index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <!--
  2. * @Author: your name
  3. * @Date: 2025-01-09 17:55:01
  4. * @LastEditTime: 2025-02-10 14:10:09
  5. * @LastEditors: bogon
  6. * @Description: In User Settings Edit
  7. * @FilePath: /performance-test/src/views/overview/data_integrity_second/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-dialog
  51. v-if="isShowDescription"
  52. title="添加评论"
  53. :visible="isShow"
  54. width="30%"
  55. v-dialogDrag
  56. :modal="false"
  57. :lock-scroll="false"
  58. :modal-append-to-body="false"
  59. @close="handleClose"
  60. >
  61. <el-tabs value="first">
  62. <el-tab-pane label="意见描述" name="first">
  63. <TinymceEditor
  64. ref="editor"
  65. v-model="comment"
  66. @input="handleEditorInput($event)"
  67. @onClick="onClick"
  68. >
  69. </TinymceEditor>
  70. </el-tab-pane>
  71. </el-tabs>
  72. <el-row
  73. type="flex"
  74. class="row-bg"
  75. justify="end"
  76. style="margin: 20px 60px 0 0"
  77. >
  78. <el-col :span="2">
  79. <el-button type="primary" size="small" @click="handleComment"
  80. >提交评论</el-button
  81. >
  82. </el-col>
  83. </el-row>
  84. </el-dialog>
  85. </div>
  86. <div class="right">
  87. <DicCard
  88. :batchCode="initBatchCode"
  89. :analysisTypeCode="analysisTypeCode"
  90. :commentDescriptionVos="commentDescriptionVos"
  91. >
  92. </DicCard>
  93. </div>
  94. </div>
  95. </template>
  96. <script>
  97. import DicCard from "@/views/overview/components/dicCard/index.vue";
  98. import FilterChart from "@/views/overview/components/filterChart/index.vue";
  99. import HeatmapCharts from "@/views/performance/components/chartsCom/HeatmapCharts.vue";
  100. import TinymceEditor from "@/components/Tinymce.vue";
  101. import {
  102. analysisDetail,
  103. queryAnalysisedEngine,
  104. analysisCommentEdit,
  105. } from "@/api/performance";
  106. export default {
  107. name: "DataIntegritySecond",
  108. components: {
  109. DicCard,
  110. FilterChart,
  111. HeatmapCharts,
  112. TinymceEditor,
  113. },
  114. props: {
  115. initBatchCode: {
  116. default: "",
  117. type: String,
  118. },
  119. isShow: {
  120. default: false,
  121. type: Boolean,
  122. },
  123. analysisTypeCode: {
  124. default: "",
  125. type: String,
  126. },
  127. batchCodeList: {
  128. default: "",
  129. type: Array,
  130. },
  131. },
  132. data() {
  133. return {
  134. form: {
  135. value2: "",
  136. },
  137. isShowDescription: false,
  138. commentDescriptionVos: [], //评论列表
  139. windEngineGroupList: [], //批次风机列表
  140. fieldEngineCodes: [], //选中风机
  141. comment: "",
  142. options: [],
  143. generalFilesDatas: [], //总图
  144. diagramRelationsDatas: [], //分图,
  145. editableTabs: [],
  146. };
  147. },
  148. watch: {
  149. initBatchCode(newVal) {
  150. if (newVal) {
  151. this.fetchData(); // 调用合并后的函数
  152. }
  153. },
  154. isShow() {
  155. if (this.isShow) {
  156. if (!this.isShowDescription) {
  157. this.$message({
  158. message: "当前分析类型暂无分析,不能进行评论操作",
  159. type: "warning",
  160. });
  161. this.$emit("setIsShow");
  162. }
  163. }
  164. },
  165. analysisTypeCode(newVal) {
  166. if (newVal) {
  167. this.fetchData(); // 调用合并后的函数
  168. }
  169. },
  170. },
  171. mounted() {
  172. if (this.initBatchCode && this.analysisTypeCode) {
  173. this.fetchData(); // 调用合并后的函数
  174. }
  175. },
  176. methods: {
  177. handleClose() {
  178. //关闭评论弹框
  179. this.$emit("setIsShow");
  180. },
  181. async handleComment() {
  182. try {
  183. await analysisCommentEdit({
  184. batchCode: this.initBatchCode,
  185. analysisTypeCode: this.analysisTypeCode,
  186. commentList: this.editableTabs.map((item) => {
  187. return {
  188. commentTypeCode: item.commentTypeCode,
  189. comment: item.commentTypeName === "分析评论" ? this.comment : "",
  190. };
  191. }),
  192. });
  193. this.$message({
  194. type: "success",
  195. message: "保存成功",
  196. });
  197. this.comment = "";
  198. this.getAnalysisDetail();
  199. this.$emit("setIsShow");
  200. } catch (e) {
  201. console.error(e);
  202. this.loading = false;
  203. }
  204. },
  205. onSubmit() {
  206. console.log("submit!");
  207. },
  208. // 合并后的函数,处理数据请求
  209. async fetchData() {
  210. try {
  211. console.log(
  212. this.initBatchCode,
  213. this.analysisTypeCode,
  214. "请求详情 分钟级"
  215. );
  216. // 获取分析详情
  217. await this.getAnalysisDetail();
  218. // 获取风机列表
  219. await this.getWindEnfineList(this.initBatchCode, this.analysisTypeCode);
  220. } catch (err) {
  221. console.error("Failed to fetch data:", err);
  222. }
  223. },
  224. // 获取分析详情接口
  225. async getAnalysisDetail() {
  226. try {
  227. const result = await analysisDetail({
  228. batchCode: this.initBatchCode,
  229. analysisTypeCode: this.analysisTypeCode,
  230. fieldEngineCodes:
  231. this.fieldEngineCodes.length === 0
  232. ? undefined
  233. : this.fieldEngineCodes.join(","),
  234. });
  235. if (result.data.length > 0) {
  236. this.isShowDescription = true;
  237. }
  238. if (
  239. result.data &&
  240. result.data[0] &&
  241. result.data[0].commentTypeRelations
  242. ) {
  243. this.editableTabs = result.data[0].commentTypeRelations;
  244. }
  245. //当前评论展示获取
  246. if (
  247. result.data &&
  248. result.data[0] &&
  249. result.data[0].commentDescriptionVos
  250. ) {
  251. this.commentDescriptionVos = result.data[0].commentDescriptionVos;
  252. }
  253. this.generalFilesDatas =
  254. (result.data &&
  255. result.data[0] &&
  256. result.data[0].generalFiles &&
  257. result.data[0].generalFiles.filter((item) =>
  258. item.fileAddr.endsWith(".json")
  259. )) ||
  260. []; //总图数据
  261. // this.diagramRelationsDatas =
  262. // result.data &&
  263. // result.data[0] &&
  264. // result.data[0].diagramRelations.filter((item) =>
  265. // item.fileAddr.endsWith(".json")
  266. // );
  267. } catch (err) {
  268. console.error("Failed to fetch analysis details:", err);
  269. }
  270. },
  271. // 请求风机列表
  272. async getWindEnfineList(batchCode, analysisTypeCode) {
  273. // console.log("请求风机列表 分钟级");
  274. const resEngineList = await queryAnalysisedEngine({
  275. batchCode: batchCode,
  276. analysisTypeCode,
  277. });
  278. this.windEngineGroupList = resEngineList.data;
  279. },
  280. handleEditorInput(index, newVal) {
  281. // 更新对应的 comment 值
  282. // 如果该功能没有实现,可以删除这个方法
  283. },
  284. //获取选中风机list
  285. getEnfineList(data) {
  286. this.fieldEngineCodes = data;
  287. this.getAnalysisDetail();
  288. console.log(this.fieldEngineCodes, "this.fieldEngineCodes");
  289. },
  290. //下一条
  291. handleNext() {
  292. const index = this.batchCodeList.findIndex(
  293. (item) => item === this.initBatchCode
  294. );
  295. if (index === this.batchCodeList.length - 1) {
  296. this.$message.warning("已经是最后一个分析结果了");
  297. return;
  298. }
  299. this.$emit("setInitBathCode", this.batchCodeList[index + 1]);
  300. },
  301. //上一条
  302. handlePrevious() {
  303. const index = this.batchCodeList.findIndex(
  304. (item) => item === this.initBatchCode
  305. );
  306. if (index === 0) {
  307. this.$message.warning("没有上一条了");
  308. return;
  309. }
  310. this.$emit("setInitBathCode", this.batchCodeList[index - 1]);
  311. },
  312. onClick() {},
  313. },
  314. };
  315. </script>
  316. <style scoped lang="scss">
  317. .type-variable {
  318. display: flex;
  319. height: 90%;
  320. overflow: hidden;
  321. .left {
  322. width: 30%;
  323. height: 100%;
  324. overflow: auto;
  325. padding: 20px;
  326. flex: 1;
  327. /* 滚动条整体样式 */
  328. &::-webkit-scrollbar {
  329. width: 6px; /* 滚动条宽度 */
  330. }
  331. /* 滚动条轨道 */
  332. &::-webkit-scrollbar-track {
  333. background: #f5f7fa;
  334. border-radius: 3px;
  335. }
  336. /* 滚动条滑块 */
  337. &::-webkit-scrollbar-thumb {
  338. background: #c0c4cc;
  339. border-radius: 3px;
  340. }
  341. /* 滚动条滑块悬停时 */
  342. &::-webkit-scrollbar-thumb:hover {
  343. background: #909399;
  344. }
  345. }
  346. .right {
  347. width: 250px;
  348. height: 100%;
  349. overflow: hidden;
  350. }
  351. }
  352. .el-dialog__wrapper {
  353. position: relative !important;
  354. }
  355. ::v-deep .el-dialog {
  356. position: fixed !important;
  357. z-index: 999 !important;
  358. top: 50%;
  359. left: 50%;
  360. transform: translate(0, -50%);
  361. }
  362. </style>