From c48041a2b51284de9d88cea25d1035aa6a0cb343 Mon Sep 17 00:00:00 2001 From: JEECG <445654970@qq.com> Date: Mon, 25 Mar 2024 16:00:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=8C=E9=80=89=E6=8B=A9=E5=8D=A1=E9=A1=BF?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=9C=A83.6.3=E7=89=88=E6=9C=AC=E4=BE=9D?= =?UTF-8?q?=E7=84=B6=E5=AD=98=E5=9C=A8=20#1120?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/guard/permissionGuard.ts | 6 +++++- src/store/modules/user.ts | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/router/guard/permissionGuard.ts b/src/router/guard/permissionGuard.ts index 50c6896..6774977 100644 --- a/src/router/guard/permissionGuard.ts +++ b/src/router/guard/permissionGuard.ts @@ -174,7 +174,11 @@ export function createPermissionGuard(router: Router) { // } // } //update-end---author:scott ---date::2024-02-21 for:【QQYUN-8326】刷新首页,不需要重新获获取用户信息--- - + // update-begin--author:liaozhiyang---date:20240321---for:【QQYUN-8572】表格行选择卡顿问题(customRender中字典引起的) + if (userStore.getLastUpdateTime === 0) { + userStore.setAllDictItemsByLocal(); + } + // update-end--author:liaozhiyang---date:20240321---for:【QQYUN-8572】表格行选择卡顿问题(customRender中字典引起的) if (permissionStore.getIsDynamicAddedRoute) { next(); return; diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 18fb7f6..61546b1 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -19,11 +19,14 @@ import { useGlobSetting } from '/@/hooks/setting'; import { JDragConfigEnum } from '/@/enums/jeecgEnum'; import { useSso } from '/@/hooks/web/useSso'; import { isOAuth2AppEnv } from "/@/views/sys/login/useLogin"; +interface dictType { + [key: string]: any; +} interface UserState { userInfo: Nullable; token?: string; roleList: RoleEnum[]; - dictItems?: []; + dictItems?: dictType | null; sessionTimeout?: boolean; lastUpdateTime: number; tenantid?: string | number; @@ -41,7 +44,7 @@ export const useUserStore = defineStore({ // 角色列表 roleList: [], // 字典 - dictItems: [], + dictItems: null, // session过期时间 sessionTimeout: false, // Last fetch time @@ -109,6 +112,16 @@ export const useUserStore = defineStore({ this.dictItems = dictItems; setAuthCache(DB_DICT_DATA_KEY, dictItems); }, + setAllDictItemsByLocal() { + // update-begin--author:liaozhiyang---date:20240321---for:【QQYUN-8572】表格行选择卡顿问题(customRender中字典引起的) + if (!this.dictItems) { + const allDictItems = getAuthCache(DB_DICT_DATA_KEY); + if (allDictItems) { + this.dictItems = allDictItems; + } + } + // update-end--author:liaozhiyang---date:20240321---for:【QQYUN-8572】表格行选择卡顿问题(customRender中字典引起的) + }, setTenant(id) { this.tenantid = id; setAuthCache(TENANT_ID, id); @@ -121,7 +134,7 @@ export const useUserStore = defineStore({ }, resetState() { this.userInfo = null; - this.dictItems = []; + this.dictItems = null; this.token = ''; this.roleList = []; this.sessionTimeout = false;