general-basic-form 2.0.62 → 2.0.63

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.
Files changed (35) hide show
  1. package/README.assets/image-20210820173738506.png +0 -0
  2. package/README.md +15 -2
  3. package/package.json +8 -17
  4. package/script/link.ts +36 -0
  5. package/script/unlink.ts +45 -0
  6. package/src/Descriptions.vue +107 -0
  7. package/src/GeneralBasicForm.vue +240 -0
  8. package/src/InfiniteScrollList.vue +163 -0
  9. package/src/assets/image-20210820173037871.png +0 -0
  10. package/src/assets/logo.png +0 -0
  11. package/src/components/CustomCom/img-mask/index.vue +79 -0
  12. package/src/components/CustomCom/input-graphic-verification/index.vue +81 -0
  13. package/src/components/CustomCom/input-mobile-verification/index.vue +56 -0
  14. package/src/components/CustomCom/input-mobile-verification/verification-button.vue +82 -0
  15. package/src/components/VABasic/input/index.vue +75 -0
  16. package/src/components/VBasic/cascader/index.vue +32 -0
  17. package/src/components/VBasic/checkbox/index.vue +37 -0
  18. package/src/components/VBasic/date-picker/index.vue +31 -0
  19. package/src/components/VBasic/divider/index.vue +53 -0
  20. package/src/components/VBasic/input/index.vue +67 -0
  21. package/src/components/VBasic/input-number/index.vue +31 -0
  22. package/src/components/VBasic/radio/index.vue +37 -0
  23. package/src/components/VBasic/select/index.vue +37 -0
  24. package/src/components/setting.ts +28 -0
  25. package/src/index.ts +30 -0
  26. package/src/injectKey.ts +2 -0
  27. package/src/types/basicFrom.ts +63 -0
  28. package/src/types/componentType.ts +6 -0
  29. package/src/types/componentsProps.ts +18 -0
  30. package/tsconfig.json +14 -0
  31. package/vite.config.js +123 -0
  32. package/dist/index.js +0 -1028
  33. package/dist/index.umd.cjs +0 -1
  34. package/dist/style.css +0 -1
  35. /package/{dist → public}/index.d.ts +0 -0
