@dazhicheng/ui 1.6.16 → 1.6.18
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/components/tt-area/TtArea.vue.js +1 -1
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
- package/dist/components/tt-form/src/form-render/FormField.vue2.js +165 -159
- package/dist/components/tt-form/src/form-render/dependencies.d.ts +1 -1
- package/dist/components/tt-form/src/form-render/dependencies.js +53 -53
- package/dist/components/tt-form/src/form-render/form.vue2.js +68 -67
- package/dist/components/tt-form/src/form-render/helper.js +20 -16
- package/dist/components/tt-form/src/group-form/groupFormApi.js +42 -41
- package/dist/components/tt-icon/index.vue.js +2 -2
- package/dist/components/tt-loading/src/loading.vue.js +2 -2
- package/dist/hooks/useBasicDataOptions.js +27 -26
- package/dist/hooks/useDataPermissionOptions.js +75 -92
- package/dist/hooks/useFormSchemasLink.d.ts +2 -1
- package/dist/hooks/useFormSchemasLink.js +83 -75
- package/dist/hooks/userListCache.d.ts +12 -0
- package/dist/hooks/userListCache.js +17 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useDataPermissionOptions as
|
|
1
|
+
import { useDataPermissionOptions as Z } from "./useDataPermissionOptions.js";
|
|
2
2
|
import "axios";
|
|
3
|
-
import { ElSelectV2 as
|
|
3
|
+
import { ElSelectV2 as $ } from "element-plus";
|
|
4
4
|
import { isFunction as q } from "../packages/utils/src/is.js";
|
|
5
5
|
import "vue";
|
|
6
6
|
import "dayjs";
|
|
@@ -13,46 +13,46 @@ import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
|
13
13
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
14
14
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
15
15
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
16
|
-
import { omit as
|
|
17
|
-
const
|
|
16
|
+
import { omit as v } from "lodash-es";
|
|
17
|
+
const U = "all", H = { label: "全部", value: U }, z = [
|
|
18
18
|
"platformId",
|
|
19
19
|
"shopId",
|
|
20
20
|
"purchasePlaceId",
|
|
21
21
|
"businessType",
|
|
22
22
|
"lockUserId",
|
|
23
23
|
"userId"
|
|
24
|
-
],
|
|
24
|
+
], y = {
|
|
25
25
|
platformId: "platformIds",
|
|
26
26
|
shopId: "shopIds",
|
|
27
27
|
purchasePlaceId: "purchasePlaceId",
|
|
28
28
|
businessType: "businessType",
|
|
29
29
|
lockUserId: "lockUserId"
|
|
30
|
-
},
|
|
30
|
+
}, T = {
|
|
31
31
|
platformId: "平台",
|
|
32
32
|
shopId: "店铺",
|
|
33
33
|
purchasePlaceId: "采购地",
|
|
34
34
|
businessType: "业务线",
|
|
35
35
|
lockUserId: "锁单人"
|
|
36
36
|
};
|
|
37
|
-
function
|
|
38
|
-
return typeof r == "string" && r.toLowerCase() ===
|
|
37
|
+
function k(r) {
|
|
38
|
+
return typeof r == "string" && r.toLowerCase() === U.toLowerCase();
|
|
39
39
|
}
|
|
40
40
|
function O(r) {
|
|
41
41
|
return Array.isArray(r) ? r : r == null || r === "" ? [] : [r];
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return [
|
|
43
|
+
function oo(r = []) {
|
|
44
|
+
return [H].concat(r);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function no(r, u, c, A) {
|
|
47
47
|
return r ? q(r) ? r(u, c, A) : r : {};
|
|
48
48
|
}
|
|
49
49
|
function j(r, u, c, A) {
|
|
50
|
-
var
|
|
50
|
+
var b;
|
|
51
51
|
u == null || u(r);
|
|
52
|
-
const I = A(), f = (
|
|
52
|
+
const I = A(), f = (b = I.values) == null ? void 0 : b[I.fieldName];
|
|
53
53
|
c == null || c(f, I);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function eo(r = {}, u = z) {
|
|
56
56
|
const c = r.scene || "list", A = u.reduce(
|
|
57
57
|
(o, e) => {
|
|
58
58
|
if (e === "userId") return o;
|
|
@@ -60,28 +60,28 @@ function no(r = {}, u = z) {
|
|
|
60
60
|
return o[e] = t ? !1 : n.showAll ?? !1, o;
|
|
61
61
|
},
|
|
62
62
|
{}
|
|
63
|
-
), { dataSource: I } =
|
|
63
|
+
), { dataSource: I } = Z({
|
|
64
64
|
codes: u,
|
|
65
65
|
dataSource: r.dataSource,
|
|
66
66
|
showAll: A
|
|
67
67
|
});
|
|
68
68
|
function f(o) {
|
|
69
|
-
return g(o).fieldName ||
|
|
69
|
+
return g(o).fieldName || y[o];
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function b(o) {
|
|
72
72
|
return g(o).rules;
|
|
73
73
|
}
|
|
74
74
|
function M(o) {
|
|
75
|
-
return g(o).label ||
|
|
75
|
+
return g(o).label || T[o];
|
|
76
76
|
}
|
|
77
77
|
function g(o) {
|
|
78
78
|
var e;
|
|
79
79
|
return ((e = r.fieldConfigs) == null ? void 0 : e[o]) || {};
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
return g(o).showAllField ??
|
|
81
|
+
function P(o) {
|
|
82
|
+
return g(o).showAllField ?? U;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function E(o, e) {
|
|
85
85
|
const n = g(o).dependencies;
|
|
86
86
|
if (!e) return n;
|
|
87
87
|
if (!n) return e;
|
|
@@ -129,31 +129,39 @@ function no(r = {}, u = z) {
|
|
|
129
129
|
}, e.set(t, l)), l.children.push(n);
|
|
130
130
|
}), Array.from(e.values());
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function _(o) {
|
|
133
133
|
return o.flatMap((e) => {
|
|
134
134
|
const n = e.children;
|
|
135
|
-
return n != null && n.length ?
|
|
135
|
+
return n != null && n.length ? _(n) : [e];
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
function K(o, e) {
|
|
139
|
-
return O(o).some((n) => n === e ||
|
|
139
|
+
return O(o).some((n) => n === e || k(n));
|
|
140
|
+
}
|
|
141
|
+
function Q(o, e) {
|
|
142
|
+
const n = f("shopId"), t = F("shopId"), l = P("shopId");
|
|
143
|
+
if (c === "action" && w(e)) {
|
|
144
|
+
o[n] = t ? [l] : l;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
o[n] = t ? [] : void 0;
|
|
140
148
|
}
|
|
141
|
-
function
|
|
142
|
-
const e = K(o,
|
|
149
|
+
function w(o) {
|
|
150
|
+
const e = K(o, P("platformId")), n = Array.isArray(o) ? o.length > 1 : !1;
|
|
143
151
|
return c === "action" && (e || n);
|
|
144
152
|
}
|
|
145
|
-
function
|
|
153
|
+
function W(o) {
|
|
146
154
|
const e = N("shopId"), n = O(o);
|
|
147
155
|
if (!n.length)
|
|
148
156
|
return c === "action" ? [] : e;
|
|
149
|
-
if (
|
|
157
|
+
if (w(o)) return [];
|
|
150
158
|
const t = e.filter((s) => n.includes(s.platformId));
|
|
151
|
-
return !t.some((s) => s.value ===
|
|
159
|
+
return !t.some((s) => s.value === P("shopId") || k(s.value)) || t.length <= 1 ? t : oo(t.filter((s) => s.value !== P("shopId") && !k(s.value)));
|
|
152
160
|
}
|
|
153
|
-
function
|
|
154
|
-
const s = f(o),
|
|
155
|
-
var
|
|
156
|
-
return (
|
|
161
|
+
function B(o, e, n, t, l) {
|
|
162
|
+
const s = f(o), d = l ? t.filter((i) => {
|
|
163
|
+
var h;
|
|
164
|
+
return (h = e[s]) == null ? void 0 : h.includes(i.value);
|
|
157
165
|
}) || [] : t.find((i) => i.value === e[s]);
|
|
158
166
|
return {
|
|
159
167
|
values: e,
|
|
@@ -161,42 +169,42 @@ function no(r = {}, u = z) {
|
|
|
161
169
|
fieldName: s,
|
|
162
170
|
dataType: o,
|
|
163
171
|
options: t,
|
|
164
|
-
currentOption:
|
|
172
|
+
currentOption: d
|
|
165
173
|
};
|
|
166
174
|
}
|
|
167
|
-
function
|
|
168
|
-
const s = g(o),
|
|
175
|
+
function L(o, e, n, t, l) {
|
|
176
|
+
const s = g(o), d = no(s.componentProps, e, n, t), i = F(o), { onChange: h, ...a } = d, m = q(s.customOptions) ? s.customOptions(e, t) : t, p = S(o) === "TtPanelSelect", C = p && o === "shopId" ? J(m) : p && o === "purchasePlaceId" ? G(m) : m, x = p ? _(C) : m;
|
|
169
177
|
return p ? {
|
|
170
178
|
multiple: i,
|
|
171
179
|
showAll: s.showAll ?? (o === "shopId" && c === "action" ? O(e[f("platformId")]).length > 0 : !0),
|
|
172
|
-
showAllField:
|
|
180
|
+
showAllField: P(o),
|
|
173
181
|
showNav: o !== "platformId" && o !== "purchasePlaceId",
|
|
174
182
|
showOriginMode: o === "platformId",
|
|
175
183
|
showPinyinMode: o !== "shopId" && o !== "purchasePlaceId",
|
|
176
|
-
...
|
|
177
|
-
options:
|
|
184
|
+
...a,
|
|
185
|
+
options: C,
|
|
178
186
|
onChange(R) {
|
|
179
|
-
const
|
|
187
|
+
const Y = e[f(o)];
|
|
180
188
|
j(
|
|
181
|
-
|
|
189
|
+
Y,
|
|
182
190
|
l,
|
|
183
191
|
s.onChange,
|
|
184
|
-
() =>
|
|
192
|
+
() => B(o, e, n, x, i)
|
|
185
193
|
);
|
|
186
194
|
}
|
|
187
195
|
} : {
|
|
188
196
|
multiple: i,
|
|
189
|
-
component:
|
|
197
|
+
component: $,
|
|
190
198
|
showOriginMode: !1,
|
|
191
199
|
showPinyinMode: !0,
|
|
192
|
-
...
|
|
193
|
-
options:
|
|
200
|
+
...a,
|
|
201
|
+
options: m,
|
|
194
202
|
onChange(R) {
|
|
195
203
|
j(
|
|
196
204
|
R,
|
|
197
205
|
l,
|
|
198
206
|
s.onChange,
|
|
199
|
-
() =>
|
|
207
|
+
() => B(o, e, n, x, i)
|
|
200
208
|
);
|
|
201
209
|
}
|
|
202
210
|
};
|
|
@@ -207,36 +215,36 @@ function no(r = {}, u = z) {
|
|
|
207
215
|
component: S(o),
|
|
208
216
|
fieldName: e,
|
|
209
217
|
label: M(o),
|
|
210
|
-
rules:
|
|
211
|
-
dependencies:
|
|
218
|
+
rules: b(o),
|
|
219
|
+
dependencies: E(o),
|
|
212
220
|
componentProps: (n, t) => {
|
|
213
|
-
var
|
|
214
|
-
const l = N(o), s = f(o),
|
|
215
|
-
return
|
|
221
|
+
var a;
|
|
222
|
+
const l = N(o), s = f(o), d = F(o), i = P(o), h = ((a = n[s]) == null ? void 0 : a.at(-1)) !== i;
|
|
223
|
+
return L(o, n, t, l, (m) => {
|
|
216
224
|
if (S(o) !== "TtPanelSelect") {
|
|
217
225
|
const p = n[s];
|
|
218
|
-
|
|
226
|
+
d && (h && O(m).at(-1) === i ? n[s] = [i] : n[s] = p == null ? void 0 : p.filter((C) => C !== i));
|
|
219
227
|
}
|
|
220
228
|
});
|
|
221
229
|
}
|
|
222
230
|
};
|
|
223
231
|
}
|
|
224
|
-
const
|
|
232
|
+
const D = {
|
|
225
233
|
// 平台
|
|
226
234
|
platformId: {
|
|
227
235
|
component: S("platformId"),
|
|
228
236
|
fieldName: f("platformId"),
|
|
229
237
|
label: M("platformId"),
|
|
230
|
-
rules:
|
|
238
|
+
rules: b("platformId"),
|
|
231
239
|
componentProps: (o, e) => {
|
|
232
|
-
var
|
|
233
|
-
const n = "platformId", t = f(n), l =
|
|
234
|
-
return
|
|
240
|
+
var h;
|
|
241
|
+
const n = "platformId", t = f(n), l = F(n), s = N(n), d = P(n), i = ((h = o[t]) == null ? void 0 : h.at(-1)) !== d;
|
|
242
|
+
return L(n, o, e, s, (a) => {
|
|
235
243
|
if (S(n) !== "TtPanelSelect") {
|
|
236
|
-
const
|
|
237
|
-
|
|
244
|
+
const m = o[t];
|
|
245
|
+
l && (i && O(a).at(-1) === d ? o[t] = [d] : o[t] = m == null ? void 0 : m.filter((p) => p !== d));
|
|
238
246
|
}
|
|
239
|
-
o
|
|
247
|
+
Q(o, o[t]);
|
|
240
248
|
});
|
|
241
249
|
}
|
|
242
250
|
},
|
|
@@ -246,22 +254,22 @@ function no(r = {}, u = z) {
|
|
|
246
254
|
fieldName: f("shopId"),
|
|
247
255
|
label: M("shopId"),
|
|
248
256
|
componentProps: (o, e) => {
|
|
249
|
-
var
|
|
250
|
-
const n = "shopId", t = f(n), l = o[f("platformId")], s =
|
|
251
|
-
return
|
|
257
|
+
var a;
|
|
258
|
+
const n = "shopId", t = f(n), l = o[f("platformId")], s = W(l), d = F(n), i = P(n), h = ((a = o[t]) == null ? void 0 : a.at(-1)) !== i;
|
|
259
|
+
return L(n, o, e, s, (m) => {
|
|
252
260
|
if (S(n) !== "TtPanelSelect") {
|
|
253
261
|
const p = o[t];
|
|
254
|
-
|
|
262
|
+
d && (h && O(m).at(-1) === i ? o[t] = [i] : o[t] = p == null ? void 0 : p.filter((C) => C !== i));
|
|
255
263
|
}
|
|
256
264
|
});
|
|
257
265
|
},
|
|
258
|
-
dependencies:
|
|
266
|
+
dependencies: E("shopId", {
|
|
259
267
|
triggerFields: [f("platformId")],
|
|
260
268
|
disabled(o) {
|
|
261
|
-
return
|
|
269
|
+
return w(o[f("platformId")]);
|
|
262
270
|
},
|
|
263
271
|
rules(o) {
|
|
264
|
-
return
|
|
272
|
+
return w(o[f("platformId")]) ? null : b("shopId") || null;
|
|
265
273
|
}
|
|
266
274
|
})
|
|
267
275
|
},
|
|
@@ -269,25 +277,25 @@ function no(r = {}, u = z) {
|
|
|
269
277
|
businessType: V("businessType"),
|
|
270
278
|
lockUserId: V("lockUserId")
|
|
271
279
|
};
|
|
272
|
-
function
|
|
273
|
-
return Object.keys(
|
|
280
|
+
function X() {
|
|
281
|
+
return Object.keys(D).reduce(
|
|
274
282
|
(o, e) => {
|
|
275
283
|
var l;
|
|
276
|
-
const n =
|
|
284
|
+
const n = D[e], t = (l = r.fieldConfigs) == null ? void 0 : l[e];
|
|
277
285
|
return o[e] = {
|
|
278
286
|
...n,
|
|
279
|
-
|
|
287
|
+
...v(t, ["componentProps", "rules"])
|
|
280
288
|
}, o;
|
|
281
289
|
},
|
|
282
290
|
{}
|
|
283
291
|
);
|
|
284
292
|
}
|
|
285
293
|
return {
|
|
286
|
-
...
|
|
294
|
+
...X(),
|
|
287
295
|
dataSource: I
|
|
288
296
|
};
|
|
289
297
|
}
|
|
290
|
-
function
|
|
298
|
+
function Ao() {
|
|
291
299
|
const r = {
|
|
292
300
|
options: {},
|
|
293
301
|
codes: [...z]
|
|
@@ -332,11 +340,11 @@ function So() {
|
|
|
332
340
|
}, u;
|
|
333
341
|
},
|
|
334
342
|
build() {
|
|
335
|
-
return
|
|
343
|
+
return eo(r.options, r.codes);
|
|
336
344
|
}
|
|
337
345
|
};
|
|
338
346
|
return u;
|
|
339
347
|
}
|
|
340
348
|
export {
|
|
341
|
-
|
|
349
|
+
Ao as useFormSchemasLink
|
|
342
350
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 取全量用户列表,整个应用只请求一次
|
|
3
|
+
*
|
|
4
|
+
* `useDataPermissionOptions` 的 `userId` 和 `useBasicDataOptions` 的 `USER` 都要这份数据。
|
|
5
|
+
* 两边各自缓存会把 `/iam/user/page` 打两遍,所以请求收敛到这里,label value 的映射仍由各自负责。
|
|
6
|
+
*
|
|
7
|
+
* 空结果和请求失败都不写缓存、不留在途引用,下次调用可以重新请求
|
|
8
|
+
* @returns 用户原始记录列表
|
|
9
|
+
*/
|
|
10
|
+
export declare function fetchUserListOnce(): Promise<IamAPI.UserDTO[]>;
|
|
11
|
+
/** 清空用户列表缓存,供各 hook 的 reload 使用 */
|
|
12
|
+
export declare function clearUserListCache(): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { pageUser as t } from "../api/dataTypeContext.js";
|
|
2
|
+
let r, e;
|
|
3
|
+
function c() {
|
|
4
|
+
return r != null && r.length ? Promise.resolve(r) : e || (e = t({ pageNo: 1, pageSize: 9999 }).then((i) => {
|
|
5
|
+
const n = (i == null ? void 0 : i.records) || [];
|
|
6
|
+
return n.length ? r = n : e = void 0, n;
|
|
7
|
+
}), e.catch(() => {
|
|
8
|
+
e = void 0;
|
|
9
|
+
}), e);
|
|
10
|
+
}
|
|
11
|
+
function s() {
|
|
12
|
+
r = void 0, e = void 0;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
s as clearUserListCache,
|
|
16
|
+
c as fetchUserListOnce
|
|
17
|
+
};
|