longyvfengyun
2023-12-25 d8d792a6842832e8f6af6604274c438b25053afe
src/pages/dataTest/realTime.vue
@@ -62,9 +62,55 @@
      <!--                    <i class="iconfont el-icon-icon-test" @click="nibian.show=true"></i>-->
      <!--                </el-tooltip>-->
      <!--            </div>-->
      <flex-layout :no-bg="true">
      <flex-layout :no-bg="true" :loading="loading">
        <div class="content-header" slot="header" :model="inputs">
          <div class="table-layout">
        <div class="table-layout" v-if="cdshStatus == 'cdsh'">
            <div class="table-row">
              <div class="table-cell text-right w80">电池状态:</div>
              <div class="table-cell">
                <el-input
                  :value="backInputs.batt_state"
                  size="small"
                  :disabled="true"
                ></el-input>
              </div>
              <div class="table-cell text-right w80">端电压:</div>
              <div class="table-cell">
                <el-input
                  :value="backInputs.group_online_vol"
                  size="small"
                  :disabled="true"
                ></el-input>
              </div>
              <div class="table-cell text-right w80">电池电流:</div>
              <div class="table-cell">
                <el-input
                  :value="backInputs.group_curr"
                  size="small"
                  :disabled="true"
                ></el-input>
              </div>
            </div>
            <div class="table-row">
              <div class="table-cell text-right w80">单体电池数量:</div>
              <div class="table-cell">
                <el-input
                  :value="backInputs.MonCount"
                  size="small"
                  :disabled="true"
                ></el-input>
              </div>
              <div class="table-cell text-right w80">标称单体电压:</div>
              <div class="table-cell">
                <el-input
                  :value="backInputs.MonVolStd"
                  size="small"
                  :disabled="true"
                ></el-input>
              </div>
            </div>
          </div>
          <div class="table-layout" v-else>
            <div class="table-row">
              <div class="table-cell text-right w80">电池状态:</div>
              <div class="table-cell">
@@ -140,6 +186,9 @@
            class="page-content-tools"
            v-if="control.show && isCanTest && isTestDev"
          >
            <button class="hdw-btn transparentBtn" @click="guidesDialog = true" v-if="(acTabs == 'vol'||acTabs == 'res'||acTabs == 'temp'||acTabs == 'conduct'||acTabs == 'leakVol')&&cdshStatus=='cdsh'">
              <span class="light-color">设置参考线</span>
            </button>
            <el-popover placement="bottom" trigger="hover">
              <div class="hdw-menu-list">
                <ul>
@@ -286,7 +335,7 @@
                <science-box
                  style="position: relative; margin-top: 8px"
                  no-header
                  v-show="stateListState && batt.FBSDeviceId"
                  v-show="stateListState && batt.FBSDeviceId && showHistoryStateList.length"
                >
                  <div class="hdw-state-list table-layout">
                    <div
@@ -403,7 +452,9 @@
                :update="acTabs=='lithiumPack'"
                :change-flag="dataChangeFlag"
                :mon-vols="monVols"
                :mon-temps="monTemps"></lithium-pack-tab>
                :mon-temps="monTemps"
                :pack-vols="packVols"
                :pack-currs="packCurrs"></lithium-pack-tab>
            </el-tab-pane>
            <el-tab-pane
              key="res"
@@ -687,6 +738,7 @@
    >
      <discharge-dialog-content
        v-if="dischargeDialog.show"
        :tdata="tdata"
        :batt="batt"
        @close="closeDisChargeDialog"
      >
@@ -856,6 +908,22 @@
        :batt="batt"
      ></work-plan>
    </el-dialog>
    <!-- 设置参考线 -->
    <el-dialog
      title="设置参考线"
      width="600px"
      :visible.sync="guidesDialog"
      top="0"
      class="dialog-center"
      :modal-append-to-body="false"
    >
        <div class="wx_guides">
          <p>参考线:</p>
          <p><el-input v-model="guidesVal"></el-input></p>
          <el-button type="primary" @click="setGuidesAlert()">设置</el-button>
          <el-button type="info" @click="guidesDialog = false">取消</el-button>
        </div>
    </el-dialog>
    <right-menu
      :visible.sync="rightMenu.show"
      :x="rightMenu.x"
