he wei
2022-06-25 55d7decf3ece27a6c213f1d2a8ae53d176f3b7bd
U 实时页面修改
3个文件已修改
1063 ■■■■■ 已修改文件
src/components/params/61850/DischargeParams.vue 1041 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/params/DischargeDialogContent.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/dataTest/realTime.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/params/61850/DischargeParams.vue
@@ -1,479 +1,628 @@
<template>
    <el-form
        ref="ruleForm"
        size="mini"
        label-position="top"
        :model="params"
        :rules="rules"
        class="params-dialog">
        <el-form-item label="电池组名称">
            <el-input v-model="otherParams.groupName" readonly></el-input>
        </el-form-item>
        <div class="table-layout">
            <div class="table-row">
                <div class="table-cell pr16">
                    <el-form-item label="设备ID">
                        <el-input v-model="otherParams.FBSDeviceId" readonly></el-input>
                    </el-form-item>
                </div>
                <div class="table-cell">
                    <el-form-item label="电池组信息">
                        <el-input v-model="otherParams.groupInfo" readonly></el-input>
                    </el-form-item>
                </div>
            </div>
            <div class="table-row">
                <div class="table-cell pr16">
                    <el-form-item label="电池组号">
                        <el-input v-model="otherParams.GroupIndexInFBSDevice" readonly></el-input>
                    </el-form-item>
                </div>
                <div class="table-cell">
                    <el-form-item label="测试类型">
                        <el-select v-model="params.TestCmd" placeholder="请选择">
                            <el-option
                                v-for="item in testType" :key="item.value"
                                :label="item.label"
                                :value="item.value"></el-option>
                        </el-select>
                    </el-form-item>
                </div>
            </div>
            <div class="table-row">
                <div class="table-cell pr16">
                    <el-form-item label="核容电流(1~300A)" prop="DisCurr">
                        <el-input v-model="params.DisCurr" :readonly="readOnly"></el-input>
                    </el-form-item>
                </div>
                <div class="table-cell">
                    <el-form-item label="核容时长(1~10000分钟)" prop="DisTime">
                        <el-input v-model="params.DisTime" :readonly="readOnly"></el-input>
                    </el-form-item>
                </div>
            </div>
            <div class="table-row">
                <div class="table-cell pr16">
                    <el-form-item label="核容容量(1~2000AH)" prop="DisCap">
                        <el-input v-model="params.DisCap" :readonly="readOnly"></el-input>
                    </el-form-item>
                </div>
                <div class="table-cell">
                    <el-form-item label="单体温度上限(10~60℃)" prop="MonomerTmp_High">
                        <el-input v-model="params.MonomerTmp_High" :readonly="readOnly"></el-input>
                    </el-form-item>
                </div>
            </div>
            <div class="table-row">
                <div class="table-cell pr16">
                    <el-form-item :label="rangeLabel.GroupVol_Low" prop="GroupVol_Low">
                        <el-input v-model="params.GroupVol_Low" :readonly="readOnly"></el-input>
                    </el-form-item>
                </div>
                <div class="table-cell">
                    <el-form-item :label="rangeLabel.MonomerVol_Low" prop="MonomerVol_Low">
                        <el-input v-model="params.MonomerVol_Low" :readonly="readOnly"></el-input>
                    </el-form-item>
                </div>
            </div>
            <div class="table-row">
                <div class="table-cell pr16">
                    <el-form-item label="升压上限(V)">
                        <el-input v-model="params.DCVolHighLimit"></el-input>
                    </el-form-item>
                </div>
                <div class="table-cell">
                    <el-form-item label="充电电流(A)">
                        <el-input v-model="params.ChargeCurrSet"></el-input>
                    </el-form-item>
                </div>
            </div>
  <el-form
    ref="ruleForm"
    size="mini"
    label-position="top"
    :model="params"
    :rules="rules"
    class="params-dialog"
  >
    <el-form-item label="电池组名称">
      <el-input v-model="otherParams.groupName" readonly></el-input>
    </el-form-item>
    <div class="table-layout">
      <div class="table-row">
        <div class="table-cell pr16">
          <el-form-item label="设备ID">
            <el-input v-model="otherParams.FBSDeviceId" readonly></el-input>
          </el-form-item>
        </div>
        <div class="form-footer">
            <!-- <three-btn>清除告警</three-btn> -->
            <three-btn :disabled="!startTestFlag" @click="startTestCheck">启动测试</three-btn>
            <three-btn @click="getParams(true)">读取</three-btn>
            <three-btn :disabled="!setTestFlag" @click="submitFrom">设定</three-btn>
        <div class="table-cell">
          <el-form-item label="电池组信息">
            <el-input v-model="otherParams.groupInfo" readonly></el-input>
          </el-form-item>
        </div>
        <el-dialog
            title="人脸校验" width="480px"
            :visible.sync="setFaceShow"
            :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="setFaceShow" @checkSuccess="setFaceSuccess"></check-face>
        </el-dialog>
        <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>
    </el-form>
      </div>
      <div class="table-row">
        <div class="table-cell pr16">
          <el-form-item label="电池组号">
            <el-input
              v-model="otherParams.GroupIndexInFBSDevice"
              readonly
            ></el-input>
          </el-form-item>
        </div>
        <div class="table-cell">
          <el-form-item label="测试类型">
            <el-select v-model="params.TestCmd" placeholder="请选择">
              <el-option
                v-for="item in testType"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </div>
      </div>
      <div class="table-row">
        <div class="table-cell pr16">
          <el-form-item label="核容电流(1~300A)" prop="DisCurr">
            <el-input v-model="params.DisCurr" :readonly="readOnly"></el-input>
          </el-form-item>
        </div>
        <div class="table-cell">
          <el-form-item label="核容时长(1~10000分钟)" prop="DisTime">
            <el-input v-model="params.DisTime" :readonly="readOnly"></el-input>
          </el-form-item>
        </div>
      </div>
      <div class="table-row">
        <div class="table-cell pr16">
          <el-form-item label="核容容量(1~2000AH)" prop="DisCap">
            <el-input v-model="params.DisCap" :readonly="readOnly"></el-input>
          </el-form-item>
        </div>
        <div class="table-cell">
          <el-form-item label="单体温度上限(10~60℃)" prop="MonomerTmp_High">
            <el-input
              v-model="params.MonomerTmp_High"
              :readonly="readOnly"
            ></el-input>
          </el-form-item>
        </div>
      </div>
      <div class="table-row">
        <div class="table-cell pr16">
          <el-form-item :label="rangeLabel.GroupVol_Low" prop="GroupVol_Low">
            <el-input
              v-model="params.GroupVol_Low"
              :readonly="readOnly"
            ></el-input>
          </el-form-item>
        </div>
        <div class="table-cell">
          <el-form-item
            :label="rangeLabel.MonomerVol_Low"
            prop="MonomerVol_Low"
          >
            <el-input
              v-model="params.MonomerVol_Low"
              :readonly="readOnly"
            ></el-input>
          </el-form-item>
        </div>
      </div>
      <div class="table-row">
        <div class="table-cell pr16">
          <el-form-item label="升压上限(V)">
            <el-input v-model="params.DCVolHighLimit"></el-input>
          </el-form-item>
        </div>
        <div class="table-cell">
          <el-form-item label="充电电流(A)">
            <el-input v-model="params.ChargeCurrSet"></el-input>
          </el-form-item>
        </div>
      </div>
    </div>
    <div class="form-footer">
      <!-- <three-btn>清除告警</three-btn> -->
      <three-btn :disabled="!startTestFlag" @click="monDataShow = true"
        >启动测试</three-btn
      >
      <three-btn @click="getParams(true)">读取</three-btn>
      <three-btn :disabled="!setTestFlag" @click="submitFrom">设定</three-btn>
    </div>
    <el-dialog
      title="人脸校验"
      width="480px"
      :visible.sync="setFaceShow"
      :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="setFaceShow"
        @checkSuccess="setFaceSuccess"
      ></check-face>
    </el-dialog>
    <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>
    <el-dialog
      title="单体数据面板"
      width="500px"
      :visible.sync="monDataShow"
      :close-on-click-modal="false"
      top="0"
      :modal="false"
      class="dialog-center"
      :modal-append-to-body="false"
      :destroy-on-close="true"
    >
      <div class="d_contain">
        <el-table :data="monData.datas" height="400">
          <el-table-column
            v-for="(header, key) in monData.headers"
            :key="key"
            :prop="header.prop"
            :label="header.label"
            :width="header.width"
            :min-width="header.minWidth"
            align="center"
          ></el-table-column>
        </el-table>
        <div class="footer">
          <three-btn @click="startTestCheck">确定</three-btn>
        </div>
      </div>
    </el-dialog>
  </el-form>
