缓存修改,里面的时间切换不做缓存

This commit is contained in:
stt
2025-11-14 13:24:21 +08:00
parent cd565c03ca
commit ea6aed9b99
2 changed files with 14 additions and 30 deletions

View File

@@ -30,10 +30,10 @@ import { log } from 'console'
const prop = defineProps({
w: { type: [String, Number] },
h: { type: [String, Number]},
width: { type: [String, Number]},
height: { type: [String, Number]},
timeKey: { type: [String, Number]},
h: { type: [String, Number] },
width: { type: [String, Number] },
height: { type: [String, Number] },
timeKey: { type: [String, Number] },
timeValue: { type: Object }
})
const OverLimitDetailsRef = ref()
@@ -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)`

View File

@@ -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)