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,