general-basic-form 2.0.10 → 2.0.11
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.assets/image-20210820173738506.png +0 -0
- package/README.md +5 -1
- package/package.json +3 -14
- package/script/link.ts +36 -0
- package/script/unlink.ts +45 -0
- package/src/GeneralBasicForm.vue +246 -0
- package/src/assets/image-20210820173037871.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/components/VBasic/cascader/index.vue +31 -0
- package/src/components/VBasic/date-picker/index.vue +30 -0
- package/src/components/VBasic/divider/index.vue +52 -0
- package/src/components/VBasic/input/index.vue +67 -0
- package/src/components/VBasic/input-graphic-verification/index.vue +56 -0
- package/src/components/VBasic/input-mobile-verification/index.vue +31 -0
- package/src/components/VBasic/input-mobile-verification/verification-button.vue +64 -0
- package/src/components/VBasic/input-number/index.vue +30 -0
- package/src/components/VBasic/radio/index.vue +40 -0
- package/src/components/VBasic/select/index.vue +37 -0
- package/src/components/setting.ts +28 -0
- package/src/index.ts +15 -0
- package/src/injectKey.ts +2 -0
- package/src/types/basicFrom.ts +53 -0
- package/src/types/componentsProps.ts +17 -0
- package/tsconfig.json +14 -0
- package/vite.config.js +123 -0
- package/dist/index.js +0 -524
- package/dist/index.umd.cjs +0 -1
- package/dist/style.css +0 -1
- /package/{dist → public}/index.d.ts +0 -0
package/dist/index.js
DELETED
|
@@ -1,524 +0,0 @@
|
|
|
1
|
-
import { defineComponent as v, inject as g, resolveComponent as s, openBlock as r, createBlock as a, mergeProps as h, withKeys as X, createSlots as D, renderList as P, withCtx as f, resolveDynamicComponent as G, createCommentVNode as m, ref as z, unref as _, resolveDirective as N, withDirectives as L, createElementBlock as $, createVNode as R, createElementVNode as Y, computed as E, onBeforeUnmount as Z, normalizeStyle as x, createTextVNode as q, toDisplayString as A, h as ee, normalizeProps as te, guardReactiveProps as ne, Fragment as C, provide as I, renderSlot as F, vShow as oe } from "vue";
|
|
2
|
-
import { useRoute as re } from "vue-router";
|
|
3
|
-
const Q = {
|
|
4
|
-
placeholder: "请输入",
|
|
5
|
-
style: "width: 200px",
|
|
6
|
-
clearable: !0
|
|
7
|
-
}, ae = v({
|
|
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
|
-
...Q,
|
|
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
|
-
}), V = (e, n) => {
|
|
48
|
-
const t = e.__vccOpts || e;
|
|
49
|
-
for (const [i, l] of n)
|
|
50
|
-
t[i] = l;
|
|
51
|
-
return t;
|
|
52
|
-
};
|
|
53
|
-
function ie(e, n, t, i, l, c) {
|
|
54
|
-
const p = s("el-input");
|
|
55
|
-
return r(), a(p, h({
|
|
56
|
-
onKeydown: X(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), D({ _: 2 }, [
|
|
61
|
-
P(e.item.template, (u, d) => ({
|
|
62
|
-
name: d,
|
|
63
|
-
fn: f(() => [
|
|
64
|
-
u ? (r(), a(G(e.currentInputComponent()), {
|
|
65
|
-
key: d,
|
|
66
|
-
templateEle: u
|
|
67
|
-
}, null, 8, ["templateEle"])) : m("", !0)
|
|
68
|
-
])
|
|
69
|
-
}))
|
|
70
|
-
]), 1040, ["onKeydown", "modelValue", "size"]);
|
|
71
|
-
}
|
|
72
|
-
const w = /* @__PURE__ */ V(ae, [["render", ie]]), le = /* @__PURE__ */ v({
|
|
73
|
-
__name: "index",
|
|
74
|
-
props: {
|
|
75
|
-
item: {}
|
|
76
|
-
},
|
|
77
|
-
setup(e) {
|
|
78
|
-
const { item: n } = e, t = g("queryParams", {}), i = g("size"), l = z({
|
|
79
|
-
...Q,
|
|
80
|
-
...n.inputSetting
|
|
81
|
-
});
|
|
82
|
-
return (c, p) => {
|
|
83
|
-
const u = s("el-input-number");
|
|
84
|
-
return r(), a(u, h({
|
|
85
|
-
modelValue: _(t)[c.item.prop],
|
|
86
|
-
"onUpdate:modelValue": p[0] || (p[0] = (d) => _(t)[c.item.prop] = d),
|
|
87
|
-
size: _(i)
|
|
88
|
-
}, l.value), null, 16, ["modelValue", "size"]);
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
}), T = Symbol(), se = { class: "input-graphic-verification" }, ue = ["src"], pe = /* @__PURE__ */ v({
|
|
92
|
-
__name: "index",
|
|
93
|
-
props: {
|
|
94
|
-
item: {}
|
|
95
|
-
},
|
|
96
|
-
setup(e) {
|
|
97
|
-
const { item: n } = e, { graphicSrc: t = "", getGraphic: i = () => {
|
|
98
|
-
} } = n, { formLoading: l, updateFormLoading: c } = g(T), p = async () => {
|
|
99
|
-
i && !l.value && await i();
|
|
100
|
-
};
|
|
101
|
-
return (u, d) => {
|
|
102
|
-
const b = N("loading");
|
|
103
|
-
return L((r(), $("div", se, [
|
|
104
|
-
R(w, {
|
|
105
|
-
item: u.item,
|
|
106
|
-
class: "input"
|
|
107
|
-
}, null, 8, ["item"]),
|
|
108
|
-
Y("img", {
|
|
109
|
-
class: "graphic",
|
|
110
|
-
onClick: p,
|
|
111
|
-
src: _(t)
|
|
112
|
-
}, null, 8, ue)
|
|
113
|
-
])), [
|
|
114
|
-
[b, _(l)]
|
|
115
|
-
]);
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
const ce = /* @__PURE__ */ V(pe, [["__scopeId", "data-v-500ec9b0"]]), k = "获取验证码", de = 60, me = /* @__PURE__ */ v({
|
|
120
|
-
__name: "verification-button",
|
|
121
|
-
props: {
|
|
122
|
-
getSmscode: { type: Function }
|
|
123
|
-
},
|
|
124
|
-
setup(e) {
|
|
125
|
-
const { getSmscode: n } = e, t = z(k), i = z(null), l = E(() => t.value === k), c = () => {
|
|
126
|
-
i && (clearInterval(i.value), i.value = null, t.value = k);
|
|
127
|
-
}, p = async () => {
|
|
128
|
-
if (t.value === k)
|
|
129
|
-
if (t.value = de, i.value = setInterval(() => {
|
|
130
|
-
if (Number(t.value) <= 0 || !t.value) {
|
|
131
|
-
c();
|
|
132
|
-
return;
|
|
133
|
-
} else
|
|
134
|
-
t.value = Number(t.value) - 1;
|
|
135
|
-
}, 1e3), n)
|
|
136
|
-
await n() === !1 && c();
|
|
137
|
-
else
|
|
138
|
-
return;
|
|
139
|
-
};
|
|
140
|
-
return Z(() => {
|
|
141
|
-
c();
|
|
142
|
-
}), (u, d) => {
|
|
143
|
-
const b = s("el-button");
|
|
144
|
-
return r(), a(b, {
|
|
145
|
-
class: "verifiaction-button",
|
|
146
|
-
style: x({
|
|
147
|
-
color: l.value ? "var(--color-primary, #409EFF)" : "var(--text-color-placeholder, #A8ABB2)",
|
|
148
|
-
cursor: l.value ? "pointer" : "default"
|
|
149
|
-
}),
|
|
150
|
-
onClick: p
|
|
151
|
-
}, {
|
|
152
|
-
default: f(() => [
|
|
153
|
-
q(A(l.value ? k : t.value + "s"), 1)
|
|
154
|
-
]),
|
|
155
|
-
_: 1
|
|
156
|
-
}, 8, ["style"]);
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
const fe = /* @__PURE__ */ V(me, [["__scopeId", "data-v-4074e137"]]), _e = /* @__PURE__ */ v({
|
|
161
|
-
__name: "index",
|
|
162
|
-
props: {
|
|
163
|
-
item: {}
|
|
164
|
-
},
|
|
165
|
-
setup(e) {
|
|
166
|
-
const { item: n } = e, t = n;
|
|
167
|
-
return t.template = {
|
|
168
|
-
append: () => ee(fe, {
|
|
169
|
-
getSmscode: t.getSmscode
|
|
170
|
-
})
|
|
171
|
-
}, (i, l) => (r(), a(w, {
|
|
172
|
-
item: _(t),
|
|
173
|
-
class: "input"
|
|
174
|
-
}, null, 8, ["item"]));
|
|
175
|
-
}
|
|
176
|
-
}), ye = v({
|
|
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 he(e, n, t, i, l, c) {
|
|
203
|
-
const p = s("el-divider");
|
|
204
|
-
return r(), a(p, te(ne(e.dividerSetting)), D({ _: 2 }, [
|
|
205
|
-
P(e.item.template, (u, d) => ({
|
|
206
|
-
name: d,
|
|
207
|
-
fn: f(() => [
|
|
208
|
-
u ? (r(), a(G(e.currentInputComponent()), {
|
|
209
|
-
key: d,
|
|
210
|
-
templateEle: u
|
|
211
|
-
}, null, 8, ["templateEle"])) : m("", !0)
|
|
212
|
-
])
|
|
213
|
-
}))
|
|
214
|
-
]), 1040);
|
|
215
|
-
}
|
|
216
|
-
const ge = /* @__PURE__ */ V(ye, [["render", he]]), ve = /* @__PURE__ */ v({
|
|
217
|
-
__name: "index",
|
|
218
|
-
props: {
|
|
219
|
-
item: {}
|
|
220
|
-
},
|
|
221
|
-
setup(e) {
|
|
222
|
-
const { item: n } = e, t = g("queryParams", {}), i = g("size"), l = z({
|
|
223
|
-
...n.radioSetting
|
|
224
|
-
}), c = z({
|
|
225
|
-
...n.radioGroupSetting
|
|
226
|
-
});
|
|
227
|
-
return (p, u) => {
|
|
228
|
-
const d = s("el-radio"), b = s("el-radio-group");
|
|
229
|
-
return r(), a(b, h({
|
|
230
|
-
modelValue: _(t)[p.item.prop],
|
|
231
|
-
"onUpdate:modelValue": u[0] || (u[0] = (S) => _(t)[p.item.prop] = S),
|
|
232
|
-
size: _(i)
|
|
233
|
-
}, c.value), {
|
|
234
|
-
default: f(() => [
|
|
235
|
-
(r(!0), $(C, null, P(p.item.option || [], (S) => (r(), a(d, h({
|
|
236
|
-
size: _(i),
|
|
237
|
-
label: S.label,
|
|
238
|
-
key: S.label
|
|
239
|
-
}, l.value), {
|
|
240
|
-
default: f(() => [
|
|
241
|
-
q(A(S.value), 1)
|
|
242
|
-
]),
|
|
243
|
-
_: 2
|
|
244
|
-
}, 1040, ["size", "label"]))), 128))
|
|
245
|
-
]),
|
|
246
|
-
_: 1
|
|
247
|
-
}, 16, ["modelValue", "size"]);
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
}), be = v({
|
|
251
|
-
name: "GeneralBasicForm",
|
|
252
|
-
components: {
|
|
253
|
-
Input: w,
|
|
254
|
-
InputNumber: le,
|
|
255
|
-
InputGraphicVerification: ce,
|
|
256
|
-
InputMobileVerification: _e,
|
|
257
|
-
Divider: ge,
|
|
258
|
-
Radio: ve
|
|
259
|
-
},
|
|
260
|
-
props: {
|
|
261
|
-
showSearch: {
|
|
262
|
-
// 是否展示所有元素
|
|
263
|
-
type: Boolean,
|
|
264
|
-
default: !0
|
|
265
|
-
},
|
|
266
|
-
loading: {
|
|
267
|
-
// 加载动画
|
|
268
|
-
type: Boolean,
|
|
269
|
-
default: !1
|
|
270
|
-
},
|
|
271
|
-
formOnly: {
|
|
272
|
-
// 是否只展示表单不展示按钮
|
|
273
|
-
type: Boolean,
|
|
274
|
-
default: !1
|
|
275
|
-
},
|
|
276
|
-
getList: {
|
|
277
|
-
// 查找数据调用的函数
|
|
278
|
-
type: Function,
|
|
279
|
-
default: () => {
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
afterReset: {
|
|
283
|
-
// 在重置按钮点击完后但还没重新请求时触发的的函数
|
|
284
|
-
type: Function,
|
|
285
|
-
default: () => {
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
formItem: {
|
|
289
|
-
// 定义表单的数据
|
|
290
|
-
type: Array,
|
|
291
|
-
default: []
|
|
292
|
-
},
|
|
293
|
-
size: {
|
|
294
|
-
// 控制按钮大小
|
|
295
|
-
type: String,
|
|
296
|
-
default: "default"
|
|
297
|
-
},
|
|
298
|
-
labelWidth: {
|
|
299
|
-
// 表单文字宽度
|
|
300
|
-
type: String,
|
|
301
|
-
default: "90px"
|
|
302
|
-
},
|
|
303
|
-
noUrlParameters: {
|
|
304
|
-
// 不接受和不改变url的参数
|
|
305
|
-
type: Boolean,
|
|
306
|
-
default: () => !1
|
|
307
|
-
},
|
|
308
|
-
formData: {
|
|
309
|
-
// 外部传入的表单数据,用于回填
|
|
310
|
-
type: Object,
|
|
311
|
-
default: () => {
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
data() {
|
|
316
|
-
return {
|
|
317
|
-
formLoading: this.loading || !1,
|
|
318
|
-
selectSetting: {
|
|
319
|
-
placeholder: "请选择",
|
|
320
|
-
clearable: !0,
|
|
321
|
-
style: "width: 200px"
|
|
322
|
-
},
|
|
323
|
-
datePackerSetting: {
|
|
324
|
-
style: "width: 227px",
|
|
325
|
-
"start-placeholder": "开始日期",
|
|
326
|
-
"end-placeholder": "结束日期",
|
|
327
|
-
type: "daterange"
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
},
|
|
331
|
-
setup(e) {
|
|
332
|
-
const { size: n, noUrlParameters: t, getList: i } = e, l = re(), c = z({
|
|
333
|
-
...t ? {} : l == null ? void 0 : l.query
|
|
334
|
-
});
|
|
335
|
-
return I(
|
|
336
|
-
/* 注入名 */
|
|
337
|
-
"queryParams",
|
|
338
|
-
/* 值 */
|
|
339
|
-
c
|
|
340
|
-
), I(
|
|
341
|
-
/* 注入名 */
|
|
342
|
-
"size",
|
|
343
|
-
/* 值 */
|
|
344
|
-
n
|
|
345
|
-
), I(
|
|
346
|
-
/* 注入名 */
|
|
347
|
-
"getList",
|
|
348
|
-
/* 值 */
|
|
349
|
-
i
|
|
350
|
-
), {
|
|
351
|
-
queryParams: c
|
|
352
|
-
};
|
|
353
|
-
},
|
|
354
|
-
watch: {
|
|
355
|
-
formData: {
|
|
356
|
-
handler(e) {
|
|
357
|
-
this.queryParams = {
|
|
358
|
-
...this.noUrlParameters ? {} : this.queryParams,
|
|
359
|
-
...e
|
|
360
|
-
};
|
|
361
|
-
},
|
|
362
|
-
// watch 默认是懒执行的:仅当数据源变化时,才会执行回调。但在某些场景中,我们希望在创建侦听器时,立即执行一遍回调。举例来说,我们想请求一些初始数据,然后在相关状态更改时重新请求数据。
|
|
363
|
-
// https://cn.vuejs.org/guide/essentials/watchers.html#deep-watchers
|
|
364
|
-
immediate: !0
|
|
365
|
-
// deep: true,
|
|
366
|
-
},
|
|
367
|
-
loading(e) {
|
|
368
|
-
this.formLoading !== e && (this.formLoading = e);
|
|
369
|
-
},
|
|
370
|
-
formLoading(e) {
|
|
371
|
-
this.loading !== e && this.$emit("update:loading", e);
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
provide() {
|
|
375
|
-
return {
|
|
376
|
-
// 显式提供一个计算属性
|
|
377
|
-
[T]: {
|
|
378
|
-
formLoading: E(() => this.formLoading),
|
|
379
|
-
updateFormLoading: (e) => {
|
|
380
|
-
this.formLoading = e;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
},
|
|
385
|
-
methods: {
|
|
386
|
-
/** 搜索按钮操作 */
|
|
387
|
-
handleQuery() {
|
|
388
|
-
var t;
|
|
389
|
-
const e = { page: 1, limit: 10 }, n = {
|
|
390
|
-
...(t = this.$route) == null ? void 0 : t.query,
|
|
391
|
-
...this.queryParams,
|
|
392
|
-
...e
|
|
393
|
-
};
|
|
394
|
-
this.noUrlParameters || this.$router.push({
|
|
395
|
-
query: { ...n }
|
|
396
|
-
}), this.getList({
|
|
397
|
-
...n
|
|
398
|
-
});
|
|
399
|
-
},
|
|
400
|
-
/** 重置按钮操作 */
|
|
401
|
-
async resetQuery() {
|
|
402
|
-
var n;
|
|
403
|
-
this.$refs.queryFormRef.resetFields();
|
|
404
|
-
const e = { page: 1 };
|
|
405
|
-
this.noUrlParameters || await this.$router.push({
|
|
406
|
-
query: { ...e }
|
|
407
|
-
}), this.queryParams = {
|
|
408
|
-
...this.noUrlParameters ? {} : (n = this.$route) == null ? void 0 : n.query
|
|
409
|
-
}, this.afterReset(), this.handleQuery();
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
function Se(e, n, t, i, l, c) {
|
|
414
|
-
const p = s("Input"), u = s("InputGraphicVerification"), d = s("InputMobileVerification"), b = s("Divider"), S = s("Radio"), K = s("el-option"), O = s("el-select"), M = s("el-cascader"), j = s("el-date-picker"), W = s("InputNumber"), B = s("el-form-item"), U = s("el-button"), H = s("el-form"), J = N("loading");
|
|
415
|
-
return L((r(), a(H, h({
|
|
416
|
-
model: e.queryParams,
|
|
417
|
-
ref: "queryFormRef",
|
|
418
|
-
inline: "",
|
|
419
|
-
"label-position": "left",
|
|
420
|
-
"label-width": e.labelWidth
|
|
421
|
-
}, e.$attrs), {
|
|
422
|
-
default: f(() => [
|
|
423
|
-
(r(!0), $(C, null, P(e.formItem, (o) => (r(), a(B, {
|
|
424
|
-
label: o.label,
|
|
425
|
-
prop: o.prop,
|
|
426
|
-
key: o.prop,
|
|
427
|
-
rules: o.rules
|
|
428
|
-
}, {
|
|
429
|
-
default: f(() => [
|
|
430
|
-
o.type === "input" ? (r(), a(p, {
|
|
431
|
-
key: 0,
|
|
432
|
-
item: o
|
|
433
|
-
}, null, 8, ["item"])) : m("", !0),
|
|
434
|
-
o.type === "input-graphic-verification" ? (r(), a(u, {
|
|
435
|
-
item: o,
|
|
436
|
-
key: o.key
|
|
437
|
-
}, null, 8, ["item"])) : m("", !0),
|
|
438
|
-
o.type === "input-mobile-verification" ? (r(), a(d, {
|
|
439
|
-
key: 2,
|
|
440
|
-
item: o
|
|
441
|
-
}, null, 8, ["item"])) : m("", !0),
|
|
442
|
-
o.type === "divider" ? (r(), a(b, {
|
|
443
|
-
key: 3,
|
|
444
|
-
item: o
|
|
445
|
-
}, null, 8, ["item"])) : m("", !0),
|
|
446
|
-
o.type === "radio" ? (r(), a(S, {
|
|
447
|
-
key: 4,
|
|
448
|
-
item: o
|
|
449
|
-
}, null, 8, ["item"])) : m("", !0),
|
|
450
|
-
o.type === "select" ? (r(), a(O, h({
|
|
451
|
-
key: 5,
|
|
452
|
-
filterable: "",
|
|
453
|
-
modelValue: e.queryParams[o.prop],
|
|
454
|
-
"onUpdate:modelValue": (y) => e.queryParams[o.prop] = y,
|
|
455
|
-
size: e.size
|
|
456
|
-
}, o.selectSetting || e.selectSetting), {
|
|
457
|
-
default: f(() => [
|
|
458
|
-
(r(!0), $(C, null, P(o.option || [], (y) => (r(), a(K, {
|
|
459
|
-
key: y.value,
|
|
460
|
-
label: y.label,
|
|
461
|
-
value: y.value
|
|
462
|
-
}, null, 8, ["label", "value"]))), 128))
|
|
463
|
-
]),
|
|
464
|
-
_: 2
|
|
465
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "size"])) : m("", !0),
|
|
466
|
-
o.type === "cascader" ? (r(), a(M, h({
|
|
467
|
-
key: 6,
|
|
468
|
-
filterable: "",
|
|
469
|
-
modelValue: e.queryParams[o.prop],
|
|
470
|
-
"onUpdate:modelValue": (y) => e.queryParams[o.prop] = y,
|
|
471
|
-
size: e.size,
|
|
472
|
-
options: o.options || []
|
|
473
|
-
}, o.selectSetting || e.selectSetting), null, 16, ["modelValue", "onUpdate:modelValue", "size", "options"])) : m("", !0),
|
|
474
|
-
o.type === "date-picker" ? (r(), a(j, h({
|
|
475
|
-
key: 7,
|
|
476
|
-
modelValue: e.queryParams[o.prop],
|
|
477
|
-
"onUpdate:modelValue": (y) => e.queryParams[o.prop] = y,
|
|
478
|
-
size: e.size
|
|
479
|
-
}, o.datePackerSetting || e.datePackerSetting), null, 16, ["modelValue", "onUpdate:modelValue", "size"])) : m("", !0),
|
|
480
|
-
o.type === "input-number" ? (r(), a(W, {
|
|
481
|
-
key: 8,
|
|
482
|
-
item: o
|
|
483
|
-
}, null, 8, ["item"])) : m("", !0)
|
|
484
|
-
]),
|
|
485
|
-
_: 2
|
|
486
|
-
}, 1032, ["label", "prop", "rules"]))), 128)),
|
|
487
|
-
F(e.$slots, "default"),
|
|
488
|
-
e.formOnly ? m("", !0) : (r(), a(B, { key: 0 }, {
|
|
489
|
-
default: f(() => [
|
|
490
|
-
L((r(), a(U, {
|
|
491
|
-
type: "primary",
|
|
492
|
-
size: e.size,
|
|
493
|
-
onClick: e.handleQuery
|
|
494
|
-
}, {
|
|
495
|
-
default: f(() => [
|
|
496
|
-
q("查询")
|
|
497
|
-
]),
|
|
498
|
-
_: 1
|
|
499
|
-
}, 8, ["size", "onClick"])), [
|
|
500
|
-
[J, e.formLoading]
|
|
501
|
-
]),
|
|
502
|
-
R(U, {
|
|
503
|
-
size: e.size,
|
|
504
|
-
onClick: e.resetQuery
|
|
505
|
-
}, {
|
|
506
|
-
default: f(() => [
|
|
507
|
-
q("重置")
|
|
508
|
-
]),
|
|
509
|
-
_: 1
|
|
510
|
-
}, 8, ["size", "onClick"])
|
|
511
|
-
]),
|
|
512
|
-
_: 1
|
|
513
|
-
})),
|
|
514
|
-
F(e.$slots, "behind-the-button")
|
|
515
|
-
]),
|
|
516
|
-
_: 3
|
|
517
|
-
}, 16, ["model", "label-width"])), [
|
|
518
|
-
[oe, e.showSearch]
|
|
519
|
-
]);
|
|
520
|
-
}
|
|
521
|
-
const ze = /* @__PURE__ */ V(be, [["render", Se]]), Ve = ze;
|
|
522
|
-
export {
|
|
523
|
-
Ve as VGeneralBasicForm
|
|
524
|
-
};
|
package/dist/index.umd.cjs
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,V){"use strict";const k={placeholder:"请输入",style:"width: 200px",clearable:!0},b=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"}}}),y=(t,n)=>{const o=t.__vccOpts||t;for(const[a,l]of n)o[a]=l;return o};function P(t,n,o,a,l,c){const s=e.resolveComponent("el-input");return e.openBlock(),e.createBlock(s,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=y(b,[["render",P]]),S=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,o=e.inject("queryParams",{}),a=e.inject("size"),l=e.ref({...k,...n.inputSetting});return(c,s)=>{const i=e.resolveComponent("el-input-number");return e.openBlock(),e.createBlock(i,e.mergeProps({modelValue:e.unref(o)[c.item.prop],"onUpdate:modelValue":s[0]||(s[0]=p=>e.unref(o)[c.item.prop]=p),size:e.unref(a)},l.value),null,16,["modelValue","size"])}}}),g=Symbol(),z={class:"input-graphic-verification"},q=["src"],$=e.defineComponent({__name:"index",props:{item:{}},setup(t){const{item:n}=t,{graphicSrc:o="",getGraphic:a=()=>{}}=n,{formLoading:l,updateFormLoading:c}=e.inject(g),s=async()=>{a&&!l.value&&await a()};return(i,p)=>{const u=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createElementBlock("div",z,[e.createVNode(h,{item:i.item,class:"input"},null,8,["item"]),e.createElementVNode("img",{class:"graphic",onClick:s,src:e.unref(o)},null,8,q)])),[[u,e.unref(l)]])}}}),J="",w=y($,[["__scopeId","data-v-500ec9b0"]]),_="获取验证码",I=60,L=e.defineComponent({__name:"verification-button",props:{getSmscode:{type:Function}},setup(t){const{getSmscode:n}=t,o=e.ref(_),a=e.ref(null),l=e.computed(()=>o.value===_),c=()=>{a&&(clearInterval(a.value),a.value=null,o.value=_)},s=async()=>{if(o.value===_)if(o.value=I,a.value=setInterval(()=>{if(Number(o.value)<=0||!o.value){c();return}else o.value=Number(o.value)-1},1e3),n)await n()===!1&&c();else return};return e.onBeforeUnmount(()=>{c()}),(i,p)=>{const u=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(u,{class:"verifiaction-button",style:e.normalizeStyle({color:l.value?"var(--color-primary, #409EFF)":"var(--text-color-placeholder, #A8ABB2)",cursor:l.value?"pointer":"default"}),onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value?_:o.value+"s"),1)]),_:1},8,["style"])}}}),X="",N=y(L,[["__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(N,{getSmscode:o.getSmscode})},(a,l)=>(e.openBlock(),e.createBlock(h,{item:e.unref(o),class:"input"},null,8,["item"]))}}),D=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,c){const s=e.resolveComponent("el-divider");return e.openBlock(),e.createBlock(s,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 j=y(D,[["render",U]]),E=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}),c=e.ref({...n.radioGroupSetting});return(s,i)=>{const p=e.resolveComponent("el-radio"),u=e.resolveComponent("el-radio-group");return e.openBlock(),e.createBlock(u,e.mergeProps({modelValue:e.unref(o)[s.item.prop],"onUpdate:modelValue":i[0]||(i[0]=f=>e.unref(o)[s.item.prop]=f),size:e.unref(a)},c.value),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.item.option||[],f=>(e.openBlock(),e.createBlock(p,e.mergeProps({size:e.unref(a),label:f.label,key:f.label},l.value),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value),1)]),_:2},1040,["size","label"]))),128))]),_:1},16,["modelValue","size"])}}}),G=e.defineComponent({name:"GeneralBasicForm",components:{Input:h,InputNumber:S,InputGraphicVerification:w,InputMobileVerification:F,Divider:j,Radio:E},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,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=V.useRoute(),c=e.ref({...o?{}:l==null?void 0:l.query});return e.provide("queryParams",c),e.provide("size",n),e.provide("getList",a),{queryParams:c}},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 T(t,n,o,a,l,c){const s=e.resolveComponent("Input"),i=e.resolveComponent("InputGraphicVerification"),p=e.resolveComponent("InputMobileVerification"),u=e.resolveComponent("Divider"),f=e.resolveComponent("Radio"),A=e.resolveComponent("el-option"),O=e.resolveComponent("el-select"),Q=e.resolveComponent("el-cascader"),K=e.resolveComponent("el-date-picker"),M=e.resolveComponent("InputNumber"),B=e.resolveComponent("el-form-item"),C=e.resolveComponent("el-button"),W=e.resolveComponent("el-form"),H=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createBlock(W,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(B,{label:r.label,prop:r.prop,key:r.prop,rules:r.rules},{default:e.withCtx(()=>[r.type==="input"?(e.openBlock(),e.createBlock(s,{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(u,{key:3,item:r},null,8,["item"])):e.createCommentVNode("",!0),r.type==="radio"?(e.openBlock(),e.createBlock(f,{key:4,item:r},null,8,["item"])):e.createCommentVNode("",!0),r.type==="select"?(e.openBlock(),e.createBlock(O,e.mergeProps({key:5,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(A,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","size"])):e.createCommentVNode("",!0),r.type==="cascader"?(e.openBlock(),e.createBlock(Q,e.mergeProps({key:6,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"])):e.createCommentVNode("",!0),r.type==="date-picker"?(e.openBlock(),e.createBlock(K,e.mergeProps({key:7,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(M,{key:8,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(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"])),[[H,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 R=y(G,[["render",T]]);d.VGeneralBasicForm=R,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
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}
|
|
File without changes
|