index.vue 11 KB

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