Browse Source

告警改动后测试1版

pull/1/head
ljlong_2630 1 year ago
parent
commit
2350fbebc7
  1. 5
      src/assets/styles/self-defined.scss
  2. 171
      src/views/model/alert/deviceparamalert.vue

5
src/assets/styles/self-defined.scss

@ -180,3 +180,8 @@
display: block;
}
.elFormItem {
div{
margin-left: 0px !important;
}
}

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

@ -223,66 +223,76 @@
</el-form-item>
</el-col>
<el-col :span="24" v-show="policyModelVisiable">
<el-form-item label="告警算法" prop="policyModel">
<el-table ref="policyTable" v-loading="loading" :data="modelList" :row-key="getRowKey" @selection-change="handleSelectionChange">
<el-table-column type="selection" reserve-selection="true" width="55" align="center" />
<el-table-column label="名称" align="center" prop="name">
<template #default="scope">
<el-input v-model="scope.row.name"></el-input>
</template>
</el-table-column>
<el-table-column label="符号" align="center" prop="code" :width="120"/>
<el-table-column label="运算符" align="center" prop="operator" :width="120">
<template #default="scope">
<dict-tag :options="operator_sign" :value="scope.row.operator"/>
</template>
</el-table-column>
<el-table-column label="限值" align="center" prop="value">
<template #default="scope">
<el-input v-model="scope.row.value" @change="handleValueChange(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column label="级别" align="center" prop="level">
<template #default="scope">
<el-input v-model="scope.row.level"></el-input>
</template>
</el-table-column>
<el-table-column label="排序" align="center" prop="sort">
<template #default="scope">
<el-input v-model="scope.row.sort"></el-input>
</template>
</el-table-column>
<el-table-column label="告警方式" align="center" prop="methodIds">
<template #default="scope">
<el-select v-model="scope.row.methodIds" multiple @change="methodIdsChange" placeholder="请选择告警方式">
<el-option
v-for="item in methodList"
:key="item.id"
:label="item.methodName"
:value="item.id"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="状态值" align="center" prop="statusValue">
<template #default="scope">
<el-input v-model="scope.row.statusValue"></el-input>
</template>
</el-table-column>
<el-table-column label="状态类型" align="center" prop="statusType">
<template #default="scope">
<el-select v-model="scope.row.statusType" placeholder="请选择状态类型">
<el-option
v-for="item in status"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-row style="margin-bottom: 10px;">
<el-col>
<H3>告警逻辑</H3>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item class="elFormItem" prop="policyModel">
<el-table ref="policyTable" v-loading="loading" :data="modelList" :row-key="getRowKey" @selection-change="handleSelectionChange">
<el-table-column type="selection" reserve-selection="true" width="55" align="center" />
<el-table-column label="名称" align="center" prop="name">
<template #default="scope">
<el-input v-model="scope.row.name"></el-input>
</template>
</el-table-column>
<el-table-column label="符号" align="center" prop="code" :width="120"/>
<el-table-column label="运算符" align="center" prop="operator" :width="120">
<template #default="scope">
<dict-tag :options="operator_sign" :value="scope.row.operator"/>
</template>
</el-table-column>
<el-table-column label="限值" align="center" prop="value">
<template #default="scope">
<el-input v-model="scope.row.value" @change="handleValueChange(scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column label="级别" align="center" prop="level">
<template #default="scope">
<el-input v-model="scope.row.level"></el-input>
</template>
</el-table-column>
<el-table-column label="排序" align="center" prop="sort">
<template #default="scope">
<el-input v-model="scope.row.sort"></el-input>
</template>
</el-table-column>
<el-table-column label="告警方式" align="center" prop="methodIds">
<template #default="scope">
<el-select v-model="scope.row.methodIds" multiple @change="methodIdsChange" placeholder="请选择告警方式">
<el-option
v-for="item in methodList"
:key="item.id"
:label="item.methodName"
:value="item.id"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="状态值" align="center" prop="statusValue">
<template #default="scope">
<el-input v-model="scope.row.statusValue"></el-input>
</template>
</el-table-column>
<el-table-column label="状态类型" align="center" prop="statusType">
<template #default="scope">
<el-select v-model="scope.row.statusType" placeholder="请选择状态类型">
<el-option
v-for="item in status"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
</el-table>
</el-form-item>
</el-col>
</el-row>
</el-col>
</el-row>
</el-form>
@ -692,7 +702,7 @@ function getModelListSwitch(row){
if(response.data && response.data.length>0){
formPolicy.value.statusValue = response.data[0].statusValue;
formPolicy.value.statusType = response.data[0].statusType;
formPolicy.value.methodIds = response.data[0].methodIds.split(',').map(Number);
formPolicy.value.methodIds = response.data[0].methodIds?.split(',').map(Number);
formPolicy.value.boolValue = response.data[0].boolValue;
formPolicy.value.alertId = row.id;
formPolicy.value.deviceId = row.deviceUuid;
@ -716,16 +726,18 @@ function getModelList(row){
formPolicy.value.deviceId = row.deviceUuid;
proxy.$refs.policyTable.clearSelection();
console.log(queryPolicy.value);
listPolicyInfo(queryPolicy.value).then(response=>{
listPolicyInfo(queryPolicy.value).then(responsePolicy=>{
//
if(response.data && response.data.length>0){
console.log(response.data);
oldPolicyRows.value = response.data;
formPolicy.value.alertId = response.data[0].alertId;
formPolicy.value.deviceId = response.data[0].deviceId;
formPolicy.value.id = response.data[0].id;
if(responsePolicy.data && responsePolicy.data.length>0){
console.log(responsePolicy.data);
oldPolicyRows.value = responsePolicy.data;
formPolicy.value.alertId = responsePolicy.data[0].alertId;
formPolicy.value.deviceId = responsePolicy.data[0].deviceId;
formPolicy.value.id = responsePolicy.data[0].id;
console.log('modle');
modelList.value.map(element=>{
response.data.forEach(item=>{
console.log('response');
responsePolicy.data.forEach(item=>{
if(item.alertModelId == element.id){
policyDeviceUuid.value = item.deviceId;
policyAlertId.value = item.alertId;
@ -738,12 +750,15 @@ function getModelList(row){
}
element.level = item.level;
element.name = item.name;
element.id = item.id;
console.log('item.id');
console.log(item.id);
element.policyId = item.id;
element.statusValue = item.statusValue;
element.statusType = item.statusType;
element.methodIds = item.methodIds.split(',').map(Number);
element.methodIds = item.methodIds?.split(',').map(Number);
element.operator = item.operator;
element.sort = item.sortId;
element.id = item.alertModelId;
proxy.$refs.policyTable.toggleRowSelection(element,true);
return element;
}
@ -775,7 +790,7 @@ function mapFormTable(){
policyParam.name = item.name;
policyParam.statusValue = item.statusValue;
policyParam.statusType = item.statusType;
policyParam.methodIds = item.methodIds.join(',');
policyParam.methodIds = item.methodIds?.join(',');
policyParam.operator = item.operator;
policyParam.sortId = item.sort;
policyParams.value.push(policyParam);
@ -788,7 +803,7 @@ function mapFormTableUpdate(){
policyParams.value=[];
policyTableRows.forEach(item=>{
let policyParam = {};
policyParam.id = item.id;
policyParam.id = item.policyId;
policyParam.deviceId = policyDeviceUuid.value;
policyParam.alertId = item.alertId;
if(paramTypeValue.value == '3'){
@ -799,11 +814,11 @@ function mapFormTableUpdate(){
policyParam.intValue = item.value;
}
policyParam.level = item.level;
policyParam.alertModelId = item.alertModelId;
policyParam.alertModelId = item.id;
policyParam.name = item.name;
policyParam.statusValue = item.statusValue;
policyParam.statusType = item.statusType;
policyParam.methodIds = item.methodIds.join(',');
policyParam.methodIds = item.methodIds?.join(',');
policyParam.operator = item.operator;
policyParam.sortId = item.sort;
policyParams.value.push(policyParam);
@ -849,7 +864,6 @@ function computeAddPolicy() {
return item.id !== element.id;
})
//id
delete item.id;
let policyParam = {};
policyParam.deviceId = policyDeviceUuid.value;
policyParam.alertId = policyAlertId.value;
@ -865,7 +879,7 @@ function computeAddPolicy() {
policyParam.name = item.name;
policyParam.statusValue = item.statusValue;
policyParam.statusType = item.statusType;
policyParam.methodIds = item.methodIds.join(',');
policyParam.methodIds = item.methodIds?.join(',');
policyParam.operator = item.operator;
policyParam.sortId = item.sort;
addPolicyRows.value.push(policyParam);
@ -940,9 +954,6 @@ function handleValueChangeSub(row){
return flag;
}
function methodIdsChange(){
proxy.$forceUpdate();
}
getList();

Loading…
Cancel
Save