fix: 去除无用时间格式

This commit is contained in:
@changcode
2022-01-04 16:26:15 +08:00
parent bf376fad61
commit 452d5573be
7 changed files with 20 additions and 27 deletions

View File

@@ -160,8 +160,7 @@ export default {
},
isPopoverDisabled: false,
isCustom: false,
valueArr: [],
multipleTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss'
valueArr: []
}
},
watch: {

View File

@@ -80,8 +80,7 @@ export default {
theme: {
themeColor: ''
},
timer: '',
pickTimer: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss',
timer: ''
}
},
created () {

View File

@@ -213,8 +213,7 @@ export default {
moduleData: null,
endpointData: null,
startAtTamp: '',
endAtTamp: '',
alertSilenceTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss'
endAtTamp: ''
}
},
mounted () {

View File

@@ -147,8 +147,7 @@
size="small"
:value-format="timeFormatStrToDatePickFormat(timeFormatMain)"
:format="timeFormatStrToDatePickFormat(timeFormatMain)"
style="width: 100%"
value-format="yyyy-MM-dd">
style="width: 100%">
</my-date-picker>
</template>
</template>

View File

@@ -68,10 +68,9 @@ export default {
return {
isPopoverDisabled: false,
isCustom: false,
timePicker: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss',
searchTime: [
bus.timeFormate(bus.getOffsetTimezoneData(-1), this.timePicker),
bus.timeFormate(bus.getOffsetTimezoneData(), this.timePicker)
bus.timeFormate(bus.getOffsetTimezoneData(-1)),
bus.timeFormate(bus.getOffsetTimezoneData())
],
showTime: {
id: 4,
@@ -165,8 +164,8 @@ export default {
},
methods: {
dateChange (val) {
const startTime = bus.timeFormate(val[0], this.timePicker)
const endTime = bus.timeFormate(val[1], this.timePicker)
const startTime = bus.timeFormate(val[0])
const endTime = bus.timeFormate(val[1])
this.$set(this.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime)
@@ -190,11 +189,11 @@ export default {
}
const time = bus.getTimezontDateRange()
if (timeGroup.start_time) {
this.$set(this.searchTime, 0, bus.timeFormate(timeGroup.start_time, this.timePicker))
this.$set(this.searchTime, 1, bus.timeFormate(timeGroup.end_time, this.timePicker))
this.$set(this.searchTime, 0, bus.timeFormate(timeGroup.start_time))
this.$set(this.searchTime, 1, bus.timeFormate(timeGroup.end_time))
} else {
this.$set(this.searchTime, 0, bus.timeFormate(time[0], this.timePicker))
this.$set(this.searchTime, 1, bus.timeFormate(time[1], this.timePicker))
this.$set(this.searchTime, 0, bus.timeFormate(time[0]))
this.$set(this.searchTime, 1, bus.timeFormate(time[1]))
}
}
} else {
@@ -263,20 +262,20 @@ export default {
},
setSearchTime (type, val) {
if (type === 'minute') {
const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val), this.timePicker)
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), this.timePicker)
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.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 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), this.timePicker)
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), this.timePicker)
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.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 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), this.timePicker)
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), this.timePicker)
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.searchTime, 0, startTime)
this.$set(this.searchTime, 1, endTime)
this.$set(this.searchTime, 2, val + 'd')

View File

@@ -165,8 +165,7 @@ export default {
disabledDate (time) {
return time.getTime() < Date.now() - 24 * 60 * 60 * 1000
}
},
apiKeyTableTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss'
}
}
},
methods: {

View File

@@ -276,8 +276,7 @@ export default {
// ---图表相关参数--end
scrollbarWrap: null,
batchDeleteObjs: [],
nowTimeType: {},
panelDateFormatTime: localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss'
nowTimeType: {}
}
},
components: {