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