缓存修改,里面的时间切换不做缓存
This commit is contained in:
@@ -59,12 +59,11 @@ const fullscreen = computed(() => {
|
||||
const selectChange = (showSelect: any, height: any, datePickerValue?: any) => {
|
||||
headerHeight.value = height
|
||||
|
||||
// 如果有传入 datePicker 的值
|
||||
// if (datePickerValue) {
|
||||
// // 更新表格参数
|
||||
// tableStore.table.params.searchBeginTime = datePickerValue.timeValue?.[0]
|
||||
// tableStore.table.params.searchEndTime = datePickerValue.timeValue?.[1]
|
||||
// }
|
||||
if (datePickerValue && datePickerValue.timeValue) {
|
||||
// 更新时间参数
|
||||
tableStore.table.params.searchBeginTime = datePickerValue.timeValue[0]
|
||||
tableStore.table.params.searchEndTime = datePickerValue.timeValue[1]
|
||||
}
|
||||
}
|
||||
|
||||
const tableStore: any = new TableStore({
|
||||
@@ -105,23 +104,8 @@ const tableStore: any = new TableStore({
|
||||
{ title: '主要存在的电能质量问题', field: 'problems', minWidth: '150', showOverflow: true }
|
||||
],
|
||||
beforeSearchFun: () => {
|
||||
// 尝试从缓存获取时间值
|
||||
let beginTime, endTime
|
||||
|
||||
if (fullscreen.value) {
|
||||
const cached = timeCacheStore.getCache(route.path)
|
||||
if (cached && cached.timeValue) {
|
||||
beginTime = cached.timeValue[0]
|
||||
endTime = cached.timeValue[1]
|
||||
}
|
||||
}
|
||||
|
||||
console.log('beginTime0000', beginTime)
|
||||
console.log('prop.timeValue?.[0]111', prop.timeValue?.[0])
|
||||
|
||||
// 如果缓存中没有则使用默认值
|
||||
tableStore.table.params.searchBeginTime = beginTime || prop.timeValue?.[0]
|
||||
tableStore.table.params.searchEndTime = endTime || prop.timeValue?.[1]
|
||||
tableStore.table.params.searchBeginTime = tableStore.table.params.searchBeginTime ?? prop.timeValue?.[0]
|
||||
tableStore.table.params.searchEndTime = tableStore.table.params.searchEndTime ?? prop.timeValue?.[1]
|
||||
},
|
||||
loadCallback: () => {
|
||||
tableStore.table.height = `calc(${prop.height} - 80px)`
|
||||
|
||||
@@ -103,9 +103,9 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
// 处理 DatePicker 值变化事件
|
||||
const handleDatePickerChange = (value: any) => {
|
||||
// 将值缓存到 timeCache
|
||||
if (value) {
|
||||
timeCacheStore.setCache(route.path, value.interval, value.timeValue)
|
||||
}
|
||||
// if (value) {
|
||||
// timeCacheStore.setCache(route.path, value.interval, value.timeValue)
|
||||
// }
|
||||
|
||||
// 将 datePicker 的变化传递给父组件
|
||||
emit('selectChange', true, tableHeader.value.offsetHeight, value)
|
||||
|
||||
Reference in New Issue
Block a user