From ed653bf0fc9fcd05195802b3b26082f39d65d8f9 Mon Sep 17 00:00:00 2001 From: renpy Date: Mon, 28 Aug 2023 17:11:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=97=B6=E9=97=B4=E4=B8=8E=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E4=B9=8B=E9=97=B4=E7=9A=84=E8=81=94=E5=8A=A8?= =?UTF-8?q?=E6=95=88=E6=9E=9C=EF=BC=8C=E5=8F=8A=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E7=9A=84=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../instances/conditionBox.vue | 48 ++++++++++++------- .../databaseMonitor/overview/index.vue | 11 ++++- .../emailMonitor/instances/index.vue | 4 +- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/src/views/abnormalAlarm/databaseMonitor/instances/conditionBox.vue b/src/views/abnormalAlarm/databaseMonitor/instances/conditionBox.vue index 32c1652..4a521ce 100644 --- a/src/views/abnormalAlarm/databaseMonitor/instances/conditionBox.vue +++ b/src/views/abnormalAlarm/databaseMonitor/instances/conditionBox.vue @@ -4,7 +4,7 @@ Database name Time @@ -54,24 +54,38 @@ import { getAction, postAction, httpAction, deleteAction } from '@/api/manage' export default { data() { return { - queryParams: { - name: undefined, - timer: "1h", - startDate: dateFormat(new Date(), 'yyyy-MM-dd'), - endDate: dateFormat(new Date(), 'yyyy-MM-dd') - }, + name: undefined, + timer: 1, + startDate: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'), + endDate: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'), DbOptions: [], timerOptions: [ - {label: "1Hours",value: "1h"}, - {label: "2Hours",value: "2h"}, - {label: "3Hours",value: "3h"}, + {label: "1Hours",value: 1}, + {label: "2Hours",value: 2}, + {label: "3Hours",value: 3}, + {label: "user-defined",value: 0}, ], + currId:"" } }, + watch: { + name(newValue, oldValue) { + this.currId = newValue + } + }, + created() { + this.getBeforeHours(1) + }, mounted () { this.getDbList(); }, methods: { + getBeforeHours(num) { + let currentTime = moment() + let oneHourAgo = moment().subtract(num, 'hours'); + this.startDate = oneHourAgo.format('YYYY-MM-DD HH:mm:ss') + this.endDate = currentTime.format('YYYY-MM-DD HH:mm:ss') + }, moment, filterOption(input, option) { return ( @@ -81,6 +95,7 @@ export default { getDbList() { getAction("/sysDatabase/sourceList").then(res => { if (res.success) { + this.name = this.$route.query.id || res.result[0].sourceId this.DbOptions = res.result.map(item => { return { label: item.sourceName, @@ -93,14 +108,15 @@ export default { }) }, onDbChange(val) { - console.log(val); + this.name = val }, onTimeChange(val) { - console.log(val); + this.getBeforeHours(val) }, onRangeDateChange(date, dateString) { - this.queryParams.startDate = dateString[0] - this.queryParams.endDate = dateString[1] + this.timer = 0 + this.startDate = dateString[0] + this.endDate = dateString[1] }, }, } diff --git a/src/views/abnormalAlarm/databaseMonitor/overview/index.vue b/src/views/abnormalAlarm/databaseMonitor/overview/index.vue index d6d918f..e5d1dea 100644 --- a/src/views/abnormalAlarm/databaseMonitor/overview/index.vue +++ b/src/views/abnormalAlarm/databaseMonitor/overview/index.vue @@ -390,8 +390,15 @@ export default { this.form.resetFields() this.visible = false }, - onRowDbclick() { - this.$router.push("/alarm/databaseMonitor/instances") + onRowDbclick(record) { + console.log(record); + let query = { + id:record.id + } + this.$router.push({ + path: '/alarm/databaseMonitor/instances', + query + }) } }, } diff --git a/src/views/abnormalAlarm/emailMonitor/instances/index.vue b/src/views/abnormalAlarm/emailMonitor/instances/index.vue index c265de4..93b915c 100644 --- a/src/views/abnormalAlarm/emailMonitor/instances/index.vue +++ b/src/views/abnormalAlarm/emailMonitor/instances/index.vue @@ -204,9 +204,7 @@ export default { getEmailList() { getAction("/sysEmail/sourceList").then(res => { if (res.success) { - // if (!this.$route.query.emailId) { - this.emailId = this.$route.query.emailId || res.result[0].sourceId - // } + this.emailId = this.$route.query.emailId || res.result[0].sourceId this.emailOptions = res.result.map(item => { return { label: item.sourceName,