@@ -875,6 +943,20 @@
      </div>
    </right-menu>
    <stop-outline-curing :dev-id="batt.FBSDeviceId" :stop-time="stopTime"></stop-outline-curing>
     <el-dialog
        title="人脸校验"
        width="480px"
        :visible.sync="startFaceShow"
        :close-on-click-modal="false"
        top="0"
        :modal="false"
        class="dialog-center"
        :modal-append-to-body="false"
        :destroy-on-close="true">
        <check-face
           v-if="startFaceShow"
           @checkSuccess="startFaceSuccess"></check-face>
     </el-dialog>
  </flex-layout>
</template>
@@ -944,12 +1026,15 @@
import AutoCheck from "@/pages/dataTest/dialogs/autoCheck";
import const_9120 from "@/assets/js/const/const_9120";
import LithiumPackTab from "@/pages/dataTest/components/lithiumPackTab";
import CheckFace from "@/components/checkFace.vue";
import config from "@/assets/js/config";
/* import moment from "moment"; */
let vol, resChart, temp, conduct, currChart, leakVol, monConnRes;
let tblData = [];
export default {
  components: {
     CheckFace,
    LithiumPackTab,
    AutoCheck,
    stopOutlineCuring,
@@ -998,10 +1083,14 @@
        this.resize();
      });
    },
    "diagram.type"() {
      let batt = this.batt;
      this.getLastCapacityTest(batt);
    "$store.user.realTabsConfig"(pageConfig) {
      this.pageConfig = pageConfig;
    }
    // "diagram.type"(n) {
    //   // console.log(n, '===========测试类型:');
    //   let batt = this.batt;
    //   this.getLastCapacityTest(batt);
    // }
  },
  data() {
    let permits = this.$store.state.user.permits;
@@ -1011,6 +1100,21 @@
    let lastCapacityTest = const_61850.lastCapacityTest;
    let pageConfig = this.$store.getters["user/realTabsConfig"];
    return {
       startFaceShow: false,
      // 成都石化
      cdshStatus:this.cdshFan(),
      guidesDialog:false,
      guidesVal:"",
      guidesData:{
        monVol:0,
        monTemp:0,
        monRes:0,
        monConduct:0,
        leakVol:0
      },
      //
      loading: false,
      workPlanDialog: false,
      dcdcWorkDialog: false,
      balanceControlDialog: false,
@@ -1050,6 +1154,7 @@
      chargeMon: "",
      dischargeMon: "",
      acTabs: "eleLine",
      tdata: [],
      table: {
        headers: [
          {
@@ -1144,6 +1249,7 @@
      historyStateList: historyStateList,
      lastCapacityTest: lastCapacityTest,
      timer: new Timeout("realTime"),
      timer2: new Timeout("realTime"),
      diagram: {
        update: true,
        type: -1,
@@ -1510,9 +1616,17 @@
      monVols: [],
      // 单体温度信息
      monTemps: [],
      // 包电压
      packVols:[],
      packCurrs: [],
    };
  },
  methods: {
    // 成都石化判断
    cdshFan:function(){
      return this.$CFG.clientName.name;
    },
    //
    tabClick(tab) {
      this.acTabs = tab.name;
      // 根据tab更新电路图
@@ -1786,10 +1900,22 @@
      }
    },
    startTimer() {
      this.timer.start(() => {
        this.$axios
          .all([
      // 计时器2
      this.timer2.start(()=>{
        this.$axios.all([
            this.realTimeSearch(),
        ]).then(()=>{
          this.dataChangeFlag = Math.random(); // 数据更新
          this.timer2.open();
        }).catch(()=>{
          this.dataChangeFlag = Math.random(); // 数据更新
          this.timer2.open();
        });
      }, 3000);
      // 计时器1
      this.timer.start(() => {
        this.$axios.all([
            this.realTimeGroupss(),
            this.realStateTimeData(),
            this.realTimeStateList(),
@@ -1797,13 +1923,12 @@
            //this.inversionInfo()
            this.getLithiumAnalog(), // 锂电池模拟量
            this.inversionData(),
            this.getLastCapacityTest(this.batt),
          ])
          .then(() => {
            this.dataChangeFlag = Math.random(); // 数据更新
            this.timer.open();
          })
          .catch(() => {
            this.dataChangeFlag = Math.random(); // 数据更新
            this.timer.open();
          });
      }, 3000);
@@ -1811,6 +1936,7 @@
    getBattGroupInfo(BattGroupId) {
      this.homeListShow = false;
      this.timer.name = "movingRingSysteRrealTime";
      this.timer2.name = "movingRingSysteRrealTime";
      this.$apis.dataMager.battGroupMager
        .getBattGroupInfo(BattGroupId)
        .then((res) => {
@@ -1837,8 +1963,19 @@
      if (regEquipType(data.FBSDeviceId, ["equip61850"])) {
        this.getLastCapacityTest(data);
      }
      let keyList = ["eleLine", "vol", "res", "temp", "conduct", "monConnRes",
        "curr", "leakVol", "tblData", "dianchigaojing", "niBianInfoTab", "jggdInfoTab", "elePrice", "bmsInfo"];
      for(let i=0; i<keyList.length; i++) {
        let key = keyList[i];
        if(this.pageConfig[key]) {
          this.acTabs = key;
          break;
        }
      }
      this.loading = true;
      this.changeTabsName();
      this.$nextTick(()=>{
        this.changeTabsName();
        // 开启循环请求
        this.startTimer();
      });
@@ -1867,6 +2004,50 @@
        let rs = JSON.parse(res.data.result);
        if (rs.code == 1) {
          let list = rs.data;
        // 初始化查询参考线
        if(this.cdshStatus == "cdsh"){
          this.getGuides(rs);
        }else{
          this.setLin(rs)
        }
          // // 单体电压
          // this.setChartMarkLine(vol, "Voltage", "Batt_Alarm_Type_MonVol", list);
          // // 单体温度
          // this.setChartMarkLine(
          //   temp,
          //   "Temperature",
          //   "Batt_Alarm_Type_MonTmp",
          //   list
          // );
          // // 单体内阻
          // this.setChartMarkLine(
          //   resChart,
          //   "Resistance",
          //   "Batt_Alarm_Type_MonRes",
          //   list
          // );
          // // 单体电导
          // this.setChartMarkLine(
          //   conduct,
          //   "Conductance",
          //   "Batt_Alarm_Type_MonRes",
          //   list
          // );
          // // 漏液电压
          // this.setChartMarkLine(
          //   leakVol,
          //   "leakVol",
          //   "Batt_Alarm_Type_MonLYVol",
          //   list
          // );
        }
      });
    },
    // 设置高低线参考线
    setLin:function(res){
      if (res.code) {
          let list = res.data;
          // 单体电压
          this.setChartMarkLine(vol, "Voltage", "Batt_Alarm_Type_MonVol", list);
          // 单体温度
@@ -1899,7 +2080,6 @@
            list
          );
        }
      });
    },
    setChartMarkLine(chartData, name, alm_name, list) {
      let batt = this.batt;
@@ -1909,42 +2089,152 @@
        if (item.alm_name == alm_name) {
          let high = 0;
          let low = 0;
          let guides = 0;
          switch (name) {
            case "Voltage": // 电压告警
              //单体电压
              let std_mon_vol = batt.MonVolStd;
              high = parseFloat(std_mon_vol * item.alm_high_coe).toHold(3);
              low = parseFloat(std_mon_vol * item.alm_low_coe).toHold(3);
              if(this.cdshStatus == "cdsh"){
                guides = this.guidesData.monVol;
              }
              break;
            case "Temperature":
              //单体温度
              let std_mon_tmp = 25;
              high = parseFloat(std_mon_tmp * item.alm_high_coe).toHold(1);
              low = parseFloat(std_mon_tmp * item.alm_low_coe).toHold(1);
              if(this.cdshStatus == "cdsh"){
                guides = this.guidesData.monTemp;
              }
              break;
            case "Resistance":
              // 单体电阻
              let std_mon_res =
                (1 * (batt.MonVolStd / 2)) / (batt.MonCapStd / 100);
              high = parseFloat(std_mon_res * item.alm_high_coe).toHold(3);
              low = parseFloat(std_mon_res * item.alm_low_coe).toHold(3);
              if(this.cdshStatus == "cdsh"){
                guides = this.guidesData.monRes;
              }
              break;
            case "Conductance":
              // 单体电导
              let std_mon_ser = batt.MonSerStd;
              high = parseFloat(std_mon_ser * item.alm_high_coe).toHold(0);
              low = parseFloat(std_mon_ser * item.alm_low_coe).toHold(0);
              if(this.cdshStatus == "cdsh"){
                guides = this.guidesData.monConduct;
              }
              break;
            case "leakVol":
              // 漏液电压
              high = parseFloat(item.alm_high_coe);
              low = parseFloat(item.alm_low_coe);
              if(this.cdshStatus == "cdsh"){
                guides = this.guidesData.leakVol;
              }
              break;
          }
          // 低告警
          chartData.series[0].markLine.data[0].yAxis = low;
          // 高告警
          chartData.series[0].markLine.data[1].yAxis = high;
          if(this.cdshStatus == "cdsh"){
            //参考线
            chartData.series[0].markLine.data[2].yAxis = guides;
          }
          break;
        }
      }
    },
    // 获取电池组参考线
    getGuides:function(resdata){
      let vm = this;
      let batt = this.batt;
      let obj = {
        battGroupId:batt.BattGroupId
      }
          // debugger
          vm.$axios({
            method: "POST",
              url: "BattGroupGuidesAction!getAll",
              data:'json=' + JSON.stringify(obj)
          }).then((res)=>{
            let rs = JSON.parse(res.data.result);
                if(rs.code == 1){
                  vm.guidesData = rs.data;
                  console.log(vm.guidesData)
                  vm.setLin(resdata)
                }
            console.log(vm.guidesData);
          })
    },
    // 设置参考线弹窗
    setGuidesAlert:function(){
      let vm = this;
      let params = function(){
                      let obj = {};
                      for (const key in vm.guidesData) {
                        // if(key == 'id'){
                        //   if(vm.guidesData[key] != null){
                        //     obj[key] = vm.guidesData[key];
                        //   }
                        // }else{
                          obj[key] = vm.guidesData[key];
                        // }
                      }
                      return obj;
                    }();
          if(!params.battGroupId){
            params.battGroupId = vm.batt.BattGroupId;
          }
          if(vm.guidesVal != ""){
            switch (vm.acTabs) {
              case "vol"://电压
                params.monVol = vm.guidesVal;
                break;
              case "res"://内阻
                params.monRes = vm.guidesVal;
                break;
              case "temp"://温度
                params.monTemp = vm.guidesVal;
                break;
              case "conduct"://电导
                params.monConduct = vm.guidesVal;
                break;
              case "leakVol"://漏液电压
                params.leakVol = vm.guidesVal;
                break;
            }
            // debugger
            vm.$axios({
              method: "POST",
              url: "BattGroupGuidesAction!update",
              data:"json=" + JSON.stringify(params)
            }).then((rs)=>{
              let res = JSON.parse(rs.data.result);
              if(res.code == 1){
                  vm.$message({
                    message: "设置成功!",
                    type: 'success'
                  });
                  vm.guidesVal = "";
                  vm.guidesDialog = false;
                  vm.realTimeAlarmss();
              }else{
                vm.$message.error("设置失败!");
              }
            })
          }else{
            vm.$message({
              message: '请先填写参考线值!',
              type: 'warning'
            });
          }
    },
    /* 实时组端信息 */
    realTimeGroupss() {
@@ -1955,9 +2245,15 @@
          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];
          if(this.cdshStatus == "cdsh"){
            let data2 = rsa.data2;
             for (const key in data2) {
              this.inputs[key] = data2[key]
            }
            console.log(this.inputs)
          }
          // 多个实际容量
          let list = rsa.data[0].stationId.split(",").filter(item=>{
            return item != "";
@@ -2459,7 +2755,8 @@
        // 添加正在测试的单体
        this.chargeMon = chargeMon;
        this.dischargeMon = dischargeMon;
        this.tdata = data;
        // 更新表格
        if (this.acTabs == "tblData") {
          this.table.datas = data;
@@ -2608,6 +2905,12 @@
        monConnRes.series[0].data = monConnResData;
        // 更新电压图表
        this.setChart();
        this.loading = false;
      }).catch(error=>{
        // 更新电压图表
        this.setChart();
        this.loading = false;
        this.loading = false;
      });
    },
    // 向父级发送同步页面的指令
@@ -2687,6 +2990,7 @@
        .stop({
          num: const_ld_nine.cmd.stop,
          dev_id: this.batt.FBSDeviceId,
          BattGroupNum: this.batt.GroupIndexInFBSDevice+1,
        })
        .then((res) => {
          let rs = JSON.parse(res.data.result);
@@ -2717,6 +3021,7 @@
        .stop({
          num: const_9100.cmd.stop,
          dev_id: this.batt.FBSDeviceId,
          BattGroupNum: this.batt.GroupIndexInFBSDevice+1,
        })
        .then((res) => {
          let rs = JSON.parse(res.data.result);
@@ -2747,6 +3052,7 @@
        .stop({
          num: const_61850.cmd.stop,
          dev_id: this.batt.FBSDeviceId,
          BattGroupNum: this.batt.GroupIndexInFBSDevice+1,
        })
        .then((res) => {
          let rs = JSON.parse(res.data.result);
@@ -2901,8 +3207,7 @@
      let batt = this.batt;
      let isLithium = regEquipType(batt.FBSDeviceId, ["lithium", "lithiumPack"]);
      if (isLithium) {
        this.$apis.dcdc
          .getDcDcAnalogParams({
        this.$apis.dcdc.getDcDcAnalogParams({
            devId: batt.FBSDeviceId,
            groupNum: batt.GroupIndexInFBSDevice
          })
@@ -2911,10 +3216,15 @@
            if (rs.code == 1 && rs.data.length != 0) {
              // 剩余容量进行累加
              let restCap = 0;
              let packVols = [];
              let packCurrs = [];
              rs.data.map(item=>{
                restCap += item.restCap;
                packVols.push(item.sumVol);
                packCurrs.push(item.current);
              });
              this.packVols = packVols;
              this.packCurrs = packCurrs;
              let data = rs.data[0];
              data.restCap = restCap;
              this.lithiumParams.analog = data;
@@ -3094,6 +3404,20 @@
    closeDisChargeDialog() {
      this.dischargeDialog.show = false;
    },
     startFaceSuccess() {
         this.startFaceShow = false;
        let batt = this.batt;
        let loading = this.$layer.loading();
        this.$apis.outline.restart(batt.FBSDeviceId).then((res) => {
           let rs = JSON.parse(res.data.result);
           if (rs.code == 1) {
              this.$alert("发送重启命令成功", "系统提示");
           } else {
              this.$alert("发送重启命令失败!", "系统提示");
           }
           this.$layer.close(loading);
        }).catch((error) => {});
     },
    restartSystem() {
      let self = this;
      let batt = this.batt;
@@ -3102,27 +3426,17 @@
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        inputType: "password",
      })
        .then(({ value }) => {
      }).then(({ value }) => {
          if (value == resetPwd) {
            let loading = this.$layer.loading();
            this.$apis.outline
              .restart(batt.FBSDeviceId)
              .then((res) => {
                let rs = JSON.parse(res.data.result);
                if (rs.code == 1) {
                  this.$alert("发送重启命令成功", "系统提示");
                } else {
                  this.$alert("发送重启命令失败!", "系统提示");
                }
                this.$layer.close(loading);
              })
              .catch((error) => {});
             if (config.dischargeByFace.value) {
                     this.startFaceShow = true;
             }else {
                this.startFaceSuccess();
             }
          } else {
            this.$layer.msg("密码不正确");
          }
        })
        .catch(() => {});
        }).catch(() => {});
    },
    changeSkin() {
      this.$nextTick(() => {
@@ -3193,9 +3507,9 @@
          }
          if(data.rlayworkmode == 1 || data.rlayworkmode == 3) {
            this.buscoupleSwitch = 1;
          }else {
            this.buscoupleSwitch = 0;
          }else {
            this.buscoupleSwitch = 1;
          }
        }).catch(error=>{
          this.buscoupleSwitch = 0;
@@ -3220,6 +3534,7 @@
          2: "充电",
          3: "放电",
          4: "均充",
          5: "内阻测试"
        },
        list = {
          batt_state: "未知",
@@ -3231,6 +3546,11 @@
          batt_syrl_cap: "---",
          sysc: "------",
        };
      if(this.cdshStatus == "cdsh"){
        list.MonCount = "0";
        list.MonVolStd = "0V";
      }
      if (this.diagram.type == -1) {
        return list;
      }
@@ -3251,6 +3571,11 @@
      list.batt_test_tlong = formatSeconds(this.inputs.batt_test_tlong);
      list.batt_test_cap = this.inputs.batt_test_cap.toFixed(1) + "AH";
      if(this.cdshStatus == "cdsh"){
        list.MonCount = this.inputs.MonCount;
        list.MonVolStd = this.inputs.MonVolStd + "V";
      }
      if (this.inputs.batt_state === 3) {
        // 为0是不更新剩余容量
        if(this.inputs.batt_rest_cap != 0) {
@@ -3487,6 +3812,7 @@
  destroyed() {
    window.removeEventListener("resize", this.resize);
    this.timer.stop();
    this.timer2.stop();
  },
};
</script>
@@ -3679,4 +4005,18 @@
  font-size: 14px;
  padding: 0;
}
.wx_guides{
  height: 150px;
  text-align: center;
  background-color: #ffffff;
  padding-top: 15%;
}
.wx_guides p {
  display: inline-block;
  margin-right: 10px;
}
.wx_guides p /deep/.el-input__inner {
  color:#000;
}
</style>