| | |
| | | * @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'; |
| | |
| | | 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>; |
| | |
| | | /* 从系统参数获取启用哪种权限 */ |
| | | 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)) { |
| | |
| | | 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失败'); |
| | | } |
| | |
| | | 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; |