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