index.vue 12 KB

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