NEZ-3289 fix: 修改浏览器刷新 不清空所有参数 只更新时间参数
This commit is contained in:
@@ -76,7 +76,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
searchTime: [],
|
searchTime: ['', ''],
|
||||||
visible: false,
|
visible: false,
|
||||||
intervalTimer: null,
|
intervalTimer: null,
|
||||||
interval: -1,
|
interval: -1,
|
||||||
@@ -146,10 +146,10 @@ export default {
|
|||||||
},
|
},
|
||||||
timeFormate (timeRange) {
|
timeFormate (timeRange) {
|
||||||
if (timeRange && timeRange.length < 2) {
|
if (timeRange && timeRange.length < 2) {
|
||||||
return []
|
return ['', '']
|
||||||
}
|
}
|
||||||
if (!timeRange[0]) {
|
if (!timeRange[0]) {
|
||||||
return []
|
return ['', '']
|
||||||
}
|
}
|
||||||
const startTime = bus.timeFormate(timeRange[0], this.pickTimer)
|
const startTime = bus.timeFormate(timeRange[0], this.pickTimer)
|
||||||
const endTime = bus.timeFormate(timeRange[1], this.pickTimer)
|
const endTime = bus.timeFormate(timeRange[1], this.pickTimer)
|
||||||
|
|||||||
@@ -237,8 +237,9 @@ export default {
|
|||||||
this.getUtcStr()
|
this.getUtcStr()
|
||||||
this.getRangeHistoryArr()
|
this.getRangeHistoryArr()
|
||||||
const timeTemp = this.$lodash.cloneDeep(this.searchTime)
|
const timeTemp = this.$lodash.cloneDeep(this.searchTime)
|
||||||
this.oldSearchTime[0] = timeTemp[0]
|
console.log(this.searchTime)
|
||||||
this.oldSearchTime[1] = timeTemp[1]
|
this.oldSearchTime[0] = timeTemp[0] || ''
|
||||||
|
this.oldSearchTime[1] = timeTemp[1] || ''
|
||||||
// 监听dateFormat变化 改变日期格式
|
// 监听dateFormat变化 改变日期格式
|
||||||
window.addEventListener('storage', this.watchDateFormat)
|
window.addEventListener('storage', this.watchDateFormat)
|
||||||
},
|
},
|
||||||
@@ -606,7 +607,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.showEmpty && this.defaultPick === 12) {
|
if (this.showEmpty && this.defaultPick === 12) {
|
||||||
this.searchTime = []
|
this.searchTime = ['', '']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ export default {
|
|||||||
isError: false,
|
isError: false,
|
||||||
defaultPick: 10,
|
defaultPick: 10,
|
||||||
defaultPickType: 'date',
|
defaultPickType: 'date',
|
||||||
defaultPickVal: 7,
|
defaultPickVal: 7
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -452,19 +452,16 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
renderDefaultParams () {
|
renderDefaultParams () {
|
||||||
if (sessionStorage.getItem('nz-reload') == 1) {
|
|
||||||
this.searchTime = [bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - 24 * 7)), bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))), '7d']
|
|
||||||
this.searchLabel = {}
|
|
||||||
sessionStorage.setItem('nz-reload', 0)
|
sessionStorage.setItem('nz-reload', 0)
|
||||||
return
|
|
||||||
}
|
|
||||||
const q = JSON.parse(this.$route.query.body)
|
const q = JSON.parse(this.$route.query.body)
|
||||||
this.state = q.state
|
this.state = q.state
|
||||||
this.searchTime[0] = q.startAt ? this.momentTz(q.startAt) : ''
|
this.searchTime[0] = q.startAt ? this.momentTz(q.startAt) : ''
|
||||||
this.searchTime[1] = q.endAt ? this.momentTz(q.endAt) : ''
|
this.searchTime[1] = q.endAt ? this.momentTz(q.endAt) : ''
|
||||||
this.searchTime[2] = q.timeType
|
this.searchTime[2] = q.timeType
|
||||||
if (!q.startAt) {
|
if (!q.startAt && !q.timeType) {
|
||||||
this.searchTime[2] = 'all'
|
this.searchTime = ['', '', 'all']
|
||||||
|
} else if (q.timeType === 'all') {
|
||||||
|
this.searchTime = ['', '', 'all']
|
||||||
}
|
}
|
||||||
switch (this.searchTime[2]) {
|
switch (this.searchTime[2]) {
|
||||||
case '5m' :
|
case '5m' :
|
||||||
@@ -922,10 +919,16 @@ export default {
|
|||||||
...this.searchLabel
|
...this.searchLabel
|
||||||
}
|
}
|
||||||
const path = this.fromRoute.alertMessage
|
const path = this.fromRoute.alertMessage
|
||||||
const routePathParams = this.$lodash.cloneDeep(param)
|
const routePathParams = JSON.parse(JSON.stringify(param))
|
||||||
delete routePathParams.statistics
|
delete routePathParams.statistics
|
||||||
|
console.log(this.searchTime[2])
|
||||||
|
if (!this.searchTime[2]) {
|
||||||
routePathParams.body.startAt = this.searchTime[0] ? this.momentStrToTimestamp(this.searchTime[0]) : ''
|
routePathParams.body.startAt = this.searchTime[0] ? this.momentStrToTimestamp(this.searchTime[0]) : ''
|
||||||
routePathParams.body.endAt = this.searchTime[1] ? this.momentStrToTimestamp(this.searchTime[1]) : ''
|
routePathParams.body.endAt = this.searchTime[1] ? this.momentStrToTimestamp(this.searchTime[1]) : ''
|
||||||
|
} else {
|
||||||
|
delete routePathParams.body.startAt
|
||||||
|
delete routePathParams.body.endAt
|
||||||
|
}
|
||||||
routePathParams.body.timeType = this.searchTime[2]
|
routePathParams.body.timeType = this.searchTime[2]
|
||||||
routePathParams.body = JSON.stringify(routePathParams.body)
|
routePathParams.body = JSON.stringify(routePathParams.body)
|
||||||
this.updatePath(routePathParams, path)
|
this.updatePath(routePathParams, path)
|
||||||
|
|||||||
Reference in New Issue
Block a user