vue3-element-dict 2.0.1 → 2.0.3

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,2847 +0,0 @@
1
- import { reactive as ae, defineComponent as H, toRefs as Le, toRaw as P, computed as N, ref as k, watchEffect as Ve, resolveComponent as $, openBlock as G, createBlock as w, mergeProps as ie, unref as S, createSlots as Q, withCtx as L, createTextVNode as K, toDisplayString as U, renderList as x, renderSlot as M, normalizeProps as W, guardReactiveProps as X, useAttrs as me, watch as re, createElementBlock as te, Fragment as ne, createVNode as Ue } from "vue";
2
- const ce = (e, n, g, t) => {
3
- const s = {};
4
- for (let l in e)
5
- s[l] = n(e[l]).map((c) => ({
6
- ...c,
7
- [t]: g(c) || !!c[t]
8
- }));
9
- return s;
10
- }, R = ae({
11
- dictConfig: {
12
- getDictCodeApi: new Promise((e, n) => {
13
- e({});
14
- }),
15
- //组件过滤数据 配置
16
- filterDataFun: (e) => e,
17
- //组件禁用数据 配置
18
- disabledDataFun: (e) => !1,
19
- //配置数组数据转化成树形数据
20
- treeSetting: {
21
- idField: "id",
22
- //唯一标识字段名
23
- parentIdField: "parentId",
24
- //父节点唯一标识字段名
25
- childrenField: "children",
26
- //子节点标识字段名
27
- firstId: "0",
28
- // 根节点值
29
- labelField: "label",
30
- //label字段名
31
- labelArrField: "labelArr",
32
- //给对象新增的中文数组字段名
33
- idArrField: "idArr",
34
- //给对象新增的id数组字段名
35
- levelField: "level",
36
- //给对象新增的层级字段名
37
- level: 1,
38
- // 给第一级展示的层级
39
- leafField: "leaf"
40
- //叶子节点标识字段名
41
- },
42
- query: "type",
43
- versionKey: "currentVersion",
44
- dictDataKey: "dictCodeList",
45
- format: {
46
- value: "value",
47
- label: "label",
48
- disabled: "disabled",
49
- type: "type",
50
- color: "color"
51
- },
52
- formatterRequest: (e, n) => n ? { [e]: n } : { [e]: "" },
53
- formatterDictList: (e, n) => e.dictCodeList,
54
- formatterDictVersion: (e) => e.version,
55
- storage: localStorage,
56
- usuallyGetDictTypes: "",
57
- isGetAll: !1,
58
- localDictCodes: {},
59
- //本地数据
60
- getDictEveryTime: !1
61
- },
62
- // 字典配置
63
- dictCodes: {},
64
- // 字典数据
65
- isGettingDictTypes: [],
66
- //正在请求字典类型数组 防止多个请求
67
- isGettingAllDictTypes: !1,
68
- //正在请求所有字典数据
69
- unfindDictTypes: []
70
- //防止重复请求没有的字典数据
71
- }), Y = {
72
- //设置字典配置
73
- SET_DICT_SETTING(e) {
74
- R.dictConfig = e;
75
- },
76
- //设置字典数据值
77
- SET_DICT_CODES(e) {
78
- R.dictCodes = e;
79
- },
80
- //添加正在请求的字典类型字段
81
- ADD_IS_EGTTING_DICT_TYPES(e) {
82
- const g = [...e.split(","), ...R.isGettingDictTypes], t = new Set(g);
83
- R.isGettingDictTypes = Array.from(t);
84
- },
85
- //去除正在请求的字典类型字段
86
- REMOVE_IS_EGTTING_DICT_TYPES(e) {
87
- const n = e.split(","), g = [...new Set(R.isGettingDictTypes)].filter(
88
- (t) => !new Set(n).has(t)
89
- );
90
- R.isGettingDictTypes = Array.from(g);
91
- },
92
- //设置是否正在请求所有字典数据
93
- SETTING_ISGETTING_ALL_DICT_TYPES(e) {
94
- R.isGettingAllDictTypes = e;
95
- },
96
- //添加找不到的字典类型字段
97
- ADD_UNFIND_DICT_TYPES(e) {
98
- const g = [...e.split(","), ...R.unfindDictTypes], t = new Set(g);
99
- R.unfindDictTypes = Array.from(t);
100
- },
101
- //去除找不到的字典类型字段
102
- REMOVE_UNFIND_DICT_TYPES(e) {
103
- const n = e.split(","), g = [...new Set(R.unfindDictTypes)].filter(
104
- (t) => !new Set(n).has(t)
105
- );
106
- R.unfindDictTypes = Array.from(g);
107
- }
108
- }, He = {
109
- getDictDataObj(e) {
110
- return new Promise((n, g) => {
111
- if (!e)
112
- return;
113
- const {
114
- storage: t,
115
- dictDataKey: s,
116
- getDictCodeApi: l,
117
- usuallyGetDictTypes: c,
118
- formatterRequest: a,
119
- query: d,
120
- versionKey: i,
121
- localDictCodes: r,
122
- formatterDictList: b,
123
- formatterDictVersion: T,
124
- isGetAll: h,
125
- filterDataFun: I,
126
- disabledDataFun: O,
127
- format: F
128
- } = R.dictConfig, E = R.dictCodes || r;
129
- if (!E[e] || E[e].length === 0) {
130
- if (R.isGettingDictTypes.includes(e) || R.isGettingAllDictTypes)
131
- return;
132
- if (Y.ADD_IS_EGTTING_DICT_TYPES(e), R.unfindDictTypes.includes(e)) {
133
- g(`不存在类型为:${e} 的字典字段,请确认后再填写`);
134
- return;
135
- }
136
- Y.ADD_UNFIND_DICT_TYPES(e), l(a(d, e)).then((C) => {
137
- Y.REMOVE_IS_EGTTING_DICT_TYPES(e);
138
- const v = T(C), m = t.getItem(i);
139
- if (v !== m) {
140
- let f = "";
141
- if (h)
142
- f = "", Y.SETTING_ISGETTING_ALL_DICT_TYPES(!0);
143
- else {
144
- if (c) {
145
- const u = Object.keys(E), D = c.split(","), p = u.concat(D);
146
- p.push(e), f = Array.from(new Set(p)).join(",");
147
- } else {
148
- const u = Object.keys(E);
149
- u.push(e), f = Array.from(new Set(u)).join(",");
150
- }
151
- Y.ADD_IS_EGTTING_DICT_TYPES(f);
152
- }
153
- l(a(d, f)).then(
154
- (u) => {
155
- const D = b(
156
- u,
157
- e
158
- );
159
- if (!(D[e] && D[e].length > 0)) {
160
- g(
161
- `不存在类型为:${e} 的字典字段,请确认后再填写`
162
- );
163
- return;
164
- }
165
- Y.REMOVE_UNFIND_DICT_TYPES(e);
166
- const p = T(u), y = Object.assign(
167
- JSON.parse(JSON.stringify(r)),
168
- D
169
- ), _ = ce(y, I, O, F == null ? void 0 : F.disabled);
170
- t.setItem(s, JSON.stringify(_)), t.setItem(i, p), Y.SET_DICT_CODES(_), n(R.dictCodes), R.isGettingAllDictTypes ? Y.SETTING_ISGETTING_ALL_DICT_TYPES(!1) : Y.REMOVE_IS_EGTTING_DICT_TYPES(f);
171
- }
172
- );
173
- } else {
174
- const f = b(
175
- C,
176
- e
177
- );
178
- if (!(f[e] && f[e].length > 0)) {
179
- g(`不存在类型为:${e} 的字典字段,请确认后再填写`);
180
- return;
181
- }
182
- Y.REMOVE_UNFIND_DICT_TYPES(e);
183
- const u = R.dictCodes || r, D = ce(f, I, O, F == null ? void 0 : F.disabled);
184
- Object.assign(u, D), t.setItem(s, JSON.stringify(u)), Y.SET_DICT_CODES(u), n(R.dictCodes);
185
- }
186
- });
187
- } else
188
- Y.REMOVE_UNFIND_DICT_TYPES(e), Y.SET_DICT_CODES(E), n(R.dictCodes);
189
- });
190
- }
191
- }, o = {
192
- state: R,
193
- mutations: Y,
194
- actions: He
195
- }, Qe = (e, n, g) => new Promise((t, s) => {
196
- const { format: l } = o.state.dictConfig, c = o.state.dictCodes;
197
- let a = [];
198
- if (!c || !c[n])
199
- if (o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes) {
200
- const d = setInterval(() => {
201
- if (!(o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes)) {
202
- if (clearInterval(d), a = o.state.dictCodes[n], !a) {
203
- s(`不存在类型为:${n} 的字典字段,请确认后再填写`);
204
- return;
205
- }
206
- const i = a.find((r) => r[l.value] === e);
207
- t(i ? i[l.label] : g ?? "");
208
- }
209
- }, 1e3);
210
- } else
211
- o.actions.getDictDataObj(n).then((d) => {
212
- if (a = d[n], !a) {
213
- s(`不存在类型为:${n} 的字典字段,请确认后再填写`);
214
- return;
215
- }
216
- const i = a.find((r) => r[l.value] === e);
217
- t(i ? i[l.label] : g ?? "");
218
- });
219
- else {
220
- a = c[n];
221
- const d = a.find((i) => i[l.value] === e);
222
- t(d ? d[l.label] : g ?? "");
223
- }
224
- });
225
- function de(e, n, g, t) {
226
- const s = [];
227
- for (let l = 0; l < e.length; l++) {
228
- const c = n.find((a) => a[g.value] === e[l]);
229
- c ? s.push(c) : s.push({
230
- [g.label]: t,
231
- [g.value]: e[l]
232
- });
233
- }
234
- return s;
235
- }
236
- const We = (e, n, g) => {
237
- const t = {
238
- defaultVal: "",
239
- formatFun: (s, l) => s.map((c) => c[l.label]).join(","),
240
- spacer: ","
241
- };
242
- return Object.assign(t, g), new Promise((s, l) => {
243
- let c = [];
244
- Array.isArray(e) ? c = e : typeof e == "string" && (c = e.split(t.spacer));
245
- const { format: a } = o.state.dictConfig, d = o.state.dictCodes;
246
- let i = [];
247
- if (!d || !d[n])
248
- if (o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes) {
249
- const r = setInterval(() => {
250
- if (!(o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes)) {
251
- if (clearInterval(r), i = o.state.dictCodes[n], !i) {
252
- l(`不存在类型为:${n} 的字典字段,请确认后再填写`);
253
- return;
254
- }
255
- const b = de(
256
- c,
257
- i,
258
- a,
259
- t.defaultVal
260
- );
261
- s(
262
- b && b.length > 0 ? t.formatFun(b, a) : t.defaultVal
263
- );
264
- }
265
- }, 1e3);
266
- } else
267
- o.actions.getDictDataObj(n).then((r) => {
268
- if (i = r[n], !i) {
269
- l(`不存在类型为:${n} 的字典字段,请确认后再填写`);
270
- return;
271
- }
272
- const b = de(
273
- c,
274
- i,
275
- a,
276
- t.defaultVal
277
- );
278
- s(
279
- b && b.length > 0 ? t.formatFun(b, a) : t.defaultVal
280
- );
281
- });
282
- else {
283
- i = d[n];
284
- const r = de(
285
- c,
286
- i,
287
- a,
288
- t.defaultVal
289
- );
290
- s(
291
- r && r.length > 0 ? t.formatFun(r, a) : t.defaultVal
292
- );
293
- }
294
- });
295
- }, Xe = (e, n, g) => new Promise((t, s) => {
296
- const { format: l } = o.state.dictConfig, c = o.state.dictCodes;
297
- let a = [];
298
- if (!c || !c[n])
299
- if (o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes) {
300
- const d = setInterval(() => {
301
- if (!(o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes)) {
302
- if (clearInterval(d), a = o.state.dictCodes[n], !a) {
303
- s(`不存在类型为:${n} 的字典字段,请确认后再填写`);
304
- return;
305
- }
306
- const i = a.find((r) => r[l.label] === e);
307
- t(i ? i[l.value] : g ?? "");
308
- }
309
- }, 1e3);
310
- } else
311
- o.actions.getDictDataObj(n).then((d) => {
312
- if (a = d[n], !a) {
313
- s(`不存在类型为:${n} 的字典字段,请确认后再填写`);
314
- return;
315
- }
316
- const i = a.find((r) => r[l.label] === e);
317
- t(i ? i[l.value] : g ?? "");
318
- });
319
- else {
320
- a = c[n];
321
- const d = a.find((i) => i[l.label] === e);
322
- t(d ? d[l.value] : g ?? "");
323
- }
324
- });
325
- function fe(e, n, g, t) {
326
- const s = [];
327
- for (let l = 0; l < e.length; l++) {
328
- const c = n.find((a) => a[g.label] === e[l]);
329
- c ? s.push(c) : s.push({
330
- [g.label]: e[l],
331
- [g.value]: t
332
- });
333
- }
334
- return s;
335
- }
336
- const Ze = (e, n, g) => {
337
- const t = {
338
- defaultVal: "",
339
- formatFun: (s, l) => s.map((c) => c[l.value]).join(","),
340
- spacer: ","
341
- };
342
- return Object.assign(t, g), new Promise((s, l) => {
343
- let c = [];
344
- Array.isArray(e) ? c = e : typeof e == "string" && (c = e.split(t.spacer));
345
- const { format: a } = o.state.dictConfig, d = o.state.dictCodes;
346
- let i = [];
347
- if (!d || !d[n])
348
- if (o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes) {
349
- const r = setInterval(() => {
350
- if (!(o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes)) {
351
- if (clearInterval(r), i = o.state.dictCodes[n], !i) {
352
- l(`不存在类型为:${n} 的字典字段,请确认后再填写`);
353
- return;
354
- }
355
- const b = fe(
356
- c,
357
- i,
358
- a,
359
- t.defaultVal
360
- );
361
- s(
362
- b && b.length > 0 ? t.formatFun(b, a) : t.defaultVal
363
- );
364
- }
365
- }, 1e3);
366
- } else
367
- o.actions.getDictDataObj(n).then((r) => {
368
- if (i = r[n], !i) {
369
- l(`不存在类型为:${n} 的字典字段,请确认后再填写`);
370
- return;
371
- }
372
- const b = fe(
373
- c,
374
- i,
375
- a,
376
- t.defaultVal
377
- );
378
- s(
379
- b && b.length > 0 ? t.formatFun(b, a) : t.defaultVal
380
- );
381
- });
382
- else {
383
- i = d[n];
384
- const r = fe(
385
- c,
386
- i,
387
- a,
388
- t.defaultVal
389
- );
390
- s(
391
- r && r.length > 0 ? t.formatFun(r, a) : t.defaultVal
392
- );
393
- }
394
- });
395
- }, et = (e) => new Promise((n, g) => {
396
- let t = [], s = "";
397
- Array.isArray(e) ? (s = e.join(","), t = e) : typeof e == "string" && (t = e.split(","));
398
- const l = o.state.dictCodes, c = o.state.dictConfig;
399
- if (!l)
400
- o.mutations.ADD_IS_EGTTING_DICT_TYPES(s), c.getDictCodeApi(c.formatterRequest(c.query, s)).then((a) => {
401
- o.mutations.REMOVE_IS_EGTTING_DICT_TYPES(s);
402
- const d = c.formatterDictList(a, e), i = ce(d, c.filterDataFun, c.disabledDataFun), r = JSON.parse(JSON.stringify(i)), b = Object.assign(o.state.dictCodes, r);
403
- c.storage.setItem(
404
- c.dictDataKey,
405
- JSON.stringify(b)
406
- ), o.mutations.SET_DICT_CODES(b), n(i);
407
- });
408
- else {
409
- const a = [], d = {};
410
- for (let i = 0; i < t.length; i++) {
411
- if (l[t[i]]) {
412
- d[t[i]] = l[t[i]];
413
- continue;
414
- }
415
- a.push(t[i]);
416
- }
417
- a.length > 0 ? (o.mutations.ADD_IS_EGTTING_DICT_TYPES(a.join(",")), c.getDictCodeApi(
418
- c.formatterRequest(c.query, a.join(","))
419
- ).then((i) => {
420
- o.mutations.REMOVE_IS_EGTTING_DICT_TYPES(a.join(","));
421
- const r = c.formatterDictList(i, e), b = ce(r, c.filterDataFun, c.disabledDataFun), T = JSON.parse(JSON.stringify(b)), h = Object.assign(o.state.dictCodes, T);
422
- c.storage.setItem(
423
- c.dictDataKey,
424
- JSON.stringify(h)
425
- ), o.mutations.SET_DICT_CODES(h);
426
- const I = Object.assign(d, r), O = [];
427
- for (const F in I)
428
- (!I[F] || I[F].length === 0) && O.push(F);
429
- O.length > 0 && g(
430
- `不存在类型为:${O.join(
431
- "、"
432
- )} 的字典字段,请确认后再填写`
433
- ), n(b);
434
- })) : n(d);
435
- }
436
- }), pe = (e, n, g) => new Promise((t, s) => {
437
- const { format: l } = o.state.dictConfig, c = o.state.dictCodes;
438
- let a = [];
439
- if (!c || !c[n])
440
- if (o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes) {
441
- const d = setInterval(() => {
442
- if (!(o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes)) {
443
- if (clearInterval(d), a = o.state.dictCodes[n], !a) {
444
- s(`不存在类型为:${n} 的字典字段,请确认后再填写`);
445
- return;
446
- }
447
- const i = a.find((r) => r[l.value] === e);
448
- t(i || (g ?? ""));
449
- }
450
- }, 1e3);
451
- } else
452
- o.actions.getDictDataObj(n).then((d) => {
453
- if (a = d[n], !a) {
454
- s(`不存在类型为:${n} 的字典字段,请确认后再填写`);
455
- return;
456
- }
457
- const i = a.find((r) => r[l.value] === e);
458
- t(i || (g ?? ""));
459
- });
460
- else {
461
- a = c[n];
462
- const d = a.find((i) => i[l.value] === e);
463
- t(d || (g ?? ""));
464
- }
465
- }), tt = {
466
- name: "ElButtonDict"
467
- }, Te = /* @__PURE__ */ H({
468
- ...tt,
469
- props: {
470
- value: {
471
- type: [String, Number],
472
- required: !0
473
- },
474
- dictType: {
475
- type: [String],
476
- required: !0
477
- },
478
- //请求的码表值
479
- judgeTypeFun: {
480
- type: Function
481
- },
482
- type: {
483
- type: String,
484
- default: ""
485
- },
486
- judgeColorFun: {
487
- type: Function
488
- },
489
- color: {
490
- type: String,
491
- default: ""
492
- },
493
- judgeDisabledFun: {
494
- type: Function
495
- },
496
- disabled: {
497
- type: Boolean
498
- }
499
- },
500
- setup(e, { expose: n }) {
501
- const g = e, { value: t, dictType: s, judgeTypeFun: l, type: c, judgeColorFun: a, color: d, judgeDisabledFun: i, disabled: r } = Le(g), b = P(o.state.dictConfig), T = N(() => l != null && l.value ? l.value(t.value) : c.value ? c.value : O.value && O.value[b.format.type] ? O.value[b.format.type] : "primary"), h = N(() => a != null && a.value ? a.value(t.value) : d != null && d.value ? d.value : O.value && O.value[b.format.color] ? O.value[b.format.color] : ""), I = N(() => O.value && O.value[b.format.disabled] ? O.value[b.format.disabled] : i != null && i.value ? i.value(t.value) : !!r.value);
502
- let O = k(null), F = k(null);
503
- Ve(() => {
504
- pe(t.value, s.value).then((v) => {
505
- O.value = v, F.value = v[b.format.label];
506
- });
507
- });
508
- const E = k(null);
509
- return n({ getRef: () => E.value }), (v, m) => {
510
- const f = $("el-button");
511
- return G(), w(f, ie({
512
- ref_key: "ElButtonDict",
513
- ref: E,
514
- type: S(T),
515
- color: S(h),
516
- disabled: S(I)
517
- }, v.$attrs), Q({
518
- default: L(() => [
519
- K(U(S(F)), 1)
520
- ]),
521
- _: 2
522
- }, [
523
- x(v.$slots, (u, D, p) => ({
524
- name: D,
525
- fn: L((y) => [
526
- M(v.$slots, D, W(X(y)))
527
- ])
528
- }))
529
- ]), 1040, ["type", "color", "disabled"]);
530
- };
531
- }
532
- });
533
- Te.install = function(e) {
534
- e.component(Te.name, Te);
535
- };
536
- const nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
537
- __proto__: null,
538
- default: Te
539
- }, Symbol.toStringTag, { value: "Module" })), ye = (e, n, g) => {
540
- const t = {
541
- idField: "id",
542
- //唯一标识字段名
543
- parentIdField: "parentId",
544
- //父节点唯一标识字段名
545
- childrenField: "children",
546
- //子节点标识字段名
547
- firstId: "0",
548
- // 根节点值
549
- labelField: "label",
550
- //label字段名
551
- labelArrField: "labelArr",
552
- //给对象新增的中文数组字段名
553
- idArrField: "idArr",
554
- //给对象新增的id数组字段名
555
- levelField: "level",
556
- //给对象新增的层级字段名
557
- level: 0,
558
- // 给根目录配置的层级
559
- leafField: "leaf"
560
- //叶子节点标识字段名
561
- };
562
- n && Object.assign(t, n), g || (g = {
563
- [t.idField]: t.firstId,
564
- [t.levelField]: t.level,
565
- [t.labelArrField]: [],
566
- [t.idArrField]: []
567
- });
568
- for (var s = [], l, c = 0; c < e.length; c++)
569
- if (e[c][t.parentIdField] === g[t.idField]) {
570
- var a = e[c];
571
- a[t.levelField] = g[t.levelField] + 1, a[t.labelArrField] = g[t.labelArrField].concat(a[t.labelField]), a[t.idArrField] = g[t.idArrField].concat(a[t.idField]), l = ye(e, n, a), l.length > 0 ? (a[t.childrenField] = l, a[t.leafField] = !1) : a[t.leafField] = !0, s.push(a);
572
- }
573
- return s;
574
- }, le = (e, n, g) => {
575
- const t = {
576
- idField: "id",
577
- //唯一标识字段名
578
- parentIdField: "parentId"
579
- //父节点唯一标识字段名
580
- };
581
- Object.assign(t, g);
582
- const s = n.find((l) => l[t.idField] === e);
583
- return s ? le(s[t.parentIdField], n, t).concat([s]) : [];
584
- }, oe = (e, n, g) => {
585
- const t = {
586
- idField: "id",
587
- labelField: "label",
588
- //唯一标识字段名
589
- parentIdField: "parentId"
590
- //父节点唯一标识字段名
591
- };
592
- Object.assign(t, g);
593
- const s = n.find((l) => l[t.labelField] === e);
594
- return le(s[t.idField], n, t);
595
- }, it = {
596
- name: "ElCascaderDict"
597
- }, _e = /* @__PURE__ */ H({
598
- ...it,
599
- props: {
600
- //最大层级
601
- maxLevel: {
602
- type: [Number, String]
603
- },
604
- dictType: {
605
- type: [String, Object],
606
- required: !0
607
- },
608
- disableObj: {
609
- type: Object
610
- },
611
- //过滤函数
612
- filterDataFun: {
613
- type: Function
614
- },
615
- //禁用函数
616
- disabledDataFun: {
617
- type: Function
618
- }
619
- },
620
- emits: ["dictChange"],
621
- setup(e, { expose: n, emit: g }) {
622
- const { maxLevel: t, dictType: s, disableObj: l, filterDataFun: c, disabledDataFun: a } = e, d = me(), i = k(""), r = P(o.state.dictConfig), b = P(o.state.dictCodes), T = (u) => {
623
- g("dictChange", u);
624
- }, h = ae({
625
- list: []
626
- }), I = (u, D) => {
627
- for (let p = 0; p < u.length; p++) {
628
- const y = u[p];
629
- if (y[r.treeSetting.levelField] === D) {
630
- delete y[C.value.children], y[C.value.leaf] = !0;
631
- continue;
632
- } else
633
- I(y[C.value.children], D);
634
- }
635
- }, O = async () => {
636
- if (!s)
637
- return;
638
- let u = [];
639
- if (typeof s == "object") {
640
- i.value = s.type, await o.actions.getDictDataObj(i.value), u = [].concat(b[i.value]);
641
- const {
642
- filters: D,
643
- filterType: p = r.format.value,
644
- reverse: y = !1
645
- } = s, _ = typeof D == "string" ? D.split(",") : D;
646
- y ? u = u.filter((j) => !_.includes(j[p])) : u = u.filter((j) => _.includes(j[p]));
647
- } else
648
- i.value = s, await o.actions.getDictDataObj(i.value), u = [].concat(b[i.value]);
649
- if (c && (u = c(u)), a && (u = u.map((D) => ({
650
- ...D,
651
- [r.format.disabled]: !!D[r.format.disabled] || a(D)
652
- }))), l) {
653
- const {
654
- disableValue: D,
655
- disableType: p = r.format.value,
656
- reverse: y = !1
657
- } = l, _ = typeof D == "string" ? D.split(",") : D;
658
- y ? u = u.map((j) => {
659
- const V = JSON.parse(JSON.stringify(j));
660
- return V[r.format.disabled] = !_.includes(V[p]) || V[r.format.disabled], V;
661
- }) : u = u.map((j) => {
662
- const V = JSON.parse(JSON.stringify(j));
663
- return V[r.format.disabled] = _.includes(V[p]) || V[r.format.disabled], V;
664
- });
665
- }
666
- h.list = u;
667
- }, F = N(() => o.state.isGettingDictTypes.includes(i.value)), E = N(() => o.state.isGettingAllDictTypes), C = N(() => {
668
- const u = d.props ?? {};
669
- return u.disabled = u.disabled ?? r.format.disabled, u.value = u.value ?? r.treeSetting.idField, u.label = u.label ?? r.treeSetting.labelField, u.children = u.children ?? r.treeSetting.childrenField, u.leaf = u.leaf ?? r.treeSetting.leafField, u;
670
- }), v = N(() => {
671
- const u = d.props ?? {}, D = {
672
- idField: u.value ?? r.treeSetting.idField,
673
- labelField: u.label ?? r.treeSetting.labelField,
674
- childrenField: u.children ?? r.treeSetting.childrenField,
675
- leafField: u.leaf ?? r.treeSetting.leafField
676
- }, p = Object.assign(r.treeSetting, D), y = JSON.parse(JSON.stringify(h.list)), _ = ye(y, p);
677
- return t && I(_, +t), _;
678
- });
679
- re(
680
- [F, E],
681
- ([u], [D]) => {
682
- !u && !D && O();
683
- },
684
- {
685
- immediate: !0
686
- }
687
- );
688
- const m = k(null);
689
- return n({ getRef: () => m.value }), (u, D) => {
690
- const p = $("el-cascader");
691
- return G(), w(p, {
692
- ref_key: "ElCascaderDict",
693
- ref: m,
694
- options: S(v),
695
- props: S(C),
696
- onChange: T
697
- }, Q({ _: 2 }, [
698
- x(u.$slots, (y, _, j) => ({
699
- name: _,
700
- fn: L((V) => [
701
- M(u.$slots, _, W(X(V)))
702
- ])
703
- }))
704
- ]), 1032, ["options", "props"]);
705
- };
706
- }
707
- });
708
- _e.install = function(e) {
709
- e.component(_e.name, _e);
710
- };
711
- const at = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
712
- __proto__: null,
713
- default: _e
714
- }, Symbol.toStringTag, { value: "Module" })), lt = {
715
- name: "ElCheckboxButtonDict"
716
- }, ve = /* @__PURE__ */ H({
717
- ...lt,
718
- props: {
719
- dictType: {
720
- type: [String, Object],
721
- required: !0
722
- },
723
- disableObj: {
724
- type: Object
725
- },
726
- //原生 name 属性
727
- name: {
728
- type: String,
729
- default: ""
730
- },
731
- //设置 当前是否勾选
732
- checked: {
733
- type: Boolean,
734
- default: !1
735
- },
736
- //选中时的值
737
- trueValue: {
738
- type: [String, Number],
739
- default: ""
740
- },
741
- //没有选中时的值
742
- falseValue: {
743
- type: [String, Number],
744
- default: ""
745
- },
746
- //选中时的值
747
- trueLabel: {
748
- type: [String, Number],
749
- default: ""
750
- },
751
- //没有选中时的值
752
- falseLabel: {
753
- type: [String, Number],
754
- default: ""
755
- },
756
- //是否返回键值
757
- keyValue: {
758
- type: Boolean,
759
- default: !1
760
- },
761
- //过滤函数
762
- filterDataFun: {
763
- type: Function
764
- },
765
- //禁用函数
766
- disabledDataFun: {
767
- type: Function
768
- }
769
- },
770
- emits: ["dictChange"],
771
- setup(e, { expose: n, emit: g }) {
772
- const {
773
- dictType: t,
774
- disableObj: s,
775
- name: l,
776
- checked: c,
777
- trueValue: a,
778
- falseValue: d,
779
- trueLabel: i,
780
- falseLabel: r,
781
- keyValue: b,
782
- filterDataFun: T,
783
- disabledDataFun: h
784
- } = e, I = k(""), O = P(o.state.dictConfig), F = P(o.state.dictCodes), E = (p) => {
785
- if (!b) {
786
- g("dictChange", p);
787
- return;
788
- }
789
- const y = C.list.filter((_) => p.includes(_[O.format.value]));
790
- g("dictChange", y);
791
- }, C = ae({
792
- list: []
793
- }), v = async () => {
794
- if (!t)
795
- return;
796
- let p = [];
797
- if (typeof t == "object") {
798
- I.value = t.type, await o.actions.getDictDataObj(I.value), p = [].concat(F[I.value]);
799
- const {
800
- filters: y,
801
- filterType: _ = O.format.value,
802
- reverse: j = !1
803
- } = t, V = typeof y == "string" ? y.split(",") : y;
804
- j ? p = p.filter((B) => !V.includes(B[_])) : p = p.filter((B) => V.includes(B[_]));
805
- } else
806
- I.value = t, await o.actions.getDictDataObj(I.value), p = [].concat(F[I.value]);
807
- if (T && (p = T(p)), h && (p = p.map((y) => ({
808
- ...y,
809
- [O.format.disabled]: !!y[O.format.disabled] || h(y)
810
- }))), s) {
811
- const {
812
- disableValue: y,
813
- disableType: _ = O.format.value,
814
- reverse: j = !1
815
- } = s, V = typeof y == "string" ? y.split(",") : y;
816
- j ? p = p.map((B) => {
817
- const A = JSON.parse(JSON.stringify(B));
818
- return A[O.format.disabled] = !V.includes(A[_]) || A[O.format.disabled], A;
819
- }) : p = p.map((B) => {
820
- const A = JSON.parse(JSON.stringify(B));
821
- return A[O.format.disabled] = V.includes(A[_]) || A[O.format.disabled], A;
822
- });
823
- }
824
- C.list = p;
825
- }, m = N(() => o.state.isGettingDictTypes.includes(I.value)), f = N(() => o.state.isGettingAllDictTypes);
826
- re(
827
- [m, f],
828
- ([p], [y]) => {
829
- !p && !y && v();
830
- },
831
- {
832
- immediate: !0
833
- }
834
- );
835
- const u = k(null);
836
- return n({ getRef: () => u.value }), (p, y) => {
837
- const _ = $("el-checkbox-button"), j = $("el-checkbox-group");
838
- return G(), w(j, ie({
839
- ref_key: "ElCheckboxButtonDict",
840
- ref: u
841
- }, p.$attrs, { onChange: E }), Q({
842
- default: L(() => [
843
- (G(!0), te(ne, null, x(C.list, (V) => (G(), w(_, {
844
- key: V[S(O).format.value],
845
- disabled: V[S(O).format.disabled],
846
- label: V[S(O).format.value],
847
- name: e.name,
848
- "true-value": e.trueValue,
849
- "false-value": e.falseValue,
850
- "true-label": e.trueLabel,
851
- "false-label": e.falseLabel,
852
- checked: e.checked
853
- }, {
854
- default: L(() => [
855
- K(U(V[S(O).format.label]), 1)
856
- ]),
857
- _: 2
858
- }, 1032, ["disabled", "label", "name", "true-value", "false-value", "true-label", "false-label", "checked"]))), 128))
859
- ]),
860
- _: 2
861
- }, [
862
- x(p.$slots, (V, B, A) => ({
863
- name: B,
864
- fn: L((J) => [
865
- M(p.$slots, B, W(X(J)))
866
- ])
867
- }))
868
- ]), 1040);
869
- };
870
- }
871
- });
872
- ve.install = function(e) {
873
- e.component(ve.name, ve);
874
- };
875
- const rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
876
- __proto__: null,
877
- default: ve
878
- }, Symbol.toStringTag, { value: "Module" })), st = {
879
- name: "ElCheckboxDict"
880
- }, Se = /* @__PURE__ */ H({
881
- ...st,
882
- props: {
883
- dictType: {
884
- type: [String, Object],
885
- required: !0
886
- },
887
- disableObj: {
888
- type: Object
889
- },
890
- //是否显示边框
891
- border: {
892
- type: Boolean,
893
- default: !1
894
- },
895
- //radio 的尺寸,仅在 border 为真时有效 medium / small / mini
896
- size: {
897
- type: String,
898
- default: ""
899
- },
900
- //原生 name 属性
901
- name: {
902
- type: String,
903
- default: ""
904
- },
905
- //设置 当前是否勾选
906
- checked: {
907
- type: Boolean,
908
- default: !1
909
- },
910
- //设置 indeterminate 状态,只负责样式控制
911
- indeterminate: {
912
- type: Boolean,
913
- default: !1
914
- },
915
- //选中时的值
916
- trueValue: {
917
- type: [String, Number],
918
- default: ""
919
- },
920
- //没有选中时的值
921
- falseValue: {
922
- type: [String, Number],
923
- default: ""
924
- },
925
- //选中时的值
926
- trueLabel: {
927
- type: [String, Number],
928
- default: ""
929
- },
930
- //没有选中时的值
931
- falseLabel: {
932
- type: [String, Number],
933
- default: ""
934
- },
935
- //是否返回键值
936
- keyValue: {
937
- type: Boolean,
938
- default: !1
939
- },
940
- //过滤函数
941
- filterDataFun: {
942
- type: Function
943
- },
944
- //禁用函数
945
- disabledDataFun: {
946
- type: Function
947
- },
948
- validateEvent: {
949
- type: Boolean
950
- },
951
- tabindex: {
952
- type: [String, Number]
953
- },
954
- id: {
955
- type: String
956
- }
957
- },
958
- emits: ["dictChange"],
959
- setup(e, { expose: n, emit: g }) {
960
- const {
961
- dictType: t,
962
- disableObj: s,
963
- border: l,
964
- size: c,
965
- name: a,
966
- checked: d,
967
- indeterminate: i,
968
- trueValue: r,
969
- falseValue: b,
970
- trueLabel: T,
971
- falseLabel: h,
972
- keyValue: I,
973
- filterDataFun: O,
974
- disabledDataFun: F,
975
- validateEvent: E,
976
- tabindex: C,
977
- id: v
978
- } = e, m = k(""), f = P(o.state.dictConfig), u = P(o.state.dictCodes), D = (A) => {
979
- if (!I) {
980
- g("dictChange", A);
981
- return;
982
- }
983
- const J = p.list.find((q) => A.includes(q[f.format.value]));
984
- g("dictChange", J);
985
- }, p = ae({
986
- list: []
987
- }), y = async () => {
988
- if (!t)
989
- return;
990
- let A = [];
991
- if (typeof t == "object") {
992
- m.value = t.type, await o.actions.getDictDataObj(m.value), A = [].concat(u[m.value]);
993
- const {
994
- filters: J,
995
- filterType: q = f.format.value,
996
- reverse: se = !1
997
- } = t, z = typeof J == "string" ? J.split(",") : J;
998
- se ? A = A.filter((Z) => !z.includes(Z[q])) : A = A.filter((Z) => z.includes(Z[q]));
999
- } else
1000
- m.value = t, await o.actions.getDictDataObj(m.value), A = [].concat(u[m.value]);
1001
- if (O && (A = O(A)), F && (A = A.map((J) => ({
1002
- ...J,
1003
- [f.format.disabled]: !!J[f.format.disabled] || F(J)
1004
- }))), s) {
1005
- const {
1006
- disableValue: J,
1007
- disableType: q = f.format.value,
1008
- reverse: se = !1
1009
- } = s, z = typeof J == "string" ? J.split(",") : J;
1010
- se ? A = A.map((Z) => {
1011
- const ee = JSON.parse(JSON.stringify(Z));
1012
- return ee[f.format.disabled] = !z.includes(ee[q]) || ee[f.format.disabled], ee;
1013
- }) : A = A.map((Z) => {
1014
- const ee = JSON.parse(JSON.stringify(Z));
1015
- return ee[f.format.disabled] = z.includes(ee[q]) || ee[f.format.disabled], ee;
1016
- });
1017
- }
1018
- p.list = A;
1019
- }, _ = N(() => o.state.isGettingDictTypes.includes(m.value)), j = N(() => o.state.isGettingAllDictTypes);
1020
- re(
1021
- [_, j],
1022
- ([A], [J]) => {
1023
- !A && !J && y();
1024
- },
1025
- {
1026
- immediate: !0
1027
- }
1028
- );
1029
- const V = k(null);
1030
- return n({ getRef: () => V.value }), (A, J) => {
1031
- const q = $("el-checkbox"), se = $("el-checkbox-group");
1032
- return G(), w(se, ie({
1033
- ref_key: "ElCheckboxDict",
1034
- ref: V
1035
- }, A.$attrs, { onChange: D }), Q({
1036
- default: L(() => [
1037
- (G(!0), te(ne, null, x(p.list, (z) => (G(), w(q, {
1038
- key: z[S(f).format.value],
1039
- label: z[S(f).format.value],
1040
- "true-value": e.trueValue,
1041
- "false-value": e.falseValue,
1042
- "true-label": e.trueLabel,
1043
- "false-label": e.falseLabel,
1044
- disabled: z[S(f).format.disabled],
1045
- border: e.border,
1046
- size: e.size,
1047
- name: e.name,
1048
- checked: e.checked,
1049
- indeterminate: e.indeterminate,
1050
- "validate-event": e.validateEvent,
1051
- tabindex: e.tabindex,
1052
- id: e.id
1053
- }, {
1054
- default: L(() => [
1055
- K(U(z[S(f).format.label]), 1)
1056
- ]),
1057
- _: 2
1058
- }, 1032, ["label", "true-value", "false-value", "true-label", "false-label", "disabled", "border", "size", "name", "checked", "indeterminate", "validate-event", "tabindex", "id"]))), 128))
1059
- ]),
1060
- _: 2
1061
- }, [
1062
- x(A.$slots, (z, Z, ee) => ({
1063
- name: Z,
1064
- fn: L((De) => [
1065
- M(A.$slots, Z, W(X(De)))
1066
- ])
1067
- }))
1068
- ]), 1040);
1069
- };
1070
- }
1071
- });
1072
- Se.install = function(e) {
1073
- e.component(Se.name, Se);
1074
- };
1075
- const ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1076
- __proto__: null,
1077
- default: Se
1078
- }, Symbol.toStringTag, { value: "Module" })), ct = {
1079
- name: "ElLinkDict"
1080
- }, Fe = /* @__PURE__ */ H({
1081
- ...ct,
1082
- props: {
1083
- value: {
1084
- type: [String, Number],
1085
- required: !0
1086
- },
1087
- dictType: {
1088
- type: [String],
1089
- required: !0
1090
- },
1091
- //请求的码表值
1092
- judgeTypeFun: {
1093
- type: Function
1094
- },
1095
- type: {
1096
- type: String,
1097
- default: ""
1098
- },
1099
- judgeDisabledFun: {
1100
- type: Function
1101
- },
1102
- disabled: {
1103
- type: Boolean
1104
- }
1105
- },
1106
- setup(e, { expose: n }) {
1107
- const g = e, { value: t, dictType: s, judgeTypeFun: l, type: c, judgeDisabledFun: a, disabled: d } = Le(g), i = P(o.state.dictConfig), r = N(() => l != null && l.value ? l.value(t.value) : c.value ? c.value : T.value && T.value[i.format.type] ? T.value[i.format.type] : "primary"), b = N(() => T.value && T.value[i.format.disabled] ? T.value[i.format.disabled] : a != null && a.value ? a.value(t.value) : !!d.value);
1108
- let T = k(null), h = k(null);
1109
- Ve(() => {
1110
- pe(t.value, s.value).then((F) => {
1111
- T.value = F, h.value = F[i.format.label];
1112
- });
1113
- });
1114
- const I = k(null);
1115
- return n({ getRef: () => I.value }), (F, E) => {
1116
- const C = $("el-link");
1117
- return G(), w(C, ie({
1118
- ref_key: "ElLinkDict",
1119
- ref: I,
1120
- type: S(r),
1121
- disabled: S(b)
1122
- }, F.$attrs), Q({
1123
- default: L(() => [
1124
- K(" " + U(S(h)), 1)
1125
- ]),
1126
- _: 2
1127
- }, [
1128
- x(F.$slots, (v, m, f) => ({
1129
- name: m,
1130
- fn: L((u) => [
1131
- M(F.$slots, m, W(X(u)))
1132
- ])
1133
- }))
1134
- ]), 1040, ["type", "disabled"]);
1135
- };
1136
- }
1137
- });
1138
- Fe.install = function(e) {
1139
- e.component(Fe.name, Fe);
1140
- };
1141
- const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1142
- __proto__: null,
1143
- default: Fe
1144
- }, Symbol.toStringTag, { value: "Module" })), dt = {
1145
- name: "ElRadioButtonDict"
1146
- }, Oe = /* @__PURE__ */ H({
1147
- ...dt,
1148
- props: {
1149
- dictType: {
1150
- type: [String, Object],
1151
- required: !0
1152
- },
1153
- disableObj: {
1154
- type: Object
1155
- },
1156
- //原生 name 属性
1157
- name: {
1158
- type: String,
1159
- default: ""
1160
- },
1161
- //是否返回键值
1162
- keyValue: {
1163
- type: Boolean,
1164
- default: !1
1165
- },
1166
- //过滤函数
1167
- filterDataFun: {
1168
- type: Function
1169
- },
1170
- //禁用函数
1171
- disabledDataFun: {
1172
- type: Function
1173
- }
1174
- },
1175
- emits: ["dictChange"],
1176
- setup(e, { expose: n, emit: g }) {
1177
- const {
1178
- dictType: t,
1179
- disableObj: s,
1180
- name: l,
1181
- keyValue: c,
1182
- filterDataFun: a,
1183
- disabledDataFun: d
1184
- } = e, i = k(""), r = P(o.state.dictConfig), b = P(o.state.dictCodes), T = (v) => {
1185
- if (!c) {
1186
- g("dictChange", v);
1187
- return;
1188
- }
1189
- const m = h.list.find((f) => f[r.format.value] === v);
1190
- g("dictChange", m);
1191
- }, h = ae({
1192
- list: []
1193
- }), I = async () => {
1194
- if (!t)
1195
- return;
1196
- let v = [];
1197
- if (typeof t == "object") {
1198
- i.value = t.type, await o.actions.getDictDataObj(i.value), v = [].concat(b[i.value]);
1199
- const {
1200
- filters: m,
1201
- filterType: f = r.format.value,
1202
- reverse: u = !1
1203
- } = t, D = typeof m == "string" ? m.split(",") : m;
1204
- u ? v = v.filter((p) => !D.includes(p[f])) : v = v.filter((p) => D.includes(p[f]));
1205
- } else
1206
- i.value = t, await o.actions.getDictDataObj(i.value), v = [].concat(b[i.value]);
1207
- if (a && (v = a(v)), d && (v = v.map((m) => ({
1208
- ...m,
1209
- [r.format.disabled]: !!m[r.format.disabled] || d(m)
1210
- }))), s) {
1211
- const {
1212
- disableValue: m,
1213
- disableType: f = r.format.value,
1214
- reverse: u = !1
1215
- } = s, D = typeof m == "string" ? m.split(",") : m;
1216
- u ? v = v.map((p) => {
1217
- const y = JSON.parse(JSON.stringify(p));
1218
- return y[r.format.disabled] = !D.includes(y[f]) || y[r.format.disabled], y;
1219
- }) : v = v.map((p) => {
1220
- const y = JSON.parse(JSON.stringify(p));
1221
- return y[r.format.disabled] = D.includes(y[f]) || y[r.format.disabled], y;
1222
- });
1223
- }
1224
- h.list = v;
1225
- }, O = N(() => o.state.isGettingDictTypes.includes(i.value)), F = N(() => o.state.isGettingAllDictTypes);
1226
- re(
1227
- [O, F],
1228
- ([v], [m]) => {
1229
- !v && !m && I();
1230
- },
1231
- {
1232
- immediate: !0
1233
- }
1234
- );
1235
- const E = k(null);
1236
- return n({ getRef: () => E.value }), (v, m) => {
1237
- const f = $("el-radio-button"), u = $("el-radio-group");
1238
- return G(), w(u, ie({
1239
- ref_key: "ElRadioButtonDict",
1240
- ref: E
1241
- }, v.$attrs, { onChange: T }), Q({
1242
- default: L(() => [
1243
- (G(!0), te(ne, null, x(h.list, (D) => (G(), w(f, {
1244
- key: D[S(r).format.value],
1245
- disabled: D[S(r).format.disabled],
1246
- label: D[S(r).format.value],
1247
- name: e.name
1248
- }, {
1249
- default: L(() => [
1250
- K(U(D[S(r).format.label]), 1)
1251
- ]),
1252
- _: 2
1253
- }, 1032, ["disabled", "label", "name"]))), 128))
1254
- ]),
1255
- _: 2
1256
- }, [
1257
- x(v.$slots, (D, p, y) => ({
1258
- name: p,
1259
- fn: L((_) => [
1260
- M(v.$slots, p, W(X(_)))
1261
- ])
1262
- }))
1263
- ]), 1040);
1264
- };
1265
- }
1266
- });
1267
- Oe.install = function(e) {
1268
- e.component(Oe.name, Oe);
1269
- };
1270
- const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1271
- __proto__: null,
1272
- default: Oe
1273
- }, Symbol.toStringTag, { value: "Module" })), gt = {
1274
- name: "ElRadioDict"
1275
- }, Ce = /* @__PURE__ */ H({
1276
- ...gt,
1277
- props: {
1278
- dictType: {
1279
- type: [String, Object],
1280
- required: !0
1281
- },
1282
- disableObj: {
1283
- type: Object
1284
- },
1285
- //是否显示边框
1286
- border: {
1287
- type: Boolean,
1288
- default: !1
1289
- },
1290
- //radio 的尺寸,仅在 border 为真时有效 medium / small / mini
1291
- size: {
1292
- type: String,
1293
- default: ""
1294
- },
1295
- //原生 name 属性
1296
- name: {
1297
- type: String,
1298
- default: ""
1299
- },
1300
- //是否返回键值
1301
- keyValue: {
1302
- type: Boolean,
1303
- default: !1
1304
- },
1305
- //过滤函数
1306
- filterDataFun: {
1307
- type: Function
1308
- },
1309
- //禁用函数
1310
- disabledDataFun: {
1311
- type: Function
1312
- }
1313
- },
1314
- emits: ["dictChange"],
1315
- setup(e, { expose: n, emit: g }) {
1316
- const {
1317
- dictType: t,
1318
- disableObj: s,
1319
- border: l,
1320
- size: c,
1321
- name: a,
1322
- keyValue: d,
1323
- filterDataFun: i,
1324
- disabledDataFun: r
1325
- } = e, b = k(""), T = P(o.state.dictConfig), h = P(o.state.dictCodes), I = (f) => {
1326
- if (!d) {
1327
- g("dictChange", f);
1328
- return;
1329
- }
1330
- const u = O.list.find((D) => D[T.format.value] === f);
1331
- g("dictChange", u);
1332
- }, O = ae({
1333
- list: []
1334
- }), F = async () => {
1335
- if (!t)
1336
- return;
1337
- let f = [];
1338
- if (typeof t == "object") {
1339
- b.value = t.type, await o.actions.getDictDataObj(b.value), f = [].concat(h[b.value]);
1340
- const {
1341
- filters: u,
1342
- filterType: D = T.format.value,
1343
- reverse: p = !1
1344
- } = t, y = typeof u == "string" ? u.split(",") : u;
1345
- p ? f = f.filter((_) => !y.includes(_[D])) : f = f.filter((_) => y.includes(_[D]));
1346
- } else
1347
- b.value = t, await o.actions.getDictDataObj(b.value), f = [].concat(h[b.value]);
1348
- if (i && (f = i(f)), r && (f = f.map((u) => ({
1349
- ...u,
1350
- [T.format.disabled]: !!u[T.format.disabled] || r(u)
1351
- }))), s) {
1352
- const {
1353
- disableValue: u,
1354
- disableType: D = T.format.value,
1355
- reverse: p = !1
1356
- } = s, y = typeof u == "string" ? u.split(",") : u;
1357
- p ? f = f.map((_) => {
1358
- const j = JSON.parse(JSON.stringify(_));
1359
- return j[T.format.disabled] = !y.includes(j[D]) || j[T.format.disabled], j;
1360
- }) : f = f.map((_) => {
1361
- const j = JSON.parse(JSON.stringify(_));
1362
- return j[T.format.disabled] = y.includes(j[D]) || j[T.format.disabled], j;
1363
- });
1364
- }
1365
- O.list = f;
1366
- }, E = N(() => o.state.isGettingDictTypes.includes(b.value)), C = N(() => o.state.isGettingAllDictTypes);
1367
- re(
1368
- [E, C],
1369
- ([f], [u]) => {
1370
- !f && !u && F();
1371
- },
1372
- {
1373
- immediate: !0
1374
- }
1375
- );
1376
- const v = k(null);
1377
- return n({ getRef: () => v.value }), (f, u) => {
1378
- const D = $("el-radio"), p = $("el-radio-group");
1379
- return G(), w(p, ie({
1380
- ref_key: "ElRadioDict",
1381
- ref: v
1382
- }, f.$attrs, { onChange: I }), Q({
1383
- default: L(() => [
1384
- (G(!0), te(ne, null, x(O.list, (y) => (G(), w(D, {
1385
- key: y[S(T).format.value],
1386
- disabled: y[S(T).format.disabled],
1387
- label: y[S(T).format.value],
1388
- border: e.border,
1389
- size: e.size,
1390
- name: e.name
1391
- }, {
1392
- default: L(() => [
1393
- K(U(y[S(T).format.label]), 1)
1394
- ]),
1395
- _: 2
1396
- }, 1032, ["disabled", "label", "border", "size", "name"]))), 128))
1397
- ]),
1398
- _: 2
1399
- }, [
1400
- x(f.$slots, (y, _, j) => ({
1401
- name: _,
1402
- fn: L((V) => [
1403
- M(f.$slots, _, W(X(V)))
1404
- ])
1405
- }))
1406
- ]), 1040);
1407
- };
1408
- }
1409
- });
1410
- Ce.install = function(e) {
1411
- e.component(Ce.name, Ce);
1412
- };
1413
- const bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1414
- __proto__: null,
1415
- default: Ce
1416
- }, Symbol.toStringTag, { value: "Module" })), mt = {
1417
- name: "ElSelectDict"
1418
- }, he = /* @__PURE__ */ H({
1419
- ...mt,
1420
- props: {
1421
- dictType: {
1422
- type: [String, Object],
1423
- required: !0
1424
- },
1425
- disableObj: {
1426
- type: Object
1427
- },
1428
- //是否返回键值
1429
- keyValue: {
1430
- type: Boolean,
1431
- default: !1
1432
- },
1433
- //过滤函数
1434
- filterDataFun: {
1435
- type: Function
1436
- },
1437
- //禁用函数
1438
- disabledDataFun: {
1439
- type: Function
1440
- }
1441
- },
1442
- emits: ["dictChange"],
1443
- setup(e, { expose: n, emit: g }) {
1444
- const { dictType: t, disableObj: s, keyValue: l, filterDataFun: c, disabledDataFun: a } = e, d = k(""), i = P(o.state.dictConfig), r = P(o.state.dictCodes), b = (C) => {
1445
- g("dictChange", C);
1446
- }, T = ae({
1447
- list: []
1448
- }), h = async () => {
1449
- if (!t)
1450
- return;
1451
- let C = [];
1452
- if (typeof t == "object") {
1453
- d.value = t.type, await o.actions.getDictDataObj(d.value), C = [].concat(r[d.value]);
1454
- const {
1455
- filters: v,
1456
- filterType: m = i.format.value,
1457
- reverse: f = !1
1458
- } = t, u = typeof v == "string" ? v.split(",") : v;
1459
- f ? C = C.filter((D) => !u.includes(D[m])) : C = C.filter((D) => u.includes(D[m]));
1460
- } else
1461
- d.value = t, await o.actions.getDictDataObj(d.value), C = [].concat(r[d.value]);
1462
- if (c && (C = c(C)), a && (C = C.map((v) => ({
1463
- ...v,
1464
- [i.format.disabled]: !!v[i.format.disabled] || a(v)
1465
- }))), s) {
1466
- const {
1467
- disableValue: v,
1468
- disableType: m = i.format.value,
1469
- reverse: f = !1
1470
- } = s, u = typeof v == "string" ? v.split(",") : v;
1471
- f ? C = C.map((D) => {
1472
- const p = JSON.parse(JSON.stringify(D));
1473
- return p[i.format.disabled] = !u.includes(p[m]) || p[i.format.disabled], p;
1474
- }) : C = C.map((D) => {
1475
- const p = JSON.parse(JSON.stringify(D));
1476
- return p[i.format.disabled] = u.includes(p[m]) || p[i.format.disabled], p;
1477
- });
1478
- }
1479
- T.list = C;
1480
- }, I = N(() => o.state.isGettingDictTypes.includes(d.value)), O = N(() => o.state.isGettingAllDictTypes);
1481
- re(
1482
- [I, O],
1483
- ([C], [v]) => {
1484
- !C && !v && h();
1485
- },
1486
- {
1487
- immediate: !0
1488
- }
1489
- );
1490
- const F = k(null);
1491
- return n({ getRef: () => F.value }), (C, v) => {
1492
- const m = $("el-option"), f = $("el-select");
1493
- return G(), w(f, ie({
1494
- ref_key: "ElSelectDict",
1495
- ref: F
1496
- }, C.$attrs, {
1497
- "value-key": e.keyValue ? S(i).format.label : "",
1498
- onChange: b
1499
- }), Q({
1500
- default: L(() => [
1501
- (G(!0), te(ne, null, x(T.list, (u) => (G(), w(m, {
1502
- key: u[S(i).format.value],
1503
- disabled: u[S(i).format.disabled],
1504
- label: u[S(i).format.label],
1505
- value: e.keyValue ? u : u[S(i).format.value]
1506
- }, null, 8, ["disabled", "label", "value"]))), 128))
1507
- ]),
1508
- _: 2
1509
- }, [
1510
- x(C.$slots, (u, D, p) => ({
1511
- name: D,
1512
- fn: L((y) => [
1513
- M(C.$slots, D, W(X(y)))
1514
- ])
1515
- }))
1516
- ]), 1040, ["value-key"]);
1517
- };
1518
- }
1519
- });
1520
- he.install = function(e) {
1521
- e.component(he.name, he);
1522
- };
1523
- const pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1524
- __proto__: null,
1525
- default: he
1526
- }, Symbol.toStringTag, { value: "Module" })), yt = (e, n, g) => {
1527
- const { format: t } = o.state.dictConfig, s = o.state.dictCodes;
1528
- let l = [];
1529
- if (!s || !s[n])
1530
- o.actions.getDictDataObj(n).then((c) => {
1531
- if (l = c[n], !l)
1532
- return;
1533
- const a = l.find((d) => d[t.value] === e);
1534
- return a ? a[t.label] : g ?? "";
1535
- });
1536
- else {
1537
- l = s[n];
1538
- const c = l.find((a) => a[t.value] === e);
1539
- return c ? c[t.label] : g ?? "";
1540
- }
1541
- }, we = (e, n, g) => {
1542
- const t = {
1543
- defaultVal: "",
1544
- formatFun: (d, i) => d.map((r) => r[i.label]).join(","),
1545
- spacer: ","
1546
- };
1547
- Object.assign(t, g);
1548
- let s = [];
1549
- Array.isArray(e) ? s = e : typeof e == "string" && (s = e.split(t.spacer));
1550
- const { format: l } = o.state.dictConfig, c = o.state.dictCodes;
1551
- let a = [];
1552
- if (!c || !c[n])
1553
- o.actions.getDictDataObj(n).then((d) => {
1554
- if (a = d[n], !a)
1555
- return;
1556
- const i = de(
1557
- s,
1558
- a,
1559
- l,
1560
- t.defaultVal
1561
- );
1562
- return i && i.length > 0 ? t.formatFun(i, l) : t.defaultVal;
1563
- });
1564
- else {
1565
- a = c[n];
1566
- const d = de(s, a, l, t.defaultVal);
1567
- return d && d.length > 0 ? t.formatFun(d, l) : t.defaultVal;
1568
- }
1569
- }, Dt = (e, n, g) => {
1570
- const { format: t } = o.state.dictConfig, s = o.state.dictCodes;
1571
- let l = [];
1572
- if (!s || !s[n])
1573
- o.actions.getDictDataObj(n).then((c) => {
1574
- if (l = c[n], !l)
1575
- return;
1576
- const a = l.find((d) => d[t.label] === e);
1577
- return a ? a[t.value] : g ?? "";
1578
- });
1579
- else {
1580
- l = s[n];
1581
- const c = l.find((a) => a[t.label] === e);
1582
- return c ? c[t.value] : g ?? "";
1583
- }
1584
- }, Tt = (e, n, g) => {
1585
- const t = {
1586
- defaultVal: "",
1587
- formatFun: (d, i) => d.map((r) => r[i.value]).join(","),
1588
- spacer: ","
1589
- };
1590
- Object.assign(t, g);
1591
- let s = [];
1592
- Array.isArray(e) ? s = e : typeof e == "string" && (s = e.split(t.spacer));
1593
- const { format: l } = o.state.dictConfig, c = o.state.dictCodes;
1594
- let a = [];
1595
- if (!c || !c[n])
1596
- o.actions.getDictDataObj(n).then((d) => {
1597
- if (a = d[n], !a)
1598
- return;
1599
- const i = fe(
1600
- s,
1601
- a,
1602
- l,
1603
- t.defaultVal
1604
- );
1605
- return i && i.length > 0 ? t.formatFun(i, l) : t.defaultVal;
1606
- });
1607
- else {
1608
- a = c[n];
1609
- const d = fe(s, a, l, t.defaultVal);
1610
- return d && d.length > 0 ? t.formatFun(d, l) : t.defaultVal;
1611
- }
1612
- }, _t = (e, n, g) => {
1613
- const t = {
1614
- defaultVal: "",
1615
- formatFun: (s, l) => s.map((c) => c[l.labelField]).join(","),
1616
- treeSetting: {}
1617
- };
1618
- return Object.assign(t, g), new Promise((s, l) => {
1619
- const { treeSetting: c } = o.state.dictConfig, a = Object.assign(c, t.treeSetting), d = o.state.dictCodes;
1620
- let i = [];
1621
- if (!d || !d[n])
1622
- if (o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes) {
1623
- const r = setInterval(() => {
1624
- if (!(o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes)) {
1625
- if (clearInterval(r), i = o.state.dictCodes[n], !i) {
1626
- l(`不存在类型为:${n} 的字典字段,请确认后再填写`);
1627
- return;
1628
- }
1629
- const b = i.find((T) => T[a.idField] === e);
1630
- s(b ? t.formatFun(le(b[a.idField], i, a), a) : t.defaultVal);
1631
- }
1632
- }, 1e3);
1633
- } else
1634
- o.actions.getDictDataObj(n).then((r) => {
1635
- if (i = r[n], !i) {
1636
- l(`不存在类型为:${n} 的字典字段,请确认后再填写`);
1637
- return;
1638
- }
1639
- const b = i.find((T) => T[a.idField] === e);
1640
- s(b ? t.formatFun(le(b[a.idField], i, a), a) : t.defaultVal);
1641
- });
1642
- else {
1643
- i = d[n];
1644
- const r = i.find((b) => b[a.idField] === e);
1645
- s(r ? t.formatFun(le(r[a.idField], i, a), a) : t.defaultVal);
1646
- }
1647
- });
1648
- };
1649
- function ge(e, n, g, t, s) {
1650
- const l = [];
1651
- for (let c = 0; c < e.length; c++) {
1652
- const a = n.find((d) => d[s.idField] === e[c]);
1653
- a ? l.push(t(le(a[s.idField], n, s), s)) : l.push(g);
1654
- }
1655
- return l;
1656
- }
1657
- const vt = (e, n, g) => {
1658
- const t = {
1659
- defaultVal: "",
1660
- formatFunIn: (s, l) => s.map((c) => c[l.labelField]).join("/"),
1661
- treeSetting: {},
1662
- formatFunOut: (s) => s.join(","),
1663
- spacer: ","
1664
- };
1665
- return Object.assign(t, g), new Promise((s, l) => {
1666
- let c = [];
1667
- Array.isArray(e) ? c = e : typeof e == "string" && (c = e.split(t.spacer));
1668
- const { treeSetting: a } = o.state.dictConfig, d = Object.assign(a, t.treeSetting), i = o.state.dictCodes;
1669
- let r = [];
1670
- if (!i || !i[n])
1671
- if (o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes) {
1672
- const b = setInterval(() => {
1673
- if (!(o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes)) {
1674
- if (clearInterval(b), r = o.state.dictCodes[n], !r) {
1675
- l(`不存在类型为:${n} 的字典字段,请确认后再填写`);
1676
- return;
1677
- }
1678
- const T = ge(c, r, t.defaultVal, t.formatFunIn, d);
1679
- s(T && T.length > 0 ? t.formatFunOut(T) : t.defaultVal);
1680
- }
1681
- }, 1e3);
1682
- } else
1683
- o.actions.getDictDataObj(n).then((b) => {
1684
- if (r = b[n], !r) {
1685
- l(`不存在类型为:${n} 的字典字段,请确认后再填写`);
1686
- return;
1687
- }
1688
- const T = ge(c, r, t.defaultVal, t.formatFunIn, d);
1689
- s(T && T.length > 0 ? t.formatFunOut(T) : t.defaultVal);
1690
- });
1691
- else {
1692
- r = i[n];
1693
- const b = ge(c, r, t.defaultVal, t.formatFunIn, d);
1694
- s(b && b.length > 0 ? t.formatFunOut(b) : t.defaultVal);
1695
- }
1696
- });
1697
- }, St = (e, n, g) => {
1698
- const t = {
1699
- defaultVal: "",
1700
- formatFun: (s, l) => s.map((c) => c[l.idField]).join(","),
1701
- treeSetting: {}
1702
- };
1703
- return Object.assign(t, g), new Promise((s, l) => {
1704
- const { treeSetting: c } = o.state.dictConfig, a = Object.assign(c, t.treeSetting), d = o.state.dictCodes;
1705
- let i = [];
1706
- if (!d || !d[n])
1707
- if (o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes) {
1708
- const r = setInterval(() => {
1709
- if (!(o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes)) {
1710
- if (clearInterval(r), i = o.state.dictCodes[n], !i) {
1711
- l(`不存在类型为:${n} 的字典字段,请确认后再填写`);
1712
- return;
1713
- }
1714
- const b = i.find((T) => T[a.labelField] === e);
1715
- s(b ? t.formatFun(oe(b[a.labelField], i, a), a) : t.defaultVal);
1716
- }
1717
- }, 1e3);
1718
- } else
1719
- o.actions.getDictDataObj(n).then((r) => {
1720
- if (i = r[n], !i) {
1721
- l(`不存在类型为:${n} 的字典字段,请确认后再填写`);
1722
- return;
1723
- }
1724
- const b = i.find((T) => T[a.labelField] === e);
1725
- s(b ? t.formatFun(oe(b[a.labelField], i, a), a) : t.defaultVal);
1726
- });
1727
- else {
1728
- i = d[n];
1729
- const r = i.find((b) => b[a.labelField] === e);
1730
- s(r ? t.formatFun(oe(r[a.labelField], i, a), a) : t.defaultVal);
1731
- }
1732
- });
1733
- };
1734
- function be(e, n, g, t, s) {
1735
- const l = [];
1736
- for (let c = 0; c < e.length; c++) {
1737
- const a = n.find((d) => d[s.labelField] === e[c]);
1738
- a ? l.push(t(oe(a[s.labelField], n, s), s)) : l.push(g);
1739
- }
1740
- return l;
1741
- }
1742
- const Ft = (e, n, g) => {
1743
- const t = {
1744
- defaultVal: "",
1745
- formatFunIn: (s, l) => s.map((c) => c[l.idField]).join("/"),
1746
- treeSetting: {},
1747
- formatFunOut: (s) => s.join(","),
1748
- spacer: ","
1749
- };
1750
- return Object.assign(t, g), new Promise((s, l) => {
1751
- let c = [];
1752
- Array.isArray(e) ? c = e : typeof e == "string" && (c = e.split(t.spacer));
1753
- const { treeSetting: a } = o.state.dictConfig, d = Object.assign(a, t.treeSetting), i = o.state.dictCodes;
1754
- let r = [];
1755
- if (!i || !i[n])
1756
- if (o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes) {
1757
- const b = setInterval(() => {
1758
- if (!(o.state.isGettingDictTypes.includes(n) || o.state.isGettingAllDictTypes)) {
1759
- if (clearInterval(b), r = o.state.dictCodes[n], !r) {
1760
- l(`不存在类型为:${n} 的字典字段,请确认后再填写`);
1761
- return;
1762
- }
1763
- const T = be(c, r, t.defaultVal, t.formatFunIn, d);
1764
- s(T && T.length > 0 ? t.formatFunOut(T) : t.defaultVal);
1765
- }
1766
- }, 1e3);
1767
- } else
1768
- o.actions.getDictDataObj(n).then((b) => {
1769
- if (r = b[n], !r) {
1770
- l(`不存在类型为:${n} 的字典字段,请确认后再填写`);
1771
- return;
1772
- }
1773
- const T = be(c, r, t.defaultVal, t.formatFunIn, d);
1774
- s(T && T.length > 0 ? t.formatFunOut(T) : t.defaultVal);
1775
- });
1776
- else {
1777
- r = i[n];
1778
- const b = be(c, r, t.defaultVal, t.formatFunIn, d);
1779
- s(b && b.length > 0 ? t.formatFunOut(b) : t.defaultVal);
1780
- }
1781
- });
1782
- }, Ot = (e, n, g) => {
1783
- const t = {
1784
- defaultVal: "",
1785
- formatFun: (d, i) => d.map((r) => r[i.labelField]).join(","),
1786
- treeSetting: {}
1787
- };
1788
- Object.assign(t, g);
1789
- const { treeSetting: s } = o.state.dictConfig, l = Object.assign(s, t.treeSetting), c = o.state.dictCodes;
1790
- let a = [];
1791
- if (!c || !c[n])
1792
- o.actions.getDictDataObj(n).then((d) => {
1793
- if (a = d[n], !a)
1794
- return new Error(`不存在类型为:${n} 的字典字段,请确认后再填写`);
1795
- const i = a.find((r) => r[l.idField] === e);
1796
- return i ? t.formatFun(
1797
- le(
1798
- i[l.idField],
1799
- a,
1800
- l
1801
- ),
1802
- l
1803
- ) : t.defaultVal;
1804
- });
1805
- else {
1806
- a = c[n];
1807
- const d = a.find((i) => i[l.idField] === e);
1808
- return d ? t.formatFun(
1809
- le(
1810
- d[l.idField],
1811
- a,
1812
- l
1813
- ),
1814
- l
1815
- ) : t.defaultVal;
1816
- }
1817
- }, Je = (e, n, g) => {
1818
- const t = {
1819
- defaultVal: "",
1820
- formatFunIn: (i, r) => i.map((b) => b[r.labelField]).join("/"),
1821
- treeSetting: {},
1822
- formatFunOut: (i) => i.join(","),
1823
- spacer: ","
1824
- };
1825
- Object.assign(t, g);
1826
- let s = [];
1827
- Array.isArray(e) ? s = e : typeof e == "string" && (s = e.split(t.spacer));
1828
- const { treeSetting: l } = o.state.dictConfig, c = Object.assign(l, t.treeSetting), a = o.state.dictCodes;
1829
- let d = [];
1830
- if (!a || !a[n])
1831
- o.actions.getDictDataObj(n).then((i) => {
1832
- if (d = i[n], !d)
1833
- return new Error(`不存在类型为:${n} 的字典字段,请确认后再填写`);
1834
- const r = ge(
1835
- s,
1836
- d,
1837
- t.defaultVal,
1838
- t.formatFunIn,
1839
- c
1840
- );
1841
- return r && r.length > 0 ? t.formatFunOut(r) : t.defaultVal;
1842
- });
1843
- else {
1844
- d = a[n];
1845
- const i = ge(
1846
- s,
1847
- d,
1848
- t.defaultVal,
1849
- t.formatFunIn,
1850
- c
1851
- );
1852
- return i && i.length > 0 ? t.formatFunOut(i) : t.defaultVal;
1853
- }
1854
- }, Ct = (e, n, g) => {
1855
- const t = {
1856
- defaultVal: "",
1857
- formatFun: (d, i) => d.map((r) => r[i.idField]).join(","),
1858
- treeSetting: {}
1859
- };
1860
- Object.assign(t, g);
1861
- const { treeSetting: s } = o.state.dictConfig, l = Object.assign(s, t.treeSetting), c = o.state.dictCodes;
1862
- let a = [];
1863
- if (!c || !c[n])
1864
- o.actions.getDictDataObj(n).then((d) => {
1865
- if (a = d[n], !a)
1866
- return new Error(`不存在类型为:${n} 的字典字段,请确认后再填写`);
1867
- const i = a.find((r) => r[l.labelField] === e);
1868
- return i ? t.formatFun(
1869
- oe(
1870
- i[l.labelField],
1871
- a,
1872
- l
1873
- ),
1874
- l
1875
- ) : t.defaultVal;
1876
- });
1877
- else {
1878
- a = c[n];
1879
- const d = a.find((i) => i[l.labelField] === e);
1880
- return d ? t.formatFun(
1881
- oe(
1882
- d[l.labelField],
1883
- a,
1884
- l
1885
- ),
1886
- l
1887
- ) : t.defaultVal;
1888
- }
1889
- }, ht = (e, n, g) => {
1890
- const t = {
1891
- defaultVal: "",
1892
- formatFunIn: (i, r) => i.map((b) => b[r.idField]).join("/"),
1893
- treeSetting: {},
1894
- formatFunOut: (i) => i.join(","),
1895
- spacer: ","
1896
- };
1897
- Object.assign(t, g);
1898
- let s = [];
1899
- Array.isArray(e) ? s = e : typeof e == "string" && (s = e.split(t.spacer));
1900
- const { treeSetting: l } = o.state.dictConfig, c = Object.assign(l, t.treeSetting), a = o.state.dictCodes;
1901
- let d = [];
1902
- if (!a || !a[n])
1903
- o.actions.getDictDataObj(n).then((i) => {
1904
- if (d = i[n], !d)
1905
- return new Error(`不存在类型为:${n} 的字典字段,请确认后再填写`);
1906
- const r = be(
1907
- s,
1908
- d,
1909
- t.defaultVal,
1910
- t.formatFunIn,
1911
- c
1912
- );
1913
- return r && r.length > 0 ? t.formatFunOut(r) : t.defaultVal;
1914
- });
1915
- else {
1916
- d = a[n];
1917
- const i = be(
1918
- s,
1919
- d,
1920
- t.defaultVal,
1921
- t.formatFunIn,
1922
- c
1923
- );
1924
- return i && i.length > 0 ? t.formatFunOut(i) : t.defaultVal;
1925
- }
1926
- }, $e = {
1927
- date: "yyyy-MM-dd",
1928
- month: "yyyy-MM",
1929
- datetime: "yyyy-MM-dd hh:mm:ss",
1930
- time: "hh:mm:ss",
1931
- year: "yyyy"
1932
- }, Re = (e) => {
1933
- const n = e.replaceAll("-", "/");
1934
- var g = new Date(e), t = new Date(n);
1935
- return !isNaN(g.getTime()) || !isNaN(t.getTime());
1936
- }, Pe = (e, n = "datetime", g) => {
1937
- if (!e || !n)
1938
- return g ?? "";
1939
- Object.keys($e).includes(n) && (n = $e[n]), e instanceof Date || (typeof e == "number" || Re(e) ? e = new Date(e) : e = new Date(Number(e)));
1940
- const t = {
1941
- "M+": e.getMonth() + 1,
1942
- "d+": e.getDate(),
1943
- "h+": e.getHours(),
1944
- "m+": e.getMinutes(),
1945
- "s+": e.getSeconds(),
1946
- "q+": Math.floor((e.getMonth() + 3) / 3),
1947
- S: e.getMilliseconds()
1948
- };
1949
- /(y+)/.test(n) && (n = n.replace(RegExp.$1, String(e.getFullYear()).substr(4 - RegExp.$1.length)));
1950
- for (const s in t) {
1951
- const l = new RegExp(`(${s})`);
1952
- l.test(n) && (n = n.replace(l, RegExp.$1.length === 1 ? t[s] : ("00" + t[s]).substr(String(t[s]).length)));
1953
- }
1954
- return n;
1955
- }, ue = (e, n) => {
1956
- let t = Object.assign({
1957
- start: 0,
1958
- end: 0,
1959
- middle: 0,
1960
- symbol: "*"
1961
- }, n);
1962
- if (t || (t = { start: 0, end: 0, symbol: "*" }), t.start < 0 || t.end < 0)
1963
- return "";
1964
- const s = e.length;
1965
- if (t.start + t.end + t.middle > s)
1966
- return e;
1967
- let l = "";
1968
- for (let d = 0; d < t.start && d < s; d++)
1969
- l += e.charAt(d);
1970
- let c = "";
1971
- for (let d = s - 1; d >= 0 && d >= s - t.end; d--)
1972
- c = e.charAt(d) + c;
1973
- const a = t.symbol.repeat(Math.max(t.middle || s - t.start - t.end, 0));
1974
- return l + a + c;
1975
- }, xe = (e, n = "*") => {
1976
- if (!e)
1977
- return "";
1978
- const g = e.length;
1979
- if (g === 1)
1980
- return e;
1981
- const t = e.charAt(0), s = e.charAt(g - 1);
1982
- return ue(e.substring(1, g - 1), { start: 1, symbol: n }) ? `${t}*${s}` : `${t}${s}`;
1983
- }, Me = (e, n = "*") => e ? ue(e, { start: 4, end: 4, symbol: n }) : "", qe = (e, n = "*") => e ? ue(String(e), { start: 3, end: 4, symbol: n }) : "", ze = (e, n = "*") => {
1984
- if (!e)
1985
- return "";
1986
- const g = e.trim().split(/\s+/), t = g.length;
1987
- let s = "";
1988
- for (let l = 0; l < t; l++)
1989
- /^[\u4e00-\u9fa5]+$/.test(g[l]) ? s += ue(g[l], { start: 1, symbol: n }) : s += ue(g[l], { start: 2, symbol: n }), l < t - 1 && (s += " ");
1990
- return s;
1991
- }, It = {
1992
- mobile: qe,
1993
- name: xe,
1994
- address: ze,
1995
- idCard: Me
1996
- }, Ye = (e, n) => {
1997
- if (typeof n == "string" && (n = {
1998
- maskType: n
1999
- }), n.maskType === "none")
2000
- return e;
2001
- const g = {
2002
- start: 0,
2003
- // 从前往后保留的位数,默认为 0
2004
- end: 0,
2005
- // 从后往前保留的位数,默认为 0
2006
- symbol: "*",
2007
- // 替换的字符,默认为 *
2008
- defaultVal: "",
2009
- maskType: ""
2010
- };
2011
- if (Object.assign(g, n), !e)
2012
- return g.defaultVal;
2013
- if (g.maskType)
2014
- return It[g.maskType](e, g.symbol);
2015
- const t = {
2016
- start: g.start,
2017
- end: g.end,
2018
- middle: g.middle,
2019
- symbol: g.symbol
2020
- };
2021
- return ue(e, t);
2022
- }, jt = {
2023
- name: "ElTableColumnDict"
2024
- }, Ie = /* @__PURE__ */ H({
2025
- ...jt,
2026
- props: {
2027
- // 字典类型
2028
- dictType: {
2029
- type: String,
2030
- default: ""
2031
- },
2032
- dictTreeType: {
2033
- type: String,
2034
- default: ""
2035
- },
2036
- // 日期格式化
2037
- dateFormat: {
2038
- type: String
2039
- },
2040
- //缺省时展示
2041
- defaultVal: {
2042
- type: String,
2043
- default: ""
2044
- },
2045
- // 格式化展示内容
2046
- formatFun: {
2047
- type: Function,
2048
- default: null
2049
- },
2050
- // 格式化展示内容
2051
- formatFunIn: {
2052
- type: Function,
2053
- default: null
2054
- },
2055
- // 格式化展示内容
2056
- formatFunOut: {
2057
- type: Function,
2058
- default: null
2059
- },
2060
- // 间隔符
2061
- spacer: {
2062
- type: String,
2063
- default: ","
2064
- },
2065
- treeSetting: {
2066
- type: Object,
2067
- default: null
2068
- },
2069
- // 脱敏类型
2070
- maskType: {
2071
- type: String,
2072
- validator(e) {
2073
- return ["mobile", "address", "idCard", "name"].includes(e);
2074
- }
2075
- },
2076
- maskStart: {
2077
- type: Number
2078
- },
2079
- maskEnd: {
2080
- type: Number
2081
- },
2082
- maskMiddle: {
2083
- type: Number
2084
- },
2085
- maskSymbol: {
2086
- type: String,
2087
- default: "*"
2088
- },
2089
- // 字典类型时展示的节点组件
2090
- dictTypeNode: {
2091
- type: String,
2092
- validator(e) {
2093
- return ["link", "button", "tag", "text"].includes(e);
2094
- }
2095
- }
2096
- },
2097
- setup(e, { expose: n }) {
2098
- const {
2099
- dictType: g,
2100
- dictTreeType: t,
2101
- dateFormat: s,
2102
- defaultVal: l,
2103
- treeSetting: c,
2104
- formatFun: a,
2105
- formatFunIn: d,
2106
- formatFunOut: i,
2107
- spacer: r,
2108
- maskType: b,
2109
- maskStart: T,
2110
- maskEnd: h,
2111
- maskMiddle: I,
2112
- maskSymbol: O
2113
- } = e, F = me(), E = N(() => {
2114
- let u = {};
2115
- return l && (u.defaultVal = l), a && (u.formatFun = a), r && (u.spacer = r), u;
2116
- }), C = N(() => {
2117
- let u = {};
2118
- return l && (u.defaultVal = l), d && (u.formatFunIn = d), i && (u.formatFunOut = i), c && (u.treeSetting = c), r && (u.spacer = r), u;
2119
- }), v = N(() => {
2120
- const u = {};
2121
- return l && (u.defaultVal = l), b && (u.maskType = b), T && (u.start = T), h && (u.end = h), I && (u.middle = I), O && (u.symbol = O), u;
2122
- }), m = k(null);
2123
- return n({ getRef: () => m.value }), (u, D) => {
2124
- const p = $("el-button-dict"), y = $("el-link-dict"), _ = $("el-tag-dict"), j = $("el-text-dict"), V = $("el-table-column");
2125
- return G(), w(V, ie({
2126
- ref_key: "ElTableColumnDict",
2127
- ref: m
2128
- }, u.$attrs), Q({
2129
- default: L((B) => {
2130
- var A, J, q, se, z, Z, ee, De, ke;
2131
- return [
2132
- e.dictType ? (G(), te(ne, { key: 0 }, [
2133
- e.dictTypeNode === "button" ? (G(), w(p, {
2134
- key: 0,
2135
- value: B.row[(A = S(F)) == null ? void 0 : A.prop] || "",
2136
- dictType: e.dictType
2137
- }, null, 8, ["value", "dictType"])) : e.dictTypeNode === "link" ? (G(), w(y, {
2138
- key: 1,
2139
- value: B.row[(J = S(F)) == null ? void 0 : J.prop] || "",
2140
- dictType: e.dictType
2141
- }, null, 8, ["value", "dictType"])) : e.dictTypeNode === "tag" ? (G(), w(_, {
2142
- key: 2,
2143
- value: B.row[(q = S(F)) == null ? void 0 : q.prop] || "",
2144
- dictType: e.dictType
2145
- }, null, 8, ["value", "dictType"])) : e.dictTypeNode === "text" ? (G(), w(j, {
2146
- key: 3,
2147
- value: B.row[(se = S(F)) == null ? void 0 : se.prop] || "",
2148
- dictType: e.dictType
2149
- }, null, 8, ["value", "dictType"])) : (G(), te(ne, { key: 4 }, [
2150
- K(U(S(we)(B.row[(z = S(F)) == null ? void 0 : z.prop], e.dictType, S(E))), 1)
2151
- ], 64))
2152
- ], 64)) : e.dictTreeType ? (G(), te(ne, { key: 1 }, [
2153
- K(U(S(Je)(
2154
- B.row[(Z = S(F)) == null ? void 0 : Z.prop],
2155
- e.dictTreeType,
2156
- S(C)
2157
- )), 1)
2158
- ], 64)) : e.dateFormat ? (G(), te(ne, { key: 2 }, [
2159
- K(U(S(Pe)(B.row[(ee = S(F)) == null ? void 0 : ee.prop], e.dateFormat, e.defaultVal)), 1)
2160
- ], 64)) : e.maskType || e.maskStart ? (G(), te(ne, { key: 3 }, [
2161
- K(U(S(Ye)(B.row[(De = S(F)) == null ? void 0 : De.prop], S(v))), 1)
2162
- ], 64)) : (G(), te(ne, { key: 4 }, [
2163
- K(U(B.row[(ke = S(F)) == null ? void 0 : ke.prop] || e.defaultVal), 1)
2164
- ], 64))
2165
- ];
2166
- }),
2167
- _: 2
2168
- }, [
2169
- x(u.$slots, (B, A, J) => ({
2170
- name: A,
2171
- fn: L((q) => [
2172
- M(u.$slots, A, W(X(q)))
2173
- ])
2174
- }))
2175
- ]), 1040);
2176
- };
2177
- }
2178
- });
2179
- Ie.install = function(e) {
2180
- e.component(Ie.name, Ie);
2181
- };
2182
- const At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2183
- __proto__: null,
2184
- default: Ie
2185
- }, Symbol.toStringTag, { value: "Module" })), Gt = {
2186
- name: "ElTabsDict"
2187
- }, je = /* @__PURE__ */ H({
2188
- ...Gt,
2189
- props: {
2190
- //角标对象
2191
- badgeObj: {
2192
- type: Object,
2193
- default: () => ({})
2194
- },
2195
- dictType: {
2196
- type: [String, Object],
2197
- required: !0
2198
- },
2199
- disableObj: {
2200
- type: Object
2201
- },
2202
- //是否返回键值
2203
- keyValue: {
2204
- type: Boolean,
2205
- default: !1
2206
- },
2207
- //过滤函数
2208
- filterDataFun: {
2209
- type: Function
2210
- },
2211
- //禁用函数
2212
- disabledDataFun: {
2213
- type: Function
2214
- }
2215
- },
2216
- emits: ["dictChange"],
2217
- setup(e, { expose: n, emit: g }) {
2218
- const {
2219
- badgeObj: t,
2220
- dictType: s,
2221
- disableObj: l,
2222
- keyValue: c,
2223
- filterDataFun: a,
2224
- disabledDataFun: d
2225
- } = e, i = me(), r = k(""), b = P(o.state.dictConfig), T = P(o.state.dictCodes), h = (m) => {
2226
- window.setTimeout(() => {
2227
- if (!c) {
2228
- g("dictChange", i.modelValue);
2229
- return;
2230
- }
2231
- const f = I.list.find((u) => u[b.format.value] === i.modelValue);
2232
- g("dictChange", f);
2233
- }, 0);
2234
- }, I = ae({
2235
- list: []
2236
- }), O = async () => {
2237
- if (!s)
2238
- return;
2239
- let m = [];
2240
- if (typeof s == "object") {
2241
- r.value = s.type, await o.actions.getDictDataObj(r.value), m = [].concat(T[r.value]);
2242
- const {
2243
- filters: f,
2244
- filterType: u = b.format.value,
2245
- reverse: D = !1
2246
- } = s, p = typeof f == "string" ? f.split(",") : f;
2247
- D ? m = m.filter((y) => !p.includes(y[u])) : m = m.filter((y) => p.includes(y[u]));
2248
- } else
2249
- r.value = s, await o.actions.getDictDataObj(r.value), m = [].concat(T[r.value]);
2250
- if (a && (m = a(m)), d && (m = m.map((f) => ({
2251
- ...f,
2252
- [b.format.disabled]: !!f[b.format.disabled] || d(f)
2253
- }))), l) {
2254
- const {
2255
- disableValue: f,
2256
- disableType: u = b.format.value,
2257
- reverse: D = !1
2258
- } = l, p = typeof f == "string" ? f.split(",") : f;
2259
- D ? m = m.map((y) => {
2260
- const _ = JSON.parse(JSON.stringify(y));
2261
- return _[b.format.disabled] = !p.includes(_[u]) || _[b.format.disabled], _;
2262
- }) : m = m.map((y) => {
2263
- const _ = JSON.parse(JSON.stringify(y));
2264
- return _[b.format.disabled] = p.includes(_[u]) || _[b.format.disabled], _;
2265
- });
2266
- }
2267
- I.list = m;
2268
- }, F = N(() => o.state.isGettingDictTypes.includes(r.value)), E = N(() => o.state.isGettingAllDictTypes);
2269
- re(
2270
- [F, E],
2271
- ([m], [f]) => {
2272
- !m && !f && O();
2273
- },
2274
- {
2275
- immediate: !0
2276
- }
2277
- );
2278
- const C = k(null);
2279
- return n({ getRef: () => C.value }), (m, f) => {
2280
- const u = $("el-badge"), D = $("el-tab-pane"), p = $("el-tabs");
2281
- return G(), w(p, ie({
2282
- ref_key: "ElTabsDict",
2283
- ref: C,
2284
- class: "vue-element-dict-tabs"
2285
- }, m.$attrs, { onTabClick: h }), {
2286
- default: L(() => [
2287
- (G(!0), te(ne, null, x(I.list, (y) => (G(), w(D, {
2288
- disabled: y[S(b).format.disabled],
2289
- label: y[S(b).format.label],
2290
- key: y[S(b).format.value],
2291
- name: y[S(b).format.value]
2292
- }, Q({
2293
- default: L(() => [
2294
- M(m.$slots, y[S(b).format.value])
2295
- ]),
2296
- _: 2
2297
- }, [
2298
- x(m.$slots, (_, j, V) => ({
2299
- name: j,
2300
- fn: L((B) => [
2301
- M(m.$slots, j, W(X(B)))
2302
- ])
2303
- })),
2304
- e.badgeObj[y[S(b).format.value]] ? {
2305
- name: "label",
2306
- fn: L(() => [
2307
- Ue(u, {
2308
- type: e.badgeObj[y[S(b).format.value]].type,
2309
- "is-dot": e.badgeObj[y[S(b).format.value]].isDot,
2310
- value: e.badgeObj[y[S(b).format.value]].value,
2311
- max: e.badgeObj[y[S(b).format.value]].max,
2312
- hidden: e.badgeObj[y[S(b).format.value]].hidden,
2313
- class: "item"
2314
- }, {
2315
- default: L(() => [
2316
- K(U(y[S(b).format.label]), 1)
2317
- ]),
2318
- _: 2
2319
- }, 1032, ["type", "is-dot", "value", "max", "hidden"])
2320
- ]),
2321
- key: "0"
2322
- } : void 0
2323
- ]), 1032, ["disabled", "label", "name"]))), 128))
2324
- ]),
2325
- _: 3
2326
- }, 16);
2327
- };
2328
- }
2329
- });
2330
- je.install = function(e) {
2331
- e.component(je.name, je);
2332
- };
2333
- const Et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2334
- __proto__: null,
2335
- default: je
2336
- }, Symbol.toStringTag, { value: "Module" })), Nt = {
2337
- name: "ElTagDict"
2338
- }, Ae = /* @__PURE__ */ H({
2339
- ...Nt,
2340
- props: {
2341
- value: {
2342
- type: [String, Number],
2343
- required: !0
2344
- },
2345
- dictType: {
2346
- type: [String],
2347
- required: !0
2348
- },
2349
- //请求的码表值
2350
- judgeTypeFun: {
2351
- type: Function
2352
- },
2353
- type: {
2354
- type: String,
2355
- default: ""
2356
- },
2357
- judgeColorFun: {
2358
- type: Function
2359
- },
2360
- color: {
2361
- type: String,
2362
- default: ""
2363
- }
2364
- },
2365
- setup(e, { expose: n }) {
2366
- const g = e, { value: t, dictType: s, judgeTypeFun: l, type: c, judgeColorFun: a, color: d } = Le(g), i = P(o.state.dictConfig), r = N(() => l != null && l.value ? l == null ? void 0 : l.value(t.value) : c.value ? c.value : T.value && T.value[i.format.type] ? T.value[i.format.type] : "success"), b = N(() => a != null && a.value ? a == null ? void 0 : a.value(t) : d.value ? d.value : T.value && T.value[i.format.color] ? T.value[i.format.color] : "");
2367
- let T = k(null), h = k(null);
2368
- Ve(() => {
2369
- pe(t.value, s.value).then((F) => {
2370
- T.value = F, h.value = F[i.format.label];
2371
- });
2372
- });
2373
- const I = k(null);
2374
- return n({ getRef: () => I.value }), (F, E) => {
2375
- const C = $("el-tag");
2376
- return G(), w(C, ie({
2377
- ref_key: "ElTagDict",
2378
- ref: I,
2379
- type: S(r),
2380
- color: S(b)
2381
- }, F.$attrs), Q({
2382
- default: L(() => [
2383
- K(" " + U(S(h)), 1)
2384
- ]),
2385
- _: 2
2386
- }, [
2387
- x(F.$slots, (v, m, f) => ({
2388
- name: m,
2389
- fn: L((u) => [
2390
- M(F.$slots, m, W(X(u)))
2391
- ])
2392
- }))
2393
- ]), 1040, ["type", "color"]);
2394
- };
2395
- }
2396
- });
2397
- Ae.install = function(e) {
2398
- e.component(Ae.name, Ae);
2399
- };
2400
- const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2401
- __proto__: null,
2402
- default: Ae
2403
- }, Symbol.toStringTag, { value: "Module" })), Vt = {
2404
- name: "ElTextDict"
2405
- }, Ge = /* @__PURE__ */ H({
2406
- ...Vt,
2407
- props: {
2408
- value: {
2409
- type: [String, Number],
2410
- required: !0
2411
- },
2412
- dictType: {
2413
- type: [String],
2414
- required: !0
2415
- },
2416
- //请求的码表值
2417
- judgeTypeFun: {
2418
- type: Function
2419
- },
2420
- type: {
2421
- type: String,
2422
- default: ""
2423
- }
2424
- },
2425
- setup(e, { expose: n }) {
2426
- const g = e, { value: t, dictType: s, judgeTypeFun: l, type: c } = Le(g), a = P(o.state.dictConfig), d = N(() => l != null && l.value ? l == null ? void 0 : l.value(t.value) : c != null && c.value ? c.value : i.value && i.value[a.format.type] ? i.value[a.format.type] : "primary");
2427
- let i = k(null), r = k(null);
2428
- Ve(() => {
2429
- pe(t.value, s.value).then((h) => {
2430
- i.value = h, r.value = h[a.format.label];
2431
- });
2432
- });
2433
- const b = k(null);
2434
- return n({ getRef: () => b.value }), (h, I) => {
2435
- const O = $("el-text");
2436
- return G(), w(O, ie({
2437
- ref: "ElTextDict",
2438
- type: S(d)
2439
- }, h.$attrs), Q({
2440
- default: L(() => [
2441
- K(" " + U(S(r)), 1)
2442
- ]),
2443
- _: 2
2444
- }, [
2445
- x(h.$slots, (F, E, C) => ({
2446
- name: E,
2447
- fn: L((v) => [
2448
- M(h.$slots, E, W(X(v)))
2449
- ])
2450
- }))
2451
- ]), 1040, ["type"]);
2452
- };
2453
- }
2454
- });
2455
- Ge.install = function(e) {
2456
- e.component(Ge.name, Ge);
2457
- };
2458
- const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2459
- __proto__: null,
2460
- default: Ge
2461
- }, Symbol.toStringTag, { value: "Module" })), $t = {
2462
- name: "ElTreeDict"
2463
- }, Ee = /* @__PURE__ */ H({
2464
- ...$t,
2465
- props: {
2466
- //最大层级
2467
- maxLevel: {
2468
- type: [Number, String]
2469
- },
2470
- dictType: {
2471
- type: [String, Object],
2472
- required: !0
2473
- },
2474
- disableObj: {
2475
- type: Object
2476
- },
2477
- //过滤函数
2478
- filterDataFun: {
2479
- type: Function
2480
- },
2481
- //禁用函数
2482
- disabledDataFun: {
2483
- type: Function
2484
- }
2485
- },
2486
- setup(e, { expose: n }) {
2487
- const { maxLevel: g, dictType: t, disableObj: s, filterDataFun: l, disabledDataFun: c } = e, a = me(), d = k(""), i = P(o.state.dictConfig), r = P(o.state.dictCodes), b = ae({
2488
- list: []
2489
- }), T = (m, f) => {
2490
- for (let u = 0; u < m.length; u++) {
2491
- const D = m[u];
2492
- if (D[i.treeSetting.levelField] === f) {
2493
- delete D[F.value.children], D[F.value.isLeaf] = !0;
2494
- continue;
2495
- } else
2496
- T(D[F.value.children], f);
2497
- }
2498
- }, h = async () => {
2499
- if (!t)
2500
- return;
2501
- let m = [];
2502
- if (typeof t == "object") {
2503
- d.value = t.type, await o.actions.getDictDataObj(d.value), m = [].concat(r[d.value]);
2504
- const {
2505
- filters: f,
2506
- filterType: u = i.format.value,
2507
- reverse: D = !1
2508
- } = t, p = typeof f == "string" ? f.split(",") : f;
2509
- D ? m = m.filter((y) => !p.includes(y[u])) : m = m.filter((y) => p.includes(y[u]));
2510
- } else
2511
- d.value = t, await o.actions.getDictDataObj(d.value), m = [].concat(r[d.value]);
2512
- if (l && (m = l(m)), c && (m = m.map((f) => ({
2513
- ...f,
2514
- [i.format.disabled]: !!f[i.format.disabled] || c(f)
2515
- }))), s) {
2516
- const {
2517
- disableValue: f,
2518
- disableType: u = i.format.value,
2519
- reverse: D = !1
2520
- } = s, p = typeof f == "string" ? f.split(",") : f;
2521
- D ? m = m.map((y) => {
2522
- const _ = JSON.parse(JSON.stringify(y));
2523
- return _[i.format.disabled] = !p.includes(_[u]) || _[i.format.disabled], _;
2524
- }) : m = m.map((y) => {
2525
- const _ = JSON.parse(JSON.stringify(y));
2526
- return _[i.format.disabled] = p.includes(_[u]) || _[i.format.disabled], _;
2527
- });
2528
- }
2529
- b.list = m;
2530
- }, I = N(() => o.state.isGettingDictTypes.includes(d.value)), O = N(() => o.state.isGettingAllDictTypes), F = N(() => {
2531
- const m = a.props ?? {};
2532
- return m.disabled = m.disabled ?? o.state.dictConfig.format.disabled, m.label = m.label ?? o.state.dictConfig.treeSetting.labelField, m.children = m.children ?? o.state.dictConfig.treeSetting.childrenField, m.isLeaf = m.leaf ?? o.state.dictConfig.treeSetting.leafField, m;
2533
- }), E = N(() => {
2534
- const m = a.props ?? {}, f = {
2535
- labelField: m.label ?? i.treeSetting.labelField,
2536
- childrenField: m.children ?? i.treeSetting.childrenField,
2537
- leafField: m.leaf ?? i.treeSetting.leafField
2538
- }, u = Object.assign(o.state.dictConfig.treeSetting, f), D = JSON.parse(JSON.stringify(b.list)), p = ye(D, u);
2539
- return g && T(p, +g), p;
2540
- });
2541
- re(
2542
- [I, O],
2543
- ([m], [f]) => {
2544
- !m && !f && h();
2545
- },
2546
- {
2547
- immediate: !0
2548
- }
2549
- );
2550
- const C = k(null);
2551
- return n({ getRef: () => C.value }), (m, f) => {
2552
- const u = $("el-tree");
2553
- return G(), w(u, {
2554
- ref_key: "ElTreeDict",
2555
- ref: C,
2556
- data: S(E),
2557
- props: S(F)
2558
- }, Q({ _: 2 }, [
2559
- x(m.$slots, (D, p, y) => ({
2560
- name: p,
2561
- fn: L((_) => [
2562
- M(m.$slots, p, W(X(_)))
2563
- ])
2564
- }))
2565
- ]), 1032, ["data", "props"]);
2566
- };
2567
- }
2568
- });
2569
- Ee.install = function(e) {
2570
- e.component(Ee.name, Ee);
2571
- };
2572
- const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2573
- __proto__: null,
2574
- default: Ee
2575
- }, Symbol.toStringTag, { value: "Module" })), wt = {
2576
- name: "ElTreeSelectDict"
2577
- }, Ne = /* @__PURE__ */ H({
2578
- ...wt,
2579
- props: {
2580
- //最大层级
2581
- maxLevel: {
2582
- type: [Number, String]
2583
- },
2584
- nodeKey: {
2585
- type: String,
2586
- default: o.state.dictConfig.treeSetting.idField
2587
- },
2588
- dictType: {
2589
- type: [String, Object],
2590
- required: !0
2591
- },
2592
- disableObj: {
2593
- type: Object
2594
- },
2595
- //过滤函数
2596
- filterDataFun: {
2597
- type: Function
2598
- },
2599
- //禁用函数
2600
- disabledDataFun: {
2601
- type: Function
2602
- }
2603
- },
2604
- setup(e, { expose: n }) {
2605
- const { maxLevel: g, nodeKey: t, dictType: s, disableObj: l, filterDataFun: c, disabledDataFun: a } = e, d = me(), i = k(""), r = P(o.state.dictConfig), b = P(o.state.dictCodes), T = ae({
2606
- list: []
2607
- }), h = (f, u) => {
2608
- for (let D = 0; D < f.length; D++) {
2609
- const p = f[D];
2610
- if (p[r.treeSetting.levelField] === u) {
2611
- delete p[E.value.children], p[E.value.isLeaf] = !0;
2612
- continue;
2613
- } else
2614
- h(p[E.value.children], u);
2615
- }
2616
- }, I = async () => {
2617
- if (!s)
2618
- return;
2619
- let f = [];
2620
- if (typeof s == "object") {
2621
- i.value = s.type, await o.actions.getDictDataObj(i.value), f = [].concat(b[i.value]);
2622
- const {
2623
- filters: u,
2624
- filterType: D = r.format.value,
2625
- reverse: p = !1
2626
- } = s, y = typeof u == "string" ? u.split(",") : u;
2627
- p ? f = f.filter((_) => !y.includes(_[D])) : f = f.filter((_) => y.includes(_[D]));
2628
- } else
2629
- i.value = s, await o.actions.getDictDataObj(i.value), f = [].concat(b[i.value]);
2630
- if (c && (f = c(f)), a && (f = f.map((u) => ({
2631
- ...u,
2632
- [r.format.disabled]: !!u[r.format.disabled] || a(u)
2633
- }))), l) {
2634
- const {
2635
- disableValue: u,
2636
- disableType: D = r.format.value,
2637
- reverse: p = !1
2638
- } = l, y = typeof u == "string" ? u.split(",") : u;
2639
- p ? f = f.map((_) => {
2640
- const j = JSON.parse(JSON.stringify(_));
2641
- return j[r.format.disabled] = !y.includes(j[D]) || j[r.format.disabled], j;
2642
- }) : f = f.map((_) => {
2643
- const j = JSON.parse(JSON.stringify(_));
2644
- return j[r.format.disabled] = y.includes(j[D]) || j[r.format.disabled], j;
2645
- });
2646
- }
2647
- T.list = f;
2648
- }, O = N(() => o.state.isGettingDictTypes.includes(i.value)), F = N(() => o.state.isGettingAllDictTypes), E = N(() => {
2649
- const f = d.props ?? {};
2650
- return f.disabled = f.disabled ?? o.state.dictConfig.format.disabled, f.label = f.label ?? o.state.dictConfig.treeSetting.labelField, f.children = f.children ?? o.state.dictConfig.treeSetting.childrenField, f.isLeaf = f.leaf ?? o.state.dictConfig.treeSetting.leafField, f;
2651
- }), C = N(() => {
2652
- const f = d.props ?? {}, u = {
2653
- labelField: f.label ?? r.treeSetting.labelField,
2654
- childrenField: f.children ?? r.treeSetting.childrenField,
2655
- leafField: f.leaf ?? r.treeSetting.leafField
2656
- }, D = Object.assign(o.state.dictConfig.treeSetting, u), p = JSON.parse(JSON.stringify(T.list)), y = ye(p, D);
2657
- return g && h(y, +g), y;
2658
- });
2659
- re(
2660
- [O, F],
2661
- ([f], [u]) => {
2662
- !f && !u && I();
2663
- },
2664
- {
2665
- immediate: !0
2666
- }
2667
- );
2668
- const v = k(null);
2669
- return n({ getRef: () => v.value }), (f, u) => {
2670
- const D = $("el-tree-select");
2671
- return G(), w(D, {
2672
- ref_key: "ElTreeSelectDict",
2673
- ref: v,
2674
- data: S(C),
2675
- "node-key": e.nodeKey,
2676
- props: S(E)
2677
- }, Q({ _: 2 }, [
2678
- x(f.$slots, (p, y, _) => ({
2679
- name: y,
2680
- fn: L((j) => [
2681
- M(f.$slots, y, W(X(j)))
2682
- ])
2683
- }))
2684
- ]), 1032, ["data", "node-key", "props"]);
2685
- };
2686
- }
2687
- });
2688
- Ne.install = function(e) {
2689
- e.component(Ne.name, Ne);
2690
- };
2691
- const Jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2692
- __proto__: null,
2693
- default: Ne
2694
- }, Symbol.toStringTag, { value: "Module" })), Be = /* @__PURE__ */ Object.assign({
2695
- "./el-button-dict/index.ts": nt,
2696
- "./el-cascader-dict/index.ts": at,
2697
- "./el-checkbox-button-dict/index.ts": rt,
2698
- "./el-checkbox-dict/index.ts": ot,
2699
- "./el-link-dict/index.ts": ut,
2700
- "./el-radio-button-dict/index.ts": ft,
2701
- "./el-radio-dict/index.ts": bt,
2702
- "./el-select-dict/index.ts": pt,
2703
- "./el-table-column-dict/index.ts": At,
2704
- "./el-tabs-dict/index.ts": Et,
2705
- "./el-tag-dict/index.ts": Lt,
2706
- "./el-text-dict/index.ts": kt,
2707
- "./el-tree-dict/index.ts": Bt,
2708
- "./el-tree-select-dict/index.ts": Jt
2709
- });
2710
- let Ke = [];
2711
- Object.keys(Be).forEach((e) => {
2712
- Ke.push(Be[e].default);
2713
- });
2714
- const Rt = () => o.state.dictConfig, Pt = (e) => o.state.dictConfig[e], qt = Rt, zt = Pt, Yt = Qe, Kt = We, Ut = Xe, Ht = Ze, Qt = et, Wt = pe, Xt = yt, Zt = we, en = Dt, tn = Tt, nn = ue, an = ze, ln = Me, rn = xe, sn = qe, on = Ye, cn = Pe, un = Re, dn = ye, fn = le, gn = oe, bn = _t, mn = St, pn = vt, yn = Ft, Dn = Ot, Tn = Ct, _n = Je, vn = ht;
2715
- async function xt(e) {
2716
- var l;
2717
- const n = e.storage.getItem(e.dictDataKey) || "{}", g = JSON.parse(n), t = e.usuallyGetDictTypes ? e.usuallyGetDictTypes.split(",") : [];
2718
- let s = [];
2719
- if (e.usuallyGetDictTypesByApi)
2720
- s = t;
2721
- else if (t.length > 0)
2722
- for (let c = 0; c < t.length; c++)
2723
- g[t[c]] || s.push(t[c]);
2724
- if (n === "{}" || e.isGetAll || s.length > 0) {
2725
- let c, a = "";
2726
- e.isGetAll ? (o.mutations.SETTING_ISGETTING_ALL_DICT_TYPES(!0), c = await e.getDictCodeApi(
2727
- e.formatterRequest(e.query, a)
2728
- ), o.mutations.SETTING_ISGETTING_ALL_DICT_TYPES(!1)) : s.length > 0 && (a = s.join(","), o.mutations.ADD_IS_EGTTING_DICT_TYPES(a), c = await e.getDictCodeApi(
2729
- e.formatterRequest(e.query, a)
2730
- ), o.mutations.REMOVE_IS_EGTTING_DICT_TYPES(a));
2731
- const d = e.formatterDictList(c, a), i = e.formatterDictVersion(c);
2732
- e.storage.setItem(e.versionKey, i);
2733
- const r = Object.assign(o.state.dictCodes, d), b = ce(r, e.filterDataFun, e.disabledDataFun, (l = e == null ? void 0 : e.format) == null ? void 0 : l.disabled);
2734
- o.mutations.SET_DICT_CODES(b), e.storage.setItem(e.dictDataKey, JSON.stringify(b));
2735
- }
2736
- }
2737
- let Sn = {
2738
- async install(e, n) {
2739
- var d, i;
2740
- const g = {
2741
- //组件过滤数据 配置
2742
- filterDataFun: (r) => r,
2743
- //组件禁用数据 配置
2744
- disabledDataFun: (r) => !1,
2745
- //配置数组数据转化成树形数据
2746
- treeSetting: {
2747
- idField: "id",
2748
- //唯一标识字段名
2749
- parentIdField: "parentId",
2750
- //父节点唯一标识字段名
2751
- childrenField: "children",
2752
- //子节点标识字段名
2753
- firstId: "0",
2754
- // 根节点值
2755
- labelField: "label",
2756
- //label字段名
2757
- labelArrField: "labelArr",
2758
- //给对象新增的中文数组字段名
2759
- idArrField: "idArr",
2760
- //给对象新增的id数组字段名
2761
- levelField: "level",
2762
- //给对象新增的层级字段名
2763
- level: 0,
2764
- // 给第一级展示的层级
2765
- leafField: "leaf"
2766
- //叶子节点标识字段名
2767
- },
2768
- query: "dictType",
2769
- versionKey: "vue3ElementDictVersion",
2770
- dictDataKey: "vue3ElementDictData",
2771
- format: {
2772
- value: "value",
2773
- label: "label",
2774
- disabled: "disabled",
2775
- type: "type",
2776
- color: "color"
2777
- },
2778
- formatterRequest: (r, b) => b ? { [r]: b } : { [r]: "" },
2779
- formatterDictList: (r, b) => !r || !r.dictData ? {} : r.dictData,
2780
- formatterDictVersion: (r) => !r || !r.version ? "unknow" : r.version,
2781
- version: "unknow",
2782
- storage: localStorage,
2783
- isGetAll: !1,
2784
- usuallyGetDictTypes: "",
2785
- usuallyGetDictTypesByApi: !1,
2786
- localDictCodes: {}
2787
- //本地数据
2788
- };
2789
- n.format = Object.assign(
2790
- g.format,
2791
- n.format
2792
- ), n.treeSetting = Object.assign(
2793
- g.treeSetting,
2794
- n.treeSetting
2795
- );
2796
- const t = Object.assign(g, n);
2797
- o.mutations.SET_DICT_SETTING(t);
2798
- const s = JSON.parse(t.storage.getItem(t.dictDataKey)) || {};
2799
- let l = JSON.parse(JSON.stringify(t.localDictCodes));
2800
- l = Object.assign(s, l);
2801
- const c = ce(l, t.filterDataFun, t.disabledDataFun, (d = t == null ? void 0 : t.format) == null ? void 0 : d.disabled);
2802
- t.storage.setItem(t.dictDataKey, JSON.stringify(c)), o.mutations.SET_DICT_CODES(c);
2803
- const a = t.storage.getItem(t.versionKey);
2804
- if (t.version !== a) {
2805
- t.storage.removeItem(t.dictDataKey), t.storage.setItem(t.versionKey, t.version);
2806
- const r = JSON.parse(JSON.stringify(t.localDictCodes)), b = ce(r, t.filterDataFun, t.disabledDataFun, (i = t == null ? void 0 : t.format) == null ? void 0 : i.disabled);
2807
- t.storage.setItem(t.dictDataKey, JSON.stringify(b)), o.mutations.SET_DICT_CODES(b);
2808
- }
2809
- (t.isGetAll || t.usuallyGetDictTypes) && xt(t), Ke.forEach((r) => {
2810
- e.component(r.name, r);
2811
- });
2812
- }
2813
- };
2814
- export {
2815
- Sn as default,
2816
- on as desensitization,
2817
- cn as formatDate,
2818
- Ut as getCodeByLabel,
2819
- en as getCodeByLabelFilter,
2820
- Ht as getCodeByLabels,
2821
- tn as getCodeByLabelsFilter,
2822
- qt as getDictConfig,
2823
- zt as getDictConfigByKey,
2824
- Qt as getDictObjByDictTypes,
2825
- Wt as getItemByCode,
2826
- Yt as getLabelByCode,
2827
- Xt as getLabelByCodeFilter,
2828
- Kt as getLabelByCodes,
2829
- Zt as getLabelByCodesFilter,
2830
- mn as getTreeCodeByLabel,
2831
- Tn as getTreeCodeByLabelFilter,
2832
- yn as getTreeCodeByLabels,
2833
- vn as getTreeCodeByLabelsFilter,
2834
- fn as getTreeItemByCode,
2835
- gn as getTreeItemByLabel,
2836
- bn as getTreeLabelByCode,
2837
- Dn as getTreeLabelByCodeFilter,
2838
- pn as getTreeLabelByCodes,
2839
- _n as getTreeLabelByCodesFilter,
2840
- un as isDate,
2841
- dn as listToTree,
2842
- nn as mask,
2843
- an as maskAddress,
2844
- ln as maskIdCard,
2845
- rn as maskName,
2846
- sn as maskPhone
2847
- };