tianheng-ui 0.1.10 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/lib/theme-chalk/styles/reset.scss +0 -2
  2. package/lib/tianheng-ui.js +13 -14
  3. package/package.json +1 -1
  4. package/packages/FormMaking/GenerateForm.vue +16 -11
  5. package/packages/FormMaking/GenerateFormItem.vue +73 -581
  6. package/packages/FormMaking/GenerateFormItemH5.vue +6 -6
  7. package/packages/FormMaking/Upload/index.vue +0 -1
  8. package/packages/FormMaking/WidgetConfig.vue +100 -77
  9. package/packages/FormMaking/WidgetForm.vue +7 -48
  10. package/packages/FormMaking/WidgetFormItem.vue +41 -65
  11. package/packages/FormMaking/WidgetSelect.vue +160 -0
  12. package/packages/FormMaking/WidgetTools.vue +538 -0
  13. package/packages/FormMaking/config/index.js +6 -0
  14. package/packages/FormMaking/custom/config.js +119 -87
  15. package/packages/FormMaking/custom/configs/button.vue +24 -25
  16. package/packages/FormMaking/custom/configs/cascader.vue +7 -7
  17. package/packages/FormMaking/custom/configs/checkbox.vue +23 -22
  18. package/packages/FormMaking/custom/configs/color.vue +3 -3
  19. package/packages/FormMaking/custom/configs/date.vue +3 -3
  20. package/packages/FormMaking/custom/configs/grid.vue +4 -4
  21. package/packages/FormMaking/custom/configs/input.vue +138 -31
  22. package/packages/FormMaking/custom/configs/number.vue +5 -5
  23. package/packages/FormMaking/custom/configs/radio.vue +23 -19
  24. package/packages/FormMaking/custom/configs/rate.vue +3 -3
  25. package/packages/FormMaking/custom/configs/select.vue +25 -20
  26. package/packages/FormMaking/custom/configs/slider.vue +3 -3
  27. package/packages/FormMaking/custom/configs/switch.vue +3 -3
  28. package/packages/FormMaking/custom/configs/table.vue +2 -2
  29. package/packages/FormMaking/custom/configs/{table_h5.vue → tableH5.vue} +2 -2
  30. package/packages/FormMaking/custom/configs/tabs.vue +18 -23
  31. package/packages/FormMaking/custom/configs/textarea.vue +124 -22
  32. package/packages/FormMaking/custom/configs/time.vue +3 -3
  33. package/packages/FormMaking/custom/configs/upload.vue +5 -5
  34. package/packages/FormMaking/custom/index.js +2 -4
  35. package/packages/FormMaking/custom/items/alliance.vue +30 -29
  36. package/packages/FormMaking/custom/items/blank_pro.vue +14 -0
  37. package/packages/FormMaking/custom/items/button.vue +36 -1
  38. package/packages/FormMaking/custom/items/cascader.vue +6 -2
  39. package/packages/FormMaking/custom/items/cell.vue +0 -2
  40. package/packages/FormMaking/custom/items/checkbox.vue +18 -8
  41. package/packages/FormMaking/custom/items/color.vue +1 -1
  42. package/packages/FormMaking/custom/items/date.vue +1 -1
  43. package/packages/FormMaking/custom/items/editor.vue +1 -1
  44. package/packages/FormMaking/custom/items/{grid.vue → grid_dev.vue} +16 -47
  45. package/packages/FormMaking/custom/items/grid_pro.vue +45 -0
  46. package/packages/FormMaking/custom/items/image.vue +0 -28
  47. package/packages/FormMaking/custom/items/input.vue +15 -9
  48. package/packages/FormMaking/custom/items/number.vue +4 -4
  49. package/packages/FormMaking/custom/items/radio.vue +17 -7
  50. package/packages/FormMaking/custom/items/rate.vue +1 -1
  51. package/packages/FormMaking/custom/items/select.vue +12 -6
  52. package/packages/FormMaking/custom/items/slider.vue +1 -1
  53. package/packages/FormMaking/custom/items/switch.vue +1 -1
  54. package/packages/FormMaking/custom/items/{table_h5.vue → tableH5_dev.vue} +44 -49
  55. package/packages/FormMaking/custom/items/tableH5_pro.vue +113 -0
  56. package/packages/FormMaking/custom/items/{table.vue → table_dev.vue} +21 -41
  57. package/packages/FormMaking/custom/items/table_pro.vue +114 -0
  58. package/packages/FormMaking/custom/items/tabs_dev.vue +101 -0
  59. package/packages/FormMaking/custom/items/tabs_pro.vue +50 -0
  60. package/packages/FormMaking/custom/items/text.vue +1 -1
  61. package/packages/FormMaking/custom/items/textarea.vue +4 -13
  62. package/packages/FormMaking/custom/items/time.vue +3 -3
  63. package/packages/FormMaking/custom/items/upload.vue +15 -14
  64. package/packages/FormMaking/custom/mixins/index.js +28 -6
  65. package/packages/FormMaking/custom/register.js +22 -11
  66. package/packages/FormMaking/index.vue +95 -468
  67. package/packages/FormMaking/styles/index.scss +235 -242
  68. package/packages/FormMaking/util/generateCode.js +3 -3
  69. package/packages/FormMaking/util/index.js +33 -23
  70. package/packages/FormMaking/util/request.js +9 -12
  71. package/packages/FormMaking/custom/items/tabs.vue +0 -145
  72. /package/packages/FormMaking/custom/items/{blank.vue → blank_dev.vue} +0 -0
