index.vue 8.7 KB

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