@dazhicheng/ui 1.5.241 → 1.5.242

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,7 +1,7 @@
1
- import { useDataPermissionOptions as J } from "./useDataPermissionOptions.js";
1
+ import { useDataPermissionOptions as Y } from "./useDataPermissionOptions.js";
2
2
  import "axios";
3
- import { ElSelectV2 as K } from "element-plus";
4
- import { isFunction as x } from "../packages/utils/src/is.js";
3
+ import { ElSelectV2 as Z } from "element-plus";
4
+ import { isFunction as q } from "../packages/utils/src/is.js";
5
5
  import "vue";
6
6
  import "xe-utils";
7
7
  import "dayjs";
@@ -12,288 +12,331 @@ import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
12
12
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
13
13
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
14
14
  import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
15
- import { omit as Q } from "lodash-es";
16
- const U = "all", W = { label: "全部", value: U }, R = [
15
+ import { omit as $ } from "lodash-es";
16
+ const E = "all", v = { label: "全部", value: E }, z = [
17
17
  "platformId",
18
18
  "shopId",
19
19
  "purchasePlaceId",
20
20
  "businessType",
21
21
  "lockUserId",
22
22
  "userId"
23
- ], X = {
23
+ ], H = {
24
24
  platformId: "platformIds",
25
25
  shopId: "shopIds",
26
26
  purchasePlaceId: "purchasePlaceId",
27
27
  businessType: "businessType",
28
28
  lockUserId: "lockUserId"
29
- }, Y = {
29
+ }, y = {
30
30
  platformId: "平台",
31
31
  shopId: "店铺",
32
32
  purchasePlaceId: "采购地",
33
33
  businessType: "业务线",
34
34
  lockUserId: "锁单人"
35
35
  };
36
- function M(e) {
37
- return typeof e == "string" && e.toLowerCase() === U.toLowerCase();
36
+ function U(r) {
37
+ return typeof r == "string" && r.toLowerCase() === E.toLowerCase();
38
38
  }
39
- function _(e) {
40
- return Array.isArray(e) ? e : e == null || e === "" ? [] : [e];
39
+ function F(r) {
40
+ return Array.isArray(r) ? r : r == null || r === "" ? [] : [r];
41
41
  }
42
- function Z(e = []) {
43
- return [W].concat(e);
42
+ function T(r = []) {
43
+ return [v].concat(r);
44
44
  }
45
- function $(e, l, c, A) {
46
- return e ? x(e) ? e(l, c, A) : e : {};
45
+ function oo(r, u, c, A) {
46
+ return r ? q(r) ? r(u, c, A) : r : {};
47
47
  }
48
- function B(e, l, c, A) {
48
+ function j(r, u, c, A) {
49
49
  var C;
50
- l == null || l(e);
51
- const g = A(), u = (C = g.values) == null ? void 0 : C[g.fieldName];
52
- c == null || c(u, g);
50
+ u == null || u(r);
51
+ const g = A(), f = (C = g.values) == null ? void 0 : C[g.fieldName];
52
+ c == null || c(f, g);
53
53
  }
54
- function y(e = {}, l = R) {
55
- const c = e.scene || "list", A = l.reduce(
56
- (o, n) => {
57
- if (n === "userId") return o;
58
- const t = I(n), s = t.component === "TtPanelSelect";
59
- return o[n] = s ? !1 : t.showAll ?? !1, o;
54
+ function no(r = {}, u = z) {
55
+ const c = r.scene || "list", A = u.reduce(
56
+ (o, e) => {
57
+ if (e === "userId") return o;
58
+ const n = I(e), t = S(e) === "TtPanelSelect";
59
+ return o[e] = t ? !1 : n.showAll ?? !1, o;
60
60
  },
61
61
  {}
62
- ), { dataSource: g } = J({
63
- codes: l,
64
- dataSource: e.dataSource,
62
+ ), { dataSource: g } = Y({
63
+ codes: u,
64
+ dataSource: r.dataSource,
65
65
  showAll: A
66
66
  });
67
- function u(o) {
68
- return I(o).fieldName || X[o];
67
+ function f(o) {
68
+ return I(o).fieldName || H[o];
69
69
  }
70
70
  function C(o) {
71
71
  return I(o).rules;
72
72
  }
73
- function F(o) {
74
- return I(o).label || Y[o];
73
+ function M(o) {
74
+ return I(o).label || y[o];
75
75
  }
76
76
  function I(o) {
77
- var n;
78
- return ((n = e.fieldConfigs) == null ? void 0 : n[o]) || {};
77
+ var e;
78
+ return ((e = r.fieldConfigs) == null ? void 0 : e[o]) || {};
79
79
  }
80
80
  function b(o) {
81
- return I(o).showAllField ?? U;
81
+ return I(o).showAllField ?? E;
82
82
  }
83
- function V(o, n) {
84
- const t = I(o).dependencies;
85
- if (!n) return t;
86
- if (!t) return n;
87
- const s = {
88
- ...n,
89
- ...t
83
+ function _(o, e) {
84
+ const n = I(o).dependencies;
85
+ if (!e) return n;
86
+ if (!n) return e;
87
+ const t = {
88
+ ...e,
89
+ ...n
90
90
  };
91
- if (n && t) {
92
- const f = n.triggerFields, r = t.triggerFields;
93
- s.triggerFields = r ?? f;
91
+ if (e && n) {
92
+ const l = e.triggerFields, s = n.triggerFields;
93
+ t.triggerFields = s ?? l;
94
94
  }
95
- return s;
96
- }
97
- function O(o) {
98
- return I(o).component || "TtApiComponent";
95
+ return t;
99
96
  }
100
97
  function S(o) {
98
+ return I(o).component || (o === "platformId" || o === "shopId" || o === "purchasePlaceId" ? "TtPanelSelect" : "TtApiComponent");
99
+ }
100
+ function O(o) {
101
101
  return I(o).multiple ?? !0;
102
102
  }
103
- function w(o) {
103
+ function N(o) {
104
104
  return g.value[o] || [];
105
105
  }
106
- function j(o) {
107
- return _(o).some((n) => M(n));
106
+ function G(o) {
107
+ const e = /* @__PURE__ */ new Map();
108
+ return o.forEach((n) => {
109
+ const t = n.purchaseInfo, l = t == null ? void 0 : t.supplierSubType;
110
+ if (l == null) return;
111
+ let s = e.get(l);
112
+ s || (s = {
113
+ label: String(l),
114
+ value: l,
115
+ children: []
116
+ }, e.set(l, s)), s.children.push(n);
117
+ }), Array.from(e.values());
108
118
  }
109
- function N(o) {
110
- const n = j(o), t = Array.isArray(o) ? o.length > 1 : !1;
111
- return c === "action" && (n || t);
119
+ function J(o) {
120
+ const e = /* @__PURE__ */ new Map();
121
+ return o.forEach((n) => {
122
+ const t = n.platformId;
123
+ if (t == null) return;
124
+ let l = e.get(t);
125
+ l || (l = {
126
+ label: String(n.platformName ?? n.platformId),
127
+ value: t,
128
+ children: []
129
+ }, e.set(t, l)), l.children.push(n);
130
+ }), Array.from(e.values());
131
+ }
132
+ function D(o) {
133
+ return o.flatMap((e) => {
134
+ const n = e.children;
135
+ return n != null && n.length ? D(n) : [e];
136
+ });
137
+ }
138
+ function K(o, e) {
139
+ return F(o).some((n) => n === e || U(n));
140
+ }
141
+ function L(o) {
142
+ const e = K(o, b("platformId")), n = Array.isArray(o) ? o.length > 1 : !1;
143
+ return c === "action" && (e || n);
112
144
  }
113
- function q(o) {
114
- const n = w("shopId"), t = _(o);
115
- if (!t.length)
116
- return c === "action" ? [] : n;
117
- if (N(o)) return [];
118
- const s = n.filter((r) => t.includes(r.platformId));
119
- return !s.some((r) => M(r.value)) || s.length <= 1 ? s : Z(s.filter((r) => !M(r.value)));
145
+ function Q(o) {
146
+ const e = N("shopId"), n = F(o);
147
+ if (!n.length)
148
+ return c === "action" ? [] : e;
149
+ if (L(o)) return [];
150
+ 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)));
120
152
  }
121
- function E(o, n, t, s, f) {
122
- const r = u(o), P = f ? s.filter((i) => {
123
- var m;
124
- return (m = n[r]) == null ? void 0 : m.includes(i.value);
125
- }) || [] : s.find((i) => i.value === n[r]);
153
+ function x(o, e, n, t, l) {
154
+ const s = f(o), P = l ? t.filter((i) => {
155
+ var d;
156
+ return (d = e[s]) == null ? void 0 : d.includes(i.value);
157
+ }) || [] : t.find((i) => i.value === e[s]);
126
158
  return {
127
- values: n,
128
- actions: t,
129
- fieldName: r,
159
+ values: e,
160
+ actions: n,
161
+ fieldName: s,
130
162
  dataType: o,
131
- options: s,
163
+ options: t,
132
164
  currentOption: P
133
165
  };
134
166
  }
135
- function L(o, n, t, s, f) {
136
- const r = I(o), P = $(r.componentProps, n, t, s), i = S(o), { onChange: m, ...a } = P, p = x(r.customOptions) ? r.customOptions(n, s) : s;
137
- return r.component === "TtPanelSelect" ? {
167
+ function k(o, e, n, t, l) {
168
+ const s = I(o), P = oo(s.componentProps, e, n, t), i = O(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
+ return p ? {
138
170
  multiple: i,
139
- showAll: r.showAll ?? !1,
171
+ showAll: s.showAll ?? !0,
140
172
  showAllField: b(o),
141
- ...a,
142
- options: p,
143
- onChange(h) {
144
- B(
145
- h,
146
- void 0,
147
- r.onChange,
148
- () => E(o, n, t, p, i)
173
+ showNav: o !== "platformId" && o !== "purchasePlaceId",
174
+ showOriginMode: o === "platformId",
175
+ showPinyinMode: o !== "shopId" && o !== "purchasePlaceId",
176
+ ...h,
177
+ options: a,
178
+ onChange(R) {
179
+ const X = e[f(o)];
180
+ j(
181
+ X,
182
+ l,
183
+ s.onChange,
184
+ () => x(o, e, n, w, i)
149
185
  );
150
186
  }
151
187
  } : {
152
188
  multiple: i,
153
- component: K,
189
+ component: Z,
154
190
  showOriginMode: !1,
155
191
  showPinyinMode: !0,
156
- ...a,
157
- options: p,
158
- onChange(h) {
159
- B(
160
- h,
161
- f,
162
- r.onChange,
163
- () => E(o, n, t, p, i)
192
+ ...h,
193
+ options: m,
194
+ onChange(R) {
195
+ j(
196
+ R,
197
+ l,
198
+ s.onChange,
199
+ () => x(o, e, n, w, i)
164
200
  );
165
201
  }
166
202
  };
167
203
  }
168
- function k(o) {
169
- const n = u(o);
204
+ function V(o) {
205
+ const e = f(o);
170
206
  return {
171
- component: O(o),
172
- fieldName: n,
173
- label: F(o),
207
+ component: S(o),
208
+ fieldName: e,
209
+ label: M(o),
174
210
  rules: C(o),
175
- dependencies: V(o),
176
- componentProps: (t, s) => {
177
- var a;
178
- const f = w(o), r = u(o), P = S(o), i = b(o), m = ((a = t[r]) == null ? void 0 : a.at(-1)) !== i;
179
- return L(o, t, s, f, (p) => {
180
- const d = t[r];
181
- P && (m && (p == null ? void 0 : p.at(-1)) === i ? t[r] = [i] : t[r] = d == null ? void 0 : d.filter((h) => h !== i));
211
+ dependencies: _(o),
212
+ componentProps: (n, t) => {
213
+ var h;
214
+ const l = N(o), s = f(o), P = O(o), i = b(o), d = ((h = n[s]) == null ? void 0 : h.at(-1)) !== i;
215
+ return k(o, n, t, l, (m) => {
216
+ if (S(o) !== "TtPanelSelect") {
217
+ const p = n[s];
218
+ P && (d && F(m).at(-1) === i ? n[s] = [i] : n[s] = p == null ? void 0 : p.filter((a) => a !== i));
219
+ }
182
220
  });
183
221
  }
184
222
  };
185
223
  }
186
- const D = {
224
+ const B = {
187
225
  // 平台
188
226
  platformId: {
189
- component: O("platformId"),
190
- fieldName: u("platformId"),
191
- label: F("platformId"),
227
+ component: S("platformId"),
228
+ fieldName: f("platformId"),
229
+ label: M("platformId"),
192
230
  rules: C("platformId"),
193
- componentProps: (o, n) => {
194
- var p;
195
- const t = "platformId", s = u(t), f = u("shopId"), r = S(t), P = S("shopId"), i = w(t), m = b(t), a = ((p = o[s]) == null ? void 0 : p.at(-1)) !== m;
196
- return L(t, o, n, i, (d) => {
197
- const h = o[s];
198
- r && (a && (d == null ? void 0 : d.at(-1)) === m ? o[s] = [m] : o[s] = h == null ? void 0 : h.filter((G) => G !== m)), o[f] = P ? [] : void 0;
231
+ componentProps: (o, e) => {
232
+ var m;
233
+ const n = "platformId", t = f(n), l = f("shopId"), s = O(n), P = O("shopId"), i = N(n), d = b(n), h = ((m = o[t]) == null ? void 0 : m.at(-1)) !== d;
234
+ return k(n, o, e, i, (p) => {
235
+ if (S(n) !== "TtPanelSelect") {
236
+ const a = o[t];
237
+ s && (h && F(p).at(-1) === d ? o[t] = [d] : o[t] = a == null ? void 0 : a.filter((w) => w !== d));
238
+ }
239
+ o[l] = P ? [] : void 0;
199
240
  });
200
241
  }
201
242
  },
202
243
  // 店铺
203
244
  shopId: {
204
- component: O("shopId"),
205
- fieldName: u("shopId"),
206
- label: F("shopId"),
207
- componentProps: (o, n) => {
208
- var a;
209
- const t = "shopId", s = u(t), f = o[u("platformId")], r = q(f), P = S(t), i = b(t), m = ((a = o[s]) == null ? void 0 : a.at(-1)) !== i;
210
- return L(t, o, n, r, (p) => {
211
- const d = o[s];
212
- P && (m && (p == null ? void 0 : p.at(-1)) === i ? o[s] = [i] : o[s] = d == null ? void 0 : d.filter((h) => h !== i));
245
+ component: S("shopId"),
246
+ fieldName: f("shopId"),
247
+ label: M("shopId"),
248
+ componentProps: (o, e) => {
249
+ var h;
250
+ const n = "shopId", t = f(n), l = o[f("platformId")], s = Q(l), P = O(n), i = b(n), d = ((h = o[t]) == null ? void 0 : h.at(-1)) !== i;
251
+ return k(n, o, e, s, (m) => {
252
+ if (S(n) !== "TtPanelSelect") {
253
+ const p = o[t];
254
+ P && (d && F(m).at(-1) === i ? o[t] = [i] : o[t] = p == null ? void 0 : p.filter((a) => a !== i));
255
+ }
213
256
  });
214
257
  },
215
- dependencies: V("shopId", {
216
- triggerFields: [u("platformId")],
258
+ dependencies: _("shopId", {
259
+ triggerFields: [f("platformId")],
217
260
  disabled(o) {
218
- return N(o[u("platformId")]);
261
+ return L(o[f("platformId")]);
219
262
  },
220
263
  rules(o) {
221
- return N(o[u("platformId")]) ? null : C("shopId") || null;
264
+ return L(o[f("platformId")]) ? null : C("shopId") || null;
222
265
  }
223
266
  })
224
267
  },
225
- purchasePlaceId: k("purchasePlaceId"),
226
- businessType: k("businessType"),
227
- lockUserId: k("lockUserId")
268
+ purchasePlaceId: V("purchasePlaceId"),
269
+ businessType: V("businessType"),
270
+ lockUserId: V("lockUserId")
228
271
  };
229
- function z() {
230
- return Object.keys(D).reduce(
231
- (o, n) => {
232
- var f;
233
- const t = D[n], s = (f = e.fieldConfigs) == null ? void 0 : f[n];
234
- return o[n] = {
235
- ...t,
236
- ...Q(s, ["componentProps", "rules"])
272
+ function W() {
273
+ return Object.keys(B).reduce(
274
+ (o, e) => {
275
+ var l;
276
+ const n = B[e], t = (l = r.fieldConfigs) == null ? void 0 : l[e];
277
+ return o[e] = {
278
+ ...n,
279
+ ...$(t, ["componentProps", "rules"])
237
280
  }, o;
238
281
  },
239
282
  {}
240
283
  );
241
284
  }
242
285
  return {
243
- ...z(),
286
+ ...W(),
244
287
  dataSource: g
245
288
  };
246
289
  }
247
- function mo() {
248
- const e = {
290
+ function Po() {
291
+ const r = {
249
292
  options: {},
250
- codes: [...R]
251
- }, l = {
293
+ codes: [...z]
294
+ }, u = {
252
295
  /**
253
296
  * @description 渲染查询场景
254
297
  */
255
298
  list() {
256
- return e.options.scene = "list", l;
299
+ return r.options.scene = "list", u;
257
300
  },
258
301
  /**
259
302
  * @description 渲染新增编辑场景
260
303
  */
261
304
  action() {
262
- return e.options.scene = "action", l;
305
+ return r.options.scene = "action", u;
263
306
  },
264
307
  /**
265
308
  * @param scene 场景值 list为查询 action为新增编辑等操作
266
309
  * @returns FormSchemasLinkBuilder
267
310
  */
268
311
  scene(c) {
269
- return e.options.scene = c, l;
312
+ return r.options.scene = c, u;
270
313
  },
271
314
  /**
272
315
  * @param codes 接口请求所需要的入参,需要什么数据源就传什么入参
273
316
  * @returns FormSchemasLinkBuilder
274
317
  */
275
318
  codes(c) {
276
- return e.codes = [...c], l;
319
+ return r.codes = [...c], u;
277
320
  },
278
321
  dataSource(c) {
279
- return e.options.dataSource = c, l;
322
+ return r.options.dataSource = c, u;
280
323
  },
281
324
  field(c, A) {
282
325
  var g;
283
- return e.options.fieldConfigs = {
284
- ...e.options.fieldConfigs,
326
+ return r.options.fieldConfigs = {
327
+ ...r.options.fieldConfigs,
285
328
  [c]: {
286
- ...((g = e.options.fieldConfigs) == null ? void 0 : g[c]) || {},
329
+ ...((g = r.options.fieldConfigs) == null ? void 0 : g[c]) || {},
287
330
  ...A
288
331
  }
289
- }, l;
332
+ }, u;
290
333
  },
291
334
  build() {
292
- return y(e.options, e.codes);
335
+ return no(r.options, r.codes);
293
336
  }
294
337
  };
295
- return l;
338
+ return u;
296
339
  }
297
340
  export {
298
- mo as useFormSchemasLink
341
+ Po as useFormSchemasLink
299
342
  };