|
@ -185,7 +185,7 @@ |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="12" v-show="methodIdsVisiable"> |
|
|
<el-col :span="12" v-show="methodIdsVisiable"> |
|
|
<el-form-item label="告警方式" prop="methodIds"> |
|
|
<el-form-item label="告警方式" prop="methodIds"> |
|
|
<el-select v-model="formPolicy.methodIds" placeholder="请选择告警方式"> |
|
|
<el-select v-model="formPolicy.methodIds" multiple placeholder="请选择告警方式"> |
|
|
<el-option |
|
|
<el-option |
|
|
v-for="item in methodList" |
|
|
v-for="item in methodList" |
|
|
:key="item.id" |
|
|
:key="item.id" |
|
@ -195,6 +195,23 @@ |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
<el-col :span="12" v-show="levelVisiable"> |
|
|
|
|
|
<el-form-item label="级别" prop="level"> |
|
|
|
|
|
<el-select v-model="formPolicy.level" placeholder="请选择告警级别" @change="levelChange"> |
|
|
|
|
|
<el-option |
|
|
|
|
|
v-for="dict in dc_alert_level" |
|
|
|
|
|
:key="parseInt(dict.value)" |
|
|
|
|
|
:label="dict.label" |
|
|
|
|
|
:value="parseInt(dict.value)" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="12" v-show="nameVisiable"> |
|
|
|
|
|
<el-form-item label="名称" prop="name"> |
|
|
|
|
|
<el-input disabled v-model="formPolicy.name" placeholder="请选择告警级别"/> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-col> |
|
|
<el-col :span="12" v-show="sortIdVisiable"> |
|
|
<el-col :span="12" v-show="sortIdVisiable"> |
|
|
<el-form-item label="排序" prop="sortId"> |
|
|
<el-form-item label="排序" prop="sortId"> |
|
|
<el-input-number v-model="formPolicy.sortId" :min="1" :max="1000" /> |
|
|
<el-input-number v-model="formPolicy.sortId" :min="1" :max="1000" /> |
|
@ -224,6 +241,7 @@ |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
|
|
|
</el-row> |
|
|
</el-row> |
|
|
<el-row style="margin-bottom: 10px;" v-show="tableVisiable"> |
|
|
<el-row style="margin-bottom: 10px;" v-show="tableVisiable"> |
|
|
<el-col> |
|
|
<el-col> |
|
@ -252,7 +270,7 @@ |
|
|
<el-table-column label="排序" align="center" prop="sort"/> |
|
|
<el-table-column label="排序" align="center" prop="sort"/> |
|
|
<el-table-column label="告警方式" align="center" prop="methodIds" > |
|
|
<el-table-column label="告警方式" align="center" prop="methodIds" > |
|
|
<template #default="scope"> |
|
|
<template #default="scope"> |
|
|
<el-form-item :class="{'is-error': isInvalid(scope.row.methodIds,scope.row)}" label-width="0px" > |
|
|
<el-form-item label-width="0px" > |
|
|
<el-select v-model="scope.row.methodIds" multiple @change="methodIdsChange" placeholder="请选择告警方式"> |
|
|
<el-select v-model="scope.row.methodIds" multiple @change="methodIdsChange" placeholder="请选择告警方式"> |
|
|
<el-option |
|
|
<el-option |
|
|
v-for="item in methodList" |
|
|
v-for="item in methodList" |
|
@ -309,12 +327,12 @@ |
|
|
import { getDeviceParamsAlertInfo,delAlert, addAlert, updateAlert } from "@/api/model/alert"; |
|
|
import { getDeviceParamsAlertInfo,delAlert, addAlert, updateAlert } from "@/api/model/alert"; |
|
|
import { listDeviceNoPage } from "@/api/model/device"; |
|
|
import { listDeviceNoPage } from "@/api/model/device"; |
|
|
import { listMethod } from "@/api/model/method"; |
|
|
import { listMethod } from "@/api/model/method"; |
|
|
import { listModel } from "@/api/model/alertmodel"; |
|
|
import { listModelEnabledNoPage } from "@/api/model/alertmodel"; |
|
|
import { ElMessageBox } from 'element-plus'; |
|
|
import { ElMessageBox } from 'element-plus'; |
|
|
import {listPolicyInfo,updatePolicy,updatePolicyBatch,addPolicy,addPolicyBatch,listAlertParamSelect } from "@/api/model/policy"; |
|
|
import {listPolicyInfo,updatePolicy,updatePolicyBatch,addPolicy,addPolicyBatch,listAlertParamSelect } from "@/api/model/policy"; |
|
|
const { proxy } = getCurrentInstance(); |
|
|
const { proxy } = getCurrentInstance(); |
|
|
const router = useRouter(); |
|
|
const router = useRouter(); |
|
|
const { operator_sign,dc_param_value_type } = proxy.useDict('operator_sign','dc_param_value_type'); |
|
|
const { operator_sign,dc_param_value_type,dc_alert_level } = proxy.useDict('operator_sign','dc_param_value_type','dc_alert_level'); |
|
|
const alertList = ref([]); |
|
|
const alertList = ref([]); |
|
|
const open = ref(false); |
|
|
const open = ref(false); |
|
|
const openPolicy = ref(false); |
|
|
const openPolicy = ref(false); |
|
@ -347,6 +365,9 @@ const rowPolicySelected = ref([]); |
|
|
const colorValue = ref({}); |
|
|
const colorValue = ref({}); |
|
|
const tableVisiable = ref(false); |
|
|
const tableVisiable = ref(false); |
|
|
const dialogWidth = ref('1600px'); |
|
|
const dialogWidth = ref('1600px'); |
|
|
|
|
|
const queryModel = ref({}); |
|
|
|
|
|
const levelVisiable = ref(false); |
|
|
|
|
|
const nameVisiable = ref(false); |
|
|
const alert_value = ref([ |
|
|
const alert_value = ref([ |
|
|
{label: '1', value: true, elTagType: 'default', elTagClass: null}, |
|
|
{label: '1', value: true, elTagType: 'default', elTagClass: null}, |
|
|
{label: '0', value: false, elTagType: 'default', elTagClass: null} |
|
|
{label: '0', value: false, elTagType: 'default', elTagClass: null} |
|
@ -519,7 +540,6 @@ function handlePolicy(row) { |
|
|
selectedRows.value=[]; |
|
|
selectedRows.value=[]; |
|
|
deletePolicyRows.value=[]; |
|
|
deletePolicyRows.value=[]; |
|
|
addPolicyRows.value=[]; |
|
|
addPolicyRows.value=[]; |
|
|
deletePolicyRows.value=[]; |
|
|
|
|
|
logicCode.value = row.logicCode; |
|
|
logicCode.value = row.logicCode; |
|
|
formPolicy.value.enabled = row.enabled; |
|
|
formPolicy.value.enabled = row.enabled; |
|
|
if(row.logicCode=='A'){ |
|
|
if(row.logicCode=='A'){ |
|
@ -532,6 +552,8 @@ function handlePolicy(row) { |
|
|
sortIdVisiable.value=false; |
|
|
sortIdVisiable.value=false; |
|
|
methodIdsVisiable.value=true; |
|
|
methodIdsVisiable.value=true; |
|
|
tableVisiable.value=false; |
|
|
tableVisiable.value=false; |
|
|
|
|
|
levelVisiable.value = true; |
|
|
|
|
|
nameVisiable.value = true; |
|
|
}else if(row.logicCode == 'B'){ |
|
|
}else if(row.logicCode == 'B'){ |
|
|
dialogWidth.value = '1600px'; |
|
|
dialogWidth.value = '1600px'; |
|
|
getModelList(row); |
|
|
getModelList(row); |
|
@ -542,6 +564,8 @@ function handlePolicy(row) { |
|
|
sortIdVisiable.value=false; |
|
|
sortIdVisiable.value=false; |
|
|
methodIdsVisiable.value=false; |
|
|
methodIdsVisiable.value=false; |
|
|
tableVisiable.value=true; |
|
|
tableVisiable.value=true; |
|
|
|
|
|
levelVisiable.value = false; |
|
|
|
|
|
nameVisiable.value = false; |
|
|
}else if(row.logicCode == 'C'){ |
|
|
}else if(row.logicCode == 'C'){ |
|
|
ElMessageBox.alert('目前该告警逻辑没有实现', '提示', { |
|
|
ElMessageBox.alert('目前该告警逻辑没有实现', '提示', { |
|
|
confirmButtonText: '确定', |
|
|
confirmButtonText: '确定', |
|
@ -671,6 +695,7 @@ function submitFormPolicy() { |
|
|
getList(); |
|
|
getList(); |
|
|
}); |
|
|
}); |
|
|
}else if(logicCode.value == 'A'){ |
|
|
}else if(logicCode.value == 'A'){ |
|
|
|
|
|
formPolicy.value.methodIds = formPolicy.value.methodIds?.join(','); |
|
|
updatePolicy(formPolicy.value).then(response => { |
|
|
updatePolicy(formPolicy.value).then(response => { |
|
|
proxy.$modal.msgSuccess("新增成功"); |
|
|
proxy.$modal.msgSuccess("新增成功"); |
|
|
openPolicy.value = false; |
|
|
openPolicy.value = false; |
|
@ -694,6 +719,7 @@ function submitFormPolicy() { |
|
|
getList(); |
|
|
getList(); |
|
|
}); |
|
|
}); |
|
|
}else if(logicCode.value == 'A'){ |
|
|
}else if(logicCode.value == 'A'){ |
|
|
|
|
|
formPolicy.value.methodIds = formPolicy.value.methodIds?.join(','); |
|
|
addPolicy(formPolicy.value).then(response => { |
|
|
addPolicy(formPolicy.value).then(response => { |
|
|
proxy.$modal.msgSuccess("新增成功"); |
|
|
proxy.$modal.msgSuccess("新增成功"); |
|
|
openPolicy.value = false; |
|
|
openPolicy.value = false; |
|
@ -713,20 +739,32 @@ function cancelPolicy() { |
|
|
//开关量初始化策略表单 |
|
|
//开关量初始化策略表单 |
|
|
function getModelListSwitch(row){ |
|
|
function getModelListSwitch(row){ |
|
|
queryPolicy.value.alertId = row.id; |
|
|
queryPolicy.value.alertId = row.id; |
|
|
|
|
|
queryModel.value.logicCode = row.logicCode; |
|
|
|
|
|
queryModel.value.paramType = row.paramType; |
|
|
listPolicyInfo(queryPolicy.value).then(response=>{ |
|
|
listPolicyInfo(queryPolicy.value).then(response=>{ |
|
|
//修改界面初始化 |
|
|
//修改界面初始化 |
|
|
if(response.data && response.data.length>0){ |
|
|
if(response.data && response.data.length>0){ |
|
|
formPolicy.value.statusValue = response.data[0].statusValue; |
|
|
formPolicy.value.statusValue = response.data[0].statusValue; |
|
|
formPolicy.value.statusType = response.data[0].statusType; |
|
|
formPolicy.value.statusType = response.data[0].statusType; |
|
|
formPolicy.value.methodIds = response.data[0].methodIds?.split(',').map(Number); |
|
|
formPolicy.value.methodIds = response.data[0].methodIds==null||response.data[0].methodIds==''?null:response.data[0].methodIds.split(',').map(Number); |
|
|
formPolicy.value.boolValue = response.data[0].boolValue; |
|
|
formPolicy.value.boolValue = response.data[0].boolValue; |
|
|
|
|
|
formPolicy.value.level = response.data[0].level; |
|
|
|
|
|
formPolicy.value.name = response.data[0].name; |
|
|
formPolicy.value.alertId = row.id; |
|
|
formPolicy.value.alertId = row.id; |
|
|
formPolicy.value.deviceId = row.deviceUuid; |
|
|
formPolicy.value.deviceId = row.deviceUuid; |
|
|
|
|
|
formPolicy.value.alertModelId = response.data[0].alertModelId; |
|
|
formPolicy.value.id = response.data[0].id; |
|
|
formPolicy.value.id = response.data[0].id; |
|
|
//新增界面初始化 |
|
|
//新增界面初始化 |
|
|
}else{ |
|
|
}else{ |
|
|
formPolicy.value.alertId = row.id; |
|
|
formPolicy.value.alertId = row.id; |
|
|
formPolicy.value.deviceId = row.deviceUuid; |
|
|
formPolicy.value.deviceId = row.deviceUuid; |
|
|
|
|
|
listModelEnabledNoPage(queryModel.value).then(response => { |
|
|
|
|
|
if(response.data && response.data.length>0){ |
|
|
|
|
|
formPolicy.value.level = response.data[0].level; |
|
|
|
|
|
formPolicy.value.name = response.data[0].name; |
|
|
|
|
|
formPolicy.value.alertModelId = response.data[0].id; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -736,8 +774,10 @@ function getModelListSwitch(row){ |
|
|
function getModelList(row){ |
|
|
function getModelList(row){ |
|
|
queryPolicy.value.alertId = row.id; |
|
|
queryPolicy.value.alertId = row.id; |
|
|
queryPolicy.value.flagEnabled = true; |
|
|
queryPolicy.value.flagEnabled = true; |
|
|
listModel().then(response => { |
|
|
queryModel.value.logicCode = row.logicCode; |
|
|
modelList.value = response.rows; |
|
|
queryModel.value.paramType = row.paramType; |
|
|
|
|
|
listModelEnabledNoPage(queryModel.value).then(response => { |
|
|
|
|
|
modelList.value = response.data; |
|
|
formPolicy.value.alertId = row.id; |
|
|
formPolicy.value.alertId = row.id; |
|
|
formPolicy.value.deviceId = row.deviceUuid; |
|
|
formPolicy.value.deviceId = row.deviceUuid; |
|
|
proxy.$refs.policyTable.clearSelection(); |
|
|
proxy.$refs.policyTable.clearSelection(); |
|
@ -765,7 +805,7 @@ function getModelList(row){ |
|
|
element.policyId = item.id; |
|
|
element.policyId = item.id; |
|
|
element.statusValue = item.statusValue; |
|
|
element.statusValue = item.statusValue; |
|
|
element.statusType = item.statusType; |
|
|
element.statusType = item.statusType; |
|
|
element.methodIds = item.methodIds?.split(',').map(Number); |
|
|
element.methodIds = item.methodIds==null||item.methodIds==''?null:item.methodIds.split(',').map(Number); |
|
|
element.operator = item.operator; |
|
|
element.operator = item.operator; |
|
|
element.sort = item.sortId; |
|
|
element.sort = item.sortId; |
|
|
element.id = item.alertModelId; |
|
|
element.id = item.alertModelId; |
|
@ -942,9 +982,9 @@ function judgeIfRightValue(){ |
|
|
if(!handleValueChangeSub(item)){ |
|
|
if(!handleValueChangeSub(item)){ |
|
|
flag = false; |
|
|
flag = false; |
|
|
}; |
|
|
}; |
|
|
if(item.value === '' || item.methodIds.length === 0){ |
|
|
// if(item.value === '' || item.methodIds == null || item.methodIds.length === 0){ |
|
|
flag = false; |
|
|
// flag = false; |
|
|
} |
|
|
// } |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
return flag; |
|
|
return flag; |
|
@ -984,9 +1024,9 @@ const validateCell = (data) => { |
|
|
} else if (typeof data.value === 'boolean') { |
|
|
} else if (typeof data.value === 'boolean') { |
|
|
return data.value !== undefined && data.value !== null; |
|
|
return data.value !== undefined && data.value !== null; |
|
|
} else if (Array.isArray(data.value)) { |
|
|
} else if (Array.isArray(data.value)) { |
|
|
return data.value !== []; |
|
|
return data.value.lenght == 0; |
|
|
} else if (typeof data.value === 'object') { |
|
|
} else if (typeof data.value === 'object') { |
|
|
return data.value !== {}; |
|
|
return data.value.lenght == 0; |
|
|
} else { |
|
|
} else { |
|
|
return data.value !== undefined && data.value !== null; |
|
|
return data.value !== undefined && data.value !== null; |
|
|
} |
|
|
} |
|
@ -1030,6 +1070,17 @@ function changeEnabled(row){ |
|
|
updateAlert(param); |
|
|
updateAlert(param); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function levelChange(value){ |
|
|
|
|
|
if(logicCode.value == 'A'){ |
|
|
|
|
|
dc_alert_level.value.forEach(item=>{ |
|
|
|
|
|
if(item.value == String(value)){ |
|
|
|
|
|
formPolicy.value.name = item.label |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getList(); |
|
|
getList(); |
|
|
|
|
|
|
|
|