general-basic-form 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +149 -18
- package/dist/index.mjs +133 -118
- package/dist/index.umd.js +1 -1
- package/package.json +57 -48
- package/dist/style.css +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# GeneralBasicForm
|
|
2
2
|
|
|
3
|
-
一个兼容
|
|
3
|
+
一个兼容 Vue3 和 React(未来实现) 的表单组件 <br/>
|
|
4
4
|
|
|
5
5
|
示例:
|
|
6
6
|
|
|
@@ -45,10 +45,11 @@ import GeneralBasicForm from 'general-basic-form'
|
|
|
45
45
|
/>
|
|
46
46
|
|
|
47
47
|
<style lang="scss" scoped>
|
|
48
|
-
:deep {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
:deep(.el-form-item) {
|
|
49
|
+
margin-bottom: 16px;
|
|
50
|
+
}
|
|
51
|
+
:deep(.el-divider--horizontal) {
|
|
52
|
+
margin: 8px 0px;
|
|
52
53
|
}
|
|
53
54
|
</style>
|
|
54
55
|
|
|
@@ -63,14 +64,29 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
|
|
|
63
64
|
|
|
64
65
|
表单数据校验需要拿到内部表单的ref
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
async getSmscode() {
|
|
68
|
+
const VGeneralBasicFormRef = this.$refs['VGeneralBasicFormRef'] as any
|
|
69
|
+
const state = await new Promise<boolean>((resolve, reject) => {
|
|
70
|
+
VGeneralBasicFormRef.$refs['queryFormRef']?.validateField(
|
|
71
|
+
'user_phone',
|
|
72
|
+
async (valid: FormValidateCallback | undefined) => {
|
|
73
|
+
if (valid) {
|
|
74
|
+
const { user_phone } = VGeneralBasicFormRef['queryParams']
|
|
75
|
+
const res: any = await SmscodeList({ user_phone })
|
|
76
|
+
if (res) {
|
|
77
|
+
console.log(res)
|
|
78
|
+
resolve(true)
|
|
79
|
+
} else {
|
|
80
|
+
resolve(false)
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
resolve(false)
|
|
84
|
+
}
|
|
71
85
|
}
|
|
72
|
-
|
|
73
|
-
)
|
|
86
|
+
)
|
|
87
|
+
})
|
|
88
|
+
return state
|
|
89
|
+
},
|
|
74
90
|
|
|
75
91
|
|
|
76
92
|

|
|
@@ -83,10 +99,25 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
|
|
|
83
99
|
formOnly:true // 只展示表单不展示按钮
|
|
84
100
|
noUrlParameters:true // 不接受和不改变url的参数
|
|
85
101
|
formItem: [
|
|
102
|
+
{
|
|
103
|
+
label: '',
|
|
104
|
+
prop: 'bsName35',
|
|
105
|
+
type: 'divider',
|
|
106
|
+
dividerSetting: {
|
|
107
|
+
},
|
|
108
|
+
template: {
|
|
109
|
+
default: () => {
|
|
110
|
+
return "123123123";
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
86
114
|
{ label: "款式名称",
|
|
87
115
|
prop: "bsName",
|
|
88
116
|
type: "input",
|
|
89
|
-
|
|
117
|
+
inputSetting: {
|
|
118
|
+
placeholder: '请输入手机验证码',
|
|
119
|
+
style: 'width: 100%'
|
|
120
|
+
},
|
|
90
121
|
rules: [
|
|
91
122
|
{
|
|
92
123
|
message: "请输入信息"
|
|
@@ -101,7 +132,7 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
|
|
|
101
132
|
return <svg-icon icon-class="baifenbi" />;
|
|
102
133
|
},
|
|
103
134
|
},
|
|
104
|
-
|
|
135
|
+
},
|
|
105
136
|
{
|
|
106
137
|
label: "二次工艺",
|
|
107
138
|
prop: "spName",
|
|
@@ -133,6 +164,40 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
|
|
|
133
164
|
},
|
|
134
165
|
],
|
|
135
166
|
},
|
|
167
|
+
{
|
|
168
|
+
label: '',
|
|
169
|
+
prop: 'bsName2',
|
|
170
|
+
type: 'input-graphic-verification',
|
|
171
|
+
inputSetting: {
|
|
172
|
+
placeholder: '请输入图形验证码',
|
|
173
|
+
style: 'width: 100%'
|
|
174
|
+
},
|
|
175
|
+
rules: [
|
|
176
|
+
{
|
|
177
|
+
message: '请输入图形验证码',
|
|
178
|
+
trigger: 'blur'
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
graphicSrc, // 请求图像的URL
|
|
182
|
+
getGraphic, // 重新请求图像的函数
|
|
183
|
+
key:Math.random(), // 必传,图像更新后必须更新。如果URL会变化也可以用URL代替
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
label: '',
|
|
187
|
+
prop: 'bsName3',
|
|
188
|
+
type: 'input-mobile-verification',
|
|
189
|
+
inputSetting: {
|
|
190
|
+
placeholder: '请输入手机验证码',
|
|
191
|
+
style: 'width: 100%'
|
|
192
|
+
},
|
|
193
|
+
rules: [
|
|
194
|
+
{
|
|
195
|
+
message: '请输入手机验证码',
|
|
196
|
+
trigger: 'blur'
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
getSmscode,// 获取验证码的回调函数,获取失败必须返回false,否则计时器不会重新计算
|
|
200
|
+
},
|
|
136
201
|
{
|
|
137
202
|
label: "分类",
|
|
138
203
|
prop: "分类",
|
|
@@ -201,9 +266,6 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
|
|
|
201
266
|
],
|
|
202
267
|
},
|
|
203
268
|
],
|
|
204
|
-
//分别支持input输入框,select单选框,date-picker日期选择器,cascader层级选择器 四种组件
|
|
205
|
-
|
|
206
|
-
//date-picker可以传入'start-placeholder'和'end-placeholder',其他组件支持placeholder传入
|
|
207
269
|
|
|
208
270
|
//rules为表单校验规则,每个组件都可以传入
|
|
209
271
|
|
|
@@ -212,5 +274,74 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
|
|
|
212
274
|
//suffix 输入框尾部内容,只对 type="text" 有效
|
|
213
275
|
//prepend 输入框前置内容,只对 type="text" 有效
|
|
214
276
|
//append 输入框后置内容,只对 type="text" 有效
|
|
277
|
+
|
|
278
|
+
//divider支持template:
|
|
279
|
+
//default
|
|
280
|
+
支持组件:
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
|
|
284
|
+
\* @description: 输入框
|
|
285
|
+
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
'input' = 'input',
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
|
|
292
|
+
\* @description: 输入框/图像验证码
|
|
293
|
+
|
|
294
|
+
*/
|
|
295
|
+
|
|
296
|
+
'input-graphic-verification' = 'input-graphic-verification',
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
|
|
300
|
+
\* @description: 输入框/手机验证码
|
|
301
|
+
|
|
302
|
+
*/
|
|
303
|
+
|
|
304
|
+
'input-mobile-verification' = 'input-mobile-verification',
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
|
|
308
|
+
\* @description: 分割线
|
|
309
|
+
|
|
310
|
+
*/
|
|
311
|
+
|
|
312
|
+
'divider' = 'divider',
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
|
|
316
|
+
\* @description: 选择器
|
|
317
|
+
|
|
318
|
+
*/
|
|
319
|
+
|
|
320
|
+
'select' = 'select',
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
|
|
324
|
+
\* @description: 级联选择器
|
|
325
|
+
|
|
326
|
+
*/
|
|
327
|
+
|
|
328
|
+
'cascader' = 'cascader',
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
|
|
332
|
+
\* @description: 日期选择器
|
|
333
|
+
|
|
334
|
+
*/
|
|
335
|
+
|
|
336
|
+
'date-picker' = 'date-picker',
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
|
|
340
|
+
\* @description: 数字输入框
|
|
341
|
+
|
|
342
|
+
*/
|
|
343
|
+
|
|
344
|
+
'input-number' = 'input-number',
|
|
345
|
+
|
|
215
346
|
安装:npm i general-basic-form<br/>
|
|
216
|
-
install: npm i general-basic-form
|
|
347
|
+
install: npm i general-basic-form
|
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
const t = r.__vccOpts || r;
|
|
4
|
-
for (const [h, l] of n)
|
|
5
|
-
t[h] = l;
|
|
6
|
-
return t;
|
|
7
|
-
}, G = {
|
|
8
|
-
name: "GeneralBasicForm",
|
|
1
|
+
import { defineComponent as v, resolveComponent as u, openBlock as n, createBlock as s, mergeProps as c, withKeys as C, createSlots as F, renderList as g, withCtx as i, resolveDynamicComponent as B, createCommentVNode as d, withDirectives as I, createElementBlock as _, Fragment as z, renderSlot as L, createVNode as k, createTextVNode as V, vShow as O } from "vue";
|
|
2
|
+
const Q = v({
|
|
9
3
|
components: {
|
|
10
|
-
InputArchive: (
|
|
11
|
-
const { templateEle:
|
|
12
|
-
return
|
|
4
|
+
InputArchive: (e) => {
|
|
5
|
+
const { templateEle: l } = e;
|
|
6
|
+
return l();
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
props: {
|
|
10
|
+
item: null,
|
|
11
|
+
// null就是any
|
|
12
|
+
queryParams: { type: [Object, String], required: !0 },
|
|
13
|
+
getList: { type: Function, required: !0 },
|
|
14
|
+
size: { type: String, required: !0 }
|
|
15
|
+
},
|
|
16
|
+
data() {
|
|
17
|
+
return {
|
|
18
|
+
inputSetting: {
|
|
19
|
+
placeholder: "请输入",
|
|
20
|
+
style: "width: 200px",
|
|
21
|
+
clearable: !0
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
created() {
|
|
26
|
+
console.log("new");
|
|
27
|
+
},
|
|
28
|
+
methods: {
|
|
29
|
+
currentInputComponent() {
|
|
30
|
+
return "input-archive";
|
|
13
31
|
}
|
|
14
32
|
},
|
|
33
|
+
watch: {
|
|
34
|
+
item(e) {
|
|
35
|
+
console.log(e);
|
|
36
|
+
},
|
|
37
|
+
size(e) {
|
|
38
|
+
console.log(e);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}), S = (e, l) => {
|
|
42
|
+
const r = e.__vccOpts || e;
|
|
43
|
+
for (const [y, o] of l)
|
|
44
|
+
r[y] = o;
|
|
45
|
+
return r;
|
|
46
|
+
};
|
|
47
|
+
function D(e, l, r, y, o, h) {
|
|
48
|
+
const f = u("el-input");
|
|
49
|
+
return n(), s(f, c({
|
|
50
|
+
onKeydown: C(e.getList, ["enter"]),
|
|
51
|
+
modelValue: e.queryParams[e.item.prop],
|
|
52
|
+
"onUpdate:modelValue": l[0] || (l[0] = (p) => e.queryParams[e.item.prop] = p),
|
|
53
|
+
size: e.size
|
|
54
|
+
}, e.item.inputSetting || e.inputSetting), F({ _: 2 }, [
|
|
55
|
+
g(e.item.template, (p, m) => ({
|
|
56
|
+
name: m,
|
|
57
|
+
fn: i(() => [
|
|
58
|
+
p ? (n(), s(B(e.currentInputComponent()), {
|
|
59
|
+
key: m,
|
|
60
|
+
templateEle: p
|
|
61
|
+
}, null, 8, ["templateEle"])) : d("", !0)
|
|
62
|
+
])
|
|
63
|
+
}))
|
|
64
|
+
]), 1040, ["onKeydown", "modelValue", "size"]);
|
|
65
|
+
}
|
|
66
|
+
const R = /* @__PURE__ */ S(Q, [["render", D]]), G = {
|
|
67
|
+
name: "GeneralBasicForm",
|
|
68
|
+
components: {
|
|
69
|
+
Input: R
|
|
70
|
+
},
|
|
15
71
|
props: {
|
|
16
72
|
showSearch: {
|
|
17
73
|
// 是否展示所有元素
|
|
@@ -63,10 +119,10 @@ const D = (r, n) => {
|
|
|
63
119
|
}
|
|
64
120
|
},
|
|
65
121
|
data() {
|
|
66
|
-
var
|
|
122
|
+
var e;
|
|
67
123
|
return {
|
|
68
124
|
queryParams: {
|
|
69
|
-
...this.noUrlParameters ? {} : (
|
|
125
|
+
...this.noUrlParameters ? {} : (e = this.$route) == null ? void 0 : e.query
|
|
70
126
|
},
|
|
71
127
|
// form表单数据
|
|
72
128
|
selectSetting: {
|
|
@@ -74,11 +130,6 @@ const D = (r, n) => {
|
|
|
74
130
|
clearable: !0,
|
|
75
131
|
style: "width: 200px"
|
|
76
132
|
},
|
|
77
|
-
inputSetting: {
|
|
78
|
-
placeholder: "请输入",
|
|
79
|
-
style: "width: 200px",
|
|
80
|
-
clearable: !0
|
|
81
|
-
},
|
|
82
133
|
datePackerSetting: {
|
|
83
134
|
style: "width: 227px",
|
|
84
135
|
"start-placeholder": "开始日期",
|
|
@@ -102,151 +153,115 @@ const D = (r, n) => {
|
|
|
102
153
|
// };
|
|
103
154
|
// },
|
|
104
155
|
watch: {
|
|
105
|
-
formData(
|
|
156
|
+
formData(e) {
|
|
106
157
|
this.queryParams = {
|
|
107
158
|
...this.noUrlParameters ? {} : this.queryParams,
|
|
108
|
-
...
|
|
159
|
+
...e
|
|
109
160
|
};
|
|
110
161
|
}
|
|
111
162
|
},
|
|
112
163
|
methods: {
|
|
113
164
|
/** 搜索按钮操作 */
|
|
114
165
|
handleQuery() {
|
|
115
|
-
var
|
|
116
|
-
const
|
|
117
|
-
...(
|
|
166
|
+
var r;
|
|
167
|
+
const e = { page: 1, limit: 10 }, l = {
|
|
168
|
+
...(r = this.$route) == null ? void 0 : r.query,
|
|
118
169
|
...this.queryParams,
|
|
119
|
-
...
|
|
170
|
+
...e
|
|
120
171
|
};
|
|
121
172
|
this.noUrlParameters || this.$router.push({
|
|
122
|
-
query: { ...
|
|
173
|
+
query: { ...l }
|
|
123
174
|
}), this.getList({
|
|
124
|
-
...
|
|
175
|
+
...l
|
|
125
176
|
});
|
|
126
177
|
},
|
|
127
178
|
/** 重置按钮操作 */
|
|
128
179
|
async resetQuery() {
|
|
129
|
-
var
|
|
180
|
+
var l;
|
|
130
181
|
this.$refs.queryFormRef.resetFields();
|
|
131
|
-
const
|
|
182
|
+
const e = { page: 1 };
|
|
132
183
|
this.noUrlParameters || await this.$router.push({
|
|
133
|
-
query: { ...
|
|
184
|
+
query: { ...e }
|
|
134
185
|
}), this.queryParams = {
|
|
135
|
-
...this.noUrlParameters ? {} : (
|
|
186
|
+
...this.noUrlParameters ? {} : (l = this.$route) == null ? void 0 : l.query
|
|
136
187
|
}, this.afterReset(), this.handleQuery();
|
|
137
|
-
},
|
|
138
|
-
currentInputComponent() {
|
|
139
|
-
return "input-archive";
|
|
140
188
|
}
|
|
141
189
|
}
|
|
142
|
-
};
|
|
143
|
-
function
|
|
144
|
-
const
|
|
145
|
-
return
|
|
146
|
-
model:
|
|
190
|
+
}, K = { key: 0 };
|
|
191
|
+
function N(e, l, r, y, o, h) {
|
|
192
|
+
const f = u("el-option"), p = u("el-select"), m = u("el-cascader"), b = u("el-date-picker"), w = u("el-input-number"), P = u("el-form-item"), q = u("el-button"), U = u("el-form");
|
|
193
|
+
return I((n(), s(U, c({
|
|
194
|
+
model: o.queryParams,
|
|
147
195
|
ref: "queryFormRef",
|
|
148
196
|
inline: "",
|
|
149
197
|
"label-position": "left",
|
|
150
|
-
"label-width":
|
|
151
|
-
},
|
|
152
|
-
default:
|
|
153
|
-
(
|
|
154
|
-
label:
|
|
155
|
-
prop:
|
|
156
|
-
key:
|
|
157
|
-
rules:
|
|
198
|
+
"label-width": r.labelWidth
|
|
199
|
+
}, e.$attrs), {
|
|
200
|
+
default: i(() => [
|
|
201
|
+
(n(!0), _(z, null, g(r.formItem, (t) => (n(), s(P, {
|
|
202
|
+
label: t.label,
|
|
203
|
+
prop: t.prop,
|
|
204
|
+
key: t.prop,
|
|
205
|
+
rules: t.rules
|
|
158
206
|
}, {
|
|
159
|
-
default:
|
|
160
|
-
|
|
161
|
-
key: 0,
|
|
162
|
-
onKeydown: B(t.getList, ["enter"]),
|
|
163
|
-
modelValue: l.queryParams[e.prop],
|
|
164
|
-
"onUpdate:modelValue": (o) => l.queryParams[e.prop] = o,
|
|
165
|
-
size: t.size
|
|
166
|
-
}, l.inputSetting, {
|
|
167
|
-
placeholder: e.placeholder || l.inputSetting.placeholder,
|
|
168
|
-
maxlength: e.maxlength
|
|
169
|
-
}), C({ _: 2 }, [
|
|
170
|
-
m(e.template, (o, f) => ({
|
|
171
|
-
name: f,
|
|
172
|
-
fn: p(() => [
|
|
173
|
-
o ? (a(), s(F(d.currentInputComponent()), {
|
|
174
|
-
key: f,
|
|
175
|
-
templateEle: o
|
|
176
|
-
}, null, 8, ["templateEle"])) : i("", !0)
|
|
177
|
-
])
|
|
178
|
-
}))
|
|
179
|
-
]), 1040, ["onKeydown", "modelValue", "onUpdate:modelValue", "size", "placeholder", "maxlength"])) : e.type === "select" ? (a(), s(b, c({
|
|
207
|
+
default: i(() => [
|
|
208
|
+
t.type === "input" ? (n(), _("div", K)) : t.type === "select" ? (n(), s(p, c({
|
|
180
209
|
key: 1,
|
|
181
210
|
filterable: "",
|
|
182
|
-
modelValue:
|
|
183
|
-
"onUpdate:modelValue": (
|
|
184
|
-
size:
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
key: o.value,
|
|
192
|
-
label: o.desc,
|
|
193
|
-
value: o.value
|
|
211
|
+
modelValue: o.queryParams[t.prop],
|
|
212
|
+
"onUpdate:modelValue": (a) => o.queryParams[t.prop] = a,
|
|
213
|
+
size: r.size
|
|
214
|
+
}, t.selectSetting || o.selectSetting), {
|
|
215
|
+
default: i(() => [
|
|
216
|
+
(n(!0), _(z, null, g(t.option || [], (a) => (n(), s(f, {
|
|
217
|
+
key: a.value,
|
|
218
|
+
label: a.desc,
|
|
219
|
+
value: a.value
|
|
194
220
|
}, null, 8, ["label", "value"]))), 128))
|
|
195
221
|
]),
|
|
196
222
|
_: 2
|
|
197
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "size"
|
|
223
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "size"])) : t.type === "cascader" ? (n(), s(m, c({
|
|
198
224
|
key: 2,
|
|
199
225
|
filterable: "",
|
|
200
|
-
modelValue:
|
|
201
|
-
"onUpdate:modelValue": (
|
|
202
|
-
size:
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
placeholder: e.placeholder || l.selectSetting.placeholder
|
|
206
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "size", "options", "placeholder"])) : e.type === "date-picker" ? (a(), s(v, c({
|
|
226
|
+
modelValue: o.queryParams[t.prop],
|
|
227
|
+
"onUpdate:modelValue": (a) => o.queryParams[t.prop] = a,
|
|
228
|
+
size: r.size,
|
|
229
|
+
options: t.options || []
|
|
230
|
+
}, t.selectSetting || o.selectSetting), null, 16, ["modelValue", "onUpdate:modelValue", "size", "options"])) : t.type === "date-picker" ? (n(), s(b, c({
|
|
207
231
|
key: 3,
|
|
208
|
-
modelValue:
|
|
209
|
-
"onUpdate:modelValue": (
|
|
210
|
-
size:
|
|
211
|
-
},
|
|
212
|
-
|
|
213
|
-
"end-placeholder": e["end-placeholder"] || l.datePackerSetting["end-placeholder"],
|
|
214
|
-
"value-format": e["value-format"]
|
|
215
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "size", "start-placeholder", "end-placeholder", "value-format"])) : i("", !0),
|
|
216
|
-
e.type === "input-number" ? (a(), s(U, c({
|
|
232
|
+
modelValue: o.queryParams[t.prop],
|
|
233
|
+
"onUpdate:modelValue": (a) => o.queryParams[t.prop] = a,
|
|
234
|
+
size: r.size
|
|
235
|
+
}, t.datePackerSetting || o.datePackerSetting), null, 16, ["modelValue", "onUpdate:modelValue", "size"])) : d("", !0),
|
|
236
|
+
t.type === "input-number" ? (n(), s(w, c({
|
|
217
237
|
key: 4,
|
|
218
|
-
modelValue:
|
|
219
|
-
"onUpdate:modelValue": (
|
|
220
|
-
size:
|
|
221
|
-
},
|
|
222
|
-
min: e.min,
|
|
223
|
-
max: e.max,
|
|
224
|
-
"controls-position": e["controls-position"],
|
|
225
|
-
"step-strictly": e["step-strictly"]
|
|
226
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "size", "min", "max", "controls-position", "step-strictly"])) : i("", !0)
|
|
238
|
+
modelValue: o.queryParams[t.prop],
|
|
239
|
+
"onUpdate:modelValue": (a) => o.queryParams[t.prop] = a,
|
|
240
|
+
size: r.size
|
|
241
|
+
}, t.inputSetting || e.inputSetting), null, 16, ["modelValue", "onUpdate:modelValue", "size"])) : d("", !0)
|
|
227
242
|
]),
|
|
228
243
|
_: 2
|
|
229
244
|
}, 1032, ["label", "prop", "rules"]))), 128)),
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
default:
|
|
233
|
-
k(
|
|
245
|
+
L(e.$slots, "default"),
|
|
246
|
+
r.formOnly ? d("", !0) : (n(), s(P, { key: 0 }, {
|
|
247
|
+
default: i(() => [
|
|
248
|
+
k(q, {
|
|
234
249
|
type: "primary",
|
|
235
250
|
icon: "el-icon-search",
|
|
236
|
-
size:
|
|
237
|
-
onClick:
|
|
251
|
+
size: r.size,
|
|
252
|
+
onClick: h.handleQuery
|
|
238
253
|
}, {
|
|
239
|
-
default:
|
|
254
|
+
default: i(() => [
|
|
240
255
|
V("查询")
|
|
241
256
|
]),
|
|
242
257
|
_: 1
|
|
243
258
|
}, 8, ["size", "onClick"]),
|
|
244
|
-
k(
|
|
259
|
+
k(q, {
|
|
245
260
|
icon: "el-icon-refresh",
|
|
246
|
-
size:
|
|
247
|
-
onClick:
|
|
261
|
+
size: r.size,
|
|
262
|
+
onClick: h.resetQuery
|
|
248
263
|
}, {
|
|
249
|
-
default:
|
|
264
|
+
default: i(() => [
|
|
250
265
|
V("重置")
|
|
251
266
|
]),
|
|
252
267
|
_: 1
|
|
@@ -257,10 +272,10 @@ function L(r, n, t, h, l, d) {
|
|
|
257
272
|
]),
|
|
258
273
|
_: 3
|
|
259
274
|
}, 16, ["model", "label-width"])), [
|
|
260
|
-
[
|
|
275
|
+
[O, r.showSearch]
|
|
261
276
|
]);
|
|
262
277
|
}
|
|
263
|
-
const
|
|
278
|
+
const j = /* @__PURE__ */ S(G, [["render", N]]), E = j;
|
|
264
279
|
export {
|
|
265
280
|
E as VGeneralBasicForm
|
|
266
281
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.Index={},s.Vue))})(this,function(s,e){"use strict";const
|
|
1
|
+
(function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.Index={},s.Vue))})(this,function(s,e){"use strict";const h=e.defineComponent({components:{InputArchive:t=>{const{templateEle:l}=t;return l()}},props:{item:null,queryParams:{type:[Object,String],required:!0},getList:{type:Function,required:!0},size:{type:String,required:!0}},data(){return{inputSetting:{placeholder:"请输入",style:"width: 200px",clearable:!0}}},created(){console.log("new")},methods:{currentInputComponent(){return"input-archive"}},watch:{item(t){console.log(t)},size(t){console.log(t)}}}),u=(t,l)=>{const r=t.__vccOpts||t;for(const[p,n]of l)r[p]=n;return r};function k(t,l,r,p,n,m){const d=e.resolveComponent("el-input");return e.openBlock(),e.createBlock(d,e.mergeProps({onKeydown:e.withKeys(t.getList,["enter"]),modelValue:t.queryParams[t.item.prop],"onUpdate:modelValue":l[0]||(l[0]=i=>t.queryParams[t.item.prop]=i),size:t.size},t.item.inputSetting||t.inputSetting),e.createSlots({_:2},[e.renderList(t.item.template,(i,c)=>({name:c,fn:e.withCtx(()=>[i?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.currentInputComponent()),{key:c,templateEle:i},null,8,["templateEle"])):e.createCommentVNode("",!0)])}))]),1040,["onKeydown","modelValue","size"])}const _={name:"GeneralBasicForm",components:{Input:u(h,[["render",k]])},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(){var t;return{queryParams:{...this.noUrlParameters?{}:(t=this.$route)==null?void 0:t.query},selectSetting:{placeholder:"请选择",clearable:!0,style:"width: 200px"},datePackerSetting:{style:"width: 227px","start-placeholder":"开始日期","end-placeholder":"结束日期",type:"daterange"}}},watch:{formData(t){this.queryParams={...this.noUrlParameters?{}:this.queryParams,...t}}},methods:{handleQuery(){var r;const t={page:1,limit:10},l={...(r=this.$route)==null?void 0:r.query,...this.queryParams,...t};this.noUrlParameters||this.$router.push({query:{...l}}),this.getList({...l})},async resetQuery(){var l;this.$refs.queryFormRef.resetFields();const t={page:1};this.noUrlParameters||await this.$router.push({query:{...t}}),this.queryParams={...this.noUrlParameters?{}:(l=this.$route)==null?void 0:l.query},this.afterReset(),this.handleQuery()}}},g={key:0};function B(t,l,r,p,n,m){const d=e.resolveComponent("el-option"),i=e.resolveComponent("el-select"),c=e.resolveComponent("el-cascader"),V=e.resolveComponent("el-date-picker"),q=e.resolveComponent("el-input-number"),y=e.resolveComponent("el-form-item"),f=e.resolveComponent("el-button"),C=e.resolveComponent("el-form");return e.withDirectives((e.openBlock(),e.createBlock(C,e.mergeProps({model:n.queryParams,ref:"queryFormRef",inline:"","label-position":"left","label-width":r.labelWidth},t.$attrs),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.formItem,o=>(e.openBlock(),e.createBlock(y,{label:o.label,prop:o.prop,key:o.prop,rules:o.rules},{default:e.withCtx(()=>[o.type==="input"?(e.openBlock(),e.createElementBlock("div",g)):o.type==="select"?(e.openBlock(),e.createBlock(i,e.mergeProps({key:1,filterable:"",modelValue:n.queryParams[o.prop],"onUpdate:modelValue":a=>n.queryParams[o.prop]=a,size:r.size},o.selectSetting||n.selectSetting),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.option||[],a=>(e.openBlock(),e.createBlock(d,{key:a.value,label:a.desc,value:a.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","size"])):o.type==="cascader"?(e.openBlock(),e.createBlock(c,e.mergeProps({key:2,filterable:"",modelValue:n.queryParams[o.prop],"onUpdate:modelValue":a=>n.queryParams[o.prop]=a,size:r.size,options:o.options||[]},o.selectSetting||n.selectSetting),null,16,["modelValue","onUpdate:modelValue","size","options"])):o.type==="date-picker"?(e.openBlock(),e.createBlock(V,e.mergeProps({key:3,modelValue:n.queryParams[o.prop],"onUpdate:modelValue":a=>n.queryParams[o.prop]=a,size:r.size},o.datePackerSetting||n.datePackerSetting),null,16,["modelValue","onUpdate:modelValue","size"])):e.createCommentVNode("",!0),o.type==="input-number"?(e.openBlock(),e.createBlock(q,e.mergeProps({key:4,modelValue:n.queryParams[o.prop],"onUpdate:modelValue":a=>n.queryParams[o.prop]=a,size:r.size},o.inputSetting||t.inputSetting),null,16,["modelValue","onUpdate:modelValue","size"])):e.createCommentVNode("",!0)]),_:2},1032,["label","prop","rules"]))),128)),e.renderSlot(t.$slots,"default"),r.formOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(y,{key:0},{default:e.withCtx(()=>[e.createVNode(f,{type:"primary",icon:"el-icon-search",size:r.size,onClick:m.handleQuery},{default:e.withCtx(()=>[e.createTextVNode("查询")]),_:1},8,["size","onClick"]),e.createVNode(f,{icon:"el-icon-refresh",size:r.size,onClick:m.resetQuery},{default:e.withCtx(()=>[e.createTextVNode("重置")]),_:1},8,["size","onClick"])]),_:1}))]),_:3},16,["model","label-width"])),[[e.vShow,r.showSearch]])}const P=u(_,[["render",B]]);s.VGeneralBasicForm=P,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,48 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "general-basic-form",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "general-basic-form",
|
|
3
|
+
"version": "2.0.3",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist/index.umd.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "cross-env CURRENT_ENV=prod run-p type-check build-only",
|
|
8
|
+
"test:e2e": "playwright test",
|
|
9
|
+
"build-only": "vite build",
|
|
10
|
+
"type-check": "tsc --noEmit -p tsconfig.json --composite false",
|
|
11
|
+
"link": "tsx script/link.ts && yarn link",
|
|
12
|
+
"unlink": "tsx script/unlink.ts && yarn unlink"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"general-basic-form",
|
|
16
|
+
"form",
|
|
17
|
+
"vue",
|
|
18
|
+
"vue2",
|
|
19
|
+
"vue3",
|
|
20
|
+
"element-plus"
|
|
21
|
+
],
|
|
22
|
+
"author": "chendeli419287484@qq.com",
|
|
23
|
+
"license": "ISC",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/Alan1034/GeneralBasicForm.git"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@playwright/test": "^1.36.1",
|
|
30
|
+
"@types/node": "^20.8.10",
|
|
31
|
+
"@vitejs/plugin-legacy": "^4.1.1",
|
|
32
|
+
"@vitejs/plugin-vue": "^4.2.3",
|
|
33
|
+
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
|
34
|
+
"cross-env": "^7.0.3",
|
|
35
|
+
"chalk": "^2.4.2",
|
|
36
|
+
"npm-run-all": "^4.1.5",
|
|
37
|
+
"tsx": "^4.0.0",
|
|
38
|
+
"typescript": "^5.2.2",
|
|
39
|
+
"vite-plugin-image-optimizer": "^1.1.6"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"element-plus": ">=2.4.2",
|
|
43
|
+
"vue": ">=3.3.4",
|
|
44
|
+
"vue-router": ">=4.2.4"
|
|
45
|
+
},
|
|
46
|
+
"module": "./dist/index.mjs",
|
|
47
|
+
"exports": {
|
|
48
|
+
".": {
|
|
49
|
+
"import": "./dist/index.mjs",
|
|
50
|
+
"require": "./dist/index.umd.js"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"typings": "./dist/index.d.ts",
|
|
54
|
+
"files": [
|
|
55
|
+
"/dist"
|
|
56
|
+
]
|
|
57
|
+
}
|
package/dist/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.el-form-item[data-v-279f95d9]{margin-bottom:2px!important}
|