From e5e7d8032f938f4142c05fa71fb09ff73058b740 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 24 七月 2024 16:22:19 +0800 Subject: [PATCH] 权限守护更新 --- src/store/modules/user.ts | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b04afdd..ae3b263 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-18 15:09:47 * @LastEditors: Ben Lin - * @LastEditTime: 2024-07-17 20:52:52 + * @LastEditTime: 2024-07-24 16:17:11 */ import type { UserInfo } from '#/store'; import type { ErrorMessageMode } from '#/axios'; @@ -28,6 +28,7 @@ import { getMenuAuthList } from '/@/api/sys/menu'; import { iV_USER_MENU } from '/@/api/tigerapi/model/vModel'; import { getSysParam } from '/@/api/tigerapi/system'; +import { ApiAction } from '/@/api/model/baseModel'; interface UserState { userInfo: Nullable<UserInfo>; @@ -163,9 +164,12 @@ /* 浠庣郴缁熷弬鏁拌幏鍙栧惎鐢ㄥ摢绉嶆潈闄� */ var action = await getSysParam({ group: 'ByAuthActive' }); if (action.IsSuccessed) { - userInfo.byOrg = action.Data.filter((x) => x.PARAM_CODE == 'ByOrgActive')[0].PARAM_VALUE == 'Y'; - userInfo.byProd = action.Data.filter((x) => x.PARAM_CODE == 'ByProdActive')[0].PARAM_VALUE == 'Y'; - userInfo.byWh = action.Data.filter((x) => x.PARAM_CODE == 'ByWhActive')[0].PARAM_VALUE == 'Y'; + userInfo.byOrg = + action.Data.filter((x) => x.PARAM_CODE == 'ByOrgActive')[0].PARAM_VALUE == 'Y'; + userInfo.byProd = + action.Data.filter((x) => x.PARAM_CODE == 'ByProdActive')[0].PARAM_VALUE == 'Y'; + userInfo.byWh = + action.Data.filter((x) => x.PARAM_CODE == 'ByWhActive')[0].PARAM_VALUE == 'Y'; } const { roles = [] } = userInfo; if (isArray(roles)) { @@ -184,7 +188,7 @@ async logout(goLogin = false) { if (this.getToken) { try { - await doLogout({ Data: this.getToken }); + await doLogout({ Data: this.getToken } as unknown as ApiAction<string>); } catch { console.log('娉ㄩ攢Token澶辫触'); } @@ -218,7 +222,7 @@ prodCode: data.FTY_CODE, //globSetting.useOrg == 'N' ? data.FTY_CODE : '', avatar: '', roles: vUserMenu.Data.Items as unknown as iV_USER_MENU[], - }; + } as unknown as UserInfo; this.setUserInfo(userInfo); //console.log(data[0].LOGINNAME); return userInfo; -- Gitblit v1.9.3