index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <!--
  2. * @Author: your name
  3. * @Date: 2025-01-10 09:10:39
  4. * @LastEditTime: 2025-01-16 17:43:47
  5. * @LastEditors: bogon
  6. * @Description: In User Settings Edit
  7. * @FilePath: /performance-test/src/views/overview/components/tsr_trend/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. 分析风力发电机组的Cp值对于优化其性能和增强效率至关重要:通过测量和分析Cp,可以直观了解风机的效率。Cp值越接近贝兹极限,说明风机的设计和运行越高效。
  31. </div>
  32. <div style="font-size: 12px; margin-top: 10px">
  33. Cp的分析也是监测风机性能的重要手段。如果Cp值出现异常下降,可能预示着机械故障、叶片磨损或其他维护需求。
  34. </div>
  35. </el-alert>
  36. <VirtualList
  37. :list="diagramRelationsDatas"
  38. keyField="fieldEngineCode"
  39. :itemSize="452"
  40. v-slot="{ item, index }"
  41. >
  42. <BoxMarkersCharts
  43. :key="item.fieldEngineCode"
  44. :index="index"
  45. :ref="item.fieldEngineCode"
  46. :fileAddr="item.fileAddr"
  47. >
  48. </BoxMarkersCharts>
  49. </VirtualList>
  50. <el-tabs value="first">
  51. <el-tab-pane label="意见描述" name="first">
  52. <TinymceEditor
  53. ref="editor"
  54. v-model="comment"
  55. @input="handleEditorInput($event)"
  56. @onClick="onClick"
  57. >
  58. </TinymceEditor>
  59. </el-tab-pane>
  60. </el-tabs>
  61. <el-row type="flex" class="row-bg" justify="end">
  62. <el-col :span="2" style="margin: 20px">
  63. <el-button type="primary" size="small" @click="handleComment"
  64. >提交评论</el-button
  65. >
  66. </el-col>
  67. </el-row>
  68. </div>
  69. <div class="right">
  70. <DicCard
  71. :batchCode="initBatchCode"
  72. :analysisTypeCode="analysisTypeCode"
  73. :commentDescriptionVos="commentDescriptionVos"
  74. >
  75. </DicCard>
  76. </div>
  77. </div>
  78. </template>
  79. <script>
  80. import DicCard from "@/views/overview/components/dicCard/index.vue";
  81. import FilterChart from "@/views/overview/components/filterChart/index.vue";
  82. import BoxMarkersCharts from "@/views/performance/components/chartsCom/BoxMarkersCharts.vue";
  83. import TinymceEditor from "@/components/Tinymce.vue";
  84. import { analysisDetail, queryAnalysisedEngine } from "@/api/performance";
  85. export default {
  86. name: "tsrTrend",
  87. components: {
  88. DicCard,
  89. FilterChart,
  90. BoxMarkersCharts,
  91. TinymceEditor,
  92. },
  93. props: {
  94. initBatchCode: {
  95. default: "",
  96. type: String,
  97. },
  98. analysisTypeCode: {
  99. default: "",
  100. type: String,
  101. },
  102. batchCodeList: {
  103. default: "",
  104. type: Array,
  105. },
  106. },
  107. data() {
  108. return {
  109. form: {
  110. value2: "",
  111. },
  112. windEngineGroupList: [], //批次风机列表
  113. fieldEngineCodes: [], //选中风机
  114. comment: "",
  115. options: [],
  116. generalFilesDatas: [], //总图
  117. diagramRelationsDatas: [], //分图,
  118. commentDescriptionVos: [], //评论列表
  119. editableTabs: [],
  120. };
  121. },
  122. watch: {
  123. initBatchCode(newVal) {
  124. if (newVal) {
  125. this.fetchData(); // 调用合并后的函数
  126. }
  127. },
  128. analysisTypeCode(newVal) {
  129. if (newVal) {
  130. this.fetchData(); // 调用合并后的函数
  131. }
  132. },
  133. },
  134. mounted() {
  135. if (this.initBatchCode && this.analysisTypeCode) {
  136. this.fetchData(); // 调用合并后的函数
  137. }
  138. },
  139. methods: {
  140. async handleComment() {
  141. try {
  142. await analysisCommentEdit({
  143. batchCode: this.initBatchCode,
  144. analysisTypeCode: this.analysisTypeCode,
  145. commentList: this.editableTabs.map((item) => {
  146. return {
  147. commentTypeCode: item.commentTypeCode,
  148. comment: item.commentTypeName === "分析评论" ? this.comment : "",
  149. };
  150. }),
  151. });
  152. this.$message({
  153. type: "success",
  154. message: "保存成功",
  155. });
  156. this.comment = "";
  157. this.getAnalysisDetail();
  158. } catch (e) {
  159. console.error(e);
  160. this.loading = false;
  161. }
  162. },
  163. onSubmit() {
  164. console.log("submit!");
  165. },
  166. // 合并后的函数,处理数据请求
  167. async fetchData() {
  168. try {
  169. console.log(
  170. this.initBatchCode,
  171. this.analysisTypeCode,
  172. "请求详情 分钟级"
  173. );
  174. // 获取分析详情
  175. await this.getAnalysisDetail();
  176. // 获取风机列表
  177. await this.getWindEnfineList(this.initBatchCode, this.analysisTypeCode);
  178. } catch (err) {
  179. console.error("Failed to fetch data:", err);
  180. }
  181. },
  182. // 获取分析详情接口
  183. async getAnalysisDetail() {
  184. try {
  185. const result = await analysisDetail({
  186. batchCode: this.initBatchCode,
  187. analysisTypeCode: this.analysisTypeCode,
  188. fieldEngineCodes:
  189. this.fieldEngineCodes.length === 0
  190. ? undefined
  191. : this.fieldEngineCodes.join(","),
  192. });
  193. if (
  194. result.data &&
  195. result.data[0] &&
  196. result.data[0].commentTypeRelations
  197. ) {
  198. this.editableTabs = result.data[0].commentTypeRelations;
  199. }
  200. //当前评论展示获取
  201. if (
  202. result.data &&
  203. result.data[0] &&
  204. result.data[0].commentDescriptionVos
  205. ) {
  206. this.commentDescriptionVos = result.data[0].commentDescriptionVos;
  207. }
  208. this.generalFilesDatas =
  209. result.data &&
  210. result.data[0] &&
  211. result.data[0].generalFiles &&
  212. result.data[0].generalFiles.filter((item) =>
  213. item.fileAddr.endsWith(".json")
  214. ); //总图数据
  215. this.diagramRelationsDatas =
  216. result.data &&
  217. result.data[0] &&
  218. result.data[0].diagramRelations.filter((item) =>
  219. item.fileAddr.endsWith(".json")
  220. );
  221. } catch (err) {
  222. console.error("Failed to fetch analysis details:", err);
  223. }
  224. },
  225. // 请求风机列表
  226. async getWindEnfineList(batchCode, analysisTypeCode) {
  227. // console.log("请求风机列表 分钟级");
  228. const resEngineList = await queryAnalysisedEngine({
  229. batchCode: batchCode,
  230. analysisTypeCode,
  231. });
  232. this.windEngineGroupList = resEngineList.data;
  233. },
  234. handleEditorInput(index, newVal) {
  235. // 更新对应的 comment 值
  236. // 如果该功能没有实现,可以删除这个方法
  237. },
  238. //获取选中风机list
  239. getEnfineList(data) {
  240. this.fieldEngineCodes = data;
  241. this.getAnalysisDetail();
  242. console.log(this.fieldEngineCodes, "this.fieldEngineCodes");
  243. },
  244. //下一条
  245. handleNext() {
  246. const index = this.batchCodeList.findIndex(
  247. (item) => item === this.initBatchCode
  248. );
  249. if (index === this.batchCodeList.length - 1) {
  250. this.$message.warning("已经是最后一个分析结果了");
  251. return;
  252. }
  253. this.$emit("setInitBathCode", this.batchCodeList[index + 1]);
  254. },
  255. //上一条
  256. handlePrevious() {
  257. const index = this.batchCodeList.findIndex(
  258. (item) => item === this.initBatchCode
  259. );
  260. if (index === 0) {
  261. this.$message.warning("没有上一条了");
  262. return;
  263. }
  264. this.$emit("setInitBathCode", this.batchCodeList[index - 1]);
  265. },
  266. onClick() {},
  267. },
  268. };
  269. </script>
  270. <style scoped lang="scss">
  271. .type-variable {
  272. display: flex;
  273. height: 90%;
  274. overflow: hidden;
  275. .left {
  276. width: 30%;
  277. height: 100%;
  278. overflow: auto;
  279. padding: 20px;
  280. flex: 1;
  281. }
  282. .right {
  283. width: 250px;
  284. height: 100%;
  285. overflow: hidden;
  286. }
  287. }
  288. </style>