general-basic-form 2.0.4 → 2.0.6
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 +2 -0
- package/dist/index.js +477 -0
- package/dist/index.umd.cjs +1 -0
- package/dist/style.css +1 -1
- package/package.json +6 -5
- package/dist/index.mjs +0 -452
- package/dist/index.umd.js +0 -1
package/README.md
CHANGED
|
@@ -42,6 +42,7 @@ import GeneralBasicForm from 'general-basic-form'
|
|
|
42
42
|
}
|
|
43
43
|
noUrlParameters
|
|
44
44
|
:afterReset="afterReset"
|
|
45
|
+
v-model:loading="loading"
|
|
45
46
|
/>
|
|
46
47
|
|
|
47
48
|
<style lang="scss" scoped>
|
|
@@ -98,6 +99,7 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
|
|
|
98
99
|
afterReset(); // 在重置按钮点击完后但还没重新请求时触发的的函数
|
|
99
100
|
formOnly:true // 只展示表单不展示按钮
|
|
100
101
|
noUrlParameters:true // 不接受和不改变url的参数
|
|
102
|
+
loading:false // 加载动画
|
|
101
103
|
formItem: [
|
|
102
104
|
{
|
|
103
105
|
label: '',
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
import { defineComponent as _, inject as g, resolveComponent as l, openBlock as r, createBlock as a, mergeProps as h, withKeys as W, createSlots as F, renderList as S, withCtx as f, resolveDynamicComponent as U, createCommentVNode as y, ref as V, unref as v, resolveDirective as D, withDirectives as $, createElementBlock as q, createVNode as N, createElementVNode as H, computed as E, onBeforeUnmount as J, normalizeStyle as X, createTextVNode as I, toDisplayString as Y, h as Z, normalizeProps as x, guardReactiveProps as ee, provide as z, Fragment as B, renderSlot as te, vShow as ne } from "vue";
|
|
2
|
+
import { useRoute as oe } from "vue-router";
|
|
3
|
+
const G = {
|
|
4
|
+
placeholder: "请输入",
|
|
5
|
+
style: "width: 200px",
|
|
6
|
+
clearable: !0
|
|
7
|
+
}, re = _({
|
|
8
|
+
components: {
|
|
9
|
+
InputArchive: (e) => {
|
|
10
|
+
const { templateEle: n } = e;
|
|
11
|
+
return n();
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
item: null
|
|
16
|
+
// null就是any
|
|
17
|
+
},
|
|
18
|
+
setup() {
|
|
19
|
+
const e = g("queryParams", {}), n = g("getList"), t = g("size");
|
|
20
|
+
return { queryParams: e, getList: n, size: t };
|
|
21
|
+
},
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
inputSetting: {
|
|
25
|
+
...G,
|
|
26
|
+
...this.item.inputSetting
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
// created() {
|
|
31
|
+
// console.log("new", this.item);
|
|
32
|
+
// console.log("new", this.inputSetting);
|
|
33
|
+
// },
|
|
34
|
+
methods: {
|
|
35
|
+
currentInputComponent() {
|
|
36
|
+
return "input-archive";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// watch: {
|
|
40
|
+
// item(val) {
|
|
41
|
+
// console.log("item", val);
|
|
42
|
+
// },
|
|
43
|
+
// size(val) {
|
|
44
|
+
// console.log(val);
|
|
45
|
+
// },
|
|
46
|
+
// },
|
|
47
|
+
}), P = (e, n) => {
|
|
48
|
+
const t = e.__vccOpts || e;
|
|
49
|
+
for (const [s, i] of n)
|
|
50
|
+
t[s] = i;
|
|
51
|
+
return t;
|
|
52
|
+
};
|
|
53
|
+
function ae(e, n, t, s, i, p) {
|
|
54
|
+
const c = l("el-input");
|
|
55
|
+
return r(), a(c, h({
|
|
56
|
+
onKeydown: W(e.getList, ["enter"]),
|
|
57
|
+
modelValue: e.queryParams[e.item.prop],
|
|
58
|
+
"onUpdate:modelValue": n[0] || (n[0] = (u) => e.queryParams[e.item.prop] = u),
|
|
59
|
+
size: e.size
|
|
60
|
+
}, e.inputSetting), F({ _: 2 }, [
|
|
61
|
+
S(e.item.template, (u, d) => ({
|
|
62
|
+
name: d,
|
|
63
|
+
fn: f(() => [
|
|
64
|
+
u ? (r(), a(U(e.currentInputComponent()), {
|
|
65
|
+
key: d,
|
|
66
|
+
templateEle: u
|
|
67
|
+
}, null, 8, ["templateEle"])) : y("", !0)
|
|
68
|
+
])
|
|
69
|
+
}))
|
|
70
|
+
]), 1040, ["onKeydown", "modelValue", "size"]);
|
|
71
|
+
}
|
|
72
|
+
const L = /* @__PURE__ */ P(re, [["render", ae]]), ie = /* @__PURE__ */ _({
|
|
73
|
+
__name: "index",
|
|
74
|
+
props: {
|
|
75
|
+
item: {}
|
|
76
|
+
},
|
|
77
|
+
setup(e) {
|
|
78
|
+
const { item: n } = e, t = g("queryParams", {}), s = g("size"), i = V({
|
|
79
|
+
...G,
|
|
80
|
+
...n.inputSetting
|
|
81
|
+
});
|
|
82
|
+
return (p, c) => {
|
|
83
|
+
const u = l("el-input-number");
|
|
84
|
+
return r(), a(u, h({
|
|
85
|
+
modelValue: v(t)[p.item.prop],
|
|
86
|
+
"onUpdate:modelValue": c[0] || (c[0] = (d) => v(t)[p.item.prop] = d),
|
|
87
|
+
size: v(s)
|
|
88
|
+
}, i.value), null, 16, ["modelValue", "size"]);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}), R = Symbol(), se = { class: "input-graphic-verification" }, le = ["src"], ue = /* @__PURE__ */ _({
|
|
92
|
+
__name: "index",
|
|
93
|
+
props: {
|
|
94
|
+
item: {}
|
|
95
|
+
},
|
|
96
|
+
setup(e) {
|
|
97
|
+
const { item: n } = e, { graphicSrc: t = "", getGraphic: s = () => {
|
|
98
|
+
} } = n, { formLoading: i, updateFormLoading: p } = g(R), c = async () => {
|
|
99
|
+
s && !i.value && await s();
|
|
100
|
+
};
|
|
101
|
+
return (u, d) => {
|
|
102
|
+
const b = D("loading");
|
|
103
|
+
return $((r(), q("div", se, [
|
|
104
|
+
N(L, {
|
|
105
|
+
item: u.item,
|
|
106
|
+
class: "input"
|
|
107
|
+
}, null, 8, ["item"]),
|
|
108
|
+
H("img", {
|
|
109
|
+
class: "graphic",
|
|
110
|
+
onClick: c,
|
|
111
|
+
src: v(t)
|
|
112
|
+
}, null, 8, le)
|
|
113
|
+
])), [
|
|
114
|
+
[b, v(i)]
|
|
115
|
+
]);
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const pe = /* @__PURE__ */ P(ue, [["__scopeId", "data-v-500ec9b0"]]), k = "获取验证码", ce = 60, de = /* @__PURE__ */ _({
|
|
120
|
+
__name: "verification-button",
|
|
121
|
+
props: {
|
|
122
|
+
getSmscode: { type: Function }
|
|
123
|
+
},
|
|
124
|
+
setup(e) {
|
|
125
|
+
const { getSmscode: n } = e, t = V(k), s = V(null), i = E(() => t.value === k), p = () => {
|
|
126
|
+
s && (clearInterval(s.value), s.value = null, t.value = k);
|
|
127
|
+
}, c = async () => {
|
|
128
|
+
if (t.value === k)
|
|
129
|
+
if (t.value = ce, s.value = setInterval(() => {
|
|
130
|
+
if (Number(t.value) <= 0 || !t.value) {
|
|
131
|
+
p();
|
|
132
|
+
return;
|
|
133
|
+
} else
|
|
134
|
+
t.value = Number(t.value) - 1;
|
|
135
|
+
}, 1e3), n)
|
|
136
|
+
await n() === !1 && p();
|
|
137
|
+
else
|
|
138
|
+
return;
|
|
139
|
+
};
|
|
140
|
+
return J(() => {
|
|
141
|
+
p();
|
|
142
|
+
}), (u, d) => {
|
|
143
|
+
const b = l("el-button");
|
|
144
|
+
return r(), a(b, {
|
|
145
|
+
class: "verifiaction-button",
|
|
146
|
+
style: X({
|
|
147
|
+
color: i.value ? "var(--color-primary, #409EFF)" : "var(--text-color-placeholder, #A8ABB2)",
|
|
148
|
+
cursor: i.value ? "pointer" : "default"
|
|
149
|
+
}),
|
|
150
|
+
onClick: c
|
|
151
|
+
}, {
|
|
152
|
+
default: f(() => [
|
|
153
|
+
I(Y(i.value ? k : t.value + "s"), 1)
|
|
154
|
+
]),
|
|
155
|
+
_: 1
|
|
156
|
+
}, 8, ["style"]);
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
const me = /* @__PURE__ */ P(de, [["__scopeId", "data-v-4074e137"]]), fe = /* @__PURE__ */ _({
|
|
161
|
+
__name: "index",
|
|
162
|
+
props: {
|
|
163
|
+
item: {}
|
|
164
|
+
},
|
|
165
|
+
setup(e) {
|
|
166
|
+
const { item: n } = e, t = n;
|
|
167
|
+
return t.template = {
|
|
168
|
+
append: () => Z(me, {
|
|
169
|
+
getSmscode: t.getSmscode
|
|
170
|
+
})
|
|
171
|
+
}, (s, i) => (r(), a(L, {
|
|
172
|
+
item: v(t),
|
|
173
|
+
class: "input"
|
|
174
|
+
}, null, 8, ["item"]));
|
|
175
|
+
}
|
|
176
|
+
}), ye = _({
|
|
177
|
+
components: {
|
|
178
|
+
slotArchive: (e) => {
|
|
179
|
+
const { templateEle: n } = e;
|
|
180
|
+
return n();
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
props: {
|
|
184
|
+
item: null
|
|
185
|
+
// null就是any
|
|
186
|
+
},
|
|
187
|
+
setup() {
|
|
188
|
+
},
|
|
189
|
+
data() {
|
|
190
|
+
return {
|
|
191
|
+
dividerSetting: {
|
|
192
|
+
...this.item.dividerSetting
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
methods: {
|
|
197
|
+
currentInputComponent() {
|
|
198
|
+
return "slot-archive";
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
function _e(e, n, t, s, i, p) {
|
|
203
|
+
const c = l("el-divider");
|
|
204
|
+
return r(), a(c, x(ee(e.dividerSetting)), F({ _: 2 }, [
|
|
205
|
+
S(e.item.template, (u, d) => ({
|
|
206
|
+
name: d,
|
|
207
|
+
fn: f(() => [
|
|
208
|
+
u ? (r(), a(U(e.currentInputComponent()), {
|
|
209
|
+
key: d,
|
|
210
|
+
templateEle: u
|
|
211
|
+
}, null, 8, ["templateEle"])) : y("", !0)
|
|
212
|
+
])
|
|
213
|
+
}))
|
|
214
|
+
]), 1040);
|
|
215
|
+
}
|
|
216
|
+
const he = /* @__PURE__ */ P(ye, [["render", _e]]), ge = _({
|
|
217
|
+
name: "GeneralBasicForm",
|
|
218
|
+
components: {
|
|
219
|
+
Input: L,
|
|
220
|
+
InputNumber: ie,
|
|
221
|
+
InputGraphicVerification: pe,
|
|
222
|
+
InputMobileVerification: fe,
|
|
223
|
+
Divider: he
|
|
224
|
+
},
|
|
225
|
+
props: {
|
|
226
|
+
showSearch: {
|
|
227
|
+
// 是否展示所有元素
|
|
228
|
+
type: Boolean,
|
|
229
|
+
default: !0
|
|
230
|
+
},
|
|
231
|
+
loading: {
|
|
232
|
+
// 加载动画
|
|
233
|
+
type: Boolean,
|
|
234
|
+
default: !1
|
|
235
|
+
},
|
|
236
|
+
formOnly: {
|
|
237
|
+
// 是否只展示表单不展示按钮
|
|
238
|
+
type: Boolean,
|
|
239
|
+
default: !1
|
|
240
|
+
},
|
|
241
|
+
getList: {
|
|
242
|
+
// 查找数据调用的函数
|
|
243
|
+
type: Function,
|
|
244
|
+
default: () => {
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
afterReset: {
|
|
248
|
+
// 在重置按钮点击完后但还没重新请求时触发的的函数
|
|
249
|
+
type: Function,
|
|
250
|
+
default: () => {
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
formItem: {
|
|
254
|
+
// 定义表单的数据
|
|
255
|
+
type: Array,
|
|
256
|
+
default: []
|
|
257
|
+
},
|
|
258
|
+
size: {
|
|
259
|
+
// 控制按钮大小
|
|
260
|
+
type: String,
|
|
261
|
+
default: "medium"
|
|
262
|
+
},
|
|
263
|
+
labelWidth: {
|
|
264
|
+
// 表单文字宽度
|
|
265
|
+
type: String,
|
|
266
|
+
default: "90px"
|
|
267
|
+
},
|
|
268
|
+
noUrlParameters: {
|
|
269
|
+
// 不接受和不改变url的参数
|
|
270
|
+
type: Boolean,
|
|
271
|
+
default: () => !1
|
|
272
|
+
},
|
|
273
|
+
formData: {
|
|
274
|
+
// 外部传入的表单数据,用于回填
|
|
275
|
+
type: Object,
|
|
276
|
+
default: () => {
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
data() {
|
|
281
|
+
return {
|
|
282
|
+
formLoading: this.loading || !1,
|
|
283
|
+
selectSetting: {
|
|
284
|
+
placeholder: "请选择",
|
|
285
|
+
clearable: !0,
|
|
286
|
+
style: "width: 200px"
|
|
287
|
+
},
|
|
288
|
+
datePackerSetting: {
|
|
289
|
+
style: "width: 227px",
|
|
290
|
+
"start-placeholder": "开始日期",
|
|
291
|
+
"end-placeholder": "结束日期",
|
|
292
|
+
type: "daterange"
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
},
|
|
296
|
+
setup(e) {
|
|
297
|
+
const { size: n, noUrlParameters: t, getList: s } = e, i = oe(), p = V({
|
|
298
|
+
...t ? {} : i == null ? void 0 : i.query
|
|
299
|
+
});
|
|
300
|
+
return z(
|
|
301
|
+
/* 注入名 */
|
|
302
|
+
"queryParams",
|
|
303
|
+
/* 值 */
|
|
304
|
+
p
|
|
305
|
+
), z(
|
|
306
|
+
/* 注入名 */
|
|
307
|
+
"size",
|
|
308
|
+
/* 值 */
|
|
309
|
+
n
|
|
310
|
+
), z(
|
|
311
|
+
/* 注入名 */
|
|
312
|
+
"getList",
|
|
313
|
+
/* 值 */
|
|
314
|
+
s
|
|
315
|
+
), {
|
|
316
|
+
queryParams: p
|
|
317
|
+
};
|
|
318
|
+
},
|
|
319
|
+
watch: {
|
|
320
|
+
formData(e) {
|
|
321
|
+
this.queryParams = {
|
|
322
|
+
...this.noUrlParameters ? {} : this.queryParams,
|
|
323
|
+
...e
|
|
324
|
+
};
|
|
325
|
+
},
|
|
326
|
+
loading(e) {
|
|
327
|
+
this.formLoading !== e && (this.formLoading = e);
|
|
328
|
+
},
|
|
329
|
+
formLoading(e) {
|
|
330
|
+
this.loading !== e && this.$emit("update:loading", e);
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
provide() {
|
|
334
|
+
return {
|
|
335
|
+
// 显式提供一个计算属性
|
|
336
|
+
[R]: {
|
|
337
|
+
formLoading: E(() => this.formLoading),
|
|
338
|
+
updateFormLoading: (e) => {
|
|
339
|
+
this.formLoading = e;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
},
|
|
344
|
+
methods: {
|
|
345
|
+
/** 搜索按钮操作 */
|
|
346
|
+
handleQuery() {
|
|
347
|
+
var t;
|
|
348
|
+
const e = { page: 1, limit: 10 }, n = {
|
|
349
|
+
...(t = this.$route) == null ? void 0 : t.query,
|
|
350
|
+
...this.queryParams,
|
|
351
|
+
...e
|
|
352
|
+
};
|
|
353
|
+
this.noUrlParameters || this.$router.push({
|
|
354
|
+
query: { ...n }
|
|
355
|
+
}), this.getList({
|
|
356
|
+
...n
|
|
357
|
+
});
|
|
358
|
+
},
|
|
359
|
+
/** 重置按钮操作 */
|
|
360
|
+
async resetQuery() {
|
|
361
|
+
var n;
|
|
362
|
+
this.$refs.queryFormRef.resetFields();
|
|
363
|
+
const e = { page: 1 };
|
|
364
|
+
this.noUrlParameters || await this.$router.push({
|
|
365
|
+
query: { ...e }
|
|
366
|
+
}), this.queryParams = {
|
|
367
|
+
...this.noUrlParameters ? {} : (n = this.$route) == null ? void 0 : n.query
|
|
368
|
+
}, this.afterReset(), this.handleQuery();
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
function ve(e, n, t, s, i, p) {
|
|
373
|
+
const c = l("Input"), u = l("InputGraphicVerification"), d = l("InputMobileVerification"), b = l("Divider"), A = l("el-option"), Q = l("el-select"), T = l("el-cascader"), K = l("el-date-picker"), O = l("InputNumber"), C = l("el-form-item"), w = l("el-button"), M = l("el-form"), j = D("loading");
|
|
374
|
+
return $((r(), a(M, h({
|
|
375
|
+
model: e.queryParams,
|
|
376
|
+
ref: "queryFormRef",
|
|
377
|
+
inline: "",
|
|
378
|
+
"label-position": "left",
|
|
379
|
+
"label-width": e.labelWidth
|
|
380
|
+
}, e.$attrs), {
|
|
381
|
+
default: f(() => [
|
|
382
|
+
(r(!0), q(B, null, S(e.formItem, (o) => (r(), a(C, {
|
|
383
|
+
label: o.label,
|
|
384
|
+
prop: o.prop,
|
|
385
|
+
key: o.prop,
|
|
386
|
+
rules: o.rules
|
|
387
|
+
}, {
|
|
388
|
+
default: f(() => [
|
|
389
|
+
o.type === "input" ? (r(), a(c, {
|
|
390
|
+
key: 0,
|
|
391
|
+
item: o
|
|
392
|
+
}, null, 8, ["item"])) : y("", !0),
|
|
393
|
+
o.type === "input-graphic-verification" ? (r(), a(u, {
|
|
394
|
+
item: o,
|
|
395
|
+
key: o.key
|
|
396
|
+
}, null, 8, ["item"])) : y("", !0),
|
|
397
|
+
o.type === "input-mobile-verification" ? (r(), a(d, {
|
|
398
|
+
key: 2,
|
|
399
|
+
item: o
|
|
400
|
+
}, null, 8, ["item"])) : y("", !0),
|
|
401
|
+
o.type === "divider" ? (r(), a(b, {
|
|
402
|
+
key: 3,
|
|
403
|
+
item: o
|
|
404
|
+
}, null, 8, ["item"])) : o.type === "select" ? (r(), a(Q, h({
|
|
405
|
+
key: 4,
|
|
406
|
+
filterable: "",
|
|
407
|
+
modelValue: e.queryParams[o.prop],
|
|
408
|
+
"onUpdate:modelValue": (m) => e.queryParams[o.prop] = m,
|
|
409
|
+
size: e.size
|
|
410
|
+
}, o.selectSetting || e.selectSetting), {
|
|
411
|
+
default: f(() => [
|
|
412
|
+
(r(!0), q(B, null, S(o.option || [], (m) => (r(), a(A, {
|
|
413
|
+
key: m.value,
|
|
414
|
+
label: m.desc,
|
|
415
|
+
value: m.value
|
|
416
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
417
|
+
]),
|
|
418
|
+
_: 2
|
|
419
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "size"])) : o.type === "cascader" ? (r(), a(T, h({
|
|
420
|
+
key: 5,
|
|
421
|
+
filterable: "",
|
|
422
|
+
modelValue: e.queryParams[o.prop],
|
|
423
|
+
"onUpdate:modelValue": (m) => e.queryParams[o.prop] = m,
|
|
424
|
+
size: e.size,
|
|
425
|
+
options: o.options || []
|
|
426
|
+
}, o.selectSetting || e.selectSetting), null, 16, ["modelValue", "onUpdate:modelValue", "size", "options"])) : o.type === "date-picker" ? (r(), a(K, h({
|
|
427
|
+
key: 6,
|
|
428
|
+
modelValue: e.queryParams[o.prop],
|
|
429
|
+
"onUpdate:modelValue": (m) => e.queryParams[o.prop] = m,
|
|
430
|
+
size: e.size
|
|
431
|
+
}, o.datePackerSetting || e.datePackerSetting), null, 16, ["modelValue", "onUpdate:modelValue", "size"])) : y("", !0),
|
|
432
|
+
o.type === "input-number" ? (r(), a(O, {
|
|
433
|
+
key: 7,
|
|
434
|
+
item: o
|
|
435
|
+
}, null, 8, ["item"])) : y("", !0)
|
|
436
|
+
]),
|
|
437
|
+
_: 2
|
|
438
|
+
}, 1032, ["label", "prop", "rules"]))), 128)),
|
|
439
|
+
te(e.$slots, "default"),
|
|
440
|
+
e.formOnly ? y("", !0) : (r(), a(C, { key: 0 }, {
|
|
441
|
+
default: f(() => [
|
|
442
|
+
$((r(), a(w, {
|
|
443
|
+
type: "primary",
|
|
444
|
+
icon: "el-icon-search",
|
|
445
|
+
size: e.size,
|
|
446
|
+
onClick: e.handleQuery
|
|
447
|
+
}, {
|
|
448
|
+
default: f(() => [
|
|
449
|
+
I("查询")
|
|
450
|
+
]),
|
|
451
|
+
_: 1
|
|
452
|
+
}, 8, ["size", "onClick"])), [
|
|
453
|
+
[j, e.formLoading]
|
|
454
|
+
]),
|
|
455
|
+
N(w, {
|
|
456
|
+
icon: "el-icon-refresh",
|
|
457
|
+
size: e.size,
|
|
458
|
+
onClick: e.resetQuery
|
|
459
|
+
}, {
|
|
460
|
+
default: f(() => [
|
|
461
|
+
I("重置")
|
|
462
|
+
]),
|
|
463
|
+
_: 1
|
|
464
|
+
}, 8, ["size", "onClick"])
|
|
465
|
+
]),
|
|
466
|
+
_: 1
|
|
467
|
+
}))
|
|
468
|
+
]),
|
|
469
|
+
_: 3
|
|
470
|
+
}, 16, ["model", "label-width"])), [
|
|
471
|
+
[ne, e.showSearch]
|
|
472
|
+
]);
|
|
473
|
+
}
|
|
474
|
+
const be = /* @__PURE__ */ P(ge, [["render", ve]]), Se = be;
|
|
475
|
+
export {
|
|
476
|
+
Se as VGeneralBasicForm
|
|
477
|
+
};
|
|
@@ -0,0 +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,C){"use strict";const _={placeholder:"请输入",style:"width: 200px",clearable:!0},V=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:{..._,...this.item.inputSetting}}},methods:{currentInputComponent(){return"input-archive"}}}),u=(t,n)=>{const o=t.__vccOpts||t;for(const[l,a]of n)o[l]=a;return o};function b(t,n,o,l,a,s){const c=e.resolveComponent("el-input");return e.openBlock(),e.createBlock(c,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 h=u(V,[["render",b]]),P=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),l=e.inject("size"),a=e.ref({..._,...n.inputSetting});return(s,c)=>{const i=e.resolveComponent("el-input-number");return e.openBlock(),e.createBlock(i,e.mergeProps({modelValue:e.unref(o)[s.item.prop],"onUpdate:modelValue":c[0]||(c[0]=p=>e.unref(o)[s.item.prop]=p),size:e.unref(l)},a.value),null,16,["modelValue","size"])}}}),k=Symbol(),S={class:"input-graphic-verification"},z=["src"],q=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,{graphicSrc:o="",getGraphic:l=()=>{}}=n,{formLoading:a,updateFormLoading:s}=e.inject(k),c=async()=>{l&&!a.value&&await l()};return(i,p)=>{const y=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createElementBlock("div",S,[e.createVNode(h,{item:i.item,class:"input"},null,8,["item"]),e.createElementVNode("img",{class:"graphic",onClick:c,src:e.unref(o)},null,8,z)])),[[y,e.unref(a)]])}}}),W="",$=u(q,[["__scopeId","data-v-500ec9b0"]]),f="获取验证码",w=60,I=e.defineComponent({__name:"verification-button",props:{getSmscode:{type:Function}},setup(t){const{getSmscode:n}=t,o=e.ref(f),l=e.ref(null),a=e.computed(()=>o.value===f),s=()=>{l&&(clearInterval(l.value),l.value=null,o.value=f)},c=async()=>{if(o.value===f)if(o.value=w,l.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 y=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(y,{class:"verifiaction-button",style:e.normalizeStyle({color:a.value?"var(--color-primary, #409EFF)":"var(--text-color-placeholder, #A8ABB2)",cursor:a.value?"pointer":"default"}),onClick:c},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value?f:o.value+"s"),1)]),_:1},8,["style"])}}}),H="",L=u(I,[["__scopeId","data-v-4074e137"]]),N=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=n;return o.template={append:()=>e.h(L,{getSmscode:o.getSmscode})},(l,a)=>(e.openBlock(),e.createBlock(h,{item:e.unref(o),class:"input"},null,8,["item"]))}}),F=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 D(t,n,o,l,a,s){const c=e.resolveComponent("el-divider");return e.openBlock(),e.createBlock(c,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 U=u(F,[["render",D]]),E=e.defineComponent({name:"GeneralBasicForm",components:{Input:h,InputNumber:P,InputGraphicVerification:$,InputMobileVerification:N,Divider:U},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:"medium"},labelWidth:{type:String,default:"90px"},noUrlParameters:{type:Boolean,default:()=>!1},formData:{type:Object,default:()=>{}}},data(){return{formLoading:this.loading||!1,selectSetting:{placeholder:"请选择",clearable:!0,style:"width: 200px"},datePackerSetting:{style:"width: 227px","start-placeholder":"开始日期","end-placeholder":"结束日期",type:"daterange"}}},setup(t){const{size:n,noUrlParameters:o,getList:l}=t,a=C.useRoute(),s=e.ref({...o?{}:a==null?void 0:a.query});return e.provide("queryParams",s),e.provide("size",n),e.provide("getList",l),{queryParams:s}},watch:{formData(t){this.queryParams={...this.noUrlParameters?{}:this.queryParams,...t}},loading(t){this.formLoading!==t&&(this.formLoading=t)},formLoading(t){this.loading!==t&&this.$emit("update:loading",t)}},provide(){return{[k]:{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 T(t,n,o,l,a,s){const c=e.resolveComponent("Input"),i=e.resolveComponent("InputGraphicVerification"),p=e.resolveComponent("InputMobileVerification"),y=e.resolveComponent("Divider"),G=e.resolveComponent("el-option"),R=e.resolveComponent("el-select"),A=e.resolveComponent("el-cascader"),O=e.resolveComponent("el-date-picker"),Q=e.resolveComponent("InputNumber"),g=e.resolveComponent("el-form-item"),B=e.resolveComponent("el-button"),K=e.resolveComponent("el-form"),M=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createBlock(K,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,r=>(e.openBlock(),e.createBlock(g,{label:r.label,prop:r.prop,key:r.prop,rules:r.rules},{default:e.withCtx(()=>[r.type==="input"?(e.openBlock(),e.createBlock(c,{key:0,item:r},null,8,["item"])):e.createCommentVNode("",!0),r.type==="input-graphic-verification"?(e.openBlock(),e.createBlock(i,{item:r,key:r.key},null,8,["item"])):e.createCommentVNode("",!0),r.type==="input-mobile-verification"?(e.openBlock(),e.createBlock(p,{key:2,item:r},null,8,["item"])):e.createCommentVNode("",!0),r.type==="divider"?(e.openBlock(),e.createBlock(y,{key:3,item:r},null,8,["item"])):r.type==="select"?(e.openBlock(),e.createBlock(R,e.mergeProps({key:4,filterable:"",modelValue:t.queryParams[r.prop],"onUpdate:modelValue":m=>t.queryParams[r.prop]=m,size:t.size},r.selectSetting||t.selectSetting),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.option||[],m=>(e.openBlock(),e.createBlock(G,{key:m.value,label:m.desc,value:m.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","size"])):r.type==="cascader"?(e.openBlock(),e.createBlock(A,e.mergeProps({key:5,filterable:"",modelValue:t.queryParams[r.prop],"onUpdate:modelValue":m=>t.queryParams[r.prop]=m,size:t.size,options:r.options||[]},r.selectSetting||t.selectSetting),null,16,["modelValue","onUpdate:modelValue","size","options"])):r.type==="date-picker"?(e.openBlock(),e.createBlock(O,e.mergeProps({key:6,modelValue:t.queryParams[r.prop],"onUpdate:modelValue":m=>t.queryParams[r.prop]=m,size:t.size},r.datePackerSetting||t.datePackerSetting),null,16,["modelValue","onUpdate:modelValue","size"])):e.createCommentVNode("",!0),r.type==="input-number"?(e.openBlock(),e.createBlock(Q,{key:7,item:r},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(g,{key:0},{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(B,{type:"primary",icon:"el-icon-search",size:t.size,onClick:t.handleQuery},{default:e.withCtx(()=>[e.createTextVNode("查询")]),_:1},8,["size","onClick"])),[[M,t.formLoading]]),e.createVNode(B,{icon:"el-icon-refresh",size:t.size,onClick:t.resetQuery},{default:e.withCtx(()=>[e.createTextVNode("重置")]),_:1},8,["size","onClick"])]),_:1}))]),_:3},16,["model","label-width"])),[[e.vShow,t.showSearch]])}const j=u(E,[["render",T]]);d.VGeneralBasicForm=j,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.input-graphic-verification[data-v-
|
|
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}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "general-basic-form",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "./dist/index.umd.
|
|
5
|
+
"main": "./dist/index.umd.cjs",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"build": "cross-env CURRENT_ENV=prod run-p type-check build-only",
|
|
8
9
|
"test:e2e": "playwright test",
|
|
@@ -45,11 +46,11 @@
|
|
|
45
46
|
"vue-router": ">=4.2.4"
|
|
46
47
|
},
|
|
47
48
|
"typings": "./dist/index.d.ts",
|
|
48
|
-
"module": "./dist/index.
|
|
49
|
+
"module": "./dist/index.js",
|
|
49
50
|
"exports": {
|
|
50
51
|
".": {
|
|
51
|
-
"import": "./dist/index.
|
|
52
|
-
"require": "./dist/index.umd.
|
|
52
|
+
"import": "./dist/index.js",
|
|
53
|
+
"require": "./dist/index.umd.cjs"
|
|
53
54
|
}
|
|
54
55
|
},
|
|
55
56
|
"files": [
|
package/dist/index.mjs
DELETED
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
import { defineComponent as _, inject as g, resolveComponent as i, openBlock as o, createBlock as s, mergeProps as h, withKeys as O, createSlots as F, renderList as S, withCtx as y, resolveDynamicComponent as D, createCommentVNode as f, ref as k, unref as b, resolveDirective as K, withDirectives as N, createElementBlock as $, createVNode as q, createElementVNode as M, computed as j, onBeforeUnmount as W, normalizeStyle as H, createTextVNode as I, toDisplayString as J, h as X, normalizeProps as Y, guardReactiveProps as Z, provide as z, Fragment as U, renderSlot as x, vShow as ee } from "vue";
|
|
2
|
-
import { useRoute as te } from "vue-router";
|
|
3
|
-
const E = {
|
|
4
|
-
placeholder: "请输入",
|
|
5
|
-
style: "width: 200px",
|
|
6
|
-
clearable: !0
|
|
7
|
-
}, ne = _({
|
|
8
|
-
components: {
|
|
9
|
-
InputArchive: (e) => {
|
|
10
|
-
const { templateEle: n } = e;
|
|
11
|
-
return n();
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
props: {
|
|
15
|
-
item: null
|
|
16
|
-
// null就是any
|
|
17
|
-
},
|
|
18
|
-
setup() {
|
|
19
|
-
const e = g("queryParams", {}), n = g("getList"), t = g("size");
|
|
20
|
-
return { queryParams: e, getList: n, size: t };
|
|
21
|
-
},
|
|
22
|
-
data() {
|
|
23
|
-
return {
|
|
24
|
-
inputSetting: {
|
|
25
|
-
...E,
|
|
26
|
-
...this.item.inputSetting
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
// created() {
|
|
31
|
-
// console.log("new", this.item);
|
|
32
|
-
// console.log("new", this.inputSetting);
|
|
33
|
-
// },
|
|
34
|
-
methods: {
|
|
35
|
-
currentInputComponent() {
|
|
36
|
-
return "input-archive";
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// watch: {
|
|
40
|
-
// item(val) {
|
|
41
|
-
// console.log("item", val);
|
|
42
|
-
// },
|
|
43
|
-
// size(val) {
|
|
44
|
-
// console.log(val);
|
|
45
|
-
// },
|
|
46
|
-
// },
|
|
47
|
-
}), P = (e, n) => {
|
|
48
|
-
const t = e.__vccOpts || e;
|
|
49
|
-
for (const [l, a] of n)
|
|
50
|
-
t[l] = a;
|
|
51
|
-
return t;
|
|
52
|
-
};
|
|
53
|
-
function re(e, n, t, l, a, u) {
|
|
54
|
-
const c = i("el-input");
|
|
55
|
-
return o(), s(c, h({
|
|
56
|
-
onKeydown: O(e.getList, ["enter"]),
|
|
57
|
-
modelValue: e.queryParams[e.item.prop],
|
|
58
|
-
"onUpdate:modelValue": n[0] || (n[0] = (p) => e.queryParams[e.item.prop] = p),
|
|
59
|
-
size: e.size
|
|
60
|
-
}, e.inputSetting), F({ _: 2 }, [
|
|
61
|
-
S(e.item.template, (p, m) => ({
|
|
62
|
-
name: m,
|
|
63
|
-
fn: y(() => [
|
|
64
|
-
p ? (o(), s(D(e.currentInputComponent()), {
|
|
65
|
-
key: m,
|
|
66
|
-
templateEle: p
|
|
67
|
-
}, null, 8, ["templateEle"])) : f("", !0)
|
|
68
|
-
])
|
|
69
|
-
}))
|
|
70
|
-
]), 1040, ["onKeydown", "modelValue", "size"]);
|
|
71
|
-
}
|
|
72
|
-
const C = /* @__PURE__ */ P(ne, [["render", re]]), oe = /* @__PURE__ */ _({
|
|
73
|
-
__name: "index",
|
|
74
|
-
props: {
|
|
75
|
-
item: {}
|
|
76
|
-
},
|
|
77
|
-
setup(e) {
|
|
78
|
-
const { item: n } = e, t = g("queryParams", {}), l = g("size"), a = k({
|
|
79
|
-
...E,
|
|
80
|
-
...n.inputSetting
|
|
81
|
-
});
|
|
82
|
-
return (u, c) => {
|
|
83
|
-
const p = i("el-input-number");
|
|
84
|
-
return o(), s(p, h({
|
|
85
|
-
modelValue: b(t)[u.item.prop],
|
|
86
|
-
"onUpdate:modelValue": c[0] || (c[0] = (m) => b(t)[u.item.prop] = m),
|
|
87
|
-
size: b(l)
|
|
88
|
-
}, a.value), null, 16, ["modelValue", "size"]);
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
}), ae = { class: "input-graphic-verification" }, se = ["src"], le = /* @__PURE__ */ _({
|
|
92
|
-
__name: "index",
|
|
93
|
-
props: {
|
|
94
|
-
item: {}
|
|
95
|
-
},
|
|
96
|
-
setup(e) {
|
|
97
|
-
const { item: n } = e, { graphicSrc: t = "", getGraphic: l = () => {
|
|
98
|
-
} } = n, a = k(!1), u = async () => {
|
|
99
|
-
l && !a.value && (a.value = !0, await l(), a.value = !1);
|
|
100
|
-
};
|
|
101
|
-
return (c, p) => {
|
|
102
|
-
const m = K("loading");
|
|
103
|
-
return N((o(), $("div", ae, [
|
|
104
|
-
q(C, {
|
|
105
|
-
item: c.item,
|
|
106
|
-
class: "input"
|
|
107
|
-
}, null, 8, ["item"]),
|
|
108
|
-
M("img", {
|
|
109
|
-
class: "graphic",
|
|
110
|
-
onClick: u,
|
|
111
|
-
src: b(t)
|
|
112
|
-
}, null, 8, se)
|
|
113
|
-
])), [
|
|
114
|
-
[m, a.value]
|
|
115
|
-
]);
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
const ie = /* @__PURE__ */ P(le, [["__scopeId", "data-v-768ce181"]]), v = "获取验证码", ue = 60, pe = /* @__PURE__ */ _({
|
|
120
|
-
__name: "verification-button",
|
|
121
|
-
props: {
|
|
122
|
-
getSmscode: { type: Function }
|
|
123
|
-
},
|
|
124
|
-
setup(e) {
|
|
125
|
-
const { getSmscode: n } = e, t = k(v), l = k(null), a = j(() => t.value === v), u = () => {
|
|
126
|
-
l && (clearInterval(l.value), l.value = null, t.value = v);
|
|
127
|
-
}, c = async () => {
|
|
128
|
-
if (t.value === v)
|
|
129
|
-
if (t.value = ue, l.value = setInterval(() => {
|
|
130
|
-
if (Number(t.value) <= 0 || !t.value) {
|
|
131
|
-
u();
|
|
132
|
-
return;
|
|
133
|
-
} else
|
|
134
|
-
t.value = Number(t.value) - 1;
|
|
135
|
-
}, 1e3), n)
|
|
136
|
-
await n() === !1 && u();
|
|
137
|
-
else
|
|
138
|
-
return;
|
|
139
|
-
};
|
|
140
|
-
return W(() => {
|
|
141
|
-
u();
|
|
142
|
-
}), (p, m) => {
|
|
143
|
-
const V = i("el-button");
|
|
144
|
-
return o(), s(V, {
|
|
145
|
-
class: "verifiaction-button",
|
|
146
|
-
style: H({
|
|
147
|
-
color: a.value ? "var(--color-primary, #409EFF)" : "var(--text-color-placeholder, #A8ABB2)",
|
|
148
|
-
cursor: a.value ? "pointer" : "default"
|
|
149
|
-
}),
|
|
150
|
-
onClick: c
|
|
151
|
-
}, {
|
|
152
|
-
default: y(() => [
|
|
153
|
-
I(J(a.value ? v : t.value + "s"), 1)
|
|
154
|
-
]),
|
|
155
|
-
_: 1
|
|
156
|
-
}, 8, ["style"]);
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
const ce = /* @__PURE__ */ P(pe, [["__scopeId", "data-v-4074e137"]]), me = /* @__PURE__ */ _({
|
|
161
|
-
__name: "index",
|
|
162
|
-
props: {
|
|
163
|
-
item: {}
|
|
164
|
-
},
|
|
165
|
-
setup(e) {
|
|
166
|
-
const { item: n } = e, t = n;
|
|
167
|
-
return t.template = {
|
|
168
|
-
append: () => X(ce, {
|
|
169
|
-
getSmscode: t.getSmscode
|
|
170
|
-
})
|
|
171
|
-
}, (l, a) => (o(), s(C, {
|
|
172
|
-
item: b(t),
|
|
173
|
-
class: "input"
|
|
174
|
-
}, null, 8, ["item"]));
|
|
175
|
-
}
|
|
176
|
-
}), de = _({
|
|
177
|
-
components: {
|
|
178
|
-
slotArchive: (e) => {
|
|
179
|
-
const { templateEle: n } = e;
|
|
180
|
-
return n();
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
props: {
|
|
184
|
-
item: null
|
|
185
|
-
// null就是any
|
|
186
|
-
},
|
|
187
|
-
setup() {
|
|
188
|
-
},
|
|
189
|
-
data() {
|
|
190
|
-
return {
|
|
191
|
-
dividerSetting: {
|
|
192
|
-
...this.item.dividerSetting
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
},
|
|
196
|
-
methods: {
|
|
197
|
-
currentInputComponent() {
|
|
198
|
-
return "slot-archive";
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
function ye(e, n, t, l, a, u) {
|
|
203
|
-
const c = i("el-divider");
|
|
204
|
-
return o(), s(c, Y(Z(e.dividerSetting)), F({ _: 2 }, [
|
|
205
|
-
S(e.item.template, (p, m) => ({
|
|
206
|
-
name: m,
|
|
207
|
-
fn: y(() => [
|
|
208
|
-
p ? (o(), s(D(e.currentInputComponent()), {
|
|
209
|
-
key: m,
|
|
210
|
-
templateEle: p
|
|
211
|
-
}, null, 8, ["templateEle"])) : f("", !0)
|
|
212
|
-
])
|
|
213
|
-
}))
|
|
214
|
-
]), 1040);
|
|
215
|
-
}
|
|
216
|
-
const fe = /* @__PURE__ */ P(de, [["render", ye]]), _e = _({
|
|
217
|
-
name: "GeneralBasicForm",
|
|
218
|
-
components: {
|
|
219
|
-
Input: C,
|
|
220
|
-
InputNumber: oe,
|
|
221
|
-
InputGraphicVerification: ie,
|
|
222
|
-
InputMobileVerification: me,
|
|
223
|
-
Divider: fe
|
|
224
|
-
},
|
|
225
|
-
props: {
|
|
226
|
-
showSearch: {
|
|
227
|
-
// 是否展示所有元素
|
|
228
|
-
type: Boolean,
|
|
229
|
-
default: !0
|
|
230
|
-
},
|
|
231
|
-
formOnly: {
|
|
232
|
-
// 是否只展示表单不展示按钮
|
|
233
|
-
type: Boolean,
|
|
234
|
-
default: !1
|
|
235
|
-
},
|
|
236
|
-
getList: {
|
|
237
|
-
// 查找数据调用的函数
|
|
238
|
-
type: Function,
|
|
239
|
-
default: () => {
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
afterReset: {
|
|
243
|
-
// 在重置按钮点击完后但还没重新请求时触发的的函数
|
|
244
|
-
type: Function,
|
|
245
|
-
default: () => {
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
formItem: {
|
|
249
|
-
// 定义表单的数据
|
|
250
|
-
type: Array,
|
|
251
|
-
default: []
|
|
252
|
-
},
|
|
253
|
-
size: {
|
|
254
|
-
// 控制按钮大小
|
|
255
|
-
type: String,
|
|
256
|
-
default: "medium"
|
|
257
|
-
},
|
|
258
|
-
labelWidth: {
|
|
259
|
-
// 表单文字宽度
|
|
260
|
-
type: String,
|
|
261
|
-
default: "90px"
|
|
262
|
-
},
|
|
263
|
-
noUrlParameters: {
|
|
264
|
-
// 不接受和不改变url的参数
|
|
265
|
-
type: Boolean,
|
|
266
|
-
default: () => !1
|
|
267
|
-
},
|
|
268
|
-
formData: {
|
|
269
|
-
// 外部传入的表单数据,用于回填
|
|
270
|
-
type: Object,
|
|
271
|
-
default: () => {
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
data() {
|
|
276
|
-
return {
|
|
277
|
-
selectSetting: {
|
|
278
|
-
placeholder: "请选择",
|
|
279
|
-
clearable: !0,
|
|
280
|
-
style: "width: 200px"
|
|
281
|
-
},
|
|
282
|
-
datePackerSetting: {
|
|
283
|
-
style: "width: 227px",
|
|
284
|
-
"start-placeholder": "开始日期",
|
|
285
|
-
"end-placeholder": "结束日期",
|
|
286
|
-
type: "daterange"
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
},
|
|
290
|
-
setup(e) {
|
|
291
|
-
const { size: n, noUrlParameters: t, getList: l } = e, a = te(), u = k({
|
|
292
|
-
...t ? {} : a == null ? void 0 : a.query
|
|
293
|
-
});
|
|
294
|
-
return z(
|
|
295
|
-
/* 注入名 */
|
|
296
|
-
"queryParams",
|
|
297
|
-
/* 值 */
|
|
298
|
-
u
|
|
299
|
-
), z(
|
|
300
|
-
/* 注入名 */
|
|
301
|
-
"size",
|
|
302
|
-
/* 值 */
|
|
303
|
-
n
|
|
304
|
-
), z(
|
|
305
|
-
/* 注入名 */
|
|
306
|
-
"getList",
|
|
307
|
-
/* 值 */
|
|
308
|
-
l
|
|
309
|
-
), {
|
|
310
|
-
queryParams: u
|
|
311
|
-
};
|
|
312
|
-
},
|
|
313
|
-
watch: {
|
|
314
|
-
formData(e) {
|
|
315
|
-
this.queryParams = {
|
|
316
|
-
...this.noUrlParameters ? {} : this.queryParams,
|
|
317
|
-
...e
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
},
|
|
321
|
-
methods: {
|
|
322
|
-
/** 搜索按钮操作 */
|
|
323
|
-
handleQuery() {
|
|
324
|
-
var t;
|
|
325
|
-
const e = { page: 1, limit: 10 }, n = {
|
|
326
|
-
...(t = this.$route) == null ? void 0 : t.query,
|
|
327
|
-
...this.queryParams,
|
|
328
|
-
...e
|
|
329
|
-
};
|
|
330
|
-
this.noUrlParameters || this.$router.push({
|
|
331
|
-
query: { ...n }
|
|
332
|
-
}), this.getList({
|
|
333
|
-
...n
|
|
334
|
-
});
|
|
335
|
-
},
|
|
336
|
-
/** 重置按钮操作 */
|
|
337
|
-
async resetQuery() {
|
|
338
|
-
var n;
|
|
339
|
-
this.$refs.queryFormRef.resetFields();
|
|
340
|
-
const e = { page: 1 };
|
|
341
|
-
this.noUrlParameters || await this.$router.push({
|
|
342
|
-
query: { ...e }
|
|
343
|
-
}), this.queryParams = {
|
|
344
|
-
...this.noUrlParameters ? {} : (n = this.$route) == null ? void 0 : n.query
|
|
345
|
-
}, this.afterReset(), this.handleQuery();
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
function he(e, n, t, l, a, u) {
|
|
350
|
-
const c = i("Input"), p = i("InputGraphicVerification"), m = i("InputMobileVerification"), V = i("Divider"), L = i("el-option"), G = i("el-select"), R = i("el-cascader"), A = i("el-date-picker"), Q = i("InputNumber"), w = i("el-form-item"), B = i("el-button"), T = i("el-form");
|
|
351
|
-
return N((o(), s(T, h({
|
|
352
|
-
model: e.queryParams,
|
|
353
|
-
ref: "queryFormRef",
|
|
354
|
-
inline: "",
|
|
355
|
-
"label-position": "left",
|
|
356
|
-
"label-width": e.labelWidth
|
|
357
|
-
}, e.$attrs), {
|
|
358
|
-
default: y(() => [
|
|
359
|
-
(o(!0), $(U, null, S(e.formItem, (r) => (o(), s(w, {
|
|
360
|
-
label: r.label,
|
|
361
|
-
prop: r.prop,
|
|
362
|
-
key: r.prop,
|
|
363
|
-
rules: r.rules
|
|
364
|
-
}, {
|
|
365
|
-
default: y(() => [
|
|
366
|
-
r.type === "input" ? (o(), s(c, {
|
|
367
|
-
key: 0,
|
|
368
|
-
item: r
|
|
369
|
-
}, null, 8, ["item"])) : f("", !0),
|
|
370
|
-
r.type === "input-graphic-verification" ? (o(), s(p, {
|
|
371
|
-
item: r,
|
|
372
|
-
key: r.key
|
|
373
|
-
}, null, 8, ["item"])) : f("", !0),
|
|
374
|
-
r.type === "input-mobile-verification" ? (o(), s(m, {
|
|
375
|
-
key: 2,
|
|
376
|
-
item: r
|
|
377
|
-
}, null, 8, ["item"])) : f("", !0),
|
|
378
|
-
r.type === "divider" ? (o(), s(V, {
|
|
379
|
-
key: 3,
|
|
380
|
-
item: r
|
|
381
|
-
}, null, 8, ["item"])) : r.type === "select" ? (o(), s(G, h({
|
|
382
|
-
key: 4,
|
|
383
|
-
filterable: "",
|
|
384
|
-
modelValue: e.queryParams[r.prop],
|
|
385
|
-
"onUpdate:modelValue": (d) => e.queryParams[r.prop] = d,
|
|
386
|
-
size: e.size
|
|
387
|
-
}, r.selectSetting || e.selectSetting), {
|
|
388
|
-
default: y(() => [
|
|
389
|
-
(o(!0), $(U, null, S(r.option || [], (d) => (o(), s(L, {
|
|
390
|
-
key: d.value,
|
|
391
|
-
label: d.desc,
|
|
392
|
-
value: d.value
|
|
393
|
-
}, null, 8, ["label", "value"]))), 128))
|
|
394
|
-
]),
|
|
395
|
-
_: 2
|
|
396
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "size"])) : r.type === "cascader" ? (o(), s(R, h({
|
|
397
|
-
key: 5,
|
|
398
|
-
filterable: "",
|
|
399
|
-
modelValue: e.queryParams[r.prop],
|
|
400
|
-
"onUpdate:modelValue": (d) => e.queryParams[r.prop] = d,
|
|
401
|
-
size: e.size,
|
|
402
|
-
options: r.options || []
|
|
403
|
-
}, r.selectSetting || e.selectSetting), null, 16, ["modelValue", "onUpdate:modelValue", "size", "options"])) : r.type === "date-picker" ? (o(), s(A, h({
|
|
404
|
-
key: 6,
|
|
405
|
-
modelValue: e.queryParams[r.prop],
|
|
406
|
-
"onUpdate:modelValue": (d) => e.queryParams[r.prop] = d,
|
|
407
|
-
size: e.size
|
|
408
|
-
}, r.datePackerSetting || e.datePackerSetting), null, 16, ["modelValue", "onUpdate:modelValue", "size"])) : f("", !0),
|
|
409
|
-
r.type === "input-number" ? (o(), s(Q, {
|
|
410
|
-
key: 7,
|
|
411
|
-
item: r
|
|
412
|
-
}, null, 8, ["item"])) : f("", !0)
|
|
413
|
-
]),
|
|
414
|
-
_: 2
|
|
415
|
-
}, 1032, ["label", "prop", "rules"]))), 128)),
|
|
416
|
-
x(e.$slots, "default"),
|
|
417
|
-
e.formOnly ? f("", !0) : (o(), s(w, { key: 0 }, {
|
|
418
|
-
default: y(() => [
|
|
419
|
-
q(B, {
|
|
420
|
-
type: "primary",
|
|
421
|
-
icon: "el-icon-search",
|
|
422
|
-
size: e.size,
|
|
423
|
-
onClick: e.handleQuery
|
|
424
|
-
}, {
|
|
425
|
-
default: y(() => [
|
|
426
|
-
I("查询")
|
|
427
|
-
]),
|
|
428
|
-
_: 1
|
|
429
|
-
}, 8, ["size", "onClick"]),
|
|
430
|
-
q(B, {
|
|
431
|
-
icon: "el-icon-refresh",
|
|
432
|
-
size: e.size,
|
|
433
|
-
onClick: e.resetQuery
|
|
434
|
-
}, {
|
|
435
|
-
default: y(() => [
|
|
436
|
-
I("重置")
|
|
437
|
-
]),
|
|
438
|
-
_: 1
|
|
439
|
-
}, 8, ["size", "onClick"])
|
|
440
|
-
]),
|
|
441
|
-
_: 1
|
|
442
|
-
}))
|
|
443
|
-
]),
|
|
444
|
-
_: 3
|
|
445
|
-
}, 16, ["model", "label-width"])), [
|
|
446
|
-
[ee, e.showSearch]
|
|
447
|
-
]);
|
|
448
|
-
}
|
|
449
|
-
const ve = /* @__PURE__ */ P(_e, [["render", he]]), ke = ve;
|
|
450
|
-
export {
|
|
451
|
-
ke as VGeneralBasicForm
|
|
452
|
-
};
|
package/dist/index.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,g){"use strict";const h={placeholder:"请输入",style:"width: 200px",clearable:!0},C=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:{...h,...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 V(t,n,o,a,l,s){const c=e.resolveComponent("el-input");return e.openBlock(),e.createBlock(c,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 y=u(C,[["render",V]]),b=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),a=e.inject("size"),l=e.ref({...h,...n.inputSetting});return(s,c)=>{const i=e.resolveComponent("el-input-number");return e.openBlock(),e.createBlock(i,e.mergeProps({modelValue:e.unref(o)[s.item.prop],"onUpdate:modelValue":c[0]||(c[0]=p=>e.unref(o)[s.item.prop]=p),size:e.unref(a)},l.value),null,16,["modelValue","size"])}}}),P={class:"input-graphic-verification"},S=["src"],z=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,{graphicSrc:o="",getGraphic:a=()=>{}}=n,l=e.ref(!1),s=async()=>{a&&!l.value&&(l.value=!0,await a(),l.value=!1)};return(c,i)=>{const p=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createElementBlock("div",P,[e.createVNode(y,{item:c.item,class:"input"},null,8,["item"]),e.createElementVNode("img",{class:"graphic",onClick:s,src:e.unref(o)},null,8,S)])),[[p,l.value]])}}}),M="",q=u(z,[["__scopeId","data-v-768ce181"]]),f="获取验证码",$=60,w=e.defineComponent({__name:"verification-button",props:{getSmscode:{type:Function}},setup(t){const{getSmscode:n}=t,o=e.ref(f),a=e.ref(null),l=e.computed(()=>o.value===f),s=()=>{a&&(clearInterval(a.value),a.value=null,o.value=f)},c=async()=>{if(o.value===f)if(o.value=$,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 _=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(_,{class:"verifiaction-button",style:e.normalizeStyle({color:l.value?"var(--color-primary, #409EFF)":"var(--text-color-placeholder, #A8ABB2)",cursor:l.value?"pointer":"default"}),onClick:c},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value?f:o.value+"s"),1)]),_:1},8,["style"])}}}),K="",I=u(w,[["__scopeId","data-v-4074e137"]]),N=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=n;return o.template={append:()=>e.h(I,{getSmscode:o.getSmscode})},(a,l)=>(e.openBlock(),e.createBlock(y,{item:e.unref(o),class:"input"},null,8,["item"]))}}),F=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,a,l,s){const c=e.resolveComponent("el-divider");return e.openBlock(),e.createBlock(c,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 D=u(F,[["render",U]]),L=e.defineComponent({name:"GeneralBasicForm",components:{Input:y,InputNumber:b,InputGraphicVerification:q,InputMobileVerification:N,Divider:D},props:{showSearch:{type:Boolean,default:!0},formOnly:{type:Boolean,default:!1},getList:{type:Function,default:()=>{}},afterReset:{type:Function,default:()=>{}},formItem:{type:Array,default:[]},size:{type:String,default:"medium"},labelWidth:{type:String,default:"90px"},noUrlParameters:{type:Boolean,default:()=>!1},formData:{type:Object,default:()=>{}}},data(){return{selectSetting:{placeholder:"请选择",clearable:!0,style:"width: 200px"},datePackerSetting:{style:"width: 227px","start-placeholder":"开始日期","end-placeholder":"结束日期",type:"daterange"}}},setup(t){const{size:n,noUrlParameters:o,getList:a}=t,l=g.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(t){this.queryParams={...this.noUrlParameters?{}:this.queryParams,...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 E(t,n,o,a,l,s){const c=e.resolveComponent("Input"),i=e.resolveComponent("InputGraphicVerification"),p=e.resolveComponent("InputMobileVerification"),_=e.resolveComponent("Divider"),G=e.resolveComponent("el-option"),j=e.resolveComponent("el-select"),R=e.resolveComponent("el-cascader"),A=e.resolveComponent("el-date-picker"),O=e.resolveComponent("InputNumber"),k=e.resolveComponent("el-form-item"),B=e.resolveComponent("el-button"),Q=e.resolveComponent("el-form");return e.withDirectives((e.openBlock(),e.createBlock(Q,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,r=>(e.openBlock(),e.createBlock(k,{label:r.label,prop:r.prop,key:r.prop,rules:r.rules},{default:e.withCtx(()=>[r.type==="input"?(e.openBlock(),e.createBlock(c,{key:0,item:r},null,8,["item"])):e.createCommentVNode("",!0),r.type==="input-graphic-verification"?(e.openBlock(),e.createBlock(i,{item:r,key:r.key},null,8,["item"])):e.createCommentVNode("",!0),r.type==="input-mobile-verification"?(e.openBlock(),e.createBlock(p,{key:2,item:r},null,8,["item"])):e.createCommentVNode("",!0),r.type==="divider"?(e.openBlock(),e.createBlock(_,{key:3,item:r},null,8,["item"])):r.type==="select"?(e.openBlock(),e.createBlock(j,e.mergeProps({key:4,filterable:"",modelValue:t.queryParams[r.prop],"onUpdate:modelValue":m=>t.queryParams[r.prop]=m,size:t.size},r.selectSetting||t.selectSetting),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.option||[],m=>(e.openBlock(),e.createBlock(G,{key:m.value,label:m.desc,value:m.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","size"])):r.type==="cascader"?(e.openBlock(),e.createBlock(R,e.mergeProps({key:5,filterable:"",modelValue:t.queryParams[r.prop],"onUpdate:modelValue":m=>t.queryParams[r.prop]=m,size:t.size,options:r.options||[]},r.selectSetting||t.selectSetting),null,16,["modelValue","onUpdate:modelValue","size","options"])):r.type==="date-picker"?(e.openBlock(),e.createBlock(A,e.mergeProps({key:6,modelValue:t.queryParams[r.prop],"onUpdate:modelValue":m=>t.queryParams[r.prop]=m,size:t.size},r.datePackerSetting||t.datePackerSetting),null,16,["modelValue","onUpdate:modelValue","size"])):e.createCommentVNode("",!0),r.type==="input-number"?(e.openBlock(),e.createBlock(O,{key:7,item:r},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(k,{key:0},{default:e.withCtx(()=>[e.createVNode(B,{type:"primary",icon:"el-icon-search",size:t.size,onClick:t.handleQuery},{default:e.withCtx(()=>[e.createTextVNode("查询")]),_:1},8,["size","onClick"]),e.createVNode(B,{icon:"el-icon-refresh",size:t.size,onClick:t.resetQuery},{default:e.withCtx(()=>[e.createTextVNode("重置")]),_:1},8,["size","onClick"])]),_:1}))]),_:3},16,["model","label-width"])),[[e.vShow,t.showSearch]])}const T=u(L,[["render",E]]);d.VGeneralBasicForm=T,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|