@@ -8,563 +8,34 @@
8
8
  :label="widget.options.hideLabel ? '' : widget.name"
9
9
  :label-width="labelWidth"
10
10
  :prop="prop ? prop : widget.model"
11
- :rules="widget.rules"
11
+ :rules="
12
+ widget.options.required
13
+ ? [
14
+ ...widget.rules,
15
+ { required: true, message: '必需项', trigger: 'change' }
16
+ ]
17
+ : widget.rules
18
+ "
12
19
  :ref="widget.model"
13
20
  >
14
- <template v-if="widget.type == 'input'">
15
- <el-input
16
- v-if="
17
- widget.options.dataType == 'number' ||
18
- widget.options.dataType == 'integer' ||
19
- widget.options.dataType == 'float'
20
- "
21
- type="number"
22
- v-model.number="dataModel"
23
- :placeholder="widget.options.placeholder"
24
- :style="{ width: widget.options.width }"
25
- :disabled="widget.options.disabled"
26
- :readonly="widget.options.readonly"
27
- :clearable="widget.options.clearable"
28
- :maxlength="widget.options.maxlength"
29
- :show-word-limit="widget.options.showWordLimit"
30
- :show-password="widget.options.showPassword"
31
- @input="handleEventAction(widget.events.onChange)"
32
- @focus="handleEventAction(widget.events.onFocus)"
33
- @blur="handleEventAction(widget.events.onBlur)"
34
- >
35
- </el-input>
36
- <el-input
37
- v-else
38
- type="text"
39
- v-model="dataModel"
40
- :placeholder="widget.options.placeholder"
41
- :style="{ width: widget.options.width }"
42
- :disabled="widget.options.disabled"
43
- :readonly="widget.options.readonly"
44
- :clearable="widget.options.clearable"
45
- :maxlength="widget.options.maxlength"
46
- :show-word-limit="widget.options.showWordLimit"
47
- :show-password="widget.options.showPassword"
48
- :suffix-icon="widget.options.suffixIcon"
49
- :prefix-icon="widget.options.prefixIcon"
50
- @input="handleEventAction(widget.events.onChange)"
51
- @focus="handleEventAction(widget.events.onFocus)"
52
- @blur="handleEventAction(widget.events.onBlur)"
53
- >
54
- <template v-if="widget.options.prepend" slot="prepend">{{
55
- widget.options.prepend
56
- }}</template>
57
- <template v-if="widget.options.append" slot="append">{{
58
- widget.options.append
59
- }}</template>
60
- </el-input>
61
- </template>
62
-
63
- <template v-if="widget.type == 'textarea'">
64
- <el-input
65
- type="textarea"
66
- v-model="dataModel"
67
- :disabled="widget.options.disabled"
68
- :placeholder="widget.options.placeholder"
69
- :style="{ width: widget.options.width }"
70
- :maxlength="widget.options.maxlength"
71
- :clearable="widget.options.clearable"
72
- :show-word-limit="widget.options.showWordLimit"
73
- :autosize="{
74
- minRows: widget.options.minRows,
75
- maxRows: widget.options.maxRows
76
- }"
77
- @input="handleEventAction(widget.events.onChange)"
78
- @focus="handleEventAction(widget.events.onFocus)"
79
- @blur="handleEventAction(widget.events.onBlur)"
80
- ></el-input>
81
- </template>
82
-
83
- <template v-if="widget.type == 'cell'">
84
- <th-cell
85
- :title="widget.options.title"
86
- :value="widget.options.value"
87
- :label="widget.options.label"
88
- ></th-cell>
89
- </template>
90
-
91
- <template v-if="widget.type == 'number'">
92
- <el-input-number
93
- v-model="dataModel"
94
- :style="{ width: widget.options.width }"
95
- :step="widget.options.step"
96
- :controls-position="widget.options.controlsPosition ? 'right' : ''"
97
- :disabled="widget.options.disabled"
98
- :min="widget.options.min"
99
- :max="widget.options.max"
100
- :precision="widget.options.precision"
101
- @change="handleEventAction(widget.events.onChange)"
102
- @focus="handleEventAction(widget.events.onFocus)"
103
- @blur="handleEventAction(widget.events.onBlur)"
104
- ></el-input-number>
105
- </template>
106
-
107
- <template v-if="widget.type == 'text'">
108
- <div
109
- :style="{
110
- height: widget.options.height,
111
- textAlign: widget.options.textAlign
112
- }"
113
- v-html="dataModel"
114
- ></div>
115
- </template>
116
-
117
- <template v-if="widget.type == 'radio'">
118
- <el-radio-group
119
- v-model="dataModel"
120
- :style="{ width: widget.options.width }"
121
- :disabled="widget.options.disabled"
122
- @change="handleEventAction(widget.events.onChange)"
123
- >
124
- <template v-if="widget.options.buttonType">
125
- <el-radio-button
126
- :style="{
127
- display: widget.options.inline ? 'inline-block' : 'block'
128
- }"
129
- v-for="(item, index) in widget.options.remote
130
- ? widget.options.remoteOptions
131
- : widget.options.options"
132
- :key="index"
133
- :label="item.value"
134
- :border="widget.options.border"
135
- >
136
- <template v-if="widget.options.remote">{{ item.label }}</template>
137
- <template v-else>{{
138
- widget.options.showLabel ? item.label : item.value
139
- }}</template>
140
- </el-radio-button>
141
- </template>
142
- <template v-else>
143
- <el-radio
144
- :style="{
145
- display: widget.options.inline ? 'inline-block' : 'block'
146
- }"
147
- :label="item.value"
148
- :border="widget.options.border"
149
- v-for="(item, index) in widget.options.remote
150
- ? widget.options.remoteOptions
151
- : widget.options.options"
152
- :key="index"
153
- >
154
- <template v-if="widget.options.remote">{{ item.label }}</template>
155
- <template v-else>{{
156
- widget.options.showLabel ? item.label : item.value
157
- }}</template>
158
- </el-radio>
159
- </template>
160
- </el-radio-group>
161
- </template>
162
-
163
- <template v-if="widget.type == 'checkbox'">
164
- <el-checkbox-group
165
- v-model="dataModel"
166
- :style="{ width: widget.options.width }"
167
- :disabled="widget.options.disabled"
168
- :min="widget.options.min"
169
- :max="widget.options.max"
170
- @change="handleEventAction(widget.events.onChange)"
171
- >
172
- <template v-if="widget.options.buttonType">
173
- <el-checkbox-button
174
- :style="{
175
- display: widget.options.inline ? 'inline-block' : 'block'
176
- }"
177
- :label="item.value"
178
- :border="widget.options.border"
179
- v-for="(item, index) in widget.options.remote
180
- ? widget.options.remoteOptions
181
- : widget.options.options"
182
- :key="index"
183
- >
184
- <template v-if="widget.options.remote">{{ item.label }}</template>
185
- <template v-else>{{
186
- widget.options.showLabel ? item.label : item.value
187
- }}</template>
188
- </el-checkbox-button>
189
- </template>
190
- <template v-else>
191
- <el-checkbox
192
- :style="{
193
- display: widget.options.inline ? 'inline-block' : 'block'
194
- }"
195
- :label="item.value"
196
- :border="widget.options.border"
197
- v-for="(item, index) in widget.options.remote
198
- ? widget.options.remoteOptions
199
- : widget.options.options"
200
- :key="index"
201
- >
202
- <template v-if="widget.options.remote">{{ item.label }}</template>
203
- <template v-else>{{
204
- widget.options.showLabel ? item.label : item.value
205
- }}</template>
206
- </el-checkbox>
207
- </template>
208
- </el-checkbox-group>
209
- </template>
210
-
211
- <template v-if="widget.type == 'time'">
212
- <el-time-picker
213
- v-model="dataModel"
214
- :style="{ width: widget.options.width }"
215
- :is-range="widget.options.isRange"
216
- :placeholder="widget.options.placeholder"
217
- :start-placeholder="widget.options.startPlaceholder"
218
- :end-placeholder="widget.options.endPlaceholder"
219
- :readonly="widget.options.readonly"
220
- :disabled="widget.options.disabled"
221
- :editable="widget.options.editable"
222
- :clearable="widget.options.clearable"
223
- :arrowControl="widget.options.arrowControl"
224
- :value-format="widget.options.format"
225
- :picker-options="{
226
- selectableRange: `${widget.options.pickerOptions.selectableRange[0]} - ${widget.options.pickerOptions.selectableRange[1]}`
227
- }"
228
- @change="handleEventAction(widget.events.onChange)"
229
- @focus="handleEventAction(widget.events.onFocus)"
230
- @blur="handleEventAction(widget.events.onBlur)"
231
- >
232
- </el-time-picker>
233
- </template>
234
-
235
- <template v-if="widget.type == 'date'">
236
- <el-date-picker
237
- v-model="dataModel"
238
- :style="{ width: widget.options.width }"
239
- :type="widget.options.type"
240
- :is-range="widget.options.isRange"
241
- :placeholder="widget.options.placeholder"
242
- :start-placeholder="widget.options.startPlaceholder"
243
- :end-placeholder="widget.options.endPlaceholder"
244
- :readonly="widget.options.readonly"
245
- :disabled="widget.options.disabled"
246
- :editable="widget.options.editable"
247
- :clearable="widget.options.clearable"
248
- :value-format="widget.options.format"
249
- @change="handleEventAction(widget.events.onChange)"
250
- @focus="handleEventAction(widget.events.onFocus)"
251
- @blur="handleEventAction(widget.events.onBlur)"
252
- >
253
- </el-date-picker>
254
- </template>
255
-
256
- <template v-if="widget.type == 'select'">
257
- <el-select
258
- v-model="dataModel"
259
- :style="{ width: widget.options.width }"
260
- :disabled="widget.options.disabled"
261
- :multiple="widget.options.multiple"
262
- :clearable="widget.options.clearable"
263
- :placeholder="widget.options.placeholder"
264
- :collapseTags="widget.options.collapseTags"
265
- :allowCreate="widget.options.allowCreate"
266
- :filterable="
267
- widget.options.allowCreate ? true : widget.options.filterable
268
- "
269
- @change="handleEventAction(widget.events.onChange)"
270
- @focus="handleEventAction(widget.events.onFocus)"
271
- @blur="handleEventAction(widget.events.onBlur)"
272
- >
273
- <el-option
274
- v-for="item in widget.options.remote
275
- ? widget.options.remoteOptions
276
- : widget.options.options"
277
- :key="item.value"
278
- :value="item.value"
279
- :label="
280
- widget.options.showLabel || widget.options.remote
281
- ? item.label
282
- : item.value
283
- "
284
- ></el-option>
285
- </el-select>
286
- </template>
287
-
288
- <template v-if="widget.type == 'color'">
289
- <el-color-picker
290
- v-model="dataModel"
291
- :disabled="widget.options.disabled"
292
- :show-alpha="widget.options.showAlpha"
293
- @change="handleEventAction(widget.events.onChange)"
294
- ></el-color-picker>
295
- </template>
296
-
297
- <template v-if="widget.type == 'switch'">
298
- <el-switch
299
- v-model="dataModel"
300
- :width="widget.options.width - 20"
301
- :disabled="widget.options.disabled"
302
- :inactive-text="widget.options.switchInactiveText"
303
- :active-text="widget.options.switchActiveText"
304
- :inactive-color="widget.options.switchInactiveColor"
305
- :active-color="widget.options.switchActiveColor"
306
- @change="handleEventAction(widget.events.onChange)"
307
- >
308
- </el-switch>
309
- </template>
310
-
311
- <template v-if="widget.type == 'button'">
312
- <el-button
313
- :style="{
314
- width: widget.options.width,
315
- height: widget.options.height
316
- }"
317
- :size="widget.options.buttonSize"
318
- :type="widget.options.buttonType"
319
- :plain="widget.options.buttonPlain"
320
- :round="widget.options.buttonRound"
321
- :circle="widget.options.buttonCircle"
322
- :loading="widget.options.loading"
323
- :disabled="widget.options.disabled"
324
- :icon="widget.options.buttonIcon"
325
- @click="handleEventAction(widget.events.onClick)"
326
- >{{ widget.options.defaultValue }}</el-button
327
- >
328
- </template>
329
-
330
- <template v-if="widget.type == 'slider'">
331
- <el-slider
332
- v-model="dataModel"
333
- :min="widget.options.min"
334
- :max="widget.options.max"
335
- :disabled="widget.options.disabled"
336
- :step="widget.options.step"
337
- :show-input="widget.options.showInput"
338
- :range="widget.options.range"
339
- :style="{
340
- width: widget.options.width,
341
- height: widget.options.height
342
- }"
343
- :show-tooltip="widget.options.showTooltip"
344
- :format-tooltip="
345
- val => formatTooltip(val, widget.options.formatTooltip)
346
- "
347
- :show-stops="widget.options.showStops"
348
- :vertical="widget.options.vertical"
349
- @change="handleEventAction(widget.events.onChange)"
350
- ></el-slider>
351
- </template>
352
-
353
- <template v-if="widget.type == 'rate'">
354
- <el-rate
355
- v-model="dataModel"
356
- :max="widget.options.max"
357
- :disabled="widget.options.disabled"
358
- :allow-half="widget.options.allowHalf"
359
- :show-text="widget.options.showText"
360
- :texts="widget.options.auxiliaryValue"
361
- @change="handleEventAction(widget.events.onChange)"
362
- ></el-rate>
363
- </template>
364
-
365
- <template v-if="widget.type == 'filler'">
366
- <div
367
- :style="{
368
- width: widget.options.width,
369
- height: widget.options.height
370
- }"
371
- ></div>
372
- </template>
373
-
374
- <template v-if="widget.type == 'image'">
375
- <!-- <el-image
376
- :style="{
377
- width: widget.options.width,
378
- height: widget.options.height
379
- }"
380
- :src="widget.options.defaultValue"
381
- :fit="widget.options.fit"
382
- :preview-src-list="[widget.options.defaultValue]"
383
- :lazy="widget.options.isLazy"
384
- ></el-image> -->
385
- <el-image
386
- v-for="(item, index) in widget.options.defaultValue"
387
- :key="index"
388
- :style="{
389
- width: widget.options.width,
390
- height: widget.options.height,
391
- borderRadius: widget.options.borderRadius,
392
- verticalAlign:'middle'
393
- }"
394
- :src="item.url"
395
- :fit="widget.options.fit"
396
- :preview-src-list="imagePreviewList"
397
- :lazy="widget.options.isLazy"
398
- ></el-image>
399
- </template>
400
-
401
- <template v-if="widget.type == 'upload'">
402
- <el-upload
403
- class="upload-demo"
404
- :action="uploadUrl"
405
- :headers="
406
- widget.options.remote ? widget.options.remoteFunc.headers : {}
407
- "
408
- :data="widget.options.remote ? widget.options.remoteFunc.params : {}"
409
- :multiple="widget.options.multiple"
410
- :limit="widget.options.length"
411
- :width="widget.options.size.width"
412
- :height="widget.options.size.height"
413
- :list-type="widget.options.listType"
414
- :drag="widget.options.drag"
415
- :disabled="widget.options.disabled"
416
- :auto-upload="true"
417
- :on-change="handleAvatar"
418
- :on-error="handleAvatarError"
419
- :on-preview="
420
- file => handlePictureCardPreview(file, widget.options.listType)
421
- "
422
- :on-remove="handleRemove"
423
- >
424
- <el-button
425
- size="small"
426
- type="primary"
427
- :disabled="widget.options.disabled"
428
- v-if="
429
- ['default', 'picture'].includes(widget.options.listType) &&
430
- !widget.options.drag
431
- "
432
- >点击上传</el-button
433
- >
434
- <i
435
- slot="default"
436
- class="el-icon-plus"
437
- v-if="
438
- widget.options.listType === 'picture-card' && !widget.options.drag
439
- "
440
- ></i>
441
- <i class="el-icon-upload" v-if="widget.options.drag"></i>
442
- <div class="el-upload__text" v-if="widget.options.drag">
443
- 将文件拖到此处,或<em>点击上传</em>
444
- </div>
445
- <div
446
- slot="tip"
447
- class="el-upload__tip"
448
- v-html="widget.options.elUploadTip"
449
- ></div>
450
- </el-upload>
451
- </template>
452
-
453
- <template v-if="widget.type == 'editor'">
454
- <vue-editor
455
- v-model="dataModel"
456
- :style="{ width: widget.options.width }"
457
- :disabled="widget.options.disabled"
458
- >
459
- </vue-editor>
460
- </template>
461
-
462
- <template v-if="widget.type == 'cascader'">
463
- <el-cascader
464
- v-model="dataModel"
465
- :disabled="widget.options.disabled"
466
- :clearable="widget.options.clearable"
467
- :placeholder="widget.options.placeholder"
468
- :style="{
469
- width: widget.options.width,
470
- height: widget.options.height
471
- }"
472
- :options="widget.options.remoteOptions"
473
- :props="widget.options.props"
474
- :show-all-levels="widget.options.showAllLevels ? false : true"
475
- :collapse-tags="widget.options.collapseTags"
476
- :filterable="widget.options.filterable"
477
- @change="handleEventAction(widget.events.onChange)"
478
- >
479
- <template slot-scope="{ data }">
480
- <span v-html="widget.options.prepend"></span>
481
- <span>{{ data.label }}</span>
482
- <span v-html="widget.options.append"></span>
483
- </template>
484
- </el-cascader>
485
- </template>
486
-
487
- <template v-if="widget.type == 'blank'">
488
- <slot :name="widget.model" />
489
- </template>
490
-
491
- <template v-if="widget.type == 'table'">
492
- <el-table
493
- style="width:100%"
494
- :data="dataModel"
495
- :stripe="widget.options.stripe"
496
- :show-header="widget.options.showHeader"
497
- :highlight-current-row="widget.options.highlightCurrentRow"
498
- :border="widget.options.border"
499
- >
500
- <el-table-column
501
- v-if="widget.options.isSerial"
502
- label="序号"
503
- type="index"
504
- width="50"
505
- align="center"
506
- >
507
- </el-table-column>
508
- <el-table-column
509
- v-for="element in widget.list"
510
- :key="`table_${element.key}`"
511
- :label="element.name"
512
- :prop="element.model"
513
- :width="element.options.width"
514
- >
515
- <template slot-scope="scope">
516
- <genetate-form-item
517
- :models.sync="dataModel[scope.$index]"
518
- :widget="element"
519
- :remote="remote"
520
- :config="config"
521
- :prop="`${prop}.${scope.$index}.${element.model}`"
522
- :slotKeys="slotKeys"
523
- :componentsData="componentsData"
524
- >
525
- <template v-for="name in slotKeys" :slot="name">
526
- <slot :name="name" />
527
- </template>
528
- </genetate-form-item>
529
- </template>
530
- </el-table-column>
531
- <el-table-column
532
- v-if="widget.options.isDelete"
533
- fixed="right"
534
- label="操作"
535
- width="60"
536
- align="center"
537
- >
538
- <template slot-scope="scope">
539
- <el-button
540
- style="color:#F56C6C"
541
- type="text"
542
- @click.native.prevent="handleTableDelete(scope.$index)"
543
- >
544
- 移除
545
- </el-button>
546
- </template>
547
- </el-table-column>
548
- <template v-if="widget.options.isAdd" slot="append">
549
- <div
550
- style="text-align: center;"
551
- :style="{
552
- borderTop:
553
- dataModel && dataModel.length != 0 ? '' : '1px solid #EBEEF5'
554
- }"
555
- >
556
- <el-button
557
- type="text"
558
- :disabled="widget.options.disabled"
559
- @click="handleTableAdd"
560
- >新增</el-button
561
- >
562
- </div>
563
- </template>
564
- </el-table>
565
- </template>
566
-
567
- <template v-if="widget.type == 'table_h5'">
21
+ <component
22
+ :is="compsData[widget.type].content"
23
+ :value.sync="dataModel"
24
+ :widget="widget"
25
+ :config="config"
26
+ :models="models"
27
+ :remote="remote"
28
+ :prop="prop"
29
+ :slotKeys="slotKeys"
30
+ :componentsData="componentsData"
31
+ @button-submit="handleButtonSubmit"
32
+ ></component>
33
+
34
+ <!-- <template v-if="widget.type == 'input'">
35
+
36
+
37
+
38
+ <template v-if="widget.type == 'tableH5'">
568
39
  <div class="tableH5">
