diff --git a/src/views/abnormalAlarm/databaseMonitor/overview/index.vue b/src/views/abnormalAlarm/databaseMonitor/overview/index.vue index 3632eec..8ed53c0 100644 --- a/src/views/abnormalAlarm/databaseMonitor/overview/index.vue +++ b/src/views/abnormalAlarm/databaseMonitor/overview/index.vue @@ -293,41 +293,50 @@ export default { this.visible = true }, onEdit() { - this.isAdd = false - this.visible = true - getAction("/sysDatabase/findInfo", {id:this.currentId}).then(res => { - if (res.success) { - this.form.setFieldsValue({ - username: res.result.username, - password: res.result.password, - name: res.result.name, - type: res.result.type, - port: res.result.port, - ipAddress: res.result.ipAddress - }); - } else { - this.$message.warning("This operation fails. Contact your system administrator") - } - }) + if (this.currentId) { + this.isAdd = false + this.visible = true + getAction("/sysDatabase/findInfo", {id:this.currentId}).then(res => { + if (res.success) { + this.form.setFieldsValue({ + username: res.result.username, + password: res.result.password, + name: res.result.name, + type: res.result.type, + port: res.result.port, + ipAddress: res.result.ipAddress + }); + } else { + this.$message.warning("This operation fails. Contact your system administrator") + } + }) + } else { + this.$message.info("Please select a piece of data") + } }, onDelete() { - let _this = this - this.$confirm({ - title: 'Are you sure to delete this item?', - onOk() { - deleteAction("/sysDatabase/deleteById", {id:_this.currentId}).then(res => { - if (res.success) { - _this.$message.success("success") - _this.getSysDatabase() - } else { - _this.$message.warning("This operation fails. Contact your system administrator") - } - }) - }, - onCancel() { - console.log('Cancel'); - }, - }); + if (this.currentId) { + let _this = this + this.$confirm({ + title: 'Are you sure to delete this item?', + onOk() { + deleteAction("/sysDatabase/deleteById", {id:_this.currentId}).then(res => { + if (res.success) { + _this.$message.success("success") + this.currentId="" + _this.getSysDatabase() + } else { + _this.$message.warning("This operation fails. Contact your system administrator") + } + }) + }, + onCancel() { + console.log('Cancel'); + }, + }); + } else { + this.$message.info("Please select a piece of data") + } }, onRowClick(record) { this.currentId = record.id diff --git a/src/views/abnormalAlarm/emailMonitor/overview/index.vue b/src/views/abnormalAlarm/emailMonitor/overview/index.vue index 9627410..9c12f06 100644 --- a/src/views/abnormalAlarm/emailMonitor/overview/index.vue +++ b/src/views/abnormalAlarm/emailMonitor/overview/index.vue @@ -314,42 +314,51 @@ export default { this.visible = true }, onEdit() { - this.isAdd = false - this.visible = true - getAction("/sysEmail/findInfo", {id:this.currentId}).then(res => { - if (res.success) { - this.form.setFieldsValue({ - name: res.result.username, - emailServerAddress: res.result.emailServerAddress, - username: res.result.username, - password: res.result.password, - emilType: res.result.emilType, - enabled: res.result.enabled, - port: res.result.port - }); - } else { - this.$message.warning("This operation fails. Contact your system administrator") - } - }) + if (this.currentId) { + this.isAdd = false + this.visible = true + getAction("/sysEmail/findInfo", {id:this.currentId}).then(res => { + if (res.success) { + this.form.setFieldsValue({ + name: res.result.username, + emailServerAddress: res.result.emailServerAddress, + username: res.result.username, + password: res.result.password, + emilType: res.result.emilType, + enabled: res.result.enabled, + port: res.result.port + }); + } else { + this.$message.warning("This operation fails. Contact your system administrator") + } + }) + } else { + this.$message.info("Please select a piece of data") + } }, onDelete() { - let _this = this - this.$confirm({ - title: 'Are you sure to delete this item?', - onOk() { - deleteAction("/sysEmail/deleteById", {id:_this.currentId}).then(res => { - if (res.success) { - _this.$message.success("success") - _this.getSysEmail() - } else { - _this.$message.warning("This operation fails. Contact your system administrator") - } - }) - }, - onCancel() { - console.log('Cancel'); - }, - }); + if (this.currentId) { + let _this = this + this.$confirm({ + title: 'Are you sure to delete this item?', + onOk() { + deleteAction("/sysEmail/deleteById", {id:_this.currentId}).then(res => { + if (res.success) { + _this.$message.success("success") + this.currentId="" + _this.getSysEmail() + } else { + _this.$message.warning("This operation fails. Contact your system administrator") + } + }) + }, + onCancel() { + console.log('Cancel'); + }, + }); + } else { + this.$message.info("Please select a piece of data") + } }, onRowClick(record) { console.log(record); diff --git a/src/views/abnormalAlarm/serverMonitor/overview/index.vue b/src/views/abnormalAlarm/serverMonitor/overview/index.vue index ad079ea..55b011b 100644 --- a/src/views/abnormalAlarm/serverMonitor/overview/index.vue +++ b/src/views/abnormalAlarm/serverMonitor/overview/index.vue @@ -235,37 +235,46 @@ export default { this.visible = true }, onEdit() { - this.isAdd = false - this.visible = true - getAction("/sysServer/findInfo", {id:this.currentId}).then(res => { - if (res.success) { - this.form.setFieldsValue({ - name: res.result.name, - ipAddress: res.result.ipAddress - }); - } else { - this.$message.warning("This operation fails. Contact your system administrator") - } - }) + if (this.currentId) { + this.isAdd = false + this.visible = true + getAction("/sysServer/findInfo", {id:this.currentId}).then(res => { + if (res.success) { + this.form.setFieldsValue({ + name: res.result.name, + ipAddress: res.result.ipAddress + }); + } else { + this.$message.warning("This operation fails. Contact your system administrator") + } + }) + } else { + this.$message.info("Please select a piece of data") + } }, onDelete() { - let _this = this - this.$confirm({ - title: 'Are you sure to delete this item?', - onOk() { - deleteAction("/sysServer/deleteById", {id:_this.currentId}).then(res => { - if (res.success) { - _this.$message.success("success") - _this.getSysServer() - } else { - _this.$message.warning("This operation fails. Contact your system administrator") - } - }) - }, - onCancel() { - console.log('Cancel'); - }, - }); + if (this.currentId) { + let _this = this + this.$confirm({ + title: 'Are you sure to delete this item?', + onOk() { + deleteAction("/sysServer/deleteById", {id:_this.currentId}).then(res => { + if (res.success) { + _this.$message.success("success") + _this.currentId = "" + _this.getSysServer() + } else { + _this.$message.warning("This operation fails. Contact your system administrator") + } + }) + }, + onCancel() { + console.log('Cancel'); + }, + }); + } else { + this.$message.info("Please select a piece of data") + } }, onRowClick(record) { this.currentId = record.id