tianheng-ui 0.1.63 → 0.1.65
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/theme-chalk/index.scss +1 -1
- package/lib/theme-chalk/styles/feature.scss +1 -0
- package/lib/tianheng-ui.js +13 -13
- package/package.json +1 -1
- package/packages/CodeEditor/index.vue +41 -19
- package/packages/FormMaking/GenerateForm.vue +67 -71
- package/packages/FormMaking/WidgetConfig.vue +1 -1
- package/packages/FormMaking/WidgetForm.vue +11 -5
- package/packages/FormMaking/WidgetFormItem.vue +11 -4
- package/packages/FormMaking/WidgetGuide.vue +0 -0
- package/packages/FormMaking/WidgetTools.vue +2 -2
- package/packages/FormMaking/custom/config.js +320 -76
- package/packages/FormMaking/custom/configs/blank.vue +1 -1
- package/packages/FormMaking/custom/configs/button.vue +2 -2
- package/packages/FormMaking/custom/configs/cascader.vue +71 -34
- package/packages/FormMaking/custom/configs/cell.vue +1 -1
- package/packages/FormMaking/custom/configs/checkbox.vue +95 -64
- package/packages/FormMaking/custom/configs/color.vue +1 -1
- package/packages/FormMaking/custom/configs/date.vue +1 -1
- package/packages/FormMaking/custom/configs/descriptions.vue +314 -0
- package/packages/FormMaking/custom/configs/divider.vue +1 -1
- package/packages/FormMaking/custom/configs/editor.vue +1 -1
- package/packages/FormMaking/custom/configs/filler.vue +1 -1
- package/packages/FormMaking/custom/configs/grid.vue +33 -22
- package/packages/FormMaking/custom/configs/image.vue +1 -1
- package/packages/FormMaking/custom/configs/input.vue +1 -1
- package/packages/FormMaking/custom/configs/number.vue +1 -1
- package/packages/FormMaking/custom/configs/radio.vue +84 -53
- package/packages/FormMaking/custom/configs/rate.vue +1 -1
- package/packages/FormMaking/custom/configs/select.vue +157 -158
- package/packages/FormMaking/custom/configs/slider.vue +1 -1
- package/packages/FormMaking/custom/configs/switch.vue +1 -1
- package/packages/FormMaking/custom/configs/table.vue +1 -1
- package/packages/FormMaking/custom/configs/tableH5.vue +1 -1
- package/packages/FormMaking/custom/configs/tabs.vue +1 -1
- package/packages/FormMaking/custom/configs/text.vue +1 -1
- package/packages/FormMaking/custom/configs/textarea.vue +1 -1
- package/packages/FormMaking/custom/configs/time.vue +1 -1
- package/packages/FormMaking/custom/configs/upload.vue +1 -1
- package/packages/FormMaking/custom/configs/workflow.vue +494 -0
- package/packages/FormMaking/custom/index.js +4 -2
- package/packages/FormMaking/custom/items/cascader.vue +2 -2
- package/packages/FormMaking/custom/items/checkbox.vue +6 -10
- package/packages/FormMaking/custom/items/descriptions.vue +75 -0
- package/packages/FormMaking/custom/items/grid_dev.vue +2 -2
- package/packages/FormMaking/custom/items/list_dev.vue +10 -22
- package/packages/FormMaking/custom/items/radio.vue +5 -9
- package/packages/FormMaking/custom/items/select.vue +2 -4
- package/packages/FormMaking/custom/items/tableH5_dev.vue +9 -18
- package/packages/FormMaking/custom/items/table_dev.vue +13 -3
- package/packages/FormMaking/custom/items/tabs_dev.vue +3 -2
- package/packages/FormMaking/custom/items/workflow.vue +131 -0
- package/packages/FormMaking/custom/register.js +15 -1
- package/packages/FormMaking/index.vue +61 -27
- package/packages/FormMaking/styles/index.scss +156 -478
- package/packages/TableMaking/index.vue +4 -1
- package/packages/TableMaking/widgetGuide.vue +96 -0
- package/packages/TableMaking/widgetTable.vue +0 -7
- package/packages/Workflow/index.vue +0 -31
- package/packages/FormMaking/GenerateFormItemH5.vue +0 -825
@@ -1,825 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div
|
3
|
-
v-show="!widget.options.hidden"
|
4
|
-
:class="{
|
5
|
-
[widget.model]: true,
|
6
|
-
[widget.type]: true
|
7
|
-
}"
|
8
|
-
:ref="widget.model"
|
9
|
-
>
|
10
|
-
<template v-if="widget.type == 'input'">
|
11
|
-
<van-field
|
12
|
-
v-model="dataModel"
|
13
|
-
:name="prop ? prop : widget.model"
|
14
|
-
:label="widget.options.hideLabel ? '' : widget.name"
|
15
|
-
:label-width="labelWidth"
|
16
|
-
:placeholder="widget.options.placeholder"
|
17
|
-
:required="widget.options.required"
|
18
|
-
colon
|
19
|
-
:rules="widget.rules"
|
20
|
-
/>
|
21
|
-
</template>
|
22
|
-
|
23
|
-
<template v-if="widget.type == 'textarea'">
|
24
|
-
<el-input
|
25
|
-
type="textarea"
|
26
|
-
v-model="dataModel"
|
27
|
-
:disabled="widget.options.disabled"
|
28
|
-
:placeholder="widget.options.placeholder"
|
29
|
-
:style="{ width: widget.options.width }"
|
30
|
-
:maxlength="widget.options.maxlength"
|
31
|
-
:clearable="widget.options.clearable"
|
32
|
-
:show-word-limit="widget.options.showWordLimit"
|
33
|
-
:autosize="{
|
34
|
-
minRows: widget.options.minRows,
|
35
|
-
maxRows: widget.options.maxRows
|
36
|
-
}"
|
37
|
-
@input="handleEventAction(widget.events.onChange)"
|
38
|
-
@focus="handleEventAction(widget.events.onFocus)"
|
39
|
-
@blur="handleEventAction(widget.events.onBlur)"
|
40
|
-
></el-input>
|
41
|
-
</template>
|
42
|
-
|
43
|
-
<template v-if="widget.type == 'cell'">
|
44
|
-
<th-cell
|
45
|
-
:title="widget.options.title"
|
46
|
-
:value="widget.options.value"
|
47
|
-
:label="widget.options.label"
|
48
|
-
></th-cell>
|
49
|
-
</template>
|
50
|
-
|
51
|
-
<template v-if="widget.type == 'number'">
|
52
|
-
<el-input-number
|
53
|
-
v-model="dataModel"
|
54
|
-
:style="{ width: widget.options.width }"
|
55
|
-
:step="widget.options.step"
|
56
|
-
:controls-position="widget.options.controlsPosition ? 'right' : ''"
|
57
|
-
:disabled="widget.options.disabled"
|
58
|
-
:min="widget.options.min"
|
59
|
-
:max="widget.options.max"
|
60
|
-
:precision="widget.options.precision"
|
61
|
-
@change="handleEventAction(widget.events.onChange)"
|
62
|
-
@focus="handleEventAction(widget.events.onFocus)"
|
63
|
-
@blur="handleEventAction(widget.events.onBlur)"
|
64
|
-
></el-input-number>
|
65
|
-
</template>
|
66
|
-
|
67
|
-
<template v-if="widget.type == 'text'">
|
68
|
-
<div
|
69
|
-
:style="{
|
70
|
-
height: widget.options.height,
|
71
|
-
textAlign: widget.options.textAlign
|
72
|
-
}"
|
73
|
-
v-html="dataModel"
|
74
|
-
></div>
|
75
|
-
</template>
|
76
|
-
|
77
|
-
<template v-if="widget.type == 'radio'">
|
78
|
-
<el-radio-group
|
79
|
-
v-model="dataModel"
|
80
|
-
:style="{ width: widget.options.width }"
|
81
|
-
:disabled="widget.options.disabled"
|
82
|
-
@change="handleEventAction(widget.events.onChange)"
|
83
|
-
>
|
84
|
-
<template v-if="widget.options.buttonType">
|
85
|
-
<el-radio-button
|
86
|
-
:style="{
|
87
|
-
display: widget.options.inline ? 'inline-block' : 'block'
|
88
|
-
}"
|
89
|
-
v-for="(item, index) in widget.options.remote
|
90
|
-
? widget.options.remoteOptions
|
91
|
-
: widget.options.options"
|
92
|
-
:key="index"
|
93
|
-
:label="item.value"
|
94
|
-
:border="widget.options.border"
|
95
|
-
>
|
96
|
-
<template v-if="widget.options.remote">{{ item.label }}</template>
|
97
|
-
<template v-else>{{
|
98
|
-
widget.options.showLabel ? item.label : item.value
|
99
|
-
}}</template>
|
100
|
-
</el-radio-button>
|
101
|
-
</template>
|
102
|
-
<template v-else>
|
103
|
-
<el-radio
|
104
|
-
:style="{
|
105
|
-
display: widget.options.inline ? 'inline-block' : 'block'
|
106
|
-
}"
|
107
|
-
:label="item.value"
|
108
|
-
:border="widget.options.border"
|
109
|
-
v-for="(item, index) in widget.options.remote
|
110
|
-
? widget.options.remoteOptions
|
111
|
-
: widget.options.options"
|
112
|
-
:key="index"
|
113
|
-
>
|
114
|
-
<template v-if="widget.options.remote">{{ item.label }}</template>
|
115
|
-
<template v-else>{{
|
116
|
-
widget.options.showLabel ? item.label : item.value
|
117
|
-
}}</template>
|
118
|
-
</el-radio>
|
119
|
-
</template>
|
120
|
-
</el-radio-group>
|
121
|
-
</template>
|
122
|
-
|
123
|
-
<template v-if="widget.type == 'checkbox'">
|
124
|
-
<el-checkbox-group
|
125
|
-
v-model="dataModel"
|
126
|
-
:style="{ width: widget.options.width }"
|
127
|
-
:disabled="widget.options.disabled"
|
128
|
-
:min="widget.options.min"
|
129
|
-
:max="widget.options.max"
|
130
|
-
@change="handleEventAction(widget.events.onChange)"
|
131
|
-
>
|
132
|
-
<template v-if="widget.options.buttonType">
|
133
|
-
<el-checkbox-button
|
134
|
-
:style="{
|
135
|
-
display: widget.options.inline ? 'inline-block' : 'block'
|
136
|
-
}"
|
137
|
-
:label="item.value"
|
138
|
-
:border="widget.options.border"
|
139
|
-
v-for="(item, index) in widget.options.remote
|
140
|
-
? widget.options.remoteOptions
|
141
|
-
: widget.options.options"
|
142
|
-
:key="index"
|
143
|
-
>
|
144
|
-
<template v-if="widget.options.remote">{{ item.label }}</template>
|
145
|
-
<template v-else>{{
|
146
|
-
widget.options.showLabel ? item.label : item.value
|
147
|
-
}}</template>
|
148
|
-
</el-checkbox-button>
|
149
|
-
</template>
|
150
|
-
<template v-else>
|
151
|
-
<el-checkbox
|
152
|
-
:style="{
|
153
|
-
display: widget.options.inline ? 'inline-block' : 'block'
|
154
|
-
}"
|
155
|
-
:label="item.value"
|
156
|
-
:border="widget.options.border"
|
157
|
-
v-for="(item, index) in widget.options.remote
|
158
|
-
? widget.options.remoteOptions
|
159
|
-
: widget.options.options"
|
160
|
-
:key="index"
|
161
|
-
>
|
162
|
-
<template v-if="widget.options.remote">{{ item.label }}</template>
|
163
|
-
<template v-else>{{
|
164
|
-
widget.options.showLabel ? item.label : item.value
|
165
|
-
}}</template>
|
166
|
-
</el-checkbox>
|
167
|
-
</template>
|
168
|
-
</el-checkbox-group>
|
169
|
-
</template>
|
170
|
-
|
171
|
-
<template v-if="widget.type == 'time'">
|
172
|
-
<el-time-picker
|
173
|
-
v-model="dataModel"
|
174
|
-
:style="{ width: widget.options.width }"
|
175
|
-
:is-range="widget.options.isRange"
|
176
|
-
:placeholder="widget.options.placeholder"
|
177
|
-
:start-placeholder="widget.options.startPlaceholder"
|
178
|
-
:end-placeholder="widget.options.endPlaceholder"
|
179
|
-
:readonly="widget.options.readonly"
|
180
|
-
:disabled="widget.options.disabled"
|
181
|
-
:editable="widget.options.editable"
|
182
|
-
:clearable="widget.options.clearable"
|
183
|
-
:arrowControl="widget.options.arrowControl"
|
184
|
-
:value-format="widget.options.format"
|
185
|
-
:picker-options="{
|
186
|
-
selectableRange: `${widget.options.pickerOptions.selectableRange[0]} - ${widget.options.pickerOptions.selectableRange[1]}`
|
187
|
-
}"
|
188
|
-
@change="handleEventAction(widget.events.onChange)"
|
189
|
-
@focus="handleEventAction(widget.events.onFocus)"
|
190
|
-
@blur="handleEventAction(widget.events.onBlur)"
|
191
|
-
>
|
192
|
-
</el-time-picker>
|
193
|
-
</template>
|
194
|
-
|
195
|
-
<template v-if="widget.type == 'date'">
|
196
|
-
<el-date-picker
|
197
|
-
v-model="dataModel"
|
198
|
-
:style="{ width: widget.options.width }"
|
199
|
-
:type="widget.options.type"
|
200
|
-
:is-range="widget.options.isRange"
|
201
|
-
:placeholder="widget.options.placeholder"
|
202
|
-
:start-placeholder="widget.options.startPlaceholder"
|
203
|
-
:end-placeholder="widget.options.endPlaceholder"
|
204
|
-
:readonly="widget.options.readonly"
|
205
|
-
:disabled="widget.options.disabled"
|
206
|
-
:editable="widget.options.editable"
|
207
|
-
:clearable="widget.options.clearable"
|
208
|
-
:value-format="widget.options.format"
|
209
|
-
@change="handleEventAction(widget.events.onChange)"
|
210
|
-
@focus="handleEventAction(widget.events.onFocus)"
|
211
|
-
@blur="handleEventAction(widget.events.onBlur)"
|
212
|
-
>
|
213
|
-
</el-date-picker>
|
214
|
-
</template>
|
215
|
-
|
216
|
-
<template v-if="widget.type == 'select'">
|
217
|
-
<el-select
|
218
|
-
v-model="dataModel"
|
219
|
-
:style="{ width: widget.options.width }"
|
220
|
-
:disabled="widget.options.disabled"
|
221
|
-
:multiple="widget.options.multiple"
|
222
|
-
:clearable="widget.options.clearable"
|
223
|
-
:placeholder="widget.options.placeholder"
|
224
|
-
:collapseTags="widget.options.collapseTags"
|
225
|
-
:allowCreate="widget.options.allowCreate"
|
226
|
-
:filterable="
|
227
|
-
widget.options.allowCreate ? true : widget.options.filterable
|
228
|
-
"
|
229
|
-
@change="handleEventAction(widget.events.onChange)"
|
230
|
-
@focus="handleEventAction(widget.events.onFocus)"
|
231
|
-
@blur="handleEventAction(widget.events.onBlur)"
|
232
|
-
>
|
233
|
-
<el-option
|
234
|
-
v-for="item in widget.options.remote
|
235
|
-
? widget.options.remoteOptions
|
236
|
-
: widget.options.options"
|
237
|
-
:key="item.value"
|
238
|
-
:value="item.value"
|
239
|
-
:label="
|
240
|
-
widget.options.showLabel || widget.options.remote
|
241
|
-
? item.label
|
242
|
-
: item.value
|
243
|
-
"
|
244
|
-
></el-option>
|
245
|
-
</el-select>
|
246
|
-
</template>
|
247
|
-
|
248
|
-
<template v-if="widget.type == 'color'">
|
249
|
-
<el-color-picker
|
250
|
-
v-model="dataModel"
|
251
|
-
:disabled="widget.options.disabled"
|
252
|
-
:show-alpha="widget.options.showAlpha"
|
253
|
-
@change="handleEventAction(widget.events.onChange)"
|
254
|
-
></el-color-picker>
|
255
|
-
</template>
|
256
|
-
|
257
|
-
<template v-if="widget.type == 'switch'">
|
258
|
-
<el-switch
|
259
|
-
v-model="dataModel"
|
260
|
-
:width="widget.options.width - 20"
|
261
|
-
:disabled="widget.options.disabled"
|
262
|
-
:inactive-text="widget.options.switchInactiveText"
|
263
|
-
:active-text="widget.options.switchActiveText"
|
264
|
-
:inactive-color="widget.options.switchInactiveColor"
|
265
|
-
:active-color="widget.options.switchActiveColor"
|
266
|
-
@change="handleEventAction(widget.events.onChange)"
|
267
|
-
>
|
268
|
-
</el-switch>
|
269
|
-
</template>
|
270
|
-
|
271
|
-
<template v-if="widget.type == 'button'">
|
272
|
-
<el-button
|
273
|
-
:style="{
|
274
|
-
width: widget.options.width,
|
275
|
-
height: widget.options.height
|
276
|
-
}"
|
277
|
-
:size="widget.options.buttonSize"
|
278
|
-
:type="widget.options.buttonType"
|
279
|
-
:plain="widget.options.buttonPlain"
|
280
|
-
:round="widget.options.buttonRound"
|
281
|
-
:circle="widget.options.buttonCircle"
|
282
|
-
:loading="widget.options.loading"
|
283
|
-
:disabled="widget.options.disabled"
|
284
|
-
:icon="widget.options.buttonIcon"
|
285
|
-
@click="handleEventAction(widget.events.onClick)"
|
286
|
-
>{{ widget.options.defaultValue }}</el-button
|
287
|
-
>
|
288
|
-
</template>
|
289
|
-
|
290
|
-
<template v-if="widget.type == 'slider'">
|
291
|
-
<el-slider
|
292
|
-
v-model="dataModel"
|
293
|
-
:min="widget.options.min"
|
294
|
-
:max="widget.options.max"
|
295
|
-
:disabled="widget.options.disabled"
|
296
|
-
:step="widget.options.step"
|
297
|
-
:show-input="widget.options.showInput"
|
298
|
-
:range="widget.options.range"
|
299
|
-
:style="{
|
300
|
-
width: widget.options.width,
|
301
|
-
height: widget.options.height
|
302
|
-
}"
|
303
|
-
:show-tooltip="widget.options.showTooltip"
|
304
|
-
:format-tooltip="
|
305
|
-
val => formatTooltip(val, widget.options.formatTooltip)
|
306
|
-
"
|
307
|
-
:show-stops="widget.options.showStops"
|
308
|
-
:vertical="widget.options.vertical"
|
309
|
-
@change="handleEventAction(widget.events.onChange)"
|
310
|
-
></el-slider>
|
311
|
-
</template>
|
312
|
-
|
313
|
-
<template v-if="widget.type == 'rate'">
|
314
|
-
<el-rate
|
315
|
-
v-model="dataModel"
|
316
|
-
:max="widget.options.max"
|
317
|
-
:disabled="widget.options.disabled"
|
318
|
-
:allow-half="widget.options.allowHalf"
|
319
|
-
:show-text="widget.options.showText"
|
320
|
-
:texts="widget.options.auxiliaryValue"
|
321
|
-
@change="handleEventAction(widget.events.onChange)"
|
322
|
-
></el-rate>
|
323
|
-
</template>
|
324
|
-
|
325
|
-
<template v-if="widget.type == 'filler'">
|
326
|
-
<div
|
327
|
-
:style="{
|
328
|
-
width: widget.options.width,
|
329
|
-
height: widget.options.height
|
330
|
-
}"
|
331
|
-
></div>
|
332
|
-
</template>
|
333
|
-
|
334
|
-
<template v-if="widget.type == 'image'">
|
335
|
-
<th-image
|
336
|
-
:src="widget.options.url"
|
337
|
-
:height="widget.options.height"
|
338
|
-
:width="widget.options.width"
|
339
|
-
:fit="widget.options.fit"
|
340
|
-
></th-image>
|
341
|
-
</template>
|
342
|
-
|
343
|
-
<template v-if="widget.type == 'upload'">
|
344
|
-
<el-upload
|
345
|
-
class="upload-demo"
|
346
|
-
:action="widget.options.remoteFunc"
|
347
|
-
:on-preview="
|
348
|
-
file => handlePictureCardPreview(file, widget.options.listType)
|
349
|
-
"
|
350
|
-
:on-remove="handleRemove"
|
351
|
-
:multiple="widget.options.multiple"
|
352
|
-
:limit="widget.options.length"
|
353
|
-
:width="widget.options.size.width"
|
354
|
-
:height="widget.options.size.height"
|
355
|
-
:list-type="widget.options.listType"
|
356
|
-
:on-change="handleAvatar"
|
357
|
-
:on-error="handleAvatarError"
|
358
|
-
:drag="widget.options.drag"
|
359
|
-
:disabled="widget.options.disabled"
|
360
|
-
:auto-upload="false"
|
361
|
-
>
|
362
|
-
<el-button
|
363
|
-
size="small"
|
364
|
-
type="primary"
|
365
|
-
:disabled="widget.options.disabled"
|
366
|
-
v-if="
|
367
|
-
['default', 'picture'].includes(widget.options.listType) &&
|
368
|
-
!widget.options.drag
|
369
|
-
"
|
370
|
-
>点击上传</el-button
|
371
|
-
>
|
372
|
-
<i
|
373
|
-
slot="default"
|
374
|
-
class="el-icon-plus"
|
375
|
-
v-if="
|
376
|
-
widget.options.listType === 'picture-card' && !widget.options.drag
|
377
|
-
"
|
378
|
-
></i>
|
379
|
-
<i class="el-icon-upload" v-if="widget.options.drag"></i>
|
380
|
-
<div class="el-upload__text" v-if="widget.options.drag">
|
381
|
-
将文件拖到此处,或<em>点击上传</em>
|
382
|
-
</div>
|
383
|
-
<div
|
384
|
-
slot="tip"
|
385
|
-
class="el-upload__tip"
|
386
|
-
v-html="widget.options.elUploadTip"
|
387
|
-
></div>
|
388
|
-
</el-upload>
|
389
|
-
</template>
|
390
|
-
|
391
|
-
<template v-if="widget.type == 'editor'">
|
392
|
-
<vue-editor
|
393
|
-
v-model="dataModel"
|
394
|
-
:style="{ width: widget.options.width }"
|
395
|
-
:disabled="widget.options.disabled"
|
396
|
-
>
|
397
|
-
</vue-editor>
|
398
|
-
</template>
|
399
|
-
|
400
|
-
<template v-if="widget.type == 'cascader'">
|
401
|
-
<el-cascader
|
402
|
-
v-model="dataModel"
|
403
|
-
:disabled="widget.options.disabled"
|
404
|
-
:clearable="widget.options.clearable"
|
405
|
-
:placeholder="widget.options.placeholder"
|
406
|
-
:style="{
|
407
|
-
width: widget.options.width,
|
408
|
-
height: widget.options.height
|
409
|
-
}"
|
410
|
-
:options="widget.options.remoteOptions"
|
411
|
-
:props="widget.options.props"
|
412
|
-
:show-all-levels="widget.options.showAllLevels ? false : true"
|
413
|
-
:collapse-tags="widget.options.collapseTags"
|
414
|
-
:filterable="widget.options.filterable"
|
415
|
-
@change="handleEventAction(widget.events.onChange)"
|
416
|
-
>
|
417
|
-
<template slot-scope="{ data }">
|
418
|
-
<span v-html="widget.options.prepend"></span>
|
419
|
-
<span>{{ data.label }}</span>
|
420
|
-
<span v-html="widget.options.append"></span>
|
421
|
-
</template>
|
422
|
-
</el-cascader>
|
423
|
-
</template>
|
424
|
-
|
425
|
-
<template v-if="widget.type == 'blank'">
|
426
|
-
<slot :name="widget.model" />
|
427
|
-
</template>
|
428
|
-
|
429
|
-
<template v-if="widget.type == 'table'">
|
430
|
-
<el-table
|
431
|
-
style="width:100%"
|
432
|
-
:data="dataModel"
|
433
|
-
:stripe="widget.options.stripe"
|
434
|
-
:show-header="widget.options.showHeader"
|
435
|
-
:highlight-current-row="widget.options.highlightCurrentRow"
|
436
|
-
:border="widget.options.border"
|
437
|
-
>
|
438
|
-
<el-table-column
|
439
|
-
v-if="widget.options.isSerial"
|
440
|
-
label="序号"
|
441
|
-
type="index"
|
442
|
-
width="50"
|
443
|
-
align="center"
|
444
|
-
>
|
445
|
-
</el-table-column>
|
446
|
-
<el-table-column
|
447
|
-
v-for="element in widget.list"
|
448
|
-
:key="`table_${element.key}`"
|
449
|
-
:label="element.name"
|
450
|
-
:prop="element.model"
|
451
|
-
:width="element.options.width"
|
452
|
-
>
|
453
|
-
<template slot-scope="scope">
|
454
|
-
<genetate-form-item
|
455
|
-
:models.sync="dataModel[scope.$index]"
|
456
|
-
:widget="element"
|
457
|
-
:remote="remote"
|
458
|
-
:config="config"
|
459
|
-
:prop="`${prop}.${scope.$index}.${element.model}`"
|
460
|
-
:slotKeys="slotKeys"
|
461
|
-
:componentsData="componentsData"
|
462
|
-
>
|
463
|
-
<template v-for="name in slotKeys" :slot="name">
|
464
|
-
<slot :name="name" />
|
465
|
-
</template>
|
466
|
-
</genetate-form-item>
|
467
|
-
</template>
|
468
|
-
</el-table-column>
|
469
|
-
<el-table-column
|
470
|
-
v-if="widget.options.isDelete"
|
471
|
-
fixed="right"
|
472
|
-
label="操作"
|
473
|
-
width="60"
|
474
|
-
align="center"
|
475
|
-
>
|
476
|
-
<template slot-scope="scope">
|
477
|
-
<el-button
|
478
|
-
style="color:#F56C6C"
|
479
|
-
type="text"
|
480
|
-
@click.native.prevent="handleTableDelete(scope.$index)"
|
481
|
-
>
|
482
|
-
移除
|
483
|
-
</el-button>
|
484
|
-
</template>
|
485
|
-
</el-table-column>
|
486
|
-
<template v-if="widget.options.isAdd" slot="append">
|
487
|
-
<div
|
488
|
-
style="text-align: center;"
|
489
|
-
:style="{
|
490
|
-
borderTop:
|
491
|
-
dataModel && dataModel.length != 0 ? '' : '1px solid #EBEEF5'
|
492
|
-
}"
|
493
|
-
>
|
494
|
-
<el-button
|
495
|
-
type="text"
|
496
|
-
:disabled="widget.options.disabled"
|
497
|
-
@click="handleTableAdd"
|
498
|
-
>新增</el-button
|
499
|
-
>
|
500
|
-
</div>
|
501
|
-
</template>
|
502
|
-
</el-table>
|
503
|
-
</template>
|
504
|
-
|
505
|
-
<template v-if="widget.type == 'tableH5'">
|
506
|
-
<div class="tableH5">
|
507
|
-
<div
|
508
|
-
class="tableH5-item"
|
509
|
-
v-for="(column, columnIndex) in dataModel"
|
510
|
-
:key="`tableH5_${columnIndex}`"
|
511
|
-
>
|
512
|
-
<div
|
513
|
-
v-for="(element, elementIndex) in widget.list"
|
514
|
-
:key="`tableH5_${columnIndex}_${element.key}`"
|
515
|
-
>
|
516
|
-
<genetate-form-item
|
517
|
-
style="flex:1;"
|
518
|
-
:models.sync="column"
|
519
|
-
:widget="element"
|
520
|
-
:remote="remote"
|
521
|
-
:config="config"
|
522
|
-
:prop="
|
523
|
-
element.type === 'grid'
|
524
|
-
? `${prop}.${columnIndex}`
|
525
|
-
: `${prop}.${columnIndex}.${element.model}`
|
526
|
-
"
|
527
|
-
:slotKeys="slotKeys"
|
528
|
-
:componentsData="componentsData"
|
529
|
-
>
|
530
|
-
<template v-for="name in slotKeys" :slot="name">
|
531
|
-
<slot :name="name" />
|
532
|
-
</template>
|
533
|
-
</genetate-form-item>
|
534
|
-
<div
|
535
|
-
v-if="
|
536
|
-
widget.options.isDelete &&
|
537
|
-
elementIndex === 0 &&
|
538
|
-
columnIndex >= widget.options.deleteIndex
|
539
|
-
"
|
540
|
-
class="actions"
|
541
|
-
>
|
542
|
-
<el-button
|
543
|
-
type="danger"
|
544
|
-
@click.native.prevent="handleTableDelete(columnIndex)"
|
545
|
-
>{{ widget.options.deleteButtonText }}</el-button
|
546
|
-
>
|
547
|
-
</div>
|
548
|
-
</div>
|
549
|
-
</div>
|
550
|
-
|
551
|
-
<div v-if="widget.options.isAdd" style="text-align: center;">
|
552
|
-
<el-button
|
553
|
-
type="text"
|
554
|
-
:disabled="widget.options.disabled"
|
555
|
-
@click="handleTableAdd"
|
556
|
-
>{{ widget.options.addButtonText }}</el-button
|
557
|
-
>
|
558
|
-
</div>
|
559
|
-
</div>
|
560
|
-
</template>
|
561
|
-
|
562
|
-
<template v-if="widget.type == 'grid'">
|
563
|
-
<el-row
|
564
|
-
type="flex"
|
565
|
-
:gutter="widget.options.gutter ? widget.options.gutter : 0"
|
566
|
-
:justify="widget.options.justify"
|
567
|
-
:align="widget.options.align"
|
568
|
-
>
|
569
|
-
<el-col
|
570
|
-
v-for="(column, columnIndex) in widget.options.columns"
|
571
|
-
:key="columnIndex"
|
572
|
-
:span="column.span"
|
573
|
-
>
|
574
|
-
<genetate-form-item
|
575
|
-
v-for="element in column.list"
|
576
|
-
:key="element.key"
|
577
|
-
:widget="element"
|
578
|
-
:models="models"
|
579
|
-
:config="config"
|
580
|
-
:remote="remote"
|
581
|
-
:prop="prop ? `${prop}.${element.model}` : element.model"
|
582
|
-
:slotKeys="slotKeys"
|
583
|
-
:componentsData="componentsData"
|
584
|
-
>
|
585
|
-
<template v-for="name in slotKeys" :slot="name">
|
586
|
-
<slot :name="name" />
|
587
|
-
</template>
|
588
|
-
</genetate-form-item>
|
589
|
-
</el-col>
|
590
|
-
</el-row>
|
591
|
-
</template>
|
592
|
-
|
593
|
-
<template v-if="widget.type == 'tabs'">
|
594
|
-
<el-tabs v-model="widget.options.defaultValue">
|
595
|
-
<el-tab-pane
|
596
|
-
v-for="(column, columnIndex) in widget.options.columns"
|
597
|
-
:key="`tabs_${columnIndex}`"
|
598
|
-
:label="column.label"
|
599
|
-
:name="column.value"
|
600
|
-
>
|
601
|
-
<genetate-form-item
|
602
|
-
v-for="element in column.list"
|
603
|
-
:key="`tabs_${columnIndex}_${element.key}`"
|
604
|
-
:widget="element"
|
605
|
-
:models.sync="dataModel[column.value]"
|
606
|
-
:config="config"
|
607
|
-
:remote="remote"
|
608
|
-
:prop="
|
609
|
-
element.type === 'grid'
|
610
|
-
? `${prop}.${column.value}`
|
611
|
-
: `${prop}.${column.value}.${element.model}`
|
612
|
-
"
|
613
|
-
:slotKeys="slotKeys"
|
614
|
-
:componentsData="componentsData"
|
615
|
-
>
|
616
|
-
<template v-for="name in slotKeys" :slot="name">
|
617
|
-
<slot :name="name" />
|
618
|
-
</template>
|
619
|
-
</genetate-form-item>
|
620
|
-
</el-tab-pane>
|
621
|
-
</el-tabs>
|
622
|
-
</template>
|
623
|
-
|
624
|
-
<template v-if="widget.type == 'divider'">
|
625
|
-
<el-divider :content-position="widget.options.contentPosition">
|
626
|
-
{{ widget.options.defaultValue }}
|
627
|
-
</el-divider>
|
628
|
-
</template>
|
629
|
-
|
630
|
-
<el-dialog :visible.sync="dialogVisible" append-to-body>
|
631
|
-
<img width="100%" :src="dialogImageUrl" alt="" />
|
632
|
-
</el-dialog>
|
633
|
-
</div>
|
634
|
-
</template>
|
635
|
-
|
636
|
-
<script>
|
637
|
-
import FmUpload from "./Upload";
|
638
|
-
import { VueEditor } from "vue2-editor";
|
639
|
-
import ThCell from "ui/Cell/index.vue";
|
640
|
-
import ThImage from "ui/Image/index.vue";
|
641
|
-
|
642
|
-
export default {
|
643
|
-
name: "genetate-form-item-h5",
|
644
|
-
props: [
|
645
|
-
"widget",
|
646
|
-
"models",
|
647
|
-
"remote",
|
648
|
-
"prop",
|
649
|
-
"slotKeys",
|
650
|
-
"config",
|
651
|
-
"componentsData"
|
652
|
-
],
|
653
|
-
components: { FmUpload, VueEditor, ThCell, ThImage },
|
654
|
-
data() {
|
655
|
-
return {
|
656
|
-
dataModel: this.models[this.widget.model],
|
657
|
-
dialogVisible: false,
|
658
|
-
dialogImageUrl: ""
|
659
|
-
};
|
660
|
-
},
|
661
|
-
watch: {
|
662
|
-
dataModel: {
|
663
|
-
deep: true,
|
664
|
-
handler(val) {
|
665
|
-
this.models[this.widget.model] = val;
|
666
|
-
this.$emit("update:models", {
|
667
|
-
...this.models,
|
668
|
-
[this.widget.model]: val
|
669
|
-
});
|
670
|
-
this.$emit("input-change", val, this.widget.model);
|
671
|
-
}
|
672
|
-
},
|
673
|
-
models: {
|
674
|
-
deep: true,
|
675
|
-
handler(val) {
|
676
|
-
this.dataModel = val[this.widget.model];
|
677
|
-
}
|
678
|
-
}
|
679
|
-
},
|
680
|
-
computed: {
|
681
|
-
labelWidth() {
|
682
|
-
if (this.widget.options.hideLabel) return "0";
|
683
|
-
if (this.widget.options.isLabelWidth)
|
684
|
-
return `${this.widget.options.labelWidth}px`;
|
685
|
-
|
686
|
-
return "";
|
687
|
-
}
|
688
|
-
},
|
689
|
-
created() {
|
690
|
-
if (
|
691
|
-
this.widget.options.remote &&
|
692
|
-
this.remote[this.widget.options.remoteFunc]
|
693
|
-
) {
|
694
|
-
this.remote[this.widget.options.remoteFunc](data => {
|
695
|
-
this.widget.options.remoteOptions = data.map(item => {
|
696
|
-
return {
|
697
|
-
value: item[this.widget.options.props.value],
|
698
|
-
label: item[this.widget.options.props.label],
|
699
|
-
children: item[this.widget.options.props.children]
|
700
|
-
};
|
701
|
-
});
|
702
|
-
});
|
703
|
-
}
|
704
|
-
|
705
|
-
if (
|
706
|
-
this.widget.type === "upload" &&
|
707
|
-
this.remote[this.widget.options.remoteFunc]
|
708
|
-
) {
|
709
|
-
this.remote[this.widget.options.remoteFunc](data => {
|
710
|
-
this.widget.options.remoteApi = data;
|
711
|
-
});
|
712
|
-
}
|
713
|
-
},
|
714
|
-
mounted() {
|
715
|
-
this.$nextTick(() => {
|
716
|
-
this.componentsData[this.widget.model] = this.widget;
|
717
|
-
});
|
718
|
-
},
|
719
|
-
methods: {
|
720
|
-
handleTimePicker(vals) {
|
721
|
-
this.dataModel = [];
|
722
|
-
this.dataModel[0] = vals;
|
723
|
-
this.widget.options.endTimePickerOptions.minTime = vals;
|
724
|
-
},
|
725
|
-
formatTooltip(val, num) {
|
726
|
-
return val / num;
|
727
|
-
},
|
728
|
-
handlePictureCardPreview(file, listType) {
|
729
|
-
if (listType === "picture-card") {
|
730
|
-
this.dialogImageUrl = file.url;
|
731
|
-
this.dialogVisible = true;
|
732
|
-
}
|
733
|
-
},
|
734
|
-
handleRemove(file, fileList) {
|
735
|
-
this.dataModel = {
|
736
|
-
data: fileList,
|
737
|
-
remoteApi: this.widget.options.remoteApi
|
738
|
-
};
|
739
|
-
},
|
740
|
-
handleAvatar(res, file) {
|
741
|
-
this.dataModel = {
|
742
|
-
data: file,
|
743
|
-
remoteApi: this.widget.options.remoteApi
|
744
|
-
};
|
745
|
-
},
|
746
|
-
handleAvatarError() {
|
747
|
-
console.log("上传失败!");
|
748
|
-
},
|
749
|
-
handleTableAdd() {
|
750
|
-
let dic = {};
|
751
|
-
this.widget.list.forEach(item => {
|
752
|
-
if (item.type === "grid") {
|
753
|
-
for (let i = 0; i < item.options.columns.length; i++) {
|
754
|
-
const element = item.options.columns[i];
|
755
|
-
for (let j = 0; j < element.list.length; j++) {
|
756
|
-
const element2 = element.list[j];
|
757
|
-
dic[element2.model] = element2.options.defaultValue;
|
758
|
-
}
|
759
|
-
}
|
760
|
-
} else {
|
761
|
-
dic[item.model] = item.options.defaultValue;
|
762
|
-
}
|
763
|
-
});
|
764
|
-
this.dataModel.push(dic);
|
765
|
-
},
|
766
|
-
handleTableDelete(index) {
|
767
|
-
this.dataModel.splice(index, 1);
|
768
|
-
},
|
769
|
-
|
770
|
-
// 支撑 JavaScript 动态编译
|
771
|
-
handleEventAction(key) {
|
772
|
-
if (!key) return;
|
773
|
-
const eventScript = this.config.eventScript;
|
774
|
-
for (let i = 0; i < eventScript.length; i++) {
|
775
|
-
const element = eventScript[i];
|
776
|
-
if (element.key === key) {
|
777
|
-
const func = `(item,value)=>{${element.value}}`;
|
778
|
-
eval(func)(this.widget, this.dataModel);
|
779
|
-
}
|
780
|
-
}
|
781
|
-
},
|
782
|
-
// 显示组件
|
783
|
-
display(keys) {
|
784
|
-
if (!keys || keys.length === 0) return;
|
785
|
-
for (let i = 0; i < keys.length; i++) {
|
786
|
-
const key = keys[i];
|
787
|
-
if (this.componentsData[key]) {
|
788
|
-
this.componentsData[key].options.hidden = false;
|
789
|
-
}
|
790
|
-
}
|
791
|
-
},
|
792
|
-
// 隐藏组件
|
793
|
-
hide(keys) {
|
794
|
-
if (!keys || keys.length === 0) return;
|
795
|
-
for (let i = 0; i < keys.length; i++) {
|
796
|
-
const key = keys[i];
|
797
|
-
if (this.componentsData[key]) {
|
798
|
-
this.componentsData[key].options.hidden = true;
|
799
|
-
}
|
800
|
-
}
|
801
|
-
},
|
802
|
-
// 设置数据,仅支持修改当前组件节点下的数据
|
803
|
-
setData(obj) {
|
804
|
-
const keys = Object.keys(obj);
|
805
|
-
for (let i = 0; i < keys.length; i++) {
|
806
|
-
const arr = keys[i].split(".");
|
807
|
-
if (arr.length === 1) {
|
808
|
-
const key = keys[i];
|
809
|
-
const value = obj[key];
|
810
|
-
this.$set(this.models, key, value);
|
811
|
-
} else {
|
812
|
-
const key = arr.pop();
|
813
|
-
const value = obj[keys[i]];
|
814
|
-
const path = arr.join(".");
|
815
|
-
this.$set(eval(`this.models.${path}`), key, value);
|
816
|
-
}
|
817
|
-
}
|
818
|
-
},
|
819
|
-
// 获取数据,仅支持获取当前组件节点下的数据
|
820
|
-
getData() {
|
821
|
-
return this.models;
|
822
|
-
}
|
823
|
-
}
|
824
|
-
};
|
825
|
-
</script>
|