From 1255f2244f7736340d407c08eb04d819affc9e98 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期三, 02 四月 2025 10:02:57 +0800 Subject: [PATCH] 数据分析 消息内容 显示优化 --- src/views/model/pre/analysis/index.vue | 137 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 132 insertions(+), 5 deletions(-) diff --git a/src/views/model/pre/analysis/index.vue b/src/views/model/pre/analysis/index.vue index 35a306b..a4dd2ec 100644 --- a/src/views/model/pre/analysis/index.vue +++ b/src/views/model/pre/analysis/index.vue @@ -58,13 +58,18 @@ <div class="his-body"> <div class="his-body-left"> <div class="his-body-tree"> + <el-input + v-model="filterText" + class="mb-2" + placeholder="Filter" + /> <el-tree :data="treeData" show-checkbox node-key="id" - ref="tree" + ref="treeRef" highlight-current - :props="defaultProps" + :filter-node-method="filterNode" @check="onCheckTree"/> </div> </div> @@ -133,6 +138,11 @@ {{ calRateForm.preCumulant }} </el-form-item> </el-col> + <el-col :span="4"> + <el-form-item label="平均绝对误差:" label-width="110px"> + {{ calRateForm.deviation }} + </el-form-item> + </el-col> </el-row> <el-row> <el-col :span="4"> @@ -158,6 +168,11 @@ <el-col :span="4"> <el-form-item label="真实累积量:"> {{ calRateForm.realCumulant }} + </el-form-item> + </el-col> + <el-col :span="4"> + <el-form-item label="累积量平均绝对误差:" label-width="152px"> + {{ calRateForm.deviationCumulant }} </el-form-item> </el-col> </el-row> @@ -186,6 +201,46 @@ </el-row> </el-form> <div ref="dataAnalysisChart" style="height: 500px;"></div> + <div class="chart-foot"> + <div class="chart-foot-content"> + <h3 class="chart-foot-title">预警信息</h3> + <div class="chart-foot-table"> + <el-table :data="alarmList" style="width: 100%" v-loading="loadingAlarm" height="100px"> + <el-table-column prop="content" header-align="center" align="left" label="消息内容" min-width="240" /> + <el-table-column prop="alarmType" label="预警类型" header-align="center" align="left" min-width="150"/> + <el-table-column prop="alarmTime" label="预警时间" header-align="center" align="left" min-width="150"/> + </el-table> + </div> + </div> + <div class="chart-foot-content"> + <h3 class="chart-foot-title">调度建议</h3> + <div class="chart-foot-table"> + <el-table :data="suggestList" style="width: 100%" v-loading="loadingAdjust" height="100px"> + <el-table-column + prop="scheduleTime" + label="调度时间" + header-align="center" + align="left" + min-width="160" + /> + <el-table-column + prop="content" + label="内容" + min-width="300" + header-align="center" align="left" + /> + <el-table-column + prop="adjustValue" + label="调整值" + header-align="center" + align="center" + min-width="100" + /> + </el-table> + </div> + + </div> + </div> </div> </div> </div> @@ -196,6 +251,8 @@ <script lang="ts" setup> import {getYMDHMS} from "@/utils/dateUtil" import * as McsApi from '@/api/model/mcs' +import * as AlarmMessageApi from '@/api/model/pre/alarm/message' +import * as ScheSuggestApi from '@/api/model/sche/suggest' import * as echarts from "echarts"; import {Search, DArrowLeft, DArrowRight, VideoPlay, VideoPause, CaretLeft, CaretRight} from '@element-plus/icons-vue' @@ -249,7 +306,9 @@ itemPreMax: 0, itemPreMin: 0, preCumulant: 0, - realCumulant: 0 + realCumulant: 0, + deviation: 0, //平均绝对误差 + deviationCumulant: 0, //累积量平均绝对误差 }) let itemData = ref({ currentTreeList: [], @@ -261,12 +320,27 @@ const timer = ref() let myChart = null; const isPlay = ref(false) +const alarmList = ref([]) +const suggestList = ref([]) +const loadingAlarm = ref(false) +const loadingAdjust = ref(false) const formRules = reactive({ calItem: [{required: true, message: '预测项不能为空', trigger: 'blur'}], IN_DEVIATION: [{required: true, message: '精准度偏差不能为空', trigger: 'blur'}], OUT_DEVIATION: [{required: true, message: '不可信率偏差不能为空', trigger: 'blur'}], }) + +// 树形过滤 +const filterText = ref('') +const treeRef = ref() +watch(filterText, (val) => { + treeRef.value!.filter(val) +}) +const filterNode = (value: string, data) => { + if (!value) return true + return data.label.includes(value) +} /** 查询列表 */ const getList = async (isClear = true) => { @@ -289,10 +363,24 @@ startTime: formData.value.startTime, endTime: formData.value.endTime }) + const data = await McsApi.getPreDataCharts(params) formData.value.predictTime = data.predictTime; formData.value.startTime = data.startTime formData.value.endTime = data.endTime + + const paramsAlarm = reactive({ + outIds: outIds, + predictTime: formData.value.predictTime + }) + + loadingAlarm.value = true + alarmList.value = await AlarmMessageApi.getListByOut(paramsAlarm) + loadingAlarm.value = false + + loadingAdjust.value = true + suggestList.value = await ScheSuggestApi.getListByOut(paramsAlarm) + loadingAdjust.value = false let xAxisData = data.categories; let defaultYAxis = [ @@ -720,6 +808,8 @@ calRateForm.value.itemMin = dataView.hisMin; calRateForm.value.itemAvg = dataView.hisAvg; calRateForm.value.realCumulant = dataView.hisCumulant; + calDeviation(dataView.realData,dataView.preDataL,'deviation') + calDeviation(dataView.cumulantRealData,dataView.cumulantPreData,'deviationCumulant') } calAccuracyRate() } @@ -774,6 +864,24 @@ calRateForm.value.IN_ACCURACY_RATE = Number(rateIn); calRateForm.value.OUT_ACCURACY_RATE = Number(rateOut); loading2.value = false; +} + +function calDeviation(realData,preDataL,key) { + if (realData == null || preDataL == null || realData.length === 0 || preDataL.length === 0) { + return; + } + const realObj = {} + realData.map(e => realObj[e[0]] = e[1]) + + let sum = 0; + let index = 0; + preDataL.forEach(e => { + if (realObj[e[0]] != undefined) { + sum += Math.abs(e[1] - realObj[e[0]]) + index++ + } + }) + calRateForm.value[key] = Number((sum / index).toFixed(2)) } function rightSearchDataByRange() { @@ -838,12 +946,31 @@ itemPreMax: 0, itemPreMin: 0, preCumulant: 0, - realCumulant: 0 + realCumulant: 0, + deviation: 0, //平均绝对误差 + deviationCumulant: 0, //累积量平均绝对误差 } calRateFormRef.value?.resetFields() } </script> <style scoped> +.chart-foot-table { + border: 1px solid #bababa; +} +.chart-foot-title { + font-size: 14px; +} +.chart-foot-content { + height: 100%; + width: 50%; + padding: 5px; +} +.chart-foot { + height: 120px; + width: 100%; + display: flex; + flex-direction: row; +} .el-form-item { margin-bottom: 0 !important; } @@ -875,7 +1002,7 @@ .his-body { width: 100%; - height: calc(calc(100vh - 68px - 38px - 160px)); + height: calc(calc(100vh - 68px - 38px - 60px)); display: flex; flex-direction: row; justify-content: flex-start; -- Gitblit v1.9.3