@dazhicheng/ui 1.6.22 → 1.6.24
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { queryDataPermissionDetailDataTypeContext as
|
|
2
|
-
import { fetchUserListOnce as
|
|
3
|
-
import { ref as
|
|
4
|
-
import { useOwnerRoutePath as
|
|
5
|
-
const
|
|
1
|
+
import { queryDataPermissionDetailDataTypeContext as j } from "../api/dataTypeContext.js";
|
|
2
|
+
import { fetchUserListOnce as k, clearUserListCache as B } from "./userListCache.js";
|
|
3
|
+
import { ref as F, watchEffect as W, unref as U, computed as G } from "vue";
|
|
4
|
+
import { useOwnerRoutePath as H } from "./useOwnerRoutePath.js";
|
|
5
|
+
const u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), J = "all", Q = { label: "全部", value: J }, b = /* @__PURE__ */ new WeakMap(), X = {
|
|
6
6
|
platformId: ["platformName", "platformId"],
|
|
7
7
|
shopId: ["shopName", "shopId"],
|
|
8
8
|
purchasePlaceId: ["purchasePlaceName", "purchasePlaceCode"],
|
|
@@ -10,114 +10,119 @@ const o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), y = /* @__PU
|
|
|
10
10
|
lockUserId: ["userName", "userId"],
|
|
11
11
|
userId: ["fullName", "id"]
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
const [
|
|
17
|
-
const
|
|
13
|
+
function Y(n, a = []) {
|
|
14
|
+
const i = b.get(a) || /* @__PURE__ */ new Map(), o = i.get(n);
|
|
15
|
+
if (o) return o.slice();
|
|
16
|
+
const [y, S] = X[n], m = a.map((h) => {
|
|
17
|
+
const c = n === "purchasePlaceId" ? h.purchaseInfo || {} : h;
|
|
18
18
|
return {
|
|
19
|
-
...
|
|
20
|
-
label:
|
|
21
|
-
value:
|
|
19
|
+
...h,
|
|
20
|
+
label: c == null ? void 0 : c[y],
|
|
21
|
+
value: c == null ? void 0 : c[S]
|
|
22
22
|
};
|
|
23
23
|
});
|
|
24
|
-
return
|
|
24
|
+
return i.set(n, m), b.set(a, i), m.slice();
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const a =
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
(e, r) => (e[r] =
|
|
26
|
+
function re(n) {
|
|
27
|
+
const a = H(), i = F({});
|
|
28
|
+
function o(t = {}) {
|
|
29
|
+
i.value = n.codes.reduce(
|
|
30
|
+
(e, r) => (e[r] = Y(r, t[r]), e),
|
|
31
31
|
{}
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function y(t) {
|
|
35
35
|
var e;
|
|
36
36
|
return typeof n.showAll == "boolean" ? n.showAll : ((e = n.showAll) == null ? void 0 : e[t]) ?? !1;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
|
|
38
|
+
function S() {
|
|
39
|
+
p.clear(), f.clear(), u.clear(), d.clear(), I.clear(), B();
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
41
|
+
function m(t) {
|
|
42
|
+
u.delete(t), d.delete(t), f.delete(t);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
const e =
|
|
46
|
-
n.codes.forEach((
|
|
44
|
+
function h(t) {
|
|
45
|
+
const e = d.get(t) || /* @__PURE__ */ new Set(), r = e.size;
|
|
46
|
+
n.codes.forEach((l) => e.add(l)), d.set(t, e), e.size !== r && A(t);
|
|
47
47
|
}
|
|
48
|
-
async function
|
|
49
|
-
const e = a, r =
|
|
48
|
+
async function c(t = !1) {
|
|
49
|
+
const e = a, r = U(n.dataSource);
|
|
50
50
|
if (r) {
|
|
51
|
-
|
|
51
|
+
o({ ...u.get(e) || {}, ...r });
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
const L = t ? void 0 : y.get(e);
|
|
61
|
-
if (L) {
|
|
62
|
-
const s = await L, l = { ...o.get(e) || {}, ...s };
|
|
63
|
-
if (o.set(e, l), m = S.filter((g) => !Object.prototype.hasOwnProperty.call(l, g)), !m.length) {
|
|
64
|
-
c(l);
|
|
54
|
+
const l = /* @__PURE__ */ new Set(), V = 32;
|
|
55
|
+
for (let L = 0; L < V; L++) {
|
|
56
|
+
const v = u.get(e) || {}, M = [...d.get(e) || n.codes], g = t ? M : M.filter((s) => !Object.prototype.hasOwnProperty.call(v, s));
|
|
57
|
+
if (t = !1, !g.length) {
|
|
58
|
+
o(v);
|
|
65
59
|
return;
|
|
66
60
|
}
|
|
61
|
+
const N = p.get(e);
|
|
62
|
+
if (N) {
|
|
63
|
+
await N;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (g.every((s) => l.has(s))) {
|
|
67
|
+
o(v);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
g.forEach((s) => l.add(s));
|
|
71
|
+
const x = g.filter((s) => s !== "userId"), _ = g.includes("userId"), D = Promise.allSettled([
|
|
72
|
+
x.length ? j({ dataTypeName: x }).then(
|
|
73
|
+
(s) => s
|
|
74
|
+
) : Promise.resolve([]),
|
|
75
|
+
_ ? k() : Promise.resolve(void 0)
|
|
76
|
+
]).then(([s, q]) => {
|
|
77
|
+
const w = s.status === "fulfilled" ? s.value : [], C = q.status === "fulfilled" ? q.value : void 0;
|
|
78
|
+
return {
|
|
79
|
+
...C != null && C.length ? { userId: C } : {},
|
|
80
|
+
...w.reduce((O, P) => {
|
|
81
|
+
const T = P == null ? void 0 : P.dataTypeCode;
|
|
82
|
+
return T && (O[T] = P.originalItems || []), O;
|
|
83
|
+
}, {})
|
|
84
|
+
};
|
|
85
|
+
}), R = (I.get(e) || 0) + 1;
|
|
86
|
+
I.set(e, R), p.set(e, D);
|
|
87
|
+
try {
|
|
88
|
+
const s = await D;
|
|
89
|
+
if (I.get(e) !== R) continue;
|
|
90
|
+
const w = { ...u.get(e) || {}, ...s };
|
|
91
|
+
u.set(e, w), o(w);
|
|
92
|
+
} finally {
|
|
93
|
+
p.get(e) === D && p.delete(e);
|
|
94
|
+
}
|
|
67
95
|
}
|
|
68
|
-
|
|
69
|
-
M.length ? E({ dataTypeName: M }).then(
|
|
70
|
-
(s) => s
|
|
71
|
-
) : Promise.resolve([]),
|
|
72
|
-
z ? V() : Promise.resolve(void 0)
|
|
73
|
-
]).then(([s, P]) => {
|
|
74
|
-
const l = s.status === "fulfilled" ? s.value : [], g = P.status === "fulfilled" ? P.value : void 0;
|
|
75
|
-
return {
|
|
76
|
-
...g != null && g.length ? { userId: g } : {},
|
|
77
|
-
...l.reduce((q, I) => {
|
|
78
|
-
const x = I == null ? void 0 : I.dataTypeCode;
|
|
79
|
-
return x && (q[x] = I.originalItems || []), q;
|
|
80
|
-
}, {})
|
|
81
|
-
};
|
|
82
|
-
}), O = (w.get(e) || 0) + 1;
|
|
83
|
-
w.set(e, O), y.set(e, N);
|
|
84
|
-
try {
|
|
85
|
-
const s = await N;
|
|
86
|
-
if (w.get(e) !== O) return;
|
|
87
|
-
const l = { ...o.get(e) || {}, ...s };
|
|
88
|
-
o.set(e, l), c(l);
|
|
89
|
-
} finally {
|
|
90
|
-
w.get(e) === O && y.delete(e);
|
|
91
|
-
}
|
|
96
|
+
o(u.get(e) || {});
|
|
92
97
|
}
|
|
93
|
-
async function
|
|
94
|
-
const t = a, e = new Set(
|
|
95
|
-
|
|
98
|
+
async function E() {
|
|
99
|
+
const t = a, e = new Set(d.get(t) || n.codes);
|
|
100
|
+
S(), m(t), d.set(t, e), await c(!0);
|
|
96
101
|
}
|
|
97
102
|
function A(t) {
|
|
98
103
|
const e = f.get(t);
|
|
99
104
|
if (e) return e;
|
|
100
|
-
const r = Promise.resolve().then(() =>
|
|
105
|
+
const r = Promise.resolve().then(() => c());
|
|
101
106
|
return f.set(t, r), r.finally(() => {
|
|
102
107
|
f.get(t) === r && f.delete(t);
|
|
103
108
|
}), r;
|
|
104
109
|
}
|
|
105
|
-
|
|
106
|
-
const t =
|
|
107
|
-
t &&
|
|
110
|
+
W(() => {
|
|
111
|
+
const t = U(n.dataSource);
|
|
112
|
+
t && o({ ...u.get(a) || {}, ...t });
|
|
108
113
|
});
|
|
109
|
-
function
|
|
110
|
-
|
|
114
|
+
function z(t) {
|
|
115
|
+
o(u.get(t));
|
|
111
116
|
}
|
|
112
|
-
return
|
|
117
|
+
return h(a), A(a).then(() => z(a)), {
|
|
113
118
|
/**
|
|
114
119
|
* 数据源
|
|
115
120
|
*/
|
|
116
|
-
dataSource:
|
|
121
|
+
dataSource: G(() => {
|
|
117
122
|
const t = n.codes.reduce(
|
|
118
123
|
(e, r) => {
|
|
119
|
-
const
|
|
120
|
-
return e[r] =
|
|
124
|
+
const l = i.value[r] || [];
|
|
125
|
+
return e[r] = y(r) ? [Q, ...l] : l, e;
|
|
121
126
|
},
|
|
122
127
|
{}
|
|
123
128
|
);
|
|
@@ -133,9 +138,9 @@ function K(n) {
|
|
|
133
138
|
/**
|
|
134
139
|
* @description 清空所有缓存,重新请求
|
|
135
140
|
*/
|
|
136
|
-
reload:
|
|
141
|
+
reload: E
|
|
137
142
|
};
|
|
138
143
|
}
|
|
139
144
|
export {
|
|
140
|
-
|
|
145
|
+
re as useDataPermissionOptions
|
|
141
146
|
};
|