fix: 表格自定义缓存修改(1. 初始化读取缓存时,判断缓存里的version和当前version是否一致,不一致则清掉缓存,改用代码里的tableTitle;2. 在保存时,version字段直接用当前version,不用加小版本)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { tableSort } from '@/utils/tools'
|
||||
import { defaultPageSize, fromRoute, position, storageKey, dbTableColumnCustomizeConfigPre } from '@/utils/constants'
|
||||
import { defaultPageSize, fromRoute, position, storageKey, dbTableColumnCustomizeConfigPre,dbTableColumnCustomizeConfig } from '@/utils/constants'
|
||||
import _ from 'lodash'
|
||||
import { ref } from 'vue'
|
||||
import pagination from '@/components/common/Pagination'
|
||||
@@ -428,9 +428,19 @@ export default {
|
||||
localStorageTableTitle = await indexedDBUtils.selectTable(tableName).get({ id: userId })
|
||||
}
|
||||
|
||||
localStorageTableTitle = localStorageTableTitle && localStorageTableTitle.config
|
||||
? localStorageTableTitle.config
|
||||
: (this.$refs.dataTable && this.$refs.dataTable.tableTitle ? this.$refs.dataTable.tableTitle : [])
|
||||
let curTableTitles = this.$refs.dataTable && this.$refs.dataTable.tableTitle ? this.$refs.dataTable.tableTitle : []
|
||||
let curTableConfig = dbTableColumnCustomizeConfig.find(item => item.tableName === tableName)
|
||||
if(localStorageTableTitle && curTableConfig &&
|
||||
localStorageTableTitle.version !== curTableConfig.version && curTableTitles) {
|
||||
this.$emit('update', curTableTitles)
|
||||
await indexedDBUtils.selectTable(tableName).put({
|
||||
id: userId,
|
||||
version: curTableConfig.version,
|
||||
config: _.cloneDeep(curTableTitles)
|
||||
})
|
||||
}
|
||||
|
||||
localStorageTableTitle = localStorageTableTitle && localStorageTableTitle.config ? localStorageTableTitle.config : curTableTitles
|
||||
// this.tools.customTableTitle = this.$refs.dataTable.tableTitle.map((item, index) => { // 修复切换中英文的问题
|
||||
// if (localStorageTableTitle[index]) {
|
||||
// item.show = localStorageTableTitle[index].show
|
||||
|
||||
Reference in New Issue
Block a user