修改缓存查询逻辑.

This commit is contained in:
lijiahang
2023-09-14 12:07:33 +08:00
parent 2ff0d37f07
commit 08f9b9410b
9 changed files with 25 additions and 43 deletions

View File

@@ -74,7 +74,7 @@
if (!cacheStore.menus?.length) {
// 加载菜单
const { data: menuData } = await getMenuList({});
cacheStore.updateMenus(menuData);
cacheStore.set('menus', menuData);
}
// 获取角色菜单
const { data: roleMenuIdList } = await getRoleMenuId(record.id);

View File

@@ -34,7 +34,7 @@
// 卸载时清除 menu cache
onUnmounted(() => {
const cacheStore = useCacheStore();
cacheStore.resetMenus();
cacheStore.set('menus', []);
});
</script>

View File

@@ -92,7 +92,7 @@
// 获取全部角色
if (!cacheStore.roles?.length) {
const { data } = await getRoleList();
cacheStore.updateRoles(data);
cacheStore.set('roles', data);
}
// 加载用户角色
const { data: roleIdList } = await getUserRoleIdList(formModel.id);

View File

@@ -39,7 +39,7 @@
// 卸载时清除 role cache
onUnmounted(() => {
const cacheStore = useCacheStore();
cacheStore.resetRoles();
cacheStore.set('roles', []);
});
</script>