index.vue 10 KB

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