general-basic-form 2.0.12 → 2.0.13
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 +71 -2
- package/dist/index.js +306 -193
- package/dist/index.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# GeneralBasicForm
|
|
2
2
|
|
|
3
|
-
一个兼容 Vue3 和 React(未来实现) 的表单组件
|
|
3
|
+
## 一个兼容 Vue3 和 React(未来实现) 的表单组件
|
|
4
4
|
|
|
5
5
|
示例:
|
|
6
6
|
|
|
@@ -394,5 +394,74 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
|
|
|
394
394
|
|
|
395
395
|
'input-number' = 'input-number',
|
|
396
396
|
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
## 对虚拟滚动列表+接口的封装
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+

|
|
404
|
+
|
|
405
|
+
```
|
|
406
|
+
import { VInfiniteScrollList } from 'general-basic-form'
|
|
407
|
+
<VInfiniteScrollList
|
|
408
|
+
:search="search"
|
|
409
|
+
id="user_id"
|
|
410
|
+
name="name"
|
|
411
|
+
ref="InfiniteScrollListRef"
|
|
412
|
+
:extra="extraRender"
|
|
413
|
+
:max="1"
|
|
414
|
+
/>
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
```
|
|
418
|
+
search:数据接口 (page: Number) => Promise<[]>
|
|
419
|
+
id:数据key值(唯一和选择值)
|
|
420
|
+
name:显示名字
|
|
421
|
+
extra:同行额外显示的内容,(item: any) => Node|String
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
```
|
|
425
|
+
defineExpose({ reset, loadList, selectInfo });
|
|
426
|
+
InfiniteScrollListRef.value.reset():重置列表内容
|
|
427
|
+
InfiniteScrollListRef.value.loadList():重新请求列表内容
|
|
428
|
+
InfiniteScrollListRef?.value?.selectInfo:选择的内容
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
## 对展示描述列表的封装
|
|
432
|
+
|
|
433
|
+

|
|
434
|
+
|
|
435
|
+
```
|
|
436
|
+
import { VDescriptions } from 'general-basic-form'
|
|
437
|
+
<VDescriptions
|
|
438
|
+
:formData="props.formData"
|
|
439
|
+
:formItem="formItem"
|
|
440
|
+
:descriptionsItemProps="{
|
|
441
|
+
'label-class-name': 'label-class-name'
|
|
442
|
+
}"
|
|
443
|
+
...其他el-descriptions的配置
|
|
444
|
+
/>
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
```
|
|
448
|
+
formData:Object
|
|
449
|
+
formItem:[ {
|
|
450
|
+
label: '受访人',
|
|
451
|
+
prop: 'contactors',
|
|
452
|
+
render: (scope: any) => {
|
|
453
|
+
const { $index, row = {} } = scope
|
|
454
|
+
const { contactors = [] } = row
|
|
455
|
+
const ele = (contactors.length > 0 ? <span>{contactors.map((item: any) => item.name).join(",")} </span> : null)
|
|
456
|
+
return ele
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
label: '拜访详情',
|
|
461
|
+
prop: 'detail',
|
|
462
|
+
}]
|
|
463
|
+
descriptionsItemProps:el-descriptions-item的配置
|
|
464
|
+
```
|
|
465
|
+
|
|
397
466
|
安装:npm i general-basic-form<br/>
|
|
398
|
-
install: npm i general-basic-form
|
|
467
|
+
install: npm i general-basic-form
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRoute as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as g, inject as v, resolveComponent as c, openBlock as o, createBlock as u, mergeProps as k, withKeys as X, createSlots as x, renderList as z, withCtx as f, resolveDynamicComponent as K, createCommentVNode as b, ref as y, unref as m, resolveDirective as U, withDirectives as D, createElementBlock as P, createVNode as O, createElementVNode as Y, computed as Q, onBeforeUnmount as Z, normalizeStyle as ee, createTextVNode as V, toDisplayString as w, h as te, normalizeProps as ne, guardReactiveProps as oe, Fragment as F, provide as A, renderSlot as j, vShow as re } from "vue";
|
|
2
|
+
import { useRoute as se } from "vue-router";
|
|
3
|
+
const M = {
|
|
4
4
|
placeholder: "请输入",
|
|
5
5
|
style: "width: 200px",
|
|
6
6
|
clearable: !0
|
|
7
|
-
},
|
|
7
|
+
}, ie = {
|
|
8
8
|
style: "width: 227px",
|
|
9
9
|
"start-placeholder": "开始日期",
|
|
10
10
|
"end-placeholder": "结束日期",
|
|
11
11
|
type: "daterange"
|
|
12
|
-
},
|
|
12
|
+
}, W = {
|
|
13
13
|
placeholder: "请选择",
|
|
14
14
|
filterable: !0,
|
|
15
15
|
clearable: !0,
|
|
16
16
|
style: "width: 200px"
|
|
17
|
-
}, ae =
|
|
17
|
+
}, ae = g({
|
|
18
18
|
components: {
|
|
19
19
|
InputArchive: (e) => {
|
|
20
20
|
const { templateEle: n } = e;
|
|
@@ -26,13 +26,13 @@ const A = {
|
|
|
26
26
|
// null就是any
|
|
27
27
|
},
|
|
28
28
|
setup() {
|
|
29
|
-
const e =
|
|
29
|
+
const e = v("queryParams", {}), n = v("getList"), t = v("size");
|
|
30
30
|
return { queryParams: e, getList: n, size: t };
|
|
31
31
|
},
|
|
32
32
|
data() {
|
|
33
33
|
return {
|
|
34
34
|
inputSetting: {
|
|
35
|
-
...
|
|
35
|
+
...M,
|
|
36
36
|
...this.item.inputSetting
|
|
37
37
|
}
|
|
38
38
|
};
|
|
@@ -54,120 +54,120 @@ const A = {
|
|
|
54
54
|
// console.log(val);
|
|
55
55
|
// },
|
|
56
56
|
// },
|
|
57
|
-
}),
|
|
57
|
+
}), I = (e, n) => {
|
|
58
58
|
const t = e.__vccOpts || e;
|
|
59
|
-
for (const [
|
|
60
|
-
t[
|
|
59
|
+
for (const [l, s] of n)
|
|
60
|
+
t[l] = s;
|
|
61
61
|
return t;
|
|
62
62
|
};
|
|
63
|
-
function
|
|
64
|
-
const
|
|
65
|
-
return o(),
|
|
66
|
-
onKeydown:
|
|
63
|
+
function le(e, n, t, l, s, a) {
|
|
64
|
+
const r = c("el-input");
|
|
65
|
+
return o(), u(r, k({
|
|
66
|
+
onKeydown: X(e.getList, ["enter"]),
|
|
67
67
|
modelValue: e.queryParams[e.item.prop],
|
|
68
|
-
"onUpdate:modelValue": n[0] || (n[0] = (
|
|
68
|
+
"onUpdate:modelValue": n[0] || (n[0] = (i) => e.queryParams[e.item.prop] = i),
|
|
69
69
|
size: e.size
|
|
70
|
-
}, e.inputSetting),
|
|
71
|
-
|
|
72
|
-
name:
|
|
73
|
-
fn:
|
|
74
|
-
|
|
75
|
-
key:
|
|
76
|
-
templateEle:
|
|
77
|
-
}, null, 8, ["templateEle"])) :
|
|
70
|
+
}, e.inputSetting), x({ _: 2 }, [
|
|
71
|
+
z(e.item.template, (i, d) => ({
|
|
72
|
+
name: d,
|
|
73
|
+
fn: f(() => [
|
|
74
|
+
i ? (o(), u(K(e.currentInputComponent()), {
|
|
75
|
+
key: d,
|
|
76
|
+
templateEle: i
|
|
77
|
+
}, null, 8, ["templateEle"])) : b("", !0)
|
|
78
78
|
])
|
|
79
79
|
}))
|
|
80
80
|
]), 1040, ["onKeydown", "modelValue", "size"]);
|
|
81
81
|
}
|
|
82
|
-
const
|
|
82
|
+
const T = /* @__PURE__ */ I(ae, [["render", le]]), ue = /* @__PURE__ */ g({
|
|
83
83
|
__name: "index",
|
|
84
84
|
props: {
|
|
85
85
|
item: {}
|
|
86
86
|
},
|
|
87
87
|
setup(e) {
|
|
88
|
-
const { item: n } = e, t =
|
|
89
|
-
...
|
|
88
|
+
const { item: n } = e, t = v("queryParams", {}), l = v("size"), s = y({
|
|
89
|
+
...M,
|
|
90
90
|
...n.inputSetting
|
|
91
91
|
});
|
|
92
|
-
return (
|
|
93
|
-
const
|
|
94
|
-
return o(),
|
|
95
|
-
modelValue:
|
|
96
|
-
"onUpdate:modelValue":
|
|
97
|
-
size:
|
|
98
|
-
},
|
|
92
|
+
return (a, r) => {
|
|
93
|
+
const i = c("el-input-number");
|
|
94
|
+
return o(), u(i, k({
|
|
95
|
+
modelValue: m(t)[a.item.prop],
|
|
96
|
+
"onUpdate:modelValue": r[0] || (r[0] = (d) => m(t)[a.item.prop] = d),
|
|
97
|
+
size: m(l)
|
|
98
|
+
}, s.value), null, 16, ["modelValue", "size"]);
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
}),
|
|
101
|
+
}), H = Symbol(), ce = { class: "input-graphic-verification" }, pe = ["src"], me = /* @__PURE__ */ g({
|
|
102
102
|
__name: "index",
|
|
103
103
|
props: {
|
|
104
104
|
item: {}
|
|
105
105
|
},
|
|
106
106
|
setup(e) {
|
|
107
|
-
const { item: n } = e, { graphicSrc: t = "", getGraphic:
|
|
108
|
-
} } = n, { formLoading:
|
|
109
|
-
|
|
107
|
+
const { item: n } = e, { graphicSrc: t = "", getGraphic: l = () => {
|
|
108
|
+
} } = n, { formLoading: s, updateFormLoading: a } = v(H), r = async () => {
|
|
109
|
+
l && !s.value && await l();
|
|
110
110
|
};
|
|
111
|
-
return (
|
|
112
|
-
const
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
item:
|
|
111
|
+
return (i, d) => {
|
|
112
|
+
const _ = U("loading");
|
|
113
|
+
return D((o(), P("div", ce, [
|
|
114
|
+
O(T, {
|
|
115
|
+
item: i.item,
|
|
116
116
|
class: "input"
|
|
117
117
|
}, null, 8, ["item"]),
|
|
118
|
-
|
|
118
|
+
Y("img", {
|
|
119
119
|
class: "graphic",
|
|
120
|
-
onClick:
|
|
121
|
-
src:
|
|
122
|
-
}, null, 8,
|
|
120
|
+
onClick: r,
|
|
121
|
+
src: m(t)
|
|
122
|
+
}, null, 8, pe)
|
|
123
123
|
])), [
|
|
124
|
-
[
|
|
124
|
+
[_, m(s)]
|
|
125
125
|
]);
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
|
-
const
|
|
129
|
+
const de = /* @__PURE__ */ I(me, [["__scopeId", "data-v-500ec9b0"]]), C = "获取验证码", _e = 60, fe = /* @__PURE__ */ g({
|
|
130
130
|
__name: "verification-button",
|
|
131
131
|
props: {
|
|
132
132
|
getSmscode: { type: Function }
|
|
133
133
|
},
|
|
134
134
|
setup(e) {
|
|
135
|
-
const { getSmscode: n } = e, t =
|
|
136
|
-
|
|
137
|
-
},
|
|
138
|
-
if (t.value ===
|
|
139
|
-
if (t.value =
|
|
135
|
+
const { getSmscode: n } = e, t = y(C), l = y(null), s = Q(() => t.value === C), a = () => {
|
|
136
|
+
l && (clearInterval(l.value), l.value = null, t.value = C);
|
|
137
|
+
}, r = async () => {
|
|
138
|
+
if (t.value === C)
|
|
139
|
+
if (t.value = _e, l.value = setInterval(() => {
|
|
140
140
|
if (Number(t.value) <= 0 || !t.value) {
|
|
141
|
-
|
|
141
|
+
a();
|
|
142
142
|
return;
|
|
143
143
|
} else
|
|
144
144
|
t.value = Number(t.value) - 1;
|
|
145
145
|
}, 1e3), n)
|
|
146
|
-
await n() === !1 &&
|
|
146
|
+
await n() === !1 && a();
|
|
147
147
|
else
|
|
148
148
|
return;
|
|
149
149
|
};
|
|
150
|
-
return
|
|
151
|
-
|
|
152
|
-
}), (
|
|
153
|
-
const
|
|
154
|
-
return o(),
|
|
150
|
+
return Z(() => {
|
|
151
|
+
a();
|
|
152
|
+
}), (i, d) => {
|
|
153
|
+
const _ = c("el-button");
|
|
154
|
+
return o(), u(_, {
|
|
155
155
|
class: "verifiaction-button",
|
|
156
|
-
style:
|
|
157
|
-
color:
|
|
158
|
-
cursor:
|
|
156
|
+
style: ee({
|
|
157
|
+
color: s.value ? "var(--color-primary, #409EFF)" : "var(--text-color-placeholder, #A8ABB2)",
|
|
158
|
+
cursor: s.value ? "pointer" : "default"
|
|
159
159
|
}),
|
|
160
|
-
onClick:
|
|
160
|
+
onClick: r
|
|
161
161
|
}, {
|
|
162
|
-
default:
|
|
163
|
-
|
|
162
|
+
default: f(() => [
|
|
163
|
+
V(w(s.value ? C : t.value + "s"), 1)
|
|
164
164
|
]),
|
|
165
165
|
_: 1
|
|
166
166
|
}, 8, ["style"]);
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
169
|
});
|
|
170
|
-
const
|
|
170
|
+
const ye = /* @__PURE__ */ I(fe, [["__scopeId", "data-v-4074e137"]]), ve = /* @__PURE__ */ g({
|
|
171
171
|
__name: "index",
|
|
172
172
|
props: {
|
|
173
173
|
item: {}
|
|
@@ -175,15 +175,15 @@ const _e = /* @__PURE__ */ P(de, [["__scopeId", "data-v-4074e137"]]), fe = /* @_
|
|
|
175
175
|
setup(e) {
|
|
176
176
|
const { item: n } = e, t = n;
|
|
177
177
|
return t.template = {
|
|
178
|
-
append: () =>
|
|
178
|
+
append: () => te(ye, {
|
|
179
179
|
getSmscode: t.getSmscode
|
|
180
180
|
})
|
|
181
|
-
}, (
|
|
182
|
-
item:
|
|
181
|
+
}, (l, s) => (o(), u(T, {
|
|
182
|
+
item: m(t),
|
|
183
183
|
class: "input"
|
|
184
184
|
}, null, 8, ["item"]));
|
|
185
185
|
}
|
|
186
|
-
}),
|
|
186
|
+
}), ge = g({
|
|
187
187
|
components: {
|
|
188
188
|
slotArchive: (e) => {
|
|
189
189
|
const { templateEle: n } = e;
|
|
@@ -209,46 +209,46 @@ const _e = /* @__PURE__ */ P(de, [["__scopeId", "data-v-4074e137"]]), fe = /* @_
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
|
-
function
|
|
213
|
-
const
|
|
214
|
-
return o(),
|
|
215
|
-
|
|
216
|
-
name:
|
|
217
|
-
fn:
|
|
218
|
-
|
|
219
|
-
key:
|
|
220
|
-
templateEle:
|
|
221
|
-
}, null, 8, ["templateEle"])) :
|
|
212
|
+
function he(e, n, t, l, s, a) {
|
|
213
|
+
const r = c("el-divider");
|
|
214
|
+
return o(), u(r, ne(oe(e.dividerSetting)), x({ _: 2 }, [
|
|
215
|
+
z(e.item.template, (i, d) => ({
|
|
216
|
+
name: d,
|
|
217
|
+
fn: f(() => [
|
|
218
|
+
i ? (o(), u(K(e.currentInputComponent()), {
|
|
219
|
+
key: d,
|
|
220
|
+
templateEle: i
|
|
221
|
+
}, null, 8, ["templateEle"])) : b("", !0)
|
|
222
222
|
])
|
|
223
223
|
}))
|
|
224
224
|
]), 1040);
|
|
225
225
|
}
|
|
226
|
-
const
|
|
226
|
+
const be = /* @__PURE__ */ I(ge, [["render", he]]), ke = /* @__PURE__ */ g({
|
|
227
227
|
__name: "index",
|
|
228
228
|
props: {
|
|
229
229
|
item: {}
|
|
230
230
|
},
|
|
231
231
|
setup(e) {
|
|
232
|
-
const { item: n } = e, t =
|
|
232
|
+
const { item: n } = e, t = v("queryParams", {}), l = v("size"), s = y({
|
|
233
233
|
...n.radioSetting
|
|
234
|
-
}),
|
|
234
|
+
}), a = y({
|
|
235
235
|
...n.radioGroupSetting
|
|
236
236
|
});
|
|
237
|
-
return (
|
|
238
|
-
const
|
|
239
|
-
return o(),
|
|
240
|
-
modelValue:
|
|
241
|
-
"onUpdate:modelValue":
|
|
242
|
-
size:
|
|
243
|
-
},
|
|
244
|
-
default:
|
|
245
|
-
(o(!0),
|
|
246
|
-
size:
|
|
247
|
-
label:
|
|
248
|
-
key:
|
|
249
|
-
},
|
|
250
|
-
default:
|
|
251
|
-
|
|
237
|
+
return (r, i) => {
|
|
238
|
+
const d = c("el-radio"), _ = c("el-radio-group");
|
|
239
|
+
return o(), u(_, k({
|
|
240
|
+
modelValue: m(t)[r.item.prop],
|
|
241
|
+
"onUpdate:modelValue": i[0] || (i[0] = (h) => m(t)[r.item.prop] = h),
|
|
242
|
+
size: m(l)
|
|
243
|
+
}, a.value), {
|
|
244
|
+
default: f(() => [
|
|
245
|
+
(o(!0), P(F, null, z(r.item.option || [], (h) => (o(), u(d, k({
|
|
246
|
+
size: m(l),
|
|
247
|
+
label: h.label,
|
|
248
|
+
key: h.label
|
|
249
|
+
}, s.value), {
|
|
250
|
+
default: f(() => [
|
|
251
|
+
V(w(h.value), 1)
|
|
252
252
|
]),
|
|
253
253
|
_: 2
|
|
254
254
|
}, 1040, ["size", "label"]))), 128))
|
|
@@ -257,84 +257,84 @@ const he = /* @__PURE__ */ P(ye, [["render", ge]]), ve = /* @__PURE__ */ h({
|
|
|
257
257
|
}, 16, ["modelValue", "size"]);
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
|
-
}),
|
|
260
|
+
}), Se = /* @__PURE__ */ g({
|
|
261
261
|
__name: "index",
|
|
262
262
|
props: {
|
|
263
263
|
item: {}
|
|
264
264
|
},
|
|
265
265
|
setup(e) {
|
|
266
|
-
const { item: n } = e, t =
|
|
267
|
-
...
|
|
266
|
+
const { item: n } = e, t = v("queryParams", {}), l = v("size"), s = y({
|
|
267
|
+
...ie,
|
|
268
268
|
...n.datePackerSetting
|
|
269
269
|
});
|
|
270
|
-
return (
|
|
271
|
-
const
|
|
272
|
-
return o(),
|
|
273
|
-
modelValue:
|
|
274
|
-
"onUpdate:modelValue":
|
|
275
|
-
size:
|
|
276
|
-
},
|
|
270
|
+
return (a, r) => {
|
|
271
|
+
const i = c("el-date-picker");
|
|
272
|
+
return o(), u(i, k({
|
|
273
|
+
modelValue: m(t)[a.item.prop],
|
|
274
|
+
"onUpdate:modelValue": r[0] || (r[0] = (d) => m(t)[a.item.prop] = d),
|
|
275
|
+
size: m(l)
|
|
276
|
+
}, s.value), null, 16, ["modelValue", "size"]);
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
|
-
}),
|
|
279
|
+
}), Pe = /* @__PURE__ */ g({
|
|
280
280
|
__name: "index",
|
|
281
281
|
props: {
|
|
282
282
|
item: {}
|
|
283
283
|
},
|
|
284
284
|
setup(e) {
|
|
285
|
-
const { item: n } = e, t =
|
|
286
|
-
...
|
|
285
|
+
const { item: n } = e, t = v("queryParams", {}), l = v("size"), s = y({
|
|
286
|
+
...W,
|
|
287
287
|
...n.selectSetting
|
|
288
288
|
});
|
|
289
|
-
return (
|
|
290
|
-
const
|
|
291
|
-
return o(),
|
|
292
|
-
modelValue:
|
|
293
|
-
"onUpdate:modelValue":
|
|
294
|
-
size:
|
|
295
|
-
},
|
|
296
|
-
default:
|
|
297
|
-
(o(!0),
|
|
298
|
-
key:
|
|
299
|
-
label:
|
|
300
|
-
value:
|
|
289
|
+
return (a, r) => {
|
|
290
|
+
const i = c("el-option"), d = c("el-select");
|
|
291
|
+
return o(), u(d, k({
|
|
292
|
+
modelValue: m(t)[a.item.prop],
|
|
293
|
+
"onUpdate:modelValue": r[0] || (r[0] = (_) => m(t)[a.item.prop] = _),
|
|
294
|
+
size: m(l)
|
|
295
|
+
}, s.value), {
|
|
296
|
+
default: f(() => [
|
|
297
|
+
(o(!0), P(F, null, z(a.item.option || [], (_) => (o(), u(i, {
|
|
298
|
+
key: _.value,
|
|
299
|
+
label: _.label,
|
|
300
|
+
value: _.value
|
|
301
301
|
}, null, 8, ["label", "value"]))), 128))
|
|
302
302
|
]),
|
|
303
303
|
_: 1
|
|
304
304
|
}, 16, ["modelValue", "size"]);
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
|
-
}), ze = /* @__PURE__ */
|
|
307
|
+
}), ze = /* @__PURE__ */ g({
|
|
308
308
|
__name: "index",
|
|
309
309
|
props: {
|
|
310
310
|
item: {}
|
|
311
311
|
},
|
|
312
312
|
setup(e) {
|
|
313
|
-
const { item: n } = e, t =
|
|
314
|
-
...
|
|
313
|
+
const { item: n } = e, t = v("queryParams", {}), l = v("size"), s = y({
|
|
314
|
+
...W,
|
|
315
315
|
...n.selectSetting
|
|
316
316
|
});
|
|
317
|
-
return (
|
|
318
|
-
const
|
|
319
|
-
return o(),
|
|
320
|
-
modelValue:
|
|
321
|
-
"onUpdate:modelValue":
|
|
322
|
-
size:
|
|
323
|
-
options:
|
|
324
|
-
},
|
|
317
|
+
return (a, r) => {
|
|
318
|
+
const i = c("el-cascader");
|
|
319
|
+
return o(), u(i, k({
|
|
320
|
+
modelValue: m(t)[a.item.prop],
|
|
321
|
+
"onUpdate:modelValue": r[0] || (r[0] = (d) => m(t)[a.item.prop] = d),
|
|
322
|
+
size: m(l),
|
|
323
|
+
options: a.item.options || []
|
|
324
|
+
}, s.value), null, 16, ["modelValue", "size", "options"]);
|
|
325
325
|
};
|
|
326
326
|
}
|
|
327
|
-
}),
|
|
327
|
+
}), $e = g({
|
|
328
328
|
name: "GeneralBasicForm",
|
|
329
329
|
components: {
|
|
330
|
-
Input:
|
|
331
|
-
InputNumber:
|
|
332
|
-
InputGraphicVerification:
|
|
333
|
-
InputMobileVerification:
|
|
334
|
-
Divider:
|
|
335
|
-
Radio:
|
|
336
|
-
DatePicker:
|
|
337
|
-
Select:
|
|
330
|
+
Input: T,
|
|
331
|
+
InputNumber: ue,
|
|
332
|
+
InputGraphicVerification: de,
|
|
333
|
+
InputMobileVerification: ve,
|
|
334
|
+
Divider: be,
|
|
335
|
+
Radio: ke,
|
|
336
|
+
DatePicker: Se,
|
|
337
|
+
Select: Pe,
|
|
338
338
|
Cascader: ze
|
|
339
339
|
},
|
|
340
340
|
props: {
|
|
@@ -398,26 +398,26 @@ const he = /* @__PURE__ */ P(ye, [["render", ge]]), ve = /* @__PURE__ */ h({
|
|
|
398
398
|
};
|
|
399
399
|
},
|
|
400
400
|
setup(e) {
|
|
401
|
-
const { size: n, noUrlParameters: t, getList:
|
|
402
|
-
...t ? {} :
|
|
401
|
+
const { size: n, noUrlParameters: t, getList: l } = e, s = se(), a = y({
|
|
402
|
+
...t ? {} : s == null ? void 0 : s.query
|
|
403
403
|
});
|
|
404
|
-
return
|
|
404
|
+
return A(
|
|
405
405
|
/* 注入名 */
|
|
406
406
|
"queryParams",
|
|
407
407
|
/* 值 */
|
|
408
|
-
|
|
409
|
-
),
|
|
408
|
+
a
|
|
409
|
+
), A(
|
|
410
410
|
/* 注入名 */
|
|
411
411
|
"size",
|
|
412
412
|
/* 值 */
|
|
413
413
|
n
|
|
414
|
-
),
|
|
414
|
+
), A(
|
|
415
415
|
/* 注入名 */
|
|
416
416
|
"getList",
|
|
417
417
|
/* 值 */
|
|
418
|
-
|
|
418
|
+
l
|
|
419
419
|
), {
|
|
420
|
-
queryParams:
|
|
420
|
+
queryParams: a
|
|
421
421
|
};
|
|
422
422
|
},
|
|
423
423
|
watch: {
|
|
@@ -443,8 +443,8 @@ const he = /* @__PURE__ */ P(ye, [["render", ge]]), ve = /* @__PURE__ */ h({
|
|
|
443
443
|
provide() {
|
|
444
444
|
return {
|
|
445
445
|
// 显式提供一个计算属性
|
|
446
|
-
[
|
|
447
|
-
formLoading:
|
|
446
|
+
[H]: {
|
|
447
|
+
formLoading: Q(() => this.formLoading),
|
|
448
448
|
updateFormLoading: (e) => {
|
|
449
449
|
this.formLoading = e;
|
|
450
450
|
}
|
|
@@ -479,97 +479,210 @@ const he = /* @__PURE__ */ P(ye, [["render", ge]]), ve = /* @__PURE__ */ h({
|
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
});
|
|
482
|
-
function
|
|
483
|
-
const
|
|
484
|
-
return
|
|
482
|
+
function qe(e, n, t, l, s, a) {
|
|
483
|
+
const r = c("Input"), i = c("Radio"), d = c("Select"), _ = c("Divider"), h = c("Cascader"), $ = c("DatePicker"), G = c("InputNumber"), B = c("InputMobileVerification"), N = c("InputGraphicVerification"), S = c("el-form-item"), L = c("el-button"), R = c("el-form"), E = U("loading");
|
|
484
|
+
return D((o(), u(R, k({
|
|
485
485
|
model: e.queryParams,
|
|
486
486
|
ref: "queryFormRef",
|
|
487
487
|
inline: "",
|
|
488
488
|
"label-position": "left",
|
|
489
489
|
"label-width": e.labelWidth
|
|
490
490
|
}, e.$attrs), {
|
|
491
|
-
default:
|
|
492
|
-
(o(!0),
|
|
491
|
+
default: f(() => [
|
|
492
|
+
(o(!0), P(F, null, z(e.formItem, (p) => (o(), u(S, {
|
|
493
493
|
label: p.label,
|
|
494
494
|
prop: p.prop,
|
|
495
495
|
key: p.prop,
|
|
496
496
|
rules: p.rules
|
|
497
497
|
}, {
|
|
498
|
-
default:
|
|
499
|
-
p.type === "input" ? (o(),
|
|
498
|
+
default: f(() => [
|
|
499
|
+
p.type === "input" ? (o(), u(r, {
|
|
500
500
|
key: 0,
|
|
501
501
|
item: p
|
|
502
|
-
}, null, 8, ["item"])) :
|
|
503
|
-
p.type === "radio" ? (o(),
|
|
502
|
+
}, null, 8, ["item"])) : b("", !0),
|
|
503
|
+
p.type === "radio" ? (o(), u(i, {
|
|
504
504
|
key: 1,
|
|
505
505
|
item: p
|
|
506
|
-
}, null, 8, ["item"])) :
|
|
507
|
-
p.type === "select" ? (o(),
|
|
506
|
+
}, null, 8, ["item"])) : b("", !0),
|
|
507
|
+
p.type === "select" ? (o(), u(d, {
|
|
508
508
|
key: 2,
|
|
509
509
|
item: p
|
|
510
|
-
}, null, 8, ["item"])) :
|
|
511
|
-
p.type === "divider" ? (o(),
|
|
510
|
+
}, null, 8, ["item"])) : b("", !0),
|
|
511
|
+
p.type === "divider" ? (o(), u(_, {
|
|
512
512
|
key: 3,
|
|
513
513
|
item: p
|
|
514
|
-
}, null, 8, ["item"])) :
|
|
515
|
-
p.type === "cascader" ? (o(),
|
|
514
|
+
}, null, 8, ["item"])) : b("", !0),
|
|
515
|
+
p.type === "cascader" ? (o(), u(h, {
|
|
516
516
|
key: 4,
|
|
517
517
|
item: p
|
|
518
|
-
}, null, 8, ["item"])) :
|
|
519
|
-
p.type === "date-picker" ? (o(),
|
|
518
|
+
}, null, 8, ["item"])) : b("", !0),
|
|
519
|
+
p.type === "date-picker" ? (o(), u($, {
|
|
520
520
|
key: 5,
|
|
521
521
|
item: p
|
|
522
|
-
}, null, 8, ["item"])) :
|
|
523
|
-
p.type === "input-number" ? (o(),
|
|
522
|
+
}, null, 8, ["item"])) : b("", !0),
|
|
523
|
+
p.type === "input-number" ? (o(), u(G, {
|
|
524
524
|
key: 6,
|
|
525
525
|
item: p
|
|
526
|
-
}, null, 8, ["item"])) :
|
|
527
|
-
p.type === "input-mobile-verification" ? (o(),
|
|
526
|
+
}, null, 8, ["item"])) : b("", !0),
|
|
527
|
+
p.type === "input-mobile-verification" ? (o(), u(B, {
|
|
528
528
|
key: 7,
|
|
529
529
|
item: p
|
|
530
|
-
}, null, 8, ["item"])) :
|
|
531
|
-
p.type === "input-graphic-verification" ? (o(),
|
|
530
|
+
}, null, 8, ["item"])) : b("", !0),
|
|
531
|
+
p.type === "input-graphic-verification" ? (o(), u(N, {
|
|
532
532
|
item: p,
|
|
533
533
|
key: p.key
|
|
534
|
-
}, null, 8, ["item"])) :
|
|
534
|
+
}, null, 8, ["item"])) : b("", !0)
|
|
535
535
|
]),
|
|
536
536
|
_: 2
|
|
537
537
|
}, 1032, ["label", "prop", "rules"]))), 128)),
|
|
538
|
-
|
|
539
|
-
e.formOnly ?
|
|
540
|
-
default:
|
|
541
|
-
|
|
538
|
+
j(e.$slots, "default"),
|
|
539
|
+
e.formOnly ? b("", !0) : (o(), u(S, { key: 0 }, {
|
|
540
|
+
default: f(() => [
|
|
541
|
+
D((o(), u(L, {
|
|
542
542
|
type: "primary",
|
|
543
543
|
size: e.size,
|
|
544
544
|
onClick: e.handleQuery
|
|
545
545
|
}, {
|
|
546
|
-
default:
|
|
547
|
-
|
|
546
|
+
default: f(() => [
|
|
547
|
+
V("查询")
|
|
548
548
|
]),
|
|
549
549
|
_: 1
|
|
550
550
|
}, 8, ["size", "onClick"])), [
|
|
551
|
-
[
|
|
551
|
+
[E, e.formLoading]
|
|
552
552
|
]),
|
|
553
|
-
|
|
553
|
+
O(L, {
|
|
554
554
|
size: e.size,
|
|
555
555
|
onClick: e.resetQuery
|
|
556
556
|
}, {
|
|
557
|
-
default:
|
|
558
|
-
|
|
557
|
+
default: f(() => [
|
|
558
|
+
V("重置")
|
|
559
559
|
]),
|
|
560
560
|
_: 1
|
|
561
561
|
}, 8, ["size", "onClick"])
|
|
562
562
|
]),
|
|
563
563
|
_: 1
|
|
564
564
|
})),
|
|
565
|
-
|
|
565
|
+
j(e.$slots, "behind-the-button")
|
|
566
566
|
]),
|
|
567
567
|
_: 3
|
|
568
568
|
}, 16, ["model", "label-width"])), [
|
|
569
|
-
[
|
|
569
|
+
[re, e.showSearch]
|
|
570
570
|
]);
|
|
571
571
|
}
|
|
572
|
-
const
|
|
572
|
+
const Ve = /* @__PURE__ */ I($e, [["render", qe]]), Ie = ["infinite-scroll-disabled"], Le = /* @__PURE__ */ g({
|
|
573
|
+
__name: "InfiniteScrollList",
|
|
574
|
+
props: {
|
|
575
|
+
search: {
|
|
576
|
+
type: Function,
|
|
577
|
+
required: !0
|
|
578
|
+
},
|
|
579
|
+
id: {
|
|
580
|
+
type: String,
|
|
581
|
+
required: !0
|
|
582
|
+
},
|
|
583
|
+
name: {
|
|
584
|
+
type: String,
|
|
585
|
+
required: !0
|
|
586
|
+
},
|
|
587
|
+
extra: {
|
|
588
|
+
type: Function,
|
|
589
|
+
required: !1
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
setup(e, { expose: n }) {
|
|
593
|
+
const t = e, { search: l, id: s, name: a, extra: r } = t, i = y([]), d = y(1), _ = y(!1), h = y([]), $ = y(!1), G = () => {
|
|
594
|
+
d.value = 1, i.value = [], h.value = [], _.value = !1;
|
|
595
|
+
}, B = async () => {
|
|
596
|
+
if ($.value || _.value)
|
|
597
|
+
return;
|
|
598
|
+
$.value = !0;
|
|
599
|
+
const S = await l(d.value);
|
|
600
|
+
S && S.length > 0 ? (i.value = [...i.value, ...S], d.value += 1) : _.value = !0, $.value = !1;
|
|
601
|
+
}, N = Q(
|
|
602
|
+
() => i.value.filter((S) => h.value.includes(S[s]))
|
|
603
|
+
) || {};
|
|
604
|
+
return n({ reset: G, loadList: B, selectInfo: N }), (S, L) => {
|
|
605
|
+
const R = c("el-checkbox"), E = c("el-checkbox-group"), p = U("infinite-scroll"), J = U("loading");
|
|
606
|
+
return D((o(), u(E, k({
|
|
607
|
+
modelValue: h.value,
|
|
608
|
+
"onUpdate:modelValue": L[0] || (L[0] = (q) => h.value = q)
|
|
609
|
+
}, t), {
|
|
610
|
+
default: f(() => [
|
|
611
|
+
D((o(), P("ul", {
|
|
612
|
+
class: "list",
|
|
613
|
+
"infinite-scroll-disabled": _.value
|
|
614
|
+
}, [
|
|
615
|
+
(o(!0), P(F, null, z(i.value, (q) => (o(), P("li", {
|
|
616
|
+
key: q[m(s)],
|
|
617
|
+
class: "list-item"
|
|
618
|
+
}, [
|
|
619
|
+
O(R, {
|
|
620
|
+
label: q[m(s)],
|
|
621
|
+
class: "checkbox"
|
|
622
|
+
}, {
|
|
623
|
+
default: f(() => [
|
|
624
|
+
V(w(q[m(a)]) + " " + w(m(r) && m(r)(q)), 1)
|
|
625
|
+
]),
|
|
626
|
+
_: 2
|
|
627
|
+
}, 1032, ["label"])
|
|
628
|
+
]))), 128))
|
|
629
|
+
], 8, Ie)), [
|
|
630
|
+
[p, B]
|
|
631
|
+
])
|
|
632
|
+
]),
|
|
633
|
+
_: 1
|
|
634
|
+
}, 16, ["modelValue"])), [
|
|
635
|
+
[J, $.value]
|
|
636
|
+
]);
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
const Ce = /* @__PURE__ */ I(Le, [["__scopeId", "data-v-fda8f794"]]), De = /* @__PURE__ */ g({
|
|
641
|
+
__name: "Descriptions",
|
|
642
|
+
props: {
|
|
643
|
+
formData: {
|
|
644
|
+
type: Object,
|
|
645
|
+
required: !0
|
|
646
|
+
},
|
|
647
|
+
descriptionsItemProps: {
|
|
648
|
+
type: Object,
|
|
649
|
+
required: !1
|
|
650
|
+
},
|
|
651
|
+
formItem: {
|
|
652
|
+
type: Array,
|
|
653
|
+
required: !0
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
setup(e) {
|
|
657
|
+
const n = e;
|
|
658
|
+
return (t, l) => {
|
|
659
|
+
const s = c("el-descriptions-item"), a = c("el-descriptions");
|
|
660
|
+
return o(), u(a, k({
|
|
661
|
+
column: 1,
|
|
662
|
+
border: "",
|
|
663
|
+
class: "form-width"
|
|
664
|
+
}, n), {
|
|
665
|
+
default: f(() => [
|
|
666
|
+
(o(!0), P(F, null, z(n.formItem, (r, i) => (o(), u(s, k({
|
|
667
|
+
key: r.prop,
|
|
668
|
+
label: r.label
|
|
669
|
+
}, n.descriptionsItemProps), {
|
|
670
|
+
default: f(() => [
|
|
671
|
+
V(w(r.render ? r.render({
|
|
672
|
+
row: e.formData,
|
|
673
|
+
$index: i
|
|
674
|
+
}) : e.formData[r.prop]), 1)
|
|
675
|
+
]),
|
|
676
|
+
_: 2
|
|
677
|
+
}, 1040, ["label"]))), 128))
|
|
678
|
+
]),
|
|
679
|
+
_: 1
|
|
680
|
+
}, 16);
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
}), Be = Ve, Ue = Ce, Ge = De;
|
|
573
684
|
export {
|
|
574
|
-
|
|
685
|
+
Ge as VDescriptions,
|
|
686
|
+
Be as VGeneralBasicForm,
|
|
687
|
+
Ue as VInfiniteScrollList
|
|
575
688
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.Index={},d.Vue,d["vue-router"]))})(this,function(d,e,b){"use strict";const k={placeholder:"请输入",style:"width: 200px",clearable:!0},V={style:"width: 227px","start-placeholder":"开始日期","end-placeholder":"结束日期",type:"daterange"},h={placeholder:"请选择",filterable:!0,clearable:!0,style:"width: 200px"},P=e.defineComponent({components:{InputArchive:t=>{const{templateEle:n}=t;return n()}},props:{item:null},setup(){const t=e.inject("queryParams",{}),n=e.inject("getList"),o=e.inject("size");return{queryParams:t,getList:n,size:o}},data(){return{inputSetting:{...k,...this.item.inputSetting}}},methods:{currentInputComponent(){return"input-archive"}}}),u=(t,n)=>{const o=t.__vccOpts||t;for(const[r,i]of n)o[r]=i;return o};function S(t,n,o,r,i,a){const l=e.resolveComponent("el-input");return e.openBlock(),e.createBlock(l,e.mergeProps({onKeydown:e.withKeys(t.getList,["enter"]),modelValue:t.queryParams[t.item.prop],"onUpdate:modelValue":n[0]||(n[0]=s=>t.queryParams[t.item.prop]=s),size:t.size},t.inputSetting),e.createSlots({_:2},[e.renderList(t.item.template,(s,p)=>({name:p,fn:e.withCtx(()=>[s?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.currentInputComponent()),{key:p,templateEle:s},null,8,["templateEle"])):e.createCommentVNode("",!0)])}))]),1040,["onKeydown","modelValue","size"])}const y=u(P,[["render",S]]),z=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),r=e.inject("size"),i=e.ref({...k,...n.inputSetting});return(a,l)=>{const s=e.resolveComponent("el-input-number");return e.openBlock(),e.createBlock(s,e.mergeProps({modelValue:e.unref(o)[a.item.prop],"onUpdate:modelValue":l[0]||(l[0]=p=>e.unref(o)[a.item.prop]=p),size:e.unref(r)},i.value),null,16,["modelValue","size"])}}}),g=Symbol(),$={class:"input-graphic-verification"},q=["src"],w=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,{graphicSrc:o="",getGraphic:r=()=>{}}=n,{formLoading:i,updateFormLoading:a}=e.inject(g),l=async()=>{r&&!i.value&&await r()};return(s,p)=>{const m=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createElementBlock("div",$,[e.createVNode(y,{item:s.item,class:"input"},null,8,["item"]),e.createElementVNode("img",{class:"graphic",onClick:l,src:e.unref(o)},null,8,q)])),[[m,e.unref(i)]])}}}),Y="",I=u(w,[["__scopeId","data-v-500ec9b0"]]),_="获取验证码",L=60,N=e.defineComponent({__name:"verification-button",props:{getSmscode:{type:Function}},setup(t){const{getSmscode:n}=t,o=e.ref(_),r=e.ref(null),i=e.computed(()=>o.value===_),a=()=>{r&&(clearInterval(r.value),r.value=null,o.value=_)},l=async()=>{if(o.value===_)if(o.value=L,r.value=setInterval(()=>{if(Number(o.value)<=0||!o.value){a();return}else o.value=Number(o.value)-1},1e3),n)await n()===!1&&a();else return};return e.onBeforeUnmount(()=>{a()}),(s,p)=>{const m=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(m,{class:"verifiaction-button",style:e.normalizeStyle({color:i.value?"var(--color-primary, #409EFF)":"var(--text-color-placeholder, #A8ABB2)",cursor:i.value?"pointer":"default"}),onClick:l},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.value?_:o.value+"s"),1)]),_:1},8,["style"])}}}),Z="",D=u(N,[["__scopeId","data-v-4074e137"]]),F=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=n;return o.template={append:()=>e.h(D,{getSmscode:o.getSmscode})},(r,i)=>(e.openBlock(),e.createBlock(y,{item:e.unref(o),class:"input"},null,8,["item"]))}}),j=e.defineComponent({components:{slotArchive:t=>{const{templateEle:n}=t;return n()}},props:{item:null},setup(){},data(){return{dividerSetting:{...this.item.dividerSetting}}},methods:{currentInputComponent(){return"slot-archive"}}});function U(t,n,o,r,i,a){const l=e.resolveComponent("el-divider");return e.openBlock(),e.createBlock(l,e.normalizeProps(e.guardReactiveProps(t.dividerSetting)),e.createSlots({_:2},[e.renderList(t.item.template,(s,p)=>({name:p,fn:e.withCtx(()=>[s?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.currentInputComponent()),{key:p,templateEle:s},null,8,["templateEle"])):e.createCommentVNode("",!0)])}))]),1040)}const E=u(j,[["render",U]]),G=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),r=e.inject("size"),i=e.ref({...n.radioSetting}),a=e.ref({...n.radioGroupSetting});return(l,s)=>{const p=e.resolveComponent("el-radio"),m=e.resolveComponent("el-radio-group");return e.openBlock(),e.createBlock(m,e.mergeProps({modelValue:e.unref(o)[l.item.prop],"onUpdate:modelValue":s[0]||(s[0]=f=>e.unref(o)[l.item.prop]=f),size:e.unref(r)},a.value),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.option||[],f=>(e.openBlock(),e.createBlock(p,e.mergeProps({size:e.unref(r),label:f.label,key:f.label},i.value),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value),1)]),_:2},1040,["size","label"]))),128))]),_:1},16,["modelValue","size"])}}}),T=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),r=e.inject("size"),i=e.ref({...V,...n.datePackerSetting});return(a,l)=>{const s=e.resolveComponent("el-date-picker");return e.openBlock(),e.createBlock(s,e.mergeProps({modelValue:e.unref(o)[a.item.prop],"onUpdate:modelValue":l[0]||(l[0]=p=>e.unref(o)[a.item.prop]=p),size:e.unref(r)},i.value),null,16,["modelValue","size"])}}}),R=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),r=e.inject("size"),i=e.ref({...h,...n.selectSetting});return(a,l)=>{const s=e.resolveComponent("el-option"),p=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(p,e.mergeProps({modelValue:e.unref(o)[a.item.prop],"onUpdate:modelValue":l[0]||(l[0]=m=>e.unref(o)[a.item.prop]=m),size:e.unref(r)},i.value),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.item.option||[],m=>(e.openBlock(),e.createBlock(s,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","size"])}}}),x=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),r=e.inject("size"),i=e.ref({...h,...n.selectSetting});return(a,l)=>{const s=e.resolveComponent("el-cascader");return e.openBlock(),e.createBlock(s,e.mergeProps({modelValue:e.unref(o)[a.item.prop],"onUpdate:modelValue":l[0]||(l[0]=p=>e.unref(o)[a.item.prop]=p),size:e.unref(r),options:a.item.options||[]},i.value),null,16,["modelValue","size","options"])}}}),A=e.defineComponent({name:"GeneralBasicForm",components:{Input:y,InputNumber:z,InputGraphicVerification:I,InputMobileVerification:F,Divider:E,Radio:G,DatePicker:T,Select:R,Cascader:x},props:{showSearch:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},formOnly:{type:Boolean,default:!1},getList:{type:Function,default:()=>{}},afterReset:{type:Function,default:()=>{}},formItem:{type:Array,default:[]},size:{type:String,default:"default"},labelWidth:{type:String,default:"90px"},noUrlParameters:{type:Boolean,default:()=>!1},formData:{type:Object,default:()=>{}}},data(){return{formLoading:this.loading||!1}},setup(t){const{size:n,noUrlParameters:o,getList:r}=t,i=b.useRoute(),a=e.ref({...o?{}:i==null?void 0:i.query});return e.provide("queryParams",a),e.provide("size",n),e.provide("getList",r),{queryParams:a}},watch:{formData:{handler(t){this.queryParams={...this.noUrlParameters?{}:this.queryParams,...t}},immediate:!0},loading(t){this.formLoading!==t&&(this.formLoading=t)},formLoading(t){this.loading!==t&&this.$emit("update:loading",t)}},provide(){return{[g]:{formLoading:e.computed(()=>this.formLoading),updateFormLoading:t=>{this.formLoading=t}}}},methods:{handleQuery(){var o;const t={page:1,limit:10},n={...(o=this.$route)==null?void 0:o.query,...this.queryParams,...t};this.noUrlParameters||this.$router.push({query:{...n}}),this.getList({...n})},async resetQuery(){var n;this.$refs.queryFormRef.resetFields();const t={page:1};this.noUrlParameters||await this.$router.push({query:{...t}}),this.queryParams={...this.noUrlParameters?{}:(n=this.$route)==null?void 0:n.query},this.afterReset(),this.handleQuery()}}});function O(t,n,o,r,i,a){const l=e.resolveComponent("Input"),s=e.resolveComponent("Radio"),p=e.resolveComponent("Select"),m=e.resolveComponent("Divider"),f=e.resolveComponent("Cascader"),K=e.resolveComponent("DatePicker"),M=e.resolveComponent("InputNumber"),W=e.resolveComponent("InputMobileVerification"),H=e.resolveComponent("InputGraphicVerification"),B=e.resolveComponent("el-form-item"),C=e.resolveComponent("el-button"),J=e.resolveComponent("el-form"),X=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createBlock(J,e.mergeProps({model:t.queryParams,ref:"queryFormRef",inline:"","label-position":"left","label-width":t.labelWidth},t.$attrs),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.formItem,c=>(e.openBlock(),e.createBlock(B,{label:c.label,prop:c.prop,key:c.prop,rules:c.rules},{default:e.withCtx(()=>[c.type==="input"?(e.openBlock(),e.createBlock(l,{key:0,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="radio"?(e.openBlock(),e.createBlock(s,{key:1,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="select"?(e.openBlock(),e.createBlock(p,{key:2,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="divider"?(e.openBlock(),e.createBlock(m,{key:3,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="cascader"?(e.openBlock(),e.createBlock(f,{key:4,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="date-picker"?(e.openBlock(),e.createBlock(K,{key:5,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="input-number"?(e.openBlock(),e.createBlock(M,{key:6,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="input-mobile-verification"?(e.openBlock(),e.createBlock(W,{key:7,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="input-graphic-verification"?(e.openBlock(),e.createBlock(H,{item:c,key:c.key},null,8,["item"])):e.createCommentVNode("",!0)]),_:2},1032,["label","prop","rules"]))),128)),e.renderSlot(t.$slots,"default"),t.formOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(B,{key:0},{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(C,{type:"primary",size:t.size,onClick:t.handleQuery},{default:e.withCtx(()=>[e.createTextVNode("查询")]),_:1},8,["size","onClick"])),[[X,t.formLoading]]),e.createVNode(C,{size:t.size,onClick:t.resetQuery},{default:e.withCtx(()=>[e.createTextVNode("重置")]),_:1},8,["size","onClick"])]),_:1})),e.renderSlot(t.$slots,"behind-the-button")]),_:3},16,["model","label-width"])),[[e.vShow,t.showSearch]])}const Q=u(A,[["render",O]]);d.VGeneralBasicForm=Q,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(f,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router"],e):(f=typeof globalThis<"u"?globalThis:f||self,e(f.Index={},f.Vue,f["vue-router"]))})(this,function(f,e,I){"use strict";const w={placeholder:"请输入",style:"width: 200px",clearable:!0},$={style:"width: 227px","start-placeholder":"开始日期","end-placeholder":"结束日期",type:"daterange"},z={placeholder:"请选择",filterable:!0,clearable:!0,style:"width: 200px"},D=e.defineComponent({components:{InputArchive:t=>{const{templateEle:n}=t;return n()}},props:{item:null},setup(){const t=e.inject("queryParams",{}),n=e.inject("getList"),o=e.inject("size");return{queryParams:t,getList:n,size:o}},data(){return{inputSetting:{...w,...this.item.inputSetting}}},methods:{currentInputComponent(){return"input-archive"}}}),u=(t,n)=>{const o=t.__vccOpts||t;for(const[a,l]of n)o[a]=l;return o};function L(t,n,o,a,l,s){const r=e.resolveComponent("el-input");return e.openBlock(),e.createBlock(r,e.mergeProps({onKeydown:e.withKeys(t.getList,["enter"]),modelValue:t.queryParams[t.item.prop],"onUpdate:modelValue":n[0]||(n[0]=i=>t.queryParams[t.item.prop]=i),size:t.size},t.inputSetting),e.createSlots({_:2},[e.renderList(t.item.template,(i,p)=>({name:p,fn:e.withCtx(()=>[i?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.currentInputComponent()),{key:p,templateEle:i},null,8,["templateEle"])):e.createCommentVNode("",!0)])}))]),1040,["onKeydown","modelValue","size"])}const C=u(D,[["render",L]]),N=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),a=e.inject("size"),l=e.ref({...w,...n.inputSetting});return(s,r)=>{const i=e.resolveComponent("el-input-number");return e.openBlock(),e.createBlock(i,e.mergeProps({modelValue:e.unref(o)[s.item.prop],"onUpdate:modelValue":r[0]||(r[0]=p=>e.unref(o)[s.item.prop]=p),size:e.unref(a)},l.value),null,16,["modelValue","size"])}}}),q=Symbol(),x={class:"input-graphic-verification"},F=["src"],j=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,{graphicSrc:o="",getGraphic:a=()=>{}}=n,{formLoading:l,updateFormLoading:s}=e.inject(q),r=async()=>{a&&!l.value&&await a()};return(i,p)=>{const m=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createElementBlock("div",x,[e.createVNode(C,{item:i.item,class:"input"},null,8,["item"]),e.createElementVNode("img",{class:"graphic",onClick:r,src:e.unref(o)},null,8,F)])),[[m,e.unref(l)]])}}}),ie="",E=u(j,[["__scopeId","data-v-500ec9b0"]]),h="获取验证码",U=60,T=e.defineComponent({__name:"verification-button",props:{getSmscode:{type:Function}},setup(t){const{getSmscode:n}=t,o=e.ref(h),a=e.ref(null),l=e.computed(()=>o.value===h),s=()=>{a&&(clearInterval(a.value),a.value=null,o.value=h)},r=async()=>{if(o.value===h)if(o.value=U,a.value=setInterval(()=>{if(Number(o.value)<=0||!o.value){s();return}else o.value=Number(o.value)-1},1e3),n)await n()===!1&&s();else return};return e.onBeforeUnmount(()=>{s()}),(i,p)=>{const m=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(m,{class:"verifiaction-button",style:e.normalizeStyle({color:l.value?"var(--color-primary, #409EFF)":"var(--text-color-placeholder, #A8ABB2)",cursor:l.value?"pointer":"default"}),onClick:r},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value?h:o.value+"s"),1)]),_:1},8,["style"])}}}),se="",G=u(T,[["__scopeId","data-v-4074e137"]]),R=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=n;return o.template={append:()=>e.h(G,{getSmscode:o.getSmscode})},(a,l)=>(e.openBlock(),e.createBlock(C,{item:e.unref(o),class:"input"},null,8,["item"]))}}),O=e.defineComponent({components:{slotArchive:t=>{const{templateEle:n}=t;return n()}},props:{item:null},setup(){},data(){return{dividerSetting:{...this.item.dividerSetting}}},methods:{currentInputComponent(){return"slot-archive"}}});function A(t,n,o,a,l,s){const r=e.resolveComponent("el-divider");return e.openBlock(),e.createBlock(r,e.normalizeProps(e.guardReactiveProps(t.dividerSetting)),e.createSlots({_:2},[e.renderList(t.item.template,(i,p)=>({name:p,fn:e.withCtx(()=>[i?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.currentInputComponent()),{key:p,templateEle:i},null,8,["templateEle"])):e.createCommentVNode("",!0)])}))]),1040)}const Q=u(O,[["render",A]]),K=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),a=e.inject("size"),l=e.ref({...n.radioSetting}),s=e.ref({...n.radioGroupSetting});return(r,i)=>{const p=e.resolveComponent("el-radio"),m=e.resolveComponent("el-radio-group");return e.openBlock(),e.createBlock(m,e.mergeProps({modelValue:e.unref(o)[r.item.prop],"onUpdate:modelValue":i[0]||(i[0]=d=>e.unref(o)[r.item.prop]=d),size:e.unref(a)},s.value),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.item.option||[],d=>(e.openBlock(),e.createBlock(p,e.mergeProps({size:e.unref(a),label:d.label,key:d.label},l.value),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.value),1)]),_:2},1040,["size","label"]))),128))]),_:1},16,["modelValue","size"])}}}),M=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),a=e.inject("size"),l=e.ref({...$,...n.datePackerSetting});return(s,r)=>{const i=e.resolveComponent("el-date-picker");return e.openBlock(),e.createBlock(i,e.mergeProps({modelValue:e.unref(o)[s.item.prop],"onUpdate:modelValue":r[0]||(r[0]=p=>e.unref(o)[s.item.prop]=p),size:e.unref(a)},l.value),null,16,["modelValue","size"])}}}),W=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),a=e.inject("size"),l=e.ref({...z,...n.selectSetting});return(s,r)=>{const i=e.resolveComponent("el-option"),p=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(p,e.mergeProps({modelValue:e.unref(o)[s.item.prop],"onUpdate:modelValue":r[0]||(r[0]=m=>e.unref(o)[s.item.prop]=m),size:e.unref(a)},l.value),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.item.option||[],m=>(e.openBlock(),e.createBlock(i,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","size"])}}}),H=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),a=e.inject("size"),l=e.ref({...z,...n.selectSetting});return(s,r)=>{const i=e.resolveComponent("el-cascader");return e.openBlock(),e.createBlock(i,e.mergeProps({modelValue:e.unref(o)[s.item.prop],"onUpdate:modelValue":r[0]||(r[0]=p=>e.unref(o)[s.item.prop]=p),size:e.unref(a),options:s.item.options||[]},l.value),null,16,["modelValue","size","options"])}}}),J=e.defineComponent({name:"GeneralBasicForm",components:{Input:C,InputNumber:N,InputGraphicVerification:E,InputMobileVerification:R,Divider:Q,Radio:K,DatePicker:M,Select:W,Cascader:H},props:{showSearch:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},formOnly:{type:Boolean,default:!1},getList:{type:Function,default:()=>{}},afterReset:{type:Function,default:()=>{}},formItem:{type:Array,default:[]},size:{type:String,default:"default"},labelWidth:{type:String,default:"90px"},noUrlParameters:{type:Boolean,default:()=>!1},formData:{type:Object,default:()=>{}}},data(){return{formLoading:this.loading||!1}},setup(t){const{size:n,noUrlParameters:o,getList:a}=t,l=I.useRoute(),s=e.ref({...o?{}:l==null?void 0:l.query});return e.provide("queryParams",s),e.provide("size",n),e.provide("getList",a),{queryParams:s}},watch:{formData:{handler(t){this.queryParams={...this.noUrlParameters?{}:this.queryParams,...t}},immediate:!0},loading(t){this.formLoading!==t&&(this.formLoading=t)},formLoading(t){this.loading!==t&&this.$emit("update:loading",t)}},provide(){return{[q]:{formLoading:e.computed(()=>this.formLoading),updateFormLoading:t=>{this.formLoading=t}}}},methods:{handleQuery(){var o;const t={page:1,limit:10},n={...(o=this.$route)==null?void 0:o.query,...this.queryParams,...t};this.noUrlParameters||this.$router.push({query:{...n}}),this.getList({...n})},async resetQuery(){var n;this.$refs.queryFormRef.resetFields();const t={page:1};this.noUrlParameters||await this.$router.push({query:{...t}}),this.queryParams={...this.noUrlParameters?{}:(n=this.$route)==null?void 0:n.query},this.afterReset(),this.handleQuery()}}});function X(t,n,o,a,l,s){const r=e.resolveComponent("Input"),i=e.resolveComponent("Radio"),p=e.resolveComponent("Select"),m=e.resolveComponent("Divider"),d=e.resolveComponent("Cascader"),y=e.resolveComponent("DatePicker"),b=e.resolveComponent("InputNumber"),B=e.resolveComponent("InputMobileVerification"),V=e.resolveComponent("InputGraphicVerification"),_=e.resolveComponent("el-form-item"),g=e.resolveComponent("el-button"),S=e.resolveComponent("el-form"),P=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createBlock(S,e.mergeProps({model:t.queryParams,ref:"queryFormRef",inline:"","label-position":"left","label-width":t.labelWidth},t.$attrs),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.formItem,c=>(e.openBlock(),e.createBlock(_,{label:c.label,prop:c.prop,key:c.prop,rules:c.rules},{default:e.withCtx(()=>[c.type==="input"?(e.openBlock(),e.createBlock(r,{key:0,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="radio"?(e.openBlock(),e.createBlock(i,{key:1,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="select"?(e.openBlock(),e.createBlock(p,{key:2,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="divider"?(e.openBlock(),e.createBlock(m,{key:3,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="cascader"?(e.openBlock(),e.createBlock(d,{key:4,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="date-picker"?(e.openBlock(),e.createBlock(y,{key:5,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="input-number"?(e.openBlock(),e.createBlock(b,{key:6,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="input-mobile-verification"?(e.openBlock(),e.createBlock(B,{key:7,item:c},null,8,["item"])):e.createCommentVNode("",!0),c.type==="input-graphic-verification"?(e.openBlock(),e.createBlock(V,{item:c,key:c.key},null,8,["item"])):e.createCommentVNode("",!0)]),_:2},1032,["label","prop","rules"]))),128)),e.renderSlot(t.$slots,"default"),t.formOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(_,{key:0},{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(g,{type:"primary",size:t.size,onClick:t.handleQuery},{default:e.withCtx(()=>[e.createTextVNode("查询")]),_:1},8,["size","onClick"])),[[P,t.formLoading]]),e.createVNode(g,{size:t.size,onClick:t.resetQuery},{default:e.withCtx(()=>[e.createTextVNode("重置")]),_:1},8,["size","onClick"])]),_:1})),e.renderSlot(t.$slots,"behind-the-button")]),_:3},16,["model","label-width"])),[[e.vShow,t.showSearch]])}const Y=u(J,[["render",X]]),Z=["infinite-scroll-disabled"],v=e.defineComponent({__name:"InfiniteScrollList",props:{search:{type:Function,required:!0},id:{type:String,required:!0},name:{type:String,required:!0},extra:{type:Function,required:!1}},setup(t,{expose:n}){const o=t,{search:a,id:l,name:s,extra:r}=o,i=e.ref([]),p=e.ref(1),m=e.ref(!1),d=e.ref([]),y=e.ref(!1),b=()=>{p.value=1,i.value=[],d.value=[],m.value=!1},B=async()=>{if(y.value||m.value)return;y.value=!0;const _=await a(p.value);_&&_.length>0?(i.value=[...i.value,..._],p.value+=1):m.value=!0,y.value=!1},V=e.computed(()=>i.value.filter(_=>d.value.includes(_[l])))||{};return n({reset:b,loadList:B,selectInfo:V}),(_,g)=>{const S=e.resolveComponent("el-checkbox"),P=e.resolveComponent("el-checkbox-group"),c=e.resolveDirective("infinite-scroll"),le=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createBlock(P,e.mergeProps({modelValue:d.value,"onUpdate:modelValue":g[0]||(g[0]=k=>d.value=k)},o),{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("ul",{class:"list","infinite-scroll-disabled":m.value},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,k=>(e.openBlock(),e.createElementBlock("li",{key:k[e.unref(l)],class:"list-item"},[e.createVNode(S,{label:k[e.unref(l)],class:"checkbox"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(k[e.unref(s)])+" "+e.toDisplayString(e.unref(r)&&e.unref(r)(k)),1)]),_:2},1032,["label"])]))),128))],8,Z)),[[c,B]])]),_:1},16,["modelValue"])),[[le,y.value]])}}}),ae="",ee=u(v,[["__scopeId","data-v-fda8f794"]]),te=e.defineComponent({__name:"Descriptions",props:{formData:{type:Object,required:!0},descriptionsItemProps:{type:Object,required:!1},formItem:{type:Array,required:!0}},setup(t){const n=t;return(o,a)=>{const l=e.resolveComponent("el-descriptions-item"),s=e.resolveComponent("el-descriptions");return e.openBlock(),e.createBlock(s,e.mergeProps({column:1,border:"",class:"form-width"},n),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.formItem,(r,i)=>(e.openBlock(),e.createBlock(l,e.mergeProps({key:r.prop,label:r.label},n.descriptionsItemProps),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.render?r.render({row:t.formData,$index:i}):t.formData[r.prop]),1)]),_:2},1040,["label"]))),128))]),_:1},16)}}}),oe=Y,ne=ee,re=te;f.VDescriptions=re,f.VGeneralBasicForm=oe,f.VInfiniteScrollList=ne,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.input-graphic-verification[data-v-500ec9b0]{display:flex;gap:12px;width:100%}.input-graphic-verification .input[data-v-500ec9b0]{flex:auto}.input-graphic-verification .graphic[data-v-500ec9b0]{width:109px;height:43px;object-fit:fill;flex:none}.verifiaction-button[data-v-4074e137]{width:109px}
|
|
1
|
+
.input-graphic-verification[data-v-500ec9b0]{display:flex;gap:12px;width:100%}.input-graphic-verification .input[data-v-500ec9b0]{flex:auto}.input-graphic-verification .graphic[data-v-500ec9b0]{width:109px;height:43px;object-fit:fill;flex:none}.verifiaction-button[data-v-4074e137]{width:109px}.list[data-v-fda8f794]{height:272px;overflow:auto;padding:8px 0}.list .checkbox[data-v-fda8f794]{width:calc(100% - 32px);padding:0 16px}
|