index.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <!--
  2. * @Author: your name
  3. * @Date: 2025-07-24 17:13:23
  4. * @LastEditTime: 2025-08-01 09:25:38
  5. * @LastEditors: bogon
  6. * @Description: In User Settings Edit
  7. * @FilePath: /performance-test/src/views/overview/components/yaw_error4/index.vue
  8. -->
  9. <template>
  10. <div class="type-variable">
  11. <!-- 偏航余压--只有分图不存在总图 -->
  12. <div class="left">
  13. <FilterChart
  14. :setUpimg="[]"
  15. :isShowEngList="false"
  16. :windList="windEngineGroupList"
  17. @getEnfineList="getEnfineList"
  18. @handlePrevious="handlePrevious"
  19. @handleNext="handleNext"
  20. ></FilterChart>
  21. <el-alert type="info" :closable="false">
  22. <template v-slot:title>
  23. <div style="display: flex; align-items: center">
  24. <i
  25. class="el-icon-info"
  26. style="font-size: 20px; margin-right: 5px"
  27. ></i>
  28. <h3>分析说明:</h3>
  29. </div>
  30. </template>
  31. <div style="font-size: 12px; margin-top: 10px">
  32. 通过分析偏航系统残余压力值,可评估机组偏航余压是否满足设要求,既避免因余压不足导致偏航不稳,也防止余压过大增加偏航阻力与能耗,最终导致结构受损。
  33. </div>
  34. </el-alert>
  35. <div class="titleCharts">分析总图 :</div>
  36. <VirtualList
  37. :list="generalFilesDatas"
  38. keyField="fileAddr"
  39. :itemSize="452"
  40. v-slot="{ item, index }"
  41. >
  42. <BoxLineCharts
  43. :setUpImgData="setUpImgData"
  44. :key="item.batchCode + index"
  45. :index="item.batchCode + index"
  46. :ref="item.batchCode + index"
  47. :fileAddr="item.fileAddr"
  48. >
  49. </BoxLineCharts>
  50. </VirtualList>
  51. <el-dialog
  52. v-if="isShowDescription"
  53. title="添加评论"
  54. :visible="isShow"
  55. width="30%"
  56. v-dialogDrag
  57. :modal="false"
  58. :lock-scroll="false"
  59. :modal-append-to-body="false"
  60. @close="handleClose"
  61. >
  62. <el-tabs value="first">
  63. <el-tab-pane label="意见描述" name="first">
  64. <TinymceEditor
  65. ref="editor"
  66. v-model="comment"
  67. @input="handleEditorInput($event)"
  68. @onClick="onClick"
  69. >
  70. </TinymceEditor>
  71. </el-tab-pane>
  72. </el-tabs>
  73. <el-row
  74. type="flex"
  75. class="row-bg"
  76. justify="end"
  77. style="margin: 20px 60px 0 0"
  78. >
  79. <el-col :span="2">
  80. <el-button type="primary" size="small" @click="handleComment"
  81. >提交评论</el-button
  82. >
  83. </el-col>
  84. </el-row>
  85. </el-dialog>
  86. </div>
  87. <div class="right" v-if="isShowTinymceEditorCom">
  88. <DicCard
  89. :batchCode="initBatchCode"
  90. :analysisTypeCode="analysisTypeCode"
  91. :commentDescriptionVos="commentDescriptionVos"
  92. >
  93. </DicCard>
  94. </div>
  95. </div>
  96. </template>
  97. <script>
  98. import DicCard from "@/views/overview/components/dicCard/index.vue";
  99. import FilterChart from "@/views/overview/components/filterChart/index.vue";
  100. import BoxLineCharts from "@/views/performance/components/chartsCom/BoxLineCharts.vue";
  101. import TinymceEditor from "@/components/Tinymce.vue";
  102. import {
  103. analysisDetail,
  104. queryAnalysisedEngine,
  105. analysisCommentEdit,
  106. } from "@/api/performance";
  107. export default {
  108. name: "ratedPowerWindspeed",
  109. components: {
  110. DicCard,
  111. FilterChart,
  112. BoxLineCharts,
  113. TinymceEditor,
  114. },
  115. props: {
  116. initBatchCode: {
  117. default: "",
  118. type: String,
  119. },
  120. isShowTinymceEditorCom: {
  121. default: true,
  122. type: Boolean,
  123. },
  124. isShow: {
  125. default: false,
  126. type: Boolean,
  127. },
  128. analysisTypeCode: {
  129. default: "",
  130. type: String,
  131. },
  132. batchCodeList: {
  133. default: "",
  134. type: Array,
  135. },
  136. },
  137. data() {
  138. return {
  139. form: {
  140. value2: "",
  141. },
  142. setUpImgData: [],
  143. windEngineGroupList: [], //批次风机列表
  144. fieldEngineCodes: [], //选中风机
  145. comment: "",
  146. options: [],
  147. generalFilesDatas: [], //总图
  148. diagramRelationsDatas: [], //分图,
  149. commentDescriptionVos: [], //评论列表
  150. editableTabs: [],
  151. isShowDescription: false,
  152. };
  153. },
  154. watch: {
  155. initBatchCode(newVal) {
  156. if (newVal) {
  157. this.fetchData(); // 调用合并后的函数
  158. }
  159. },
  160. analysisTypeCode(newVal) {
  161. if (newVal) {
  162. this.fetchData(); // 调用合并后的函数
  163. }
  164. },
  165. isShow() {
  166. if (this.isShow) {
  167. if (!this.isShowDescription) {
  168. this.$message({
  169. message: "当前分析模型暂无分析,不能进行评论操作",
  170. type: "warning",
  171. });
  172. this.$emit("setIsShow");
  173. }
  174. }
  175. },
  176. },
  177. mounted() {
  178. if (this.initBatchCode && this.analysisTypeCode) {
  179. this.fetchData(); // 调用合并后的函数
  180. }
  181. },
  182. methods: {
  183. handleClose() {
  184. //关闭评论弹框
  185. this.$emit("setIsShow");
  186. },
  187. async handleComment() {
  188. try {
  189. await analysisCommentEdit({
  190. batchCode: this.initBatchCode,
  191. analysisTypeCode: this.analysisTypeCode,
  192. commentList: this.editableTabs.map((item) => {
  193. return {
  194. commentTypeCode: item.commentTypeCode,
  195. comment: item.commentTypeName === "分析评论" ? this.comment : "",
  196. };
  197. }),
  198. });
  199. this.$message({
  200. type: "success",
  201. message: "保存成功",
  202. });
  203. this.comment = "";
  204. this.getAnalysisDetail();
  205. this.$emit("setIsShow");
  206. } catch (e) {
  207. console.error(e);
  208. this.loading = false;
  209. }
  210. },
  211. onSubmit() {
  212. console.log("submit!");
  213. },
  214. // 合并后的函数,处理数据请求
  215. async fetchData() {
  216. try {
  217. // 获取分析详情
  218. await this.getAnalysisDetail();
  219. // 获取风机列表
  220. await this.getWindEnfineList(this.initBatchCode, this.analysisTypeCode);
  221. } catch (err) {
  222. console.error("Failed to fetch data:", err);
  223. }
  224. },
  225. // 获取分析详情接口
  226. async getAnalysisDetail() {
  227. try {
  228. const result = await analysisDetail({
  229. batchCode: this.initBatchCode,
  230. analysisTypeCode: this.analysisTypeCode,
  231. fieldEngineCodes:
  232. this.fieldEngineCodes.length === 0
  233. ? undefined
  234. : this.fieldEngineCodes.join(","),
  235. });
  236. if (result.data.length > 0) {
  237. this.isShowDescription = true;
  238. }
  239. if (
  240. result.data &&
  241. result.data[0] &&
  242. result.data[0].commentTypeRelations
  243. ) {
  244. this.editableTabs = result.data[0].commentTypeRelations;
  245. }
  246. //当前评论展示获取
  247. if (
  248. result.data &&
  249. result.data[0] &&
  250. result.data[0].commentDescriptionVos
  251. ) {
  252. this.commentDescriptionVos = result.data[0].commentDescriptionVos;
  253. }
  254. this.generalFilesDatas =
  255. (result.data &&
  256. result.data[0] &&
  257. result.data[0].generalFiles &&
  258. result.data[0].generalFiles.filter((item) =>
  259. item.fileAddr.endsWith(".json")
  260. )) ||
  261. []; //总图数据
  262. this.diagramRelationsDatas =
  263. (result.data &&
  264. result.data[0] &&
  265. result.data[0].diagramRelations &&
  266. result.data[0].diagramRelations.filter((item) =>
  267. item.fileAddr.endsWith(".json")
  268. )) ||
  269. [];
  270. console.log(this.generalFilesDatas, "this.generalFilesDatas");
  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, setUpImg) {
  290. this.fieldEngineCodes = data;
  291. this.setUpImgData = [...setUpImg];
  292. this.getAnalysisDetail();
  293. },
  294. //下一条
  295. handleNext() {
  296. const index = this.batchCodeList.findIndex(
  297. (item) => item === this.initBatchCode
  298. );
  299. if (index === this.batchCodeList.length - 1) {
  300. this.$message.warning("已经是最后一个分析结果了");
  301. return;
  302. }
  303. this.$emit("setInitBathCode", this.batchCodeList[index + 1]);
  304. },
  305. //上一条
  306. handlePrevious() {
  307. const index = this.batchCodeList.findIndex(
  308. (item) => item === this.initBatchCode
  309. );
  310. if (index === 0) {
  311. this.$message.warning("没有上一条了");
  312. return;
  313. }
  314. this.$emit("setInitBathCode", this.batchCodeList[index - 1]);
  315. },
  316. onClick() {},
  317. },
  318. };
  319. </script>
  320. <style scoped lang="scss">
  321. .type-variable {
  322. display: flex;
  323. height: 90%;
  324. overflow: hidden;
  325. .left {
  326. width: 30%;
  327. height: 100%;
  328. overflow: auto;
  329. padding: 20px;
  330. flex: 1;
  331. /* 滚动条整体样式 */
  332. &::-webkit-scrollbar {
  333. width: 6px; /* 滚动条宽度 */
  334. }
  335. /* 滚动条轨道 */
  336. &::-webkit-scrollbar-track {
  337. background: #f5f7fa;
  338. border-radius: 3px;
  339. }
  340. /* 滚动条滑块 */
  341. &::-webkit-scrollbar-thumb {
  342. background: #c0c4cc;
  343. border-radius: 3px;
  344. }
  345. /* 滚动条滑块悬停时 */
  346. &::-webkit-scrollbar-thumb:hover {
  347. background: #909399;
  348. }
  349. }
  350. .right {
  351. width: 0px;
  352. height: 100%;
  353. overflow: hidden;
  354. }
  355. }
  356. .el-dialog__wrapper {
  357. position: relative !important;
  358. }
  359. ::v-deep .el-dialog {
  360. position: fixed !important;
  361. z-index: 999 !important;
  362. top: 50%;
  363. left: 50%;
  364. transform: translate(0, -50%);
  365. }
  366. .titleCharts {
  367. font-size: 16px;
  368. font-weight: 500;
  369. margin-top: 20px;
  370. }
  371. </style>