569
40
  <div
570
41
  v-for="(column, columnIndex) in dataModel"
@@ -575,7 +46,7 @@
575
46
  v-for="(element, elementIndex) in widget.list"
576
47
  :key="`table_h5_${columnIndex}_${element.key}`"
577
48
  >
578
- <genetate-form-item
49
+ <generate-form-item
579
50
  style="flex:1;"
580
51
  :models.sync="column"
581
52
  :widget="element"
@@ -592,7 +63,7 @@
592
63
  <template v-for="name in slotKeys" :slot="name">
593
64
  <slot :name="name" />
594
65
  </template>
595
- </genetate-form-item>
66
+ </generate-form-item>
596
67
  <div
597
68
  v-if="
598
69
  widget.options.isDelete &&
@@ -628,11 +99,11 @@
628
99
  :align="widget.options.align"
629
100
  >
630
101
  <th-col
631
- v-for="(column, columnIndex) in widget.columns"
102
+ v-for="(column, columnIndex) in widget.options.columns"
632
103
  :key="columnIndex"
633
104
  :span="column.span"
634
105
  >
635
- <genetate-form-item
106
+ <generate-form-item
636
107
  v-for="element in column.list"
637
108
  :key="element.key"
638
109
  :widget="element"
@@ -646,20 +117,24 @@
646
117
  <template v-for="name in slotKeys" :slot="name">