</template>
<script>
import {
    const_61850,
} from '../../../assets/js/const/index'
import { const_61850 } from "../../../assets/js/const/index";
import {
    testVal
} from '../../../assets/js/tools'
import { testVal } from "../../../assets/js/tools";
import CheckFace from "@/components/checkFace";
import config from "@/assets/js/config";
export default {
    components: {CheckFace},
    props: {
        batt: {
            type: Object,
            default() {
                return {}
            }
        }
  components: { CheckFace },
  props: {
    batt: {
      type: Object,
      default() {
        return {};
      },
    },
    data() {
        let cmd = const_61850.cmd;
        let testType = const_61850.testType;
        let rules = const_61850.dischargeRules;
        let batt = this.batt;
        // 修改组端下限的取值范围
        rules.GroupVol_Low.min = (batt.MonCount*batt.MonVolStd*0.875).toHold(1);
        rules.GroupVol_Low.max = (batt.MonCount*batt.MonVolStd*1.125).toHold(1);
        rules.GroupVol_Low.msg = "取值范围"+rules.GroupVol_Low.min+"~"+rules.GroupVol_Low.max+"(保留一位小数)";
        // 修改电池单体下限的取值范围
        rules.MonomerVol_Low.min = (batt.MonVolStd*0.9).toHold(1);
        rules.MonomerVol_Low.max = (batt.MonVolStd*1.2).toHold(1);
        rules.MonomerVol_Low.msg = "取值范围"+rules.MonomerVol_Low.min+"~"+rules.MonomerVol_Low.max+"(保留一位小数)";
        return {
            setFaceShow: false,
            startFaceShow: false,
            cmd: cmd,       // 操作命令
            testType: testType,    // 测试类型
            startTestFlag: false,       // 启动测试的状态
            setTestFlag: false,         // 设置参数的状态
            readOnly: false,
            ranges: {
                GroupVol_Low: {
                    name: '组端电压下限',
                    unit: 'V',
                    min: rules.GroupVol_Low.min,
                    max: rules.GroupVol_Low.max
                },
                MonomerVol_Low: {
                    name: '单体电压下限',
                    unit: 'V',
                    min: rules.MonomerVol_Low.min,
                    max: rules.MonomerVol_Low.max
                }
            },
            params: {
                num: 0,
                dev_id: 0,     // 设备id
                TestCmd: 37,    // 测试类型
                DisCap: 0,     // 核容容量
                DisCurr: 0,    // 核容电流
                DisTime: 0,    // 核容时长
                GroupVol_Low: 0,    // 组端电压下限
                MonomerVol_Low: 0,  // 单体电压下限
                MonomerTmp_High: 0, // 单体温度上限
                DCVolHighLimit: 0,  // 升压上限
                ChargeCurrSet: 0, // 充电电流
                BattGroupNum: 0,  // 电池组编号
            },
            rules: {
                DisCap: [{
                    validator(rule, value, callback) {
                        testVal(rule, value, callback, rules.DisCap)
                    },
                    trigger: 'change'
                }],
                DisCurr: [{
                    validator(rule, value, callback) {
                        testVal(rule, value, callback, rules.DisCurr)
                    },
                    trigger: 'change'
                }],
                DisTime: [{
                    validator(rule, value, callback) {
                        testVal(rule, value, callback, rules.DisTime)
                    },
                    trigger: 'change'
                }],
                GroupVol_Low: [{
                    validator(rule, value, callback) {
                        testVal(rule, value, callback, rules.GroupVol_Low)
                    },
                    trigger: 'change'
                }],
                MonomerVol_Low: [{
                    validator(rule, value, callback) {
                        testVal(rule, value, callback, rules.MonomerVol_Low)
                    },
                    trigger: 'change'
                }],
                MonomerTmp_High: [{
                    validator(rule, value, callback) {
                        testVal(rule, value, callback, rules.MonomerTmp_High)
                    },
                    trigger: 'change'
                }],
            },
        }
    tdata: {
      type: Array,
      default() {
        return [];
      },
    },
    watch: {
        params: {
            handler(params) {
                if (params.TestCmd == 72 || params.TestCmd == 50) {
                    this.readOnly = true;
                } else {
                    this.readOnly = false;
                }
                this.startTestFlag = false;
            },
            deep: true,
  },
  data() {
    let cmd = const_61850.cmd;
    let testType = const_61850.testType;
    let rules = const_61850.dischargeRules;
    let batt = this.batt;
    // 修改组端下限的取值范围
    rules.GroupVol_Low.min = (batt.MonCount * batt.MonVolStd * 0.875).toHold(1);
    rules.GroupVol_Low.max = (batt.MonCount * batt.MonVolStd * 1.125).toHold(1);
    rules.GroupVol_Low.msg =
      "取值范围" +
      rules.GroupVol_Low.min +
      "~" +
      rules.GroupVol_Low.max +
      "(保留一位小数)";
    // 修改电池单体下限的取值范围
    rules.MonomerVol_Low.min = (batt.MonVolStd * 0.9).toHold(1);
    rules.MonomerVol_Low.max = (batt.MonVolStd * 1.2).toHold(1);
    rules.MonomerVol_Low.msg =
      "取值范围" +
      rules.MonomerVol_Low.min +
      "~" +
      rules.MonomerVol_Low.max +
      "(保留一位小数)";
    return {
      setFaceShow: false,
      startFaceShow: false,
      cmd: cmd, // 操作命令
      testType: testType, // 测试类型
      startTestFlag: false, // 启动测试的状态
      setTestFlag: false, // 设置参数的状态
      readOnly: false,
      monDataShow: false,
      monData: {
        headers: [
          {
            prop: "num1",
            label: "单体编号",
            Width: 80,
          },
          {
            prop: "vol1",
            label: "单体电压",
            width: 120,
          },
          {
            prop: "temp1",
            label: "单体温度",
            width: 120,
          },
          {
            prop: "res1",
            label: "单体内阻",
            width: 120,
          },
        ],
        datas: [],
      },
      ranges: {
        GroupVol_Low: {
          name: "组端电压下限",
          unit: "V",
          min: rules.GroupVol_Low.min,
          max: rules.GroupVol_Low.max,
        },
        MonomerVol_Low: {
          name: "单体电压下限",
          unit: "V",
          min: rules.MonomerVol_Low.min,
          max: rules.MonomerVol_Low.max,
        },
      },
      params: {
        num: 0,
        dev_id: 0, // 设备id
        TestCmd: 37, // 测试类型
        DisCap: 0, // 核容容量
        DisCurr: 0, // 核容电流
        DisTime: 0, // 核容时长
        GroupVol_Low: 0, // 组端电压下限
        MonomerVol_Low: 0, // 单体电压下限
        MonomerTmp_High: 0, // 单体温度上限
        DCVolHighLimit: 0, // 升压上限
        ChargeCurrSet: 0, // 充电电流
        BattGroupNum: 0, // 电池组编号
      },
      rules: {
        DisCap: [
          {
            validator(rule, value, callback) {
              testVal(rule, value, callback, rules.DisCap);
            },
            trigger: "change",
          },
        ],
        DisCurr: [
          {
            validator(rule, value, callback) {
              testVal(rule, value, callback, rules.DisCurr);
            },
            trigger: "change",
          },
        ],
        DisTime: [
          {
            validator(rule, value, callback) {
              testVal(rule, value, callback, rules.DisTime);
            },
            trigger: "change",
          },
        ],
        GroupVol_Low: [
          {
            validator(rule, value, callback) {
              testVal(rule, value, callback, rules.GroupVol_Low);
            },
            trigger: "change",
          },
        ],
        MonomerVol_Low: [
          {
            validator(rule, value, callback) {
              testVal(rule, value, callback, rules.MonomerVol_Low);
            },
            trigger: "change",
          },
        ],
        MonomerTmp_High: [
          {
            validator(rule, value, callback) {
              testVal(rule, value, callback, rules.MonomerTmp_High);
            },
            trigger: "change",
          },
        ],
      },
    };
  },
  watch: {
    params: {
      handler(params) {
        if (params.TestCmd == 72 || params.TestCmd == 50) {
          this.readOnly = true;
        } else {
          this.readOnly = false;
        }
        this.startTestFlag = false;
      },
      deep: true,
    },
    methods: {
        initParams() {
  },
  methods: {
    initParams() {
      // 初始化参数
      this.params = {
        num: 0,
        dev_id: 0, // 设备id
        TestCmd: 37, // 测试类型
        DisCap: 0, // 核容容量
        DisCurr: 0, // 核容电流
        DisTime: 0, // 核容时长
        GroupVol_Low: 0, // 组端电压下限
        MonomerVol_Low: 0, // 单体电压下限
        MonomerTmp_High: 0, // 单体温度上限
        DCVolHighLimit: 0, // 升压上限
        ChargeCurrSet: 0, // 充电电流
        BattGroupNum: 0, // 电池组编号
      };
    },
    // 获取参数
    getParams(showLoad) {
      // 定义等待框
      let loading;
      if (showLoad) {
        loading = this.$layer.loading(1);
      }
      // 启动按钮不可点击
      this.startTestFlag = false;
      // 查询后台
      this.$apis.dischargeTest.e61850
        .getParams({
          num: this.cmd.get,
          dev_id: this.batt.FBSDeviceId,
          BattGroupNum: this.batt.GroupIndexInFBSDevice + 1,
        })
        .then((res) => {
          let rs = JSON.parse(res.data.result);
          if (rs.code == 1) {
            let fsparam = rs.data[0].fsparam;
            // 遍历参数属性并赋值
            for (let key in this.params) {
              if (key === "TestCmd") {
                this.params.TestCmd = 37;
              } else {
                this.params[key] = fsparam[key];
              }
            }
            // 设置的命令和dev_id
            this.params.num = this.cmd.set;
            this.params.dev_id = this.batt.FBSDeviceId;
            this.$layer.msg("读取成功!");
            // 设置按钮可点击
            this.setTestFlag = true;
          } else {
            // 初始化参数
            this.params = {
                num: 0,
                dev_id: 0,     // 设备id
                TestCmd: 37,    // 测试类型
                DisCap: 0,     // 核容容量
                DisCurr: 0,    // 核容电流
                DisTime: 0,    // 核容时长
                GroupVol_Low: 0,    // 组端电压下限
                MonomerVol_Low: 0,  // 单体电压下限
                MonomerTmp_High: 0, // 单体温度上限
                DCVolHighLimit: 0,  // 升压上限
                ChargeCurrSet: 0, // 充电电流
                BattGroupNum: 0,  // 电池组编号
            };
        },
        // 获取参数
        getParams(showLoad) {
            // 定义等待框
            let loading;
            if (showLoad) {
                loading = this.$layer.loading(1);
            this.initParams();
            // 设置按钮不可点击
            this.setTestFlag = false;
            this.$layer.msg("读取失败!");
          }
          // 关闭等待框
          this.$layer.close(loading);
        })
        .catch((error) => {
          console.log(error);
          // 初始化参数
          this.initParams();
          // 设置按钮不可点击
          this.setTestFlag = false;
          // 关闭等待框
          this.$layer.close(loading);
          this.$layer.msg("读取失败,读取请求异常!");
        });
    },
    // 提交表单设置参数
    submitFrom() {
      this.$refs.ruleForm.validate((valid) => {
        // 校验通过
        if (valid) {
          // 设置参数
          this.$layer.confirm(
            "确认修改参数",
            { icon: 3, title: "系统提示" },
            (index) => {
              // 关闭确认框
              this.$layer.close(index);
              this.setParamsCheck();
            }
          );
        } else {
          this.$layer.msg("存在校验未通过的数据!");
          return false;
        }
      });
    },
    setParamsCheck() {
      if (config.dischargeByFace.value) {
        this.setFaceShow = true;
      } else {
        this.setParams(true);
      }
    },
    // 设置参数
    setParams() {
      // 等待框
      let loading = this.$layer.loading(1);
      // 请求后台
      this.$apis.dischargeTest.e61850
        .setParams(this.params)
        .then((res) => {
          let rs = JSON.parse(res.data.result);
          if (rs.code == 1) {
            // 启动按钮可点击
            this.startTestFlag = true;
            // 提示信息
            this.$layer.msg("设置成功");
          } else {
            // 启动按钮不可点击
            this.startTestFlag = false;
            // 查询后台
            this.$apis.dischargeTest.e61850.getParams({
                num: this.cmd.get,
                dev_id: this.batt.FBSDeviceId,
                BattGroupNum: this.batt.GroupIndexInFBSDevice+1
            }).then(res => {
                let rs = JSON.parse(res.data.result);
                if (rs.code == 1) {
                    let fsparam = rs.data[0].fsparam;
                    // 遍历参数属性并赋值
                    for (let key in this.params) {
                        if (key === "TestCmd") {
                            this.params.TestCmd = 37;
                        } else {
                            this.params[key] = fsparam[key];
                        }
                    }
                    // 设置的命令和dev_id
                    this.params.num = this.cmd.set;
                    this.params.dev_id = this.batt.FBSDeviceId;
                    this.$layer.msg('读取成功!');
                    // 设置按钮可点击
                    this.setTestFlag = true;
                } else {
                    // 初始化参数
                    this.initParams();
                    // 设置按钮不可点击
                    this.setTestFlag = false;
                    this.$layer.msg('读取失败!');
                }
                // 关闭等待框
                this.$layer.close(loading);
            }).catch(error => {
                console.log(error);
                // 初始化参数
                this.initParams();
                // 设置按钮不可点击
                this.setTestFlag = false;
                // 关闭等待框
                this.$layer.close(loading);
                this.$layer.msg('读取失败,读取请求异常!');
            });
        },
        // 提交表单设置参数
        submitFrom() {
            this.$refs.ruleForm.validate((valid) => {
                // 校验通过
                if (valid) {
                    // 设置参数
                    this.$layer.confirm("确认修改参数", {icon: 3, title: '系统提示'}, (index)=>{
                        // 关闭确认框
                        this.$layer.close(index);
                        this.setParamsCheck();
                    });
                } else {
                    this.$layer.msg('存在校验未通过的数据!');
                    return false;
                }
            });
        },
        setParamsCheck() {
           if(config.dischargeByFace.value) {
               this.setFaceShow = true;
           }else {
               this.setParams(true);
           }
        },
        // 设置参数
        setParams() {
            // 等待框
            let loading = this.$layer.loading(1);
            // 请求后台
            this.$apis.dischargeTest.e61850.setParams(this.params).then(res => {
                let rs = JSON.parse(res.data.result);
                if (rs.code == 1) {
                    // 启动按钮可点击
                    this.startTestFlag = true;
                    // 提示信息
                    this.$layer.msg('设置成功');
                } else {
                    // 启动按钮不可点击
                    this.startTestFlag = false;
                    // 提示信息
                    this.$layer.msg('设置失败!');
                }
                // 关闭等待框
                this.$layer.close(loading);
            }).catch(error => {
                console.log(error);
                // 关闭等待框
                this.$layer.close(loading);
                // 启动按钮不可点击
                this.startTestFlag = false;
                // 提示信息
                this.$layer.msg('设置失败,设置请求异常!');
            });
        },
        startTestCheck() {
            if(config.dischargeByFace.value) {
                this.startFaceShow = true;
            }else {
                this.confirmStartTest();
            }
        },
        // 确认框
        confirmStartTest() {
            this.$layer.prompt({title: '输入启动口令,并确认', formType: 2, area: ['300px', '180px']}, (pass, index) => {
                // 请求后台校验密码
                this.$apis.login.checkUserPwd(pass).then(res=>{
                    let rs = JSON.parse(res.data.result);
                    if(rs.code == 1) {
                        // 关闭弹出框
                        this.$layer.close(index);
                        this.$layer.msg("密码检测通过,启动测试");
                        // 启动测试
                        this.startTest();
                    }else {
                        this.$layer.msg("启动口令错误!");
                    }
                }).catch(error=>{
                    console.log(error);
                    this.$layer.msg("网络请求异常");
                });
            });
        },
        // 启动
        startTest() {
            // 等待框
            let loading = this.$layer.loading(1);
            // 请求后台
            this.$apis.dischargeTest.e61850.start({
                num: this.cmd.start,
                dev_id: this.batt.FBSDeviceId,
                BattGroupNum: this.batt.GroupIndexInFBSDevice+1,
            }).then(res => {
                let rs = JSON.parse(res.data.result);
                if (rs.code == 1) {
                    // 提示信息
                    this.$layer.msg('启动测试成功');
                    this.$emit('close');
                } else {
                    // 提示信息
                    this.$layer.msg('启动测试失败!');
                }
                // 关闭等待框
                this.$layer.close(loading);
            }).catch(error => {
                console.log(error);
                // 关闭等待框
                this.$layer.close(loading);
                // 提示信息
                this.$layer.msg('启动测试失败,启动测试请求异常!');
            });
        },
        setFaceSuccess() {
            this.setFaceShow = false;
            this.setParams();
        },
        startFaceSuccess() {
            this.startFaceShow = false;
            this.startTest();
        },
            // 提示信息
            this.$layer.msg("设置失败!");
          }
          // 关闭等待框
          this.$layer.close(loading);
        })
        .catch((error) => {
          console.log(error);
          // 关闭等待框
          this.$layer.close(loading);
          // 启动按钮不可点击
          this.startTestFlag = false;
          // 提示信息
          this.$layer.msg("设置失败,设置请求异常!");
        });
    },
    computed: {
        otherParams() {
            let batt = this.batt;
            let groupInfo = '单体数量:' + this.batt.MonCount + ";电压(V):"
                + this.batt.MonVolStd + ";容量(AH):" + this.batt.MonCapStd;
            return {
                groupName: batt.StationName + "-" + batt.BattGroupName,
                FBSDeviceId: batt.FBSDeviceId,
                groupInfo: groupInfo,
                GroupIndexInFBSDevice: this.batt.GroupIndexInFBSDevice + 1,
            }
        },
        rangeLabel() {
            let ranges = this.ranges;
            let result = {};
            for(let key in ranges) {
                let item = ranges[key];
                result[key] = item.name+"("+item.min+"~"+item.max+item.unit+")";
            }
            return result;
        },
    // 单体数据
    startTestCheck() {
      if (config.dischargeByFace.value) {
        this.startFaceShow = true;
      } else {
        this.confirmStartTest();
      }
    },
    mounted() {
        // 获取数据
        this.getParams(true);
    // 确认框
    confirmStartTest() {
      this.$layer.prompt(
        {
          title: "输入启动口令,并确认",
          formType: 2,
          area: ["300px", "180px"],
        },
        (pass, index) => {
          // 请求后台校验密码
          this.$apis.login
            .checkUserPwd(pass)
            .then((res) => {
              let rs = JSON.parse(res.data.result);
              if (rs.code == 1) {
                // 关闭弹出框
                this.$layer.close(index);
                this.$layer.msg("密码检测通过,启动测试");
                // 启动测试
                this.startTest();
              } else {
                this.$layer.msg("启动口令错误!");
              }
            })
            .catch((error) => {
              console.log(error);
              this.$layer.msg("网络请求异常");
            });
        }
      );
    },
}
    // 启动
    startTest() {
      // 等待框
      let loading = this.$layer.loading(1);
      // 请求后台
      this.$apis.dischargeTest.e61850
        .start({
          num: this.cmd.start,
          dev_id: this.batt.FBSDeviceId,
          BattGroupNum: this.batt.GroupIndexInFBSDevice + 1,
        })
        .then((res) => {
          let rs = JSON.parse(res.data.result);
          if (rs.code == 1) {
            // 提示信息
            this.$layer.msg("启动测试成功");
            this.$emit("close");
          } else {
            // 提示信息
            this.$layer.msg("启动测试失败!");
          }
          // 关闭等待框
          this.$layer.close(loading);
        })
        .catch((error) => {
          console.log(error);
          // 关闭等待框
          this.$layer.close(loading);
          // 提示信息
          this.$layer.msg("启动测试失败,启动测试请求异常!");
        });
    },
    setFaceSuccess() {
      this.setFaceShow = false;
      this.setParams();
    },
    startFaceSuccess() {
      this.startFaceShow = false;
      this.startTest();
    },
  },
  computed: {
    otherParams() {
      let batt = this.batt;
      let groupInfo =
        "单体数量:" +
        this.batt.MonCount +
        ";电压(V):" +
        this.batt.MonVolStd +
        ";容量(AH):" +
        this.batt.MonCapStd;
      return {
        groupName: batt.StationName + "-" + batt.BattGroupName,
        FBSDeviceId: batt.FBSDeviceId,
        groupInfo: groupInfo,
        GroupIndexInFBSDevice: this.batt.GroupIndexInFBSDevice + 1,
      };
    },
    rangeLabel() {
      let ranges = this.ranges;
      let result = {};
      for (let key in ranges) {
        let item = ranges[key];
        result[key] =
          item.name + "(" + item.min + "~" + item.max + item.unit + ")";
      }
      return result;
    },
  },
  mounted() {
    console.log(this.tdata, 99999999999);
    this.monData.datas = this.tdata;
    // 获取数据
    this.getParams(true);
  },
};
</script>
<style scoped>
.d_contain {
  background-color: #ececec;
}
.d_contain .footer {
  text-align: right;
  padding: 8px;
}
.form-footer {
    margin-top: 16px;
    margin-bottom: 16px;
    text-align: right;
  margin-top: 16px;
  margin-bottom: 16px;
  text-align: right;
}
.form-footer .three-btn {
    margin-left: 12px;
  margin-left: 12px;
}
</style>
src/components/params/DischargeDialogContent.vue
@@ -3,6 +3,7 @@
    <discharge-params61850
      v-if="reg61850"
      :batt="batt"
      :tdata="tdata"
      @close="close"
    ></discharge-params61850>
    <bts-discharge-params
@@ -41,6 +42,12 @@
        return {};
      },
    },
    tdata: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  data() {
    return {};
src/pages/dataTest/realTime.vue
@@ -335,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
@@ -738,6 +738,7 @@
    >
      <discharge-dialog-content
        v-if="dischargeDialog.show"
        :tdata="tdata"
        :batt="batt"
        @close="closeDisChargeDialog"
      >
@@ -1065,10 +1066,11 @@
        this.resize();
      });
    },
    "diagram.type"() {
      let batt = this.batt;
      this.getLastCapacityTest(batt);
    }
    // "diagram.type"(n) {
    //   // console.log(n, '===========测试类型:');
    //   let batt = this.batt;
    //   this.getLastCapacityTest(batt);
    // }
  },
  data() {
    let permits = this.$store.state.user.permits;
@@ -1131,6 +1133,7 @@
      chargeMon: "",
      dischargeMon: "",
      acTabs: "eleLine",
      tdata: [],
      table: {
        headers: [
          {
@@ -1899,6 +1902,7 @@
            //this.inversionInfo()
            this.getLithiumAnalog(), // 锂电池模拟量
            this.inversionData(),
            this.getLastCapacityTest(this.batt),
          ])
          .then(() => {
            this.timer.open();
@@ -2720,6 +2724,7 @@
        // 添加正在测试的单体
        this.chargeMon = chargeMon;
        this.dischargeMon = dischargeMon;
        this.tdata = data;
        
        // 更新表格
        if (this.acTabs == "tblData") {