index.vue 10 KB

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