Browse Source

告警添加参数级开关

pull/1/head
ljlong_2630 1 year ago
parent
commit
ce44b78a32
  1. 70
      src/views/model/alert/deviceparamalert.vue

70
src/views/model/alert/deviceparamalert.vue

@ -95,11 +95,16 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="参数编码" align="center" prop="paramCode" /> <el-table-column label="参数编码" align="center" prop="paramCode" />
<el-table-column label="是否可用" align="center" prop="enabledFlag" :width="120"> <el-table-column label="是否告警" align="center" prop="enabled" :width="120">
<template #default="scope"> <template #default="scope">
<dict-tag :options="enabledFlagTable" :value="scope.row.enabledFlag"/> <dict-tag :options="enabledTable" :value="scope.row.enabled"/>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="是否可用" align="center" prop="enabledFlag" :width="120">
<template #default="scope">
<dict-tag :options="enabledFlagTable" :value="scope.row.enabledFlag"/>
</template>
</el-table-column> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope"> <template #default="scope">
<!-- <el-button <!-- <el-button
@ -222,12 +227,26 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24" v-show="policyModelVisiable"> </el-row>
<el-row style="margin-bottom: 10px;"> <el-row>
<el-col> <el-col v-show="policyEnabledVisiable">
<H3>告警逻辑</H3> <el-form-item label="告警开关" prop="enabled" label-width="70px">
</el-col> <el-select v-model="formPolicy.enabled" @change="changeEnabled" placeholder="请选择是否告警">
</el-row> <el-option
v-for="item in enabled"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row style="margin-bottom: 10px;">
<el-col>
<h4>告警逻辑</h4>
</el-col>
</el-row>
<el-row> <el-row>
<el-col> <el-col>
<el-table ref="policyTable" v-loading="loading" :data="modelList" :row-key="getRowKey" @selection-change="handleSelectionChange"> <el-table ref="policyTable" v-loading="loading" :data="modelList" :row-key="getRowKey" @selection-change="handleSelectionChange">
@ -290,8 +309,6 @@
</el-col> </el-col>
</el-row> </el-row>
</el-col>
</el-row>
</el-form> </el-form>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
@ -337,6 +354,7 @@ const statusTypeVisiable = ref(false);
const sortIdVisiable = ref(false); const sortIdVisiable = ref(false);
const methodIdsVisiable = ref(false); const methodIdsVisiable = ref(false);
const policyModelVisiable = ref(false); const policyModelVisiable = ref(false);
const policyEnabledVisiable = ref(false);
const policyParams = ref([]); const policyParams = ref([]);
const policyAlertId = ref(""); const policyAlertId = ref("");
const policyDeviceUuid = ref(""); const policyDeviceUuid = ref("");
@ -348,6 +366,14 @@ const enabledFlagTable = ref([
{label: '可用', value: 'true', elTagType: 'default', elTagClass: null}, {label: '可用', value: 'true', elTagType: 'default', elTagClass: null},
{label: '不可用', value: 'false', elTagType: 'default', elTagClass: null} {label: '不可用', value: 'false', elTagType: 'default', elTagClass: null}
]); ]);
const enabled = ref([
{label: '告警', value: 1, elTagType: 'default', elTagClass: null},
{label: '不告警', value: 0, elTagType: 'default', elTagClass: null}
]);
const enabledTable = ref([
{label: '告警', value: '1', elTagType: 'default', elTagClass: null},
{label: '不告警', value: '0', elTagType: 'default', elTagClass: null}
]);
const statusSelects = ref([]); const statusSelects = ref([]);
const statusValueSelects = ref([]); const statusValueSelects = ref([]);
const data = reactive({ const data = reactive({
@ -443,6 +469,7 @@ function reset() {
level:null, level:null,
operator: null, operator: null,
operator_sign: null, operator_sign: null,
enabled: null,
}; };
proxy.resetForm("alertRef"); proxy.resetForm("alertRef");
} }
@ -472,6 +499,7 @@ function resetPolicy() {
level:null, level:null,
operator: null, operator: null,
operator_sign: null, operator_sign: null,
enabled:null,
}; };
proxy.resetForm("policyRef"); proxy.resetForm("policyRef");
} }
@ -515,6 +543,7 @@ function handlePolicy(row) {
addPolicyRows.value=[]; addPolicyRows.value=[];
deletePolicyRows.value=[]; deletePolicyRows.value=[];
logicCode.value = row.logicCode; logicCode.value = row.logicCode;
formPolicy.value.enabled = row.enabled;
if(row.logicCode=='A'){ if(row.logicCode=='A'){
getModelListSwitch(row); getModelListSwitch(row);
boolValueVisiable.value=true; boolValueVisiable.value=true;
@ -523,6 +552,7 @@ function handlePolicy(row) {
statusTypeVisiable.value=true; statusTypeVisiable.value=true;
sortIdVisiable.value=false; sortIdVisiable.value=false;
methodIdsVisiable.value=true; methodIdsVisiable.value=true;
policyEnabledVisiable.value=false;
}else if(row.logicCode == 'B'){ }else if(row.logicCode == 'B'){
getModelList(row); getModelList(row);
policyModelVisiable.value=true; policyModelVisiable.value=true;
@ -531,6 +561,7 @@ function handlePolicy(row) {
statusTypeVisiable.value=false; statusTypeVisiable.value=false;
sortIdVisiable.value=false; sortIdVisiable.value=false;
methodIdsVisiable.value=false; methodIdsVisiable.value=false;
policyEnabledVisiable.value=true;
}else if(row.logicCode == 'C'){ }else if(row.logicCode == 'C'){
ElMessageBox.alert('目前该告警逻辑没有实现', '提示', { ElMessageBox.alert('目前该告警逻辑没有实现', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
@ -719,8 +750,8 @@ function getModelList(row){
modelList.value.map(element=>{ modelList.value.map(element=>{
responsePolicy.data.forEach(item=>{ responsePolicy.data.forEach(item=>{
if(item.alertModelId == element.id){ if(item.alertModelId == element.id){
policyDeviceUuid.value = item.deviceId; // policyDeviceUuid.value = item.deviceId;
policyAlertId.value = item.alertId; // policyAlertId.value = item.alertId;
if(paramTypeValue.value == '3'){ if(paramTypeValue.value == '3'){
element.value = item.floatValue; element.value = item.floatValue;
}else if(paramTypeValue.value == '2'){ }else if(paramTypeValue.value == '2'){
@ -989,6 +1020,21 @@ const isInvalid = (value,row) => {
} }
return !validateCell(value); return !validateCell(value);
}; };
function changeEnabled(value){
let param = {
id:policyAlertId.value,
enabled:value
}
updateAlert(param);
}
function selectionDisabled(){
return formPolicy.value.enabled === 1;
}
function selectionDisableAll(){
return formPolicy.value.enabled === 1;
}
getList(); getList();

Loading…
Cancel
Save