server 模块 下拉组件与时间选择控件添加联动效果
This commit is contained in:
parent
a0a2b3971d
commit
925f5cf937
|
@ -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(queryParams.startDate), moment(queryParams.endDate)]"
|
||||||
@change="onRangeDateChange"
|
@change="onRangeDateChange"
|
||||||
/>
|
/>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
@ -152,15 +152,16 @@ export default {
|
||||||
currLabel:"",
|
currLabel:"",
|
||||||
queryParams: {
|
queryParams: {
|
||||||
server: undefined,
|
server: undefined,
|
||||||
timer: "1h",
|
timer: 1,
|
||||||
startDate: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
|
startDate: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
|
||||||
endDate: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss')
|
endDate: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss')
|
||||||
},
|
},
|
||||||
serverOptions: [],
|
serverOptions: [],
|
||||||
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},
|
||||||
],
|
],
|
||||||
option1:{},
|
option1:{},
|
||||||
option2:{},
|
option2:{},
|
||||||
|
@ -179,6 +180,9 @@ export default {
|
||||||
modalTitle: "",
|
modalTitle: "",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.getBeforeHours(1)
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getServerList()
|
this.getServerList()
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
@ -191,6 +195,12 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getBeforeHours(num) {
|
||||||
|
let currentTime = moment()
|
||||||
|
let oneHourAgo = moment().subtract(num, 'hours');
|
||||||
|
this.queryParams.startDate = oneHourAgo.format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
this.queryParams.endDate = currentTime.format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
},
|
||||||
createAlertRules() {
|
createAlertRules() {
|
||||||
this.visible_rule = true
|
this.visible_rule = true
|
||||||
},
|
},
|
||||||
|
@ -249,9 +259,10 @@ export default {
|
||||||
this.currLabel = val.label
|
this.currLabel = val.label
|
||||||
},
|
},
|
||||||
onTimeChange(val) {
|
onTimeChange(val) {
|
||||||
console.log(val);
|
this.getBeforeHours(val)
|
||||||
},
|
},
|
||||||
onRangeDateChange(date, dateString) {
|
onRangeDateChange(date, dateString) {
|
||||||
|
this.queryParams.timer = 0
|
||||||
this.queryParams.startDate = dateString[0]
|
this.queryParams.startDate = dateString[0]
|
||||||
this.queryParams.endDate = dateString[1]
|
this.queryParams.endDate = dateString[1]
|
||||||
},
|
},
|
||||||
|
|
|
@ -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(queryParams.startDate), moment(queryParams.endDate)]"
|
||||||
@change="onRangeDateChange"
|
@change="onRangeDateChange"
|
||||||
/>
|
/>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
@ -183,15 +183,16 @@ export default {
|
||||||
currLabel:"",
|
currLabel:"",
|
||||||
queryParams: {
|
queryParams: {
|
||||||
server: undefined,
|
server: undefined,
|
||||||
timer: "1h",
|
timer: 1,
|
||||||
startDate: dateFormat(new Date(), 'yyyy-MM-dd'),
|
startDate: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
|
||||||
endDate: dateFormat(new Date(), 'yyyy-MM-dd')
|
endDate: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss')
|
||||||
},
|
},
|
||||||
serverOptions: [],
|
serverOptions: [],
|
||||||
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},
|
||||||
],
|
],
|
||||||
data1: [
|
data1: [
|
||||||
{
|
{
|
||||||
|
@ -280,10 +281,19 @@ export default {
|
||||||
myLine: null
|
myLine: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.getBeforeHours(1)
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getServerList()
|
this.getServerList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getBeforeHours(num) {
|
||||||
|
let currentTime = moment()
|
||||||
|
let oneHourAgo = moment().subtract(num, 'hours');
|
||||||
|
this.queryParams.startDate = oneHourAgo.format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
this.queryParams.endDate = currentTime.format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
},
|
||||||
createAlertRules() {
|
createAlertRules() {
|
||||||
this.visible_rule = true
|
this.visible_rule = true
|
||||||
},
|
},
|
||||||
|
@ -343,8 +353,10 @@ export default {
|
||||||
},
|
},
|
||||||
onTimeChange(val) {
|
onTimeChange(val) {
|
||||||
console.log(val);
|
console.log(val);
|
||||||
|
this.getBeforeHours(val)
|
||||||
},
|
},
|
||||||
onRangeDateChange(date, dateString) {
|
onRangeDateChange(date, dateString) {
|
||||||
|
this.queryParams.timer = 0
|
||||||
this.queryParams.startDate = dateString[0]
|
this.queryParams.startDate = dateString[0]
|
||||||
this.queryParams.endDate = dateString[1]
|
this.queryParams.endDate = dateString[1]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user