647
118
  <slot :name="name" />
648
119
  </template>
649
- </genetate-form-item>
120
+ </generate-form-item>
650
121
  </th-col>
651
122
  </th-row>
652
123
  </template>
653
124
 
654
125
  <template v-if="widget.type == 'tabs'">
655
- <el-tabs v-model="widget.options.defaultValue">
126
+ <el-tabs
127
+ v-model="widget.options.defaultValue"
128
+ :type="widget.options.type"
129
+ :tab-position="widget.options.tabPosition"
130
+ >
656
131
  <el-tab-pane
657
- v-for="(column, columnIndex) in widget.tabs"
132
+ v-for="(column, columnIndex) in widget.options.columns"
658
133
  :key="`tabs_${columnIndex}`"
659
134
  :label="column.label"
660
135
  :name="column.value"
661
136
  >
662
- <genetate-form-item
137
+ <generate-form-item
663
138
  v-for="element in column.list"
664
139
  :key="`tabs_${columnIndex}_${element.key}`"
665
140
  :widget="element"
@@ -677,7 +152,7 @@
677
152
  <template v-for="name in slotKeys" :slot="name">
678
153
  <slot :name="name" />
679
154
  </template>
680
- </genetate-form-item>
155
+ </generate-form-item>
681
156
  </el-tab-pane>
