fix: 修复创建报警规则中存在的问题

This commit is contained in:
Xu Zhimeng 2024-01-04 12:00:48 +08:00
parent b17d6ffac8
commit 5d2dbf2aa2
2 changed files with 33 additions and 1 deletions

View File

@ -524,6 +524,7 @@ export default {
label: item.name, label: item.name,
value: item.itemId, value: item.itemId,
units: item.units, units: item.units,
valueType: item.valueType,
} }
}) })
} else { } else {
@ -556,6 +557,8 @@ export default {
onSave() { onSave() {
this.$refs.al_ruleForm.validate((valid) => { this.$refs.al_ruleForm.validate((valid) => {
if (valid) { if (valid) {
const find = this.itemOptions.find((item) => item.value == this.form.itemId.key)
let params = { let params = {
silenceCycle: this.form.silenceCycle, silenceCycle: this.form.silenceCycle,
contactId: this.form.contactId, contactId: this.form.contactId,
@ -570,6 +573,7 @@ export default {
}, },
name: this.form.name, name: this.form.name,
id: this.isAdd ? '' : this.currId, id: this.isAdd ? '' : this.currId,
itemType: find.valueType,
} }
if (this.isAdd) { if (this.isAdd) {
postAction('/alarmRule/create', params).then((res) => { postAction('/alarmRule/create', params).then((res) => {
@ -644,6 +648,7 @@ export default {
label: item.name, label: item.name,
value: item.itemId, value: item.itemId,
units: item.units, units: item.units,
valueType: item.valueType,
} }
}) })
} else { } else {
@ -783,6 +788,7 @@ export default {
.ant-spin-nested-loading { .ant-spin-nested-loading {
width: 100%; width: 100%;
height: calc(100% - 40px); height: calc(100% - 40px);
overflow: auto;
} }
.monitor-list { .monitor-list {
height: 100%; height: 100%;

View File

@ -215,6 +215,9 @@ export default {
}, },
} }
}, },
created() {
this.getAlarmGroup()
},
mounted() { mounted() {
this.sourceOptions = this.serverList this.sourceOptions = this.serverList
}, },
@ -227,6 +230,25 @@ export default {
}, },
}, },
methods: { methods: {
getAlarmGroup() {
let params = {
pageNo: 1,
pageSize: 9999,
}
getAction('/alarmContactGroup/findPage', params).then((res) => {
if (res.success) {
this.contactGroupOptions = res.result.records.map((item) => {
return {
label: item.name,
value: item.id,
}
})
} else {
this.$message.warning('This operation fails. Contact your system administrator')
}
})
},
onCancel() { onCancel() {
this.$emit('onCancel') this.$emit('onCancel')
this.resetForm() this.resetForm()
@ -238,6 +260,8 @@ export default {
onSave() { onSave() {
this.$refs.al_ruleForm.validate((valid) => { this.$refs.al_ruleForm.validate((valid) => {
if (valid) { if (valid) {
const find = this.itemOptions.find((item) => item.value == this.form.itemId.key)
let params = { let params = {
silenceCycle: this.form.silenceCycle, silenceCycle: this.form.silenceCycle,
contactId: this.form.contactId, contactId: this.form.contactId,
@ -251,8 +275,9 @@ export default {
units: this.units, units: this.units,
}, },
name: this.form.name, name: this.form.name,
itemType: find.valueType,
} }
this.$emit('onCanonSavecel', params) this.$emit('onOk', params)
this.resetForm() this.resetForm()
} }
}) })
@ -270,6 +295,7 @@ export default {
label: item.name, label: item.name,
value: item.itemId, value: item.itemId,
units: item.units, units: item.units,
valueType: item.valueType,
} }
}) })
} else { } else {