@das-fed/utils 6.4.0-test.3.1 → 6.4.0-test.3.2
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/common-info/index.js +43 -36
- package/common-info/index.js.gz +0 -0
- package/common-info/type.d.ts +17 -3
- package/package.json +4 -4
package/common-info/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { getConfig as
|
|
2
|
-
import { getUrlParams as
|
|
3
|
-
import { getAccessToken as
|
|
4
|
-
import { getTokenFromQuery as
|
|
5
|
-
const S =
|
|
1
|
+
import { getConfig as p } from "@das-fed/utils/config";
|
|
2
|
+
import { getUrlParams as g } from "@das-fed/utils/common-tools";
|
|
3
|
+
import { getAccessToken as m } from "@das-fed/utils/token-tools";
|
|
4
|
+
import { getTokenFromQuery as f, getProjectInfoFromQuery as d } from "@das-fed/utils/common-info/getInfoFromUrl";
|
|
5
|
+
const S = m, J = () => {
|
|
6
6
|
var n;
|
|
7
7
|
let e = JSON.parse(sessionStorage.getItem("tenantInfo") || "{}");
|
|
8
8
|
return {
|
|
@@ -11,9 +11,9 @@ const S = I, O = () => {
|
|
|
11
11
|
flag: e.flag ?? null,
|
|
12
12
|
tenantId: ((n = e == null ? void 0 : e.tenant) == null ? void 0 : n.id) ?? ""
|
|
13
13
|
};
|
|
14
|
-
},
|
|
14
|
+
}, O = () => {
|
|
15
15
|
let e = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
|
|
16
|
-
const t =
|
|
16
|
+
const t = p();
|
|
17
17
|
return JSON.stringify(e) === "{}" && t.personalInfo && (e = t.personalInfo), {
|
|
18
18
|
id: e.id ?? "",
|
|
19
19
|
name: e.name ?? "",
|
|
@@ -22,7 +22,7 @@ const S = I, O = () => {
|
|
|
22
22
|
email: e.email ?? "",
|
|
23
23
|
headPicture: e.headPicture ?? ""
|
|
24
24
|
};
|
|
25
|
-
},
|
|
25
|
+
}, P = () => {
|
|
26
26
|
let e = JSON.parse(sessionStorage.getItem("tenantInfo") || "{}");
|
|
27
27
|
return {
|
|
28
28
|
userId: e.id ?? "",
|
|
@@ -35,14 +35,21 @@ const S = I, O = () => {
|
|
|
35
35
|
};
|
|
36
36
|
}, b = () => {
|
|
37
37
|
let e = JSON.parse(sessionStorage.getItem("projectInfo") || "{}");
|
|
38
|
-
const t =
|
|
38
|
+
const t = p();
|
|
39
39
|
return JSON.stringify(e) === "{}" && t.projectInfo && (e = t.projectInfo), {
|
|
40
40
|
id: (e == null ? void 0 : e.id) ?? 0,
|
|
41
|
-
|
|
41
|
+
code: (e == null ? void 0 : e.code) ?? 0,
|
|
42
42
|
name: (e == null ? void 0 : e.name) ?? "",
|
|
43
|
-
|
|
43
|
+
type: (e == null ? void 0 : e.type) ?? null,
|
|
44
|
+
parentId: (e == null ? void 0 : e.parentId) ?? "",
|
|
45
|
+
parentName: (e == null ? void 0 : e.parentName) ?? "",
|
|
46
|
+
parentType: (e == null ? void 0 : e.parentType) ?? null,
|
|
47
|
+
tenantId: (e == null ? void 0 : e.tenant) ?? "",
|
|
48
|
+
isParent: (e == null ? void 0 : e.isParent) ?? !1,
|
|
49
|
+
leaf: (e == null ? void 0 : e.leaf) ?? !1,
|
|
50
|
+
optional: (e == null ? void 0 : e.leaf) ?? !0
|
|
44
51
|
};
|
|
45
|
-
},
|
|
52
|
+
}, T = () => {
|
|
46
53
|
const e = JSON.parse(sessionStorage.getItem("home-config") || "{}");
|
|
47
54
|
return {
|
|
48
55
|
applicationCode: (e == null ? void 0 : e.applicationCode) ?? "",
|
|
@@ -53,13 +60,13 @@ const S = I, O = () => {
|
|
|
53
60
|
type: (e == null ? void 0 : e.type) ?? null
|
|
54
61
|
};
|
|
55
62
|
}, h = (e, t) => {
|
|
56
|
-
const n = "permission-btn", s =
|
|
57
|
-
if (!
|
|
58
|
-
const
|
|
63
|
+
const n = "permission-btn", s = I(), a = g(location.href, "app") || "", r = t || a || s.currentSubAppCode;
|
|
64
|
+
if (!r) return;
|
|
65
|
+
const o = g(location.href, "menu") || "", l = e || o || s.currentSubApp.currentMenuCode, c = JSON.parse(sessionStorage.getItem(n) || "{}");
|
|
59
66
|
if (!c || JSON.stringify(c) === "{}") return;
|
|
60
|
-
const u = c[
|
|
61
|
-
return u && u.length ? u : c[
|
|
62
|
-
},
|
|
67
|
+
const u = c[r][l];
|
|
68
|
+
return u && u.length ? u : c[r]["origin-auth"] ? c[r]["origin-auth"][l] ?? [] : [];
|
|
69
|
+
}, M = (e, t) => h(e, t) ?? [], I = () => {
|
|
63
70
|
const e = JSON.parse(sessionStorage.getItem("subApps") || "{}");
|
|
64
71
|
return {
|
|
65
72
|
appcategorys: e.appcategorys ?? [],
|
|
@@ -70,16 +77,16 @@ const S = I, O = () => {
|
|
|
70
77
|
};
|
|
71
78
|
}, j = (e, t = !1) => {
|
|
72
79
|
var s, a;
|
|
73
|
-
const n =
|
|
80
|
+
const n = I().subAppList;
|
|
74
81
|
if (e)
|
|
75
|
-
return t ? ((s = n == null ? void 0 : n.find((
|
|
82
|
+
return t ? ((s = n == null ? void 0 : n.find((r) => r.code === e)) == null ? void 0 : s.originalMenus) ?? [] : ((a = n == null ? void 0 : n.find((r) => r.code === e)) == null ? void 0 : a.menus) ?? [];
|
|
76
83
|
{
|
|
77
|
-
let
|
|
78
|
-
return t ? n == null || n.forEach((
|
|
79
|
-
o
|
|
80
|
-
}) : n == null || n.forEach((
|
|
81
|
-
o
|
|
82
|
-
}),
|
|
84
|
+
let r = {};
|
|
85
|
+
return t ? n == null || n.forEach((o) => {
|
|
86
|
+
r[o.code] = o.originalMenus ?? [];
|
|
87
|
+
}) : n == null || n.forEach((o) => {
|
|
88
|
+
r[o.code] = o.menus ?? [];
|
|
89
|
+
}), r;
|
|
83
90
|
}
|
|
84
91
|
}, v = () => {
|
|
85
92
|
const e = JSON.parse(sessionStorage.getItem("tabs") || "{}");
|
|
@@ -90,27 +97,27 @@ const S = I, O = () => {
|
|
|
90
97
|
preTab: e.preTab ?? {}
|
|
91
98
|
};
|
|
92
99
|
}, U = () => {
|
|
93
|
-
const e =
|
|
100
|
+
const e = p(), t = sessionStorage.getItem("minioAddress");
|
|
94
101
|
return t || (e.baseURL ? e.baseURL : location.origin);
|
|
95
102
|
}, k = () => ({
|
|
96
103
|
instanceInfo: JSON.parse(sessionStorage.getItem("instance") || "{}").instanceInfo ?? {}
|
|
97
104
|
}), E = () => localStorage.getItem("fav-icon") || "./logo.svg";
|
|
98
|
-
S() ||
|
|
99
|
-
var
|
|
100
|
-
(
|
|
105
|
+
S() || f();
|
|
106
|
+
var i;
|
|
107
|
+
(i = b()) != null && i.id || d();
|
|
101
108
|
export {
|
|
102
109
|
E as getFavIcon,
|
|
103
|
-
|
|
110
|
+
T as getHomeInfo,
|
|
104
111
|
k as getInstanceInfo,
|
|
105
112
|
j as getMenus,
|
|
106
113
|
U as getMinioAddress,
|
|
107
114
|
h as getPageAuth,
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
M as getPageAuthBtn,
|
|
116
|
+
O as getPersonalInfo,
|
|
110
117
|
b as getProjectInfo,
|
|
111
|
-
|
|
118
|
+
I as getSubApps,
|
|
112
119
|
v as getTabInfo,
|
|
113
|
-
|
|
120
|
+
P as getTenantInfo,
|
|
114
121
|
S as getToken,
|
|
115
|
-
|
|
122
|
+
J as getUserInfo
|
|
116
123
|
};
|
package/common-info/index.js.gz
CHANGED
|
Binary file
|
package/common-info/type.d.ts
CHANGED
|
@@ -56,13 +56,27 @@ export interface HomeInfo {
|
|
|
56
56
|
|
|
57
57
|
export interface ProjectInfo {
|
|
58
58
|
/** 项目id */
|
|
59
|
-
id: string
|
|
60
|
-
/**
|
|
61
|
-
|
|
59
|
+
id: string
|
|
60
|
+
/** 项目编码 */
|
|
61
|
+
code: string
|
|
62
62
|
/** 项目名称 */
|
|
63
63
|
name: string
|
|
64
|
+
/** 项目类型: 1: 集团、 2:公司、3: 区域、4: 分公司、 5: 子公司、6: 管理中心、 7: 项目、8: 部门、 9: 组 */
|
|
65
|
+
type: string
|
|
66
|
+
/** 父级id */
|
|
67
|
+
parentId?: string
|
|
68
|
+
/** 父级名称 */
|
|
69
|
+
parentName?: string
|
|
70
|
+
/** 父级项目类型:1: 集团、 2:公司、3: 区域、4: 分公司、 5: 子公司、6: 管理中心、 7: 项目、8: 部门、 9: 组 */
|
|
71
|
+
parentType?: number
|
|
64
72
|
/** 租户id */
|
|
65
73
|
tenantId?: string
|
|
74
|
+
/** 是否父级节点 */
|
|
75
|
+
isParent?: boolean
|
|
76
|
+
/** 是否叶子节点 */
|
|
77
|
+
leaf?: boolean
|
|
78
|
+
/** 是否可用 */
|
|
79
|
+
optional?: boolean
|
|
66
80
|
}
|
|
67
81
|
|
|
68
82
|
export interface SubAppsInfo {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@das-fed/utils",
|
|
3
|
-
"version": "6.4.0-test.3.
|
|
3
|
+
"version": "6.4.0-test.3.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"license": "ISC",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@antv/x6": "^2.18.1",
|
|
12
|
-
"@das-fed/utils": "6.4.0-test.3.
|
|
12
|
+
"@das-fed/utils": "6.4.0-test.3.2",
|
|
13
13
|
"@vue/shared": "^3.4.21",
|
|
14
14
|
"@vueuse/core": "^9.6.0",
|
|
15
15
|
"axios": "^1.6.7",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"vue": "^3.4.21"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@das-fed/cli": "6.4.0-test.3.
|
|
25
|
-
"@das-fed/web": "6.4.0-test.3.
|
|
24
|
+
"@das-fed/cli": "6.4.0-test.3.2",
|
|
25
|
+
"@das-fed/web": "6.4.0-test.3.2",
|
|
26
26
|
"@types/js-cookie": "^3.0.6",
|
|
27
27
|
"@types/lodash-es": "^4.17.12",
|
|
28
28
|
"@types/qs": "^6.9.15",
|