fix: 去除无用代码

This commit is contained in:
@changcode
2021-12-31 10:10:39 +08:00
parent 3f4c65fc67
commit f297983554
3 changed files with 10 additions and 21 deletions

View File

@@ -80,7 +80,8 @@ export default {
theme: {
themeColor: ''
},
timer: ''
timer: '',
pickTimer: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss',
}
},
created () {
@@ -135,8 +136,8 @@ export default {
if (timeRange && timeRange.length < 2) {
return []
}
const startTime = bus.timeFormate(timeRange[0], 'yyyy-MM-dd hh:mm:ss')
const endTime = bus.timeFormate(timeRange[1], 'yyyy-MM-dd hh:mm:ss')
const startTime = bus.timeFormate(timeRange[0], this.pickTimer)
const endTime = bus.timeFormate(timeRange[1], this.pickTimer)
return [startTime, endTime]
},
dateChange (time) {

View File

@@ -68,7 +68,10 @@ export default {
isPopoverDisabled: false,
isCustom: false,
timePicker: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss',
searchTime: [],
searchTime: [
bus.timeFormate(bus.getOffsetTimezoneData(-1), this.timePicker),
bus.timeFormate(bus.getOffsetTimezoneData(), this.timePicker)
],
showTime: {
id: 4,
text: this.$t('dashboard.panel.lastOneHour')
@@ -308,22 +311,7 @@ export default {
}
}
}
},
stepSearchTime: {
immediate: true,
handler (n, o) {
if (n && this.searchTime[0]) {
if (this.showTime.value) {
this.setSearchTime(this.showTime.type, this.showTime.value)
} else {
const startTime = bus.timeFormate(this.searchTime[0], this.timePicker)
const endTime = bus.timeFormate(new Date(this.searchTime[0]).getTime() + new Date(this.stepSearchTime[1]).getTime() - new Date(this.stepSearchTime[0]).getTime(), this.timePicker)
this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime)
}
}
}
},
}
}
}
</script>

View File

@@ -294,7 +294,7 @@ export default new Vue({
getNewTime (time, num) {
const date = new Date(time)
const newDate = new Date(parseInt(date.getTime(), 10) + num)
return this.timeFormate(newDate, 'yyyy-MM-dd hh:mm:ss')
return this.timeFormate(newDate, localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'yyyy-MM-dd hh:mm:ss')
},
getOffsetTimezoneData (offset = 0) {
return new Date(this.computeTimezone(new Date().getTime())).setHours(new Date(this.computeTimezone(new Date().getTime())).getHours() + offset)