@dazhicheng/ui 1.5.242 → 1.5.243
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,9 +1,9 @@
|
|
|
1
1
|
import { queryDataPermissionDetailDataTypeContext as V, pageUser as _ } from "../api/dataTypeContext.js";
|
|
2
|
-
import { ref as j, watchEffect as
|
|
3
|
-
import { useRoute as
|
|
4
|
-
const
|
|
5
|
-
let
|
|
6
|
-
const
|
|
2
|
+
import { ref as j, watchEffect as F, unref as T, watch as k, computed as B } from "vue";
|
|
3
|
+
import { useRoute as G } from "vue-router";
|
|
4
|
+
const c = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
|
|
5
|
+
let v, m;
|
|
6
|
+
const H = "all", J = { label: "全部", value: H }, Q = {
|
|
7
7
|
platformId: ["platformName", "platformId"],
|
|
8
8
|
shopId: ["shopName", "shopId"],
|
|
9
9
|
purchasePlaceId: ["purchasePlaceName", "purchasePlaceCode"],
|
|
@@ -11,30 +11,30 @@ const G = "all", H = { label: "全部", value: G }, J = {
|
|
|
11
11
|
lockUserId: ["userName", "userId"],
|
|
12
12
|
userId: ["fullName", "id"]
|
|
13
13
|
};
|
|
14
|
-
async function
|
|
15
|
-
if (
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
return
|
|
14
|
+
async function W() {
|
|
15
|
+
if (v) return v;
|
|
16
|
+
if (m) return m;
|
|
17
|
+
m = _({ pageNo: 1, pageSize: 9999 }).then((s) => {
|
|
18
|
+
const o = s.records || [];
|
|
19
|
+
return v = o, o;
|
|
20
20
|
});
|
|
21
21
|
try {
|
|
22
|
-
return await
|
|
22
|
+
return await m;
|
|
23
23
|
} finally {
|
|
24
|
-
|
|
24
|
+
m = void 0;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
function
|
|
30
|
-
|
|
27
|
+
function K(s) {
|
|
28
|
+
const o = G(), N = j({});
|
|
29
|
+
function g(t = {}) {
|
|
30
|
+
N.value = s.codes.reduce(
|
|
31
31
|
(e, r) => {
|
|
32
|
-
const [
|
|
33
|
-
const
|
|
32
|
+
const [a, C] = Q[r], d = (t[r] || []).map((p) => {
|
|
33
|
+
const u = r === "purchasePlaceId" ? p.purchaseInfo || {} : p;
|
|
34
34
|
return {
|
|
35
|
-
...
|
|
36
|
-
label:
|
|
37
|
-
value:
|
|
35
|
+
...p,
|
|
36
|
+
label: u == null ? void 0 : u[a],
|
|
37
|
+
value: u == null ? void 0 : u[C]
|
|
38
38
|
};
|
|
39
39
|
});
|
|
40
40
|
return e[r] = d, e;
|
|
@@ -42,98 +42,101 @@ function $(a) {
|
|
|
42
42
|
{}
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function L(t) {
|
|
46
46
|
var e;
|
|
47
|
-
return typeof
|
|
47
|
+
return typeof s.showAll == "boolean" ? s.showAll : ((e = s.showAll) == null ? void 0 : e[t]) ?? !1;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
|
|
49
|
+
function U() {
|
|
50
|
+
P.clear(), h.clear(), c.clear(), f.clear(), w.clear(), v = void 0, m = void 0;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
52
|
+
function b(t) {
|
|
53
|
+
c.delete(t), f.delete(t), h.delete(t);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
const e =
|
|
57
|
-
|
|
55
|
+
function O(t) {
|
|
56
|
+
const e = f.get(t) || /* @__PURE__ */ new Set(), r = e.size;
|
|
57
|
+
s.codes.forEach((a) => e.add(a)), f.set(t, e), e.size !== r && (h.delete(t), y(t));
|
|
58
58
|
}
|
|
59
|
-
async function
|
|
60
|
-
const e =
|
|
59
|
+
async function A(t = !1) {
|
|
60
|
+
const e = o.path, r = T(s.dataSource);
|
|
61
61
|
if (r) {
|
|
62
|
-
const i = { ...
|
|
63
|
-
|
|
62
|
+
const i = { ...c.get(e) || {}, ...r };
|
|
63
|
+
c.set(e, i), g(i);
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
let d = t ?
|
|
66
|
+
const a = c.get(e) || {}, C = [...f.get(e) || s.codes];
|
|
67
|
+
let d = t ? C : C.filter((n) => !Object.prototype.hasOwnProperty.call(a, n));
|
|
68
68
|
if (!d.length) {
|
|
69
|
-
|
|
69
|
+
g(a);
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
const n = await
|
|
75
|
-
if (
|
|
76
|
-
|
|
72
|
+
const p = t ? void 0 : P.get(e);
|
|
73
|
+
if (p) {
|
|
74
|
+
const n = await p, l = { ...c.get(e) || {}, ...n };
|
|
75
|
+
if (c.set(e, l), d = C.filter((D) => !Object.prototype.hasOwnProperty.call(l, D)), !d.length) {
|
|
76
|
+
g(l);
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
const
|
|
81
|
-
|
|
80
|
+
const u = d.filter((n) => n !== "userId"), E = d.includes("userId"), x = Promise.allSettled([
|
|
81
|
+
u.length ? V({ dataTypeName: u }).then(
|
|
82
82
|
(n) => n
|
|
83
83
|
) : Promise.resolve([]),
|
|
84
|
-
E ?
|
|
84
|
+
E ? W() : Promise.resolve(void 0)
|
|
85
85
|
]).then(([n, i]) => {
|
|
86
|
-
const
|
|
86
|
+
const l = n.status === "fulfilled" ? n.value : [], D = i.status === "fulfilled" ? i.value : void 0;
|
|
87
87
|
return {
|
|
88
|
-
...
|
|
89
|
-
...
|
|
90
|
-
const
|
|
91
|
-
return
|
|
88
|
+
...D ? { userId: D } : {},
|
|
89
|
+
...l.reduce((q, I) => {
|
|
90
|
+
const M = I == null ? void 0 : I.dataTypeCode;
|
|
91
|
+
return M && (q[M] = I.originalItems || []), q;
|
|
92
92
|
}, {})
|
|
93
93
|
};
|
|
94
|
-
}),
|
|
95
|
-
w.set(e,
|
|
94
|
+
}), S = (w.get(e) || 0) + 1;
|
|
95
|
+
w.set(e, S), P.set(e, x);
|
|
96
96
|
try {
|
|
97
|
-
const n = await
|
|
98
|
-
if (w.get(e) !==
|
|
99
|
-
const
|
|
100
|
-
|
|
97
|
+
const n = await x;
|
|
98
|
+
if (w.get(e) !== S) return;
|
|
99
|
+
const l = { ...c.get(e) || {}, ...n };
|
|
100
|
+
c.set(e, l), g(l);
|
|
101
101
|
} finally {
|
|
102
|
-
w.get(e) ===
|
|
102
|
+
w.get(e) === S && P.delete(e);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
async function
|
|
106
|
-
const t =
|
|
107
|
-
|
|
105
|
+
async function z() {
|
|
106
|
+
const t = o.path, e = new Set(f.get(t) || s.codes);
|
|
107
|
+
U(), f.set(t, e), b(t), await A(!0);
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function y(t) {
|
|
110
110
|
const e = h.get(t);
|
|
111
111
|
if (e) return e;
|
|
112
|
-
const r = Promise.resolve().then(() =>
|
|
112
|
+
const r = Promise.resolve().then(() => A());
|
|
113
113
|
return h.set(t, r), r.finally(() => {
|
|
114
114
|
h.get(t) === r && h.delete(t);
|
|
115
115
|
}), r;
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
const t =
|
|
117
|
+
F(() => {
|
|
118
|
+
const t = T(s.dataSource);
|
|
119
119
|
if (!t) return;
|
|
120
|
-
const e =
|
|
121
|
-
|
|
122
|
-
})
|
|
123
|
-
|
|
120
|
+
const e = o.path, a = { ...c.get(e) || {}, ...t };
|
|
121
|
+
c.set(e, a), g(a);
|
|
122
|
+
});
|
|
123
|
+
function R(t) {
|
|
124
|
+
g(c.get(t));
|
|
125
|
+
}
|
|
126
|
+
return O(o.path), y(o.path).then(() => R(o.path)), k(
|
|
127
|
+
() => o.path,
|
|
124
128
|
(t) => {
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
{ immediate: !0 }
|
|
129
|
+
O(t), y(t).then(() => R(t));
|
|
130
|
+
}
|
|
128
131
|
), {
|
|
129
132
|
/**
|
|
130
133
|
* 数据源
|
|
131
134
|
*/
|
|
132
|
-
dataSource:
|
|
133
|
-
const t =
|
|
135
|
+
dataSource: B(() => {
|
|
136
|
+
const t = s.codes.reduce(
|
|
134
137
|
(e, r) => {
|
|
135
|
-
const
|
|
136
|
-
return e[r] =
|
|
138
|
+
const a = N.value[r] || [];
|
|
139
|
+
return e[r] = L(r) ? [J, ...a] : a, e;
|
|
137
140
|
},
|
|
138
141
|
{}
|
|
139
142
|
);
|
|
@@ -149,9 +152,9 @@ function $(a) {
|
|
|
149
152
|
/**
|
|
150
153
|
* @description 清空所有缓存,重新请求
|
|
151
154
|
*/
|
|
152
|
-
reload:
|
|
155
|
+
reload: z
|
|
153
156
|
};
|
|
154
157
|
}
|
|
155
158
|
export {
|
|
156
|
-
|
|
159
|
+
K as useDataPermissionOptions
|
|
157
160
|
};
|
|
@@ -36,7 +36,7 @@ const E = "all", v = { label: "全部", value: E }, z = [
|
|
|
36
36
|
function U(r) {
|
|
37
37
|
return typeof r == "string" && r.toLowerCase() === E.toLowerCase();
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function O(r) {
|
|
40
40
|
return Array.isArray(r) ? r : r == null || r === "" ? [] : [r];
|
|
41
41
|
}
|
|
42
42
|
function T(r = []) {
|
|
@@ -48,40 +48,40 @@ function oo(r, u, c, A) {
|
|
|
48
48
|
function j(r, u, c, A) {
|
|
49
49
|
var C;
|
|
50
50
|
u == null || u(r);
|
|
51
|
-
const
|
|
52
|
-
c == null || c(f,
|
|
51
|
+
const I = A(), f = (C = I.values) == null ? void 0 : C[I.fieldName];
|
|
52
|
+
c == null || c(f, I);
|
|
53
53
|
}
|
|
54
54
|
function no(r = {}, u = z) {
|
|
55
55
|
const c = r.scene || "list", A = u.reduce(
|
|
56
56
|
(o, e) => {
|
|
57
57
|
if (e === "userId") return o;
|
|
58
|
-
const n =
|
|
58
|
+
const n = g(e), t = S(e) === "TtPanelSelect";
|
|
59
59
|
return o[e] = t ? !1 : n.showAll ?? !1, o;
|
|
60
60
|
},
|
|
61
61
|
{}
|
|
62
|
-
), { dataSource:
|
|
62
|
+
), { dataSource: I } = Y({
|
|
63
63
|
codes: u,
|
|
64
64
|
dataSource: r.dataSource,
|
|
65
65
|
showAll: A
|
|
66
66
|
});
|
|
67
67
|
function f(o) {
|
|
68
|
-
return
|
|
68
|
+
return g(o).fieldName || H[o];
|
|
69
69
|
}
|
|
70
70
|
function C(o) {
|
|
71
|
-
return
|
|
71
|
+
return g(o).rules;
|
|
72
72
|
}
|
|
73
73
|
function M(o) {
|
|
74
|
-
return
|
|
74
|
+
return g(o).label || y[o];
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function g(o) {
|
|
77
77
|
var e;
|
|
78
78
|
return ((e = r.fieldConfigs) == null ? void 0 : e[o]) || {};
|
|
79
79
|
}
|
|
80
80
|
function b(o) {
|
|
81
|
-
return
|
|
81
|
+
return g(o).showAllField ?? E;
|
|
82
82
|
}
|
|
83
83
|
function _(o, e) {
|
|
84
|
-
const n =
|
|
84
|
+
const n = g(o).dependencies;
|
|
85
85
|
if (!e) return n;
|
|
86
86
|
if (!n) return e;
|
|
87
87
|
const t = {
|
|
@@ -95,13 +95,13 @@ function no(r = {}, u = z) {
|
|
|
95
95
|
return t;
|
|
96
96
|
}
|
|
97
97
|
function S(o) {
|
|
98
|
-
return
|
|
98
|
+
return g(o).component || (o === "platformId" || o === "shopId" || o === "purchasePlaceId" ? "TtPanelSelect" : "TtApiComponent");
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
return
|
|
100
|
+
function F(o) {
|
|
101
|
+
return g(o).multiple ?? !0;
|
|
102
102
|
}
|
|
103
103
|
function N(o) {
|
|
104
|
-
return
|
|
104
|
+
return I.value[o] || [];
|
|
105
105
|
}
|
|
106
106
|
function G(o) {
|
|
107
107
|
const e = /* @__PURE__ */ new Map();
|
|
@@ -136,14 +136,14 @@ function no(r = {}, u = z) {
|
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
function K(o, e) {
|
|
139
|
-
return
|
|
139
|
+
return O(o).some((n) => n === e || U(n));
|
|
140
140
|
}
|
|
141
141
|
function L(o) {
|
|
142
142
|
const e = K(o, b("platformId")), n = Array.isArray(o) ? o.length > 1 : !1;
|
|
143
143
|
return c === "action" && (e || n);
|
|
144
144
|
}
|
|
145
145
|
function Q(o) {
|
|
146
|
-
const e = N("shopId"), n =
|
|
146
|
+
const e = N("shopId"), n = O(o);
|
|
147
147
|
if (!n.length)
|
|
148
148
|
return c === "action" ? [] : e;
|
|
149
149
|
if (L(o)) return [];
|
|
@@ -165,10 +165,10 @@ function no(r = {}, u = z) {
|
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
167
|
function k(o, e, n, t, l) {
|
|
168
|
-
const s =
|
|
168
|
+
const s = g(o), P = oo(s.componentProps, e, n, t), i = F(o), { onChange: d, ...h } = P, m = q(s.customOptions) ? s.customOptions(e, t) : t, p = S(o) === "TtPanelSelect", a = p && o === "shopId" ? J(m) : p && o === "purchasePlaceId" ? G(m) : m, w = p ? D(a) : m;
|
|
169
169
|
return p ? {
|
|
170
170
|
multiple: i,
|
|
171
|
-
showAll: s.showAll ?? !0,
|
|
171
|
+
showAll: s.showAll ?? (o === "shopId" && c === "action" ? O(e[f("platformId")]).length > 0 : !0),
|
|
172
172
|
showAllField: b(o),
|
|
173
173
|
showNav: o !== "platformId" && o !== "purchasePlaceId",
|
|
174
174
|
showOriginMode: o === "platformId",
|
|
@@ -211,11 +211,11 @@ function no(r = {}, u = z) {
|
|
|
211
211
|
dependencies: _(o),
|
|
212
212
|
componentProps: (n, t) => {
|
|
213
213
|
var h;
|
|
214
|
-
const l = N(o), s = f(o), P =
|
|
214
|
+
const l = N(o), s = f(o), P = F(o), i = b(o), d = ((h = n[s]) == null ? void 0 : h.at(-1)) !== i;
|
|
215
215
|
return k(o, n, t, l, (m) => {
|
|
216
216
|
if (S(o) !== "TtPanelSelect") {
|
|
217
217
|
const p = n[s];
|
|
218
|
-
P && (d &&
|
|
218
|
+
P && (d && O(m).at(-1) === i ? n[s] = [i] : n[s] = p == null ? void 0 : p.filter((a) => a !== i));
|
|
219
219
|
}
|
|
220
220
|
});
|
|
221
221
|
}
|
|
@@ -230,11 +230,11 @@ function no(r = {}, u = z) {
|
|
|
230
230
|
rules: C("platformId"),
|
|
231
231
|
componentProps: (o, e) => {
|
|
232
232
|
var m;
|
|
233
|
-
const n = "platformId", t = f(n), l = f("shopId"), s =
|
|
233
|
+
const n = "platformId", t = f(n), l = f("shopId"), s = F(n), P = F("shopId"), i = N(n), d = b(n), h = ((m = o[t]) == null ? void 0 : m.at(-1)) !== d;
|
|
234
234
|
return k(n, o, e, i, (p) => {
|
|
235
235
|
if (S(n) !== "TtPanelSelect") {
|
|
236
236
|
const a = o[t];
|
|
237
|
-
s && (h &&
|
|
237
|
+
s && (h && O(p).at(-1) === d ? o[t] = [d] : o[t] = a == null ? void 0 : a.filter((w) => w !== d));
|
|
238
238
|
}
|
|
239
239
|
o[l] = P ? [] : void 0;
|
|
240
240
|
});
|
|
@@ -247,11 +247,11 @@ function no(r = {}, u = z) {
|
|
|
247
247
|
label: M("shopId"),
|
|
248
248
|
componentProps: (o, e) => {
|
|
249
249
|
var h;
|
|
250
|
-
const n = "shopId", t = f(n), l = o[f("platformId")], s = Q(l), P =
|
|
250
|
+
const n = "shopId", t = f(n), l = o[f("platformId")], s = Q(l), P = F(n), i = b(n), d = ((h = o[t]) == null ? void 0 : h.at(-1)) !== i;
|
|
251
251
|
return k(n, o, e, s, (m) => {
|
|
252
252
|
if (S(n) !== "TtPanelSelect") {
|
|
253
253
|
const p = o[t];
|
|
254
|
-
P && (d &&
|
|
254
|
+
P && (d && O(m).at(-1) === i ? o[t] = [i] : o[t] = p == null ? void 0 : p.filter((a) => a !== i));
|
|
255
255
|
}
|
|
256
256
|
});
|
|
257
257
|
},
|
|
@@ -284,7 +284,7 @@ function no(r = {}, u = z) {
|
|
|
284
284
|
}
|
|
285
285
|
return {
|
|
286
286
|
...W(),
|
|
287
|
-
dataSource:
|
|
287
|
+
dataSource: I
|
|
288
288
|
};
|
|
289
289
|
}
|
|
290
290
|
function Po() {
|
|
@@ -322,11 +322,11 @@ function Po() {
|
|
|
322
322
|
return r.options.dataSource = c, u;
|
|
323
323
|
},
|
|
324
324
|
field(c, A) {
|
|
325
|
-
var
|
|
325
|
+
var I;
|
|
326
326
|
return r.options.fieldConfigs = {
|
|
327
327
|
...r.options.fieldConfigs,
|
|
328
328
|
[c]: {
|
|
329
|
-
...((
|
|
329
|
+
...((I = r.options.fieldConfigs) == null ? void 0 : I[c]) || {},
|
|
330
330
|
...A
|
|
331
331
|
}
|
|
332
332
|
}, u;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dazhicheng/ui",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.243",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"vue-router": "^5.0.2",
|
|
68
68
|
"vxe-pc-ui": "^4.12.36",
|
|
69
69
|
"vxe-table": "^4.17.48",
|
|
70
|
-
"@dazhicheng/
|
|
71
|
-
"@dazhicheng/
|
|
70
|
+
"@dazhicheng/hooks": "1.4.46",
|
|
71
|
+
"@dazhicheng/utils": "1.3.43"
|
|
72
72
|
},
|
|
73
73
|
"files": [
|
|
74
74
|
"dist"
|