<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>
|
<div class="table-layout">
|
<div class="table-row">
|
<div class="table-cell pr16">
|
<el-form-item :label="rangeLabel.DisCurr" prop="DisCurr">
|
<el-input v-model="params.DisCurr"></el-input>
|
</el-form-item>
|
</div>
|
<div class="table-cell pr16">
|
<el-form-item label="放电小时率">
|
<el-input v-model="params.HourRate"></el-input>
|
</el-form-item>
|
</div>
|
<div class="table-cell">
|
<el-form-item label="放电容量(0~90000AH)" prop="DisCap">
|
<el-input v-model="params.DisCap"></el-input>
|
</el-form-item>
|
</div>
|
</div>
|
<div class="table-row">
|
<div class="table-cell pr16">
|
<el-form-item label="放电时长(0~5940分钟)" prop="DisTime">
|
<el-input v-model="params.DisTime"></el-input>
|
</el-form-item>
|
</div>
|
<div class="table-cell pr16">
|
<el-form-item :label="rangeLabel.MonomerVol_Low" prop="MonomerVol_Low">
|
<el-input v-model="params.MonomerVol_Low"></el-input>
|
</el-form-item>
|
</div>
|
<div class="table-cell">
|
<el-form-item :label="rangeLabel.GroupVol_Low" prop="GroupVol_Low">
|
<el-input v-model="params.GroupVol_Low"></el-input>
|
</el-form-item>
|
</div>
|
</div>
|
<div class="table-row">
|
<div class="table-cell pr16">
|
<el-form-item label="单体下限数量" prop="MonomerLowCount">
|
<el-input v-model="params.MonomerLowCount"></el-input>
|
</el-form-item>
|
</div>
|
<div class="table-cell pr16">
|
<el-form-item label="在线电压低处理">
|
<el-select v-model="params.OnlineLowAction" placeholder="请选择">
|
<el-option
|
label="停止测试"
|
:value="0"></el-option>
|
<el-option
|
label="继续测试"
|
:value="1"></el-option>
|
</el-select>
|
</el-form-item>
|
</div>
|
<div class="table-cell">
|
<el-form-item label="升压上限(V)">
|
<el-input v-model="params.DCVolHighLimit"></el-input>
|
</el-form-item>
|
</div>
|
</div>
|
<div class="table-row">
|
<div class="table-cell pr16">
|
<el-form-item label="充电电流(A)">
|
<el-input v-model="params.ChargeCurrSet"></el-input>
|
</el-form-item>
|
</div>
|
<div class="table-cell pr16">
|
<el-form-item label="单体温度上限(℃)">
|
<el-input v-model="params.MonomerTmp_High"></el-input>
|
</el-form-item>
|
</div>
|
</div>
|
</div>
|
<div class="form-footer">
|
<!-- <three-btn>清除告警</three-btn> -->
|
<three-btn :disabled="!startTestFlag" @click="startTestCheck">启动测试</three-btn>
|
<!-- <three-btn @click="startTestCheck">启动测试</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="auto"
|
:visible.sync="autoCheck"
|
:close-on-click-modal="false"
|
top="0"
|
class="dialog-center"
|
:modal="false"
|
:close-on-press-escape="false"
|
:modal-append-to-body="true">
|
<auto-check v-if="autoCheck" @success="startTest" :visible.sync="autoCheck" :batt="batt"></auto-check>
|
</el-dialog>
|
</el-form>
|
</template>
|
|
<script>
|
import {
|
regEquipType,
|
testVal
|
} from "@/assets/js/tools";
|
import {
|
const_9100
|
} from "@/assets/js/const"
|
import config from "@/assets/js/config";
|
import checkFace from "@/components/checkFace";
|
import autoCheck from "@/pages/dataTest/dialogs/autoCheck";
|
export default {
|
name: "BtsDischargeParams",
|
components: {
|
checkFace,
|
autoCheck
|
},
|
props: {
|
batt: {
|
type: Object,
|
default() {
|
return {}
|
}
|
}
|
},
|
data() {
|
let cmd = const_9100.cmd;
|
let testType = const_9100.testType;
|
let rules = const_9100.dischargeRules;
|
let batt = this.batt;
|
// 修改组端下限的取值范围
|
if(regEquipType(batt.FBSDeviceId, "lithium")) {
|
rules.GroupVol_Low.min = (16*batt.MonVolStd*0.875).toHold(1);
|
rules.GroupVol_Low.max = (16*batt.MonVolStd*1.125).toHold(1);
|
rules.GroupVol_Low.msg = "取值范围"+rules.GroupVol_Low.min+"~"+rules.GroupVol_Low.max+"(保留一位小数)";
|
}else if(regEquipType(batt.FBSDeviceId, "lithiumPack")) {
|
rules.GroupVol_Low.min = (48*0.875).toHold(1);
|
rules.GroupVol_Low.max = (48*1.125).toHold(1);
|
rules.GroupVol_Low.msg = "取值范围"+rules.GroupVol_Low.min+"~"+rules.GroupVol_Low.max+"(保留一位小数)";
|
}else {
|
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+"(保留一位小数)";
|
if(regEquipType(batt.FBSDeviceId, "BTS")) {
|
// 修改放电电流取值范围
|
rules.DisCurr.max = Math.floor(batt.DisCurrMax);
|
}else {
|
rules.DisCurr.max = 1000;
|
}
|
rules.DisCurr.msg = "取值范围"+rules.DisCurr.min+"~"+rules.DisCurr.max;
|
|
return {
|
autoCheck: false,
|
setFaceShow: false,
|
startFaceShow: false,
|
cmd: cmd, // 操作命令
|
startTestFlag: false, // 启动测试的状态
|
setTestFlag: false, // 设置参数的状态
|
testType: testType, // 测试类型
|
params: {
|
num: 0, //命令
|
dev_id: 0, //设备id
|
BattGroupNum: 0, //电池组编号
|
DisCurr: 0, //放电电流
|
DisCap: 0, //放电容量
|
DisTime: 0, //放电时长
|
GroupVol_Low: 0, //组端下限阀值
|
HourRate: 0, //放电小时率
|
MonomerLowCount: 0, //单体下限数量
|
MonomerVol_Low: 0, //单体下限阀值
|
OnlineLowAction: 0, //在线电压低处理
|
TestCmd: 37, //测试类型
|
ChargeCurrSet: 0, //充电电流
|
DCVolHighLimit: 0, //升压上限
|
MonomerTmp_High: 0 //温度上限
|
},
|
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
|
},
|
DisCurr: {
|
name: '放电电流',
|
unit: 'A',
|
min: rules.DisCurr.min,
|
max: rules.DisCurr.max
|
},
|
},
|
rules: {
|
DisCurr: [{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, rules.DisCurr)
|
},
|
trigger: 'change'
|
}],
|
DisCap: [{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, rules.DisCap)
|
},
|
trigger: 'change'
|
}],
|
DisTime: [{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, rules.DisTime)
|
},
|
trigger: 'change'
|
}],
|
MonomerVol_Low: [{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, rules.MonomerVol_Low)
|
},
|
trigger: 'change'
|
}],
|
GroupVol_Low: [{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, rules.GroupVol_Low)
|
},
|
trigger: 'change'
|
}],
|
},
|
}
|
},
|
methods: {
|
initParams() {
|
// 初始化参数
|
this.params = {
|
num: 0, //命令
|
dev_id: 0, //设备id
|
BattGroupNum: 0, //电池组编号
|
DisCurr: 0, //放电电流
|
DisCap: 0, //放电容量
|
DisTime: 0, //放电时长
|
GroupVol_Low: 0, //组端下限阀值
|
HourRate: 0, //放电小时率
|
MonomerLowCount: 0, //单体下限数量
|
MonomerVol_Low: 0, //单体下限阀值
|
OnlineLowAction: 0, //在线电压低处理
|
TestCmd: 37, //测试类型
|
ChargeCurrSet: 0, //充电电流
|
DCVolHighLimit: 0, //升压上限
|
MonomerTmp_High: 0 //温度上限
|
};
|
},
|
// 获取参数
|
getParams(showLoad) {
|
// 定义等待框
|
let loading;
|
if (showLoad) {
|
loading = this.$layer.loading(1);
|
}
|
// 启动按钮不可点击
|
this.startTestFlag = false;
|
|
// 查询后台
|
this.$apis.dischargeTest.bts.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 testType = this.testType;
|
let fsparam = rs.data[0].fsparam;
|
let isIn = this.checkValIsInObjects(fsparam.TestCmd, testType);
|
// 遍历参数属性并赋值
|
for (let key in this.params) {
|
if (key === "TestCmd" && !isIn) {
|
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.params.BattGroupNum = this.otherParams.GroupIndexInFBSDevice;
|
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.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.bts.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("密码检测通过,启动测试");
|
// 启动测试
|
if(regEquipType(this.batt.FBSDeviceId, ["xxxBTS9120"])) {
|
this.autoCheck = true;
|
}else {
|
this.startTest();
|
}
|
|
}else {
|
this.$layer.msg("启动口令错误!");
|
}
|
}).catch(error=>{
|
console.log(error);
|
this.$layer.msg("网络请求异常");
|
});
|
});
|
|
},
|
// 启动
|
startTest() {
|
// 等待框
|
let loading = this.$layer.loading(1);
|
// 请求后台
|
this.$apis.dischargeTest.bts.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('启动测试失败,启动测试请求异常!');
|
});
|
},
|
checkValIsInObjects(val, objects) {
|
let rs = false;
|
for(let i=0; i<objects.length; i++) {
|
let obj = objects[i];
|
if(obj.value === val) {
|
rs = true;
|
break;
|
}
|
}
|
return false;
|
},
|
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() {
|
// 获取数据
|
this.getParams(true);
|
}
|
}
|
</script>
|
|
<style scoped>
|
.form-footer {
|
margin-top: 16px;
|
margin-bottom: 16px;
|
text-align: right;
|
}
|
|
.form-footer .three-btn {
|
margin-left: 12px;
|
}
|
</style>
|