<template>
|
<div class="params-dialog">
|
<el-form size="mini" label-position="top">
|
<el-row :gutter="row.gutter">
|
<el-col>
|
<el-form-item label="电池组名称">
|
<el-input v-model="otherParams.groupName" readonly></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="row.gutter">
|
<el-col :span="row.span">
|
<el-form-item label="设备ID">
|
<el-input v-model="otherParams.fbsdeviceId" readonly></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="电池组信息">
|
<el-input v-model="otherParams.groupInfo" readonly></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<el-tabs v-model="acTabs" type="border-card" class="params-tabs flex-layout noborder" @tab-click="tabClick">
|
<el-tab-pane ref="tabs" v-for="idx in 9" :key="'list_' + idx" :name="'tab_' + (idx - 1)" :label="'组' + idx">
|
<param-item :isac="isac" :ref="'params' + (idx - 1)" :params="params[idx - 1]"></param-item>
|
</el-tab-pane>
|
</el-tabs>
|
<div class="form-footer">
|
<!-- <three-btn>清除告警</three-btn> -->
|
<template v-if="!readOnly">
|
<span v-if="copyedIdx > -1" class="msg-copy">{{ '组' + (copyedIdx + 1) + '参数已复制' }}</span>
|
<three-btn @click="copy">复制</three-btn>
|
<three-btn :disabled="copyedIdx < 0" @click="paste">粘贴</three-btn>
|
<three-btn :disabled="!startTestFlag" @click="selectGroup">启动</three-btn>
|
<three-btn @click="getParams(true)">读取</three-btn>
|
<three-btn :disabled="!setTestFlag" @click="submitFrom">设定</three-btn>
|
</template>
|
<three-btn @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="480px" :visible.sync="selectGroupVisible" :close-on-click-modal="false" top="0"
|
:modal="false" class="dialog-center" :modal-append-to-body="false" :destroy-on-close="true">
|
<select-group @ok="startTestCheck" @cancel="selectGroupVisible = false"></select-group>
|
<div class="mask"></div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import const_9149 from "@/assets/js/const/const_9149";
|
import config from "@/assets/js/config";
|
import checkFace from "@/components/checkFace";
|
import selectGroup from './selectGroup';
|
import {
|
updateParalleParam9149 as setParams,
|
searchParalleParam9149 as getParams,
|
controllerParalle9149 as start,
|
} from "../js/realTime";
|
import { checkUserPwd } from "@/views/login/js/api";
|
import toFixed from "@/assets/js/tools/toFixed";
|
import paramItem from './bts9149ParamsItem';
|
|
|
export default {
|
name: "BtsDischargeParams",
|
components: {
|
checkFace,
|
paramItem,
|
selectGroup,
|
},
|
props: {
|
batt: {
|
type: Object,
|
default() {
|
return {};
|
},
|
},
|
// 只读模式 显示参数用
|
readOnly: {
|
type: Boolean,
|
default: false
|
},
|
paramData: {
|
type: Object,
|
default() {
|
return {}
|
}
|
},
|
type: {
|
type: String,
|
default: 'charge'
|
},
|
isac: {
|
type: Boolean,
|
default: false,
|
},
|
},
|
data() {
|
let {
|
cmd,
|
testCmd,
|
CharWaitTimeList,
|
DisWaitTimeList,
|
OnlineTestFlagList,
|
switchTempList,
|
CharTimeList,
|
JCList,
|
paramsTypeList,
|
battManageList,
|
groupIndexList,
|
getInitParams,
|
} = const_9149;
|
return {
|
testList: [],
|
selectGroupVisible: false,
|
copyedParams: null,
|
copyedIdx: -1,
|
acTabs: 'tab_0',
|
row: {
|
gutter: 16,
|
span: 6,
|
},
|
CharWaitTimeList,
|
DisWaitTimeList,
|
OnlineTestFlagList,
|
switchTempList,
|
CharTimeList,
|
JCList,
|
paramsTypeList,
|
battManageList,
|
setFaceShow: false,
|
startFaceShow: false,
|
cmd: cmd, // 操作命令
|
testCmd,
|
startTestFlag: false, // 启动测试的状态
|
setTestFlag: false, // 设置参数的状态
|
params: [],
|
groupIndexList,
|
};
|
},
|
watch: {
|
},
|
methods: {
|
tabClick(tab) {
|
this.acTabs = tab.name;
|
},
|
initParams() {
|
// 初始化参数
|
this.params = [0, 1, 2, 3, 4, 5, 6, 7, 8].map((v) => {
|
let obj = const_9149.getInitParams();
|
obj.groupnum = v;
|
return obj;
|
});
|
},
|
// 获取参数
|
getParams(showLoad) {
|
// 定义等待框
|
let loading;
|
if (showLoad) {
|
loading = this.$layer.loading(1);
|
}
|
// 启动按钮不可点击
|
this.startTestFlag = false;
|
// TODO 参数类型 来自于启动时的类型 type
|
// let {
|
// hvMonUppernum1,
|
// } = this.params;
|
let paramtype = const_9149.paramsTypeList.filter((v) => v.type == this.type)[0].value;
|
let parms = {
|
opCmd: this.cmd.get,
|
devId: this.batt.fbsdeviceId,
|
paramtype,
|
};
|
// 查询后台
|
getParams(parms)
|
.then((res) => {
|
res = res.data;
|
if (res.code && res.data) {
|
this.params = res.data2;
|
console.log(res.data2, '===data2')
|
this.$layer.msg("读取成功!");
|
// 设置按钮可点击
|
this.setTestFlag = true;
|
} else {
|
// 初始化参数
|
this.initParams();
|
// 设置按钮不可点击
|
this.setTestFlag = false;
|
this.$layer.msg("读取失败!");
|
}
|
// 关闭等待框
|
this.$layer.close(loading);
|
this.reset();
|
})
|
.catch((error) => {
|
console.log(error);
|
// 初始化参数
|
this.initParams();
|
// 设置按钮不可点击
|
this.setTestFlag = false;
|
// 关闭等待框
|
this.$layer.close(loading);
|
this.reset();
|
this.$layer.msg("读取失败,读取请求异常!");
|
});
|
},
|
// 提交表单设置参数
|
submitFrom() {
|
let list = [0, 1, 2, 3, 4, 5, 6, 7, 8].map((v) => this.$refs['params' + v][0].$children[0].validate());
|
Promise.all(list).then((res) => {
|
// console.log(res, '===p res');
|
// 设置参数
|
this.setParamsCheck();
|
}).catch(e => {
|
let r = [];
|
list.forEach((v, i) => {
|
v.then(a => console.log(a, i)).catch(e => {
|
if (!r.length) {
|
this.acTabs = 'tab_' + i;
|
this.$layer.msg("存在校验未通过的数据!");
|
}
|
r.push(i);
|
});
|
})
|
// if (e === false) {
|
// this.acTabs = 'tab_' + r[0];
|
// this.$layer.msg("存在校验未通过的数据!");
|
// }
|
});
|
},
|
setParamsCheck() {
|
if (config.dischargeByFace.value) {
|
this.setFaceShow = true;
|
} else {
|
this.setParams(true);
|
}
|
},
|
// 设置参数
|
setParams() {
|
// 等待框
|
let loading = this.$layer.loading(1);
|
// let params = {
|
// ...this.params,
|
// opCmd: const_9149.cmd.set,
|
// }
|
let params = this.params.map((v) => {
|
v.opCmd = const_9149.cmd.set;
|
return v;
|
});
|
|
// 请求后台
|
setParams(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(list) {
|
this.testList = list;
|
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("密码检测通过,启动测试");
|
this.selectGroupVisible = false;
|
// 启动测试
|
this.startTest();
|
} else {
|
this.$layer.msg("启动口令错误!");
|
}
|
})
|
.catch((error) => {
|
console.log(error);
|
this.$layer.msg("网络请求异常");
|
});
|
}
|
);
|
},
|
// 启动
|
startTest() {
|
// 等待框
|
let loading = this.$layer.loading(1);
|
let params = {
|
battGroupNums: this.testList.join(','),
|
opCmd: this.cmd.start,
|
devId: this.batt.fbsdeviceId,
|
testCmd: this.testCmd[this.type],
|
}
|
// 请求后台
|
start(params)
|
.then((res) => {
|
res = res.data;
|
if (res.code && res.data[Object.keys(res.data)[0]]) {
|
// 提示信息
|
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();
|
},
|
copy() {
|
let idx = this.acTabs.split('_')[1] * 1;
|
// 后面可以加上验证
|
|
this.copyedParams = this.params[idx];
|
this.copyedIdx = idx;
|
},
|
reset() {
|
this.copyedIdx = -1;
|
this.copyedParams = null;
|
},
|
paste() {
|
let idx = this.acTabs.split('_')[1] * 1;
|
// this.params[idx] = { ...this.copyedParams, groupnum: idx };
|
this.$set(this.params, idx, { ...this.copyedParams, groupnum: idx });
|
},
|
// 选择要启动的电池组
|
selectGroup() {
|
this.selectGroupVisible = true;
|
},
|
},
|
computed: {
|
otherParams() {
|
let batt = this.batt;
|
let groupInfo =
|
"单体数量:" +
|
this.batt.monCount +
|
";电压(V):" +
|
this.batt.monVolStd;
|
return {
|
groupName: batt.stationName + "-" + batt.battGroupName,
|
fbsdeviceId: batt.fbsdeviceId,
|
groupInfo: groupInfo
|
};
|
},
|
// 0.1C-0.5C //核容限流(A)
|
disCurrRange() {
|
let { monCapStd } = this.params;
|
let r0 = toFixed(0.1 * monCapStd, 2);
|
let r1 = toFixed(0.5 * monCapStd, 2);
|
return `${r0}~${r1}`;
|
},
|
// 0.01-0.10C //均充转浮充电流(A)
|
charSotpCurrRange() {
|
let { monCapStd } = this.params;
|
let r0 = toFixed(0.01 * monCapStd, 2);
|
let r1 = toFixed(0.1 * monCapStd, 2);
|
return `${r0}~${r1}`;
|
},
|
// 0.01-0.10C //浮充转均充电流(A)
|
flowoverCharcurr1Range() {
|
let { monCapStd } = this.params;
|
let r0 = toFixed(0.01 * monCapStd, 2);
|
let r1 = toFixed(0.1 * monCapStd, 2);
|
return `${r0}~${r1}`;
|
},
|
// 0.05-0.20 C //电池充电限流(A)
|
chargeCurrSetRange() {
|
let { monCapStd } = this.params;
|
let r0 = toFixed(0.05 * monCapStd, 2);
|
let r1 = toFixed(0.2 * monCapStd, 2);
|
return `${r0}~${r1}`;
|
},
|
},
|
mounted() {
|
// 获取数据
|
if (this.readOnly) {
|
// this.initParams();
|
this.params = [
|
...this.paramData
|
];
|
} else {
|
this.getParams(true);
|
}
|
// console.log(this.batt, this.readOnly, this.paramData);
|
},
|
};
|
</script>
|
|
<style scoped>
|
.params-tabs /deep/ .el-tabs__content .el-tab-pane {
|
padding: 0 0 10px;
|
}
|
|
.form-footer {
|
margin-top: 16px;
|
margin-bottom: 16px;
|
text-align: right;
|
}
|
|
.form-footer .three-btn {
|
margin-left: 12px;
|
}
|
|
.mask {
|
position: fixed;
|
left: 0;
|
top: 0;
|
right: 0;
|
bottom: 0;
|
z-index: -1;
|
background: rgba(0, 0, 0, 0.3);
|
}
|
</style>
|