NEZ-3289 fix:处理alertMessage 底弹窗
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
<el-select v-model="state" class="margin-r-10" size="small" value-key="value" :disabled="from === fromRoute.alertSilence" @change="getTableData" popper-class="right-box-select-top right-public-box-dropdown-top" style="width: 110px">
|
||||
<el-option v-for="item in stateOptions" :key="item.value" :label="$t(item.label)" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
<pick-time ref="pickTime" v-model="searchTimeHeader" :default-pick="10" :refresh-data-func="dateChange" :show-empty="true" :use-chart-unit="false" :use-refresh="false" :sign="sign"></pick-time>
|
||||
<pick-time ref="pickTime" v-model="searchTimeHeader" :default-pick="defaultPick" :refresh-data-func="dateChange" :show-empty="true" :use-chart-unit="false" :use-refresh="false" :sign="sign"></pick-time>
|
||||
</template>
|
||||
<template v-slot>
|
||||
<alertMessageTable
|
||||
@@ -307,66 +307,103 @@ export default {
|
||||
dialogText: '',
|
||||
isError: false,
|
||||
errorContent: '',
|
||||
chartInfo: {}
|
||||
chartInfo: {},
|
||||
defaultPick: 10,
|
||||
defaultPickType: 'date',
|
||||
defaultPickVal: 7
|
||||
}
|
||||
},
|
||||
created () {
|
||||
if (this.from === fromRoute.alertSilence) {
|
||||
this.searchMsg = this.searchMsgSilence
|
||||
}
|
||||
this.$route.query.bottomSelectArr && this.renderDefaultParams()
|
||||
this.$route.query.bottomSelectTime && this.renderDefaultParams()
|
||||
},
|
||||
methods: {
|
||||
renderDefaultParams () {
|
||||
const q = JSON.parse(this.$route.query.bottomSelectArr)
|
||||
sessionStorage.setItem('nz-reload', 0)
|
||||
const q = JSON.parse(this.$route.query.bottomSelectTime)
|
||||
this.state = q.state
|
||||
this.searchTimeHeader[0] = q.startAt ? this.momentTz(q.startAt) : ''
|
||||
this.searchTimeHeader[1] = q.endAt ? this.momentTz(q.endAt) : ''
|
||||
this.searchTimeHeader[2] = q.timeType
|
||||
if (!q.startAt && !q.timeType) {
|
||||
this.searchTimeHeader = ['', '', 'all']
|
||||
} else if (q.timeType === 'all') {
|
||||
this.searchTimeHeader = ['', '', 'all']
|
||||
}
|
||||
switch (this.searchTimeHeader[2]) {
|
||||
case '5m' :
|
||||
this.defaultPick = 1
|
||||
this.defaultPickType = 'minute'
|
||||
this.defaultPickVal = 5
|
||||
break
|
||||
case '15m' :
|
||||
this.defaultPick = 2
|
||||
this.defaultPickType = 'minute'
|
||||
this.defaultPickVal = 15
|
||||
break
|
||||
case '30m' :
|
||||
this.defaultPick = 3
|
||||
this.defaultPickType = 'minute'
|
||||
this.defaultPickVal = 30
|
||||
break
|
||||
case '1h' :
|
||||
this.defaultPick = 4
|
||||
this.defaultPickType = 'hour'
|
||||
this.defaultPickVal = 1
|
||||
break
|
||||
case '3h' :
|
||||
this.defaultPick = 5
|
||||
this.defaultPickType = 'hour'
|
||||
this.defaultPickVal = 3
|
||||
break
|
||||
case '6h' :
|
||||
this.defaultPick = 6
|
||||
this.defaultPickType = 'hour'
|
||||
this.defaultPickVal = 6
|
||||
break
|
||||
case '12h' :
|
||||
this.defaultPick = 7
|
||||
this.defaultPickType = 'hour'
|
||||
this.defaultPickVal = 12
|
||||
break
|
||||
case '1d' :
|
||||
this.defaultPick = 8
|
||||
break
|
||||
// case '1d' :
|
||||
// this.defaultPick = 8
|
||||
// this.defaultPickType = 'hour'
|
||||
// break
|
||||
case '24h' :
|
||||
this.defaultPick = 8
|
||||
this.defaultPickType = 'hour'
|
||||
this.defaultPickVal = 24
|
||||
break
|
||||
case '2d' :
|
||||
this.defaultPick = 9
|
||||
this.defaultPickType = 'date'
|
||||
this.defaultPickVal = 2
|
||||
break
|
||||
case '7d' :
|
||||
this.defaultPick = 10
|
||||
this.defaultPickType = 'date'
|
||||
this.defaultPickVal = 7
|
||||
break
|
||||
case '30d' :
|
||||
this.defaultPick = 11
|
||||
this.defaultPickType = 'date'
|
||||
this.defaultPickVal = 30
|
||||
break
|
||||
case 'all' :
|
||||
this.defaultPick = 12
|
||||
this.defaultPickType = 'all'
|
||||
this.defaultPickVal = 'all'
|
||||
break
|
||||
default:
|
||||
this.defaultPick = 0
|
||||
}
|
||||
// this.defaultPick = 11
|
||||
if (this.defaultPick && this.defaultPick !== 12) {
|
||||
this.setDefaultSearchTime('')
|
||||
}
|
||||
},
|
||||
labelsSort (obj) {
|
||||
const buildIn = ['asset', 'endpoint', 'module', 'cpu', 'project', 'datacenter', 'parent_asset', 'user']
|
||||
@@ -440,6 +477,30 @@ export default {
|
||||
this.setSearchTime('searchTimeHeader')
|
||||
this.getTableData()
|
||||
},
|
||||
setDefaultSearchTime () {
|
||||
const type = this.defaultPickType
|
||||
const val = this.defaultPickVal
|
||||
const key = 'searchTime'
|
||||
if (type === 'minute') {
|
||||
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val))
|
||||
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())))
|
||||
this.$set(this[key], 0, startTime)
|
||||
this.$set(this[key], 1, endTime)
|
||||
this.$set(this[key], 2, val + 'm')
|
||||
} else if (type === 'hour') {
|
||||
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val))
|
||||
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())))
|
||||
this.$set(this[key], 0, startTime)
|
||||
this.$set(this[key], 1, endTime)
|
||||
this.$set(this[key], 2, val + 'h')
|
||||
} else if (type === 'date') {
|
||||
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val))
|
||||
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())))
|
||||
this.$set(this[key], 0, startTime)
|
||||
this.$set(this[key], 1, endTime)
|
||||
this.$set(this[key], 2, val + 'd')
|
||||
}
|
||||
},
|
||||
getTableData (state) {
|
||||
if (state) {
|
||||
this.state = state
|
||||
@@ -497,9 +558,20 @@ export default {
|
||||
delete routePathParams.statistics
|
||||
routePathParams.body.startAt = this.searchTimeHeader[0] ? this.momentStrToTimestamp(this.searchTimeHeader[0]) : ''
|
||||
routePathParams.body.endAt = this.searchTimeHeader[1] ? this.momentStrToTimestamp(this.searchTimeHeader[1]) : ''
|
||||
routePathParams.body.timeType = this.searchTime[2]
|
||||
routePathParams.body.timeType = this.searchTimeHeader[2]
|
||||
console.log(this.$route, this.$router)
|
||||
if (!this.searchTimeHeader[2]) {
|
||||
routePathParams.body.startAt = this.searchTimeHeader[0] ? this.momentStrToTimestamp(this.searchTimeHeader[0]) : ''
|
||||
routePathParams.body.endAt = this.searchTimeHeader[1] ? this.momentStrToTimestamp(this.searchTimeHeader[1]) : ''
|
||||
} else {
|
||||
delete routePathParams.body.startAt
|
||||
delete routePathParams.body.endAt
|
||||
}
|
||||
const bottomSelectTime = JSON.stringify(routePathParams.body)
|
||||
routePathParams.body = JSON.stringify(routePathParams.body)
|
||||
// this.updatePath(routePathParams, path)
|
||||
const path = this.$route.path
|
||||
const urlQuery = this.$route.query
|
||||
this.$router.replace({ path, query: { ...urlQuery, bottomSelectTime } }).catch(err => {})
|
||||
const queryParams = {
|
||||
...this.searchLabel,
|
||||
body: encodeURIComponent(JSON.stringify(this.searchLabel.body))
|
||||
|
||||
Reference in New Issue
Block a user