general-basic-form 1.0.28 → 1.0.29
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/dist/index.js +127 -189
- package/dist/index.umd.cjs +1 -1
- package/dist/style.css +0 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
function f(r, e, a, t, n, o, u, d) {
|
|
2
|
+
var s = typeof r == "function" ? r.options : r;
|
|
3
|
+
e && (s.render = e, s.staticRenderFns = a, s._compiled = !0), t && (s.functional = !0), o && (s._scopeId = "data-v-" + o);
|
|
4
|
+
var l;
|
|
5
|
+
if (u ? (l = function(i) {
|
|
6
|
+
i = i || // cached call
|
|
7
|
+
this.$vnode && this.$vnode.ssrContext || // stateful
|
|
8
|
+
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !i && typeof __VUE_SSR_CONTEXT__ < "u" && (i = __VUE_SSR_CONTEXT__), n && n.call(this, i), i && i._registeredComponents && i._registeredComponents.add(u);
|
|
9
|
+
}, s._ssrRegister = l) : n && (l = d ? function() {
|
|
10
|
+
n.call(
|
|
11
|
+
this,
|
|
12
|
+
(s.functional ? this.parent : this).$root.$options.shadowRoot
|
|
13
|
+
);
|
|
14
|
+
} : n), l)
|
|
15
|
+
if (s.functional) {
|
|
16
|
+
s._injectStyles = l;
|
|
17
|
+
var h = s.render;
|
|
18
|
+
s.render = function(m, c) {
|
|
19
|
+
return l.call(c), h(m, c);
|
|
20
|
+
};
|
|
21
|
+
} else {
|
|
22
|
+
var p = s.beforeCreate;
|
|
23
|
+
s.beforeCreate = p ? [].concat(p, l) : [l];
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
exports: r,
|
|
27
|
+
options: s
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const y = {
|
|
8
31
|
props: {
|
|
9
32
|
verificationSetting: {
|
|
10
33
|
type: Object,
|
|
@@ -52,23 +75,28 @@ const v = (e, n) => {
|
|
|
52
75
|
}
|
|
53
76
|
}
|
|
54
77
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return a(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
78
|
+
var _ = function() {
|
|
79
|
+
var e = this, a = e._self._c;
|
|
80
|
+
return a("el-button", { on: { click: e.buttonClick } }, [e._v(e._s(e.buttonType ? e.defaultText : e.buttonText + "s"))]);
|
|
81
|
+
}, g = [], b = /* @__PURE__ */ f(
|
|
82
|
+
y,
|
|
83
|
+
_,
|
|
84
|
+
g,
|
|
85
|
+
!1,
|
|
86
|
+
null,
|
|
87
|
+
null,
|
|
88
|
+
null,
|
|
89
|
+
null
|
|
90
|
+
);
|
|
91
|
+
const v = b.exports;
|
|
92
|
+
const S = {
|
|
65
93
|
name: "GeneralBasicForm",
|
|
66
94
|
components: {
|
|
67
|
-
InputArchive: (
|
|
68
|
-
const { templateEle:
|
|
69
|
-
return
|
|
95
|
+
InputArchive: (r) => {
|
|
96
|
+
const { templateEle: e } = r;
|
|
97
|
+
return e();
|
|
70
98
|
},
|
|
71
|
-
VerificationButton:
|
|
99
|
+
VerificationButton: v
|
|
72
100
|
},
|
|
73
101
|
props: {
|
|
74
102
|
showSearch: {
|
|
@@ -131,10 +159,10 @@ const G = /* @__PURE__ */ v(K, [["render", Q]]), j = {
|
|
|
131
159
|
}
|
|
132
160
|
},
|
|
133
161
|
data() {
|
|
134
|
-
var
|
|
162
|
+
var r;
|
|
135
163
|
return {
|
|
136
164
|
queryParams: {
|
|
137
|
-
...this.noUrlParameters ? {} : (
|
|
165
|
+
...this.noUrlParameters ? {} : (r = this.$route) == null ? void 0 : r.query
|
|
138
166
|
},
|
|
139
167
|
// form表单数据
|
|
140
168
|
formLoading: this.loading || !1,
|
|
@@ -173,10 +201,10 @@ const G = /* @__PURE__ */ v(K, [["render", Q]]), j = {
|
|
|
173
201
|
// },
|
|
174
202
|
watch: {
|
|
175
203
|
formData: {
|
|
176
|
-
handler(
|
|
177
|
-
JSON.stringify(
|
|
204
|
+
handler(r, e) {
|
|
205
|
+
JSON.stringify(r) !== JSON.stringify(e) && (this.queryParams = {
|
|
178
206
|
...this.noUrlParameters ? {} : this.queryParams,
|
|
179
|
-
...
|
|
207
|
+
...r
|
|
180
208
|
});
|
|
181
209
|
},
|
|
182
210
|
// watch 默认是懒执行的:仅当数据源变化时,才会执行回调。但在某些场景中,我们希望在创建侦听器时,立即执行一遍回调。举例来说,我们想请求一些初始数据,然后在相关状态更改时重新请求数据。
|
|
@@ -185,210 +213,120 @@ const G = /* @__PURE__ */ v(K, [["render", Q]]), j = {
|
|
|
185
213
|
// deep: true,
|
|
186
214
|
},
|
|
187
215
|
queryParams: {
|
|
188
|
-
handler(
|
|
189
|
-
this.$emit("update:formData",
|
|
216
|
+
handler(r) {
|
|
217
|
+
this.$emit("update:formData", r);
|
|
190
218
|
},
|
|
191
219
|
deep: !0
|
|
192
220
|
},
|
|
193
|
-
loading(
|
|
194
|
-
this.formLoading !==
|
|
221
|
+
loading(r) {
|
|
222
|
+
this.formLoading !== r && (this.formLoading = r);
|
|
195
223
|
},
|
|
196
|
-
formLoading(
|
|
197
|
-
this.loading !==
|
|
224
|
+
formLoading(r) {
|
|
225
|
+
this.loading !== r && this.$emit("update:loading", r);
|
|
198
226
|
}
|
|
199
227
|
},
|
|
200
228
|
methods: {
|
|
201
229
|
/** 搜索按钮操作 */
|
|
202
230
|
handleQuery() {
|
|
203
|
-
var
|
|
204
|
-
const
|
|
205
|
-
...(
|
|
231
|
+
var a;
|
|
232
|
+
const r = { page: 1, limit: 10 }, e = {
|
|
233
|
+
...(a = this.$route) == null ? void 0 : a.query,
|
|
206
234
|
...this.queryParams,
|
|
207
|
-
...
|
|
235
|
+
...r
|
|
208
236
|
};
|
|
209
237
|
this.noUrlParameters || this.$router.push({
|
|
210
|
-
query: { ...
|
|
238
|
+
query: { ...e }
|
|
211
239
|
}), this.getList({
|
|
212
|
-
...
|
|
240
|
+
...e
|
|
213
241
|
});
|
|
214
242
|
},
|
|
215
243
|
/** 重置按钮操作 */
|
|
216
244
|
async resetQuery() {
|
|
217
|
-
var
|
|
245
|
+
var e;
|
|
218
246
|
this.$refs.queryFormRef.resetFields();
|
|
219
|
-
const
|
|
247
|
+
const r = { page: 1 };
|
|
220
248
|
this.noUrlParameters || await this.$router.push({
|
|
221
|
-
query: { ...
|
|
249
|
+
query: { ...r }
|
|
222
250
|
}), this.queryParams = {
|
|
223
|
-
...this.noUrlParameters ? {} : (
|
|
251
|
+
...this.noUrlParameters ? {} : (e = this.$route) == null ? void 0 : e.query
|
|
224
252
|
}, this.afterReset(), this.handleQuery();
|
|
225
253
|
},
|
|
226
254
|
currentInputComponent() {
|
|
227
255
|
return "input-archive";
|
|
228
256
|
},
|
|
229
|
-
getItemRules(
|
|
230
|
-
const { type:
|
|
231
|
-
return this.noInputBlank &&
|
|
257
|
+
getItemRules(r) {
|
|
258
|
+
const { type: e, rules: a = [] } = r, t = [...a];
|
|
259
|
+
return this.noInputBlank && e === "input" && t.push({
|
|
232
260
|
pattern: this.trimRegex,
|
|
233
261
|
message: "请输入(不能仅输入空格)",
|
|
234
262
|
trigger: "blur"
|
|
235
|
-
}),
|
|
263
|
+
}), t;
|
|
236
264
|
},
|
|
237
|
-
getInputSetting(
|
|
238
|
-
const { inputSetting:
|
|
265
|
+
getInputSetting(r) {
|
|
266
|
+
const { inputSetting: e } = r;
|
|
239
267
|
return {
|
|
240
268
|
...this.inputSetting,
|
|
241
|
-
...
|
|
269
|
+
...e
|
|
242
270
|
};
|
|
243
271
|
},
|
|
244
|
-
getSelectSetting(
|
|
245
|
-
const { selectSetting:
|
|
272
|
+
getSelectSetting(r) {
|
|
273
|
+
const { selectSetting: e } = r;
|
|
246
274
|
return {
|
|
247
275
|
...this.selectSetting,
|
|
248
|
-
...
|
|
276
|
+
...e
|
|
249
277
|
};
|
|
250
278
|
},
|
|
251
|
-
getDatePackerSetting(
|
|
252
|
-
const { datePackerSetting:
|
|
279
|
+
getDatePackerSetting(r) {
|
|
280
|
+
const { datePackerSetting: e } = r;
|
|
253
281
|
return {
|
|
254
282
|
...this.datePackerSetting,
|
|
255
|
-
...
|
|
283
|
+
...e
|
|
256
284
|
};
|
|
257
285
|
}
|
|
258
286
|
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
return
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
(
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
z(T, {
|
|
303
|
-
verificationSetting: t.verificationSetting,
|
|
304
|
-
getSmscode: t.getSmscode
|
|
305
|
-
}, null, 8, ["verificationSetting", "getSmscode"])
|
|
306
|
-
])
|
|
307
|
-
]),
|
|
308
|
-
_: 2
|
|
309
|
-
}, [
|
|
310
|
-
y(t.template, (l, m) => ({
|
|
311
|
-
name: m,
|
|
312
|
-
fn: c(() => [
|
|
313
|
-
l ? (a(), s(x(i.currentInputComponent()), {
|
|
314
|
-
key: m,
|
|
315
|
-
templateEle: l
|
|
316
|
-
}, null, 8, ["templateEle"])) : f("", !0)
|
|
317
|
-
])
|
|
318
|
-
}))
|
|
319
|
-
]), 1040, ["onKeydown", "modelValue", "onUpdate:modelValue", "size"])) : t.type === "select" ? (a(), s(U, p({
|
|
320
|
-
key: 2,
|
|
321
|
-
filterable: "",
|
|
322
|
-
modelValue: o.queryParams[t.prop],
|
|
323
|
-
"onUpdate:modelValue": (l) => o.queryParams[t.prop] = l,
|
|
324
|
-
size: r.size
|
|
325
|
-
}, i.getSelectSetting(t)), {
|
|
326
|
-
default: c(() => [
|
|
327
|
-
(a(!0), k(P, null, y(t.option || [], (l) => (a(), s(w, {
|
|
328
|
-
key: l.value,
|
|
329
|
-
label: l.desc,
|
|
330
|
-
value: l.value
|
|
331
|
-
}, null, 8, ["label", "value"]))), 128))
|
|
332
|
-
]),
|
|
333
|
-
_: 2
|
|
334
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "size"])) : t.type === "cascader" ? (a(), s(I, p({
|
|
335
|
-
key: 3,
|
|
336
|
-
filterable: "",
|
|
337
|
-
modelValue: o.queryParams[t.prop],
|
|
338
|
-
"onUpdate:modelValue": (l) => o.queryParams[t.prop] = l,
|
|
339
|
-
size: r.size,
|
|
340
|
-
options: t.options || []
|
|
341
|
-
}, i.getSelectSetting(t)), null, 16, ["modelValue", "onUpdate:modelValue", "size", "options"])) : t.type === "date-picker" ? (a(), s(C, p({
|
|
342
|
-
key: 4,
|
|
343
|
-
modelValue: o.queryParams[t.prop],
|
|
344
|
-
"onUpdate:modelValue": (l) => o.queryParams[t.prop] = l,
|
|
345
|
-
size: r.size
|
|
346
|
-
}, i.getDatePackerSetting(t)), null, 16, ["modelValue", "onUpdate:modelValue", "size"])) : f("", !0),
|
|
347
|
-
t.type === "input-number" ? (a(), s(B, p({
|
|
348
|
-
key: 5,
|
|
349
|
-
modelValue: o.queryParams[t.prop],
|
|
350
|
-
"onUpdate:modelValue": (l) => o.queryParams[t.prop] = l,
|
|
351
|
-
size: r.size
|
|
352
|
-
}, i.getInputSetting(t)), null, 16, ["modelValue", "onUpdate:modelValue", "size"])) : f("", !0)
|
|
353
|
-
]),
|
|
354
|
-
_: 2
|
|
355
|
-
}, 1032, ["label", "prop", "rules"]))), 128)),
|
|
356
|
-
O(e.$slots, "default"),
|
|
357
|
-
r.formOnly ? f("", !0) : (a(), s(_, { key: 0 }, {
|
|
358
|
-
default: c(() => [
|
|
359
|
-
S((a(), s(b, {
|
|
360
|
-
type: "primary",
|
|
361
|
-
icon: "el-icon-search",
|
|
362
|
-
size: r.size,
|
|
363
|
-
onClick: i.handleQuery
|
|
364
|
-
}, {
|
|
365
|
-
default: c(() => [
|
|
366
|
-
g("查询")
|
|
367
|
-
]),
|
|
368
|
-
_: 1
|
|
369
|
-
}, 8, ["size", "onClick"])), [
|
|
370
|
-
[L, o.formLoading]
|
|
371
|
-
]),
|
|
372
|
-
z(b, {
|
|
373
|
-
icon: "el-icon-refresh",
|
|
374
|
-
size: r.size,
|
|
375
|
-
onClick: i.resetQuery
|
|
376
|
-
}, {
|
|
377
|
-
default: c(() => [
|
|
378
|
-
g("重置")
|
|
379
|
-
]),
|
|
380
|
-
_: 1
|
|
381
|
-
}, 8, ["size", "onClick"])
|
|
382
|
-
]),
|
|
383
|
-
_: 1
|
|
384
|
-
}))
|
|
385
|
-
]),
|
|
386
|
-
_: 3
|
|
387
|
-
}, 16, ["model", "label-width"])), [
|
|
388
|
-
[E, r.showSearch]
|
|
389
|
-
]);
|
|
390
|
-
}
|
|
391
|
-
const W = /* @__PURE__ */ v(j, [["render", J]]), M = W;
|
|
287
|
+
};
|
|
288
|
+
var k = function() {
|
|
289
|
+
var e = this, a = e._self._c;
|
|
290
|
+
return a("el-form", e._b({ directives: [{ name: "show", rawName: "v-show", value: e.showSearch, expression: "showSearch" }], ref: "queryFormRef", attrs: { model: e.queryParams, inline: "", "label-position": "left", "label-width": e.labelWidth } }, "el-form", e.$attrs, !1), [e._l(e.formItem, function(t) {
|
|
291
|
+
return a("el-form-item", { key: t.prop, attrs: { label: t.label, prop: t.prop, rules: e.getItemRules(t) } }, [t.type === "input" ? a("el-input", e._b({ attrs: { size: e.size }, on: { keydown: function(n) {
|
|
292
|
+
return !n.type.indexOf("key") && e._k(n.keyCode, "enter", 13, n.key, "Enter") ? null : e.getList.apply(null, arguments);
|
|
293
|
+
} }, scopedSlots: e._u([e._l(t.template, function(n, o) {
|
|
294
|
+
return { key: o, fn: function() {
|
|
295
|
+
return [n ? a(e.currentInputComponent(), { key: o, tag: "component", attrs: { templateEle: n } }) : e._e()];
|
|
296
|
+
}, proxy: !0 };
|
|
297
|
+
})], null, !0), model: { value: e.queryParams[t.prop], callback: function(n) {
|
|
298
|
+
e.$set(e.queryParams, t.prop, n);
|
|
299
|
+
}, expression: "queryParams[item.prop]" } }, "el-input", e.getInputSetting(t), !1)) : t.type === "input-mobile-verification" ? a("el-input", e._b({ attrs: { size: e.size }, on: { keydown: function(n) {
|
|
300
|
+
return !n.type.indexOf("key") && e._k(n.keyCode, "enter", 13, n.key, "Enter") ? null : e.getList.apply(null, arguments);
|
|
301
|
+
} }, scopedSlots: e._u([e._l(t.template, function(n, o) {
|
|
302
|
+
return { key: o, fn: function() {
|
|
303
|
+
return [n ? a(e.currentInputComponent(), { key: o, tag: "component", attrs: { templateEle: n } }) : e._e()];
|
|
304
|
+
}, proxy: !0 };
|
|
305
|
+
})], null, !0), model: { value: e.queryParams[t.prop], callback: function(n) {
|
|
306
|
+
e.$set(e.queryParams, t.prop, n);
|
|
307
|
+
}, expression: "queryParams[item.prop]" } }, "el-input", e.getInputSetting(t), !1), [a("template", { slot: "append" }, [a("verification-button", { attrs: { verificationSetting: t.verificationSetting, getSmscode: t.getSmscode } })], 1)], 2) : t.type === "select" ? a("el-select", e._b({ attrs: { filterable: "", size: e.size }, model: { value: e.queryParams[t.prop], callback: function(n) {
|
|
308
|
+
e.$set(e.queryParams, t.prop, n);
|
|
309
|
+
}, expression: "queryParams[item.prop]" } }, "el-select", e.getSelectSetting(t), !1), e._l(t.option || [], function(n) {
|
|
310
|
+
return a("el-option", { key: n.value, attrs: { label: n.desc, value: n.value } });
|
|
311
|
+
}), 1) : t.type === "cascader" ? a("el-cascader", e._b({ attrs: { filterable: "", size: e.size, options: t.options || [] }, model: { value: e.queryParams[t.prop], callback: function(n) {
|
|
312
|
+
e.$set(e.queryParams, t.prop, n);
|
|
313
|
+
}, expression: "queryParams[item.prop]" } }, "el-cascader", e.getSelectSetting(t), !1)) : t.type === "date-picker" ? a("el-date-picker", e._b({ attrs: { size: e.size }, model: { value: e.queryParams[t.prop], callback: function(n) {
|
|
314
|
+
e.$set(e.queryParams, t.prop, n);
|
|
315
|
+
}, expression: "queryParams[item.prop]" } }, "el-date-picker", e.getDatePackerSetting(t), !1)) : e._e(), t.type === "input-number" ? a("el-input-number", e._b({ attrs: { size: e.size }, model: { value: e.queryParams[t.prop], callback: function(n) {
|
|
316
|
+
e.$set(e.queryParams, t.prop, n);
|
|
317
|
+
}, expression: "queryParams[item.prop]" } }, "el-input-number", e.getInputSetting(t), !1)) : e._e()], 1);
|
|
318
|
+
}), e._t("default"), e.formOnly ? e._e() : a("el-form-item", [a("el-button", { directives: [{ name: "loading", rawName: "v-loading", value: e.formLoading, expression: "formLoading" }], attrs: { type: "primary", icon: "el-icon-search", size: e.size }, on: { click: e.handleQuery } }, [e._v("查询")]), a("el-button", { attrs: { icon: "el-icon-refresh", size: e.size }, on: { click: e.resetQuery } }, [e._v("重置")])], 1)], 2);
|
|
319
|
+
}, P = [], q = /* @__PURE__ */ f(
|
|
320
|
+
S,
|
|
321
|
+
k,
|
|
322
|
+
P,
|
|
323
|
+
!1,
|
|
324
|
+
null,
|
|
325
|
+
"a9566079",
|
|
326
|
+
null,
|
|
327
|
+
null
|
|
328
|
+
);
|
|
329
|
+
const x = q.exports, T = x;
|
|
392
330
|
export {
|
|
393
|
-
|
|
331
|
+
T as VGeneralBasicForm
|
|
394
332
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(u,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(u=typeof globalThis<"u"?globalThis:u||self,p(u.Index={}))})(this,function(u){"use strict";const p="";function c(r,e,a,t,n,o,f,x){var s=typeof r=="function"?r.options:r;e&&(s.render=e,s.staticRenderFns=a,s._compiled=!0),t&&(s.functional=!0),o&&(s._scopeId="data-v-"+o);var l;if(f?(l=function(i){i=i||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!i&&typeof __VUE_SSR_CONTEXT__<"u"&&(i=__VUE_SSR_CONTEXT__),n&&n.call(this,i),i&&i._registeredComponents&&i._registeredComponents.add(f)},s._ssrRegister=l):n&&(l=x?function(){n.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:n),l)if(s.functional){s._injectStyles=l;var T=s.render;s.render=function($,h){return l.call(h),T($,h)}}else{var d=s.beforeCreate;s.beforeCreate=d?[].concat(d,l):[l]}return{exports:r,options:s}}const m={props:{verificationSetting:{type:Object,default:()=>{}},getSmscode:{type:Function,default:()=>{}}},data(){return{defaultText:this.verificationSetting.defaultText||"获取验证码",buttonText:this.verificationSetting.defaultText||"获取验证码",restTime:this.verificationSetting.restTime||60,timer:null}},computed:{buttonType(){return this.buttonText===this.defaultText}},destroyed(){this.reset()},methods:{reset(){this.timer&&(clearInterval(this.timer),this.timer=null,this.buttonText=this.defaultText)},async buttonClick(){if(this.buttonText===this.defaultText)if(this.buttonText=this.restTime,this.timer=setInterval(()=>{if(Number(this.buttonText)<=0||!this.buttonText){this.reset();return}else this.buttonText=Number(this.buttonText)-1},1e3),this.getSmscode)await this.getSmscode()===!1&&this.reset();else return}}};var y=function(){var e=this,a=e._self._c;return a("el-button",{on:{click:e.buttonClick}},[e._v(e._s(e.buttonType?e.defaultText:e.buttonText+"s"))])},_=[],g=c(m,y,_,!1,null,null,null,null);const b=g.exports,w="",v={name:"GeneralBasicForm",components:{InputArchive:r=>{const{templateEle:e}=r;return e()},VerificationButton:b},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:()=>{}},noInputBlank:{type:Boolean,default:()=>!1}},data(){var r;return{queryParams:{...this.noUrlParameters?{}:(r=this.$route)==null?void 0:r.query},formLoading:this.loading||!1,selectSetting:{placeholder:"请选择",filterable:!0,clearable:!0,style:"width: 200px"},inputSetting:{placeholder:"请输入",style:"width: 200px",clearable:!0},datePackerSetting:{style:"width: 227px","start-placeholder":"开始日期","end-placeholder":"结束日期",type:"daterange"}}},watch:{formData:{handler(r,e){JSON.stringify(r)!==JSON.stringify(e)&&(this.queryParams={...this.noUrlParameters?{}:this.queryParams,...r})},immediate:!0},queryParams:{handler(r){this.$emit("update:formData",r)},deep:!0},loading(r){this.formLoading!==r&&(this.formLoading=r)},formLoading(r){this.loading!==r&&this.$emit("update:loading",r)}},methods:{handleQuery(){var a;const r={page:1,limit:10},e={...(a=this.$route)==null?void 0:a.query,...this.queryParams,...r};this.noUrlParameters||this.$router.push({query:{...e}}),this.getList({...e})},async resetQuery(){var e;this.$refs.queryFormRef.resetFields();const r={page:1};this.noUrlParameters||await this.$router.push({query:{...r}}),this.queryParams={...this.noUrlParameters?{}:(e=this.$route)==null?void 0:e.query},this.afterReset(),this.handleQuery()},currentInputComponent(){return"input-archive"},getItemRules(r){const{type:e,rules:a=[]}=r,t=[...a];return this.noInputBlank&&e==="input"&&t.push({pattern:this.trimRegex,message:"请输入(不能仅输入空格)",trigger:"blur"}),t},getInputSetting(r){const{inputSetting:e}=r;return{...this.inputSetting,...e}},getSelectSetting(r){const{selectSetting:e}=r;return{...this.selectSetting,...e}},getDatePackerSetting(r){const{datePackerSetting:e}=r;return{...this.datePackerSetting,...e}}}};var S=function(){var e=this,a=e._self._c;return a("el-form",e._b({directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],ref:"queryFormRef",attrs:{model:e.queryParams,inline:"","label-position":"left","label-width":e.labelWidth}},"el-form",e.$attrs,!1),[e._l(e.formItem,function(t){return a("el-form-item",{key:t.prop,attrs:{label:t.label,prop:t.prop,rules:e.getItemRules(t)}},[t.type==="input"?a("el-input",e._b({attrs:{size:e.size},on:{keydown:function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")?null:e.getList.apply(null,arguments)}},scopedSlots:e._u([e._l(t.template,function(n,o){return{key:o,fn:function(){return[n?a(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:n}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(t),!1)):t.type==="input-mobile-verification"?a("el-input",e._b({attrs:{size:e.size},on:{keydown:function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")?null:e.getList.apply(null,arguments)}},scopedSlots:e._u([e._l(t.template,function(n,o){return{key:o,fn:function(){return[n?a(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:n}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(t),!1),[a("template",{slot:"append"},[a("verification-button",{attrs:{verificationSetting:t.verificationSetting,getSmscode:t.getSmscode}})],1)],2):t.type==="select"?a("el-select",e._b({attrs:{filterable:"",size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-select",e.getSelectSetting(t),!1),e._l(t.option||[],function(n){return a("el-option",{key:n.value,attrs:{label:n.desc,value:n.value}})}),1):t.type==="cascader"?a("el-cascader",e._b({attrs:{filterable:"",size:e.size,options:t.options||[]},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-cascader",e.getSelectSetting(t),!1)):t.type==="date-picker"?a("el-date-picker",e._b({attrs:{size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-date-picker",e.getDatePackerSetting(t),!1)):e._e(),t.type==="input-number"?a("el-input-number",e._b({attrs:{size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input-number",e.getInputSetting(t),!1)):e._e()],1)}),e._t("default"),e.formOnly?e._e():a("el-form-item",[a("el-button",{directives:[{name:"loading",rawName:"v-loading",value:e.formLoading,expression:"formLoading"}],attrs:{type:"primary",icon:"el-icon-search",size:e.size},on:{click:e.handleQuery}},[e._v("查询")]),a("el-button",{attrs:{icon:"el-icon-refresh",size:e.size},on:{click:e.resetQuery}},[e._v("重置")])],1)],2)},k=[],P=c(v,S,k,!1,null,"a9566079",null,null);const q=P.exports;u.VGeneralBasicForm=q,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "general-basic-form",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.umd.cjs",
|
|
6
6
|
"type": "module",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"@playwright/test": "^1.36.1",
|
|
36
36
|
"@types/node": "^20.8.10",
|
|
37
37
|
"@vitejs/plugin-legacy": "^4.1.1",
|
|
38
|
-
"@vitejs/plugin-
|
|
39
|
-
"@vitejs/plugin-
|
|
38
|
+
"@vitejs/plugin-vue2": "^2.3.1",
|
|
39
|
+
"@vitejs/plugin-vue2-jsx": "^1.1.1",
|
|
40
|
+
"chalk": "^2.4.2",
|
|
40
41
|
"cross-env": "^7.0.3",
|
|
41
42
|
"less": "^4.2.0",
|
|
42
|
-
"chalk": "^2.4.2",
|
|
43
43
|
"npm-run-all": "^4.1.5",
|
|
44
44
|
"rimraf": "^5.0.5",
|
|
45
45
|
"tsx": "^4.0.0",
|