index.vue 10 KB

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