index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <!--
  2. * @Author: your name
  3. * @Date: 2025-01-21 09:58:32
  4. * @LastEditTime: 2025-02-10 14:52:53
  5. * @LastEditors: bogon
  6. * @Description: In User Settings Edit
  7. * @FilePath: /performance-test/src/views/overview/components/temperature_large_components_hig/index.vue
  8. -->
  9. <template>
  10. <div class="type-variable">
  11. <!-- 齿轮箱-高速轴温度分析 -->
  12. <div class="left">
  13. <FilterChart
  14. :windList="windEngineGroupList"
  15. @getEnfineList="getEnfineList"
  16. @handlePrevious="handlePrevious"
  17. @handleNext="handleNext"
  18. ></FilterChart>
  19. <el-alert type="info" :closable="false">
  20. <template v-slot:title>
  21. <div style="display: flex; align-items: center">
  22. <i
  23. class="el-icon-info"
  24. style="font-size: 20px; margin-right: 5px"
  25. ></i>
  26. <h3>分析说明:</h3>
  27. </div>
  28. </template>
  29. <div style="font-size: 12px; margin-top: 10px">
  30. 大部件温度分析在风电机组的运维和性能管理中扮演着极为关键的角色。以下是温度分析的几个重要作用:
  31. </div>
  32. <div style="font-size: 12px; margin-top: 10px">
  33. 1.
  34. 温度是预示机械和电气故障的早期指标之一。通过监测关键部件如齿轮箱、发电机、轴承的温度,可以及时发现异常状况。这种早期检测允许采取预防性措施,从而避免成本高昂的维修和长时间的停机。
  35. </div>
  36. <div style="font-size: 12px; margin-top: 10px">
  37. 2.
  38. 长期在高温或低温条件下运行可能会加速部件的磨损和老化。通过监控温度并据此调整运行,可以延长风电机组部件的使用寿命。
  39. </div>
  40. <div style="font-size: 12px; margin-top: 10px">
  41. 3.
  42. 温度分析是实现预测性维护的关键。通过持续监测温度变化和趋势,可以预测何时部件可能会出现问题,从而在故障发生前进行维修或更换,减少意外停机。
  43. </div>
  44. </el-alert>
  45. <div
  46. class="titleCharts"
  47. v-if="generalFilesDatas && generalFilesDatas.length > 0"
  48. >
  49. 分析总图 :
  50. </div>
  51. <el-empty description="暂无总图分析记录" v-else></el-empty>
  52. <div v-for="(item, index) in generalFilesDatas">
  53. <lineAndChildLine
  54. :key="item.batchCode + index"
  55. :index="index"
  56. :ref="item.batchCode"
  57. :fileAddr="item.fileAddr"
  58. >
  59. </lineAndChildLine>
  60. </div>
  61. <div
  62. class="titleCharts"
  63. v-if="diagramRelationsDatas && diagramRelationsDatas.length > 0"
  64. >
  65. 分析分图 :
  66. </div>
  67. <el-empty description="暂无分图分析记录" v-else></el-empty>
  68. <div v-for="(item, index) in diagramRelationsDatas">
  69. <lineChartsFen
  70. :key="item.fieldEngineCode + index"
  71. :index="index"
  72. :ref="item.fieldEngineCode"
  73. :fieldEngineCode="item.fieldEngineCode"
  74. :fileAddr="item.fileAddr"
  75. >
  76. </lineChartsFen>
  77. </div>
  78. <el-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">
  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 lineAndChildLine from "@/views/performance/components/chartsCom/lineAndChildLine.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_hig",
  137. components: {
  138. DicCard,
  139. FilterChart,
  140. lineAndChildLine,
  141. lineChartsFen,
  142. TinymceEditor,
  143. },
  144. props: {
  145. initBatchCode: {
  146. default: "",
  147. type: String,
  148. },
  149. isShow: {
  150. default: false,
  151. type: Boolean,
  152. },
  153. analysisTypeCode: {
  154. default: "",
  155. type: String,
  156. },
  157. batchCodeList: {
  158. default: "",
  159. type: Array,
  160. },
  161. },
  162. data() {
  163. return {
  164. form: {
  165. value2: "",
  166. },
  167. comment: "",
  168. options: [],
  169. windEngineGroupList: [], //批次风机列表
  170. fieldEngineCodes: [], //选中风机
  171. generalFilesDatas: [], //总图
  172. diagramRelationsDatas: [], //分图
  173. commentDescriptionVos: [], //评论列表
  174. editableTabs: [],
  175. isShowDescription: false,
  176. };
  177. },
  178. watch: {
  179. initBatchCode(newVal) {
  180. if (newVal) {
  181. this.fetchData(); // 调用合并后的函数
  182. }
  183. },
  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. analysisTypeCode(newVal) {
  196. if (newVal) {
  197. this.fetchData(); // 调用合并后的函数
  198. }
  199. },
  200. },
  201. mounted() {
  202. if (this.initBatchCode && this.analysisTypeCode) {
  203. this.fetchData(); // 调用合并后的函数
  204. }
  205. },
  206. methods: {
  207. handleClose() {
  208. //关闭评论弹框
  209. this.$emit("setIsShow");
  210. },
  211. async handleComment() {
  212. try {
  213. await analysisCommentEdit({
  214. batchCode: this.initBatchCode,
  215. analysisTypeCode: "temperature_large_components",
  216. commentList: this.editableTabs.map((item) => {
  217. return {
  218. commentTypeCode: item.commentTypeCode,
  219. comment: item.commentTypeName === "分析评论" ? this.comment : "",
  220. };
  221. }),
  222. });
  223. this.$message({
  224. type: "success",
  225. message: "保存成功",
  226. });
  227. this.comment = "";
  228. this.getAnalysisDetail();
  229. this.$emit("setIsShow");
  230. } catch (e) {
  231. console.error(e);
  232. this.loading = false;
  233. }
  234. },
  235. onSubmit() {
  236. console.log("submit!");
  237. },
  238. // 合并后的函数,处理数据请求
  239. async fetchData() {
  240. try {
  241. // 获取分析详情
  242. await this.getAnalysisDetail();
  243. // 获取风机列表
  244. await this.getWindEnfineList(
  245. this.initBatchCode,
  246. "temperature_large_components"
  247. );
  248. } catch (err) {
  249. console.error("Failed to fetch data:", err);
  250. }
  251. },
  252. // 获取分析详情接口
  253. async getAnalysisDetail() {
  254. try {
  255. const result = await analysisDetail({
  256. batchCode: this.initBatchCode,
  257. analysisTypeCode: "temperature_large_components",
  258. fieldEngineCodes:
  259. this.fieldEngineCodes.length === 0
  260. ? undefined
  261. : this.fieldEngineCodes.join(","),
  262. });
  263. if (result.data.length > 0) {
  264. this.isShowDescription = true;
  265. }
  266. if (
  267. result.data &&
  268. result.data[0] &&
  269. result.data[0].commentTypeRelations
  270. ) {
  271. this.editableTabs = result.data[0].commentTypeRelations;
  272. }
  273. //当前评论展示获取
  274. if (
  275. result.data &&
  276. result.data[0] &&
  277. result.data[0].commentDescriptionVos
  278. ) {
  279. this.commentDescriptionVos = result.data[0].commentDescriptionVos;
  280. }
  281. this.generalFilesDatas =
  282. (result.data &&
  283. result.data[0] &&
  284. result.data[0].generalFiles &&
  285. result.data[0].generalFiles
  286. .filter((item) => item.fileAddr.endsWith(".json"))
  287. .filter((item) =>
  288. item.fileAddr.includes(
  289. "gearbox_high_speed_shaft_bearing_temperature"
  290. )
  291. )) ||
  292. []; //总图数据
  293. this.diagramRelationsDatas =
  294. (result.data &&
  295. result.data[0] &&
  296. result.data[0].diagramRelations &&
  297. result.data[0].diagramRelations
  298. .filter((item) => item.fileAddr.endsWith(".json"))
  299. .filter((item) =>
  300. item.fileAddr.includes(
  301. "gearbox_high_speed_shaft_bearing_temperature"
  302. )
  303. )) ||
  304. [];
  305. } catch (err) {
  306. console.error("Failed to fetch analysis details:", err);
  307. }
  308. },
  309. // 请求风机列表
  310. async getWindEnfineList(batchCode, analysisTypeCode) {
  311. // console.log("请求风机列表 分钟级");
  312. const resEngineList = await queryAnalysisedEngine({
  313. batchCode: batchCode,
  314. analysisTypeCode,
  315. });
  316. this.windEngineGroupList = resEngineList.data;
  317. },
  318. handleEditorInput(index, newVal) {
  319. // 更新对应的 comment 值
  320. // 如果该功能没有实现,可以删除这个方法
  321. },
  322. //获取选中风机list
  323. getEnfineList(data) {
  324. this.fieldEngineCodes = data;
  325. this.getAnalysisDetail();
  326. },
  327. //下一条
  328. handleNext() {
  329. const index = this.batchCodeList.findIndex(
  330. (item) => item === this.initBatchCode
  331. );
  332. if (index === this.batchCodeList.length - 1) {
  333. this.$message.warning("已经是最后一个分析结果了");
  334. return;
  335. }
  336. this.$emit("setInitBathCode", this.batchCodeList[index + 1]);
  337. },
  338. //上一条
  339. handlePrevious() {
  340. const index = this.batchCodeList.findIndex(
  341. (item) => item === this.initBatchCode
  342. );
  343. if (index === 0) {
  344. this.$message.warning("没有上一条了");
  345. return;
  346. }
  347. this.$emit("setInitBathCode", this.batchCodeList[index - 1]);
  348. },
  349. onClick() {},
  350. },
  351. };
  352. </script>
  353. <style scoped lang="scss">
  354. .type-variable {
  355. display: flex;
  356. height: 90%;
  357. overflow: hidden;
  358. .left {
  359. width: 30%;
  360. height: 100%;
  361. overflow: auto;
  362. padding: 20px;
  363. flex: 1;
  364. /* 滚动条整体样式 */
  365. &::-webkit-scrollbar {
  366. width: 6px; /* 滚动条宽度 */
  367. }
  368. /* 滚动条轨道 */
  369. &::-webkit-scrollbar-track {
  370. background: #f5f7fa;
  371. border-radius: 3px;
  372. }
  373. /* 滚动条滑块 */
  374. &::-webkit-scrollbar-thumb {
  375. background: #c0c4cc;
  376. border-radius: 3px;
  377. }
  378. /* 滚动条滑块悬停时 */
  379. &::-webkit-scrollbar-thumb:hover {
  380. background: #909399;
  381. }
  382. }
  383. .right {
  384. width: 250px;
  385. height: 100%;
  386. overflow: hidden;
  387. }
  388. }
  389. .el-dialog__wrapper {
  390. position: relative !important;
  391. }
  392. ::v-deep .el-dialog {
  393. position: fixed !important;
  394. z-index: 999 !important;
  395. top: 50%;
  396. left: 50%;
  397. transform: translate(0, -50%);
  398. }
  399. .titleCharts {
  400. font-size: 16px;
  401. font-weight: 500;
  402. margin-top: 20px;
  403. }
  404. </style>