diff --git a/src/views/model/alert/deviceparamalert.vue b/src/views/model/alert/deviceparamalert.vue index c6875ca..ee67983 100644 --- a/src/views/model/alert/deviceparamalert.vue +++ b/src/views/model/alert/deviceparamalert.vue @@ -783,16 +783,45 @@ function submitFormPolicy() { mapFormTableUpdate(); computeDelPolicy(); computeAddPolicy(); - updatePolicyBatch(policyParams.value,deletePolicyRows.value,addPolicyRows.value,policyDeviceUuid.value).then(response => { - proxy.$modal.msgSuccess("修改成功"); - openPolicy.value = false; - getList(); - }); + if(deletePolicyRows.value?.length>0){ + const policyTableRows = proxy.$refs.policyTable.getSelectionRows(); + if(policyTableRows===undefined||policyTableRows==null||policyTableRows.length==0){ + ElMessageBox.confirm('确定删除所有告警配置?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + center: true, + }).then(() => { + // 删除所有告警配置 + updatePolicyBatch(policyParams.value,deletePolicyRows.value,addPolicyRows.value,policyDeviceUuid.value).then(response => { + proxy.$modal.msgSuccess("修改成功"); + openPolicy.value = false; + getList(); + }); + }).catch(() => { + // 取消删除告警配置 + return; + }); + }else{ + updatePolicyBatch(policyParams.value,deletePolicyRows.value,addPolicyRows.value,policyDeviceUuid.value).then(response => { + proxy.$modal.msgSuccess("修改成功"); + openPolicy.value = false; + getList(); + }); + } + }else{ + updatePolicyBatch(policyParams.value,deletePolicyRows.value,addPolicyRows.value,policyDeviceUuid.value).then(response => { + proxy.$modal.msgSuccess("修改成功"); + openPolicy.value = false; + getList(); + }); + } + }else if(logicCode.value == 'A'){ if (valid) { formPolicy.value.methodIds = formPolicy.value.methodIds?.join(','); updatePolicy(formPolicy.value).then(response => { - proxy.$modal.msgSuccess("新增成功"); + proxy.$modal.msgSuccess("修改成功"); openPolicy.value = false; getList(); }); @@ -831,7 +860,7 @@ function submitFormPolicy() { if (valid) { formPolicy.value.methodIds = formPolicy.value.methodIds?.join(','); addPolicy(formPolicy.value).then(response => { - proxy.$modal.msgSuccess("修改成功"); + proxy.$modal.msgSuccess("新增成功"); openPolicy.value = false; getList(); }); @@ -1032,7 +1061,7 @@ function computeDelPolicy() { policyParam.name = item.name; policyParam.statusValue = item.statusValue; policyParam.statusType = item.statusType; - policyParam.methodIds = item.methodIds?.join(','); + policyParam.methodIds = item.methodIds; policyParam.operator = item.operator; policyParam.sortId = item.sort; deletePolicyRows.value.push(policyParam); diff --git a/src/views/model/alert/policy.vue b/src/views/model/alert/policy.vue index 7886554..858b5d9 100644 --- a/src/views/model/alert/policy.vue +++ b/src/views/model/alert/policy.vue @@ -227,6 +227,7 @@ +