general-basic-form 2.0.2 → 2.0.4
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.mjs +452 -0
- package/dist/index.umd.js +1 -0
- package/dist/style.css +1 -0
- package/package.json +17 -5
- package/README.assets/image-20210820173738506.png +0 -0
- package/script/link.ts +0 -34
- package/script/unlink.ts +0 -42
- package/src/GeneralBasicForm.vue +0 -234
- package/src/assets/image-20210820173037871.png +0 -0
- package/src/assets/logo.png +0 -0
- 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/setting.ts +0 -15
- package/src/index.ts +0 -15
- package/src/types/basicFrom.ts +0 -48
- 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.mjs
ADDED
|
@@ -0,0 +1,452 @@
|
|
|
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
|
+
};
|
|
@@ -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,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"})});
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.input-graphic-verification[data-v-768ce181]{display:flex;gap:12px;width:100%}.input-graphic-verification .input[data-v-768ce181]{flex:auto}.input-graphic-verification .graphic[data-v-768ce181]{width:109px;height:43px;object-fit:fill;flex:none}.verifiaction-button[data-v-4074e137]{width:109px}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "general-basic-form",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "./
|
|
5
|
+
"main": "./dist/index.umd.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "cross-env CURRENT_ENV=prod run-p type-check build-only",
|
|
8
8
|
"test:e2e": "playwright test",
|
|
9
9
|
"build-only": "vite build",
|
|
10
10
|
"type-check": "tsc --noEmit -p tsconfig.json --composite false",
|
|
11
11
|
"link": "tsx script/link.ts && yarn link",
|
|
12
|
-
"unlink": "tsx script/unlink.ts && yarn unlink"
|
|
12
|
+
"unlink": "tsx script/unlink.ts && yarn unlink && run-p build"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"general-basic-form",
|
|
@@ -31,8 +31,9 @@
|
|
|
31
31
|
"@vitejs/plugin-legacy": "^4.1.1",
|
|
32
32
|
"@vitejs/plugin-vue": "^4.2.3",
|
|
33
33
|
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
|
34
|
-
"cross-env": "^7.0.3",
|
|
35
34
|
"chalk": "^2.4.2",
|
|
35
|
+
"cross-env": "^7.0.3",
|
|
36
|
+
"less": "^4.2.0",
|
|
36
37
|
"npm-run-all": "^4.1.5",
|
|
37
38
|
"tsx": "^4.0.0",
|
|
38
39
|
"typescript": "^5.2.2",
|
|
@@ -42,5 +43,16 @@
|
|
|
42
43
|
"element-plus": ">=2.4.2",
|
|
43
44
|
"vue": ">=3.3.4",
|
|
44
45
|
"vue-router": ">=4.2.4"
|
|
45
|
-
}
|
|
46
|
+
},
|
|
47
|
+
"typings": "./dist/index.d.ts",
|
|
48
|
+
"module": "./dist/index.mjs",
|
|
49
|
+
"exports": {
|
|
50
|
+
".": {
|
|
51
|
+
"import": "./dist/index.mjs",
|
|
52
|
+
"require": "./dist/index.umd.js"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"files": [
|
|
56
|
+
"/dist"
|
|
57
|
+
]
|
|
46
58
|
}
|
|
Binary file
|
package/script/link.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
-
* @Date: 2023-11-10 09:39:59
|
|
4
|
-
* @LastEditTime: 2023-11-10 10:26:53
|
|
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
|
-
|
|
15
|
-
const updateMain = () => {
|
|
16
|
-
try {
|
|
17
|
-
const packageTxt = fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8');
|
|
18
|
-
const packageJson = JSON.parse(packageTxt);
|
|
19
|
-
const mainDir = "./src/index.ts"
|
|
20
|
-
delete packageJson.files
|
|
21
|
-
delete packageJson.module
|
|
22
|
-
delete packageJson.exports
|
|
23
|
-
delete packageJson.types
|
|
24
|
-
packageJson.main = mainDir
|
|
25
|
-
const versionData = JSON.stringify(packageJson, null, 2);
|
|
26
|
-
fs.writeFileSync(path.join(__dirname, '../package.json'), versionData, 'utf8');
|
|
27
|
-
console.log(chalk.green.bold('修改入口配置成功!当前入口路径为为:' + mainDir));
|
|
28
|
-
} catch (error) {
|
|
29
|
-
console.log(chalk.red.bold('修改入口配置出错:', error.toString()));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
updateMain()
|
package/script/unlink.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: 陈德立*******419287484@qq.com
|
|
3
|
-
* @Date: 2023-11-10 09:39:59
|
|
4
|
-
* @LastEditTime: 2023-11-10 10:29:27
|
|
5
|
-
* @LastEditors: 陈德立*******419287484@qq.com
|
|
6
|
-
* @Github: https://github.com/Alan1034
|
|
7
|
-
* @Description: unlink处理流程
|
|
8
|
-
* @FilePath: \GeneralBasicForm\script\unlink.ts
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
import path from "path";
|
|
12
|
-
import fs from 'fs'
|
|
13
|
-
import chalk from 'chalk'
|
|
14
|
-
|
|
15
|
-
const updateMain = () => {
|
|
16
|
-
try {
|
|
17
|
-
const packageTxt = fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8');
|
|
18
|
-
const packageJson = JSON.parse(packageTxt);
|
|
19
|
-
const umdDir = "./dist/index.umd.js"
|
|
20
|
-
const esDir = "./dist/index.mjs"
|
|
21
|
-
packageJson.main = umdDir
|
|
22
|
-
packageJson.module = esDir
|
|
23
|
-
packageJson.exports = {
|
|
24
|
-
".": {
|
|
25
|
-
"import": esDir,
|
|
26
|
-
"require": umdDir
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
packageJson.typings = "./dist/index.d.ts"
|
|
30
|
-
packageJson.files = [
|
|
31
|
-
"/dist"
|
|
32
|
-
]
|
|
33
|
-
const versionData = JSON.stringify(packageJson, null, 2);
|
|
34
|
-
fs.writeFileSync(path.join(__dirname, '../package.json'), versionData, 'utf8');
|
|
35
|
-
console.log(chalk.green.bold('修改入口配置成功!当前入口路径为为:' + umdDir));
|
|
36
|
-
} catch (error) {
|
|
37
|
-
console.log(chalk.red.bold('修改入口配置出错:', error.toString()));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
updateMain()
|