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