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