数据库模块实现时间与日期控件之间的联动效果,及初始化的默认值
This commit is contained in:
parent
24a86494f2
commit
ed653bf0fc
|
@ -4,7 +4,7 @@
|
||||||
<a-col flex="335px">
|
<a-col flex="335px">
|
||||||
<span class="item-label">Database name</span>
|
<span class="item-label">Database name</span>
|
||||||
<a-select style="width:180px"
|
<a-select style="width:180px"
|
||||||
v-model="queryParams.name"
|
v-model="name"
|
||||||
placeholder="select..."
|
placeholder="select..."
|
||||||
:filter-option="filterOption"
|
:filter-option="filterOption"
|
||||||
show-arrow
|
show-arrow
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<a-col flex="265px">
|
<a-col flex="265px">
|
||||||
<span class="item-label">Time</span>
|
<span class="item-label">Time</span>
|
||||||
<a-select style="width:180px"
|
<a-select style="width:180px"
|
||||||
v-model="queryParams.timer"
|
v-model="timer"
|
||||||
placeholder="select..."
|
placeholder="select..."
|
||||||
show-arrow
|
show-arrow
|
||||||
allowClear
|
allowClear
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
<a-col flex="265px">
|
<a-col flex="265px">
|
||||||
<a-range-picker
|
<a-range-picker
|
||||||
:show-time="true"
|
:show-time="true"
|
||||||
:default-value="[moment(queryParams.startDate), moment(queryParams.endDate)]"
|
:value="[moment(startDate), moment(endDate)]"
|
||||||
@change="onRangeDateChange"
|
@change="onRangeDateChange"
|
||||||
/>
|
/>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
@ -54,24 +54,38 @@ import { getAction, postAction, httpAction, deleteAction } from '@/api/manage'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
queryParams: {
|
name: undefined,
|
||||||
name: undefined,
|
timer: 1,
|
||||||
timer: "1h",
|
startDate: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
|
||||||
startDate: dateFormat(new Date(), 'yyyy-MM-dd'),
|
endDate: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
|
||||||
endDate: dateFormat(new Date(), 'yyyy-MM-dd')
|
|
||||||
},
|
|
||||||
DbOptions: [],
|
DbOptions: [],
|
||||||
timerOptions: [
|
timerOptions: [
|
||||||
{label: "1Hours",value: "1h"},
|
{label: "1Hours",value: 1},
|
||||||
{label: "2Hours",value: "2h"},
|
{label: "2Hours",value: 2},
|
||||||
{label: "3Hours",value: "3h"},
|
{label: "3Hours",value: 3},
|
||||||
|
{label: "user-defined",value: 0},
|
||||||
],
|
],
|
||||||
|
currId:""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
name(newValue, oldValue) {
|
||||||
|
this.currId = newValue
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getBeforeHours(1)
|
||||||
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.getDbList();
|
this.getDbList();
|
||||||
},
|
},
|
||||||
methods: {
|
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,
|
moment,
|
||||||
filterOption(input, option) {
|
filterOption(input, option) {
|
||||||
return (
|
return (
|
||||||
|
@ -81,6 +95,7 @@ export default {
|
||||||
getDbList() {
|
getDbList() {
|
||||||
getAction("/sysDatabase/sourceList").then(res => {
|
getAction("/sysDatabase/sourceList").then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
|
this.name = this.$route.query.id || res.result[0].sourceId
|
||||||
this.DbOptions = res.result.map(item => {
|
this.DbOptions = res.result.map(item => {
|
||||||
return {
|
return {
|
||||||
label: item.sourceName,
|
label: item.sourceName,
|
||||||
|
@ -93,14 +108,15 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onDbChange(val) {
|
onDbChange(val) {
|
||||||
console.log(val);
|
this.name = val
|
||||||
},
|
},
|
||||||
onTimeChange(val) {
|
onTimeChange(val) {
|
||||||
console.log(val);
|
this.getBeforeHours(val)
|
||||||
},
|
},
|
||||||
onRangeDateChange(date, dateString) {
|
onRangeDateChange(date, dateString) {
|
||||||
this.queryParams.startDate = dateString[0]
|
this.timer = 0
|
||||||
this.queryParams.endDate = dateString[1]
|
this.startDate = dateString[0]
|
||||||
|
this.endDate = dateString[1]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,8 +390,15 @@ export default {
|
||||||
this.form.resetFields()
|
this.form.resetFields()
|
||||||
this.visible = false
|
this.visible = false
|
||||||
},
|
},
|
||||||
onRowDbclick() {
|
onRowDbclick(record) {
|
||||||
this.$router.push("/alarm/databaseMonitor/instances")
|
console.log(record);
|
||||||
|
let query = {
|
||||||
|
id:record.id
|
||||||
|
}
|
||||||
|
this.$router.push({
|
||||||
|
path: '/alarm/databaseMonitor/instances',
|
||||||
|
query
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,9 +204,7 @@ export default {
|
||||||
getEmailList() {
|
getEmailList() {
|
||||||
getAction("/sysEmail/sourceList").then(res => {
|
getAction("/sysEmail/sourceList").then(res => {
|
||||||
if (res.success) {
|
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 => {
|
this.emailOptions = res.result.map(item => {
|
||||||
return {
|
return {
|
||||||
label: item.sourceName,
|
label: item.sourceName,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user