package/dist/index.js DELETED
@@ -1,1028 +0,0 @@
1
- import { defineComponent as S, inject as y, resolveComponent as d, openBlock as s, createBlock as p, mergeProps as b, withKeys as te, createSlots as Y, renderList as q, withCtx as g, resolveDynamicComponent as w, createCommentVNode as _, ref as v, unref as m, onMounted as pe, createElementBlock as P, computed as U, shallowRef as O, onBeforeUnmount as me, createTextVNode as x, toDisplayString as T, h as H, normalizeProps as de, guardReactiveProps as fe, Fragment as L, provide as M, resolveDirective as X, withDirectives as R, renderSlot as Q, createVNode as ne, vShow as ye, watch as re, normalizeStyle as he, createElementVNode as ge } from "vue";
2
- import { useRoute as _e } from "vue-router";
3
- const J = {
4
- placeholder: "请输入",
5
- style: "width: 200px",
6
- clearable: !0
7
- }, ve = {
8
- style: "width: 227px",
9
- "start-placeholder": "开始日期",
10
- "end-placeholder": "结束日期",
11
- type: "daterange"
12
- }, oe = {
13
- placeholder: "请选择",
14
- filterable: !0,
15
- clearable: !0,
16
- style: "width: 200px"
17
- }, be = S({
18
- components: {
19
- InputArchive: (e) => {
20
- const { templateEle: t } = e;
21
- return t();
22
- }
23
- },
24
- props: {
25
- item: null
26
- // null就是any
27
- },
28
- setup() {
29
- const e = y("queryParams", {}), t = y("getList"), n = y("size", "default");
30
- return { queryParams: e, getList: t, size: n };
31
- },
32
- data() {
33
- return {
34
- inputSetting: {
35
- ...J,
36
- ...this.item.inputSetting,
37
- ...this.item.setting
38
- }
39
- };
40
- },
41
- // created() {
42
- // console.log("new", this.item);
43
- // console.log("new", this.inputSetting);
44
- // },
45
- methods: {
46
- currentInputComponent() {
47
- return "input-archive";
48
- }
49
- }
50
- // watch: {
51
- // item(val) {
52
- // console.log("item", val);
53
- // },
54
- // size(val) {
55
- // console.log(val);
56
- // },
57
- // },
58
- }), B = (e, t) => {
59
- const n = e.__vccOpts || e;
60
- for (const [i, o] of t)
61
- n[i] = o;
62
- return n;
63
- };
64
- function ke(e, t, n, i, o, l) {
65
- const a = d("el-input");
66
- return s(), p(a, b({
67
- onKeydown: te(e.getList, ["enter"]),
68
- modelValue: e.queryParams[e.item.prop],
69
- "onUpdate:modelValue": t[0] || (t[0] = (u) => e.queryParams[e.item.prop] = u),
70
- size: e.size
71
- }, e.inputSetting), Y({ _: 2 }, [
72
- q(e.item.template, (u, r) => ({
73
- name: r,
74
- fn: g(() => [
75
- u ? (s(), p(w(e.currentInputComponent()), {
76
- key: r,
77
- templateEle: u
78
- }, null, 8, ["templateEle"])) : _("", !0)
79
- ])
80
- }))
81
- ]), 1040, ["onKeydown", "modelValue", "size"]);
82
- }
83
- const A = /* @__PURE__ */ B(be, [["render", ke]]), Se = /* @__PURE__ */ S({
84
- __name: "index",
85
- props: {
86
- item: {}
87
- },
88
- setup(e) {
89
- const t = y("queryParams", {}), n = y("size"), i = v({
90
- ...J,
91
- ...e.item.inputSetting,
92
- ...e.item.setting
93
- });
94
- return (o, l) => {
95
- const a = d("el-input-number");
96
- return s(), p(a, b({
97
- modelValue: m(t)[o.item.prop],
98
- "onUpdate:modelValue": l[0] || (l[0] = (u) => m(t)[o.item.prop] = u),
99
- size: m(n)
100
- }, i.value), null, 16, ["modelValue", "size"]);
101
- };
102
- }
103
- }), Pe = S({
104
- components: {
105
- InputArchive: (e) => {
106
- const { templateEle: t } = e;
107
- return t();
108
- }
109
- },
110
- props: {
111
- item: null
112
- // null就是any
113
- },
114
- setup() {
115
- const e = y("queryParams", {}), t = y("getList", () => {
116
- }), n = y("size", "default"), o = y("Form").useInjectFormItemContext();
117
- return { queryParams: e, getList: t, size: n, formItemContext: o };
118
- },
119
- data() {
120
- return {
121
- inputSetting: {
122
- ...J,
123
- ...this.item.inputSetting,
124
- ...this.item.setting
125
- }
126
- };
127
- },
128
- // created() {
129
- // console.log("new", this.item);
130
- // console.log("new", this.inputSetting);
131
- // },
132
- methods: {
133
- currentInputComponent() {
134
- return "input-archive";
135
- },
136
- onInputChange(e) {
137
- this.queryParams[this.item.prop] = e.target.value, this.formItemContext.onFieldChange();
138
- }
139
- }
140
- // watch: {
141
- // item(val) {
142
- // console.log("item", val);
143
- // },
144
- // size(val) {
145
- // console.log(val);
146
- // },
147
- // },
148
- });
149
- function $e(e, t, n, i, o, l) {
150
- const a = d("a-input");
151
- return s(), p(a, b({
152
- onKeydown: te(e.getList, ["enter"]),
153
- onChange: e.onInputChange,
154
- value: e.queryParams[e.item.prop],
155
- size: e.size
156
- }, e.inputSetting), Y({ _: 2 }, [
157
- q(e.item.template, (u, r) => ({
158
- name: r,
159
- fn: g(() => [
160
- u ? (s(), p(w(e.currentInputComponent()), {
161
- key: r,
162
- templateEle: u
163
- }, null, 8, ["templateEle"])) : _("", !0)
164
- ])
165
- }))
166
- ]), 1040, ["onKeydown", "onChange", "value", "size"]);
167
- }
168
- const se = /* @__PURE__ */ B(Pe, [["render", $e]]), ae = Symbol(), Ie = /* @__PURE__ */ S({
169
- __name: "index",
170
- props: {
171
- imgSrc: {}
172
- },
173
- setup(e) {
174
- const t = v();
175
- return pe(() => {
176
- const n = new Image(), i = [], o = 8, l = 8;
177
- let a = 0, u = 0;
178
- const r = 300, f = t.value, k = f.getContext("2d");
179
- n.onload = function() {
180
- f.width = n.width, f.height = n.height, u = Math.floor(n.width / o), a = Math.floor(n.height / l), $(), z();
181
- }, n.src = e.imgSrc;
182
- const $ = () => {
183
- for (let I = 0; I < l; I++)
184
- for (let h = 0; h < o; h++)
185
- i.push({
186
- x: u * h,
187
- y: a * I,
188
- offsetX: (Math.random() - 0.5) * r,
189
- offsetY: (Math.random() - 0.5) * r
190
- });
191
- }, z = () => {
192
- k.clearRect(0, 0, f.width, f.height);
193
- let I = !0;
194
- i.forEach((h, N) => {
195
- k.drawImage(n, h.x, h.y, u, a, h.x + h.offsetX, h.y + h.offsetY, u, a), Math.abs(h.offsetX) > 0.5 && (I = !1, h.offsetX *= 0.95), Math.abs(h.offsetY) > 0.5 && (h.offsetY *= 0.95, I = !1);
196
- }), I ? setTimeout(() => {
197
- $(), z();
198
- }, 300) : requestAnimationFrame(z);
199
- };
200
- }), (n, i) => (s(), P("canvas", {
201
- ref_key: "loadingCanvas",
202
- ref: t
203
- }, null, 512));
204
- }
205
- }), ze = { class: "input-graphic-verification" }, Ve = ["src", "alt"], qe = /* @__PURE__ */ S({
206
- __name: "index",
207
- props: {
208
- item: {},
209
- componentType: { default: "Element Plus" },
210
- loading: { type: Boolean, default: !1 }
211
- },
212
- setup(e) {
213
- const {
214
- graphicSrc: t = "",
215
- graphicAlt: n = "",
216
- getGraphic: i = () => {
217
- },
218
- key: o
219
- } = e.item, { formLoading: l } = y(ae, !1), a = U(() => (l == null ? void 0 : l.value) || e.loading), u = async () => {
220
- i && !(a != null && a.value) && await i();
221
- }, r = O(A);
222
- switch (e.componentType) {
223
- case "Element Plus":
224
- r.value = A;
225
- break;
226
- case "Ant Design Vue":
227
- r.value = se;
228
- break;
229
- }
230
- return (f, k) => (s(), P("div", ze, [
231
- (s(), p(w(r.value), {
232
- item: f.item,
233
- class: "input"
234
- }, null, 8, ["item"])),
235
- a.value ? (s(), p(Ie, {
236
- key: 0,
237
- class: "graphic",
238
- imgSrc: m(t)
239
- }, null, 8, ["imgSrc"])) : (s(), P("img", {
240
- key: 1,
241
- class: "graphic",
242
- onClick: u,
243
- src: m(t),
244
- alt: m(n) || `${m(o)}`
245
- }, null, 8, Ve))
246
- ]));
247
- }
248
- });
249
- const ie = /* @__PURE__ */ B(qe, [["__scopeId", "data-v-fb7aa300"]]), E = "获取验证码", Ce = 60, we = /* @__PURE__ */ S({
250
- __name: "verification-button",
251
- props: {
252
- getSmscode: { type: Function },
253
- componentType: { default: "Element Plus" },
254
- item: {}
255
- },
256
- setup(e, { expose: t }) {
257
- const n = v(E), i = v(null), o = U(() => n.value === E), l = O("el-button");
258
- switch (e.componentType) {
259
- case "Element Plus":
260
- l.value = "el-button";
261
- break;
262
- case "Ant Design Vue":
263
- l.value = "a-button";
264
- break;
265
- }
266
- const a = () => {
267
- i && (clearInterval(i.value), i.value = null, n.value = E);
268
- }, u = async () => {
269
- if (n.value === E)
270
- if (n.value = Ce, i.value = setInterval(() => {
271
- if (Number(n.value) <= 0 || !n.value) {
272
- a();
273
- return;
274
- } else
275
- n.value = Number(n.value) - 1;
276
- }, 1e3), e.getSmscode)
277
- await e.getSmscode() === !1 && a();
278
- else
279
- return;
280
- };
281
- me(() => {
282
- a();
283
- });
284
- const r = { ...e.item.buttonSetting };
285
- return t({ buttonClick: u, reset: a }), (f, k) => (s(), p(w(l.value), b({
286
- class: "verifiaction-button",
287
- style: {
288
- color: o.value ? "var(--color-primary, #409EFF)" : "var(--text-color-placeholder, #A8ABB2)",
289
- cursor: o.value ? "pointer" : "default"
290
- },
291
- onClick: u
292
- }, r), {
293
- default: g(() => [
294
- x(T(o.value ? E : n.value + "s"), 1)
295
- ]),
296
- _: 1
297
- }, 16, ["style"]));
298
- }
299
- });
300
- const Z = /* @__PURE__ */ B(we, [["__scopeId", "data-v-aa89c1b7"]]), le = /* @__PURE__ */ S({
301
- __name: "index",
302
- props: {
303
- item: {},
304
- componentType: { default: "Element Plus" }
305
- },
306
- setup(e, { expose: t }) {
307
- const n = e.item, i = O(A), o = v();
308
- switch (e.componentType) {
309
- case "Element Plus":
310
- i.value = A, n.template = {
311
- append: () => H(Z, {
312
- getSmscode: n.getSmscode,
313
- item: e.item,
314
- ref: o
315
- })
316
- };
317
- break;
318
- case "Ant Design Vue":
319
- i.value = se, n.template = {
320
- suffix: () => H(Z, {
321
- getSmscode: n.getSmscode,
322
- item: e.item,
323
- ref: o
324
- })
325
- };
326
- break;
327
- }
328
- return t({ VerificationButtonRef: o }), (l, a) => (s(), p(w(i.value), {
329
- item: m(n),
330
- class: "input"
331
- }, null, 8, ["item"]));
332
- }
333
- }), De = S({
334
- components: {
335
- slotArchive: (e) => {
336
- const { templateEle: t } = e;
337
- return t();
338
- }
339
- },
340
- props: {
341
- item: null
342
- // null就是any
343
- },
344
- setup() {
345
- },
346
- data() {
347
- return {
348
- dividerSetting: {
349
- ...this.item.dividerSetting,
350
- ...this.item.setting
351
- }
352
- };
353
- },
354
- methods: {
355
- currentInputComponent() {
356
- return "slot-archive";
357
- }
358
- }
359
- });
360
- function xe(e, t, n, i, o, l) {
361
- const a = d("el-divider");
362
- return s(), p(a, de(fe(e.dividerSetting)), Y({ _: 2 }, [
363
- q(e.item.template, (u, r) => ({
364
- name: r,
365
- fn: g(() => [
366
- u ? (s(), p(w(e.currentInputComponent()), {
367
- key: r,
368
- templateEle: u
369
- }, null, 8, ["templateEle"])) : _("", !0)
370
- ])
371
- }))
372
- ]), 1040);
373
- }
374
- const Le = /* @__PURE__ */ B(De, [["render", xe]]), Be = /* @__PURE__ */ S({
375
- __name: "index",
376
- props: {
377
- item: {}
378
- },
379
- setup(e) {
380
- const t = y("queryParams", {}), n = y("size"), i = v({
381
- ...e.item.radioGroupSetting,
382
- ...e.item.setting
383
- });
384
- return (o, l) => {
385
- const a = d("el-radio"), u = d("el-radio-group");
386
- return s(), p(u, b({
387
- modelValue: m(t)[o.item.prop],
388
- "onUpdate:modelValue": l[0] || (l[0] = (r) => m(t)[o.item.prop] = r),
389
- size: m(n)
390
- }, i.value), {
391
- default: g(() => [
392
- (s(!0), P(L, null, q(o.item.option || [], (r) => (s(), p(a, b({
393
- size: m(n),
394
- key: r.value,
395
- ref_for: !0
396
- }, r), {
397
- default: g(() => [
398
- x(T(r.label), 1)
399
- ]),
400
- _: 2
401
- }, 1040, ["size"]))), 128))
402
- ]),
403
- _: 1
404
- }, 16, ["modelValue", "size"]);
405
- };
406
- }
407
- }), Fe = /* @__PURE__ */ S({
408
- __name: "index",
409
- props: {
410
- item: {}
411
- },
412
- setup(e) {
413
- const t = y("queryParams", {}), n = y("size"), i = v({
414
- ...e.item.checkboxGroupSetting,
415
- ...e.item.setting
416
- });
417
- return (o, l) => {
418
- const a = d("el-checkbox"), u = d("el-checkbox-group");
419
- return s(), p(u, b({
420
- modelValue: m(t)[o.item.prop],
421
- "onUpdate:modelValue": l[0] || (l[0] = (r) => m(t)[o.item.prop] = r),
422
- size: m(n)
423
- }, i.value), {
424
- default: g(() => [
425
- (s(!0), P(L, null, q(o.item.option || [], (r) => (s(), p(a, b({
426
- size: m(n),
427
- key: r.value,
428
- ref_for: !0
429
- }, r), {
430
- default: g(() => [
431
- x(T(r.label), 1)
432
- ]),
433
- _: 2
434
- }, 1040, ["size"]))), 128))
435
- ]),
436
- _: 1
437
- }, 16, ["modelValue", "size"]);
438
- };
439
- }
440
- }), Te = /* @__PURE__ */ S({
441
- __name: "index",
442
- props: {
443
- item: {}
444
- },
445
- setup(e) {
446
- const t = y("queryParams", {}), n = y("size"), i = v({
447
- ...ve,
448
- ...e.item.datePackerSetting,
449
- ...e.item.setting
450
- });
451
- return (o, l) => {
452
- const a = d("el-date-picker");
453
- return s(), p(a, b({
454
- modelValue: m(t)[o.item.prop],
455
- "onUpdate:modelValue": l[0] || (l[0] = (u) => m(t)[o.item.prop] = u),
456
- size: m(n)
457
- }, i.value), null, 16, ["modelValue", "size"]);
458
- };
459
- }
460
- }), Ee = /* @__PURE__ */ S({
461
- __name: "index",
462
- props: {
463
- item: {}
464
- },
465
- setup(e) {
466
- const t = y("queryParams", {}), n = y("size"), i = v({
467
- ...oe,
468
- ...e.item.selectSetting,
469
- ...e.item.setting
470
- });
471
- return (o, l) => {
472
- const a = d("el-option"), u = d("el-select");
473
- return s(), p(u, b({
474
- modelValue: m(t)[o.item.prop],
475
- "onUpdate:modelValue": l[0] || (l[0] = (r) => m(t)[o.item.prop] = r),
476
- size: m(n)
477
- }, i.value), {
478
- default: g(() => [
479
- (s(!0), P(L, null, q(o.item.option || [], (r) => (s(), p(a, b({
480
- key: r.value,
481
- ref_for: !0
482
- }, r), null, 16))), 128))
483
- ]),
484
- _: 1
485
- }, 16, ["modelValue", "size"]);
486
- };
487
- }
488
- }), Re = /* @__PURE__ */ S({
489
- __name: "index",
490
- props: {
491
- item: {}
492
- },
493
- setup(e) {
494
- const t = y("queryParams", {}), n = y("size"), i = v({
495
- ...oe,
496
- ...e.item.selectSetting,
497
- ...e.item.setting
498
- });
499
- return (o, l) => {
500
- const a = d("el-cascader");
501
- return s(), p(a, b({
502
- modelValue: m(t)[o.item.prop],
503
- "onUpdate:modelValue": l[0] || (l[0] = (u) => m(t)[o.item.prop] = u),
504
- size: m(n),
505
- options: o.item.options || []
506
- }, i.value), null, 16, ["modelValue", "size", "options"]);
507
- };
508
- }
509
- }), Oe = (e = {}) => {
510
- for (const t in e)
511
- if (Object.prototype.hasOwnProperty.call(e, t)) {
512
- const n = e[t];
513
- Object.prototype.toString.call(n) === "[object Object]" && (e[t] = JSON.stringify(n));
514
- }
515
- return e;
516
- }, Ae = (e = {}) => {
517
- for (const t in e)
518
- if (Object.prototype.hasOwnProperty.call(e, t)) {
519
- const n = e[t];
520
- try {
521
- /[{]+/g.test(n) && /[}]+/g.test(n) && (e[t] = JSON.parse(n));
522
- } catch {
523
- }
524
- }
525
- return e;
526
- }, Ne = { paramsToQuery: Oe, queryToData: Ae }, ee = Ne, Ue = S({
527
- name: "GeneralBasicForm",
528
- components: {
529
- Input: A,
530
- InputNumber: Se,
531
- InputGraphicVerification: ie,
532
- InputMobileVerification: le,
533
- Divider: Le,
534
- Radio: Be,
535
- Checkbox: Fe,
536
- DatePicker: Te,
537
- Select: Ee,
538
- Cascader: Re
539
- },
540
- props: {
541
- showSearch: {
542
- // 是否展示所有元素
543
- type: Boolean,
544
- default: !0
545
- },
546
- loading: {
547
- // 加载动画
548
- type: Boolean,
549
- default: !1
550
- },
551
- formOnly: {
552
- // 是否只展示表单不展示按钮
553
- type: Boolean,
554
- default: !1
555
- },
556
- getList: {
557
- // 查找数据调用的函数
558
- type: Function,
559
- default: () => {
560
- }
561
- },
562
- afterReset: {
563
- // 在重置按钮点击完后但还没重新请求时触发的的函数
564
- type: Function,
565
- default: () => {
566
- }
567
- },
568
- formItem: {
569
- // 定义表单的数据
570
- type: Array,
571
- default: () => []
572
- },
573
- size: {
574
- // 控制按钮大小
575
- type: String,
576
- default: "default"
577
- },
578
- labelWidth: {
579
- // 表单文字宽度
580
- type: String,
581
- default: "90px"
582
- },
583
- noUrlParameters: {
584
- // 不接受和不改变url的参数
585
- type: Boolean,
586
- default: () => !1
587
- },
588
- formData: {
589
- // 外部传入的表单数据,用于回填
590
- type: Object,
591
- default: () => {
592
- }
593
- },
594
- noInputBlank: {
595
- // 用于判断input框是否校验仅空格
596
- type: Boolean,
597
- default: () => !1
598
- },
599
- currentPageKey: {
600
- type: String,
601
- default: "page"
602
- },
603
- pageSizeKey: {
604
- type: String,
605
- default: "limit"
606
- },
607
- defCurrentPage: {
608
- type: Number,
609
- default: 1
610
- },
611
- defPageSize: {
612
- type: Number,
613
- default: 10
614
- }
615
- },
616
- data() {
617
- return {
618
- formLoading: this.loading || !1,
619
- trimRegex: /\S/
620
- };
621
- },
622
- setup(e) {
623
- const { size: t, noUrlParameters: n, getList: i } = e, o = _e(), l = v({
624
- ...n ? {} : ee.queryToData(o == null ? void 0 : o.query)
625
- });
626
- return M(
627
- /* 注入名 */
628
- "queryParams",
629
- /* 值 */
630
- l
631
- ), M(
632
- /* 注入名 */
633
- "size",
634
- /* 值 */
635
- t
636
- ), M(
637
- /* 注入名 */
638
- "getList",
639
- /* 值 */
640
- i
641
- ), {
642
- queryParams: l
643
- };
644
- },
645
- watch: {
646
- formData: {
647
- handler(e, t) {
648
- JSON.stringify(e) !== JSON.stringify(t) && (this.queryParams = {
649
- ...this.queryParams,
650
- ...e
651
- });
652
- },
653
- // watch 默认是懒执行的:仅当数据源变化时,才会执行回调。但在某些场景中,我们希望在创建侦听器时,立即执行一遍回调。举例来说,我们想请求一些初始数据,然后在相关状态更改时重新请求数据。
654
- // https://cn.vuejs.org/guide/essentials/watchers.html#deep-watchers
655
- immediate: !0
656
- // deep: true,
657
- },
658
- queryParams: {
659
- handler(e) {
660
- this.$emit("update:formData", e);
661
- },
662
- deep: !0
663
- },
664
- loading(e) {
665
- this.formLoading !== e && (this.formLoading = e);
666
- },
667
- formLoading(e) {
668
- this.loading !== e && this.$emit("update:loading", e);
669
- }
670
- },
671
- provide() {
672
- return {
673
- // 显式提供一个计算属性
674
- [ae]: {
675
- formLoading: U(() => this.formLoading),
676
- updateFormLoading: (e) => {
677
- this.formLoading = e;
678
- }
679
- }
680
- };
681
- },
682
- methods: {
683
- /** 搜索按钮操作 */
684
- handleQuery() {
685
- var n;
686
- const e = { [this.currentPageKey]: this.defCurrentPage, [this.pageSizeKey]: this.defPageSize }, t = ee.paramsToQuery({
687
- ...(n = this.$route) == null ? void 0 : n.query,
688
- ...this.queryParams,
689
- ...e
690
- });
691
- this.noUrlParameters || this.$router.push({
692
- query: { ...t }
693
- }), this.getList({
694
- ...t
695
- });
696
- },
697
- /** 重置按钮操作 */
698
- async resetQuery() {
699
- var t;
700
- this.$refs.queryFormRef.resetFields();
701
- const e = { [this.currentPageKey]: this.defCurrentPage };
702
- this.noUrlParameters || await this.$router.push({
703
- query: { ...e }
704
- }), this.queryParams = {
705
- ...this.noUrlParameters ? {} : (t = this.$route) == null ? void 0 : t.query
706
- }, this.afterReset(), this.handleQuery();
707
- },
708
- getItemRules(e) {
709
- const { type: t, rules: n = [] } = e, i = [...n];
710
- return this.noInputBlank && t === "input" && i.push({
711
- pattern: this.trimRegex,
712
- message: "请输入(不能仅输入空格)",
713
- trigger: "blur"
714
- }), i;
715
- }
716
- }
717
- });
718
- function je(e, t, n, i, o, l) {
719
- const a = d("Input"), u = d("Radio"), r = d("Select"), f = d("Divider"), k = d("Cascader"), $ = d("Checkbox"), z = d("DatePicker"), I = d("InputNumber"), h = d("InputMobileVerification"), N = d("InputGraphicVerification"), F = d("el-form-item"), D = d("el-button"), j = d("el-form"), G = X("loading");
720
- return R((s(), p(j, b({
721
- model: e.queryParams,
722
- ref: "queryFormRef",
723
- inline: "",
724
- "label-position": "left",
725
- "label-width": e.labelWidth
726
- }, e.$attrs), {
727
- default: g(() => [
728
- (s(!0), P(L, null, q(e.formItem, (c) => (s(), p(F, {
729
- label: c.label,
730
- prop: c.prop,
731
- key: c.prop,
732
- rules: e.getItemRules(c)
733
- }, {
734
- default: g(() => [
735
- /^input$/i.test(c.type) ? (s(), p(a, {
736
- key: 0,
737
- item: c
738
- }, null, 8, ["item"])) : _("", !0),
739
- /^radio$/i.test(c.type) ? (s(), p(u, {
740
- key: 1,
741
- item: c
742
- }, null, 8, ["item"])) : _("", !0),
743
- /^select$/i.test(c.type) ? (s(), p(r, {
744
- key: 2,
745
- item: c
746
- }, null, 8, ["item"])) : _("", !0),
747
- /^divider$/i.test(c.type) ? (s(), p(f, {
748
- key: 3,
749
- item: c
750
- }, null, 8, ["item"])) : _("", !0),
751
- /^cascader$/i.test(c.type) ? (s(), p(k, {
752
- key: 4,
753
- item: c
754
- }, null, 8, ["item"])) : _("", !0),
755
- /^checkbox$/i.test(c.type) ? (s(), p($, {
756
- key: 5,
757
- item: c
758
- }, null, 8, ["item"])) : _("", !0),
759
- /^date-picker$/i.test(c.type) ? (s(), p(z, {
760
- key: 6,
761
- item: c
762
- }, null, 8, ["item"])) : _("", !0),
763
- /^input-number$/i.test(c.type) ? (s(), p(I, {
764
- key: 7,
765
- item: c
766
- }, null, 8, ["item"])) : _("", !0),
767
- /^form-item-slot$/i.test(c.type) ? Q(e.$slots, c.name, { key: 8 }) : _("", !0),
768
- /^input-mobile-verification$/i.test(c.type) ? (s(), p(h, {
769
- key: 9,
770
- item: c
771
- }, null, 8, ["item"])) : _("", !0),
772
- /^input-graphic-verification$/i.test(c.type) ? (s(), p(N, {
773
- item: c,
774
- key: c.key
775
- }, null, 8, ["item"])) : _("", !0)
776
- ]),
777
- _: 2
778
- }, 1032, ["label", "prop", "rules"]))), 128)),
779
- Q(e.$slots, "default"),
780
- e.formOnly ? _("", !0) : (s(), p(F, { key: 0 }, {
781
- default: g(() => [
782
- R((s(), p(D, {
783
- type: "primary",
784
- size: e.size,
785
- onClick: e.handleQuery
786
- }, {
787
- default: g(() => t[0] || (t[0] = [
788
- x("查询")
789
- ])),
790
- _: 1
791
- }, 8, ["size", "onClick"])), [
792
- [G, e.formLoading]
793
- ]),
794
- ne(D, {
795
- size: e.size,
796
- onClick: e.resetQuery
797
- }, {
798
- default: g(() => t[1] || (t[1] = [
799
- x("重置")
800
- ])),
801
- _: 1
802
- }, 8, ["size", "onClick"])
803
- ]),
804
- _: 1
805
- })),
806
- Q(e.$slots, "behind-the-button")
807
- ]),
808
- _: 3
809
- }, 16, ["model", "label-width"])), [
810
- [ye, e.showSearch]
811
- ]);
812
- }
813
- const Ge = /* @__PURE__ */ B(Ue, [["render", je]]), Ke = ["infinite-scroll-disabled"], Me = ["infinite-scroll-disabled"], Qe = { class: "checkbox" }, Xe = /* @__PURE__ */ S({
814
- __name: "InfiniteScrollList",
815
- props: {
816
- search: {
817
- type: Function,
818
- required: !0
819
- },
820
- checkbox: {
821
- type: Boolean,
822
- required: !1
823
- },
824
- id: {
825
- type: String,
826
- required: !0
827
- },
828
- name: {
829
- type: String,
830
- required: !1
831
- },
832
- extra: {
833
- type: null,
834
- required: !1
835
- },
836
- defaultSelection: {
837
- type: Array,
838
- required: !1
839
- },
840
- height: {
841
- type: String,
842
- required: !1,
843
- default: "272px"
844
- }
845
- },
846
- setup(e, { expose: t }) {
847
- const n = e, { search: i, id: o, name: l, extra: a, height: u } = n, r = v([]), f = v(1), k = v(!1), $ = v([]), z = v(!1), I = (c, C) => {
848
- const { i: K } = c;
849
- return a && a !== "false" ? a(K) : "";
850
- }, h = (c) => {
851
- $.value = c.map((C) => typeof C == "object" ? C[o] : C);
852
- };
853
- re(
854
- () => n.defaultSelection,
855
- (c = [], C = []) => {
856
- h(c);
857
- },
858
- { immediate: !0 }
859
- );
860
- const N = () => {
861
- F(), $.value = [];
862
- }, F = () => {
863
- f.value = 1, r.value = [], k.value = !1;
864
- }, D = async () => {
865
- if (z.value || k.value)
866
- return;
867
- z.value = !0;
868
- const c = await i(f.value);
869
- c && c.length > 0 ? (r.value = [...r.value, ...c], f.value += 1) : k.value = !0, z.value = !1;
870
- }, j = () => {
871
- F(), D();
872
- }, G = U(
873
- () => r.value.filter((c) => $.value.includes(c[o]))
874
- ) || {};
875
- return t({
876
- reset: N,
877
- lowReset: F,
878
- loadList: D,
879
- selectInfo: G,
880
- list: r,
881
- ifbottom: k,
882
- refreshList: j,
883
- loading: z
884
- }), (c, C) => {
885
- const K = d("el-checkbox"), ue = d("el-checkbox-group"), W = X("infinite-scroll"), ce = X("loading");
886
- return n.checkbox ? R((s(), p(ue, b({
887
- key: 0,
888
- modelValue: $.value,
889
- "onUpdate:modelValue": C[0] || (C[0] = (V) => $.value = V)
890
- }, n), {
891
- default: g(() => [
892
- R((s(), P("ul", {
893
- class: "list",
894
- "infinite-scroll-disabled": k.value,
895
- style: he({ height: m(u) })
896
- }, [
897
- (s(!0), P(L, null, q(r.value, (V) => (s(), P("li", {
898
- key: V[m(o)],
899
- class: "list-item"
900
- }, [
901
- ne(K, {
902
- value: V[m(o)],
903
- class: "checkbox"
904
- }, {
905
- default: g(() => [
906
- x(T(V[m(l)]) + " ", 1),
907
- n.extra ? (s(), p(I, {
908
- key: 0,
909
- i: V
910
- }, null, 8, ["i"])) : _("", !0)
911
- ]),
912
- _: 2
913
- }, 1032, ["value"])
914
- ]))), 128))
915
- ], 12, Ke)), [
916
- [W, D]
917
- ])
918
- ]),
919
- _: 1
920
- }, 16, ["modelValue"])), [
921
- [ce, z.value]
922
- ]) : R((s(), P("ul", b({
923
- key: 1,
924
- class: "list",
925
- "infinite-scroll-disabled": k.value,
926
- style: { height: m(u) }
927
- }, n), [
928
- (s(!0), P(L, null, q(r.value, (V) => (s(), P("li", {
929
- key: V[m(o)],
930
- class: "list-item"
931
- }, [
932
- ge("div", Qe, [
933
- x(T(V[m(l)]) + " ", 1),
934
- n.extra ? (s(), p(I, {
935
- key: 0,
936
- i: V
937
- }, null, 8, ["i"])) : _("", !0)
938
- ])
939
- ]))), 128))
940
- ], 16, Me)), [
941
- [W, D]
942
- ]);
943
- };
944
- }
945
- });
946
- const Ye = /* @__PURE__ */ B(Xe, [["__scopeId", "data-v-e29b1da3"]]), Je = { key: 1 }, We = /* @__PURE__ */ S({
947
- __name: "Descriptions",
948
- props: {
949
- formData: {
950
- type: Object,
951
- required: !0
952
- },
953
- formItem: {
954
- type: Array,
955
- required: !0
956
- },
957
- componentType: {
958
- type: String,
959
- default: "Element Plus"
960
- },
961
- strict: {
962
- // 使用strict参数后,如果formData内的某个字段没有值,对应的描述元素将不会展示(包括标签文字),但有render的字段仍然会展示
963
- type: Boolean,
964
- default: !1
965
- }
966
- },
967
- setup(e) {
968
- const t = e, n = v([]);
969
- re(
970
- () => [t.formData, t.formItem],
971
- ([a = {}, u = []]) => {
972
- let r = u;
973
- if (t.strict)
974
- for (const f in a)
975
- Object.prototype.hasOwnProperty.call(a, f) && (a[f] || (r = r.filter(($) => $.prop !== f || $.render)));
976
- n.value = r;
977
- },
978
- { immediate: !0 }
979
- );
980
- const i = O("el-descriptions-item"), o = O("descriptions-item");
981
- switch (t.componentType) {
982
- case "Element Plus":
983
- i.value = "el-descriptions-item", o.value = "el-descriptions-item";
984
- break;
985
- case "Ant Design Vue":
986
- i.value = "a-descriptions", o.value = "a-descriptions-item";
987
- break;
988
- }
989
- const l = (a, u) => {
990
- const { i: r, render: f, formData: k } = a;
991
- return f({
992
- row: k,
993
- $index: r
994
- });
995
- };
996
- return (a, u) => (s(), p(w(i.value), b({
997
- column: 1,
998
- border: "",
999
- class: "form-width"
1000
- }, a.$attrs), {
1001
- default: g(() => [
1002
- (s(!0), P(L, null, q(n.value, (r, f) => (s(), p(w(o.value), b({
1003
- key: r.prop,
1004
- label: r.label,
1005
- ref_for: !0
1006
- }, r.descriptionsItemProps), {
1007
- default: g(() => [
1008
- r.render ? (s(), p(l, {
1009
- key: 0,
1010
- i: f,
1011
- render: r.render,
1012
- formData: e.formData
1013
- }, null, 8, ["i", "render", "formData"])) : (s(), P("span", Je, T(e.formData[r.prop]), 1))
1014
- ]),
1015
- _: 2
1016
- }, 1040, ["label"]))), 128))
1017
- ]),
1018
- _: 1
1019
- }, 16));
1020
- }
1021
- }), et = Ge, tt = Ye, nt = We, rt = ie, ot = le;
1022
- export {
1023
- nt as VDescriptions,
1024
- et as VGeneralBasicForm,
1025
- tt as VInfiniteScrollList,
1026
- rt as VInputGraphicVerification,
1027
- ot as VInputMobilecVerification
1028
- };