index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <!--
  2. * @Author: your name
  3. * @Date: 2025-01-21 10:00:25
  4. * @LastEditTime: 2025-01-21 16:12:04
  5. * @LastEditors: bogon
  6. * @Description: In User Settings Edit
  7. * @FilePath: /performance-test/src/views/overview/components/temperature_large_components_low/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-tabs value="first" v-if="isShowDescription">
  79. <el-tab-pane label="意见描述" name="first">
  80. <TinymceEditor
  81. ref="editor"
  82. v-model="comment"
  83. @input="handleEditorInput($event)"
  84. @onClick="onClick"
  85. >
  86. </TinymceEditor>
  87. </el-tab-pane>
  88. </el-tabs>
  89. <el-row type="flex" class="row-bg" justify="end" v-if="isShowDescription">
  90. <el-col :span="2" style="margin: 20px">
  91. <el-button type="primary" size="small" @click="handleComment"
  92. >提交评论</el-button
  93. >
  94. </el-col>
  95. </el-row>
  96. </div>
  97. <div class="right">
  98. <DicCard
  99. :batchCode="initBatchCode"
  100. :analysisTypeCode="analysisTypeCode"
  101. :commentDescriptionVos="commentDescriptionVos"
  102. >
  103. </DicCard>
  104. </div>
  105. </div>
  106. </template>
  107. <script>
  108. import DicCard from "@/views/overview/components/dicCard/index.vue";
  109. import FilterChart from "@/views/overview/components/filterChart/index.vue";
  110. import lineAndChildLine from "@/views/performance/components/chartsCom/lineAndChildLine.vue";
  111. import lineChartsFen from "@/views/performance/components/chartsCom/lineChartsFen.vue";
  112. import TinymceEditor from "@/components/Tinymce.vue";
  113. import {
  114. analysisDetail,
  115. queryAnalysisedEngine,
  116. analysisCommentEdit,
  117. } from "@/api/performance";
  118. export default {
  119. name: "temperature_large_components_low",
  120. components: {
  121. DicCard,
  122. FilterChart,
  123. lineAndChildLine,
  124. lineChartsFen,
  125. TinymceEditor,
  126. },
  127. props: {
  128. initBatchCode: {
  129. default: "",
  130. type: String,
  131. },
  132. analysisTypeCode: {
  133. default: "",
  134. type: String,
  135. },
  136. batchCodeList: {
  137. default: "",
  138. type: Array,
  139. },
  140. },
  141. data() {
  142. return {
  143. form: {
  144. value2: "",
  145. },
  146. comment: "",
  147. options: [],
  148. windEngineGroupList: [], //批次风机列表
  149. fieldEngineCodes: [], //选中风机
  150. generalFilesDatas: [], //总图
  151. diagramRelationsDatas: [], //分图
  152. commentDescriptionVos: [], //评论列表
  153. editableTabs: [],
  154. isShowDescription: false,
  155. };
  156. },
  157. watch: {
  158. initBatchCode(newVal) {
  159. if (newVal) {
  160. this.fetchData(); // 调用合并后的函数
  161. }
  162. },
  163. analysisTypeCode(newVal) {
  164. if (newVal) {
  165. this.fetchData(); // 调用合并后的函数
  166. }
  167. },
  168. },
  169. mounted() {
  170. if (this.initBatchCode && this.analysisTypeCode) {
  171. this.fetchData(); // 调用合并后的函数
  172. }
  173. },
  174. methods: {
  175. async handleComment() {
  176. try {
  177. await analysisCommentEdit({
  178. batchCode: this.initBatchCode,
  179. analysisTypeCode: "temperature_large_components",
  180. commentList: this.editableTabs.map((item) => {
  181. return {
  182. commentTypeCode: item.commentTypeCode,
  183. comment: item.commentTypeName === "分析评论" ? this.comment : "",
  184. };
  185. }),
  186. });
  187. this.$message({
  188. type: "success",
  189. message: "保存成功",
  190. });
  191. this.comment = "";
  192. this.getAnalysisDetail();
  193. } catch (e) {
  194. console.error(e);
  195. this.loading = false;
  196. }
  197. },
  198. onSubmit() {
  199. console.log("submit!");
  200. },
  201. // 合并后的函数,处理数据请求
  202. async fetchData() {
  203. try {
  204. // 获取分析详情
  205. await this.getAnalysisDetail();
  206. // 获取风机列表
  207. await this.getWindEnfineList(
  208. this.initBatchCode,
  209. "temperature_large_components"
  210. );
  211. } catch (err) {
  212. console.error("Failed to fetch data:", err);
  213. }
  214. },
  215. // 获取分析详情接口
  216. async getAnalysisDetail() {
  217. try {
  218. const result = await analysisDetail({
  219. batchCode: this.initBatchCode,
  220. analysisTypeCode: "temperature_large_components",
  221. fieldEngineCodes:
  222. this.fieldEngineCodes.length === 0
  223. ? undefined
  224. : this.fieldEngineCodes.join(","),
  225. });
  226. if (result.data.length > 0) {
  227. this.isShowDescription = true;
  228. }
  229. if (
  230. result.data &&
  231. result.data[0] &&
  232. result.data[0].commentTypeRelations
  233. ) {
  234. this.editableTabs = result.data[0].commentTypeRelations;
  235. }
  236. //当前评论展示获取
  237. if (
  238. result.data &&
  239. result.data[0] &&
  240. result.data[0].commentDescriptionVos
  241. ) {
  242. this.commentDescriptionVos = result.data[0].commentDescriptionVos;
  243. }
  244. this.generalFilesDatas =
  245. (result.data &&
  246. result.data[0] &&
  247. result.data[0].generalFiles &&
  248. result.data[0].generalFiles
  249. .filter((item) => item.fileAddr.endsWith(".json"))
  250. .filter((item) =>
  251. item.fileAddr.includes(
  252. "gearbox_low_speed_shaft_bearing_temperature"
  253. )
  254. )) ||
  255. []; //总图数据
  256. this.diagramRelationsDatas =
  257. (result.data &&
  258. result.data[0] &&
  259. result.data[0].diagramRelations &&
  260. result.data[0].diagramRelations
  261. .filter((item) => item.fileAddr.endsWith(".json"))
  262. .filter((item) =>
  263. item.fileAddr.includes(
  264. "gearbox_low_speed_shaft_bearing_temperature"
  265. )
  266. )) ||
  267. [];
  268. } catch (err) {
  269. console.error("Failed to fetch analysis details:", err);
  270. }
  271. },
  272. // 请求风机列表
  273. async getWindEnfineList(batchCode, analysisTypeCode) {
  274. // console.log("请求风机列表 分钟级");
  275. const resEngineList = await queryAnalysisedEngine({
  276. batchCode: batchCode,
  277. analysisTypeCode,
  278. });
  279. this.windEngineGroupList = resEngineList.data;
  280. },
  281. handleEditorInput(index, newVal) {
  282. // 更新对应的 comment 值
  283. // 如果该功能没有实现,可以删除这个方法
  284. },
  285. //获取选中风机list
  286. getEnfineList(data) {
  287. this.fieldEngineCodes = data;
  288. this.getAnalysisDetail();
  289. },
  290. //下一条
  291. handleNext() {
  292. const index = this.batchCodeList.findIndex(
  293. (item) => item === this.initBatchCode
  294. );
  295. if (index === this.batchCodeList.length - 1) {
  296. this.$message.warning("已经是最后一个分析结果了");
  297. return;
  298. }
  299. this.$emit("setInitBathCode", this.batchCodeList[index + 1]);
  300. },
  301. //上一条
  302. handlePrevious() {
  303. const index = this.batchCodeList.findIndex(
  304. (item) => item === this.initBatchCode
  305. );
  306. if (index === 0) {
  307. this.$message.warning("没有上一条了");
  308. return;
  309. }
  310. this.$emit("setInitBathCode", this.batchCodeList[index - 1]);
  311. },
  312. onClick() {},
  313. },
  314. };
  315. </script>
  316. <style scoped lang="scss">
  317. .type-variable {
  318. display: flex;
  319. height: 90%;
  320. overflow: hidden;
  321. .left {
  322. width: 30%;
  323. height: 100%;
  324. overflow: auto;
  325. padding: 20px;
  326. flex: 1;
  327. /* 滚动条整体样式 */
  328. &::-webkit-scrollbar {
  329. width: 6px; /* 滚动条宽度 */
  330. }
  331. /* 滚动条轨道 */
  332. &::-webkit-scrollbar-track {
  333. background: #f5f7fa;
  334. border-radius: 3px;
  335. }
  336. /* 滚动条滑块 */
  337. &::-webkit-scrollbar-thumb {
  338. background: #c0c4cc;
  339. border-radius: 3px;
  340. }
  341. /* 滚动条滑块悬停时 */
  342. &::-webkit-scrollbar-thumb:hover {
  343. background: #909399;
  344. }
  345. }
  346. .right {
  347. width: 250px;
  348. height: 100%;
  349. overflow: hidden;
  350. }
  351. }
  352. .titleCharts {
  353. font-size: 16px;
  354. font-weight: 500;
  355. margin-top: 20px;
  356. }
  357. </style>