longyvfengyun
2022-03-24 bad47c6f001cbbdc0b6fd3afbe3eb1fb54c0e569
内容修改
3个文件已修改
1个文件已添加
68 ■■■■ 已修改文件
src/assets/js/tools/getMaxInfo.js 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataTest/history.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataTest/realTime.vue 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataTest/standardLine.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/tools/getMaxInfo.js
New file
@@ -0,0 +1,23 @@
/**
 * 获取最大值的信息
 * @param list
 * @returns {{value: number, key: number}}
 */
function getMaxInfo(list) {
  let max = -Infinity;
  let result = {
    key: 0,
    value: 0
  };
  // 遍历数组获取信息
  for(let i=0; i<list.length; i++) {
    if(list[i]>max) {
      max = list[i];
      result.key = i;
      result.value = max;
    }
  }
  return result;
}
export default getMaxInfo;
src/pages/dataTest/history.vue
@@ -251,6 +251,7 @@
    import "@/components/chart/theme/transparent"
    import DataDiffter from "@/pages/dataTest/dialogs/DataDiffter";
    import getMinInfo from "@/assets/js/tools/getMinInfo";
    import getMaxInfo from "@/assets/js/tools/getMaxInfo";
    // 端信息
    let allData = {
        groupVol: [],
@@ -1904,11 +1905,15 @@
                    //单体电压柱状图
                    let monBarVol = monBarData.vol;
                    let monBarEndVol = monBarVol[this.getDataIndex(monBarVol.length, 100)];
                    let minInfo = getMinInfo(monBarEndVol.map(item=>{
                    let minInfo = getMaxInfo(monBarEndVol.map(item=>{
                      return item[1];
                    }));
                    let note = Math.abs(testRecord.test_cap / (testRecord.test_timelong / 3600));
                    note = note?(batt.MonCapStd/note).toFixed(0):0;
                    if(note == 0) {
                      this.$layer.msg('数据异常,请添加其他数据!');
                      return;
                    }
                    let searchParams = {
                        BattgroupId: batt.BattGroupId,
                        test_record_count: testRecord.test_record_count,
src/pages/dataTest/realTime.vue
@@ -1032,6 +1032,7 @@
        devTemperature: 0, // 环境温度
        devHumidity: 0, // 环境湿度,
        note: -1,   // 实际容量
        list: "",
      },
      chargeMon: "",
      dischargeMon: "",
@@ -1927,9 +1928,25 @@
      realTimeGroup(batt.BattGroupId).then((res) => {
        let rsa = JSON.parse(res.data.result);
        if (rsa.code == 1) {
          console.log("旧算法:"+rsa.data[0].batt_rest_cap);
          if(!rsa.data[0].stationId) {
            rsa.data[0].stationId=",-1,-1,-1,-1,-1";
          }
          rsa.data[0].note = Number(rsa.data[0].note);
          this.inputs = rsa.data[0];
          // 多个实际容量
          let list = rsa.data[0].stationId.split(",").filter(item=>{
            return item != "";
          });
          list = list.map(item=>{
            return (Number(item)-Math.abs(rsa.data[0].batt_test_cap)).toHold(1);
          }).join(",");
          console.log("*******");
          console.log("标准曲线实际容量:"+rsa.data[0].stationId);
          console.log("标准曲线剩余容量:"+list);
          console.log("旧算法剩余容量:"+rsa.data[0].batt_rest_cap);
          console.log("*******");
          this.inputs.list = list;
        }
      });
    },
@@ -3200,15 +3217,17 @@
      list.batt_test_cap = this.inputs.batt_test_cap.toFixed(1) + "AH";
      if (this.inputs.batt_state === 3) {
        // 为0是不更新剩余容量
        // if(this.inputs.batt_rest_cap != 0) {
        //   list.batt_syrl_cap = this.inputs.batt_rest_cap.toFixed(1)
        // }
        // 通过标准曲线获取实际容量后计算剩余容量
        if(this.inputs.note<=0) {
          list.batt_syrl_cap = "------";
        }else {
          list.batt_syrl_cap = (this.inputs.note-Math.abs(this.inputs.batt_test_cap)).toFixed(1)+"AH";
        if(this.inputs.batt_rest_cap != 0) {
          list.batt_syrl_cap = this.inputs.batt_rest_cap.toFixed(1)
        }
        // 通过标准曲线获取实际容量后计算剩余容量
        // if(this.inputs.note<=0) {
        //   list.batt_syrl_cap = "------";
        //   list.batt_syrl_cap = this.inputs.list+"AH";
        // }else {
        //   //list.batt_syrl_cap = (this.inputs.note-Math.abs(this.inputs.batt_test_cap)).toFixed(1)+"AH";
        //   list.batt_syrl_cap = this.inputs.list+"AH";
        // }
      } else {
        list.batt_syrl_cap = "---";
      }
src/pages/dataTest/standardLine.vue
@@ -241,6 +241,7 @@
        return;
      }
      let searchParam = searchParams[index];
      searchParam.vol_type = 1;
      this.$apis.dataTest.history.searchStandardLine(searchParam).then(res=>{
        let rs = JSON.parse(res.data.result);
        if(rs.code == 1) {