index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <!--
  2. * @Author: your name
  3. * @Date: 2025-01-10 09:26:12
  4. * @LastEditTime: 2025-01-16 09:06:36
  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. <div class="charts" v-if="diagramRelationsDatas">
  34. <template v-for="(itemChart, indChart) in diagramRelationsDatas">
  35. <TwoDMarkersChart
  36. :key="itemChart.fieldEngineCode"
  37. @getResult="getResult"
  38. @changeRequestNum="changeRequestNum"
  39. :result="requestResult"
  40. :index="indChart"
  41. :ref="itemChart.fieldEngineCode"
  42. :fileAddr="itemChart.fileAddr"
  43. >
  44. </TwoDMarkersChart>
  45. </template>
  46. </div>
  47. <el-empty description="暂无分析记录" v-else></el-empty>
  48. <el-tabs value="first">
  49. <el-tab-pane label="意见描述" name="first">
  50. <TinymceEditor
  51. ref="editor"
  52. v-model="comment"
  53. @input="handleEditorInput($event)"
  54. @onClick="onClick"
  55. >
  56. </TinymceEditor>
  57. </el-tab-pane>
  58. </el-tabs>
  59. <el-row type="flex" class="row-bg" justify="end">
  60. <el-col :span="2" style="margin: 20px">
  61. <el-button type="primary" size="small">提交评论</el-button>
  62. </el-col>
  63. </el-row>
  64. </div>
  65. <div class="right">
  66. <DicCard
  67. :batchCode="initBatchCode"
  68. :analysisTypeCode="analysisTypeCode"
  69. :commentDescriptionVos="commentDescriptionVos"
  70. >
  71. </DicCard>
  72. </div>
  73. </div>
  74. </template>
  75. <script>
  76. import DicCard from "@/views/overview/components/dicCard/index.vue";
  77. import FilterChart from "@/views/overview/components/filterChart/index.vue";
  78. import TwoDMarkersChart from "@/views/performance/components/chartsCom/TwoDMarkersChart.vue";
  79. import TinymceEditor from "@/components/Tinymce.vue";
  80. import { analysisDetail, queryAnalysisedEngine } from "@/api/performance";
  81. export default {
  82. name: "yaw_error_density",
  83. components: {
  84. DicCard,
  85. FilterChart,
  86. TwoDMarkersChart,
  87. TinymceEditor,
  88. },
  89. props: {
  90. initBatchCode: {
  91. default: "",
  92. type: String,
  93. },
  94. analysisTypeCode: {
  95. default: "",
  96. type: String,
  97. },
  98. batchCodeList: {
  99. default: "",
  100. type: Array,
  101. },
  102. },
  103. data() {
  104. return {
  105. form: {
  106. value2: "",
  107. },
  108. windEngineGroupList: [], //批次风机列表
  109. fieldEngineCodes: [], //选中风机
  110. comment: "",
  111. options: [],
  112. generalFilesDatas: [], //总图
  113. diagramRelationsDatas: [], //分图,
  114. requestResult: [], // 请求结果
  115. requestRecord: [],
  116. commentDescriptionVos: [], //评论列表
  117. };
  118. },
  119. watch: {
  120. initBatchCode(newVal) {
  121. if (newVal) {
  122. this.fetchData(); // 调用合并后的函数
  123. }
  124. },
  125. analysisTypeCode(newVal) {
  126. if (newVal) {
  127. this.fetchData(); // 调用合并后的函数
  128. }
  129. },
  130. },
  131. mounted() {
  132. if (this.initBatchCode && this.analysisTypeCode) {
  133. this.fetchData(); // 调用合并后的函数
  134. }
  135. },
  136. methods: {
  137. getResult({ index, result }) {
  138. console.log(index, result);
  139. this.$set(this.requestResult, index, result);
  140. // this.requestResult[index] = result
  141. this.requestRecord[index] = result;
  142. },
  143. changeRequestNum(index) {
  144. if (index <= 1) {
  145. this.$set(this.requestRecord, index, "start");
  146. return;
  147. }
  148. if (index > 1) {
  149. if (
  150. this.requestRecord.every((item) =>
  151. ["success", "error"].includes(item)
  152. )
  153. ) {
  154. this.$set(this.requestRecord, index, "start");
  155. this.$set(this.requestResult, index, "start");
  156. } else {
  157. this.$set(this.requestRecord, index, "start");
  158. }
  159. }
  160. },
  161. onSubmit() {
  162. console.log("submit!");
  163. },
  164. // 合并后的函数,处理数据请求
  165. async fetchData() {
  166. try {
  167. console.log(
  168. this.initBatchCode,
  169. this.analysisTypeCode,
  170. "请求详情 分钟级"
  171. );
  172. // 获取分析详情
  173. await this.getAnalysisDetail();
  174. // 获取风机列表
  175. await this.getWindEnfineList(this.initBatchCode, this.analysisTypeCode);
  176. } catch (err) {
  177. console.error("Failed to fetch data:", err);
  178. }
  179. },
  180. // 获取分析详情接口
  181. async getAnalysisDetail() {
  182. try {
  183. const result = await analysisDetail({
  184. batchCode: this.initBatchCode,
  185. analysisTypeCode: this.analysisTypeCode,
  186. fieldEngineCodes:
  187. this.fieldEngineCodes.length === 0
  188. ? undefined
  189. : this.fieldEngineCodes,
  190. });
  191. //当前评论展示获取
  192. if (
  193. result.data &&
  194. result.data[0] &&
  195. result.data[0].commentDescriptionVos
  196. ) {
  197. this.commentDescriptionVos = result.data[0].commentDescriptionVos;
  198. }
  199. this.generalFilesDatas =
  200. result.data && result.data[0] && result.data[0].generalFiles; //总图数据
  201. this.diagramRelationsDatas =
  202. result.data && result.data[0] && result.data[0].diagramRelations;
  203. } catch (err) {
  204. console.error("Failed to fetch analysis details:", err);
  205. }
  206. },
  207. // 请求风机列表
  208. async getWindEnfineList(batchCode, analysisTypeCode) {
  209. // console.log("请求风机列表 分钟级");
  210. const resEngineList = await queryAnalysisedEngine({
  211. batchCode: batchCode,
  212. analysisTypeCode,
  213. });
  214. this.windEngineGroupList = resEngineList.data;
  215. },
  216. handleEditorInput(index, newVal) {
  217. // 更新对应的 comment 值
  218. // 如果该功能没有实现,可以删除这个方法
  219. },
  220. //获取选中风机list
  221. getEnfineList(data) {
  222. this.fieldEngineCodes = data;
  223. console.log(this.fieldEngineCodes, "this.fieldEngineCodes");
  224. },
  225. //下一条
  226. handleNext() {
  227. const index = this.batchCodeList.findIndex(
  228. (item) => item === this.initBatchCode
  229. );
  230. if (index === this.batchCodeList.length - 1) {
  231. this.$message.warning("已经是最后一个分析结果了");
  232. return;
  233. }
  234. this.$emit("setInitBathCode", this.batchCodeList[index + 1]);
  235. },
  236. //上一条
  237. handlePrevious() {
  238. const index = this.batchCodeList.findIndex(
  239. (item) => item === this.initBatchCode
  240. );
  241. if (index === 0) {
  242. this.$message.warning("没有上一条了");
  243. return;
  244. }
  245. this.$emit("setInitBathCode", this.batchCodeList[index - 1]);
  246. },
  247. onClick() {},
  248. },
  249. };
  250. </script>
  251. <style scoped lang="scss">
  252. .type-variable {
  253. display: flex;
  254. height: 90%;
  255. overflow: hidden;
  256. .left {
  257. width: 30%;
  258. height: 100%;
  259. overflow: auto;
  260. padding: 20px;
  261. flex: 1;
  262. }
  263. .right {
  264. width: 250px;
  265. height: 100%;
  266. overflow: hidden;
  267. }
  268. }
  269. </style>