@mu-cabin/opms-permission 0.8.7 → 0.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +9 -12
- package/dist/index.d.mts +20 -6
- package/dist/index.d.ts +20 -6
- package/dist/index.mjs +9 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -414,19 +414,16 @@ var Permission = class {
|
|
414
414
|
}
|
415
415
|
}
|
416
416
|
async queryCompanies() {
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
storage.setItem(ORG_COMPANY_KEY, orgCompanyList);
|
425
|
-
}
|
426
|
-
this._orgCompany = orgCompanyList;
|
427
|
-
} catch (error) {
|
428
|
-
console.log(error);
|
417
|
+
let orgCompanyList = storage.getItem(ORG_COMPANY_KEY);
|
418
|
+
if (!orgCompanyList) {
|
419
|
+
const { obj } = await queryOrgCompanies(this.baseUrl, {
|
420
|
+
queryAllBranches: true
|
421
|
+
});
|
422
|
+
orgCompanyList = obj;
|
423
|
+
storage.setItem(ORG_COMPANY_KEY, orgCompanyList);
|
429
424
|
}
|
425
|
+
this._orgCompany = orgCompanyList;
|
426
|
+
return orgCompanyList;
|
430
427
|
}
|
431
428
|
isLogin() {
|
432
429
|
return !!storage.getItem(TOKEN_KEY);
|
package/dist/index.d.mts
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
interface OrgRecord {
|
2
|
+
orgId: number;
|
3
|
+
orgName: string;
|
4
|
+
orgShortName: string;
|
5
|
+
orgCode: string;
|
6
|
+
nodeLevel: number;
|
7
|
+
hasPermission: boolean;
|
8
|
+
children?: OrgRecord[];
|
9
|
+
}
|
10
|
+
|
1
11
|
interface Resource {
|
2
12
|
resourceId: number;
|
3
13
|
resourceCode: string;
|
@@ -35,6 +45,10 @@ interface UserOrganization {
|
|
35
45
|
orgShortName: string;
|
36
46
|
orgType: string;
|
37
47
|
}
|
48
|
+
interface Option {
|
49
|
+
label: string;
|
50
|
+
value: string;
|
51
|
+
}
|
38
52
|
|
39
53
|
interface PermissionOptions {
|
40
54
|
systemId: string;
|
@@ -86,18 +100,18 @@ declare class Permission {
|
|
86
100
|
* Query and process organization tree
|
87
101
|
*/
|
88
102
|
queryOrgs(): Promise<any>;
|
89
|
-
queryCompanies(): Promise<
|
103
|
+
queryCompanies(): Promise<OrgRecord[]>;
|
90
104
|
isLogin(): boolean;
|
91
105
|
getToken(): string | null;
|
92
106
|
setToken(token: string): void;
|
93
107
|
get userInfo(): UserInfo | null;
|
94
108
|
get hasRootAuth(): boolean;
|
95
109
|
get userOrganizations(): UserOrganization[];
|
96
|
-
get allCompanyOptions():
|
97
|
-
get companyOptions():
|
110
|
+
get allCompanyOptions(): Option[];
|
111
|
+
get companyOptions(): Option[];
|
98
112
|
get firstCompanyOrgCode(): string;
|
99
|
-
get unitOptions():
|
100
|
-
get allUnitOptions():
|
113
|
+
get unitOptions(): Option[];
|
114
|
+
get allUnitOptions(): Option[];
|
101
115
|
get firstUnitOrgCode(): string;
|
102
116
|
get topLevelUnitOrgCodes(): string[];
|
103
117
|
}
|
@@ -124,4 +138,4 @@ declare function jumpToSSOLogout({ baseUrl, redirectToUrl, clientId, }: {
|
|
124
138
|
clientId?: string;
|
125
139
|
}): void;
|
126
140
|
|
127
|
-
export { type MenuItem, Permission as OpmsPermission, type Resource, type UserInfo, type UserOrganization, jumpToSSOLogin, jumpToSSOLogout };
|
141
|
+
export { type MenuItem, Permission as OpmsPermission, type Option, type Resource, type UserInfo, type UserOrganization, jumpToSSOLogin, jumpToSSOLogout };
|
package/dist/index.d.ts
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
interface OrgRecord {
|
2
|
+
orgId: number;
|
3
|
+
orgName: string;
|
4
|
+
orgShortName: string;
|
5
|
+
orgCode: string;
|
6
|
+
nodeLevel: number;
|
7
|
+
hasPermission: boolean;
|
8
|
+
children?: OrgRecord[];
|
9
|
+
}
|
10
|
+
|
1
11
|
interface Resource {
|
2
12
|
resourceId: number;
|
3
13
|
resourceCode: string;
|
@@ -35,6 +45,10 @@ interface UserOrganization {
|
|
35
45
|
orgShortName: string;
|
36
46
|
orgType: string;
|
37
47
|
}
|
48
|
+
interface Option {
|
49
|
+
label: string;
|
50
|
+
value: string;
|
51
|
+
}
|
38
52
|
|
39
53
|
interface PermissionOptions {
|
40
54
|
systemId: string;
|
@@ -86,18 +100,18 @@ declare class Permission {
|
|
86
100
|
* Query and process organization tree
|
87
101
|
*/
|
88
102
|
queryOrgs(): Promise<any>;
|
89
|
-
queryCompanies(): Promise<
|
103
|
+
queryCompanies(): Promise<OrgRecord[]>;
|
90
104
|
isLogin(): boolean;
|
91
105
|
getToken(): string | null;
|
92
106
|
setToken(token: string): void;
|
93
107
|
get userInfo(): UserInfo | null;
|
94
108
|
get hasRootAuth(): boolean;
|
95
109
|
get userOrganizations(): UserOrganization[];
|
96
|
-
get allCompanyOptions():
|
97
|
-
get companyOptions():
|
110
|
+
get allCompanyOptions(): Option[];
|
111
|
+
get companyOptions(): Option[];
|
98
112
|
get firstCompanyOrgCode(): string;
|
99
|
-
get unitOptions():
|
100
|
-
get allUnitOptions():
|
113
|
+
get unitOptions(): Option[];
|
114
|
+
get allUnitOptions(): Option[];
|
101
115
|
get firstUnitOrgCode(): string;
|
102
116
|
get topLevelUnitOrgCodes(): string[];
|
103
117
|
}
|
@@ -124,4 +138,4 @@ declare function jumpToSSOLogout({ baseUrl, redirectToUrl, clientId, }: {
|
|
124
138
|
clientId?: string;
|
125
139
|
}): void;
|
126
140
|
|
127
|
-
export { type MenuItem, Permission as OpmsPermission, type Resource, type UserInfo, type UserOrganization, jumpToSSOLogin, jumpToSSOLogout };
|
141
|
+
export { type MenuItem, Permission as OpmsPermission, type Option, type Resource, type UserInfo, type UserOrganization, jumpToSSOLogin, jumpToSSOLogout };
|
package/dist/index.mjs
CHANGED
@@ -376,19 +376,16 @@ var Permission = class {
|
|
376
376
|
}
|
377
377
|
}
|
378
378
|
async queryCompanies() {
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
storage.setItem(ORG_COMPANY_KEY, orgCompanyList);
|
387
|
-
}
|
388
|
-
this._orgCompany = orgCompanyList;
|
389
|
-
} catch (error) {
|
390
|
-
console.log(error);
|
379
|
+
let orgCompanyList = storage.getItem(ORG_COMPANY_KEY);
|
380
|
+
if (!orgCompanyList) {
|
381
|
+
const { obj } = await queryOrgCompanies(this.baseUrl, {
|
382
|
+
queryAllBranches: true
|
383
|
+
});
|
384
|
+
orgCompanyList = obj;
|
385
|
+
storage.setItem(ORG_COMPANY_KEY, orgCompanyList);
|
391
386
|
}
|
387
|
+
this._orgCompany = orgCompanyList;
|
388
|
+
return orgCompanyList;
|
392
389
|
}
|
393
390
|
isLogin() {
|
394
391
|
return !!storage.getItem(TOKEN_KEY);
|