Browse Source

告警调试1版

pull/1/head
ljlong_2630 1 year ago
parent
commit
9d48a834a9
  1. 4
      src/api/model/policy.js
  2. 62
      src/views/model/alert/deviceparamalert.vue

4
src/api/model/policy.js

@ -81,11 +81,11 @@ export function listPolicyNoPage(query) {
} }
// 批量修改参数值状态策略 // 批量修改参数值状态策略
export function updatePolicyBatch(updateList,deleteList,addList) { export function updatePolicyBatch(updateList,deleteList,addList,deviceUuid) {
return request({ return request({
url: '/model/dcBusiAlertParamPolicy/batchUpdate', url: '/model/dcBusiAlertParamPolicy/batchUpdate',
method: 'put', method: 'put',
data: {"updateList":updateList,"deleteList":deleteList,"addList":addList} data: {"updateList":updateList,"deleteList":deleteList,"addList":addList,"deviceUuid":deviceUuid}
}) })
} }

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

@ -97,21 +97,11 @@
<el-table-column label="参数编码" align="center" prop="paramCode" /> <el-table-column label="参数编码" align="center" prop="paramCode" />
<el-table-column label="是否告警" align="center" prop="enabled" :width="120"> <el-table-column label="是否告警" align="center" prop="enabled" :width="120">
<template #default="scope"> <template #default="scope">
<dict-tag :options="enabledTable" :value="scope.row.enabled"/> <el-switch v-model="scope.row.enabled" :active-value="1" :inactive-value="0" @change="changeEnabled(scope.row)"/>
</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
type="text"
icon="Edit"
@click="handleUpdate(scope.row)"
>修改</el-button> -->
<el-button <el-button
type="text" type="text"
icon="Delete" icon="Delete"
@ -228,23 +218,9 @@
</el-form-item> </el-form-item>
</el-col> </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;" v-show="tableVisiable"> <el-row style="margin-bottom: 10px;" v-show="tableVisiable">
<el-col> <el-col>
<h4>告警逻辑</h4> <h3>告警逻辑</h3>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-show="tableVisiable"> <el-row v-show="tableVisiable">
@ -323,15 +299,15 @@
@import "@/assets/styles/self-defined.scss"; @import "@/assets/styles/self-defined.scss";
</style> </style>
<script setup name="Alert"> <script setup name="Alert">
import { getDeviceParamsAlertInfo, listAlert, getAlert, 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 { listModel } from "@/api/model/alertmodel";
import { ElMessageBox } from 'element-plus'; import { ElMessageBox } from 'element-plus';
import { listPolicy,listPolicyInfo,updatePolicy,updatePolicyBatch,addPolicy,addPolicyBatch,newDelPolicy, 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,alert_value } = proxy.useDict('operator_sign','dc_param_value_type','alert_value'); const { operator_sign,dc_param_value_type } = proxy.useDict('operator_sign','dc_param_value_type');
const alertList = ref([]); const alertList = ref([]);
const open = ref(false); const open = ref(false);
const openPolicy = ref(false); const openPolicy = ref(false);
@ -363,18 +339,11 @@ const logicCode = ref("");
const rowPolicySelected = ref([]); const rowPolicySelected = ref([]);
const colorValue = ref({}); const colorValue = ref({});
const tableVisiable = ref(false); const tableVisiable = ref(false);
const enabledFlagTable = ref([ const alert_value = ref([
{label: '可用', value: 'true', elTagType: 'default', elTagClass: null}, {label: '1', value: true, elTagType: 'default', elTagClass: null},
{label: '不可用', value: 'false', elTagType: 'default', elTagClass: null} {label: '0', 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({
@ -553,7 +522,6 @@ function handlePolicy(row) {
statusTypeVisiable.value=true; statusTypeVisiable.value=true;
sortIdVisiable.value=false; sortIdVisiable.value=false;
methodIdsVisiable.value=true; methodIdsVisiable.value=true;
policyEnabledVisiable.value=true;
tableVisiable.value=false; tableVisiable.value=false;
}else if(row.logicCode == 'B'){ }else if(row.logicCode == 'B'){
getModelList(row); getModelList(row);
@ -563,7 +531,6 @@ function handlePolicy(row) {
statusTypeVisiable.value=false; statusTypeVisiable.value=false;
sortIdVisiable.value=false; sortIdVisiable.value=false;
methodIdsVisiable.value=false; methodIdsVisiable.value=false;
policyEnabledVisiable.value=true;
tableVisiable.value=true; tableVisiable.value=true;
}else if(row.logicCode == 'C'){ }else if(row.logicCode == 'C'){
ElMessageBox.alert('目前该告警逻辑没有实现', '提示', { ElMessageBox.alert('目前该告警逻辑没有实现', '提示', {
@ -667,7 +634,7 @@ function submitFormPolicy() {
mapFormTableUpdate(); mapFormTableUpdate();
computeDelPolicy(); computeDelPolicy();
computeAddPolicy(); computeAddPolicy();
updatePolicyBatch(policyParams.value,deletePolicyRows.value,addPolicyRows.value).then(response => { updatePolicyBatch(policyParams.value,deletePolicyRows.value,addPolicyRows.value,policyDeviceUuid.value).then(response => {
proxy.$modal.msgSuccess("修改成功"); proxy.$modal.msgSuccess("修改成功");
openPolicy.value = false; openPolicy.value = false;
getList(); getList();
@ -1024,10 +991,10 @@ const isInvalid = (value,row) => {
return !validateCell(value); return !validateCell(value);
}; };
function changeEnabled(value){ function changeEnabled(row){
let param = { let param = {
id:policyAlertId.value, id:row.id,
enabled:value enabled:row.enabled
} }
updateAlert(param); updateAlert(param);
} }
@ -1035,9 +1002,6 @@ function selectionDisabled(){
return formPolicy.value.enabled === 1; return formPolicy.value.enabled === 1;
} }
function selectionDisableAll(){
return formPolicy.value.enabled === 1;
}
getList(); getList();

Loading…
Cancel
Save