| | |
| | | import Cookies from "js-cookie"; |
| | | import { useUserStoreHook } from "@/store/modules/user"; |
| | | import { storageLocal, isString, isIncludeAllChildren } from "@pureadmin/utils"; |
| | | import type { nowRoleType } from "@/store/types"; |
| | | |
| | | export interface DataInfo<T> { |
| | | /** token */ |
| | |
| | | exRoles?: Array<string>; |
| | | /** 当前登录用户的按钮级别权限 */ |
| | | permissions?: Array<string>; |
| | | } |
| | | /** |
| | | * AdminResult_CusExtendDto,全局返回结果 |
| | | */ |
| | | export interface ResponseEnterprise { |
| | | /** |
| | | * 状态码 |
| | | */ |
| | | code?: number; |
| | | /** |
| | | * 附加数据 |
| | | */ |
| | | extras?: null; |
| | | /** |
| | | * 错误信息 |
| | | */ |
| | | message?: null | string; |
| | | result?: CusExtendDto; |
| | | /** |
| | | * 时间 |
| | | */ |
| | | time?: Date; |
| | | /** |
| | | * 类型success、warning、error |
| | | */ |
| | | type?: null | string; |
| | | } |
| | | |
| | | /** |
| | | * CusExtendDto,用户角色资料 |
| | | */ |
| | | export interface CusExtendDto { |
| | | /** |
| | | * 企业银行账号 |
| | | */ |
| | | bankAccount?: null | string; |
| | | /** |
| | | * 企业开户行 |
| | | */ |
| | | bankName?: null | string; |
| | | /** |
| | | * 营业执照文件路径 |
| | | */ |
| | | businessLicense?: null | string; |
| | | /** |
| | | * 企业邮箱 |
| | | */ |
| | | enterpriseEmail?: null | string; |
| | | /** |
| | | * 企业名称 |
| | | */ |
| | | enterpriseName?: null | string; |
| | | /** |
| | | * 企业联系电话 |
| | | */ |
| | | enterprisePhone?: null | string; |
| | | /** |
| | | * 企业类型 从企业类型中选择 来源企业类型 |
| | | */ |
| | | enterpriseType?: null | string; |
| | | /** |
| | | * 企业成立时间 |
| | | */ |
| | | establishmentTime?: Date; |
| | | /** |
| | | * 主键 |
| | | */ |
| | | id?: number | null; |
| | | /** |
| | | * 法定代表人身份证文件路径 |
| | | */ |
| | | legalRepresentativeIdCard?: null | string; |
| | | /** |
| | | * 法定代表人身份证号码 |
| | | */ |
| | | legalRepresentativeIdNumber?: null | string; |
| | | /** |
| | | * 法定代表人姓名 |
| | | */ |
| | | legalRepresentativeName?: null | string; |
| | | /** |
| | | * 法定代表人联系电话 |
| | | */ |
| | | legalRepresentativePhone?: null | string; |
| | | /** |
| | | * 企业主营业务 |
| | | */ |
| | | mainBusiness?: null | string; |
| | | /** |
| | | * 业务经办人身份证文件路径或标识(上传后存储信息) |
| | | */ |
| | | operatorIdCard?: null | string; |
| | | /** |
| | | * 业务经办人身份证号码 |
| | | */ |
| | | operatorIdNumber?: null | string; |
| | | /** |
| | | * 业务经办人姓名 |
| | | */ |
| | | operatorName?: null | string; |
| | | /** |
| | | * 业务经办人联系电话 |
| | | */ |
| | | operatorPhone?: null | string; |
| | | /** |
| | | * 注册资金(单位:万元 ) |
| | | */ |
| | | registeredCapital?: null | string; |
| | | /** |
| | | * 企业住所(下拉选择,需结合实际可选值,先字符串接收 ) |
| | | */ |
| | | residence?: null | string; |
| | | /** |
| | | * 交易主体 代码 同角色代码 |
| | | */ |
| | | transactionCode: string; |
| | | /** |
| | | * 交易主体名称 |
| | | */ |
| | | transactionName?: null | string; |
| | | /** |
| | | * 统一社会信用代码 |
| | | */ |
| | | unifiedSocialCreditCode?: null | string; |
| | | } |
| | | |
| | | export const userKey = "user-info"; |
| | |
| | | } |
| | | } |
| | | |
| | | export function setEnterpriseInfo(data: DataInfo<Date>) { |
| | | export function setEnterpriseInfo(data: CusExtendDto) { |
| | | useUserStoreHook().SET_ENTERPRISEINFO(data); |
| | | useUserStoreHook().SET_USERNAME(data.enterpriseName); |
| | | storageLocal().setItem("enterpriseInfo", data); |
| | |
| | | storageLocal().setItem(userKey, obj); |
| | | } |
| | | |
| | | export function setRoleListInfo(data: DataInfo<Date>) { |
| | | export function setRoleListInfo(data: DataInfo<string>) { |
| | | useUserStoreHook().SET_ROLES_LIST(data); |
| | | storageLocal().setItem("rolesList", data); |
| | | } |
| | | |
| | | export function setNowRole(data: DataInfo<Date>) { |
| | | export function setNowRole(data: nowRoleType) { |
| | | const list = storageLocal().getItem<DataInfo<number>>(userKey)?.exRoles ?? []; |
| | | if (list.length > 0) { |
| | | const obj = list.find(item => { |