index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <!--
  2. * @Author: your name
  3. * @Date: 2025-01-10 09:11:34
  4. * @LastEditTime: 2025-01-14 17:23:27
  5. * @LastEditors: bogon
  6. * @Description: In User Settings Edit
  7. * @FilePath: /performance-test/src/views/overview/components/wind_speed_frequency/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. <BarChart></BarChart>
  20. <el-tabs value="first">
  21. <el-tab-pane label="意见描述" name="first">
  22. <TinymceEditor
  23. ref="editor"
  24. v-model="comment"
  25. @input="handleEditorInput($event)"
  26. @onClick="onClick"
  27. >
  28. </TinymceEditor>
  29. </el-tab-pane>
  30. </el-tabs>
  31. <el-row type="flex" class="row-bg" justify="end">
  32. <el-col :span="2" style="margin: 20px">
  33. <el-button type="primary" size="small">提交评论</el-button>
  34. </el-col>
  35. </el-row>
  36. </div>
  37. <div class="right">
  38. <DicCard></DicCard>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import DicCard from "@/views/overview/components/dicCard/index.vue";
  44. import FilterChart from "@/views/overview/components/filterChart/index.vue";
  45. import BarChart from "@/views/performance/components/chartsCom/BarChart.vue";
  46. import TinymceEditor from "@/components/Tinymce.vue";
  47. import { analysisDetail, queryAnalysisedEngine } from "@/api/performance";
  48. export default {
  49. name: "windSpeedFrequency",
  50. components: {
  51. DicCard,
  52. FilterChart,
  53. BarChart,
  54. TinymceEditor,
  55. },
  56. props: {
  57. initBatchCode: {
  58. default: "",
  59. type: String,
  60. },
  61. analysisTypeCode: {
  62. default: "",
  63. type: String,
  64. },
  65. batchCodeList: {
  66. default: "",
  67. type: Array,
  68. },
  69. },
  70. data() {
  71. return {
  72. form: {
  73. value2: "",
  74. },
  75. comment: "",
  76. options: [],
  77. windEngineGroupList: [], //批次风机列表
  78. fieldEngineCodes: [], //选中风机
  79. generalFilesDatas: [], //总图
  80. diagramRelationsDatas: [], //分图
  81. };
  82. },
  83. watch: {
  84. initBatchCode(newVal) {
  85. if (newVal) {
  86. this.fetchData(); // 调用合并后的函数
  87. }
  88. },
  89. analysisTypeCode(newVal) {
  90. if (newVal) {
  91. this.fetchData(); // 调用合并后的函数
  92. }
  93. },
  94. },
  95. mounted() {
  96. if (this.initBatchCode && this.analysisTypeCode) {
  97. this.fetchData(); // 调用合并后的函数
  98. }
  99. },
  100. methods: {
  101. onSubmit() {
  102. console.log("submit!");
  103. },
  104. // 合并后的函数,处理数据请求
  105. async fetchData() {
  106. try {
  107. console.log(
  108. this.initBatchCode,
  109. this.analysisTypeCode,
  110. "请求详情 分钟级"
  111. );
  112. // 获取分析详情
  113. await this.getAnalysisDetail();
  114. // 获取风机列表
  115. await this.getWindEnfineList(this.initBatchCode, this.analysisTypeCode);
  116. } catch (err) {
  117. console.error("Failed to fetch data:", err);
  118. }
  119. },
  120. // 获取分析详情接口
  121. async getAnalysisDetail() {
  122. try {
  123. const result = await analysisDetail({
  124. batchCode: this.initBatchCode,
  125. analysisTypeCode: this.analysisTypeCode,
  126. fieldEngineCodes:
  127. this.fieldEngineCodes.length === 0
  128. ? undefined
  129. : this.fieldEngineCodes.join(","),
  130. });
  131. this.generalFilesDatas =
  132. result.data && result.data[0] && result.data[0].generalFiles; //总图数据
  133. this.diagramRelationsDatas =
  134. result.data && result.data[0] && result.data[0].diagramRelations;
  135. } catch (err) {
  136. console.error("Failed to fetch analysis details:", err);
  137. }
  138. },
  139. // 请求风机列表
  140. async getWindEnfineList(batchCode, analysisTypeCode) {
  141. // console.log("请求风机列表 分钟级");
  142. const resEngineList = await queryAnalysisedEngine({
  143. batchCode: batchCode,
  144. analysisTypeCode,
  145. });
  146. this.windEngineGroupList = resEngineList.data;
  147. },
  148. handleEditorInput(index, newVal) {
  149. // 更新对应的 comment 值
  150. // 如果该功能没有实现,可以删除这个方法
  151. },
  152. //获取选中风机list
  153. getEnfineList(data) {
  154. this.fieldEngineCodes = data;
  155. this.getAnalysisDetail();
  156. },
  157. //下一条
  158. handleNext() {
  159. const index = this.batchCodeList.findIndex(
  160. (item) => item === this.initBatchCode
  161. );
  162. if (index === this.batchCodeList.length - 1) {
  163. this.$message.warning("已经是最后一个分析结果了");
  164. return;
  165. }
  166. this.$emit("setInitBathCode", this.batchCodeList[index + 1]);
  167. },
  168. //上一条
  169. handlePrevious() {
  170. const index = this.batchCodeList.findIndex(
  171. (item) => item === this.initBatchCode
  172. );
  173. if (index === 0) {
  174. this.$message.warning("没有上一条了");
  175. return;
  176. }
  177. this.$emit("setInitBathCode", this.batchCodeList[index - 1]);
  178. },
  179. onClick() {},
  180. },
  181. };
  182. </script>
  183. <style scoped lang="scss">
  184. .type-variable {
  185. display: flex;
  186. height: 90%;
  187. overflow: hidden;
  188. .left {
  189. width: 30%;
  190. height: 100%;
  191. overflow: auto;
  192. padding: 20px;
  193. flex: 1;
  194. }
  195. .right {
  196. width: 250px;
  197. height: 100%;
  198. overflow: hidden;
  199. }
  200. }
  201. </style>