dengzedong
2025-03-19 aa0bc5d40026bd5e627191466a3e3064f1082c0e
src/views/model/pre/analysis/index.vue
@@ -89,16 +89,14 @@
                  <el-col :span="6">
                    <el-form-item label="精准度偏差" prop="IN_DEVIATION">
                      <el-input-number size="small" v-model="calRateForm.IN_DEVIATION"
                                       controls-position="right" :min="1"
                                       :max="10"/>
                                       controls-position="right" :min="0"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="不可信率偏差" prop="OUT_DEVIATION">
                      <el-input-number size="small" v-model="calRateForm.OUT_DEVIATION"
                                       controls-position="right"
                                       :min="1"
                                       :max="20"/>
                                       :min="1"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="4">
@@ -135,6 +133,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,6 +163,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>
@@ -240,8 +248,8 @@
const calRateFormRef = ref()
const calRateForm = ref({
  calItem: undefined,
  IN_DEVIATION: 0,
  OUT_DEVIATION: 0,
  IN_DEVIATION: 10,
  OUT_DEVIATION: 50,
  IN_ACCURACY_RATE: 0,
  OUT_ACCURACY_RATE: 0,
  itemAvg: 0,
@@ -251,7 +259,9 @@
  itemPreMax: 0,
  itemPreMin: 0,
  preCumulant: 0,
  realCumulant: 0
  realCumulant: 0,
  deviation: 0, //平均绝对误差
  deviationCumulant: 0, //累积量平均绝对误差
})
let itemData = ref({
  currentTreeList: [],
@@ -487,13 +497,8 @@
        let legendName = dataView.resultName + '(预测累计)';
        legendData.push(legendName);
        let seriesLeiJiData = []
        if (dataView.curData) {
          let leiJi = 0;
          for (let i = 0; i < dataView.curData.length; i++) {
            let item = dataView.curData[i];
            leiJi = leiJi + Number(item[1])
            seriesLeiJiData.push([item[0], (leiJi / 60).toFixed(2)]);
          }
        if (dataView.cumulantPreData) {
          seriesLeiJiData = dataView.cumulantPreData
        }
        seriesData.push({
          name: legendName,
@@ -514,21 +519,8 @@
        let legendName = dataView.resultName + '(真实累计)';
        legendData.push(legendName);
        let seriesLeiJiData = []
        if (dataView.realData) {
          let leiJi = 0;
          let lCount = 0
          for (let i = 0; i < dataView.realData.length; i++) {
            let item = dataView.realData[i];
            if(new Date(item[0]).getTime() < new Date(formData.value.predictTime).getTime()) {
              continue
            }
            if (lCount > dataView.curData.length) {
              continue
            }
            lCount = lCount + 1
            leiJi = leiJi + Number(item[1])
            seriesLeiJiData.push([item[0], (leiJi / 60).toFixed(2)]);
          }
        if (dataView.cumulantRealData) {
          seriesLeiJiData = dataView.cumulantRealData
        }
        seriesData.push({
          name: legendName,
@@ -563,6 +555,12 @@
      },
      tooltip: {
        trigger: 'axis'
      },
      toolbox: {
        show: true,
        feature: {
          saveAsImage: {}
        }
      },
      legend: {
        show: true,
@@ -602,6 +600,8 @@
  } finally {
    loading1.value = false
  }
  calItemBaseVale()
}
onMounted(() => {
@@ -690,7 +690,13 @@
function onCheckTree(data, checked, indeterminate) {
  formData.value.checkedItemData = [];
  if (checked.checkedNodes) {
    formData.value.checkedItemData = [...checked.checkedNodes]
    let cns = [...checked.checkedNodes]
    for (let i = 0; i < cns.length; i++) {
      if (cns[i].id.indexOf('-') !== -1) {
        continue
      }
      formData.value.checkedItemData.push(cns[i])
    }
  }
  debounce(getList, 1000);
}
@@ -726,61 +732,80 @@
    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()
}
function calAccuracyRate() {
  this.$refs['calRateForm'].validate((valid) => {
    if (!valid) {
      return false
    }
    let dataView = itemDataObject[calRateForm.value.calItem]
    let seriesReaData = dataView.realData;
    let seriesPreData = dataView.preDataL;
    if (seriesReaData == null || seriesPreData == null ||
      seriesReaData.length === 0 || seriesPreData.length === 0) {
      loading2.value = false;
      return;
    }
    let predictValueMap = {};
    seriesPreData.forEach(function (item) {
      predictValueMap[item[0]] = item[1];
    })
    let pointValueMap = {};
    seriesReaData.forEach(function (item) {
      pointValueMap[item[0]] = item[1];
    })
    let inDeviation = Number(calRateForm.value.IN_DEVIATION);
    let outDeviation = Number(calRateForm.value.OUT_DEVIATION);
    if (inDeviation === 0 && outDeviation === 0) {
      loading2.value = false;
      return;
    }
    let inDeviationCount = 0;
    let outDeviationCount = 0;
    let totalCount = 0;
    for (let key in predictValueMap) {
      let predictValue = predictValueMap[key];
      let pointValue = pointValueMap[key];
      if (pointValue == null || "" === pointValue || predictValue == null || "" === predictValue) {
        continue;
      }
      let deviationAbs = (predictValue - pointValue) >= 0 ? (predictValue - pointValue) : (predictValue - pointValue) * -1;
      if (deviationAbs < inDeviation) {
        inDeviationCount = inDeviationCount + 1;
      }
      if (deviationAbs > outDeviation) {
        outDeviationCount = outDeviationCount + 1;
      }
      totalCount = totalCount + 1;
    }
  const valid = calRateFormRef.value.validate()
  if (!valid) return
    let rateIn = (inDeviationCount / totalCount * 100).toFixed(2);
    let rateOut = (outDeviationCount / totalCount * 100).toFixed(2);
    calRateForm.value.IN_ACCURACY_RATE = Number(rateIn);
    calRateForm.value.OUT_ACCURACY_RATE = Number(rateOut);
  let dataView = itemDataObject.value[calRateForm.value.calItem]
  let seriesReaData = dataView.realData;
  let seriesPreData = dataView.preDataL;
  if (seriesReaData == null || seriesPreData == null ||
    seriesReaData.length === 0 || seriesPreData.length === 0) {
    loading2.value = false;
    return;
  }
  let predictValueMap = {};
  seriesPreData.forEach(function (item) {
    predictValueMap[item[0]] = item[1];
  })
  let pointValueMap = {};
  seriesReaData.forEach(function (item) {
    pointValueMap[item[0]] = item[1];
  })
  let inDeviation = Number(calRateForm.value.IN_DEVIATION);
  let outDeviation = Number(calRateForm.value.OUT_DEVIATION);
  if (inDeviation === 0 && outDeviation === 0) {
    loading2.value = false;
    return;
  }
  let inDeviationCount = 0;
  let outDeviationCount = 0;
  let totalCount = 0;
  for (let key in predictValueMap) {
    let predictValue = predictValueMap[key];
    let pointValue = pointValueMap[key];
    if (pointValue == null || "" === pointValue || predictValue == null || "" === predictValue) {
      continue;
    }
    let deviationAbs = (predictValue - pointValue) >= 0 ? (predictValue - pointValue) : (predictValue - pointValue) * -1;
    if (deviationAbs < inDeviation) {
      inDeviationCount = inDeviationCount + 1;
    }
    if (deviationAbs > outDeviation) {
      outDeviationCount = outDeviationCount + 1;
    }
    totalCount = totalCount + 1;
  }
  let rateIn = (inDeviationCount / totalCount * 100).toFixed(2);
  let rateOut = (outDeviationCount / totalCount * 100).toFixed(2);
  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() {
@@ -834,8 +859,8 @@
  }
  calRateForm.value = {
    calItem: undefined,
    IN_DEVIATION: 0,
    OUT_DEVIATION: 0,
    IN_DEVIATION: 10,
    OUT_DEVIATION: 50,
    IN_ACCURACY_RATE: 0,
    OUT_ACCURACY_RATE: 0,
    itemAvg: 0,
@@ -845,7 +870,9 @@
    itemPreMax: 0,
    itemPreMin: 0,
    preCumulant: 0,
    realCumulant: 0
    realCumulant: 0,
    deviation: 0, //平均绝对误差
    deviationCumulant: 0, //累积量平均绝对误差
  }
  calRateFormRef.value?.resetFields()
}
@@ -864,7 +891,8 @@
.his-body-tree {
  height: 100%;
  border: 1px solid lightgray;
  padding: 10px;
  padding: 10px 10px 20px 10px;
  overflow-y: auto;
}
.his-body-right {