fix:处理alertMessage时间回显错误的问题

This commit is contained in:
zhangyu
2023-06-08 16:39:51 +08:00
parent c8cf46a677
commit 07ad9d121a
3 changed files with 19 additions and 5 deletions

View File

@@ -149,7 +149,8 @@ export default {
}
const startTime = bus.timeFormate(timeRange[0], this.pickTimer)
const endTime = bus.timeFormate(timeRange[1], this.pickTimer)
return [startTime, endTime]
const timeType = timeRange[2]
return [startTime, endTime, timeType || '']
},
dateChange (time) {
this.searchTime = time

View File

@@ -20,6 +20,7 @@
:ref="'search-item' + index"
:class="{'search-item-select': index === historyIndex}"
:title="renderHistoryTitle(item)"
@click="selectHistory(item)"
>
<span v-for="(tag, tIndex) in item" :key="index + '-' +tIndex" class="search-box-tag" style="margin-right: 3px">
<span>{{tag.i18n}}:</span>
@@ -568,6 +569,10 @@ export default {
})
return str
},
selectHistory (item) {
this.selectArr = item
this.emitSearch()
},
contentShow (key) {
this.keyShow = false // key 的下拉
this.symbolShow = false // symbol 的下拉
@@ -1034,6 +1039,11 @@ export default {
this.where = this.$route.path + this.position
}
const historyArr = localStorage.getItem('nz-history-' + this.where) ? JSON.parse(localStorage.getItem('nz-history-' + this.where)) : []
historyArr.forEach(item => { // todo 后续还需要处理枚举类型的中英切换
item.forEach((searchInfo) => {
searchInfo.i18n = this.$t(searchInfo.code)
})
})
this.historyArr = historyArr
},
calcType () { // 处理各个页面的from targetTab 确定查询的type

View File

@@ -231,7 +231,7 @@ export default {
chartDatas: [],
sameLabels: ['instance', 'module', 'project', 'asset', 'endpoint', 'datacenter'],
legend: [],
searchTime: [bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - 24 * 30)), bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))), '30d'],
searchTime: [bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - 24 * 30)), bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))), '7d'],
searchTimeDialog: [],
searchTimeSelect: bus.getTimezontDateRange(),
currentMsg: {},
@@ -404,7 +404,7 @@ export default {
],
errorContent: '',
isError: false,
defaultPick: 11
defaultPick: 10
}
},
computed: {
@@ -449,9 +449,10 @@ export default {
methods: {
renderDefaultParams () {
const q = JSON.parse(this.$route.query.body)
console.log(q, 'q')
this.state = q.state
this.searchTime[0] = q.startAt
this.searchTime[1] = q.endAt
this.searchTime[0] = this.momentTz(q.startAt)
this.searchTime[1] = this.momentTz(q.endAt)
this.searchTime[2] = q.timeType
switch (q.timeType) {
case '7d' :
@@ -827,6 +828,8 @@ export default {
const path = this.fromRoute.alertMessage
const routePathParams = this.$lodash.cloneDeep(param)
delete routePathParams.statistics
routePathParams.body.startAt = this.momentStrToTimestamp(this.searchTime[0])
routePathParams.body.endAt = this.momentStrToTimestamp(this.searchTime[1])
routePathParams.body.timeType = this.searchTime[2]
routePathParams.body = JSON.stringify(routePathParams.body)
this.updatePath(routePathParams, path)