dengzedong
2025-04-10 62c452107417690bc1f48fe55a4cc222e9900b13
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">
@@ -160,11 +170,16 @@
                      {{ 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>
              </el-form>
              <el-form :inline="true" :model="formData" label-width="100px">
                <el-row>
                  <el-col :span="16">
                  <el-col :span="18">
                    <el-form-item label="数据类型">
                      <el-checkbox-group v-model="formData.chartCheck" @change="changeChartCheck">
                        <el-checkbox v-for="item in formData.chartOptions" :label="item"
@@ -191,7 +206,7 @@
                  <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="200" />
                      <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>
@@ -265,7 +280,7 @@
  currentStamp60: '',
  predictStamp: '',
  chartCheck: ['T+L', '真实值'],
  chartOptions: ['T+N', 'T+L', '当时', '真实值', '调整值', '预测累计', '真实累计'],
  chartOptions: ['T+N', 'T+L','T+L(未调整)', '当时', '真实值', '调整值', '预测累计', '真实累计'],
  checkedItemData: [],
  backItem: '',
  backValue: 0,
@@ -291,7 +306,9 @@
  itemPreMax: 0,
  itemPreMin: 0,
  preCumulant: 0,
  realCumulant: 0
  realCumulant: 0,
  deviation: 0, //平均绝对误差
  deviationCumulant: 0, //累积量平均绝对误差
})
let itemData = ref({
  currentTreeList: [],
@@ -313,6 +330,17 @@
  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) => {
@@ -498,6 +526,23 @@
        seriesData.push({
          name: legendName,
          data: dataView.preDataL || [],
          type: 'line',
          showSymbol: false,
          connectNulls: true,
          yAxisIndex: yAxisIndex,
          smooth: false,
          lineStyle: {
            width: 2
          }
        });
      }
      if (chartCheckArray.indexOf('T+L(未调整)') !== -1) {
        let legendName = dataView.resultName + '(T+L(未调整))';
        legendData.push(legendName);
        seriesData.push({
          name: legendName,
          data: dataView.preDataLOriginal
            || [],
          type: 'line',
          showSymbol: false,
          connectNulls: true,
@@ -780,6 +825,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()
}
@@ -836,6 +883,24 @@
  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() {
  let mins = getRangeMins();
  let startTime = formData.value.startTime;
@@ -873,7 +938,7 @@
    currentStamp60: '',
    predictStamp: '',
    chartCheck: ['T+L', '真实值'],
    chartOptions: ['T+N', 'T+L', '当时', '真实值', '调整值', '预测累计', '真实累计'],
    chartOptions: ['T+N', 'T+L','T+L(未调整)', '当时', '真实值', '调整值', '预测累计', '真实累计'],
    checkedItemData: [],
    backItem: '',
    backValue: 0,
@@ -898,7 +963,9 @@
    itemPreMax: 0,
    itemPreMin: 0,
    preCumulant: 0,
    realCumulant: 0
    realCumulant: 0,
    deviation: 0, //平均绝对误差
    deviationCumulant: 0, //累积量平均绝对误差
  }
  calRateFormRef.value?.resetFields()
}