Browse Source

优化告警功能

pull/1/head
ljlong_2630 1 year ago
parent
commit
86333a4a66
  1. 74
      src/views/model/alert/deviceparamalert.vue

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

@ -142,7 +142,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="告警设备" prop="deviceUuid"> <el-form-item label="告警设备" prop="deviceUuid">
<el-select v-model="form.deviceUuid" filterable placeholder="请选择参数" clearable @change="getParamsList"> <el-select v-model="form.deviceUuid" filterable placeholder="请选择设备" clearable @change="getParamsListDevice">
<el-option <el-option
v-for="item in deviceList" v-for="item in deviceList"
:key="item.uuid" :key="item.uuid"
@ -152,9 +152,21 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12" v-show="partionDisabled">
<el-form-item label="分区" prop="partion">
<el-select v-model="form.partion" filterable placeholder="请选择分区" clearable @change="getParamsListPartion">
<el-option
v-for="item in dc_device_partion"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" v-show="paramDisabled">
<el-form-item label="告警参数" prop="paramCode"> <el-form-item label="告警参数" prop="paramCode">
<el-select v-model="form.paramCode" filterable placeholder="请选择参数" clearable @change="setParamsType"> <el-select v-model="form.paramCode" filterable :placeholder="paramTip" clearable @change="setParamsType">
<el-option <el-option
v-for="item in paramsList" v-for="item in paramsList"
:key="item.paramCode" :key="item.paramCode"
@ -173,7 +185,7 @@
</el-form> </el-form>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" :disabled="submitDisabled" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</template> </template>
@ -345,7 +357,7 @@ import {listPolicyInfo,updatePolicy,updatePolicyBatch,addPolicy,addPolicyBatch,l
import lock from "@/assets/icons/svg/lock.svg"; import lock from "@/assets/icons/svg/lock.svg";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const router = useRouter(); const router = useRouter();
const { operator_sign,dc_param_value_type,dc_alert_level } = proxy.useDict('operator_sign','dc_param_value_type','dc_alert_level'); const { operator_sign,dc_param_value_type,dc_alert_level,dc_device_partion } = proxy.useDict('operator_sign','dc_param_value_type','dc_alert_level','dc_device_partion');
const alertList = ref([]); const alertList = ref([]);
const open = ref(false); const open = ref(false);
const openPolicy = ref(false); const openPolicy = ref(false);
@ -368,7 +380,6 @@ 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("");
@ -383,17 +394,15 @@ const levelVisiable = ref(false);
const nameVisiable = ref(false); const nameVisiable = ref(false);
const fixedColumns = ref(false); const fixedColumns = ref(false);
const tableHeight = ref("0px"); const tableHeight = ref("0px");
const sortItemMap = ref({});
const queryParamFilter = ref({});
const sortProps = ref([]);
const collapseVisible = ref(false); const collapseVisible = ref(false);
const paramTip = ref("请先选择设备");
const paramDisabled = ref(false);
const partionDisabled = ref(false);
const submitDisabled = ref(true);
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}
]); ]);
const statusSelects = ref([]);
const statusValueSelects = ref([]);
const data = reactive({ const data = reactive({
form: {}, form: {},
formPolicy: {}, formPolicy: {},
@ -410,6 +419,7 @@ const data = reactive({
queryParamsParam: { queryParamsParam: {
deviceUuid: null, deviceUuid: null,
paramCode: null, paramCode: null,
partion: null,
}, },
queryParamsPolicy:{ queryParamsPolicy:{
pageNum: 1, pageNum: 1,
@ -433,6 +443,9 @@ const data = reactive({
paramCode: [ paramCode: [
{ required: true, message: "参数编码不能为空", trigger: "blur" } { required: true, message: "参数编码不能为空", trigger: "blur" }
], ],
partion: [
{ required: true, message: "参数分区不能为空", trigger: "blur" }
],
}, },
rulesPolicy: { rulesPolicy: {
deviceUuid: [ deviceUuid: [
@ -441,7 +454,8 @@ const data = reactive({
paramCode: [ paramCode: [
{ required: true, message: "参数编码不能为空", trigger: "blur" } { required: true, message: "参数编码不能为空", trigger: "blur" }
], ],
} },
}); });
const { queryParamsDevice, queryParamsParam, queryParams, form, rules,queryParamsPolicy,queryPolicy, formPolicy, rulesPolicy } = toRefs(data); const { queryParamsDevice, queryParamsParam, queryParams, form, rules,queryParamsPolicy,queryPolicy, formPolicy, rulesPolicy } = toRefs(data);
@ -550,6 +564,14 @@ function handleAdd() {
reset(); reset();
getDeviceList(); getDeviceList();
open.value = true; open.value = true;
queryParamsParam.value={
deviceUuid: null,
paramCode: null,
partion: null,
},
partionDisabled.value = false;
paramDisabled.value = false;
submitDisabled.value = true;
title.value = "添加设备告警"; title.value = "添加设备告警";
} }
@ -621,7 +643,9 @@ function submitForm() {
addAlert(form.value).then(response => { addAlert(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功"); proxy.$modal.msgSuccess("新增成功");
open.value = false; open.value = false;
debugger
getList(); getList();
handlePolicy(response.data);
}); });
} }
} }
@ -696,9 +720,30 @@ function getDeviceList(){
}); });
} }
function getParamsList(deviceUuid){ function getParamsListDevice(deviceUuid){
loading.value = true; loading.value = true;
queryParamsParam.value.deviceUuid = deviceUuid; queryParamsParam.value.deviceUuid = deviceUuid;
if(queryParamsParam.value.partion == null){
partionDisabled.value = true;
paramTip.value = "请先选择分区";
return;
}else{
paramDisabled.value = true;
}
listAlertParamSelect(queryParamsParam.value).then(response => {
paramsList.value = response.data;
loading.value = false;
});
}
function getParamsListPartion(partion){
loading.value = true;
queryParamsParam.value.partion = partion;
if(queryParamsParam.value.deviceUuid == null){
paramTip.value = "请先选择设备";
return;
}else{
paramDisabled.value = true;
}
listAlertParamSelect(queryParamsParam.value).then(response => { listAlertParamSelect(queryParamsParam.value).then(response => {
paramsList.value = response.data; paramsList.value = response.data;
loading.value = false; loading.value = false;
@ -989,6 +1034,7 @@ function setParamsType(val){
paramsList.value.forEach(item=>{ paramsList.value.forEach(item=>{
if(item.paramCode == val){ if(item.paramCode == val){
form.value.paramType = item.paramType; form.value.paramType = item.paramType;
submitDisabled.value = false;
} }
}) })
} }

Loading…
Cancel
Save