general-basic-form 1.0.26 → 1.0.27
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 +356 -203
- package/dist/index.d.ts +17 -0
- package/dist/index.js +809 -0
- package/dist/index.umd.cjs +1 -0
- package/dist/style.css +1 -0
- package/package.json +29 -11
- package/public/index.d.ts +17 -0
- package/script/initialization.ts +24 -0
- package/script/link.ts +14 -0
- package/script/linkNode.ts +14 -0
- package/script/unlinkModule.ts +48 -0
- package/script/unlinkNode.ts +38 -0
- package/tsconfig.json +14 -0
- package/vite.config.js +121 -0
- package/config/webpack.common.js +0 -98
- package/config/webpack.dev.js +0 -15
- package/config/webpack.prod.js +0 -16
- package/src/GeneralBasicForm.vue +0 -258
- package/src/assets/image-20210820173037871.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/index.js +0 -12
package/dist/index.js
ADDED
|
@@ -0,0 +1,809 @@
|
|
|
1
|
+
import { defineComponent as k, inject as h, resolveComponent as d, openBlock as o, createBlock as c, mergeProps as b, withKeys as ne, createSlots as J, renderList as $, withCtx as f, resolveDynamicComponent as W, createCommentVNode as y, ref as g, unref as m, resolveDirective as U, withDirectives as C, createElementBlock as S, createVNode as T, createElementVNode as H, computed as j, onBeforeUnmount as oe, normalizeStyle as re, createTextVNode as I, toDisplayString as D, h as se, normalizeProps as ae, guardReactiveProps as le, Fragment as L, provide as O, renderSlot as Q, vShow as ie, watch as ue } from "vue";
|
|
2
|
+
import { useRoute as ce } from "vue-router";
|
|
3
|
+
const X = {
|
|
4
|
+
placeholder: "请输入",
|
|
5
|
+
style: "width: 200px",
|
|
6
|
+
clearable: !0
|
|
7
|
+
}, pe = {
|
|
8
|
+
style: "width: 227px",
|
|
9
|
+
"start-placeholder": "开始日期",
|
|
10
|
+
"end-placeholder": "结束日期",
|
|
11
|
+
type: "daterange"
|
|
12
|
+
}, Y = {
|
|
13
|
+
placeholder: "请选择",
|
|
14
|
+
filterable: !0,
|
|
15
|
+
clearable: !0,
|
|
16
|
+
style: "width: 200px"
|
|
17
|
+
}, me = k({
|
|
18
|
+
components: {
|
|
19
|
+
InputArchive: (e) => {
|
|
20
|
+
const { templateEle: n } = e;
|
|
21
|
+
return n();
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
props: {
|
|
25
|
+
item: null
|
|
26
|
+
// null就是any
|
|
27
|
+
},
|
|
28
|
+
setup() {
|
|
29
|
+
const e = h("queryParams", {}), n = h("getList"), t = h("size");
|
|
30
|
+
return { queryParams: e, getList: n, size: t };
|
|
31
|
+
},
|
|
32
|
+
data() {
|
|
33
|
+
return {
|
|
34
|
+
inputSetting: {
|
|
35
|
+
...X,
|
|
36
|
+
...this.item.inputSetting
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
// created() {
|
|
41
|
+
// console.log("new", this.item);
|
|
42
|
+
// console.log("new", this.inputSetting);
|
|
43
|
+
// },
|
|
44
|
+
methods: {
|
|
45
|
+
currentInputComponent() {
|
|
46
|
+
return "input-archive";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// watch: {
|
|
50
|
+
// item(val) {
|
|
51
|
+
// console.log("item", val);
|
|
52
|
+
// },
|
|
53
|
+
// size(val) {
|
|
54
|
+
// console.log(val);
|
|
55
|
+
// },
|
|
56
|
+
// },
|
|
57
|
+
}), w = (e, n) => {
|
|
58
|
+
const t = e.__vccOpts || e;
|
|
59
|
+
for (const [a, l] of n)
|
|
60
|
+
t[a] = l;
|
|
61
|
+
return t;
|
|
62
|
+
};
|
|
63
|
+
function de(e, n, t, a, l, s) {
|
|
64
|
+
const i = d("el-input");
|
|
65
|
+
return o(), c(i, b({
|
|
66
|
+
onKeydown: ne(e.getList, ["enter"]),
|
|
67
|
+
modelValue: e.queryParams[e.item.prop],
|
|
68
|
+
"onUpdate:modelValue": n[0] || (n[0] = (r) => e.queryParams[e.item.prop] = r),
|
|
69
|
+
size: e.size
|
|
70
|
+
}, e.inputSetting), J({ _: 2 }, [
|
|
71
|
+
$(e.item.template, (r, _) => ({
|
|
72
|
+
name: _,
|
|
73
|
+
fn: f(() => [
|
|
74
|
+
r ? (o(), c(W(e.currentInputComponent()), {
|
|
75
|
+
key: _,
|
|
76
|
+
templateEle: r
|
|
77
|
+
}, null, 8, ["templateEle"])) : y("", !0)
|
|
78
|
+
])
|
|
79
|
+
}))
|
|
80
|
+
]), 1040, ["onKeydown", "modelValue", "size"]);
|
|
81
|
+
}
|
|
82
|
+
const K = /* @__PURE__ */ w(me, [["render", de]]), _e = /* @__PURE__ */ k({
|
|
83
|
+
__name: "index",
|
|
84
|
+
props: {
|
|
85
|
+
item: {}
|
|
86
|
+
},
|
|
87
|
+
setup(e) {
|
|
88
|
+
const { item: n } = e, t = h("queryParams", {}), a = h("size"), l = g({
|
|
89
|
+
...X,
|
|
90
|
+
...n.inputSetting
|
|
91
|
+
});
|
|
92
|
+
return (s, i) => {
|
|
93
|
+
const r = d("el-input-number");
|
|
94
|
+
return o(), c(r, b({
|
|
95
|
+
modelValue: m(t)[s.item.prop],
|
|
96
|
+
"onUpdate:modelValue": i[0] || (i[0] = (_) => m(t)[s.item.prop] = _),
|
|
97
|
+
size: m(a)
|
|
98
|
+
}, l.value), null, 16, ["modelValue", "size"]);
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}), Z = Symbol(), fe = { class: "input-graphic-verification" }, ye = ["src", "alt"], he = /* @__PURE__ */ k({
|
|
102
|
+
__name: "index",
|
|
103
|
+
props: {
|
|
104
|
+
item: {}
|
|
105
|
+
},
|
|
106
|
+
setup(e) {
|
|
107
|
+
const { item: n } = e, {
|
|
108
|
+
graphicSrc: t = "",
|
|
109
|
+
graphicAlt: a = "",
|
|
110
|
+
getGraphic: l = () => {
|
|
111
|
+
},
|
|
112
|
+
key: s
|
|
113
|
+
} = n, { formLoading: i, updateFormLoading: r } = h(Z), _ = async () => {
|
|
114
|
+
l && !i.value && await l();
|
|
115
|
+
};
|
|
116
|
+
return (p, P) => {
|
|
117
|
+
const q = U("loading");
|
|
118
|
+
return C((o(), S("div", fe, [
|
|
119
|
+
T(K, {
|
|
120
|
+
item: p.item,
|
|
121
|
+
class: "input"
|
|
122
|
+
}, null, 8, ["item"]),
|
|
123
|
+
H("img", {
|
|
124
|
+
class: "graphic",
|
|
125
|
+
onClick: _,
|
|
126
|
+
src: m(t),
|
|
127
|
+
alt: m(a) || `${m(s)}`
|
|
128
|
+
}, null, 8, ye)
|
|
129
|
+
])), [
|
|
130
|
+
[q, m(i)]
|
|
131
|
+
]);
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
const ve = /* @__PURE__ */ w(he, [["__scopeId", "data-v-006751c3"]]), B = "获取验证码", ge = 60, be = /* @__PURE__ */ k({
|
|
136
|
+
__name: "verification-button",
|
|
137
|
+
props: {
|
|
138
|
+
getSmscode: { type: Function }
|
|
139
|
+
},
|
|
140
|
+
setup(e) {
|
|
141
|
+
const { getSmscode: n } = e, t = g(B), a = g(null), l = j(() => t.value === B), s = () => {
|
|
142
|
+
a && (clearInterval(a.value), a.value = null, t.value = B);
|
|
143
|
+
}, i = async () => {
|
|
144
|
+
if (t.value === B)
|
|
145
|
+
if (t.value = ge, a.value = setInterval(() => {
|
|
146
|
+
if (Number(t.value) <= 0 || !t.value) {
|
|
147
|
+
s();
|
|
148
|
+
return;
|
|
149
|
+
} else
|
|
150
|
+
t.value = Number(t.value) - 1;
|
|
151
|
+
}, 1e3), n)
|
|
152
|
+
await n() === !1 && s();
|
|
153
|
+
else
|
|
154
|
+
return;
|
|
155
|
+
};
|
|
156
|
+
return oe(() => {
|
|
157
|
+
s();
|
|
158
|
+
}), (r, _) => {
|
|
159
|
+
const p = d("el-button");
|
|
160
|
+
return o(), c(p, {
|
|
161
|
+
class: "verifiaction-button",
|
|
162
|
+
style: re({
|
|
163
|
+
color: l.value ? "var(--color-primary, #409EFF)" : "var(--text-color-placeholder, #A8ABB2)",
|
|
164
|
+
cursor: l.value ? "pointer" : "default"
|
|
165
|
+
}),
|
|
166
|
+
onClick: i
|
|
167
|
+
}, {
|
|
168
|
+
default: f(() => [
|
|
169
|
+
I(D(l.value ? B : t.value + "s"), 1)
|
|
170
|
+
]),
|
|
171
|
+
_: 1
|
|
172
|
+
}, 8, ["style"]);
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
const ke = /* @__PURE__ */ w(be, [["__scopeId", "data-v-4074e137"]]), Se = /* @__PURE__ */ k({
|
|
177
|
+
__name: "index",
|
|
178
|
+
props: {
|
|
179
|
+
item: {}
|
|
180
|
+
},
|
|
181
|
+
setup(e) {
|
|
182
|
+
const { item: n } = e, t = n;
|
|
183
|
+
return t.template = {
|
|
184
|
+
append: () => se(ke, {
|
|
185
|
+
getSmscode: t.getSmscode
|
|
186
|
+
})
|
|
187
|
+
}, (a, l) => (o(), c(K, {
|
|
188
|
+
item: m(t),
|
|
189
|
+
class: "input"
|
|
190
|
+
}, null, 8, ["item"]));
|
|
191
|
+
}
|
|
192
|
+
}), ze = k({
|
|
193
|
+
components: {
|
|
194
|
+
slotArchive: (e) => {
|
|
195
|
+
const { templateEle: n } = e;
|
|
196
|
+
return n();
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
props: {
|
|
200
|
+
item: null
|
|
201
|
+
// null就是any
|
|
202
|
+
},
|
|
203
|
+
setup() {
|
|
204
|
+
},
|
|
205
|
+
data() {
|
|
206
|
+
return {
|
|
207
|
+
dividerSetting: {
|
|
208
|
+
...this.item.dividerSetting
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
methods: {
|
|
213
|
+
currentInputComponent() {
|
|
214
|
+
return "slot-archive";
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
function $e(e, n, t, a, l, s) {
|
|
219
|
+
const i = d("el-divider");
|
|
220
|
+
return o(), c(i, ae(le(e.dividerSetting)), J({ _: 2 }, [
|
|
221
|
+
$(e.item.template, (r, _) => ({
|
|
222
|
+
name: _,
|
|
223
|
+
fn: f(() => [
|
|
224
|
+
r ? (o(), c(W(e.currentInputComponent()), {
|
|
225
|
+
key: _,
|
|
226
|
+
templateEle: r
|
|
227
|
+
}, null, 8, ["templateEle"])) : y("", !0)
|
|
228
|
+
])
|
|
229
|
+
}))
|
|
230
|
+
]), 1040);
|
|
231
|
+
}
|
|
232
|
+
const Pe = /* @__PURE__ */ w(ze, [["render", $e]]), qe = /* @__PURE__ */ k({
|
|
233
|
+
__name: "index",
|
|
234
|
+
props: {
|
|
235
|
+
item: {}
|
|
236
|
+
},
|
|
237
|
+
setup(e) {
|
|
238
|
+
const { item: n } = e, t = h("queryParams", {}), a = h("size"), l = g({
|
|
239
|
+
...n.radioGroupSetting
|
|
240
|
+
});
|
|
241
|
+
return (s, i) => {
|
|
242
|
+
const r = d("el-radio"), _ = d("el-radio-group");
|
|
243
|
+
return o(), c(_, b({
|
|
244
|
+
modelValue: m(t)[s.item.prop],
|
|
245
|
+
"onUpdate:modelValue": i[0] || (i[0] = (p) => m(t)[s.item.prop] = p),
|
|
246
|
+
size: m(a)
|
|
247
|
+
}, l.value), {
|
|
248
|
+
default: f(() => [
|
|
249
|
+
(o(!0), S(L, null, $(s.item.option || [], (p) => (o(), c(r, b({
|
|
250
|
+
size: m(a),
|
|
251
|
+
key: p.label
|
|
252
|
+
}, p), {
|
|
253
|
+
default: f(() => [
|
|
254
|
+
I(D(p.value), 1)
|
|
255
|
+
]),
|
|
256
|
+
_: 2
|
|
257
|
+
}, 1040, ["size"]))), 128))
|
|
258
|
+
]),
|
|
259
|
+
_: 1
|
|
260
|
+
}, 16, ["modelValue", "size"]);
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
}), Ve = /* @__PURE__ */ k({
|
|
264
|
+
__name: "index",
|
|
265
|
+
props: {
|
|
266
|
+
item: {}
|
|
267
|
+
},
|
|
268
|
+
setup(e) {
|
|
269
|
+
const { item: n } = e, t = h("queryParams", {}), a = h("size"), l = g({
|
|
270
|
+
...n.checkboxGroupSetting
|
|
271
|
+
});
|
|
272
|
+
return (s, i) => {
|
|
273
|
+
const r = d("el-checkbox"), _ = d("el-checkbox-group");
|
|
274
|
+
return o(), c(_, b({
|
|
275
|
+
modelValue: m(t)[s.item.prop],
|
|
276
|
+
"onUpdate:modelValue": i[0] || (i[0] = (p) => m(t)[s.item.prop] = p),
|
|
277
|
+
size: m(a)
|
|
278
|
+
}, l.value), {
|
|
279
|
+
default: f(() => [
|
|
280
|
+
(o(!0), S(L, null, $(s.item.option || [], (p) => (o(), c(r, b({
|
|
281
|
+
size: m(a),
|
|
282
|
+
key: p.label
|
|
283
|
+
}, p), {
|
|
284
|
+
default: f(() => [
|
|
285
|
+
I(D(p.value), 1)
|
|
286
|
+
]),
|
|
287
|
+
_: 2
|
|
288
|
+
}, 1040, ["size"]))), 128))
|
|
289
|
+
]),
|
|
290
|
+
_: 1
|
|
291
|
+
}, 16, ["modelValue", "size"]);
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
}), Ie = /* @__PURE__ */ k({
|
|
295
|
+
__name: "index",
|
|
296
|
+
props: {
|
|
297
|
+
item: {}
|
|
298
|
+
},
|
|
299
|
+
setup(e) {
|
|
300
|
+
const { item: n } = e, t = h("queryParams", {}), a = h("size"), l = g({
|
|
301
|
+
...pe,
|
|
302
|
+
...n.datePackerSetting
|
|
303
|
+
});
|
|
304
|
+
return (s, i) => {
|
|
305
|
+
const r = d("el-date-picker");
|
|
306
|
+
return o(), c(r, b({
|
|
307
|
+
modelValue: m(t)[s.item.prop],
|
|
308
|
+
"onUpdate:modelValue": i[0] || (i[0] = (_) => m(t)[s.item.prop] = _),
|
|
309
|
+
size: m(a)
|
|
310
|
+
}, l.value), null, 16, ["modelValue", "size"]);
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
}), Le = /* @__PURE__ */ k({
|
|
314
|
+
__name: "index",
|
|
315
|
+
props: {
|
|
316
|
+
item: {}
|
|
317
|
+
},
|
|
318
|
+
setup(e) {
|
|
319
|
+
const { item: n } = e, t = h("queryParams", {}), a = h("size"), l = g({
|
|
320
|
+
...Y,
|
|
321
|
+
...n.selectSetting
|
|
322
|
+
});
|
|
323
|
+
return (s, i) => {
|
|
324
|
+
const r = d("el-option"), _ = d("el-select");
|
|
325
|
+
return o(), c(_, b({
|
|
326
|
+
modelValue: m(t)[s.item.prop],
|
|
327
|
+
"onUpdate:modelValue": i[0] || (i[0] = (p) => m(t)[s.item.prop] = p),
|
|
328
|
+
size: m(a)
|
|
329
|
+
}, l.value), {
|
|
330
|
+
default: f(() => [
|
|
331
|
+
(o(!0), S(L, null, $(s.item.option || [], (p) => (o(), c(r, {
|
|
332
|
+
key: p.value,
|
|
333
|
+
label: p.label,
|
|
334
|
+
value: p.value
|
|
335
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
336
|
+
]),
|
|
337
|
+
_: 1
|
|
338
|
+
}, 16, ["modelValue", "size"]);
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
}), Ce = /* @__PURE__ */ k({
|
|
342
|
+
__name: "index",
|
|
343
|
+
props: {
|
|
344
|
+
item: {}
|
|
345
|
+
},
|
|
346
|
+
setup(e) {
|
|
347
|
+
const { item: n } = e, t = h("queryParams", {}), a = h("size"), l = g({
|
|
348
|
+
...Y,
|
|
349
|
+
...n.selectSetting
|
|
350
|
+
});
|
|
351
|
+
return (s, i) => {
|
|
352
|
+
const r = d("el-cascader");
|
|
353
|
+
return o(), c(r, b({
|
|
354
|
+
modelValue: m(t)[s.item.prop],
|
|
355
|
+
"onUpdate:modelValue": i[0] || (i[0] = (_) => m(t)[s.item.prop] = _),
|
|
356
|
+
size: m(a),
|
|
357
|
+
options: s.item.options || []
|
|
358
|
+
}, l.value), null, 16, ["modelValue", "size", "options"]);
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
}), De = k({
|
|
362
|
+
name: "GeneralBasicForm",
|
|
363
|
+
components: {
|
|
364
|
+
Input: K,
|
|
365
|
+
InputNumber: _e,
|
|
366
|
+
InputGraphicVerification: ve,
|
|
367
|
+
InputMobileVerification: Se,
|
|
368
|
+
Divider: Pe,
|
|
369
|
+
Radio: qe,
|
|
370
|
+
Checkbox: Ve,
|
|
371
|
+
DatePicker: Ie,
|
|
372
|
+
Select: Le,
|
|
373
|
+
Cascader: Ce
|
|
374
|
+
},
|
|
375
|
+
props: {
|
|
376
|
+
showSearch: {
|
|
377
|
+
// 是否展示所有元素
|
|
378
|
+
type: Boolean,
|
|
379
|
+
default: !0
|
|
380
|
+
},
|
|
381
|
+
loading: {
|
|
382
|
+
// 加载动画
|
|
383
|
+
type: Boolean,
|
|
384
|
+
default: !1
|
|
385
|
+
},
|
|
386
|
+
formOnly: {
|
|
387
|
+
// 是否只展示表单不展示按钮
|
|
388
|
+
type: Boolean,
|
|
389
|
+
default: !1
|
|
390
|
+
},
|
|
391
|
+
getList: {
|
|
392
|
+
// 查找数据调用的函数
|
|
393
|
+
type: Function,
|
|
394
|
+
default: () => {
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
afterReset: {
|
|
398
|
+
// 在重置按钮点击完后但还没重新请求时触发的的函数
|
|
399
|
+
type: Function,
|
|
400
|
+
default: () => {
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
formItem: {
|
|
404
|
+
// 定义表单的数据
|
|
405
|
+
type: Array,
|
|
406
|
+
default: []
|
|
407
|
+
},
|
|
408
|
+
size: {
|
|
409
|
+
// 控制按钮大小
|
|
410
|
+
type: String,
|
|
411
|
+
default: "default"
|
|
412
|
+
},
|
|
413
|
+
labelWidth: {
|
|
414
|
+
// 表单文字宽度
|
|
415
|
+
type: String,
|
|
416
|
+
default: "90px"
|
|
417
|
+
},
|
|
418
|
+
noUrlParameters: {
|
|
419
|
+
// 不接受和不改变url的参数
|
|
420
|
+
type: Boolean,
|
|
421
|
+
default: () => !1
|
|
422
|
+
},
|
|
423
|
+
formData: {
|
|
424
|
+
// 外部传入的表单数据,用于回填
|
|
425
|
+
type: Object,
|
|
426
|
+
default: () => {
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
noInputBlank: {
|
|
430
|
+
// 用于判断input框是否校验仅空格
|
|
431
|
+
type: Boolean,
|
|
432
|
+
default: () => !1
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
data() {
|
|
436
|
+
return {
|
|
437
|
+
formLoading: this.loading || !1,
|
|
438
|
+
trimRegex: /\S/
|
|
439
|
+
};
|
|
440
|
+
},
|
|
441
|
+
setup(e) {
|
|
442
|
+
const { size: n, noUrlParameters: t, getList: a } = e, l = ce(), s = g({
|
|
443
|
+
...t ? {} : l == null ? void 0 : l.query
|
|
444
|
+
});
|
|
445
|
+
return O(
|
|
446
|
+
/* 注入名 */
|
|
447
|
+
"queryParams",
|
|
448
|
+
/* 值 */
|
|
449
|
+
s
|
|
450
|
+
), O(
|
|
451
|
+
/* 注入名 */
|
|
452
|
+
"size",
|
|
453
|
+
/* 值 */
|
|
454
|
+
n
|
|
455
|
+
), O(
|
|
456
|
+
/* 注入名 */
|
|
457
|
+
"getList",
|
|
458
|
+
/* 值 */
|
|
459
|
+
a
|
|
460
|
+
), {
|
|
461
|
+
queryParams: s
|
|
462
|
+
};
|
|
463
|
+
},
|
|
464
|
+
watch: {
|
|
465
|
+
formData: {
|
|
466
|
+
handler(e, n) {
|
|
467
|
+
JSON.stringify(e) !== JSON.stringify(n) && (this.queryParams = {
|
|
468
|
+
...this.noUrlParameters ? {} : this.queryParams,
|
|
469
|
+
...e
|
|
470
|
+
});
|
|
471
|
+
},
|
|
472
|
+
// watch 默认是懒执行的:仅当数据源变化时,才会执行回调。但在某些场景中,我们希望在创建侦听器时,立即执行一遍回调。举例来说,我们想请求一些初始数据,然后在相关状态更改时重新请求数据。
|
|
473
|
+
// https://cn.vuejs.org/guide/essentials/watchers.html#deep-watchers
|
|
474
|
+
immediate: !0
|
|
475
|
+
// deep: true,
|
|
476
|
+
},
|
|
477
|
+
queryParams: {
|
|
478
|
+
handler(e) {
|
|
479
|
+
this.$emit("update:formData", e);
|
|
480
|
+
},
|
|
481
|
+
deep: !0
|
|
482
|
+
},
|
|
483
|
+
loading(e) {
|
|
484
|
+
this.formLoading !== e && (this.formLoading = e);
|
|
485
|
+
},
|
|
486
|
+
formLoading(e) {
|
|
487
|
+
this.loading !== e && this.$emit("update:loading", e);
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
provide() {
|
|
491
|
+
return {
|
|
492
|
+
// 显式提供一个计算属性
|
|
493
|
+
[Z]: {
|
|
494
|
+
formLoading: j(() => this.formLoading),
|
|
495
|
+
updateFormLoading: (e) => {
|
|
496
|
+
this.formLoading = e;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
},
|
|
501
|
+
methods: {
|
|
502
|
+
/** 搜索按钮操作 */
|
|
503
|
+
handleQuery() {
|
|
504
|
+
var t;
|
|
505
|
+
const e = { page: 1, limit: 10 }, n = {
|
|
506
|
+
...(t = this.$route) == null ? void 0 : t.query,
|
|
507
|
+
...this.queryParams,
|
|
508
|
+
...e
|
|
509
|
+
};
|
|
510
|
+
this.noUrlParameters || this.$router.push({
|
|
511
|
+
query: { ...n }
|
|
512
|
+
}), this.getList({
|
|
513
|
+
...n
|
|
514
|
+
});
|
|
515
|
+
},
|
|
516
|
+
/** 重置按钮操作 */
|
|
517
|
+
async resetQuery() {
|
|
518
|
+
var n;
|
|
519
|
+
this.$refs.queryFormRef.resetFields();
|
|
520
|
+
const e = { page: 1 };
|
|
521
|
+
this.noUrlParameters || await this.$router.push({
|
|
522
|
+
query: { ...e }
|
|
523
|
+
}), this.queryParams = {
|
|
524
|
+
...this.noUrlParameters ? {} : (n = this.$route) == null ? void 0 : n.query
|
|
525
|
+
}, this.afterReset(), this.handleQuery();
|
|
526
|
+
},
|
|
527
|
+
getItemRules(e) {
|
|
528
|
+
const { type: n, rules: t = [] } = e, a = [...t];
|
|
529
|
+
return this.noInputBlank && n === "input" && a.push({
|
|
530
|
+
pattern: this.trimRegex,
|
|
531
|
+
message: "请输入(不能仅输入空格)",
|
|
532
|
+
trigger: "blur"
|
|
533
|
+
}), a;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
function we(e, n, t, a, l, s) {
|
|
538
|
+
const i = d("Input"), r = d("Radio"), _ = d("Select"), p = d("Divider"), P = d("Cascader"), q = d("Checkbox"), F = d("DatePicker"), G = d("InputNumber"), N = d("InputMobileVerification"), x = d("InputGraphicVerification"), V = d("el-form-item"), R = d("el-button"), E = d("el-form"), v = U("loading");
|
|
539
|
+
return C((o(), c(E, b({
|
|
540
|
+
model: e.queryParams,
|
|
541
|
+
ref: "queryFormRef",
|
|
542
|
+
inline: "",
|
|
543
|
+
"label-position": "left",
|
|
544
|
+
"label-width": e.labelWidth
|
|
545
|
+
}, e.$attrs), {
|
|
546
|
+
default: f(() => [
|
|
547
|
+
(o(!0), S(L, null, $(e.formItem, (u) => (o(), c(V, {
|
|
548
|
+
label: u.label,
|
|
549
|
+
prop: u.prop,
|
|
550
|
+
key: u.prop,
|
|
551
|
+
rules: e.getItemRules(u)
|
|
552
|
+
}, {
|
|
553
|
+
default: f(() => [
|
|
554
|
+
u.type === "input" ? (o(), c(i, {
|
|
555
|
+
key: 0,
|
|
556
|
+
item: u
|
|
557
|
+
}, null, 8, ["item"])) : y("", !0),
|
|
558
|
+
u.type === "radio" ? (o(), c(r, {
|
|
559
|
+
key: 1,
|
|
560
|
+
item: u
|
|
561
|
+
}, null, 8, ["item"])) : y("", !0),
|
|
562
|
+
u.type === "select" ? (o(), c(_, {
|
|
563
|
+
key: 2,
|
|
564
|
+
item: u
|
|
565
|
+
}, null, 8, ["item"])) : y("", !0),
|
|
566
|
+
u.type === "divider" ? (o(), c(p, {
|
|
567
|
+
key: 3,
|
|
568
|
+
item: u
|
|
569
|
+
}, null, 8, ["item"])) : y("", !0),
|
|
570
|
+
u.type === "cascader" ? (o(), c(P, {
|
|
571
|
+
key: 4,
|
|
572
|
+
item: u
|
|
573
|
+
}, null, 8, ["item"])) : y("", !0),
|
|
574
|
+
u.type === "checkbox" ? (o(), c(q, {
|
|
575
|
+
key: 5,
|
|
576
|
+
item: u
|
|
577
|
+
}, null, 8, ["item"])) : y("", !0),
|
|
578
|
+
u.type === "date-picker" ? (o(), c(F, {
|
|
579
|
+
key: 6,
|
|
580
|
+
item: u
|
|
581
|
+
}, null, 8, ["item"])) : y("", !0),
|
|
582
|
+
u.type === "input-number" ? (o(), c(G, {
|
|
583
|
+
key: 7,
|
|
584
|
+
item: u
|
|
585
|
+
}, null, 8, ["item"])) : y("", !0),
|
|
586
|
+
u.type === "form-item-slot" ? Q(e.$slots, u.name, { key: 8 }) : y("", !0),
|
|
587
|
+
u.type === "input-mobile-verification" ? (o(), c(N, {
|
|
588
|
+
key: 9,
|
|
589
|
+
item: u
|
|
590
|
+
}, null, 8, ["item"])) : y("", !0),
|
|
591
|
+
u.type === "input-graphic-verification" ? (o(), c(x, {
|
|
592
|
+
item: u,
|
|
593
|
+
key: u.key
|
|
594
|
+
}, null, 8, ["item"])) : y("", !0)
|
|
595
|
+
]),
|
|
596
|
+
_: 2
|
|
597
|
+
}, 1032, ["label", "prop", "rules"]))), 128)),
|
|
598
|
+
Q(e.$slots, "default"),
|
|
599
|
+
e.formOnly ? y("", !0) : (o(), c(V, { key: 0 }, {
|
|
600
|
+
default: f(() => [
|
|
601
|
+
C((o(), c(R, {
|
|
602
|
+
type: "primary",
|
|
603
|
+
size: e.size,
|
|
604
|
+
onClick: e.handleQuery
|
|
605
|
+
}, {
|
|
606
|
+
default: f(() => [
|
|
607
|
+
I("查询")
|
|
608
|
+
]),
|
|
609
|
+
_: 1
|
|
610
|
+
}, 8, ["size", "onClick"])), [
|
|
611
|
+
[v, e.formLoading]
|
|
612
|
+
]),
|
|
613
|
+
T(R, {
|
|
614
|
+
size: e.size,
|
|
615
|
+
onClick: e.resetQuery
|
|
616
|
+
}, {
|
|
617
|
+
default: f(() => [
|
|
618
|
+
I("重置")
|
|
619
|
+
]),
|
|
620
|
+
_: 1
|
|
621
|
+
}, 8, ["size", "onClick"])
|
|
622
|
+
]),
|
|
623
|
+
_: 1
|
|
624
|
+
})),
|
|
625
|
+
Q(e.$slots, "behind-the-button")
|
|
626
|
+
]),
|
|
627
|
+
_: 3
|
|
628
|
+
}, 16, ["model", "label-width"])), [
|
|
629
|
+
[ie, e.showSearch]
|
|
630
|
+
]);
|
|
631
|
+
}
|
|
632
|
+
const xe = /* @__PURE__ */ w(De, [["render", we]]), Be = ["infinite-scroll-disabled"], Fe = ["infinite-scroll-disabled"], Re = { class: "checkbox" }, Ue = /* @__PURE__ */ k({
|
|
633
|
+
__name: "InfiniteScrollList",
|
|
634
|
+
props: {
|
|
635
|
+
search: {
|
|
636
|
+
type: Function,
|
|
637
|
+
required: !0
|
|
638
|
+
},
|
|
639
|
+
checkbox: {
|
|
640
|
+
type: Boolean,
|
|
641
|
+
required: !1
|
|
642
|
+
},
|
|
643
|
+
id: {
|
|
644
|
+
type: String,
|
|
645
|
+
required: !0
|
|
646
|
+
},
|
|
647
|
+
name: {
|
|
648
|
+
type: String,
|
|
649
|
+
required: !0
|
|
650
|
+
},
|
|
651
|
+
extra: {
|
|
652
|
+
type: null,
|
|
653
|
+
required: !1
|
|
654
|
+
},
|
|
655
|
+
defaultSelection: {
|
|
656
|
+
type: Array,
|
|
657
|
+
required: !1
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
setup(e, { expose: n }) {
|
|
661
|
+
const t = e, { search: a, id: l, name: s, extra: i } = t, r = g([]), _ = g(1), p = g(!1), P = g([]), q = g(!1), F = (v, u) => {
|
|
662
|
+
const { i: A } = v;
|
|
663
|
+
return i && i !== "false" ? i(A) : "";
|
|
664
|
+
}, G = (v) => {
|
|
665
|
+
P.value = v.map((u) => typeof u == "object" ? u[l] : u);
|
|
666
|
+
};
|
|
667
|
+
ue(
|
|
668
|
+
() => t.defaultSelection,
|
|
669
|
+
(v = [], u = []) => {
|
|
670
|
+
G(v);
|
|
671
|
+
},
|
|
672
|
+
{ immediate: !0 }
|
|
673
|
+
);
|
|
674
|
+
const N = () => {
|
|
675
|
+
x(), P.value = [];
|
|
676
|
+
}, x = () => {
|
|
677
|
+
_.value = 1, r.value = [], p.value = !1;
|
|
678
|
+
}, V = async () => {
|
|
679
|
+
if (q.value || p.value)
|
|
680
|
+
return;
|
|
681
|
+
q.value = !0;
|
|
682
|
+
const v = await a(_.value);
|
|
683
|
+
v && v.length > 0 ? (r.value = [...r.value, ...v], _.value += 1) : p.value = !0, q.value = !1;
|
|
684
|
+
}, R = () => {
|
|
685
|
+
x(), V();
|
|
686
|
+
}, E = j(
|
|
687
|
+
() => r.value.filter((v) => P.value.includes(v[l]))
|
|
688
|
+
) || {};
|
|
689
|
+
return n({
|
|
690
|
+
reset: N,
|
|
691
|
+
lowReset: x,
|
|
692
|
+
loadList: V,
|
|
693
|
+
selectInfo: E,
|
|
694
|
+
list: r,
|
|
695
|
+
ifbottom: p,
|
|
696
|
+
refreshList: R
|
|
697
|
+
}), (v, u) => {
|
|
698
|
+
const A = d("el-checkbox"), ee = d("el-checkbox-group"), M = U("infinite-scroll"), te = U("loading");
|
|
699
|
+
return t.checkbox ? C((o(), c(ee, b({
|
|
700
|
+
key: 0,
|
|
701
|
+
modelValue: P.value,
|
|
702
|
+
"onUpdate:modelValue": u[0] || (u[0] = (z) => P.value = z)
|
|
703
|
+
}, t), {
|
|
704
|
+
default: f(() => [
|
|
705
|
+
C((o(), S("ul", {
|
|
706
|
+
class: "list",
|
|
707
|
+
"infinite-scroll-disabled": p.value
|
|
708
|
+
}, [
|
|
709
|
+
(o(!0), S(L, null, $(r.value, (z) => (o(), S("li", {
|
|
710
|
+
key: z[m(l)],
|
|
711
|
+
class: "list-item"
|
|
712
|
+
}, [
|
|
713
|
+
T(A, {
|
|
714
|
+
label: z[m(l)],
|
|
715
|
+
class: "checkbox"
|
|
716
|
+
}, {
|
|
717
|
+
default: f(() => [
|
|
718
|
+
I(D(z[m(s)]) + " ", 1),
|
|
719
|
+
t.extra ? (o(), c(F, {
|
|
720
|
+
key: 0,
|
|
721
|
+
i: z
|
|
722
|
+
}, null, 8, ["i"])) : y("", !0)
|
|
723
|
+
]),
|
|
724
|
+
_: 2
|
|
725
|
+
}, 1032, ["label"])
|
|
726
|
+
]))), 128))
|
|
727
|
+
], 8, Be)), [
|
|
728
|
+
[M, V]
|
|
729
|
+
])
|
|
730
|
+
]),
|
|
731
|
+
_: 1
|
|
732
|
+
}, 16, ["modelValue"])), [
|
|
733
|
+
[te, q.value]
|
|
734
|
+
]) : C((o(), S("ul", b({
|
|
735
|
+
key: 1,
|
|
736
|
+
class: "list",
|
|
737
|
+
"infinite-scroll-disabled": p.value
|
|
738
|
+
}, t), [
|
|
739
|
+
(o(!0), S(L, null, $(r.value, (z) => (o(), S("li", {
|
|
740
|
+
key: z[m(l)],
|
|
741
|
+
class: "list-item"
|
|
742
|
+
}, [
|
|
743
|
+
H("div", Re, [
|
|
744
|
+
I(D(z[m(s)]) + " ", 1),
|
|
745
|
+
t.extra ? (o(), c(F, {
|
|
746
|
+
key: 0,
|
|
747
|
+
i: z
|
|
748
|
+
}, null, 8, ["i"])) : y("", !0)
|
|
749
|
+
])
|
|
750
|
+
]))), 128))
|
|
751
|
+
], 16, Fe)), [
|
|
752
|
+
[M, V]
|
|
753
|
+
]);
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
const Ge = /* @__PURE__ */ w(Ue, [["__scopeId", "data-v-fa74e9b9"]]), Ne = { key: 1 }, Ee = /* @__PURE__ */ k({
|
|
758
|
+
__name: "Descriptions",
|
|
759
|
+
props: {
|
|
760
|
+
formData: {
|
|
761
|
+
type: Object,
|
|
762
|
+
required: !0
|
|
763
|
+
},
|
|
764
|
+
formItem: {
|
|
765
|
+
type: Array,
|
|
766
|
+
required: !0
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
setup(e) {
|
|
770
|
+
const n = e, t = (a, l) => {
|
|
771
|
+
const { i: s, render: i, formData: r } = a;
|
|
772
|
+
return i({
|
|
773
|
+
row: r,
|
|
774
|
+
$index: s
|
|
775
|
+
});
|
|
776
|
+
};
|
|
777
|
+
return (a, l) => {
|
|
778
|
+
const s = d("el-descriptions-item"), i = d("el-descriptions");
|
|
779
|
+
return o(), c(i, b({
|
|
780
|
+
column: 1,
|
|
781
|
+
border: "",
|
|
782
|
+
class: "form-width"
|
|
783
|
+
}, n), {
|
|
784
|
+
default: f(() => [
|
|
785
|
+
(o(!0), S(L, null, $(n.formItem, (r, _) => (o(), c(s, b({
|
|
786
|
+
key: r.prop,
|
|
787
|
+
label: r.label
|
|
788
|
+
}, r.descriptionsItemProps), {
|
|
789
|
+
default: f(() => [
|
|
790
|
+
r.render ? (o(), c(t, {
|
|
791
|
+
key: 0,
|
|
792
|
+
i: _,
|
|
793
|
+
render: r.render,
|
|
794
|
+
formData: e.formData
|
|
795
|
+
}, null, 8, ["i", "render", "formData"])) : (o(), S("span", Ne, D(e.formData[r.prop]), 1))
|
|
796
|
+
]),
|
|
797
|
+
_: 2
|
|
798
|
+
}, 1040, ["label"]))), 128))
|
|
799
|
+
]),
|
|
800
|
+
_: 1
|
|
801
|
+
}, 16);
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
}), Qe = xe, Te = Ge, je = Ee;
|
|
805
|
+
export {
|
|
806
|
+
je as VDescriptions,
|
|
807
|
+
Qe as VGeneralBasicForm,
|
|
808
|
+
Te as VInfiniteScrollList
|
|
809
|
+
};
|