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({
url: '/model/dcBusiAlertParamPolicy/batchUpdate',
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="enabled" :width="120">
<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>
</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
type="text"
icon="Edit"
@click="handleUpdate(scope.row)"
>修改</el-button> -->
<el-button
type="text"
icon="Delete"
@ -228,23 +218,9 @@
</el-form-item>
</el-col>
</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-col>
<h4>告警逻辑</h4>
<h3>告警逻辑</h3>
</el-col>
</el-row>
<el-row v-show="tableVisiable">
@ -323,15 +299,15 @@
@import "@/assets/styles/self-defined.scss";
</style>
<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 { listMethod } from "@/api/model/method";
import { listModel } from "@/api/model/alertmodel";
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 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 open = ref(false);
const openPolicy = ref(false);
@ -363,18 +339,11 @@ const logicCode = ref("");
const rowPolicySelected = ref([]);
const colorValue = ref({});
const tableVisiable = ref(false);
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 alert_value = ref([
{label: '1', value: true, elTagType: 'default', elTagClass: null},
{label: '0', value: false, elTagType: 'default', elTagClass: null}
]);
const statusSelects = ref([]);
const statusValueSelects = ref([]);
const data = reactive({
@ -553,7 +522,6 @@ function handlePolicy(row) {
statusTypeVisiable.value=true;
sortIdVisiable.value=false;
methodIdsVisiable.value=true;
policyEnabledVisiable.value=true;
tableVisiable.value=false;
}else if(row.logicCode == 'B'){
getModelList(row);
@ -563,7 +531,6 @@ function handlePolicy(row) {
statusTypeVisiable.value=false;
sortIdVisiable.value=false;
methodIdsVisiable.value=false;
policyEnabledVisiable.value=true;
tableVisiable.value=true;
}else if(row.logicCode == 'C'){
ElMessageBox.alert('目前该告警逻辑没有实现', '提示', {
@ -667,7 +634,7 @@ function submitFormPolicy() {
mapFormTableUpdate();
computeDelPolicy();
computeAddPolicy();
updatePolicyBatch(policyParams.value,deletePolicyRows.value,addPolicyRows.value).then(response => {
updatePolicyBatch(policyParams.value,deletePolicyRows.value,addPolicyRows.value,policyDeviceUuid.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
openPolicy.value = false;
getList();
@ -1024,10 +991,10 @@ const isInvalid = (value,row) => {
return !validateCell(value);
};
function changeEnabled(value){
function changeEnabled(row){
let param = {
id:policyAlertId.value,
enabled:value
id:row.id,
enabled:row.enabled
}
updateAlert(param);
}
@ -1035,9 +1002,6 @@ function selectionDisabled(){
return formPolicy.value.enabled === 1;
}
function selectionDisableAll(){
return formPolicy.value.enabled === 1;
}
getList();

Loading…
Cancel
Save