index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <template>
  2. <div class="type-variable">
  3. <!-- 动态偏航误差分析--只有分图不存在总图 -->
  4. <div class="left">
  5. <FilterChart
  6. :setUpimg="[]"
  7. :windList="windEngineGroupList"
  8. @getEnfineList="getEnfineList"
  9. @handlePrevious="handlePrevious"
  10. @handleNext="handleNext"
  11. ></FilterChart>
  12. <el-alert type="info" :closable="false">
  13. <template v-slot:title>
  14. <div style="display: flex; align-items: center">
  15. <i
  16. class="el-icon-info"
  17. style="font-size: 20px; margin-right: 5px"
  18. ></i>
  19. <h3>分析说明:</h3>
  20. </div>
  21. </template>
  22. <div style="font-size: 12px; margin-top: 10px">
  23. 动态偏航误差分析是对机组偏航对风角度的分布情况进行统计及可视化展示,对风角度分布对称性较差的机组需要关注其偏航系统对风异常原因。
  24. </div>
  25. </el-alert>
  26. <VirtualList
  27. :list="diagramRelationsDatas"
  28. keyField="fileAddr"
  29. :itemSize="600"
  30. v-slot="{ item, index }"
  31. >
  32. <lineAndChildLine
  33. v-if="getFileTypeFromUrl(item.fileAddr) === 'PDF-'"
  34. :setUpImgData="setUpImgData"
  35. :key="item.fieldEngineCode + index"
  36. :index="`${new Date().getTime()}` + index + item.fieldEngineCode"
  37. :ref="item.fieldEngineCode"
  38. :fileAddr="item.fileAddr"
  39. >
  40. </lineAndChildLine>
  41. <ColorbarInitTwoDmarkersChart
  42. v-else
  43. :setUpImgData="setUpImgData"
  44. :key="item.fieldEngineCode + index"
  45. :ref="item.fieldEngineCode + index"
  46. :index="index + item.fieldEngineCode"
  47. :fileAddr="item.fileAddr"
  48. >
  49. </ColorbarInitTwoDmarkersChart>
  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 ColorbarInitTwoDmarkersChart from "@/views/performance/components/chartsCom/ColorbarInitTwoDmarkersChart.vue";
  101. import TinymceEditor from "@/components/Tinymce.vue";
  102. import lineAndChildLine from "@/views/performance/components/chartsCom/lineAndChildLine.vue";
  103. import {
  104. analysisDetail,
  105. queryAnalysisedEngine,
  106. analysisCommentEdit,
  107. } from "@/api/performance";
  108. export default {
  109. name: "yaw_error_density",
  110. components: {
  111. DicCard,
  112. FilterChart,
  113. TinymceEditor,
  114. ColorbarInitTwoDmarkersChart,
  115. lineAndChildLine,
  116. },
  117. props: {
  118. initBatchCode: {
  119. default: "",
  120. type: String,
  121. },
  122. isShowTinymceEditorCom: {
  123. default: true,
  124. type: Boolean,
  125. },
  126. analysisTypeCode: {
  127. default: "",
  128. type: String,
  129. },
  130. batchCodeList: {
  131. default: "",
  132. type: Array,
  133. },
  134. isShow: {
  135. default: false,
  136. type: Boolean,
  137. },
  138. },
  139. data() {
  140. return {
  141. form: {
  142. value2: "",
  143. },
  144. setUpImgData: [],
  145. windEngineGroupList: [], //批次风机列表
  146. fieldEngineCodes: [], //选中风机
  147. comment: "",
  148. options: [],
  149. generalFilesDatas: [], //总图
  150. diagramRelationsDatas: [], //分图,
  151. requestResult: [], // 请求结果
  152. requestRecord: [],
  153. commentDescriptionVos: [], //评论列表
  154. editableTabs: [],
  155. isShowDescription: false,
  156. };
  157. },
  158. watch: {
  159. isShow() {
  160. if (this.isShow) {
  161. if (!this.isShowDescription) {
  162. this.$message({
  163. message: "当前分析模型暂无分析,不能进行评论操作",
  164. type: "warning",
  165. });
  166. this.$emit("setIsShow");
  167. }
  168. }
  169. },
  170. initBatchCode(newVal) {
  171. if (newVal) {
  172. this.fetchData(); // 调用合并后的函数
  173. }
  174. },
  175. analysisTypeCode(newVal) {
  176. if (newVal) {
  177. this.fetchData(); // 调用合并后的函数
  178. }
  179. },
  180. },
  181. mounted() {
  182. if (this.initBatchCode && this.analysisTypeCode) {
  183. this.fetchData(); // 调用合并后的函数
  184. }
  185. },
  186. methods: {
  187. handleClose() {
  188. //关闭评论弹框
  189. this.$emit("setIsShow");
  190. },
  191. async handleComment() {
  192. try {
  193. await analysisCommentEdit({
  194. batchCode: this.initBatchCode,
  195. analysisTypeCode: this.analysisTypeCode,
  196. commentList: this.editableTabs.map((item) => {
  197. return {
  198. commentTypeCode: item.commentTypeCode,
  199. comment: item.commentTypeName === "分析评论" ? this.comment : "",
  200. };
  201. }),
  202. });
  203. this.$message({
  204. type: "success",
  205. message: "保存成功",
  206. });
  207. this.comment = "";
  208. this.getAnalysisDetail();
  209. this.$emit("setIsShow");
  210. } catch (e) {
  211. console.error(e);
  212. this.loading = false;
  213. }
  214. },
  215. onSubmit() {
  216. console.log("submit!");
  217. },
  218. // 合并后的函数,处理数据请求
  219. async fetchData() {
  220. try {
  221. // 获取分析详情
  222. await this.getAnalysisDetail();
  223. // 获取风机列表
  224. await this.getWindEnfineList(this.initBatchCode, this.analysisTypeCode);
  225. } catch (err) {
  226. console.error("Failed to fetch data:", err);
  227. }
  228. },
  229. // 获取分析详情接口
  230. async getAnalysisDetail() {
  231. try {
  232. const result = await analysisDetail({
  233. batchCode: this.initBatchCode,
  234. analysisTypeCode: this.analysisTypeCode,
  235. fieldEngineCodes:
  236. this.fieldEngineCodes.length === 0
  237. ? undefined
  238. : this.fieldEngineCodes.join(","),
  239. });
  240. if (result.data.length > 0) {
  241. this.isShowDescription = true;
  242. }
  243. if (
  244. result.data &&
  245. result.data[0] &&
  246. result.data[0].commentTypeRelations
  247. ) {
  248. this.editableTabs = result.data[0].commentTypeRelations;
  249. }
  250. //当前评论展示获取
  251. if (
  252. result.data &&
  253. result.data[0] &&
  254. result.data[0].commentDescriptionVos
  255. ) {
  256. this.commentDescriptionVos = result.data[0].commentDescriptionVos;
  257. }
  258. this.generalFilesDatas =
  259. (result.data &&
  260. result.data[0] &&
  261. result.data[0].generalFiles &&
  262. result.data[0].generalFiles.filter((item) =>
  263. item.fileAddr.endsWith(".json")
  264. )) ||
  265. []; //总图数据
  266. this.diagramRelationsDatas =
  267. (result.data &&
  268. result.data[0] &&
  269. result.data[0].diagramRelations &&
  270. result.data[0].diagramRelations.filter((item) =>
  271. item.fileAddr.endsWith(".json")
  272. )) ||
  273. [];
  274. } catch (err) {
  275. console.error("Failed to fetch analysis details:", err);
  276. }
  277. },
  278. // 请求风机列表
  279. async getWindEnfineList(batchCode, analysisTypeCode) {
  280. // console.log("请求风机列表 分钟级");
  281. const resEngineList = await queryAnalysisedEngine({
  282. batchCode: batchCode,
  283. analysisTypeCode,
  284. });
  285. this.windEngineGroupList = resEngineList.data;
  286. },
  287. handleEditorInput(index, newVal) {
  288. // 更新对应的 comment 值
  289. // 如果该功能没有实现,可以删除这个方法
  290. },
  291. //获取选中风机list
  292. getEnfineList(data, setUpImg) {
  293. this.fieldEngineCodes = data;
  294. this.setUpImgData = [...setUpImg];
  295. console.log("动态偏航误差", this.fieldEngineCodes);
  296. this.getAnalysisDetail();
  297. },
  298. //下一条
  299. handleNext() {
  300. const index = this.batchCodeList.findIndex(
  301. (item) => item === this.initBatchCode
  302. );
  303. if (index === this.batchCodeList.length - 1) {
  304. this.$message.warning("已经是最后一个分析结果了");
  305. return;
  306. }
  307. this.$emit("setInitBathCode", this.batchCodeList[index + 1]);
  308. },
  309. //上一条
  310. handlePrevious() {
  311. const index = this.batchCodeList.findIndex(
  312. (item) => item === this.initBatchCode
  313. );
  314. if (index === 0) {
  315. this.$message.warning("没有上一条了");
  316. return;
  317. }
  318. this.$emit("setInitBathCode", this.batchCodeList[index - 1]);
  319. },
  320. onClick() {},
  321. getFileTypeFromUrl(url) {
  322. // 判断文件名或路径是否包含关键字
  323. if (url.includes("PDF-")) {
  324. return "PDF-"; // 如果 URL 中包含 "3D" 字符串,判断为 3D 类型
  325. } else {
  326. return "Unknown"; // 如果都不包含,返回 Unknown 或其他提示
  327. }
  328. },
  329. },
  330. };
  331. </script>
  332. <style scoped lang="scss">
  333. .type-variable {
  334. display: flex;
  335. height: 90%;
  336. overflow: hidden;
  337. .left {
  338. width: 30%;
  339. height: 100%;
  340. overflow: auto;
  341. padding: 20px;
  342. flex: 1;
  343. /* 滚动条整体样式 */
  344. &::-webkit-scrollbar {
  345. width: 6px; /* 滚动条宽度 */
  346. }
  347. /* 滚动条轨道 */
  348. &::-webkit-scrollbar-track {
  349. background: #f5f7fa;
  350. border-radius: 3px;
  351. }
  352. /* 滚动条滑块 */
  353. &::-webkit-scrollbar-thumb {
  354. background: #c0c4cc;
  355. border-radius: 3px;
  356. }
  357. /* 滚动条滑块悬停时 */
  358. &::-webkit-scrollbar-thumb:hover {
  359. background: #909399;
  360. }
  361. }
  362. .right {
  363. width: 0px;
  364. height: 100%;
  365. overflow: hidden;
  366. }
  367. }
  368. .el-dialog__wrapper {
  369. position: relative !important;
  370. }
  371. ::v-deep .el-dialog {
  372. position: fixed !important;
  373. z-index: 999 !important;
  374. top: 50%;
  375. left: 50%;
  376. transform: translate(0, -50%);
  377. }
  378. </style>