682
157
  </el-tabs>
683
158
  </template>
@@ -690,20 +165,18 @@
690
165
 
691
166
  <el-dialog :visible.sync="dialogVisible" append-to-body>
692
167
  <img width="100%" :src="dialogImageUrl" alt="" />
693
- </el-dialog>
168
+ </el-dialog> -->
694
169
  </el-form-item>
695
170
  </template>
696
171
 
697
172
  <script>
698
- import FmUpload from "./Upload";
173
+ import { inputTypeDict } from "./util/index";
699
174
  import { VueEditor } from "vue2-editor";
700
- import ThCell from "ui/Cell/index.vue";
701
- import ThImage from "ui/Image/index.vue";
702
- import ThRow from "ui/Row/index.vue";
703
- import ThCol from "ui/Col/index.vue";
175
+ import compsData from "./custom/register";
176
+ import FmUpload from "./Upload";
704
177
 
705
178
  export default {
706
- name: "genetate-form-item",
179
+ name: "generate-form-item",
707
180
  props: [
708
181
  "widget",
709
182
  "models",
@@ -713,9 +186,10 @@ export default {
713
186
  "config",
714
187
  "componentsData"
715
188
  ],
716
- components: { FmUpload, VueEditor, ThCell, ThImage, ThRow, ThCol },
189
+ components: { FmUpload, VueEditor },
717
190
  data() {
718
191
  return {
192
+ compsData: JSON.parse(JSON.stringify(compsData)),
719
193
  dataModel: this.models[this.widget.model],
720
194
  dialogVisible: false,
721
195
  dialogImageUrl: ""
@@ -754,7 +228,7 @@ export default {
754
228
  let baseUrl = "";
755
229
  if (info) baseUrl = JSON.parse(info).baseUrl;
756
230
 
757
- return `${baseUrl}/${this.widget.options.remoteFunc.api}`;
231
+ return `${baseUrl}/${this.widget.options.remoteFunc.url}`;
758
232
  } else {
759
233
  return this.widget.options.action;
760
234
  }
@@ -767,21 +241,36 @@ export default {
767
241
  return list;
768
242
  }
769
243
  },
770
- created() {},
244
+ created() {
245
+ const proComponentsPath = {
246
+ grid: "grid_pro",
247
+ table: "table_pro",
248
+ tableH5: "tableH5_pro",
249
+ tabs: "tabs_pro",
250
+ blank: "blank_pro"
251
+ };
252
+ const keys = Object.keys(this.compsData);
253
+ for (const key of keys) {
254
+ if (proComponentsPath[key])
255
+ this.compsData[
256
+ key
257
+ ].content = require(`./custom/items/${proComponentsPath[key]}`).default;
258
+ else
259
+ this.compsData[key].content = require(`./custom/items/${key}`).default;
260
+ }
261
+ },
771
262
  mounted() {
772
263
  this.$nextTick(() => {
773
264
  this.componentsData[this.widget.model] = this.widget;
774
265
  });
775
266
  },
776
267
  methods: {
268
+ inputTypeDict,
777
269
  handleTimePicker(vals) {
778
270
  this.dataModel = [];
779
271
  this.dataModel[0] = vals;
780
272
  this.widget.options.endTimePickerOptions.minTime = vals;
781
273
  },
782
- formatTooltip(val, num) {
783
- return val / num;
784
- },
785
274
  handlePictureCardPreview(file, listType) {
786
275
  if (listType === "picture-card") {
787
276
  this.dialogImageUrl = file.url;
@@ -807,8 +296,8 @@ export default {
807
296
  let dic = {};
808
297
  this.widget.list.forEach(item => {
809
298
  if (item.type === "grid") {
810
- for (let i = 0; i < item.columns.length; i++) {
811
- const element = item.columns[i];
299
+ for (let i = 0; i < item.options.columns.length; i++) {
300
+ const element = item.options.columns[i];
812
301
  for (let j = 0; j < element.list.length; j++) {
813
302
  const element2 = element.list[j];
814
303
  dic[element2.model] = element2.options.defaultValue;
@@ -823,6 +312,9 @@ export default {
823
312
  handleTableDelete(index) {
824
313
  this.dataModel.splice(index, 1);
825
314
  },
315
+ handleButtonSubmit(val) {
316
+ this.$emit("button-submit", val);
317
+ },
826
318
 
827
319
  // 支撑 JavaScript 动态编译
828
320
  handleEventAction(key) {
@@ -832,7 +324,7 @@ export default {
832
324
  for (let i = 0; i < eventScript.length; i++) {
833
325
  const element = eventScript[i];
834
326
  if (element.key === key) {
835
- const func = `(item,value)=>{${element.func}}`;
327
+ const func = `(item,value)=>{${element.value}}`;
836
328
  eval(func)(this.widget, this.dataModel);
837
329
  }
838
330
  }
@@ -879,7 +371,7 @@ export default {
879
371
  }
880
372
  },
881
373
  // 获取数据,仅支持获取当前组件节点下的数据
882
- getData() {
374
+ getData(obj) {
883
375
  return this.models;
884
376
  }
885
377
  }