@ebiz/designer-components 0.1.79 → 0.1.81
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 +29 -29
- package/dist/designer-components.css +1 -1
- package/dist/index.mjs +26610 -24287
- package/package.json +2 -1
- package/src/App.vue +26 -26
- package/src/apiService/SIMPLE_DATA_SERVICE.md +284 -284
- package/src/apiService/mockDataService.js +115 -115
- package/src/apiService/simpleDataService.js +299 -299
- package/src/assets/base.css +86 -86
- package/src/assets/logo.svg +1 -1
- package/src/components/Button.vue +149 -149
- package/src/components/DataContainer.vue +40 -40
- package/src/components/EbizApproval.vue +335 -335
- package/src/components/EbizApprovalForm.vue +507 -507
- package/src/components/EbizAutoForm.vue +596 -596
- package/src/components/EbizAvatar.vue +115 -115
- package/src/components/EbizCheckbox.vue +93 -93
- package/src/components/EbizCheckboxGroup.vue +69 -69
- package/src/components/EbizDepartmentSelector.vue +149 -149
- package/src/components/EbizDescriptions.vue +340 -340
- package/src/components/EbizDescriptionsItem.vue +47 -47
- package/src/components/EbizDetailBlock.vue +81 -81
- package/src/components/EbizDetailItem.vue +559 -559
- package/src/components/EbizDetailView.md +438 -438
- package/src/components/EbizDetailView.vue +355 -355
- package/src/components/EbizDialog.vue +260 -260
- package/src/components/EbizDictionarySelect.vue +229 -0
- package/src/components/EbizDiv.vue +40 -40
- package/src/components/EbizDivider.vue +96 -96
- package/src/components/EbizDropdown.vue +135 -135
- package/src/components/EbizDropdownItem.vue +85 -85
- package/src/components/EbizEmployeeInfo.vue +145 -139
- package/src/components/EbizEmployeeSelector.vue +1159 -1159
- package/src/components/EbizFileList.vue +466 -466
- package/src/components/EbizMap.vue +541 -541
- package/src/components/EbizMeetingRoomSelector.vue +664 -664
- package/src/components/EbizMobileMeetingRoomSelector.vue +727 -727
- package/src/components/EbizOkrTree.vue +99 -99
- package/src/components/EbizPageHeader.vue +95 -95
- package/src/components/EbizPagination.vue +162 -162
- package/src/components/EbizPdfViewer.vue +540 -540
- package/src/components/EbizPopconfirm.vue +47 -47
- package/src/components/EbizQrCode.vue +73 -73
- package/src/components/EbizRadio.vue +86 -86
- package/src/components/EbizRadioGroup.vue +83 -83
- package/src/components/EbizRemoteSelect.vue +232 -232
- package/src/components/EbizRichTextEditor.vue +275 -275
- package/src/components/EbizRouteBreadcrumb.vue +46 -46
- package/src/components/EbizSApprovalProcess.vue +1429 -1429
- package/src/components/EbizSelect.vue +85 -85
- package/src/components/EbizSpace.vue +100 -100
- package/src/components/EbizStatistic.vue +149 -149
- package/src/components/EbizStatsCard.vue +113 -113
- package/src/components/EbizSwiper.vue +113 -113
- package/src/components/EbizSwiperItem.vue +13 -13
- package/src/components/EbizSwitch.vue +85 -85
- package/src/components/EbizTabHeader.vue +132 -132
- package/src/components/EbizTabPanel.vue +22 -22
- package/src/components/EbizTable.vue +469 -469
- package/src/components/EbizTableColumn.vue +116 -116
- package/src/components/EbizTableSort.vue +179 -179
- package/src/components/EbizTabs.vue +142 -142
- package/src/components/EbizTdesignButtonDialog.vue +332 -332
- package/src/components/EbizTdesignLoading.vue +107 -107
- package/src/components/EbizTimePicker.vue +143 -143
- package/src/components/EbizTitle.vue +91 -91
- package/src/components/EbizTree.vue +141 -141
- package/src/components/EbizTreeMergeTable.vue +1494 -1494
- package/src/components/EbizTreeSelector.vue +418 -418
- package/src/components/EbizVideo.vue +553 -553
- package/src/components/EbizVxeTable.vue +290 -290
- package/src/components/Form.vue +28 -28
- package/src/components/Home.vue +7 -7
- package/src/components/MyComponent.vue +39 -39
- package/src/components/Table.vue +45 -45
- package/src/components/TdesignAlert.vue +115 -115
- package/src/components/TdesignButton.vue +135 -135
- package/src/components/TdesignCalendar/index.vue +145 -145
- package/src/components/TdesignCard.vue +195 -195
- package/src/components/TdesignCol.vue +101 -101
- package/src/components/TdesignCollapse.vue +142 -142
- package/src/components/TdesignCollapsePanel.vue +79 -79
- package/src/components/TdesignDatePicker.vue +124 -124
- package/src/components/TdesignDescriptions.vue +74 -74
- package/src/components/TdesignDescriptionsItem.vue +50 -50
- package/src/components/TdesignDialog.vue +225 -225
- package/src/components/TdesignForm.vue +138 -138
- package/src/components/TdesignFormItem.vue +105 -105
- package/src/components/TdesignGrid.vue +55 -55
- package/src/components/TdesignIcon.vue +67 -67
- package/src/components/TdesignImage.vue +162 -162
- package/src/components/TdesignImageViewer.vue +200 -200
- package/src/components/TdesignInput.vue +242 -242
- package/src/components/TdesignSelect.vue +446 -446
- package/src/components/TdesignTag.vue +117 -117
- package/src/components/TdesignTextarea.vue +142 -142
- package/src/components/TdesignTimeline.vue +58 -58
- package/src/components/TdesignTimelineItem.vue +71 -71
- package/src/components/TdesignUpload.vue +414 -414
- package/src/components/TdesignWatermark.vue +107 -107
- package/src/components/ebiz-form/components/cascader.vue +61 -61
- package/src/components/ebiz-form/components/checkbox.vue +37 -37
- package/src/components/ebiz-form/components/city.vue +137 -137
- package/src/components/ebiz-form/components/date-panel.vue +52 -52
- package/src/components/ebiz-form/components/date-range-panel.vue +52 -52
- package/src/components/ebiz-form/components/date-range.vue +56 -56
- package/src/components/ebiz-form/components/date.vue +52 -52
- package/src/components/ebiz-form/components/editor-multi-language.vue +47 -47
- package/src/components/ebiz-form/components/editor.vue +78 -78
- package/src/components/ebiz-form/components/file-multi-language.vue +52 -52
- package/src/components/ebiz-form/components/file.vue +149 -149
- package/src/components/ebiz-form/components/images-multi-language.vue +52 -52
- package/src/components/ebiz-form/components/images.vue +129 -129
- package/src/components/ebiz-form/components/img-multi-language.vue +51 -51
- package/src/components/ebiz-form/components/img.vue +129 -129
- package/src/components/ebiz-form/components/number.vue +50 -50
- package/src/components/ebiz-form/components/radio.vue +28 -28
- package/src/components/ebiz-form/components/select.vue +119 -119
- package/src/components/ebiz-form/components/switch.vue +23 -23
- package/src/components/ebiz-form/components/text-multi-language.vue +47 -47
- package/src/components/ebiz-form/components/text.vue +52 -52
- package/src/components/ebiz-form/components/textarea-multi-language.vue +48 -48
- package/src/components/ebiz-form/components/textarea.vue +29 -29
- package/src/components/ebiz-form/components/video-multi-language.vue +51 -51
- package/src/components/ebiz-form/components/video.vue +97 -97
- package/src/components/ebiz-form/index.vue +157 -157
- package/src/components/examples/PopconfirmExample.vue +149 -149
- package/src/components/icons/IconCommunity.vue +7 -7
- package/src/components/icons/IconDocumentation.vue +7 -7
- package/src/components/icons/IconEcosystem.vue +7 -7
- package/src/components/icons/IconSupport.vue +7 -7
- package/src/components/icons/IconTooling.vue +19 -19
- package/src/components/mItems/UserInfo.vue +342 -342
- package/src/components/senior/EbizSData/index.vue +273 -273
- package/src/components/senior/EbizSDialog/index.vue +770 -770
- package/src/components/senior/EbizSForm/README.md +157 -157
- package/src/components/senior/EbizSForm/index.vue +667 -667
- package/src/components/senior/EbizSForm/item.vue +986 -971
- package/src/components/senior/EbizSForm/mItems/DateTimePicker.vue +51 -51
- package/src/components/senior/EbizSForm/mItems/Picker.vue +63 -63
- package/src/index.js +313 -255
- package/src/main.js +55 -55
- package/src/router/index.js +415 -415
- package/src/utils/formatCode.js +24 -24
- package/src/utils/generateImportStatement.js +52 -52
- package/src/utils/hasJsx.js +25 -25
- package/src/utils/index.js +166 -166
- package/src/utils/mergeOptions.js +29 -29
- package/src/utils/parseRequiredBlocks.js +18 -18
- package/src/utils/vue-sfc-validator.js +155 -155
- package/src/views/Button.vue +23 -23
- package/src/views/CheckboxDemo.vue +104 -104
- package/src/views/DataContainer.vue +19 -19
- package/src/views/DialogDemo.vue +125 -125
- package/src/views/EbizApprovalDemo.vue +87 -87
- package/src/views/EbizApprovalFormDemo.vue +207 -207
- package/src/views/EbizAutoFormDemo.vue +129 -129
- package/src/views/EbizAvatar.vue +223 -223
- package/src/views/EbizDepartmentSelectorDemo.vue +169 -169
- package/src/views/EbizDetailBlockDemo.vue +30 -30
- package/src/views/EbizDetailViewDemo.vue +412 -412
- package/src/views/EbizEmployeeInfo.vue +249 -249
- package/src/views/EbizEmployeeSelector.vue +85 -85
- package/src/views/EbizFileListDemo.vue +339 -339
- package/src/views/EbizMap.vue +201 -201
- package/src/views/EbizMeetingRoomSelectorDemo.vue +293 -293
- package/src/views/EbizMobileMeetingRoomSelectorDemo.vue +566 -566
- package/src/views/EbizRadioDemo.vue +151 -151
- package/src/views/EbizSDataDemo.vue +136 -136
- package/src/views/EbizSDialogDemo.vue +303 -303
- package/src/views/EbizSForm/index.vue +352 -351
- package/src/views/EbizSFormDemo.vue +420 -420
- package/src/views/EbizSpace.vue +185 -185
- package/src/views/EbizSwiper.vue +157 -157
- package/src/views/EbizTdesignButtonDialogExample.vue +437 -437
- package/src/views/Form.vue +19 -19
- package/src/views/GridDemo.vue +238 -238
- package/src/views/Home.vue +153 -153
- package/src/views/Mindmap.vue +17 -17
- package/src/views/MyComponent.vue +19 -19
- package/src/views/OkrTree.vue +19 -19
- package/src/views/PageHeaderDemo.vue +104 -104
- package/src/views/PaginationDemo.vue +96 -96
- package/src/views/PdfViewerDemo.vue +433 -433
- package/src/views/PermissionBoxDemo.vue +85 -85
- package/src/views/PopconfirmDemo.vue +80 -80
- package/src/views/RemoteSelect.vue +350 -350
- package/src/views/StatisticDemo.vue +190 -190
- package/src/views/SwitchDemo.vue +79 -79
- package/src/views/Table.vue +19 -19
- package/src/views/TableDemo.vue +334 -334
- package/src/views/TableSortDemo.vue +143 -143
- package/src/views/TableView.vue +68 -68
- package/src/views/TabsDemo.vue +282 -282
- package/src/views/TagDemo.vue +101 -101
- package/src/views/TdesignAlert.vue +98 -98
- package/src/views/TdesignButton.vue +190 -190
- package/src/views/TdesignCalendar.vue +94 -94
- package/src/views/TdesignCard.vue +296 -296
- package/src/views/TdesignCollapse.vue +293 -293
- package/src/views/TdesignDatePicker.vue +187 -187
- package/src/views/TdesignDescriptions.vue +101 -101
- package/src/views/TdesignForm.vue +248 -248
- package/src/views/TdesignIcon.vue +203 -203
- package/src/views/TdesignImage.vue +215 -215
- package/src/views/TdesignImageViewer.vue +198 -198
- package/src/views/TdesignInput.vue +252 -252
- package/src/views/TdesignSelect.vue +473 -473
- package/src/views/TdesignSwiper.vue +157 -157
- package/src/views/TextareaDemo.vue +93 -93
- package/src/views/TimePickerDemo.vue +146 -146
- package/src/views/TimelineDemo.vue +160 -160
- package/src/views/Title.vue +19 -19
- package/src/views/TreeDemo.vue +254 -254
- package/src/views/TreeMergeTableDemo.vue +239 -239
- package/src/views/TreeSelectorDemo.vue +245 -245
- package/src/views/UploadDemo.vue +128 -128
- package/src/views/VideoDemo.vue +245 -245
- package/src/views/VxeTableDemo.vue +279 -279
- package/src/views/WatermarkDemo.vue +85 -85
|
@@ -1,352 +1,353 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="component-demo">
|
|
3
|
-
<h2>高级表单组件</h2>
|
|
4
|
-
<div class="demo-section">
|
|
5
|
-
<h3>基础表单示例</h3>
|
|
6
|
-
<div class="demo-block">
|
|
7
|
-
<ebiz-s-form ref="basicFormRef" :data="formData" :rules="formRules" show-error-message @success="handleSuccess"
|
|
8
|
-
@error="handleError">
|
|
9
|
-
<ebiz-s-form-item label="
|
|
10
|
-
<ebiz-s-form-item label="
|
|
11
|
-
<ebiz-s-form-item label="
|
|
12
|
-
<ebiz-s-form-item label="
|
|
13
|
-
<ebiz-s-form-item label="
|
|
14
|
-
<ebiz-s-form-item label="
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{ name: '
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<t-button @click="
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<ebiz-s-form-item label="
|
|
39
|
-
<ebiz-s-form-item label="
|
|
40
|
-
<ebiz-s-form-item label="
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<ebiz-s-form-item label="
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<t-button @click="
|
|
61
|
-
<t-button @click="
|
|
62
|
-
<t-button @click="
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<ebiz-s-form-item label="
|
|
67
|
-
<ebiz-s-form-item label="
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<ebiz-s-form-item label="
|
|
78
|
-
<ebiz-s-form-item label="
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
<t-button theme="
|
|
92
|
-
<t-button theme="
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
</
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
import {
|
|
104
|
-
import {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
{
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
{
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
{
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
{ label: '
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
{ label: '
|
|
172
|
-
{ label: '
|
|
173
|
-
{ label: '
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
{ label: '
|
|
179
|
-
{ label: '
|
|
180
|
-
{ label: '
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
border
|
|
350
|
-
|
|
351
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="component-demo">
|
|
3
|
+
<h2>高级表单组件</h2>
|
|
4
|
+
<div class="demo-section">
|
|
5
|
+
<h3>基础表单示例</h3>
|
|
6
|
+
<div class="demo-block">
|
|
7
|
+
<ebiz-s-form ref="basicFormRef" :data="formData" :rules="formRules" show-error-message @success="handleSuccess"
|
|
8
|
+
@error="handleError">
|
|
9
|
+
<ebiz-s-form-item label="字典" name="name" type="dictionarySelect" dictionary-key="assets_fix_type" placeholder="请输入姓名"></ebiz-s-form-item>
|
|
10
|
+
<ebiz-s-form-item label="姓名" name="name" type="input" placeholder="请输入姓名"></ebiz-s-form-item>
|
|
11
|
+
<ebiz-s-form-item label="年龄" name="age" type="number" placeholder="请输入年龄"></ebiz-s-form-item>
|
|
12
|
+
<ebiz-s-form-item label="性别" name="gender" type="radio" :options="genderOptions"></ebiz-s-form-item>
|
|
13
|
+
<ebiz-s-form-item label="爱好" name="hobbies" type="checkbox" :options="hobbyOptions"></ebiz-s-form-item>
|
|
14
|
+
<ebiz-s-form-item label="职业" name="occupation" type="select" :options="occupationOptions"></ebiz-s-form-item>
|
|
15
|
+
<ebiz-s-form-item label="出生日期" name="birthday" type="date"></ebiz-s-form-item>
|
|
16
|
+
|
|
17
|
+
<ebiz-s-form-item v-model="formData.richText" label="富文本" name="richText" type="rich-text"></ebiz-s-form-item>
|
|
18
|
+
|
|
19
|
+
{{ formData.bio }}
|
|
20
|
+
<ebiz-s-form-item v-model="formData.bio" label="简介" name="bio" type="table" :tableColumns="[
|
|
21
|
+
{ name: '名称', key: 'name' },
|
|
22
|
+
{ name: '数量', key: 'num' }
|
|
23
|
+
]" placeholder="请输入个人简介"></ebiz-s-form-item>
|
|
24
|
+
</ebiz-s-form>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div class="demo-section">
|
|
29
|
+
<h3>编辑表单示例(支持详情接口)</h3>
|
|
30
|
+
<div class="demo-block">
|
|
31
|
+
<t-space>
|
|
32
|
+
<t-button @click="openEditFormWithData">打开编辑表单(预设数据)</t-button>
|
|
33
|
+
<t-button @click="openEditFormWithId">打开编辑表单(加载详情)</t-button>
|
|
34
|
+
</t-space>
|
|
35
|
+
<ebiz-s-form ref="editFormRef" :api-config="submitApiConfig" :detail-api-config="detailApiConfig"
|
|
36
|
+
:rules="editFormRules" show-error-message reset-on-success @success="handleEditSuccess"
|
|
37
|
+
@error="handleEditError" @detail-loaded="handleDetailLoaded">
|
|
38
|
+
<ebiz-s-form-item label="ID" name="id" type="input" disabled></ebiz-s-form-item>
|
|
39
|
+
<ebiz-s-form-item label="标题" name="title" type="input" placeholder="请输入标题"></ebiz-s-form-item>
|
|
40
|
+
<ebiz-s-form-item label="内容" name="body" type="textarea" placeholder="请输入内容"></ebiz-s-form-item>
|
|
41
|
+
<ebiz-s-form-item label="用户ID" name="userId" type="number" placeholder="请输入用户ID"></ebiz-s-form-item>
|
|
42
|
+
</ebiz-s-form>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div class="demo-section">
|
|
47
|
+
<h3>行内表单示例</h3>
|
|
48
|
+
<div class="demo-block">
|
|
49
|
+
<ebiz-s-form :data="inlineFormData" layout="inline" label-width="60px">
|
|
50
|
+
<ebiz-s-form-item label="用户名" name="username" type="input" placeholder="请输入用户名"></ebiz-s-form-item>
|
|
51
|
+
<ebiz-s-form-item label="密码" name="password" type="input" placeholder="请输入密码"></ebiz-s-form-item>
|
|
52
|
+
</ebiz-s-form>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div class="demo-section">
|
|
57
|
+
<h3>表单方法调用示例</h3>
|
|
58
|
+
<div class="demo-block">
|
|
59
|
+
<t-space>
|
|
60
|
+
<t-button @click="validateForm">验证表单</t-button>
|
|
61
|
+
<t-button @click="getFormValues">获取表单值</t-button>
|
|
62
|
+
<t-button @click="resetForm">重置表单</t-button>
|
|
63
|
+
<t-button @click="setFormValues">设置表单值</t-button>
|
|
64
|
+
</t-space>
|
|
65
|
+
<ebiz-s-form ref="methodFormRef" :rules="methodFormRules">
|
|
66
|
+
<ebiz-s-form-item label="用户名" name="username" type="input" placeholder="请输入用户名"></ebiz-s-form-item>
|
|
67
|
+
<ebiz-s-form-item label="邮箱" name="email" type="input" placeholder="请输入邮箱"></ebiz-s-form-item>
|
|
68
|
+
<ebiz-s-form-item label="密码" name="password" type="input" placeholder="请输入密码"></ebiz-s-form-item>
|
|
69
|
+
</ebiz-s-form>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div class="demo-section">
|
|
74
|
+
<h3>顶部标签表单示例</h3>
|
|
75
|
+
<div class="demo-block">
|
|
76
|
+
<ebiz-s-form :data="topLabelFormData" label-align="top">
|
|
77
|
+
<ebiz-s-form-item label="邮箱" name="email" type="input" placeholder="请输入邮箱"></ebiz-s-form-item>
|
|
78
|
+
<ebiz-s-form-item label="手机号" name="phone" type="input" placeholder="请输入手机号"></ebiz-s-form-item>
|
|
79
|
+
<ebiz-s-form-item label="是否启用" name="enabled" type="switch"></ebiz-s-form-item>
|
|
80
|
+
</ebiz-s-form>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<div class="demo-section">
|
|
85
|
+
<h3>自定义表单按钮示例</h3>
|
|
86
|
+
<div class="demo-block">
|
|
87
|
+
<ebiz-s-form :data="customButtonsFormData">
|
|
88
|
+
<ebiz-s-form-item label="名称" name="name" type="input" placeholder="请输入名称"></ebiz-s-form-item>
|
|
89
|
+
<template #buttons>
|
|
90
|
+
<t-space>
|
|
91
|
+
<t-button theme="default">返回</t-button>
|
|
92
|
+
<t-button theme="primary">保存草稿</t-button>
|
|
93
|
+
<t-button theme="success">提交审核</t-button>
|
|
94
|
+
</t-space>
|
|
95
|
+
</template>
|
|
96
|
+
</ebiz-s-form>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</template>
|
|
101
|
+
|
|
102
|
+
<script>
|
|
103
|
+
import { reactive, ref } from 'vue';
|
|
104
|
+
import { EbizSForm, EbizSFormItem } from '../../index.js';
|
|
105
|
+
import { Button as TButton, Space as TSpace, MessagePlugin } from 'tdesign-vue-next';
|
|
106
|
+
|
|
107
|
+
export default {
|
|
108
|
+
name: 'EbizSFormDemo',
|
|
109
|
+
components: {
|
|
110
|
+
EbizSForm,
|
|
111
|
+
EbizSFormItem,
|
|
112
|
+
TButton,
|
|
113
|
+
TSpace
|
|
114
|
+
},
|
|
115
|
+
setup() {
|
|
116
|
+
// 表单引用
|
|
117
|
+
const basicFormRef = ref(null);
|
|
118
|
+
const editFormRef = ref(null);
|
|
119
|
+
const methodFormRef = ref(null);
|
|
120
|
+
|
|
121
|
+
const tableColumns = reactive();
|
|
122
|
+
|
|
123
|
+
// 基础表单数据
|
|
124
|
+
const formData = reactive({
|
|
125
|
+
name: '',
|
|
126
|
+
age: null,
|
|
127
|
+
gender: '',
|
|
128
|
+
hobbies: [],
|
|
129
|
+
occupation: '',
|
|
130
|
+
birthday: '',
|
|
131
|
+
bio: [{name: '123', num: 123}]
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// 表单验证规则
|
|
135
|
+
const formRules = {
|
|
136
|
+
name: [{ required: true, message: '请输入姓名', type: 'error' }],
|
|
137
|
+
age: [
|
|
138
|
+
{ required: true, message: '请输入年龄', type: 'error' },
|
|
139
|
+
{ validator: (val) => val >= 18, message: '年龄必须大于等于18岁', type: 'error' }
|
|
140
|
+
],
|
|
141
|
+
gender: [{ required: true, message: '请选择性别', type: 'error' }]
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// 编辑表单验证规则
|
|
145
|
+
const editFormRules = {
|
|
146
|
+
title: [{ required: true, message: '请输入标题', type: 'error' }],
|
|
147
|
+
body: [{ required: true, message: '请输入内容', type: 'error' }],
|
|
148
|
+
userId: [{ required: true, message: '请输入用户ID', type: 'error' }]
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// 方法示例表单验证规则
|
|
152
|
+
const methodFormRules = {
|
|
153
|
+
username: [{ required: true, message: '请输入用户名', type: 'error' }],
|
|
154
|
+
email: [
|
|
155
|
+
{ required: true, message: '请输入邮箱', type: 'error' },
|
|
156
|
+
{ validator: (val) => /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(val), message: '请输入有效的邮箱地址', type: 'error' }
|
|
157
|
+
],
|
|
158
|
+
password: [
|
|
159
|
+
{ required: true, message: '请输入密码', type: 'error' },
|
|
160
|
+
{ validator: (val) => val.length >= 6, message: '密码长度至少为6位', type: 'error' }
|
|
161
|
+
]
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
// 选项数据
|
|
165
|
+
const genderOptions = [
|
|
166
|
+
{ label: '男', value: 'male' },
|
|
167
|
+
{ label: '女', value: 'female' }
|
|
168
|
+
];
|
|
169
|
+
|
|
170
|
+
const hobbyOptions = [
|
|
171
|
+
{ label: '阅读', value: 'reading' },
|
|
172
|
+
{ label: '音乐', value: 'music' },
|
|
173
|
+
{ label: '电影', value: 'movie' },
|
|
174
|
+
{ label: '运动', value: 'sports' }
|
|
175
|
+
];
|
|
176
|
+
|
|
177
|
+
const occupationOptions = [
|
|
178
|
+
{ label: '工程师', value: 'engineer' },
|
|
179
|
+
{ label: '设计师', value: 'designer' },
|
|
180
|
+
{ label: '产品经理', value: 'pm' },
|
|
181
|
+
{ label: '运营', value: 'operation' }
|
|
182
|
+
];
|
|
183
|
+
|
|
184
|
+
// 行内表单数据
|
|
185
|
+
const inlineFormData = reactive({
|
|
186
|
+
username: '',
|
|
187
|
+
password: ''
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// 顶部标签表单数据
|
|
191
|
+
const topLabelFormData = reactive({
|
|
192
|
+
email: '',
|
|
193
|
+
phone: '',
|
|
194
|
+
enabled: false
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// 自定义按钮表单数据
|
|
198
|
+
const customButtonsFormData = reactive({
|
|
199
|
+
name: ''
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// API配置
|
|
203
|
+
const submitApiConfig = {
|
|
204
|
+
url: 'https://jsonplaceholder.typicode.com/posts/{id}',
|
|
205
|
+
method: 'put'
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// 详情API配置
|
|
209
|
+
const detailApiConfig = {
|
|
210
|
+
url: 'https://jsonplaceholder.typicode.com/posts/{id}',
|
|
211
|
+
method: 'get'
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// 预设数据
|
|
215
|
+
const predefinedData = {
|
|
216
|
+
id: 1,
|
|
217
|
+
title: '示例标题',
|
|
218
|
+
body: '这是一段示例内容,用于演示表单编辑功能。',
|
|
219
|
+
userId: 1
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// 成功处理函数
|
|
223
|
+
const handleSuccess = (_response) => {
|
|
224
|
+
MessagePlugin.success(`提交成功!`);
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// 错误处理函数
|
|
228
|
+
const handleError = (_error) => {
|
|
229
|
+
MessagePlugin.error('提交失败');
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// 编辑表单成功处理函数
|
|
233
|
+
const handleEditSuccess = (response) => {
|
|
234
|
+
MessagePlugin.success(`编辑成功,ID: ${response.id}`);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// 编辑表单错误处理函数
|
|
238
|
+
const handleEditError = (_error) => {
|
|
239
|
+
MessagePlugin.error('编辑失败');
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// 详情加载成功处理函数
|
|
243
|
+
const handleDetailLoaded = (data) => {
|
|
244
|
+
MessagePlugin.success(`已加载ID为${data.id}的数据`);
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
// 打开编辑表单并预设数据
|
|
248
|
+
const openEditFormWithData = () => {
|
|
249
|
+
editFormRef.value.openForm({
|
|
250
|
+
formData: predefinedData
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// 打开编辑表单并通过ID加载详情
|
|
255
|
+
const openEditFormWithId = () => {
|
|
256
|
+
// 这里模拟一个随机ID,1-10
|
|
257
|
+
const randomId = Math.floor(Math.random() * 10) + 1;
|
|
258
|
+
|
|
259
|
+
editFormRef.value.openForm({
|
|
260
|
+
id: randomId
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// 验证表单
|
|
265
|
+
const validateForm = async () => {
|
|
266
|
+
const result = await methodFormRef.value.validate();
|
|
267
|
+
if (result === true) {
|
|
268
|
+
MessagePlugin.success('表单验证通过');
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
// 获取表单值
|
|
273
|
+
const getFormValues = () => {
|
|
274
|
+
const values = methodFormRef.value.getFormData();
|
|
275
|
+
MessagePlugin.info(`表单值: ${JSON.stringify(values)}`);
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
// 重置表单
|
|
279
|
+
const resetForm = () => {
|
|
280
|
+
methodFormRef.value.reset();
|
|
281
|
+
MessagePlugin.success('表单已重置');
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// 设置表单值
|
|
285
|
+
const setFormValues = () => {
|
|
286
|
+
methodFormRef.value.setFormData({
|
|
287
|
+
username: 'testuser',
|
|
288
|
+
email: 'test@example.com',
|
|
289
|
+
password: 'password123'
|
|
290
|
+
});
|
|
291
|
+
MessagePlugin.success('表单值已设置');
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
return {
|
|
295
|
+
basicFormRef,
|
|
296
|
+
editFormRef,
|
|
297
|
+
methodFormRef,
|
|
298
|
+
formData,
|
|
299
|
+
formRules,
|
|
300
|
+
editFormRules,
|
|
301
|
+
methodFormRules,
|
|
302
|
+
genderOptions,
|
|
303
|
+
hobbyOptions,
|
|
304
|
+
occupationOptions,
|
|
305
|
+
inlineFormData,
|
|
306
|
+
topLabelFormData,
|
|
307
|
+
customButtonsFormData,
|
|
308
|
+
submitApiConfig,
|
|
309
|
+
detailApiConfig,
|
|
310
|
+
handleSuccess,
|
|
311
|
+
handleError,
|
|
312
|
+
handleEditSuccess,
|
|
313
|
+
handleEditError,
|
|
314
|
+
handleDetailLoaded,
|
|
315
|
+
openEditFormWithData,
|
|
316
|
+
openEditFormWithId,
|
|
317
|
+
validateForm,
|
|
318
|
+
getFormValues,
|
|
319
|
+
resetForm,
|
|
320
|
+
setFormValues
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
</script>
|
|
325
|
+
|
|
326
|
+
<style scoped>
|
|
327
|
+
.component-demo {
|
|
328
|
+
padding: 20px;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.demo-section {
|
|
332
|
+
margin-bottom: 30px;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
h2 {
|
|
336
|
+
margin-bottom: 20px;
|
|
337
|
+
font-size: 24px;
|
|
338
|
+
color: #333;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
h3 {
|
|
342
|
+
margin-bottom: 15px;
|
|
343
|
+
font-size: 18px;
|
|
344
|
+
color: #333;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.demo-block {
|
|
348
|
+
padding: 20px;
|
|
349
|
+
border: 1px solid #eee;
|
|
350
|
+
border-radius: 6px;
|
|
351
|
+
background-color: #fff;
|
|
352
|
+
}
|
|
352
353
|
</style>
|