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

Loading…
Cancel
Save