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