index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <!--
  2. * @Author: your name
  3. * @Date: 2025-01-09 17:54:02
  4. * @LastEditTime: 2025-01-21 15:49:16
  5. * @LastEditors: bogon
  6. * @Description: In User Settings Edit
  7. * @FilePath: /performance-test/src/views/overview/data_integrity_minute/index.vue
  8. -->
  9. <template>
  10. <div class="type-variable">
  11. <!-- scada分钟级数据 -->
  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. 风电机组SCADA数据完整度分析是对风电场运行数据质量进行评估的关键环节。
  31. </div>
  32. <div style="font-size: 12px; margin-top: 10px">
  33. 数据完整度分析可以帮助识别数据缺失、异常或噪声,确保所采集数据的准确性和连贯性。这对于后续的风电机组运行分析和故障诊断至关重要。
  34. </div>
  35. <div style="font-size: 12px; margin-top: 10px">
  36. 数据完整度分析是根据数据统计周期内数据总行数与期望数据总行数的比值计算出来的。
  37. </div>
  38. </el-alert>
  39. <template v-if="generalFilesDatas && generalFilesDatas.length > 0">
  40. <div v-for="(item, index) in generalFilesDatas">
  41. <HeatmapCharts
  42. :key="item.batchCode + index"
  43. :index="item.batchCode + index"
  44. :ref="item.batchCode"
  45. :fileAddr="item.fileAddr"
  46. ></HeatmapCharts>
  47. </div>
  48. </template>
  49. <el-empty description="暂无分析记录" v-else></el-empty>
  50. <el-tabs value="first" v-if="isShowDescription">
  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" v-if="isShowDescription">
  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 HeatmapCharts from "@/views/performance/components/chartsCom/HeatmapCharts.vue";
  83. import TinymceEditor from "@/components/Tinymce.vue";
  84. import {
  85. analysisDetail,
  86. queryAnalysisedEngine,
  87. analysisCommentEdit,
  88. } from "@/api/performance";
  89. export default {
  90. name: "DataIntegrityMinute",
  91. components: {
  92. DicCard,
  93. FilterChart,
  94. HeatmapCharts,
  95. TinymceEditor,
  96. },
  97. props: {
  98. initBatchCode: {
  99. default: "",
  100. type: String,
  101. },
  102. analysisTypeCode: {
  103. default: "",
  104. type: String,
  105. },
  106. batchCodeList: {
  107. default: "",
  108. type: Array,
  109. },
  110. },
  111. data() {
  112. return {
  113. form: {
  114. value2: "",
  115. },
  116. isShowDescription: false,
  117. commentDescriptionVos: [], //评论列表
  118. windEngineGroupList: [], //批次风机列表
  119. fieldEngineCodes: [], //选中风机
  120. comment: "",
  121. options: [],
  122. generalFilesDatas: [], //总图
  123. diagramRelationsDatas: [], //分图,
  124. editableTabs: [],
  125. };
  126. },
  127. watch: {
  128. initBatchCode(newVal) {
  129. if (newVal) {
  130. this.fetchData(); // 调用合并后的函数
  131. }
  132. },
  133. analysisTypeCode(newVal) {
  134. if (newVal) {
  135. this.fetchData(); // 调用合并后的函数
  136. }
  137. },
  138. },
  139. mounted() {
  140. if (this.initBatchCode && this.analysisTypeCode) {
  141. this.fetchData(); // 调用合并后的函数
  142. }
  143. },
  144. methods: {
  145. async handleComment() {
  146. try {
  147. await analysisCommentEdit({
  148. batchCode: this.initBatchCode,
  149. analysisTypeCode: this.analysisTypeCode,
  150. commentList: this.editableTabs.map((item) => {
  151. return {
  152. commentTypeCode: item.commentTypeCode,
  153. comment: item.commentTypeName === "分析评论" ? this.comment : "",
  154. };
  155. }),
  156. });
  157. this.$message({
  158. type: "success",
  159. message: "保存成功",
  160. });
  161. this.comment = "";
  162. this.getAnalysisDetail();
  163. } catch (e) {
  164. console.error(e);
  165. this.loading = false;
  166. }
  167. },
  168. onSubmit() {
  169. console.log("submit!");
  170. },
  171. // 合并后的函数,处理数据请求
  172. async fetchData() {
  173. try {
  174. console.log(
  175. this.initBatchCode,
  176. this.analysisTypeCode,
  177. "请求详情 分钟级"
  178. );
  179. // 获取分析详情
  180. await this.getAnalysisDetail();
  181. // 获取风机列表
  182. await this.getWindEnfineList(this.initBatchCode, this.analysisTypeCode);
  183. } catch (err) {
  184. console.error("Failed to fetch data:", err);
  185. }
  186. },
  187. // 获取分析详情接口
  188. async getAnalysisDetail() {
  189. try {
  190. const result = await analysisDetail({
  191. batchCode: this.initBatchCode,
  192. analysisTypeCode: this.analysisTypeCode,
  193. fieldEngineCodes:
  194. this.fieldEngineCodes.length === 0
  195. ? undefined
  196. : this.fieldEngineCodes.join(","),
  197. });
  198. if (result.data.length > 0) {
  199. this.isShowDescription = true;
  200. }
  201. if (
  202. result.data &&
  203. result.data[0] &&
  204. result.data[0].commentTypeRelations
  205. ) {
  206. this.editableTabs = result.data[0].commentTypeRelations;
  207. }
  208. //当前评论展示获取
  209. if (
  210. result.data &&
  211. result.data[0] &&
  212. result.data[0].commentDescriptionVos
  213. ) {
  214. this.commentDescriptionVos = result.data[0].commentDescriptionVos;
  215. }
  216. this.generalFilesDatas =
  217. (result.data &&
  218. result.data[0] &&
  219. result.data[0].generalFiles &&
  220. result.data[0].generalFiles.filter((item) =>
  221. item.fileAddr.endsWith(".json")
  222. )) ||
  223. []; //总图数据
  224. this.diagramRelationsDatas =
  225. (result.data &&
  226. result.data[0] &&
  227. result.data[0].diagramRelations &&
  228. result.data[0].diagramRelations.filter((item) =>
  229. item.fileAddr.endsWith(".json")
  230. )) ||
  231. [];
  232. } catch (err) {
  233. console.error("Failed to fetch analysis details:", err);
  234. }
  235. },
  236. // 请求风机列表
  237. async getWindEnfineList(batchCode, analysisTypeCode) {
  238. // console.log("请求风机列表 分钟级");
  239. const resEngineList = await queryAnalysisedEngine({
  240. batchCode: batchCode,
  241. analysisTypeCode,
  242. });
  243. this.windEngineGroupList = resEngineList.data;
  244. },
  245. handleEditorInput(index, newVal) {
  246. // 更新对应的 comment 值
  247. // 如果该功能没有实现,可以删除这个方法
  248. },
  249. //获取选中风机list
  250. getEnfineList(data) {
  251. this.fieldEngineCodes = data;
  252. this.getAnalysisDetail();
  253. console.log(this.fieldEngineCodes, "this.fieldEngineCodes");
  254. },
  255. //下一条
  256. handleNext() {
  257. const index = this.batchCodeList.findIndex(
  258. (item) => item === this.initBatchCode
  259. );
  260. if (index === this.batchCodeList.length - 1) {
  261. this.$message.warning("已经是最后一个分析结果了");
  262. return;
  263. }
  264. this.$emit("setInitBathCode", this.batchCodeList[index + 1]);
  265. },
  266. //上一条
  267. handlePrevious() {
  268. const index = this.batchCodeList.findIndex(
  269. (item) => item === this.initBatchCode
  270. );
  271. if (index === 0) {
  272. this.$message.warning("没有上一条了");
  273. return;
  274. }
  275. this.$emit("setInitBathCode", this.batchCodeList[index - 1]);
  276. },
  277. onClick() {},
  278. },
  279. };
  280. </script>
  281. <style scoped lang="scss">
  282. .type-variable {
  283. display: flex;
  284. height: 90%;
  285. overflow: hidden;
  286. .left {
  287. width: 30%;
  288. height: 100%;
  289. overflow: auto;
  290. padding: 20px;
  291. flex: 1;
  292. }
  293. .right {
  294. width: 250px;
  295. height: 100%;
  296. overflow: hidden;
  297. }
  298. }
  299. </style>