index.vue 12 KB

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