From d8cf8b6eb778e850467a8f2fa39661db02e5adc6 Mon Sep 17 00:00:00 2001 From: renpy Date: Fri, 28 Jul 2023 17:18:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=80=89=E6=8B=A9=E8=A1=8C?= =?UTF-8?q?=E5=86=85=E6=95=B0=E6=8D=AE=E6=97=B6=EF=BC=8C=E5=A2=9E=E5=AE=B6?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../databaseMonitor/overview/index.vue | 75 ++++++++++-------- .../emailMonitor/overview/index.vue | 77 +++++++++++-------- .../serverMonitor/overview/index.vue | 67 +++++++++------- 3 files changed, 123 insertions(+), 96 deletions(-) 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