@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.
@@ -1,6 +1,6 @@
1
- import { useDataPermissionOptions as Y } from "./useDataPermissionOptions.js";
1
+ import { useDataPermissionOptions as Z } from "./useDataPermissionOptions.js";
2
2
  import "axios";
3
- import { ElSelectV2 as Z } from "element-plus";
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 $ } from "lodash-es";
17
- const E = "all", v = { label: "全部", value: E }, z = [
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
- ], H = {
24
+ ], y = {
25
25
  platformId: "platformIds",
26
26
  shopId: "shopIds",
27
27
  purchasePlaceId: "purchasePlaceId",
28
28
  businessType: "businessType",
29
29
  lockUserId: "lockUserId"
30
- }, y = {
30
+ }, T = {
31
31
  platformId: "平台",
32
32
  shopId: "店铺",
33
33
  purchasePlaceId: "采购地",
34
34
  businessType: "业务线",
35
35
  lockUserId: "锁单人"
36
36
  };
37
- function U(r) {
38
- return typeof r == "string" && r.toLowerCase() === E.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 T(r = []) {
44
- return [v].concat(r);
43
+ function oo(r = []) {
44
+ return [H].concat(r);
45
45
  }
46
- function oo(r, u, c, A) {
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 C;
50
+ var b;
51
51
  u == null || u(r);
52
- const I = A(), f = (C = I.values) == null ? void 0 : C[I.fieldName];
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 no(r = {}, u = z) {
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 } = Y({
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 || H[o];
69
+ return g(o).fieldName || y[o];
70
70
  }
71
- function C(o) {
71
+ function b(o) {
72
72
  return g(o).rules;
73
73
  }
74
74
  function M(o) {
75
- return g(o).label || y[o];
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 b(o) {
82
- return g(o).showAllField ?? E;
81
+ function P(o) {
82
+ return g(o).showAllField ?? U;
83
83
  }
84
- function _(o, e) {
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 D(o) {
132
+ function _(o) {
133
133
  return o.flatMap((e) => {
134
134
  const n = e.children;
135
- return n != null && n.length ? D(n) : [e];
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 || U(n));
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 L(o) {
142
- const e = K(o, b("platformId")), n = Array.isArray(o) ? o.length > 1 : !1;
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 Q(o) {
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 (L(o)) return [];
157
+ if (w(o)) return [];
150
158
  const t = e.filter((s) => n.includes(s.platformId));
151
- return !t.some((s) => s.value === b("shopId") || U(s.value)) || t.length <= 1 ? t : T(t.filter((s) => s.value !== b("shopId") && !U(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 x(o, e, n, t, l) {
154
- const s = f(o), P = l ? t.filter((i) => {
155
- var m;
156
- return (m = e[s]) == null ? void 0 : m.includes(i.value);
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: P
172
+ currentOption: d
165
173
  };
166
174
  }
167
- function k(o, e, n, t, l) {
168
- const s = g(o), P = oo(s.componentProps, e, n, t), i = F(o), { onChange: m, ...h } = P, d = q(s.customOptions) ? s.customOptions(e, t) : t, p = S(o) === "TtPanelSelect", a = p && o === "shopId" ? J(d) : p && o === "purchasePlaceId" ? G(d) : d, w = p ? D(a) : d;
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: b(o),
180
+ showAllField: P(o),
173
181
  showNav: o !== "platformId" && o !== "purchasePlaceId",
174
182
  showOriginMode: o === "platformId",
175
183
  showPinyinMode: o !== "shopId" && o !== "purchasePlaceId",
176
- ...h,
177
- options: a,
184
+ ...a,
185
+ options: C,
178
186
  onChange(R) {
179
- const X = e[f(o)];
187
+ const Y = e[f(o)];
180
188
  j(
181
- X,
189
+ Y,
182
190
  l,
183
191
  s.onChange,
184
- () => x(o, e, n, w, i)
192
+ () => B(o, e, n, x, i)
185
193
  );
186
194
  }
187
195
  } : {
188
196
  multiple: i,
189
- component: Z,
197
+ component: $,
190
198
  showOriginMode: !1,
191
199
  showPinyinMode: !0,
192
- ...h,
193
- options: d,
200
+ ...a,
201
+ options: m,
194
202
  onChange(R) {
195
203
  j(
196
204
  R,
197
205
  l,
198
206
  s.onChange,
199
- () => x(o, e, n, w, i)
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: C(o),
211
- dependencies: _(o),
218
+ rules: b(o),
219
+ dependencies: E(o),
212
220
  componentProps: (n, t) => {
213
- var h;
214
- const l = N(o), s = f(o), P = F(o), i = b(o), m = ((h = n[s]) == null ? void 0 : h.at(-1)) !== i;
215
- return k(o, n, t, l, (d) => {
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
- P && (m && O(d).at(-1) === i ? n[s] = [i] : n[s] = p == null ? void 0 : p.filter((a) => a !== i));
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 B = {
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: C("platformId"),
238
+ rules: b("platformId"),
231
239
  componentProps: (o, e) => {
232
- var d;
233
- const n = "platformId", t = f(n), l = f("shopId"), s = F(n), P = F("shopId"), i = N(n), m = b(n), h = ((d = o[t]) == null ? void 0 : d.at(-1)) !== m;
234
- return k(n, o, e, i, (p) => {
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 a = o[t];
237
- s && (h && O(p).at(-1) === m ? o[t] = [m] : o[t] = a == null ? void 0 : a.filter((w) => w !== m));
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[l] = P ? [] : void 0;
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 h;
250
- const n = "shopId", t = f(n), l = o[f("platformId")], s = Q(l), P = F(n), i = b(n), m = ((h = o[t]) == null ? void 0 : h.at(-1)) !== i;
251
- return k(n, o, e, s, (d) => {
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
- P && (m && O(d).at(-1) === i ? o[t] = [i] : o[t] = p == null ? void 0 : p.filter((a) => a !== i));
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: _("shopId", {
266
+ dependencies: E("shopId", {
259
267
  triggerFields: [f("platformId")],
260
268
  disabled(o) {
261
- return L(o[f("platformId")]);
269
+ return w(o[f("platformId")]);
262
270
  },
263
271
  rules(o) {
264
- return L(o[f("platformId")]) ? null : C("shopId") || null;
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 W() {
273
- return Object.keys(B).reduce(
280
+ function X() {
281
+ return Object.keys(D).reduce(
274
282
  (o, e) => {
275
283
  var l;
276
- const n = B[e], t = (l = r.fieldConfigs) == null ? void 0 : l[e];
284
+ const n = D[e], t = (l = r.fieldConfigs) == null ? void 0 : l[e];
277
285
  return o[e] = {
278
286
  ...n,
279
- ...$(t, ["componentProps", "rules"])
287
+ ...v(t, ["componentProps", "rules"])
280
288
  }, o;
281
289
  },
282
290
  {}
283
291
  );
284
292
  }
285
293
  return {
286
- ...W(),
294
+ ...X(),
287
295
  dataSource: I
288
296
  };
289
297
  }
290
- function So() {
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 no(r.options, r.codes);
343
+ return eo(r.options, r.codes);
336
344
  }
337
345
  };
338
346
  return u;
339
347
  }
340
348
  export {
341
- So as useFormSchemasLink
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
+ };