fast(设备详情): 调整设备告警列表
This commit is contained in:
parent
72027678dd
commit
10e2983623
|
@ -22,3 +22,4 @@ selenium-debug.log
|
||||||
package-lock.json
|
package-lock.json
|
||||||
yarn.lock
|
yarn.lock
|
||||||
/dist.zip
|
/dist.zip
|
||||||
|
/src/assets/download.zip
|
||||||
|
|
|
@ -205,6 +205,23 @@ export function updateDeviceAlarmConfig(data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取设备功能列表
|
||||||
|
export function getDeviceAlarmConfigList(devKey) {
|
||||||
|
return request({
|
||||||
|
url: "/iot/func/" + devKey,
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新设备功能
|
||||||
|
export function updateDeviceAlarmConfigList(data) {
|
||||||
|
return request({
|
||||||
|
url: "/iot/func",
|
||||||
|
method: "put",
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 同步设备告警配置
|
// 同步设备告警配置
|
||||||
export function deviceSendAlarmConfig(data) {
|
export function deviceSendAlarmConfig(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
@ -3,175 +3,96 @@
|
||||||
<el-row style="margin-bottom: 10px">
|
<el-row style="margin-bottom: 10px">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
:disabled="disabledAck"
|
||||||
icon="el-icon-refresh"
|
icon="el-icon-refresh"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="disabledAck"
|
type="success"
|
||||||
@click="handleSendAck"
|
@click="resetAttr"
|
||||||
>同步下发</el-button
|
>刷新告警配置</el-button
|
||||||
>
|
>
|
||||||
<el-popover
|
<!-- <el-popover-->
|
||||||
placement="top-start"
|
<!-- placement="top-start"-->
|
||||||
title="同步下发"
|
<!-- title="同步下发"-->
|
||||||
width="350"
|
<!-- trigger="hover"-->
|
||||||
trigger="hover">
|
<!-- width="350">-->
|
||||||
<div>
|
<!-- <div>-->
|
||||||
<p>设备配置需要先下发到指定设备,设备配置完成后同步到云端平台</p>
|
<!-- <p>设备配置需要先下发到指定设备,设备配置完成后同步到云端平台</p>-->
|
||||||
<span style="display: block; width: 100%; color: red;">注意*:</span>
|
<!-- <span style="display: block; width: 100%; color: red;">注意*:</span>-->
|
||||||
<span style="color: red;">
|
<!-- <span style="color: red;">-->
|
||||||
欠压:报警值 < 预警值 < 正常值 </br>
|
<!-- 欠压:报警值 < 预警值 < 正常值 </br>-->
|
||||||
过压:正常值 < 预警值 < 报警值
|
<!-- 过压:正常值 < 预警值 < 报警值-->
|
||||||
</span>
|
<!-- </span>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<i class="el-icon-question" slot="reference" style="margin-left: 10px; font-size: 20px;"></i>
|
<!-- <i slot="reference" class="el-icon-question" style="margin-left: 10px; font-size: 20px;"></i>-->
|
||||||
</el-popover>
|
<!-- </el-popover>-->
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<!-- <el-form class="base-form" ref="baseForm" :model="baseForm" :rules="rules" auto-complete="on"> -->
|
<!-- <el-form class="base-form" ref="baseForm" :model="baseForm" :rules="rules" auto-complete="on"> -->
|
||||||
<el-table
|
<div class="alarm-list">
|
||||||
border
|
<el-tabs v-model="groupActive" v-loading="loading" type="card">
|
||||||
:loading="loading"
|
<el-tab-pane v-for="(group,groupIndex ) in groupList" :key="group.funcType" :label="group.funcTypeName" :name="group.funcType">
|
||||||
:data="list"
|
<el-collapse v-model="activeName" accordion>
|
||||||
class="alarm-table"
|
<el-collapse-item v-for="(item,index) in group.list" :key="item.funcKey" :name="item.funcKey" :title="item.funcName">
|
||||||
:height="monthTradingTableHeight"
|
<el-form class="device-attr-box" label-width="140px">
|
||||||
:highlight-pageNum-row="true"
|
<el-form-item v-for="val in item.confJsonObj" :key="val.key" class="device-attr-item">
|
||||||
>
|
<template #label>
|
||||||
<el-table-column
|
<span>{{val.name}}</span>
|
||||||
type="index"
|
<el-tooltip v-if="val.remark" :content="val.remark" class="item" effect="dark" placement="top">
|
||||||
label="序号"
|
<i class="el-icon-question" style="margin-left: 10px;"></i>
|
||||||
align="center"
|
</el-tooltip>
|
||||||
width="80"
|
</template>
|
||||||
:index="
|
<el-switch
|
||||||
(val) => {
|
v-if="getAttrType(val) === 'switch'"
|
||||||
return ++val;
|
v-model="val.value"
|
||||||
}
|
:active-value="1"
|
||||||
"
|
:disabled="item.disabled"
|
||||||
></el-table-column>
|
:inactive-value="0"
|
||||||
<el-table-column
|
active-color="#13ce66"
|
||||||
prop="type"
|
inactive-color="#dcdfe6"
|
||||||
label="类型"
|
/>
|
||||||
align="center"
|
<el-input
|
||||||
width="300"
|
v-else
|
||||||
:formatter="alarmTypeFormatter"
|
v-model="val.value"
|
||||||
></el-table-column>
|
:disabled="item.disabled"
|
||||||
<el-table-column prop="alarmSta" label="开启告警" align="center">
|
placeholder="请输入"
|
||||||
<template slot-scope="scope">
|
type="number"
|
||||||
<el-switch
|
/>
|
||||||
size="mini"
|
</el-form-item>
|
||||||
v-model="scope.row.alarmSta"
|
<el-form-item>
|
||||||
active-text="开启"
|
<el-button v-if="item.disabled" type="primary" @click="toggleState(groupIndex,index)">修改</el-button>
|
||||||
inactive-text="关闭"
|
<el-button v-else type="primary" @click="sendAttr(item,groupIndex,index)">下发</el-button>
|
||||||
:disabled="!updateGenTable"
|
</el-form-item>
|
||||||
:active-value="1"
|
</el-form>
|
||||||
:inactive-value="0"
|
</el-collapse-item>
|
||||||
active-color="#13ce66"
|
</el-collapse>
|
||||||
inactive-color="#dcdfe6"
|
</el-tab-pane>
|
||||||
class="switch-wrap"
|
</el-tabs>
|
||||||
@change="handleAlarmSta(scope.row.alarmSta)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="warnSta" label="开启预警" align="center">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-switch
|
|
||||||
size="mini"
|
|
||||||
v-model="scope.row.warnSta"
|
|
||||||
active-text="开启"
|
|
||||||
inactive-text="关闭"
|
|
||||||
:disabled="!updateGenTable"
|
|
||||||
:active-value="1"
|
|
||||||
:inactive-value="0"
|
|
||||||
active-color="#13ce66"
|
|
||||||
inactive-color="#dcdfe6"
|
|
||||||
class="switch-wrap"
|
|
||||||
>
|
|
||||||
</el-switch>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="alarmValue"
|
|
||||||
label="告警值"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<e-table-input @handleVerification="alarmValueTableCallback" :disabled="!scope.row.alarmSta" :form="scope.row" pops="alarmValue" />
|
|
||||||
<!-- <el-form-item :prop="'demoList.'+scope.$index+'.alarmValue'" :rules="tableFormRules.alarmValue" class="all">
|
|
||||||
<el-input v-model="scope.row.alarmValue" placeholder="请输入" clearable @focus="$refs.baseForm.clearValidate(`demoList.${scope.$index}.alarmValue`)"></el-input>
|
|
||||||
</el-form-item> -->
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<!--<el-table-column
|
</div>
|
||||||
prop="warnValueMin"
|
|
||||||
label="最小预警值"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<e-table-input @handleVerification="warnValueMinTableCallback" :disabled="!scope.row.warnSta" :form="scope.row" pops="warnValueMin" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="warnValueMax"
|
|
||||||
label="最大预警值"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<e-table-input @handleVerification="warnValueMaxTableCallback" :disabled="!scope.row.warnSta" :form="scope.row" pops="warnValueMax" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>-->
|
|
||||||
<el-table-column
|
|
||||||
prop="warnValue"
|
|
||||||
label="预警值"
|
|
||||||
align="center"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<e-table-input @handleVerification="warnValueTableCallback" :disabled="!scope.row.warnSta" :form="scope.row" pops="warnValue" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
label="操作"
|
|
||||||
align="center"
|
|
||||||
width="200px"
|
|
||||||
class-name="small-padding fixed-width"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-edit"
|
|
||||||
@click="handleUpdate(scope.row, scope.$index)"
|
|
||||||
>修改</el-button
|
|
||||||
>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<!-- </el-form> -->
|
|
||||||
|
|
||||||
|
|
||||||
<dialog-template
|
<dialog-template
|
||||||
:title="title"
|
:title="title"
|
||||||
@close="open = false"
|
|
||||||
:visible="open"
|
:visible="open"
|
||||||
width="500px"
|
width="500px"
|
||||||
|
@close="open = false"
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form
|
||||||
ref="form"
|
ref="form"
|
||||||
|
slot="dialog-center"
|
||||||
:model="form"
|
:model="form"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
label-width="100px"
|
label-width="100px"
|
||||||
slot="dialog-center"
|
|
||||||
>
|
>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="开启告警:" prop="alarmSta">
|
<el-form-item label="开启告警:" prop="alarmSta">
|
||||||
<el-switch
|
<el-switch
|
||||||
size="mini"
|
|
||||||
v-model="form.alarmSta"
|
v-model="form.alarmSta"
|
||||||
:active-value="1"
|
:active-value="1"
|
||||||
:inactive-value="0"
|
:inactive-value="0"
|
||||||
active-color="#13ce66"
|
active-color="#13ce66"
|
||||||
inactive-color="#dcdfe6"
|
inactive-color="#dcdfe6"
|
||||||
|
size="mini"
|
||||||
>
|
>
|
||||||
</el-switch>
|
</el-switch>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -179,12 +100,12 @@
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="开启预警:" prop="warnSta">
|
<el-form-item label="开启预警:" prop="warnSta">
|
||||||
<el-switch
|
<el-switch
|
||||||
size="mini"
|
|
||||||
v-model="form.warnSta"
|
v-model="form.warnSta"
|
||||||
:active-value="1"
|
:active-value="1"
|
||||||
:inactive-value="0"
|
:inactive-value="0"
|
||||||
active-color="#13ce66"
|
active-color="#13ce66"
|
||||||
inactive-color="#dcdfe6"
|
inactive-color="#dcdfe6"
|
||||||
|
size="mini"
|
||||||
>
|
>
|
||||||
</el-switch>
|
</el-switch>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -246,7 +167,7 @@
|
||||||
import {
|
import {
|
||||||
getDeviceAlarmConfig,
|
getDeviceAlarmConfig,
|
||||||
updateDeviceAlarmConfig,
|
updateDeviceAlarmConfig,
|
||||||
deviceSendAlarmConfig,
|
deviceSendAlarmConfig, getDeviceAlarmConfigList, updateDeviceAlarmConfigList
|
||||||
} from "@/api/iot/device";
|
} from "@/api/iot/device";
|
||||||
import DialogTemplate from "@/components/DialogTemplate";
|
import DialogTemplate from "@/components/DialogTemplate";
|
||||||
import ETableInput from '@/components/EUpdateTable/ETableInput'
|
import ETableInput from '@/components/EUpdateTable/ETableInput'
|
||||||
|
@ -314,6 +235,9 @@ export default {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
ackList: [],
|
ackList: [],
|
||||||
|
activeName:'',
|
||||||
|
groupList:[],
|
||||||
|
groupActive:''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -334,6 +258,13 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getAttrType(obj){
|
||||||
|
if(obj.key.endsWith('_state')){
|
||||||
|
return 'switch';
|
||||||
|
}else{
|
||||||
|
return 'input';
|
||||||
|
}
|
||||||
|
},
|
||||||
handleAlarmSta(v) {
|
handleAlarmSta(v) {
|
||||||
console.log(v)
|
console.log(v)
|
||||||
},
|
},
|
||||||
|
@ -393,7 +324,7 @@ export default {
|
||||||
this.handleDisableAce(callback());
|
this.handleDisableAce(callback());
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!row.warnValueMax && row.warnValueMax !== 0) {
|
if (!row.warnValueMax && row.warnValueMax !== 0) {
|
||||||
this.handleDisableAce(callback());
|
this.handleDisableAce(callback());
|
||||||
return
|
return
|
||||||
|
@ -420,7 +351,7 @@ export default {
|
||||||
warnValueMinTableCallback(row, callback) {
|
warnValueMinTableCallback(row, callback) {
|
||||||
if (!row.warnSta) {
|
if (!row.warnSta) {
|
||||||
callback();
|
callback();
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!row.warnValueMin && row.warnValueMin !== 0) {
|
if (!row.warnValueMin && row.warnValueMin !== 0) {
|
||||||
|
@ -432,7 +363,7 @@ export default {
|
||||||
/^((\-)*([1-9][0-9]*)|(\-)*([0-9]*)|(\-)*(([0]\.\d{1,}|[1-9][0-9]*\.\d{1,})))$/;
|
/^((\-)*([1-9][0-9]*)|(\-)*([0-9]*)|(\-)*(([0]\.\d{1,}|[1-9][0-9]*\.\d{1,})))$/;
|
||||||
if (row.warnValueMin && !isExp.test(row.warnValueMin)) {
|
if (row.warnValueMin && !isExp.test(row.warnValueMin)) {
|
||||||
callback("只可以输入数字类型!");
|
callback("只可以输入数字类型!");
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -624,16 +555,74 @@ export default {
|
||||||
alarmTypeFormatter(row, column) {
|
alarmTypeFormatter(row, column) {
|
||||||
return this.selectDictLabel(this.alarmParamOption, row.type);
|
return this.selectDictLabel(this.alarmParamOption, row.type);
|
||||||
},
|
},
|
||||||
|
//属性配置列表
|
||||||
|
resetAttr(){
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
//下发配置
|
||||||
|
sendAttr(data,index,i){
|
||||||
|
console.log("下发配置",data)
|
||||||
|
updateDeviceAlarmConfigList(data).then((res) => {
|
||||||
|
console.log("res",res)
|
||||||
|
if(res.code === 200){
|
||||||
|
this.msgSuccess(res.msg);
|
||||||
|
this.groupList[index].list[i].disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//切换状态
|
||||||
|
toggleState(index,i){
|
||||||
|
this.groupList[index].list[i].disabled = !this.groupList[index].list[i].disabled;
|
||||||
|
},
|
||||||
getList() {
|
getList() {
|
||||||
if (!this.deviceKey && this.deviceKey !== "0") {
|
if (!this.deviceKey && this.deviceKey !== "0") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
getDeviceAlarmConfig(this.deviceKey)
|
getDeviceAlarmConfigList(this.deviceKey)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.list = response.data.alarmCfg;
|
console.log("获取设备功能列表",response)
|
||||||
this.monthTradingTableHeight = this.list.length >= 6 ? '387' : 'auto'
|
let groupList = [];
|
||||||
this.isAck = response.data.isAck === 1 ? true : false;
|
if(response?.data.length>0){
|
||||||
|
response.data.forEach((item,index)=>{
|
||||||
|
let flag = true;
|
||||||
|
groupList.forEach((val,i)=>{
|
||||||
|
if(val.funcType === item.funcType){
|
||||||
|
groupList[i].list.push({
|
||||||
|
...item,
|
||||||
|
disabled: true,
|
||||||
|
});
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if(flag){
|
||||||
|
groupList.push({
|
||||||
|
funcType: item.funcType,
|
||||||
|
funcTypeName: item.funcTypeName,
|
||||||
|
list: [{
|
||||||
|
...item,
|
||||||
|
disabled: true,
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.groupList = groupList;
|
||||||
|
this.list = groupList[0].list;
|
||||||
|
this.groupActive = groupList[0].funcType;
|
||||||
|
// this.list = response.data.map(item=>{
|
||||||
|
// return {
|
||||||
|
// ...item,
|
||||||
|
// disabled: true,
|
||||||
|
// };
|
||||||
|
// });
|
||||||
|
}else{
|
||||||
|
this.groupList = [];
|
||||||
|
this.list = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// this.monthTradingTableHeight = this.list.length >= 6 ? '387' : 'auto'
|
||||||
|
// this.isAck = response.data.isAck === 1 ? true : false;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
@ -679,4 +668,41 @@ export default {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.device-attr-box{
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
.alarm-list{
|
||||||
|
//border-left:1px solid #666;
|
||||||
|
.el-collapse{
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
.el-tabs__content{
|
||||||
|
height: auto !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.alarm-list {
|
||||||
|
::v-deep .el-tabs__header{
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
::v-deep .el-tabs__nav-wrap{
|
||||||
|
//margin-bottom: 0;
|
||||||
|
}
|
||||||
|
::v-deep .el-tabs__nav-scroll {
|
||||||
|
height: auto !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
background: #fff !important;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
::v-deep .el-tabs__content{
|
||||||
|
border-left: 1px solid #dfe4ed;
|
||||||
|
border-right: 1px solid #dfe4ed;
|
||||||
|
}
|
||||||
|
::v-deep .el-collapse-item {
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue