index.vue 11 KB

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