<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="params.groupIndexInFBSDevice"
|
:readonly="!bts9140"
|
></el-input> -->
|
<el-select v-model="params.groupIndexInFBSDevice" placeholder="请选择" :disabled="!bts9140">
|
<el-option
|
v-for="item in groupIndexInFBSDeviceList"
|
:key="item.value"
|
:label="item.value"
|
:value="item.value"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
</div>
|
<div class="table-cell">
|
<el-form-item label="测试类型">
|
<el-select v-model="params.testCmd" :disabled="readOnly" 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" :readonly="readOnly"></el-input>
|
</el-form-item>
|
</div>
|
<div class="table-cell pr16">
|
<el-form-item label="放电小时率">
|
<el-input v-model="params.hourRate" :readonly="readOnly"></el-input>
|
</el-form-item>
|
</div>
|
<div class="table-cell">
|
<el-form-item label="放电容量(0~90000AH)" prop="disCap">
|
<el-input v-model="params.disCap" :readonly="readOnly"></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" :readonly="readOnly"></el-input>
|
</el-form-item>
|
</div>
|
<div class="table-cell pr16">
|
<el-form-item :label="rangeLabel.monomervolLow" prop="monomervolLow">
|
<el-input v-model="params.monomervolLow" :readonly="readOnly"></el-input>
|
</el-form-item>
|
</div>
|
<div class="table-cell">
|
<el-form-item :label="rangeLabel.groupvolLow" prop="groupvolLow">
|
<el-input v-model="params.groupvolLow" :readonly="readOnly"></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" :readonly="readOnly"></el-input>
|
</el-form-item>
|
</div>
|
<div class="table-cell pr16">
|
<el-form-item label="在线电压低处理">
|
<el-select v-model="params.onlineVolLowAction" :disabled="readOnly" 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" :readonly="readOnly"></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" :readonly="readOnly"></el-input>
|
</el-form-item>
|
</div>
|
<div class="table-cell pr16">
|
<el-form-item label="单体温度上限(℃)">
|
<el-input v-model="params.monomertmpHigh" :readonly="readOnly"></el-input>
|
</el-form-item>
|
</div>
|
<div class="table-cell pr16" v-if="bts9140">
|
<el-form-item label="均充电压(18~57.5V)" prop="chargeVolt">
|
<el-input v-model="params.chargeVolt" :readonly="readOnly"></el-input>
|
</el-form-item>
|
</div>
|
</div>
|
</div>
|
<div class="form-footer">
|
<!-- <three-btn>清除告警</three-btn> -->
|
<template v-if="!readOnly">
|
<three-btn :disabled="!startTestFlag" @click="startTestCheck"
|
>启动测试</three-btn
|
>
|
<three-btn @click="getParams(true)">读取</three-btn>
|
<three-btn :disabled="!setTestFlag" @click="submitFrom">设定</three-btn>
|
</template>
|
<three-btn v-else @click="$emit('close')">关闭</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 "./autoCheck";
|
import {
|
setParams,
|
btsControl as getParams,
|
btsControl as start,
|
} from "../js/realTime";
|
import { checkUserPwd } from "@/views/login/js/api";
|
|
export default {
|
name: "BtsDischargeParams",
|
components: {
|
checkFace,
|
AutoCheck,
|
},
|
props: {
|
batt: {
|
type: Object,
|
default() {
|
return {};
|
},
|
},
|
// 只读模式 显示参数用
|
readOnly: {
|
type: Boolean,
|
default: false
|
},
|
paramData: {
|
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 if(regEquipType(batt.fbsdeviceId, "BTS9140")){
|
rules.GroupVol_Low.min = 21.6;
|
rules.GroupVol_Low.max = (batt.monCount * batt.monVolStd * 1.125).toHold(
|
1
|
);
|
} else if(regEquipType(this.batt.fbsdeviceId, ["BTS9120"]) && this.$CFG.clientName.name == 'hzsj') { // 仅送检时使用
|
rules.GroupVol_Low.min = 3;
|
rules.GroupVol_Low.max = 240;
|
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;
|
// // 充电电压
|
// rules.chargeVolt_Low.min = (batt.monVolStd * 0.9).toHold(1);
|
// rules.chargeVolt_Low.max = (batt.monVolStd * 1.2).toHold(1);
|
|
return {
|
autoCheck: false,
|
setFaceShow: false,
|
startFaceShow: false,
|
cmd: cmd, // 操作命令
|
startTestFlag: false, // 启动测试的状态
|
setTestFlag: false, // 设置参数的状态
|
testType: testType, // 测试类型
|
params: {
|
num: 0, //命令
|
devId: 0, //设备id
|
battGroupNum: 0, //电池组编号
|
groupIndexInFBSDevice:1,//电池组编号input
|
disCurr: 0, //放电电流
|
disCap: 0, //放电容量
|
disTime: 0, //放电时长
|
groupvolLow: 0, //组端下限阀值
|
hourRate: 0, //放电小时率
|
monomerLowCount: 0, //单体下限数量
|
monomervolLow: 0, //单体下限阀值
|
onlineVolLowAction: 0, //在线电压低处理
|
testCmd: 37, //测试类型
|
chargeCurrSet: 0, //充电电流
|
dcvolHighLimit: 0, //升压上限
|
monomertmpHigh: 0, //温度上限
|
chargeVolt:0,//充电电压
|
},
|
groupIndexInFBSDeviceList:[
|
{value:0},
|
{value:1},
|
{value:2},
|
],
|
ranges: {
|
groupvolLow: {
|
name: "组端电压下限",
|
unit: "V",
|
min: rules.GroupVol_Low.min,
|
max: rules.GroupVol_Low.max,
|
},
|
monomervolLow: {
|
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",
|
},
|
],
|
monomervolLow: [
|
{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, rules.MonomerVol_Low);
|
},
|
trigger: "change",
|
},
|
],
|
groupvolLow: [
|
{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, rules.GroupVol_Low);
|
},
|
trigger: "change",
|
},
|
],
|
chargeVolt:[
|
{
|
validator(rule, value, callback) {
|
testVal(rule, value, callback, rules.chargeVolt_Low);
|
},
|
trigger: "change",
|
},
|
]
|
},
|
};
|
},
|
methods: {
|
initParams() {
|
// 初始化参数
|
this.params = {
|
num: 0, //命令
|
devId: 0, //设备id
|
battGroupNum: 0, //电池组编号
|
groupIndexInFBSDevice:this.otherParams.groupIndexInFBSDevice,//电池组编号input
|
disCurr: 0, //放电电流
|
disCap: 0, //放电容量
|
disTime: 0, //放电时长
|
groupvolLow: 0, //组端下限阀值
|
hourRate: 0, //放电小时率
|
monomerLowCount: 0, //单体下限数量
|
monomervolLow: 0, //单体下限阀值
|
onlineVolLowAction: 0, //在线电压低处理
|
testCmd: 37, //测试类型
|
chargeCurrSet: 0, //充电电流
|
dcvolHighLimit: 0, //升压上限
|
monomertmpHigh: 0, //温度上限
|
chargeVolt:0
|
};
|
|
},
|
// 获取参数
|
getParams(showLoad) {
|
// 定义等待框
|
let loading;
|
if (showLoad) {
|
loading = this.$layer.loading(1);
|
}
|
// 启动按钮不可点击
|
this.startTestFlag = false;
|
//
|
let parms = {
|
num: this.cmd.get,
|
devId: this.batt.fbsdeviceId,
|
battGroupNum: this.batt.groupIndexInFBSDevice+1
|
}
|
if(this.bts9140){
|
parms.battGroupNum = this.params.groupIndexInFBSDevice;
|
}
|
// 查询后台
|
getParams(parms)
|
.then((res) => {
|
res = res.data;
|
if (res.code && res.data2) {
|
let testType = this.testType;
|
let fsparam = res.data;
|
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];
|
}
|
}
|
// 设置的命令和devId
|
this.params.num = this.cmd.set;
|
this.params.devId = this.batt.fbsdeviceId;
|
if(this.bts9140){//res.data.groupIndexInFBSDevice
|
this.params.battGroupNum = res.data.battGroupNum;
|
this.params.groupIndexInFBSDevice = res.data.battGroupNum;
|
}else{
|
this.params.battGroupNum = this.otherParams.groupIndexInFBSDevice;
|
this.params.groupIndexInFBSDevice = 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);
|
if(this.bts9140 ){
|
this.params.battGroupNum = this.params.groupIndexInFBSDevice;
|
}
|
// 请求后台
|
setParams(this.params)
|
.then((res) => {
|
res = res.data;
|
if (res.code && res.data) {
|
// 启动按钮可点击
|
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) => {
|
// 请求后台校验密码
|
checkUserPwd(pass)
|
.then((res) => {
|
res = res.data;
|
if (res.code) {
|
// 关闭弹出框
|
this.$layer.close(index);
|
this.$layer.msg("密码检测通过,启动测试");
|
// 启动测试
|
// if (regEquipType(this.batt.fbsdeviceId, ["BTS9120x"])) {
|
// this.autoCheck = true;
|
// } else {
|
// this.startTest();
|
// }
|
this.startTest();
|
} else {
|
this.$layer.msg("启动口令错误!");
|
}
|
})
|
.catch((error) => {
|
console.log(error);
|
this.$layer.msg("网络请求异常");
|
});
|
}
|
);
|
},
|
// 启动
|
startTest() {
|
// 等待框
|
let loading = this.$layer.loading(1);
|
let params = {
|
num: this.cmd.start,
|
devId: this.batt.fbsdeviceId,
|
battGroupNum: this.batt.groupIndexInFBSDevice + 1,
|
}
|
if(this.bts9140){
|
params.battGroupNum = this.params.groupIndexInFBSDevice;
|
}
|
// 请求后台
|
start(params)
|
.then((res) => {
|
res = res.data;
|
if (res.code && res.data2) {
|
// 提示信息
|
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: {
|
//
|
bts9140() {
|
let batt = this.batt;
|
return(regEquipType(batt.fbsdeviceId, "BTS9140"))
|
},
|
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() {
|
// 获取数据
|
if (this.readOnly) {
|
this.initParams();
|
this.params = {
|
...this.params,
|
...this.paramData
|
};
|
} else {
|
this.getParams(true);
|
}
|
console.log(this.batt, this.readOnly, this.paramData);
|
},
|
};
|
</script>
|
|
<style scoped>
|
.form-footer {
|
margin-top: 16px;
|
margin-bottom: 16px;
|
text-align: right;
|
}
|
|
.form-footer .three-btn {
|
margin-left: 12px;
|
}
|
</style>
|