index.vue 10 KB

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