tianheng-ui 0.1.10 → 0.1.11
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/lib/theme-chalk/styles/reset.scss +0 -2
- package/lib/tianheng-ui.js +14 -14
- package/package.json +1 -1
- package/packages/FormMaking/GenerateForm.vue +10 -10
- package/packages/FormMaking/GenerateFormItem.vue +66 -578
- package/packages/FormMaking/GenerateFormItemH5.vue +5 -5
- package/packages/FormMaking/Upload/index.vue +0 -1
- package/packages/FormMaking/WidgetConfig.vue +66 -30
- package/packages/FormMaking/WidgetForm.vue +7 -48
- package/packages/FormMaking/WidgetFormItem.vue +41 -65
- package/packages/FormMaking/WidgetSelect.vue +160 -0
- package/packages/FormMaking/custom/config.js +98 -63
- package/packages/FormMaking/custom/configs/grid.vue +4 -4
- package/packages/FormMaking/custom/configs/input.vue +135 -28
- package/packages/FormMaking/custom/configs/number.vue +2 -2
- package/packages/FormMaking/custom/configs/table.vue +2 -2
- package/packages/FormMaking/custom/configs/{table_h5.vue → tableH5.vue} +2 -2
- package/packages/FormMaking/custom/configs/tabs.vue +6 -6
- package/packages/FormMaking/custom/configs/textarea.vue +121 -19
- package/packages/FormMaking/custom/index.js +2 -4
- package/packages/FormMaking/custom/items/alliance.vue +30 -29
- package/packages/FormMaking/custom/items/blank_pro.vue +14 -0
- package/packages/FormMaking/custom/items/button.vue +1 -0
- package/packages/FormMaking/custom/items/cascader.vue +6 -2
- package/packages/FormMaking/custom/items/cell.vue +0 -2
- package/packages/FormMaking/custom/items/checkbox.vue +17 -7
- package/packages/FormMaking/custom/items/color.vue +1 -1
- package/packages/FormMaking/custom/items/date.vue +1 -1
- package/packages/FormMaking/custom/items/editor.vue +1 -1
- package/packages/FormMaking/custom/items/{grid.vue → grid_dev.vue} +16 -47
- package/packages/FormMaking/custom/items/grid_pro.vue +45 -0
- package/packages/FormMaking/custom/items/image.vue +0 -28
- package/packages/FormMaking/custom/items/input.vue +15 -9
- package/packages/FormMaking/custom/items/number.vue +4 -4
- package/packages/FormMaking/custom/items/radio.vue +17 -7
- package/packages/FormMaking/custom/items/rate.vue +1 -1
- package/packages/FormMaking/custom/items/select.vue +12 -6
- package/packages/FormMaking/custom/items/slider.vue +1 -1
- package/packages/FormMaking/custom/items/switch.vue +1 -1
- package/packages/FormMaking/custom/items/{table_h5.vue → tableH5_dev.vue} +44 -49
- package/packages/FormMaking/custom/items/tableH5_pro.vue +113 -0
- package/packages/FormMaking/custom/items/{table.vue → table_dev.vue} +21 -41
- package/packages/FormMaking/custom/items/table_pro.vue +114 -0
- package/packages/FormMaking/custom/items/tabs_dev.vue +101 -0
- package/packages/FormMaking/custom/items/tabs_pro.vue +50 -0
- package/packages/FormMaking/custom/items/text.vue +1 -1
- package/packages/FormMaking/custom/items/textarea.vue +4 -13
- package/packages/FormMaking/custom/items/time.vue +3 -3
- package/packages/FormMaking/custom/items/upload.vue +15 -14
- package/packages/FormMaking/custom/mixins/index.js +23 -1
- package/packages/FormMaking/custom/register.js +22 -11
- package/packages/FormMaking/index.vue +11 -7
- package/packages/FormMaking/styles/index.scss +235 -221
- package/packages/FormMaking/util/generateCode.js +3 -3
- package/packages/FormMaking/util/index.js +33 -23
- package/packages/FormMaking/custom/items/tabs.vue +0 -145
- /package/packages/FormMaking/custom/items/{blank.vue → blank_dev.vue} +0 -0
@@ -8,563 +8,33 @@
|
|
8
8
|
:label="widget.options.hideLabel ? '' : widget.name"
|
9
9
|
:label-width="labelWidth"
|
10
10
|
:prop="prop ? prop : widget.model"
|
11
|
-
: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
|
-
<
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
+
></component>
|
32
|
+
|
33
|
+
<!-- <template v-if="widget.type == 'input'">
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
<template v-if="widget.type == 'tableH5'">
|
568
38
|
<div class="tableH5">
|
569
39
|
<div
|
570
40
|
v-for="(column, columnIndex) in dataModel"
|
@@ -575,7 +45,7 @@
|
|
575
45
|
v-for="(element, elementIndex) in widget.list"
|
576
46
|
:key="`table_h5_${columnIndex}_${element.key}`"
|
577
47
|
>
|
578
|
-
<
|
48
|
+
<generate-form-item
|
579
49
|
style="flex:1;"
|
580
50
|
:models.sync="column"
|
581
51
|
:widget="element"
|
@@ -592,7 +62,7 @@
|
|
592
62
|
<template v-for="name in slotKeys" :slot="name">
|
593
63
|
<slot :name="name" />
|
594
64
|
</template>
|
595
|
-
</
|
65
|
+
</generate-form-item>
|
596
66
|
<div
|
597
67
|
v-if="
|
598
68
|
widget.options.isDelete &&
|
@@ -628,11 +98,11 @@
|
|
628
98
|
:align="widget.options.align"
|
629
99
|
>
|
630
100
|
<th-col
|
631
|
-
v-for="(column, columnIndex) in widget.columns"
|
101
|
+
v-for="(column, columnIndex) in widget.options.columns"
|
632
102
|
:key="columnIndex"
|
633
103
|
:span="column.span"
|
634
104
|
>
|
635
|
-
<
|
105
|
+
<generate-form-item
|
636
106
|
v-for="element in column.list"
|
637
107
|
:key="element.key"
|
638
108
|
:widget="element"
|
@@ -646,20 +116,24 @@
|
|
646
116
|
<template v-for="name in slotKeys" :slot="name">
|
647
117
|
<slot :name="name" />
|
648
118
|
</template>
|
649
|
-
</
|
119
|
+
</generate-form-item>
|
650
120
|
</th-col>
|
651
121
|
</th-row>
|
652
122
|
</template>
|
653
123
|
|
654
124
|
<template v-if="widget.type == 'tabs'">
|
655
|
-
<el-tabs
|
125
|
+
<el-tabs
|
126
|
+
v-model="widget.options.defaultValue"
|
127
|
+
:type="widget.options.type"
|
128
|
+
:tab-position="widget.options.tabPosition"
|
129
|
+
>
|
656
130
|
<el-tab-pane
|
657
|
-
v-for="(column, columnIndex) in widget.
|
131
|
+
v-for="(column, columnIndex) in widget.options.columns"
|
658
132
|
:key="`tabs_${columnIndex}`"
|
659
133
|
:label="column.label"
|
660
134
|
:name="column.value"
|
661
135
|
>
|
662
|
-
<
|
136
|
+
<generate-form-item
|
663
137
|
v-for="element in column.list"
|
664
138
|
:key="`tabs_${columnIndex}_${element.key}`"
|
665
139
|
:widget="element"
|
@@ -677,7 +151,7 @@
|
|
677
151
|
<template v-for="name in slotKeys" :slot="name">
|
678
152
|
<slot :name="name" />
|
679
153
|
</template>
|
680
|
-
</
|
154
|
+
</generate-form-item>
|
681
155
|
</el-tab-pane>
|
682
156
|
</el-tabs>
|
683
157
|
</template>
|
@@ -690,20 +164,18 @@
|
|
690
164
|
|
691
165
|
<el-dialog :visible.sync="dialogVisible" append-to-body>
|
692
166
|
<img width="100%" :src="dialogImageUrl" alt="" />
|
693
|
-
</el-dialog>
|
167
|
+
</el-dialog> -->
|
694
168
|
</el-form-item>
|
695
169
|
</template>
|
696
170
|
|
697
171
|
<script>
|
698
|
-
import
|
172
|
+
import { inputTypeDict } from "./util/index";
|
699
173
|
import { VueEditor } from "vue2-editor";
|
700
|
-
import
|
701
|
-
import
|
702
|
-
import ThRow from "ui/Row/index.vue";
|
703
|
-
import ThCol from "ui/Col/index.vue";
|
174
|
+
import compsData from "./custom/register";
|
175
|
+
import FmUpload from "./Upload";
|
704
176
|
|
705
177
|
export default {
|
706
|
-
name: "
|
178
|
+
name: "generate-form-item",
|
707
179
|
props: [
|
708
180
|
"widget",
|
709
181
|
"models",
|
@@ -713,9 +185,10 @@ export default {
|
|
713
185
|
"config",
|
714
186
|
"componentsData"
|
715
187
|
],
|
716
|
-
components: { FmUpload, VueEditor
|
188
|
+
components: { FmUpload, VueEditor },
|
717
189
|
data() {
|
718
190
|
return {
|
191
|
+
compsData: JSON.parse(JSON.stringify(compsData)),
|
719
192
|
dataModel: this.models[this.widget.model],
|
720
193
|
dialogVisible: false,
|
721
194
|
dialogImageUrl: ""
|
@@ -767,21 +240,36 @@ export default {
|
|
767
240
|
return list;
|
768
241
|
}
|
769
242
|
},
|
770
|
-
created() {
|
243
|
+
created() {
|
244
|
+
const proComponentsPath = {
|
245
|
+
grid: "grid_pro",
|
246
|
+
table: "table_pro",
|
247
|
+
tableH5: "tableH5_pro",
|
248
|
+
tabs: "tabs_pro",
|
249
|
+
blank: "blank_pro"
|
250
|
+
};
|
251
|
+
const keys = Object.keys(this.compsData);
|
252
|
+
for (const key of keys) {
|
253
|
+
if (proComponentsPath[key])
|
254
|
+
this.compsData[
|
255
|
+
key
|
256
|
+
].content = require(`./custom/items/${proComponentsPath[key]}`).default;
|
257
|
+
else
|
258
|
+
this.compsData[key].content = require(`./custom/items/${key}`).default;
|
259
|
+
}
|
260
|
+
},
|
771
261
|
mounted() {
|
772
262
|
this.$nextTick(() => {
|
773
263
|
this.componentsData[this.widget.model] = this.widget;
|
774
264
|
});
|
775
265
|
},
|
776
266
|
methods: {
|
267
|
+
inputTypeDict,
|
777
268
|
handleTimePicker(vals) {
|
778
269
|
this.dataModel = [];
|
779
270
|
this.dataModel[0] = vals;
|
780
271
|
this.widget.options.endTimePickerOptions.minTime = vals;
|
781
272
|
},
|
782
|
-
formatTooltip(val, num) {
|
783
|
-
return val / num;
|
784
|
-
},
|
785
273
|
handlePictureCardPreview(file, listType) {
|
786
274
|
if (listType === "picture-card") {
|
787
275
|
this.dialogImageUrl = file.url;
|
@@ -807,8 +295,8 @@ export default {
|
|
807
295
|
let dic = {};
|
808
296
|
this.widget.list.forEach(item => {
|
809
297
|
if (item.type === "grid") {
|
810
|
-
for (let i = 0; i < item.columns.length; i++) {
|
811
|
-
const element = item.columns[i];
|
298
|
+
for (let i = 0; i < item.options.columns.length; i++) {
|
299
|
+
const element = item.options.columns[i];
|
812
300
|
for (let j = 0; j < element.list.length; j++) {
|
813
301
|
const element2 = element.list[j];
|
814
302
|
dic[element2.model] = element2.options.defaultValue;
|