feat: 登录时将下钻table配置改为在indexedDB中缓存

This commit is contained in:
chenjinsong
2022-09-27 11:08:38 +08:00
parent b7e0294d59
commit cea69bb71a
3 changed files with 15 additions and 6 deletions

View File

@@ -2,8 +2,9 @@ import { get, post } from '@/utils/http'
import router from '@/router'
import { sortByOrderNum, getWelcomeMenu } from '@/permission'
import { ElMessage } from 'element-plus' // dependent on utc plugin
import { storageKey } from '@/utils/constants'
import { storageKey, dbDrilldownTableConfig } from '@/utils/constants'
import { api } from '@/utils/api'
import { db } from '@/indexedDB'
const user = {
state () {
@@ -77,9 +78,15 @@ const user = {
}
}
})
get(api.config, { ckey: 'drill_down_table_config' }).then(res => {
get(api.config, { ckey: 'drill_down_table_config' }).then(async res => {
if (res.code === 200 && res.page.list && res.page.list.length > 0) {
localStorage.setItem(storageKey.drillDownTableConfig, res.page.list[0].cvalue)
await db[dbDrilldownTableConfig].put({
id: 'default',
config: res.page.list[0].cvalue
})
// const a = await db[dbDrilldownTableConfig].get({ id: 'default' })
// console.info(a)
// localStorage.setItem(storageKey.drillDownTableConfig, res.page.list[0].cvalue)
}
})
get(api.config, { ckey: 'link_info' }).then(res => {