tianheng-ui 0.0.44 → 0.0.45
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/03250ed25fc1b305e9980cf7cf0dfb09.js +1 -0
- package/lib/c755e7fc08446566ee8dd3a8aa8fe43f.js +1715 -0
- package/lib/index.js +1 -1
- package/lib/tianheng-ui.js +26 -16
- package/package.json +65 -59
- package/packages/formMaking/Container.vue +15 -2
- package/packages/formMaking/FormConfig.vue +12 -3
- package/packages/formMaking/GenerateFormItem.vue +516 -266
- package/packages/formMaking/WidgetConfig.vue +1361 -760
- package/packages/formMaking/WidgetForm.vue +2 -2
- package/packages/formMaking/WidgetFormItem.vue +466 -284
- package/packages/formMaking/componentsConfig.js +402 -332
@@ -1,284 +1,466 @@
|
|
1
|
-
<template>
|
2
|
-
<el-form-item
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
:
|
73
|
-
:
|
74
|
-
|
75
|
-
:
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
v-
|
88
|
-
:
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
:
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
</template>
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
:
|
123
|
-
:
|
124
|
-
|
125
|
-
:
|
126
|
-
>
|
127
|
-
|
128
|
-
</el-
|
129
|
-
</template>
|
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
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
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
|
-
|
1
|
+
<template>
|
2
|
+
<el-form-item
|
3
|
+
class="widget-view "
|
4
|
+
v-if="element && element.key"
|
5
|
+
:class="{
|
6
|
+
active: selectWidget.key == element.key,
|
7
|
+
is_req: element.options.required
|
8
|
+
}"
|
9
|
+
:label="element.name"
|
10
|
+
@click.native.stop="handleSelectWidget(index)"
|
11
|
+
>
|
12
|
+
<template v-if="element.type == 'input'">
|
13
|
+
<el-input
|
14
|
+
v-model="element.options.defaultValue"
|
15
|
+
:style="{ width: element.options.width }"
|
16
|
+
:placeholder="element.options.placeholder"
|
17
|
+
:disabled="element.options.disabled"
|
18
|
+
:maxlength="element.options.maxlength"
|
19
|
+
:show-word-limit="element.options.showWordLimit"
|
20
|
+
:show-password="element.options.showPassword"
|
21
|
+
:clearable="element.options.clearable"
|
22
|
+
:suffix-icon="element.options.suffixIcon"
|
23
|
+
:prefix-icon="element.options.prefixIcon"
|
24
|
+
>
|
25
|
+
<template v-if="element.options.prepend" slot="prepend">
|
26
|
+
<span v-html="element.options.prepend"></span>
|
27
|
+
</template>
|
28
|
+
<template v-if="element.options.append" slot="append">
|
29
|
+
<span v-html="element.options.append"></span>
|
30
|
+
</template>
|
31
|
+
</el-input>
|
32
|
+
</template>
|
33
|
+
|
34
|
+
<template v-if="element.type == 'textarea'">
|
35
|
+
<el-input
|
36
|
+
type="textarea"
|
37
|
+
v-model="element.options.defaultValue"
|
38
|
+
:style="{ width: element.options.width }"
|
39
|
+
:disabled="element.options.disabled"
|
40
|
+
:placeholder="element.options.placeholder"
|
41
|
+
:maxlength="element.options.maxlength"
|
42
|
+
:show-word-limit="element.options.showWordLimit"
|
43
|
+
:clearable="element.options.clearable"
|
44
|
+
:autosize="{ minRows: element.options.minRows, maxRows: element.options.maxRows }"
|
45
|
+
></el-input>
|
46
|
+
</template>
|
47
|
+
|
48
|
+
<template v-if="element.type == 'number'">
|
49
|
+
<el-input-number
|
50
|
+
v-model="element.options.defaultValue"
|
51
|
+
:disabled="element.options.disabled"
|
52
|
+
:controls-position="element.options.controlsPosition?'right':''"
|
53
|
+
:style="{ width: element.options.width }"
|
54
|
+
:min="element.options.min"
|
55
|
+
:max="element.options.max"
|
56
|
+
:step="element.options.step"
|
57
|
+
:precision="element.options.precision"
|
58
|
+
></el-input-number>
|
59
|
+
</template>
|
60
|
+
|
61
|
+
<template v-if="element.type == 'radio'">
|
62
|
+
<el-radio-group
|
63
|
+
v-model="element.options.defaultValue"
|
64
|
+
:style="{ width: element.options.width }"
|
65
|
+
:disabled="element.options.disabled"
|
66
|
+
>
|
67
|
+
<template v-if="element.options.buttonType">
|
68
|
+
<el-radio-button
|
69
|
+
:style="{
|
70
|
+
display: element.options.inline ? 'inline-block' : 'block'
|
71
|
+
}"
|
72
|
+
:label="item.value"
|
73
|
+
:border="element.options.border"
|
74
|
+
v-for="(item, index) in element.options.options"
|
75
|
+
:key="item.value + index"
|
76
|
+
>
|
77
|
+
{{ element.options.showLabel ? item.label : item.value }}
|
78
|
+
</el-radio-button>
|
79
|
+
</template>
|
80
|
+
<template v-else>
|
81
|
+
<el-radio
|
82
|
+
:style="{
|
83
|
+
display: element.options.inline ? 'inline-block' : 'block'
|
84
|
+
}"
|
85
|
+
:label="item.value"
|
86
|
+
:border="element.options.border"
|
87
|
+
v-for="(item, index) in element.options.options"
|
88
|
+
:key="item.value + index"
|
89
|
+
>
|
90
|
+
{{ element.options.showLabel ? item.label : item.value }}
|
91
|
+
</el-radio>
|
92
|
+
</template>
|
93
|
+
</el-radio-group>
|
94
|
+
</template>
|
95
|
+
|
96
|
+
<template v-if="element.type == 'checkbox'">
|
97
|
+
<el-checkbox-group
|
98
|
+
v-model="element.options.defaultValue"
|
99
|
+
:style="{ width: element.options.width }"
|
100
|
+
:disabled="element.options.disabled"
|
101
|
+
:min="element.options.min"
|
102
|
+
:max="element.options.max"
|
103
|
+
>
|
104
|
+
<template v-if="element.options.buttonType">
|
105
|
+
<el-checkbox-button
|
106
|
+
:style="{
|
107
|
+
display: element.options.inline ? 'inline-block' : 'block'
|
108
|
+
}"
|
109
|
+
:label="item.value"
|
110
|
+
:border="element.options.border"
|
111
|
+
v-for="(item, index) in element.options.options"
|
112
|
+
:key="item.value + index"
|
113
|
+
>
|
114
|
+
{{ element.options.showLabel ? item.label : item.value }}
|
115
|
+
</el-checkbox-button>
|
116
|
+
</template>
|
117
|
+
<template v-else>
|
118
|
+
<el-checkbox
|
119
|
+
:style="{
|
120
|
+
display: element.options.inline ? 'inline-block' : 'block'
|
121
|
+
}"
|
122
|
+
:label="item.value"
|
123
|
+
:border="element.options.border"
|
124
|
+
v-for="(item, index) in element.options.options"
|
125
|
+
:key="item.value + index"
|
126
|
+
>
|
127
|
+
{{ element.options.showLabel ? item.label : item.value }}
|
128
|
+
</el-checkbox>
|
129
|
+
</template>
|
130
|
+
</el-checkbox-group>
|
131
|
+
</template>
|
132
|
+
|
133
|
+
<template v-if="element.type == 'time'">
|
134
|
+
<el-time-picker
|
135
|
+
v-if="element.options.timeType"
|
136
|
+
v-model="element.options.defaultValue"
|
137
|
+
:is-range="element.options.isRange"
|
138
|
+
:placeholder="element.options.placeholder"
|
139
|
+
:start-placeholder="element.options.startPlaceholder"
|
140
|
+
:end-placeholder="element.options.endPlaceholder"
|
141
|
+
:readonly="element.options.readonly"
|
142
|
+
:disabled="element.options.disabled"
|
143
|
+
:editable="element.options.editable"
|
144
|
+
:clearable="element.options.clearable"
|
145
|
+
:arrowControl="element.options.arrowControl"
|
146
|
+
:style="{ width: element.options.width }"
|
147
|
+
>
|
148
|
+
</el-time-picker>
|
149
|
+
<template v-else>
|
150
|
+
<el-time-select
|
151
|
+
v-model="element.options.selectStartTime"
|
152
|
+
:is-range="element.options.isRange"
|
153
|
+
:placeholder="element.options.selectRange?element.options.startPlaceholder:element.options.placeholder"
|
154
|
+
:readonly="element.options.readonly"
|
155
|
+
:disabled="element.options.disabled"
|
156
|
+
:editable="element.options.editable"
|
157
|
+
:clearable="element.options.clearable"
|
158
|
+
:arrowControl="element.options.arrowControl"
|
159
|
+
:style="{ width: element.options.width }"
|
160
|
+
:picker-options="element.options.stretTimePickerOptions"
|
161
|
+
>
|
162
|
+
</el-time-select>
|
163
|
+
<el-time-select
|
164
|
+
v-if="element.options.selectRange"
|
165
|
+
v-model="element.options.selectEndTime"
|
166
|
+
:is-range="element.options.isRange"
|
167
|
+
:placeholder="element.options.endPlaceholder"
|
168
|
+
:readonly="element.options.readonly"
|
169
|
+
:disabled="element.options.disabled"
|
170
|
+
:editable="element.options.editable"
|
171
|
+
:clearable="element.options.clearable"
|
172
|
+
:arrowControl="element.options.arrowControl"
|
173
|
+
:style="{ width: element.options.width }"
|
174
|
+
:picker-options="element.options.endTimePickerOptions"
|
175
|
+
>
|
176
|
+
</el-time-select>
|
177
|
+
</template>
|
178
|
+
</template>
|
179
|
+
|
180
|
+
<template v-if="element.type == 'date'">
|
181
|
+
<el-date-picker
|
182
|
+
v-model="element.options.defaultValue"
|
183
|
+
:type="element.options.type"
|
184
|
+
:is-range="element.options.isRange"
|
185
|
+
:placeholder="element.options.placeholder"
|
186
|
+
:start-placeholder="element.options.startPlaceholder"
|
187
|
+
:end-placeholder="element.options.endPlaceholder"
|
188
|
+
:readonly="element.options.readonly"
|
189
|
+
:disabled="element.options.disabled"
|
190
|
+
:editable="element.options.editable"
|
191
|
+
:clearable="element.options.clearable"
|
192
|
+
:style="{ width: element.options.width }"
|
193
|
+
>
|
194
|
+
</el-date-picker>
|
195
|
+
</template>
|
196
|
+
|
197
|
+
<template v-if="element.type == 'rate'">
|
198
|
+
<el-rate
|
199
|
+
v-model="element.options.defaultValue"
|
200
|
+
:max="element.options.max"
|
201
|
+
:disabled="element.options.disabled"
|
202
|
+
:allow-half="element.options.allowHalf"
|
203
|
+
:show-text="element.options.showText"
|
204
|
+
:texts="element.options.auxiliaryValue"
|
205
|
+
></el-rate>
|
206
|
+
</template>
|
207
|
+
|
208
|
+
<template v-if="element.type == 'color'">
|
209
|
+
<el-color-picker
|
210
|
+
v-model="element.options.defaultValue"
|
211
|
+
:disabled="element.options.disabled"
|
212
|
+
:show-alpha="element.options.showAlpha"
|
213
|
+
></el-color-picker>
|
214
|
+
</template>
|
215
|
+
|
216
|
+
<template v-if="element.type == 'select'">
|
217
|
+
<el-select
|
218
|
+
v-model="element.options.defaultValue"
|
219
|
+
:disabled="element.options.disabled"
|
220
|
+
:multiple="element.options.multiple"
|
221
|
+
:collapseTags="element.options.collapseTags"
|
222
|
+
:allowCreate="element.options.allowCreate"
|
223
|
+
:clearable="element.options.clearable"
|
224
|
+
:placeholder="element.options.placeholder"
|
225
|
+
:style="{ width: element.options.width }"
|
226
|
+
:filterable="element.options.allowCreate?true:element.options.filterable"
|
227
|
+
>
|
228
|
+
<el-option
|
229
|
+
v-for="item in element.options.options"
|
230
|
+
:key="item.value"
|
231
|
+
:value="item.value"
|
232
|
+
:label="element.options.showLabel ? item.label : item.value"
|
233
|
+
></el-option>
|
234
|
+
</el-select>
|
235
|
+
</template>
|
236
|
+
|
237
|
+
<template v-if="element.type == 'switch'">
|
238
|
+
<el-switch
|
239
|
+
v-model="element.options.defaultValue"
|
240
|
+
:disabled="element.options.disabled"
|
241
|
+
:inactive-text="element.options.switchInactiveText"
|
242
|
+
:active-text="element.options.switchActiveText"
|
243
|
+
:inactive-color="element.options.switchInactiveColor"
|
244
|
+
:active-color="element.options.switchActiveColor"
|
245
|
+
>
|
246
|
+
</el-switch>
|
247
|
+
</template>
|
248
|
+
|
249
|
+
<template v-if="element.type == 'slider'">
|
250
|
+
<el-slider
|
251
|
+
v-model="element.options.defaultValue"
|
252
|
+
:min="element.options.min"
|
253
|
+
:max="element.options.max"
|
254
|
+
:disabled="element.options.disabled"
|
255
|
+
:step="element.options.step"
|
256
|
+
:show-input="element.options.showInput"
|
257
|
+
:range="element.options.range"
|
258
|
+
:style="{ width: element.options.width, height: element.options.height }"
|
259
|
+
:show-tooltip="element.options.showTooltip"
|
260
|
+
:format-tooltip="(val) => formatTooltip(val,element.options.formatTooltip)"
|
261
|
+
:show-stops="element.options.showStops"
|
262
|
+
:vertical="element.options.vertical"
|
263
|
+
></el-slider>
|
264
|
+
</template>
|
265
|
+
|
266
|
+
<template v-if="element.type == 'imgupload'">
|
267
|
+
<!-- <fm-upload
|
268
|
+
v-model="element.options.defaultValue"
|
269
|
+
:disabled="element.options.disabled"
|
270
|
+
:style="{ width: element.options.width }"
|
271
|
+
:width="element.options.size.width"
|
272
|
+
:height="element.options.size.height"
|
273
|
+
token="xxx"
|
274
|
+
domain="xxx"
|
275
|
+
>
|
276
|
+
</fm-upload> -->
|
277
|
+
|
278
|
+
<el-upload
|
279
|
+
class="upload-demo"
|
280
|
+
:action="element.options.remoteFunc"
|
281
|
+
:on-preview="(file) => handlePictureCardPreview(file, element.options.listType)"
|
282
|
+
:on-remove="handleRemove"
|
283
|
+
:multiple="element.options.multiple"
|
284
|
+
:limit="element.options.length"
|
285
|
+
:width="element.options.size.width"
|
286
|
+
:height="element.options.size.height"
|
287
|
+
:list-type="element.options.listType"
|
288
|
+
:file-list="element.options.defaultValue"
|
289
|
+
:drag="element.options.drag"
|
290
|
+
:on-change="handleAvatar"
|
291
|
+
:on-error="handleAvatarError"
|
292
|
+
:disabled="element.options.disabled">
|
293
|
+
<el-button size="small" type="primary" :disabled="element.options.disabled" v-if="['default', 'picture'].includes(element.options.listType) && !element.options.drag">点击上传</el-button>
|
294
|
+
<i slot="default" class="el-icon-plus" v-if="element.options.listType === 'picture-card' && !element.options.drag"></i>
|
295
|
+
<i class="el-icon-upload" v-if="element.options.drag"></i>
|
296
|
+
<div class="el-upload__text" v-if="element.options.drag">将文件拖到此处,或<em>点击上传</em></div>
|
297
|
+
<div slot="tip" class="el-upload__tip" v-html="element.options.elUploadTip"></div>
|
298
|
+
</el-upload>
|
299
|
+
</template>
|
300
|
+
|
301
|
+
<template v-if="element.type == 'cascader'">
|
302
|
+
<el-cascader
|
303
|
+
v-model="element.options.defaultValue"
|
304
|
+
:disabled="element.options.disabled"
|
305
|
+
:clearable="element.options.clearable"
|
306
|
+
:placeholder="element.options.placeholder"
|
307
|
+
:style="{ width: element.options.width }"
|
308
|
+
:options="element.options.remoteOptions"
|
309
|
+
:props="element.options.props"
|
310
|
+
:show-all-levels="element.options.showAllLevels?false:true"
|
311
|
+
:collapse-tags="element.options.collapseTags"
|
312
|
+
>
|
313
|
+
<template slot-scope="{ data }">
|
314
|
+
<span v-html="element.options.prepend"></span>
|
315
|
+
<span>{{ data.label }}</span>
|
316
|
+
<span v-html="element.options.append"></span>
|
317
|
+
</template>
|
318
|
+
</el-cascader>
|
319
|
+
</template>
|
320
|
+
|
321
|
+
<template v-if="element.type == 'editor'">
|
322
|
+
<vue-editor
|
323
|
+
v-model="element.options.defaultValue"
|
324
|
+
:style="{ width: element.options.width, height: element.options.height }"
|
325
|
+
:disabled="element.options.disabled"
|
326
|
+
>
|
327
|
+
</vue-editor>
|
328
|
+
</template>
|
329
|
+
|
330
|
+
<template v-if="element.type == 'blank'">
|
331
|
+
<div
|
332
|
+
style="height: 50px;color: #999;background: #eee;line-height:50px;text-align:center;"
|
333
|
+
>
|
334
|
+
自定义区域
|
335
|
+
</div>
|
336
|
+
</template>
|
337
|
+
|
338
|
+
<template v-if="element.type == 'text'">
|
339
|
+
<span>{{ element.options.defaultValue }}</span>
|
340
|
+
</template>
|
341
|
+
|
342
|
+
<div class="widget-view-action" v-if="selectWidget.key == element.key">
|
343
|
+
<i
|
344
|
+
class="iconfont icon-icon_clone"
|
345
|
+
@click.stop="handleWidgetClone(index)"
|
346
|
+
></i>
|
347
|
+
<i
|
348
|
+
class="iconfont icon-trash"
|
349
|
+
@click.stop="handleWidgetDelete(index)"
|
350
|
+
></i>
|
351
|
+
</div>
|
352
|
+
|
353
|
+
<div class="widget-view-drag" v-if="selectWidget.key == element.key">
|
354
|
+
<i class="iconfont icon-drag drag-widget"></i>
|
355
|
+
</div>
|
356
|
+
|
357
|
+
<el-dialog :visible.sync="dialogVisible">
|
358
|
+
<img width="100%" :src="dialogImageUrl" alt="">
|
359
|
+
</el-dialog>
|
360
|
+
</el-form-item>
|
361
|
+
</template>
|
362
|
+
|
363
|
+
<script>
|
364
|
+
import FmUpload from "./Upload";
|
365
|
+
import { VueEditor} from "vue2-editor";
|
366
|
+
export default {
|
367
|
+
props: ["element", "select", "index", "data"],
|
368
|
+
components: {
|
369
|
+
FmUpload,
|
370
|
+
VueEditor
|
371
|
+
},
|
372
|
+
data() {
|
373
|
+
return {
|
374
|
+
selectWidget: this.select,
|
375
|
+
dialogVisible: false,
|
376
|
+
dialogImageUrl: '',
|
377
|
+
};
|
378
|
+
},
|
379
|
+
mounted() {},
|
380
|
+
methods: {
|
381
|
+
handleSelectWidget(index) {
|
382
|
+
this.selectWidget = this.data.list[index];
|
383
|
+
},
|
384
|
+
handleWidgetDelete(index) {
|
385
|
+
if (this.data.list.length - 1 === index) {
|
386
|
+
if (index === 0) {
|
387
|
+
this.selectWidget = {};
|
388
|
+
} else {
|
389
|
+
this.selectWidget = this.data.list[index - 1];
|
390
|
+
}
|
391
|
+
} else {
|
392
|
+
this.selectWidget = this.data.list[index + 1];
|
393
|
+
}
|
394
|
+
|
395
|
+
this.$nextTick(() => {
|
396
|
+
this.data.list.splice(index, 1);
|
397
|
+
});
|
398
|
+
},
|
399
|
+
formatTooltip(val, num) {
|
400
|
+
return val / num;
|
401
|
+
},
|
402
|
+
handleWidgetClone(index) {
|
403
|
+
const key =
|
404
|
+
Date.parse(new Date().toString()) +
|
405
|
+
"_" +
|
406
|
+
Math.ceil(Math.random() * 99999);
|
407
|
+
let cloneData = {
|
408
|
+
...this.data.list[index],
|
409
|
+
options: {
|
410
|
+
...this.data.list[index].options,
|
411
|
+
remoteFunc: "func_" + key
|
412
|
+
},
|
413
|
+
key,
|
414
|
+
model: this.data.list[index].type + "_" + key,
|
415
|
+
rules: this.data.list[index].rules || []
|
416
|
+
};
|
417
|
+
|
418
|
+
if (
|
419
|
+
this.data.list[index].type === "radio" ||
|
420
|
+
this.data.list[index].type === "checkbox" ||
|
421
|
+
this.data.list[index].type === "select"
|
422
|
+
) {
|
423
|
+
cloneData = {
|
424
|
+
...cloneData,
|
425
|
+
options: {
|
426
|
+
...cloneData.options,
|
427
|
+
options: cloneData.options.options.map(item => ({ ...item }))
|
428
|
+
}
|
429
|
+
};
|
430
|
+
}
|
431
|
+
|
432
|
+
this.data.list.splice(index, 0, cloneData);
|
433
|
+
|
434
|
+
this.$nextTick(() => {
|
435
|
+
this.selectWidget = this.data.list[index + 1];
|
436
|
+
});
|
437
|
+
},
|
438
|
+
handlePictureCardPreview(file, listType) {
|
439
|
+
if(listType === "picture-card"){
|
440
|
+
this.dialogImageUrl = file.url;
|
441
|
+
this.dialogVisible = true;
|
442
|
+
}
|
443
|
+
},
|
444
|
+
handleRemove(file, fileList) {
|
445
|
+
this.data.options.defaultValue = fileList
|
446
|
+
},
|
447
|
+
handleAvatar(res, file) {
|
448
|
+
this.data.options.defaultValue = file
|
449
|
+
},
|
450
|
+
handleAvatarError() {
|
451
|
+
console.log("上传失败!")
|
452
|
+
},
|
453
|
+
},
|
454
|
+
watch: {
|
455
|
+
select(val) {
|
456
|
+
this.selectWidget = val;
|
457
|
+
},
|
458
|
+
selectWidget: {
|
459
|
+
handler(val) {
|
460
|
+
this.$emit("update:select", val);
|
461
|
+
},
|
462
|
+
deep: true
|
463
|
+
}
|
464
|
+
}
|
465
|
+
};
|
466
|
+
</script>
|