jianghu-ui 1.0.1
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 +376 -0
- package/dist/jianghu-ui.css +2318 -0
- package/dist/jianghu-ui.js +2 -0
- package/dist/jianghu-ui.js.LICENSE.txt +1 -0
- package/package.json +56 -0
- package/src/Design.stories.mdx +195 -0
- package/src/Introduction.stories.mdx +148 -0
- package/src/components/JhAddressSelect/JhAddressSelect.md +250 -0
- package/src/components/JhAddressSelect/JhAddressSelect.stories.js +282 -0
- package/src/components/JhAddressSelect/JhAddressSelect.vue +261 -0
- package/src/components/JhCard/JhCard.md +246 -0
- package/src/components/JhCard/JhCard.stories.js +688 -0
- package/src/components/JhCard/JhCard.vue +604 -0
- package/src/components/JhCheckCard/JhCheckCard.md +245 -0
- package/src/components/JhCheckCard/JhCheckCard.stories.js +750 -0
- package/src/components/JhCheckCard/JhCheckCard.vue +476 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.md +70 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.stories.js +550 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.vue +181 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.md +56 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.stories.js +320 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.vue +307 -0
- package/src/components/JhDescriptions/JhDescriptions.md +724 -0
- package/src/components/JhDescriptions/JhDescriptions.stories.js +858 -0
- package/src/components/JhDescriptions/JhDescriptions.vue +933 -0
- package/src/components/JhDraggable/JhDraggable.md +66 -0
- package/src/components/JhDraggable/JhDraggable.stories.js +161 -0
- package/src/components/JhDraggable/JhDraggable.vue +254 -0
- package/src/components/JhDrawer/JhDrawer.md +68 -0
- package/src/components/JhDrawer/JhDrawer.stories.js +478 -0
- package/src/components/JhDrawer/JhDrawer.vue +281 -0
- package/src/components/JhDrawerForm/JhDrawerForm.md +69 -0
- package/src/components/JhDrawerForm/JhDrawerForm.stories.js +492 -0
- package/src/components/JhDrawerForm/JhDrawerForm.vue +297 -0
- package/src/components/JhEditableTable/JhEditableTable.md +507 -0
- package/src/components/JhEditableTable/JhEditableTable.stories.js +615 -0
- package/src/components/JhEditableTable/JhEditableTable.vue +685 -0
- package/src/components/JhFileInput/JhFileInput.md +56 -0
- package/src/components/JhFileInput/JhFileInput.stories.js +103 -0
- package/src/components/JhFileInput/JhFileInput.vue +253 -0
- package/src/components/JhForm/JhForm.md +676 -0
- package/src/components/JhForm/JhForm.stories.js +1375 -0
- package/src/components/JhForm/JhForm.vue +657 -0
- package/src/components/JhFormField/JhFormField.stories.js +217 -0
- package/src/components/JhFormField/JhFormField.vue +439 -0
- package/src/components/JhFormFields/JhFormFields.md +647 -0
- package/src/components/JhFormFields/JhFormFields.stories.js +922 -0
- package/src/components/JhFormFields/JhFormFields.vue +998 -0
- package/src/components/JhFormList/JhFormList.md +303 -0
- package/src/components/JhFormList/JhFormList.stories.js +661 -0
- package/src/components/JhFormList/JhFormList.vue +1127 -0
- package/src/components/JhJsonEditor/JhJsonEditor.md +54 -0
- package/src/components/JhJsonEditor/JhJsonEditor.stories.js +157 -0
- package/src/components/JhJsonEditor/JhJsonEditor.vue +178 -0
- package/src/components/JhLayout/JhLayout.md +580 -0
- package/src/components/JhLayout/JhLayout.stories.js +414 -0
- package/src/components/JhLayout/JhLayout.vue +387 -0
- package/src/components/JhList/JhList.md +441 -0
- package/src/components/JhList/JhList.stories.js +524 -0
- package/src/components/JhList/JhList.vue +571 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.md +56 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.stories.js +191 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.vue +188 -0
- package/src/components/JhMask/JhMask.md +62 -0
- package/src/components/JhMask/JhMask.stories.js +270 -0
- package/src/components/JhMask/JhMask.vue +123 -0
- package/src/components/JhMenu/JhMenu.md +85 -0
- package/src/components/JhMenu/JhMenu.stories.js +384 -0
- package/src/components/JhMenu/JhMenu.vue +545 -0
- package/src/components/JhModal/JhModal.md +68 -0
- package/src/components/JhModal/JhModal.stories.js +562 -0
- package/src/components/JhModal/JhModal.vue +235 -0
- package/src/components/JhModalForm/JhModalForm.md +69 -0
- package/src/components/JhModalForm/JhModalForm.stories.js +592 -0
- package/src/components/JhModalForm/JhModalForm.vue +298 -0
- package/src/components/JhPageContainer/JhPageContainer.md +409 -0
- package/src/components/JhPageContainer/JhPageContainer.stories.js +209 -0
- package/src/components/JhPageContainer/JhPageContainer.vue +72 -0
- package/src/components/JhQueryFilter/JhQueryFilter.md +77 -0
- package/src/components/JhQueryFilter/JhQueryFilter.stories.js +684 -0
- package/src/components/JhQueryFilter/JhQueryFilter.vue +429 -0
- package/src/components/JhScene/JhScene.md +64 -0
- package/src/components/JhScene/JhScene.stories.js +317 -0
- package/src/components/JhScene/JhScene.vue +376 -0
- package/src/components/JhStatisticCard/JhStatisticCard.md +363 -0
- package/src/components/JhStatisticCard/JhStatisticCard.stories.js +847 -0
- package/src/components/JhStatisticCard/JhStatisticCard.vue +459 -0
- package/src/components/JhStepsForm/JhStepsForm.md +666 -0
- package/src/components/JhStepsForm/JhStepsForm.stories.js +1224 -0
- package/src/components/JhStepsForm/JhStepsForm.vue +749 -0
- package/src/components/JhTable/JhTable.md +730 -0
- package/src/components/JhTable/JhTable.stories.js +1444 -0
- package/src/components/JhTable/JhTable.vue +2298 -0
- package/src/components/JhTableAttachment/JhTableAttachment.md +70 -0
- package/src/components/JhTableAttachment/JhTableAttachment.stories.js +198 -0
- package/src/components/JhTableAttachment/JhTableAttachment.vue +264 -0
- package/src/components/JhToast/JhToast.md +67 -0
- package/src/components/JhToast/JhToast.stories.js +386 -0
- package/src/components/JhToast/JhToast.vue +239 -0
- package/src/components/JhTreeSelect/JhTreeSelect.md +82 -0
- package/src/components/JhTreeSelect/JhTreeSelect.stories.js +391 -0
- package/src/components/JhTreeSelect/JhTreeSelect.vue +727 -0
- package/src/components/JhWaterMark/JhWaterMark.md +190 -0
- package/src/components/JhWaterMark/JhWaterMark.stories.js +675 -0
- package/src/components/JhWaterMark/JhWaterMark.vue +351 -0
- package/src/components/README.md +52 -0
- package/src/index.js +135 -0
- package/src/style/globalCSSJHV4.css +348 -0
- package/src/style/globalCSSVuetifyV4.css +637 -0
- package/src/style/storybook.css +4 -0
- package/src/tailwind.css +3 -0
- package/src/utils/vuetify.js +31 -0
|
@@ -0,0 +1,1224 @@
|
|
|
1
|
+
import JhStepsForm from './JhStepsForm.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: '数据录入/JhStepsForm - 分步表单',
|
|
5
|
+
component: JhStepsForm,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
argTypes: {
|
|
8
|
+
steps: {
|
|
9
|
+
control: 'object',
|
|
10
|
+
description: '步骤配置数组',
|
|
11
|
+
},
|
|
12
|
+
initialStep: {
|
|
13
|
+
control: 'number',
|
|
14
|
+
description: '初始步骤索引 (从0开始)',
|
|
15
|
+
},
|
|
16
|
+
editable: {
|
|
17
|
+
control: 'boolean',
|
|
18
|
+
description: '是否可编辑已完成的步骤',
|
|
19
|
+
},
|
|
20
|
+
vertical: {
|
|
21
|
+
control: 'boolean',
|
|
22
|
+
description: '是否垂直布局',
|
|
23
|
+
},
|
|
24
|
+
altLabels: {
|
|
25
|
+
control: 'boolean',
|
|
26
|
+
description: '是否替代标签模式',
|
|
27
|
+
},
|
|
28
|
+
outlined: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: '输入框样式',
|
|
31
|
+
},
|
|
32
|
+
dense: {
|
|
33
|
+
control: 'boolean',
|
|
34
|
+
description: '紧凑模式',
|
|
35
|
+
},
|
|
36
|
+
submitting: {
|
|
37
|
+
control: 'boolean',
|
|
38
|
+
description: '提交中状态',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// 基础示例
|
|
44
|
+
export const 基础示例 = {
|
|
45
|
+
render: (args) => ({
|
|
46
|
+
components: { JhStepsForm },
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
steps: [
|
|
50
|
+
{
|
|
51
|
+
title: '基本信息',
|
|
52
|
+
subTitle: '填写您的基本信息',
|
|
53
|
+
fields: [
|
|
54
|
+
{
|
|
55
|
+
name: 'username',
|
|
56
|
+
label: '用户名',
|
|
57
|
+
type: 'text',
|
|
58
|
+
placeholder: '请输入用户名',
|
|
59
|
+
required: true,
|
|
60
|
+
cols: 12,
|
|
61
|
+
md: 6,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'email',
|
|
65
|
+
label: '邮箱',
|
|
66
|
+
type: 'email',
|
|
67
|
+
placeholder: '请输入邮箱',
|
|
68
|
+
required: true,
|
|
69
|
+
cols: 12,
|
|
70
|
+
md: 6,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'phone',
|
|
74
|
+
label: '手机号',
|
|
75
|
+
type: 'tel',
|
|
76
|
+
placeholder: '请输入手机号',
|
|
77
|
+
required: true,
|
|
78
|
+
cols: 12,
|
|
79
|
+
md: 6,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'gender',
|
|
83
|
+
label: '性别',
|
|
84
|
+
type: 'radio',
|
|
85
|
+
options: [
|
|
86
|
+
{ text: '男', value: 'male' },
|
|
87
|
+
{ text: '女', value: 'female' },
|
|
88
|
+
],
|
|
89
|
+
default: 'male',
|
|
90
|
+
cols: 12,
|
|
91
|
+
md: 6,
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
title: '详细信息',
|
|
97
|
+
subTitle: '完善您的详细资料',
|
|
98
|
+
fields: [
|
|
99
|
+
{
|
|
100
|
+
name: 'address',
|
|
101
|
+
label: '地址',
|
|
102
|
+
type: 'text',
|
|
103
|
+
placeholder: '请输入详细地址',
|
|
104
|
+
required: true,
|
|
105
|
+
cols: 12,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'city',
|
|
109
|
+
label: '城市',
|
|
110
|
+
type: 'select',
|
|
111
|
+
placeholder: '请选择城市',
|
|
112
|
+
options: [
|
|
113
|
+
{ text: '北京市', value: 'beijing' },
|
|
114
|
+
{ text: '上海市', value: 'shanghai' },
|
|
115
|
+
{ text: '广州市', value: 'guangzhou' },
|
|
116
|
+
{ text: '深圳市', value: 'shenzhen' },
|
|
117
|
+
],
|
|
118
|
+
required: true,
|
|
119
|
+
cols: 12,
|
|
120
|
+
md: 6,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'birthdate',
|
|
124
|
+
label: '出生日期',
|
|
125
|
+
type: 'date',
|
|
126
|
+
placeholder: '请选择出生日期',
|
|
127
|
+
cols: 12,
|
|
128
|
+
md: 6,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: 'description',
|
|
132
|
+
label: '个人简介',
|
|
133
|
+
type: 'textarea',
|
|
134
|
+
placeholder: '请输入个人简介',
|
|
135
|
+
rows: 4,
|
|
136
|
+
cols: 12,
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
title: '确认信息',
|
|
142
|
+
subTitle: '请确认您填写的信息',
|
|
143
|
+
slot: 'step-confirm',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
formData: {},
|
|
147
|
+
};
|
|
148
|
+
},
|
|
149
|
+
template: `
|
|
150
|
+
<v-container>
|
|
151
|
+
<jh-steps-form
|
|
152
|
+
v-bind="$props"
|
|
153
|
+
:steps="steps"
|
|
154
|
+
@finish="handleFinish"
|
|
155
|
+
@change="handleChange"
|
|
156
|
+
>
|
|
157
|
+
<template #step-confirm="{ formData }">
|
|
158
|
+
<v-simple-table>
|
|
159
|
+
<template v-slot:default>
|
|
160
|
+
<tbody>
|
|
161
|
+
<tr v-for="(value, key) in formData.step0 || {}" :key="'step0-' + key">
|
|
162
|
+
<td class="font-weight-bold">{{ key }}</td>
|
|
163
|
+
<td>{{ value }}</td>
|
|
164
|
+
</tr>
|
|
165
|
+
<tr v-for="(value, key) in formData.step1 || {}" :key="'step1-' + key">
|
|
166
|
+
<td class="font-weight-bold">{{ key }}</td>
|
|
167
|
+
<td>{{ value }}</td>
|
|
168
|
+
</tr>
|
|
169
|
+
</tbody>
|
|
170
|
+
</template>
|
|
171
|
+
</v-simple-table>
|
|
172
|
+
</template>
|
|
173
|
+
</jh-steps-form>
|
|
174
|
+
</v-container>
|
|
175
|
+
`,
|
|
176
|
+
methods: {
|
|
177
|
+
handleFinish(data) {
|
|
178
|
+
console.log('完成表单:', data);
|
|
179
|
+
alert('表单提交成功!请查看控制台');
|
|
180
|
+
},
|
|
181
|
+
handleChange(data) {
|
|
182
|
+
this.formData = data;
|
|
183
|
+
console.log('表单数据变化:', data);
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
}),
|
|
187
|
+
args: {
|
|
188
|
+
editable: false,
|
|
189
|
+
vertical: false,
|
|
190
|
+
altLabels: false,
|
|
191
|
+
outlined: true,
|
|
192
|
+
dense: false,
|
|
193
|
+
submitting: false,
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// 垂直布局
|
|
198
|
+
export const 垂直布局 = {
|
|
199
|
+
render: (args) => ({
|
|
200
|
+
components: { JhStepsForm },
|
|
201
|
+
data() {
|
|
202
|
+
return {
|
|
203
|
+
steps: [
|
|
204
|
+
{
|
|
205
|
+
title: '步骤1',
|
|
206
|
+
subTitle: '基础信息',
|
|
207
|
+
fields: [
|
|
208
|
+
{
|
|
209
|
+
name: 'name',
|
|
210
|
+
label: '姓名',
|
|
211
|
+
type: 'text',
|
|
212
|
+
required: true,
|
|
213
|
+
cols: 12,
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: 'age',
|
|
217
|
+
label: '年龄',
|
|
218
|
+
type: 'number',
|
|
219
|
+
cols: 12,
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
title: '步骤2',
|
|
225
|
+
subTitle: '联系方式',
|
|
226
|
+
fields: [
|
|
227
|
+
{
|
|
228
|
+
name: 'email',
|
|
229
|
+
label: '邮箱',
|
|
230
|
+
type: 'email',
|
|
231
|
+
required: true,
|
|
232
|
+
cols: 12,
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: 'phone',
|
|
236
|
+
label: '手机',
|
|
237
|
+
type: 'tel',
|
|
238
|
+
cols: 12,
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
title: '步骤3',
|
|
244
|
+
subTitle: '完成',
|
|
245
|
+
slot: 'step-finish',
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
};
|
|
249
|
+
},
|
|
250
|
+
template: `
|
|
251
|
+
<v-container>
|
|
252
|
+
<jh-steps-form
|
|
253
|
+
v-bind="$props"
|
|
254
|
+
:steps="steps"
|
|
255
|
+
vertical
|
|
256
|
+
@finish="handleFinish"
|
|
257
|
+
>
|
|
258
|
+
<template #step-finish>
|
|
259
|
+
<v-alert type="success" text>
|
|
260
|
+
所有信息已填写完成,点击完成按钮提交表单
|
|
261
|
+
</v-alert>
|
|
262
|
+
</template>
|
|
263
|
+
</jh-steps-form>
|
|
264
|
+
</v-container>
|
|
265
|
+
`,
|
|
266
|
+
methods: {
|
|
267
|
+
handleFinish(data) {
|
|
268
|
+
console.log('完成表单:', data);
|
|
269
|
+
alert('表单提交成功!');
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
}),
|
|
273
|
+
args: {},
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
// 可编辑步骤
|
|
277
|
+
export const 可编辑步骤 = {
|
|
278
|
+
render: (args) => ({
|
|
279
|
+
components: { JhStepsForm },
|
|
280
|
+
data() {
|
|
281
|
+
return {
|
|
282
|
+
steps: [
|
|
283
|
+
{
|
|
284
|
+
title: '账户信息',
|
|
285
|
+
fields: [
|
|
286
|
+
{
|
|
287
|
+
name: 'username',
|
|
288
|
+
label: '用户名',
|
|
289
|
+
type: 'text',
|
|
290
|
+
required: true,
|
|
291
|
+
cols: 12,
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: 'password',
|
|
295
|
+
label: '密码',
|
|
296
|
+
type: 'password',
|
|
297
|
+
required: true,
|
|
298
|
+
cols: 12,
|
|
299
|
+
},
|
|
300
|
+
],
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
title: '个人信息',
|
|
304
|
+
fields: [
|
|
305
|
+
{
|
|
306
|
+
name: 'realname',
|
|
307
|
+
label: '真实姓名',
|
|
308
|
+
type: 'text',
|
|
309
|
+
required: true,
|
|
310
|
+
cols: 12,
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
name: 'phone',
|
|
314
|
+
label: '手机号',
|
|
315
|
+
type: 'tel',
|
|
316
|
+
required: true,
|
|
317
|
+
cols: 12,
|
|
318
|
+
},
|
|
319
|
+
],
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
title: '其他信息',
|
|
323
|
+
fields: [
|
|
324
|
+
{
|
|
325
|
+
name: 'company',
|
|
326
|
+
label: '公司',
|
|
327
|
+
type: 'text',
|
|
328
|
+
cols: 12,
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
name: 'position',
|
|
332
|
+
label: '职位',
|
|
333
|
+
type: 'text',
|
|
334
|
+
cols: 12,
|
|
335
|
+
},
|
|
336
|
+
],
|
|
337
|
+
},
|
|
338
|
+
],
|
|
339
|
+
};
|
|
340
|
+
},
|
|
341
|
+
template: `
|
|
342
|
+
<v-container>
|
|
343
|
+
<v-alert type="info" text class="mb-4">
|
|
344
|
+
开启了可编辑模式,您可以点击已完成的步骤标题返回修改
|
|
345
|
+
</v-alert>
|
|
346
|
+
<jh-steps-form
|
|
347
|
+
v-bind="$props"
|
|
348
|
+
:steps="steps"
|
|
349
|
+
editable
|
|
350
|
+
@finish="handleFinish"
|
|
351
|
+
/>
|
|
352
|
+
</v-container>
|
|
353
|
+
`,
|
|
354
|
+
methods: {
|
|
355
|
+
handleFinish(data) {
|
|
356
|
+
console.log('完成表单:', data);
|
|
357
|
+
alert('表单提交成功!');
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
}),
|
|
361
|
+
args: {},
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
// 自定义内容
|
|
365
|
+
export const 自定义内容 = {
|
|
366
|
+
render: (args) => ({
|
|
367
|
+
components: { JhStepsForm },
|
|
368
|
+
data() {
|
|
369
|
+
return {
|
|
370
|
+
steps: [
|
|
371
|
+
{
|
|
372
|
+
title: '选择方案',
|
|
373
|
+
slot: 'step-plan',
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
title: '填写信息',
|
|
377
|
+
fields: [
|
|
378
|
+
{
|
|
379
|
+
name: 'name',
|
|
380
|
+
label: '姓名',
|
|
381
|
+
type: 'text',
|
|
382
|
+
required: true,
|
|
383
|
+
cols: 12,
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
name: 'email',
|
|
387
|
+
label: '邮箱',
|
|
388
|
+
type: 'email',
|
|
389
|
+
required: true,
|
|
390
|
+
cols: 12,
|
|
391
|
+
},
|
|
392
|
+
],
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
title: '支付',
|
|
396
|
+
slot: 'step-payment',
|
|
397
|
+
},
|
|
398
|
+
],
|
|
399
|
+
selectedPlan: '',
|
|
400
|
+
paymentMethod: '',
|
|
401
|
+
};
|
|
402
|
+
},
|
|
403
|
+
template: `
|
|
404
|
+
<v-container>
|
|
405
|
+
<jh-steps-form
|
|
406
|
+
v-bind="$props"
|
|
407
|
+
:steps="steps"
|
|
408
|
+
@finish="handleFinish"
|
|
409
|
+
>
|
|
410
|
+
<template #step-plan>
|
|
411
|
+
<v-row>
|
|
412
|
+
<v-col cols="12" md="4" v-for="plan in plans" :key="plan.value">
|
|
413
|
+
<v-card
|
|
414
|
+
:outlined="selectedPlan !== plan.value"
|
|
415
|
+
:elevation="selectedPlan === plan.value ? 4 : 0"
|
|
416
|
+
@click="selectedPlan = plan.value"
|
|
417
|
+
class="cursor-pointer"
|
|
418
|
+
>
|
|
419
|
+
<v-card-title>{{ plan.name }}</v-card-title>
|
|
420
|
+
<v-card-subtitle>{{ plan.price }}</v-card-subtitle>
|
|
421
|
+
<v-card-text>
|
|
422
|
+
<v-list dense>
|
|
423
|
+
<v-list-item v-for="(feature, index) in plan.features" :key="index">
|
|
424
|
+
<v-list-item-icon>
|
|
425
|
+
<v-icon small color="success">mdi-check</v-icon>
|
|
426
|
+
</v-list-item-icon>
|
|
427
|
+
<v-list-item-content>
|
|
428
|
+
<v-list-item-title>{{ feature }}</v-list-item-title>
|
|
429
|
+
</v-list-item-content>
|
|
430
|
+
</v-list-item>
|
|
431
|
+
</v-list>
|
|
432
|
+
</v-card-text>
|
|
433
|
+
</v-card>
|
|
434
|
+
</v-col>
|
|
435
|
+
</v-row>
|
|
436
|
+
</template>
|
|
437
|
+
|
|
438
|
+
<template #step-payment>
|
|
439
|
+
<v-radio-group v-model="paymentMethod">
|
|
440
|
+
<v-radio label="支付宝" value="alipay"></v-radio>
|
|
441
|
+
<v-radio label="微信支付" value="wechat"></v-radio>
|
|
442
|
+
<v-radio label="银行卡" value="bank"></v-radio>
|
|
443
|
+
</v-radio-group>
|
|
444
|
+
</template>
|
|
445
|
+
</jh-steps-form>
|
|
446
|
+
</v-container>
|
|
447
|
+
`,
|
|
448
|
+
computed: {
|
|
449
|
+
plans() {
|
|
450
|
+
return [
|
|
451
|
+
{
|
|
452
|
+
value: 'basic',
|
|
453
|
+
name: '基础版',
|
|
454
|
+
price: '¥99/月',
|
|
455
|
+
features: ['5个用户', '10GB存储', '基础支持'],
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
value: 'pro',
|
|
459
|
+
name: '专业版',
|
|
460
|
+
price: '¥299/月',
|
|
461
|
+
features: ['20个用户', '100GB存储', '优先支持', '高级功能'],
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
value: 'enterprise',
|
|
465
|
+
name: '企业版',
|
|
466
|
+
price: '¥999/月',
|
|
467
|
+
features: ['无限用户', '1TB存储', '7x24支持', '全部功能', '定制开发'],
|
|
468
|
+
},
|
|
469
|
+
];
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
methods: {
|
|
473
|
+
handleFinish(data) {
|
|
474
|
+
console.log('完成表单:', {
|
|
475
|
+
...data,
|
|
476
|
+
plan: this.selectedPlan,
|
|
477
|
+
payment: this.paymentMethod,
|
|
478
|
+
});
|
|
479
|
+
alert('订单提交成功!');
|
|
480
|
+
},
|
|
481
|
+
},
|
|
482
|
+
}),
|
|
483
|
+
args: {},
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
// 员工入职
|
|
487
|
+
export const 员工入职 = {
|
|
488
|
+
render: (args) => ({
|
|
489
|
+
components: { JhStepsForm },
|
|
490
|
+
data() {
|
|
491
|
+
return {
|
|
492
|
+
steps: [
|
|
493
|
+
{
|
|
494
|
+
title: '基本信息',
|
|
495
|
+
subTitle: '填写员工基本信息',
|
|
496
|
+
fields: [
|
|
497
|
+
{
|
|
498
|
+
name: 'employeeName',
|
|
499
|
+
label: '员工姓名',
|
|
500
|
+
type: 'text',
|
|
501
|
+
placeholder: '请输入员工姓名',
|
|
502
|
+
required: true,
|
|
503
|
+
cols: 12,
|
|
504
|
+
md: 4,
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
name: 'gender',
|
|
508
|
+
label: '性别',
|
|
509
|
+
type: 'radio',
|
|
510
|
+
options: [
|
|
511
|
+
{ text: '男', value: 'male' },
|
|
512
|
+
{ text: '女', value: 'female' },
|
|
513
|
+
],
|
|
514
|
+
required: true,
|
|
515
|
+
cols: 12,
|
|
516
|
+
md: 4,
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
name: 'birthdate',
|
|
520
|
+
label: '出生日期',
|
|
521
|
+
type: 'date',
|
|
522
|
+
placeholder: '请选择出生日期',
|
|
523
|
+
required: true,
|
|
524
|
+
cols: 12,
|
|
525
|
+
md: 4,
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
name: 'idCard',
|
|
529
|
+
label: '身份证号',
|
|
530
|
+
type: 'text',
|
|
531
|
+
placeholder: '请输入身份证号',
|
|
532
|
+
required: true,
|
|
533
|
+
cols: 12,
|
|
534
|
+
md: 6,
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
name: 'phone',
|
|
538
|
+
label: '手机号码',
|
|
539
|
+
type: 'tel',
|
|
540
|
+
placeholder: '请输入手机号码',
|
|
541
|
+
required: true,
|
|
542
|
+
cols: 12,
|
|
543
|
+
md: 6,
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
name: 'email',
|
|
547
|
+
label: '邮箱地址',
|
|
548
|
+
type: 'email',
|
|
549
|
+
placeholder: '请输入邮箱地址',
|
|
550
|
+
required: true,
|
|
551
|
+
cols: 12,
|
|
552
|
+
},
|
|
553
|
+
],
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
title: '岗位信息',
|
|
557
|
+
subTitle: '设置员工岗位',
|
|
558
|
+
fields: [
|
|
559
|
+
{
|
|
560
|
+
name: 'department',
|
|
561
|
+
label: '所属部门',
|
|
562
|
+
type: 'select',
|
|
563
|
+
placeholder: '请选择部门',
|
|
564
|
+
options: [
|
|
565
|
+
{ text: '技术部', value: 'tech' },
|
|
566
|
+
{ text: '产品部', value: 'product' },
|
|
567
|
+
{ text: '市场部', value: 'marketing' },
|
|
568
|
+
{ text: '销售部', value: 'sales' },
|
|
569
|
+
{ text: '人力资源部', value: 'hr' },
|
|
570
|
+
{ text: '财务部', value: 'finance' },
|
|
571
|
+
],
|
|
572
|
+
required: true,
|
|
573
|
+
cols: 12,
|
|
574
|
+
md: 6,
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
name: 'position',
|
|
578
|
+
label: '职位',
|
|
579
|
+
type: 'text',
|
|
580
|
+
placeholder: '请输入职位',
|
|
581
|
+
required: true,
|
|
582
|
+
cols: 12,
|
|
583
|
+
md: 6,
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
name: 'employeeType',
|
|
587
|
+
label: '员工类型',
|
|
588
|
+
type: 'select',
|
|
589
|
+
options: [
|
|
590
|
+
{ text: '正式员工', value: 'fulltime' },
|
|
591
|
+
{ text: '实习生', value: 'intern' },
|
|
592
|
+
{ text: '外包', value: 'contractor' },
|
|
593
|
+
],
|
|
594
|
+
required: true,
|
|
595
|
+
cols: 12,
|
|
596
|
+
md: 6,
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
name: 'entryDate',
|
|
600
|
+
label: '入职日期',
|
|
601
|
+
type: 'date',
|
|
602
|
+
placeholder: '请选择入职日期',
|
|
603
|
+
required: true,
|
|
604
|
+
cols: 12,
|
|
605
|
+
md: 6,
|
|
606
|
+
},
|
|
607
|
+
],
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
title: '紧急联系人',
|
|
611
|
+
subTitle: '填写紧急联系人信息',
|
|
612
|
+
fields: [
|
|
613
|
+
{
|
|
614
|
+
name: 'emergencyContact',
|
|
615
|
+
label: '联系人姓名',
|
|
616
|
+
type: 'text',
|
|
617
|
+
placeholder: '请输入紧急联系人姓名',
|
|
618
|
+
required: true,
|
|
619
|
+
cols: 12,
|
|
620
|
+
md: 4,
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
name: 'emergencyRelation',
|
|
624
|
+
label: '关系',
|
|
625
|
+
type: 'select',
|
|
626
|
+
placeholder: '请选择关系',
|
|
627
|
+
options: [
|
|
628
|
+
{ text: '父母', value: 'parent' },
|
|
629
|
+
{ text: '配偶', value: 'spouse' },
|
|
630
|
+
{ text: '子女', value: 'child' },
|
|
631
|
+
{ text: '兄弟姐妹', value: 'sibling' },
|
|
632
|
+
{ text: '其他', value: 'other' },
|
|
633
|
+
],
|
|
634
|
+
required: true,
|
|
635
|
+
cols: 12,
|
|
636
|
+
md: 4,
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
name: 'emergencyPhone',
|
|
640
|
+
label: '联系电话',
|
|
641
|
+
type: 'tel',
|
|
642
|
+
placeholder: '请输入紧急联系人电话',
|
|
643
|
+
required: true,
|
|
644
|
+
cols: 12,
|
|
645
|
+
md: 4,
|
|
646
|
+
},
|
|
647
|
+
],
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
title: '确认信息',
|
|
651
|
+
subTitle: '请确认您填写的信息',
|
|
652
|
+
slot: 'step-confirm',
|
|
653
|
+
},
|
|
654
|
+
],
|
|
655
|
+
formData: {},
|
|
656
|
+
};
|
|
657
|
+
},
|
|
658
|
+
template: `
|
|
659
|
+
<v-container>
|
|
660
|
+
<jh-steps-form
|
|
661
|
+
v-bind="$props"
|
|
662
|
+
:steps="steps"
|
|
663
|
+
editable
|
|
664
|
+
@finish="handleFinish"
|
|
665
|
+
@change="handleChange"
|
|
666
|
+
>
|
|
667
|
+
<template #step-confirm="{ formData }">
|
|
668
|
+
<v-row>
|
|
669
|
+
<v-col cols="12">
|
|
670
|
+
<div class="text-h6 mb-4">基本信息</div>
|
|
671
|
+
<v-simple-table>
|
|
672
|
+
<template v-slot:default>
|
|
673
|
+
<tbody>
|
|
674
|
+
<tr v-for="(value, key) in formData.step0 || {}" :key="key">
|
|
675
|
+
<td class="font-weight-bold" width="200">{{ key }}</td>
|
|
676
|
+
<td>{{ value }}</td>
|
|
677
|
+
</tr>
|
|
678
|
+
</tbody>
|
|
679
|
+
</template>
|
|
680
|
+
</v-simple-table>
|
|
681
|
+
</v-col>
|
|
682
|
+
|
|
683
|
+
<v-col cols="12">
|
|
684
|
+
<div class="text-h6 mb-4">岗位信息</div>
|
|
685
|
+
<v-simple-table>
|
|
686
|
+
<template v-slot:default>
|
|
687
|
+
<tbody>
|
|
688
|
+
<tr v-for="(value, key) in formData.step1 || {}" :key="key">
|
|
689
|
+
<td class="font-weight-bold" width="200">{{ key }}</td>
|
|
690
|
+
<td>{{ value }}</td>
|
|
691
|
+
</tr>
|
|
692
|
+
</tbody>
|
|
693
|
+
</template>
|
|
694
|
+
</v-simple-table>
|
|
695
|
+
</v-col>
|
|
696
|
+
|
|
697
|
+
<v-col cols="12">
|
|
698
|
+
<div class="text-h6 mb-4">紧急联系人</div>
|
|
699
|
+
<v-simple-table>
|
|
700
|
+
<template v-slot:default>
|
|
701
|
+
<tbody>
|
|
702
|
+
<tr v-for="(value, key) in formData.step2 || {}" :key="key">
|
|
703
|
+
<td class="font-weight-bold" width="200">{{ key }}</td>
|
|
704
|
+
<td>{{ value }}</td>
|
|
705
|
+
</tr>
|
|
706
|
+
</tbody>
|
|
707
|
+
</template>
|
|
708
|
+
</v-simple-table>
|
|
709
|
+
</v-col>
|
|
710
|
+
</v-row>
|
|
711
|
+
</template>
|
|
712
|
+
</jh-steps-form>
|
|
713
|
+
</v-container>
|
|
714
|
+
`,
|
|
715
|
+
methods: {
|
|
716
|
+
handleFinish(data) {
|
|
717
|
+
console.log('员工入职信息:', data);
|
|
718
|
+
alert('员工入职信息提交成功!请查看控制台');
|
|
719
|
+
},
|
|
720
|
+
handleChange(data) {
|
|
721
|
+
this.formData = data;
|
|
722
|
+
},
|
|
723
|
+
},
|
|
724
|
+
}),
|
|
725
|
+
args: {},
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
// 带验证
|
|
729
|
+
export const 带验证 = {
|
|
730
|
+
render: (args) => ({
|
|
731
|
+
components: { JhStepsForm },
|
|
732
|
+
data() {
|
|
733
|
+
return {
|
|
734
|
+
steps: [
|
|
735
|
+
{
|
|
736
|
+
title: '步骤1',
|
|
737
|
+
fields: [
|
|
738
|
+
{
|
|
739
|
+
name: 'username',
|
|
740
|
+
label: '用户名',
|
|
741
|
+
type: 'text',
|
|
742
|
+
required: true,
|
|
743
|
+
rules: [
|
|
744
|
+
{
|
|
745
|
+
pattern: /^[a-zA-Z0-9_]{3,16}$/,
|
|
746
|
+
message: '用户名为3-16位字母数字下划线',
|
|
747
|
+
},
|
|
748
|
+
],
|
|
749
|
+
cols: 12,
|
|
750
|
+
},
|
|
751
|
+
],
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
title: '步骤2',
|
|
755
|
+
fields: [
|
|
756
|
+
{
|
|
757
|
+
name: 'email',
|
|
758
|
+
label: '邮箱',
|
|
759
|
+
type: 'email',
|
|
760
|
+
required: true,
|
|
761
|
+
cols: 12,
|
|
762
|
+
},
|
|
763
|
+
],
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
title: '步骤3',
|
|
767
|
+
fields: [
|
|
768
|
+
{
|
|
769
|
+
name: 'phone',
|
|
770
|
+
label: '手机号',
|
|
771
|
+
type: 'tel',
|
|
772
|
+
required: true,
|
|
773
|
+
rules: [
|
|
774
|
+
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号' },
|
|
775
|
+
],
|
|
776
|
+
cols: 12,
|
|
777
|
+
},
|
|
778
|
+
],
|
|
779
|
+
},
|
|
780
|
+
],
|
|
781
|
+
};
|
|
782
|
+
},
|
|
783
|
+
template: `
|
|
784
|
+
<v-container>
|
|
785
|
+
<v-alert type="info" text class="mb-4">
|
|
786
|
+
每个步骤都有表单验证,只有验证通过才能进入下一步
|
|
787
|
+
</v-alert>
|
|
788
|
+
<jh-steps-form
|
|
789
|
+
v-bind="$props"
|
|
790
|
+
:steps="steps"
|
|
791
|
+
:validate-step="validateStep"
|
|
792
|
+
@finish="handleFinish"
|
|
793
|
+
/>
|
|
794
|
+
</v-container>
|
|
795
|
+
`,
|
|
796
|
+
methods: {
|
|
797
|
+
validateStep({ step, stepIndex, formData }) {
|
|
798
|
+
console.log('验证步骤:', stepIndex, formData);
|
|
799
|
+
// 自定义验证逻辑
|
|
800
|
+
return true;
|
|
801
|
+
},
|
|
802
|
+
handleFinish(data) {
|
|
803
|
+
console.log('完成表单:', data);
|
|
804
|
+
alert('表单提交成功!');
|
|
805
|
+
},
|
|
806
|
+
},
|
|
807
|
+
}),
|
|
808
|
+
args: {},
|
|
809
|
+
};
|
|
810
|
+
|
|
811
|
+
// v-model 控制步骤
|
|
812
|
+
export const VModel控制步骤 = {
|
|
813
|
+
render: (args) => ({
|
|
814
|
+
components: { JhStepsForm },
|
|
815
|
+
data() {
|
|
816
|
+
return {
|
|
817
|
+
currentStep: 0,
|
|
818
|
+
steps: [
|
|
819
|
+
{
|
|
820
|
+
title: '步骤1',
|
|
821
|
+
fields: [
|
|
822
|
+
{
|
|
823
|
+
name: 'field1',
|
|
824
|
+
label: '字段1',
|
|
825
|
+
type: 'text',
|
|
826
|
+
cols: 12,
|
|
827
|
+
},
|
|
828
|
+
],
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
title: '步骤2',
|
|
832
|
+
fields: [
|
|
833
|
+
{
|
|
834
|
+
name: 'field2',
|
|
835
|
+
label: '字段2',
|
|
836
|
+
type: 'text',
|
|
837
|
+
cols: 12,
|
|
838
|
+
},
|
|
839
|
+
],
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
title: '步骤3',
|
|
843
|
+
fields: [
|
|
844
|
+
{
|
|
845
|
+
name: 'field3',
|
|
846
|
+
label: '字段3',
|
|
847
|
+
type: 'text',
|
|
848
|
+
cols: 12,
|
|
849
|
+
},
|
|
850
|
+
],
|
|
851
|
+
},
|
|
852
|
+
],
|
|
853
|
+
};
|
|
854
|
+
},
|
|
855
|
+
template: `
|
|
856
|
+
<v-container>
|
|
857
|
+
<v-alert type="info" text class="mb-4">
|
|
858
|
+
使用 v-model 控制当前步骤,当前步骤: {{ currentStep + 1 }}
|
|
859
|
+
</v-alert>
|
|
860
|
+
<v-btn-toggle v-model="currentStep" mandatory class="mb-4">
|
|
861
|
+
<v-btn small>步骤1</v-btn>
|
|
862
|
+
<v-btn small>步骤2</v-btn>
|
|
863
|
+
<v-btn small>步骤3</v-btn>
|
|
864
|
+
</v-btn-toggle>
|
|
865
|
+
<jh-steps-form
|
|
866
|
+
v-model="currentStep"
|
|
867
|
+
:steps="steps"
|
|
868
|
+
@finish="handleFinish"
|
|
869
|
+
/>
|
|
870
|
+
</v-container>
|
|
871
|
+
`,
|
|
872
|
+
methods: {
|
|
873
|
+
handleFinish(data) {
|
|
874
|
+
console.log('完成表单:', data);
|
|
875
|
+
alert('表单提交成功!');
|
|
876
|
+
},
|
|
877
|
+
},
|
|
878
|
+
}),
|
|
879
|
+
args: {},
|
|
880
|
+
};
|
|
881
|
+
|
|
882
|
+
// 自定义提交按钮
|
|
883
|
+
export const 自定义提交按钮 = {
|
|
884
|
+
render: (args) => ({
|
|
885
|
+
components: { JhStepsForm },
|
|
886
|
+
data() {
|
|
887
|
+
return {
|
|
888
|
+
steps: [
|
|
889
|
+
{
|
|
890
|
+
title: '基本信息',
|
|
891
|
+
fields: [
|
|
892
|
+
{
|
|
893
|
+
name: 'name',
|
|
894
|
+
label: '姓名',
|
|
895
|
+
type: 'text',
|
|
896
|
+
required: true,
|
|
897
|
+
cols: 12,
|
|
898
|
+
},
|
|
899
|
+
],
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
title: '联系方式',
|
|
903
|
+
fields: [
|
|
904
|
+
{
|
|
905
|
+
name: 'email',
|
|
906
|
+
label: '邮箱',
|
|
907
|
+
type: 'email',
|
|
908
|
+
required: true,
|
|
909
|
+
cols: 12,
|
|
910
|
+
},
|
|
911
|
+
],
|
|
912
|
+
},
|
|
913
|
+
{
|
|
914
|
+
title: '完成',
|
|
915
|
+
slot: 'step-finish',
|
|
916
|
+
},
|
|
917
|
+
],
|
|
918
|
+
};
|
|
919
|
+
},
|
|
920
|
+
template: `
|
|
921
|
+
<v-container>
|
|
922
|
+
<v-alert type="info" text class="mb-4">
|
|
923
|
+
自定义按钮文本和样式
|
|
924
|
+
</v-alert>
|
|
925
|
+
<jh-steps-form
|
|
926
|
+
:steps="steps"
|
|
927
|
+
:submitter="{
|
|
928
|
+
previousText: '返回',
|
|
929
|
+
nextText: '继续',
|
|
930
|
+
submitText: '立即提交',
|
|
931
|
+
previousButtonProps: { color: 'secondary', outlined: true },
|
|
932
|
+
nextButtonProps: { color: 'primary', large: true },
|
|
933
|
+
submitButtonProps: { color: 'success', large: true },
|
|
934
|
+
}"
|
|
935
|
+
@finish="handleFinish"
|
|
936
|
+
>
|
|
937
|
+
<template #step-finish>
|
|
938
|
+
<v-alert type="success" text>
|
|
939
|
+
所有信息已填写完成,点击"立即提交"按钮完成操作
|
|
940
|
+
</v-alert>
|
|
941
|
+
</template>
|
|
942
|
+
</jh-steps-form>
|
|
943
|
+
</v-container>
|
|
944
|
+
`,
|
|
945
|
+
methods: {
|
|
946
|
+
handleFinish(data) {
|
|
947
|
+
console.log('完成表单:', data);
|
|
948
|
+
alert('表单提交成功!');
|
|
949
|
+
},
|
|
950
|
+
},
|
|
951
|
+
}),
|
|
952
|
+
args: {},
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
// 表单实例访问
|
|
956
|
+
export const 表单实例访问 = {
|
|
957
|
+
render: (args) => ({
|
|
958
|
+
components: { JhStepsForm },
|
|
959
|
+
data() {
|
|
960
|
+
return {
|
|
961
|
+
steps: [
|
|
962
|
+
{
|
|
963
|
+
title: '步骤1',
|
|
964
|
+
fields: [
|
|
965
|
+
{
|
|
966
|
+
name: 'username',
|
|
967
|
+
label: '用户名',
|
|
968
|
+
type: 'text',
|
|
969
|
+
required: true,
|
|
970
|
+
cols: 12,
|
|
971
|
+
},
|
|
972
|
+
],
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
title: '步骤2',
|
|
976
|
+
fields: [
|
|
977
|
+
{
|
|
978
|
+
name: 'email',
|
|
979
|
+
label: '邮箱',
|
|
980
|
+
type: 'email',
|
|
981
|
+
required: true,
|
|
982
|
+
cols: 12,
|
|
983
|
+
},
|
|
984
|
+
],
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
title: '步骤3',
|
|
988
|
+
fields: [
|
|
989
|
+
{
|
|
990
|
+
name: 'phone',
|
|
991
|
+
label: '手机号',
|
|
992
|
+
type: 'tel',
|
|
993
|
+
required: true,
|
|
994
|
+
cols: 12,
|
|
995
|
+
},
|
|
996
|
+
],
|
|
997
|
+
},
|
|
998
|
+
],
|
|
999
|
+
};
|
|
1000
|
+
},
|
|
1001
|
+
template: `
|
|
1002
|
+
<v-container>
|
|
1003
|
+
<v-alert type="info" text class="mb-4">
|
|
1004
|
+
演示如何访问表单实例进行操作
|
|
1005
|
+
</v-alert>
|
|
1006
|
+
<v-row class="mb-4">
|
|
1007
|
+
<v-col>
|
|
1008
|
+
<v-btn color="primary" @click="validateAll" small>验证所有步骤</v-btn>
|
|
1009
|
+
<v-btn color="secondary" @click="getFormData" small class="ml-2">获取表单数据</v-btn>
|
|
1010
|
+
<v-btn color="warning" @click="resetForm" small class="ml-2">重置表单</v-btn>
|
|
1011
|
+
<v-btn color="info" @click="getFormMapRef" small class="ml-2">获取表单实例</v-btn>
|
|
1012
|
+
</v-col>
|
|
1013
|
+
</v-row>
|
|
1014
|
+
<jh-steps-form
|
|
1015
|
+
ref="stepsForm"
|
|
1016
|
+
:steps="steps"
|
|
1017
|
+
@finish="handleFinish"
|
|
1018
|
+
/>
|
|
1019
|
+
</v-container>
|
|
1020
|
+
`,
|
|
1021
|
+
methods: {
|
|
1022
|
+
async validateAll() {
|
|
1023
|
+
const isValid = await this.$refs.stepsForm.validateAll();
|
|
1024
|
+
alert('所有步骤验证结果: ' + (isValid ? '通过' : '失败'));
|
|
1025
|
+
console.log('验证结果:', isValid);
|
|
1026
|
+
},
|
|
1027
|
+
getFormData() {
|
|
1028
|
+
const data = this.$refs.stepsForm.getFormData();
|
|
1029
|
+
console.log('表单数据:', data);
|
|
1030
|
+
alert('表单数据已输出到控制台');
|
|
1031
|
+
},
|
|
1032
|
+
resetForm() {
|
|
1033
|
+
this.$refs.stepsForm.reset();
|
|
1034
|
+
alert('表单已重置');
|
|
1035
|
+
},
|
|
1036
|
+
getFormMapRef() {
|
|
1037
|
+
const formMapRef = this.$refs.stepsForm.getFormMapRef();
|
|
1038
|
+
console.log('表单实例映射:', formMapRef);
|
|
1039
|
+
alert('表单实例已输出到控制台');
|
|
1040
|
+
},
|
|
1041
|
+
handleFinish(data) {
|
|
1042
|
+
console.log('完成表单:', data);
|
|
1043
|
+
alert('表单提交成功!');
|
|
1044
|
+
},
|
|
1045
|
+
},
|
|
1046
|
+
}),
|
|
1047
|
+
args: {},
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
// 步骤变化监听
|
|
1051
|
+
export const 步骤变化监听 = {
|
|
1052
|
+
render: (args) => ({
|
|
1053
|
+
components: { JhStepsForm },
|
|
1054
|
+
data() {
|
|
1055
|
+
return {
|
|
1056
|
+
currentStep: 0,
|
|
1057
|
+
stepHistory: [],
|
|
1058
|
+
formChanges: [],
|
|
1059
|
+
steps: [
|
|
1060
|
+
{
|
|
1061
|
+
title: '步骤1',
|
|
1062
|
+
fields: [
|
|
1063
|
+
{
|
|
1064
|
+
name: 'field1',
|
|
1065
|
+
label: '字段1',
|
|
1066
|
+
type: 'text',
|
|
1067
|
+
cols: 12,
|
|
1068
|
+
},
|
|
1069
|
+
],
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
title: '步骤2',
|
|
1073
|
+
fields: [
|
|
1074
|
+
{
|
|
1075
|
+
name: 'field2',
|
|
1076
|
+
label: '字段2',
|
|
1077
|
+
type: 'text',
|
|
1078
|
+
cols: 12,
|
|
1079
|
+
},
|
|
1080
|
+
],
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
title: '步骤3',
|
|
1084
|
+
fields: [
|
|
1085
|
+
{
|
|
1086
|
+
name: 'field3',
|
|
1087
|
+
label: '字段3',
|
|
1088
|
+
type: 'text',
|
|
1089
|
+
cols: 12,
|
|
1090
|
+
},
|
|
1091
|
+
],
|
|
1092
|
+
},
|
|
1093
|
+
],
|
|
1094
|
+
};
|
|
1095
|
+
},
|
|
1096
|
+
template: `
|
|
1097
|
+
<v-container>
|
|
1098
|
+
<v-alert type="info" text class="mb-4">
|
|
1099
|
+
监听步骤变化和表单字段变化事件
|
|
1100
|
+
</v-alert>
|
|
1101
|
+
<v-row>
|
|
1102
|
+
<v-col cols="12" md="8">
|
|
1103
|
+
<jh-steps-form
|
|
1104
|
+
v-model="currentStep"
|
|
1105
|
+
:steps="steps"
|
|
1106
|
+
:on-current-change="handleStepChange"
|
|
1107
|
+
:on-form-change="handleFormChange"
|
|
1108
|
+
@finish="handleFinish"
|
|
1109
|
+
/>
|
|
1110
|
+
</v-col>
|
|
1111
|
+
<v-col cols="12" md="4">
|
|
1112
|
+
<v-card outlined>
|
|
1113
|
+
<v-card-title class="text-subtitle-1">步骤历史</v-card-title>
|
|
1114
|
+
<v-card-text>
|
|
1115
|
+
<v-chip
|
|
1116
|
+
v-for="(step, index) in stepHistory"
|
|
1117
|
+
:key="index"
|
|
1118
|
+
small
|
|
1119
|
+
class="ma-1"
|
|
1120
|
+
>
|
|
1121
|
+
步骤 {{ step + 1 }}
|
|
1122
|
+
</v-chip>
|
|
1123
|
+
</v-card-text>
|
|
1124
|
+
</v-card>
|
|
1125
|
+
<v-card outlined class="mt-4">
|
|
1126
|
+
<v-card-title class="text-subtitle-1">表单变化</v-card-title>
|
|
1127
|
+
<v-card-text style="max-height: 300px; overflow-y: auto;">
|
|
1128
|
+
<div v-for="(change, index) in formChanges" :key="index" class="text-caption mb-2">
|
|
1129
|
+
<strong>步骤{{ change.stepIndex + 1 }}:</strong> {{ JSON.stringify(change.values) }}
|
|
1130
|
+
</div>
|
|
1131
|
+
</v-card-text>
|
|
1132
|
+
</v-card>
|
|
1133
|
+
</v-col>
|
|
1134
|
+
</v-row>
|
|
1135
|
+
</v-container>
|
|
1136
|
+
`,
|
|
1137
|
+
methods: {
|
|
1138
|
+
handleStepChange(stepIndex) {
|
|
1139
|
+
console.log('步骤变化:', stepIndex);
|
|
1140
|
+
this.stepHistory.push(stepIndex);
|
|
1141
|
+
},
|
|
1142
|
+
handleFormChange({ stepIndex, values, allValues }) {
|
|
1143
|
+
console.log('表单变化:', { stepIndex, values, allValues });
|
|
1144
|
+
this.formChanges.push({ stepIndex, values });
|
|
1145
|
+
// 只保留最近10条记录
|
|
1146
|
+
if (this.formChanges.length > 10) {
|
|
1147
|
+
this.formChanges.shift();
|
|
1148
|
+
}
|
|
1149
|
+
},
|
|
1150
|
+
handleFinish(data) {
|
|
1151
|
+
console.log('完成表单:', data);
|
|
1152
|
+
alert('表单提交成功!');
|
|
1153
|
+
},
|
|
1154
|
+
},
|
|
1155
|
+
}),
|
|
1156
|
+
args: {},
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
// 公共表单属性
|
|
1160
|
+
export const 公共表单属性 = {
|
|
1161
|
+
render: (args) => ({
|
|
1162
|
+
components: { JhStepsForm },
|
|
1163
|
+
data() {
|
|
1164
|
+
return {
|
|
1165
|
+
steps: [
|
|
1166
|
+
{
|
|
1167
|
+
title: '步骤1',
|
|
1168
|
+
fields: [
|
|
1169
|
+
{
|
|
1170
|
+
name: 'field1',
|
|
1171
|
+
label: '字段1',
|
|
1172
|
+
type: 'text',
|
|
1173
|
+
hint: '这是提示信息',
|
|
1174
|
+
cols: 12,
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
name: 'field2',
|
|
1178
|
+
label: '字段2',
|
|
1179
|
+
type: 'text',
|
|
1180
|
+
hint: '这也是提示信息',
|
|
1181
|
+
cols: 12,
|
|
1182
|
+
},
|
|
1183
|
+
],
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
title: '步骤2',
|
|
1187
|
+
fields: [
|
|
1188
|
+
{
|
|
1189
|
+
name: 'field3',
|
|
1190
|
+
label: '字段3',
|
|
1191
|
+
type: 'text',
|
|
1192
|
+
hint: '提示信息会显示',
|
|
1193
|
+
cols: 12,
|
|
1194
|
+
},
|
|
1195
|
+
],
|
|
1196
|
+
},
|
|
1197
|
+
],
|
|
1198
|
+
};
|
|
1199
|
+
},
|
|
1200
|
+
template: `
|
|
1201
|
+
<v-container>
|
|
1202
|
+
<v-alert type="info" text class="mb-4">
|
|
1203
|
+
使用 formProps 为所有步骤表单设置公共属性
|
|
1204
|
+
</v-alert>
|
|
1205
|
+
<jh-steps-form
|
|
1206
|
+
:steps="steps"
|
|
1207
|
+
:form-props="{
|
|
1208
|
+
outlined: true,
|
|
1209
|
+
dense: true,
|
|
1210
|
+
hideDetails: false,
|
|
1211
|
+
}"
|
|
1212
|
+
@finish="handleFinish"
|
|
1213
|
+
/>
|
|
1214
|
+
</v-container>
|
|
1215
|
+
`,
|
|
1216
|
+
methods: {
|
|
1217
|
+
handleFinish(data) {
|
|
1218
|
+
console.log('完成表单:', data);
|
|
1219
|
+
alert('表单提交成功!');
|
|
1220
|
+
},
|
|
1221
|
+
},
|
|
1222
|
+
}),
|
|
1223
|
+
args: {},
|
|
1224
|
+
};
|