Ben Lin
2024-08-22 c9f779c19d920efcca14fd17bbcca8254f92790d
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;