index.vue 8.9 KB

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