index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <!--
  2. * @Author: your name
  3. * @Date: 2025-07-24 17:12:55
  4. * @LastEditTime: 2025-08-22 09:58:16
  5. * @LastEditors: bogon
  6. * @Description: In User Settings Edit
  7. * @FilePath: /performance-test/src/views/overview/components/yaw_error3/index.vue
  8. -->
  9. <template>
  10. <div class="type-variable">
  11. <!-- 偏航异常检测 -->
  12. <div class="left scroller">
  13. <FilterChart
  14. :setUpimg="['有功功率']"
  15. :windList="windEngineGroupList"
  16. @getEnfineList="getEnfineList"
  17. @handlePrevious="handlePrevious"
  18. @handleNext="handleNext"
  19. ></FilterChart>
  20. <el-alert type="info" :closable="false">
  21. <template v-slot:title>
  22. <div style="display: flex; align-items: center">
  23. <i
  24. class="el-icon-info"
  25. style="font-size: 20px; margin-right: 5px"
  26. ></i>
  27. <h3>分析说明:</h3>
  28. </div>
  29. </template>
  30. <div style="font-size: 12px; margin-top: 10px">
  31. a.偏航要求动作,角度无变化
  32. <div style="font-size: 12px; margin-top: 10px">
  33. 偏航控制及电气回路是否正常,偏航制动系统、电机抱闸是否异常;偏航传感器检测是否存在异常
  34. </div>
  35. </div>
  36. <div style="font-size: 12px; margin-top: 10px">
  37. b.偏航未要求动作,角度有变化
  38. <div style="font-size: 12px; margin-top: 10px">
  39. 偏航动作或偏航制动是否异常,是否存在滑移;偏航传感器检测是否存在异常
  40. </div>
  41. </div>
  42. </el-alert>
  43. <LineAndScatter
  44. v-if="initBatchCode === 'WOF046400029-WOB000001'"
  45. :setUpImgData="[]"
  46. key="item.batchCodeindex"
  47. index="`${new Date().getTime()}`index"
  48. ref="item.batchCode"
  49. :fileAddr="''"
  50. >
  51. </LineAndScatter>
  52. <el-empty description="暂无分析记录" v-else></el-empty>
  53. <!-- <VirtualList
  54. :list="[...generalFilesDatas, ...diagramRelationsDatas]"
  55. keyField="fileAddr"
  56. :itemSize="500"
  57. v-slot="{ item, index }"
  58. >
  59. <div
  60. class="titleCharts"
  61. v-if="
  62. generalFilesDatas &&
  63. generalFilesDatas.length > 0 &&
  64. item.engineTypeCode &&
  65. generalFilesDatas[0].engineTypeCode === item.engineTypeCode
  66. "
  67. >
  68. 分析总图 :
  69. </div>
  70. </VirtualList> -->
  71. <!-- <el-empty
  72. description="暂无分析记录"
  73. v-if="
  74. generalFilesDatas.length === 0 && diagramRelationsDatas.length === 0
  75. "
  76. ></el-empty> -->
  77. <el-dialog
  78. custom-class="overview-dialog"
  79. v-if="isShowDescription"
  80. title="添加评论"
  81. :visible="isShow"
  82. width="30%"
  83. v-dialogDrag
  84. :modal="false"
  85. :lock-scroll="false"
  86. :modal-append-to-body="false"
  87. @close="handleClose"
  88. >
  89. <el-tabs value="first">
  90. <el-tab-pane label="意见描述" name="first">
  91. <TinymceEditor
  92. ref="editor"
  93. v-model="comment"
  94. @input="handleEditorInput($event)"
  95. @onClick="onClick"
  96. >
  97. </TinymceEditor>
  98. </el-tab-pane>
  99. </el-tabs>
  100. <el-row
  101. type="flex"
  102. class="row-bg"
  103. justify="end"
  104. style="margin: 20px 60px 0 0"
  105. >
  106. <el-col :span="2">
  107. <el-button type="primary" size="small" @click="handleComment"
  108. >提交评论</el-button
  109. >
  110. </el-col>
  111. </el-row>
  112. </el-dialog>
  113. </div>
  114. <div class="right" v-if="isShowTinymceEditorCom">
  115. <DicCard
  116. :batchCode="initBatchCode"
  117. :analysisTypeCode="analysisTypeCode"
  118. :commentDescriptionVos="commentDescriptionVos"
  119. >
  120. </DicCard>
  121. </div>
  122. </div>
  123. </template>
  124. <script>
  125. import DicCard from "@/views/overview/components/dicCard/index.vue";
  126. import FilterChart from "@/views/overview/components/filterChart/index.vue";
  127. import LineAndScatter from "@/views/performance/components/chartsCom/LineAndScatter.vue";
  128. import lineChartsFen from "@/views/performance/components/chartsCom/lineChartsFen.vue";
  129. import TinymceEditor from "@/components/Tinymce.vue";
  130. import {
  131. analysisDetail,
  132. queryAnalysisedEngine,
  133. analysisCommentEdit,
  134. } from "@/api/performance";
  135. export default {
  136. name: "temperature_large_components_Winding_tem",
  137. components: {
  138. DicCard,
  139. FilterChart,
  140. LineAndScatter,
  141. lineChartsFen,
  142. TinymceEditor,
  143. },
  144. props: {
  145. initBatchCode: {
  146. default: "",
  147. type: String,
  148. },
  149. isShowTinymceEditorCom: {
  150. default: true,
  151. type: Boolean,
  152. },
  153. isShow: {
  154. default: false,
  155. type: Boolean,
  156. },
  157. analysisTypeCode: {
  158. default: "",
  159. type: String,
  160. },
  161. batchCodeList: {
  162. default: "",
  163. type: Array,
  164. },
  165. },
  166. data() {
  167. return {
  168. form: {
  169. value2: "",
  170. },
  171. setUpImgData: [],
  172. comment: "",
  173. options: [],
  174. windEngineGroupList: [], //批次风机列表
  175. fieldEngineCodes: [], //选中风机
  176. generalFilesDatas: [], //总图
  177. diagramRelationsDatas: [], //分图
  178. commentDescriptionVos: [], //评论列表
  179. editableTabs: [],
  180. isShowDescription: false,
  181. };
  182. },
  183. watch: {
  184. isShow() {
  185. if (this.isShow) {
  186. if (!this.isShowDescription) {
  187. this.$message({
  188. message: "当前分析模型暂无分析,不能进行评论操作",
  189. type: "warning",
  190. });
  191. this.$emit("setIsShow");
  192. }
  193. }
  194. },
  195. initBatchCode(newVal) {
  196. if (newVal) {
  197. this.fetchData(); // 调用合并后的函数
  198. }
  199. },
  200. analysisTypeCode(newVal) {
  201. if (newVal) {
  202. this.fetchData(); // 调用合并后的函数
  203. }
  204. },
  205. },
  206. mounted() {
  207. if (this.initBatchCode && this.analysisTypeCode) {
  208. this.fetchData(); // 调用合并后的函数
  209. }
  210. },
  211. methods: {
  212. handleClose() {
  213. //关闭评论弹框
  214. this.$emit("setIsShow");
  215. },
  216. async handleComment() {
  217. try {
  218. await analysisCommentEdit({
  219. batchCode: this.initBatchCode,
  220. analysisTypeCode: "temperature_large_components",
  221. commentList: this.editableTabs.map((item) => {
  222. return {
  223. commentTypeCode: item.commentTypeCode,
  224. comment: item.commentTypeName === "分析评论" ? this.comment : "",
  225. };
  226. }),
  227. });
  228. this.$message({
  229. type: "success",
  230. message: "保存成功",
  231. });
  232. this.comment = "";
  233. this.getAnalysisDetail();
  234. this.$emit("setIsShow");
  235. } catch (e) {
  236. console.error(e);
  237. this.loading = false;
  238. }
  239. },
  240. onSubmit() {
  241. console.log("submit!");
  242. },
  243. // 合并后的函数,处理数据请求
  244. async fetchData() {
  245. try {
  246. // 获取分析详情
  247. await this.getAnalysisDetail();
  248. // 获取风机列表
  249. await this.getWindEnfineList(
  250. this.initBatchCode,
  251. "temperature_large_components"
  252. );
  253. } catch (err) {
  254. console.error("Failed to fetch data:", err);
  255. }
  256. },
  257. // 获取分析详情接口
  258. async getAnalysisDetail() {
  259. try {
  260. const result = await analysisDetail({
  261. batchCode: this.initBatchCode,
  262. analysisTypeCode: "temperature_large_components",
  263. fieldEngineCodes:
  264. this.fieldEngineCodes.length === 0
  265. ? undefined
  266. : this.fieldEngineCodes.join(","),
  267. });
  268. if (result.data.length > 0) {
  269. this.isShowDescription = true;
  270. }
  271. if (
  272. result.data &&
  273. result.data[0] &&
  274. result.data[0].commentTypeRelations
  275. ) {
  276. this.editableTabs = result.data[0].commentTypeRelations;
  277. }
  278. //当前评论展示获取
  279. if (
  280. result.data &&
  281. result.data[0] &&
  282. result.data[0].commentDescriptionVos
  283. ) {
  284. this.commentDescriptionVos = result.data[0].commentDescriptionVos;
  285. }
  286. this.generalFilesDatas =
  287. (result.data &&
  288. result.data[0] &&
  289. result.data[0].generalFiles &&
  290. result.data[0].generalFiles
  291. .filter((item) => item.fileAddr.endsWith(".json"))
  292. .filter((item) =>
  293. item.fileAddr.includes("generator_winding1_temperature")
  294. )) ||
  295. []; //总图数据
  296. this.diagramRelationsDatas =
  297. (result.data &&
  298. result.data[0] &&
  299. result.data[0].diagramRelations &&
  300. result.data[0].diagramRelations
  301. .filter((item) => item.fileAddr.endsWith(".json"))
  302. .filter((item) =>
  303. item.fileAddr.includes("generator_winding1_temperature")
  304. )) ||
  305. [];
  306. } catch (err) {
  307. console.error("Failed to fetch analysis details:", err);
  308. }
  309. },
  310. // 请求风机列表
  311. async getWindEnfineList(batchCode, analysisTypeCode) {
  312. // console.log("请求风机列表 分钟级");
  313. const resEngineList = await queryAnalysisedEngine({
  314. batchCode: batchCode,
  315. analysisTypeCode,
  316. });
  317. this.windEngineGroupList = resEngineList.data;
  318. },
  319. handleEditorInput(index, newVal) {
  320. // 更新对应的 comment 值
  321. // 如果该功能没有实现,可以删除这个方法
  322. },
  323. //获取选中风机list
  324. getEnfineList(data, setUpImg) {
  325. this.fieldEngineCodes = data;
  326. this.setUpImgData = [...setUpImg];
  327. this.getAnalysisDetail();
  328. },
  329. //下一条
  330. handleNext() {
  331. const index = this.batchCodeList.findIndex(
  332. (item) => item === this.initBatchCode
  333. );
  334. if (index === this.batchCodeList.length - 1) {
  335. this.$message.warning("已经是最后一个分析结果了");
  336. return;
  337. }
  338. this.$emit("setInitBathCode", this.batchCodeList[index + 1]);
  339. },
  340. //上一条
  341. handlePrevious() {
  342. const index = this.batchCodeList.findIndex(
  343. (item) => item === this.initBatchCode
  344. );
  345. if (index === 0) {
  346. this.$message.warning("没有上一条了");
  347. return;
  348. }
  349. this.$emit("setInitBathCode", this.batchCodeList[index - 1]);
  350. },
  351. onClick() {},
  352. },
  353. };
  354. </script>
  355. <style scoped lang="scss">
  356. .type-variable {
  357. display: flex;
  358. height: 90%;
  359. overflow: hidden;
  360. .left {
  361. width: 30%;
  362. height: 100%;
  363. overflow: auto;
  364. padding: 20px;
  365. flex: 1;
  366. /* 滚动条整体样式 */
  367. &::-webkit-scrollbar {
  368. width: 6px; /* 滚动条宽度 */
  369. }
  370. /* 滚动条轨道 */
  371. &::-webkit-scrollbar-track {
  372. background: #f5f7fa;
  373. border-radius: 3px;
  374. }
  375. /* 滚动条滑块 */
  376. &::-webkit-scrollbar-thumb {
  377. background: #c0c4cc;
  378. border-radius: 3px;
  379. }
  380. /* 滚动条滑块悬停时 */
  381. &::-webkit-scrollbar-thumb:hover {
  382. background: #909399;
  383. }
  384. }
  385. .right {
  386. width: 0px;
  387. height: 100%;
  388. overflow: hidden;
  389. }
  390. }
  391. .el-dialog__wrapper {
  392. position: relative !important;
  393. }
  394. ::v-deep .el-dialog {
  395. position: fixed !important;
  396. z-index: 999 !important;
  397. top: 50%;
  398. left: 50%;
  399. transform: translate(0, -50%);
  400. }
  401. .titleCharts {
  402. font-size: 16px;
  403. font-weight: 500;
  404. margin-top: 20px;
  405. }
  406. </style>