cloud-web-corejs 1.0.140 → 1.0.142
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
2
|
+
<div class="option-items-pane">
|
|
3
3
|
<el-form-item label="选项值类型">
|
|
4
4
|
<el-radio-group v-model="optionModel.optionItemValueType" @change="changeValueType">
|
|
5
5
|
<el-radio :label="0">文本</el-radio>
|
|
@@ -9,66 +9,171 @@
|
|
|
9
9
|
</el-form-item>
|
|
10
10
|
|
|
11
11
|
<el-form-item label="默认值">
|
|
12
|
-
<template
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
<template
|
|
13
|
+
v-if="
|
|
14
|
+
selectedWidget.type === 'checkbox' ||
|
|
15
|
+
(selectedWidget.type === 'select' && selectedWidget.options.multiple)
|
|
16
|
+
"
|
|
17
|
+
>
|
|
18
|
+
<a
|
|
19
|
+
href="javascript:void(0);"
|
|
20
|
+
class="a-link link-oneLind"
|
|
21
|
+
@click="openTableDataEdit()"
|
|
22
|
+
>
|
|
15
23
|
<span>{{ getDefaultValue() }}</span>
|
|
16
24
|
<i class="el-icon-edit"></i>
|
|
17
25
|
</a>
|
|
18
26
|
</template>
|
|
19
27
|
<template v-else>
|
|
20
|
-
<el-input
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
<el-input
|
|
29
|
+
v-model="optionModel.defaultValue"
|
|
30
|
+
size="mini"
|
|
31
|
+
style="width: 100px"
|
|
32
|
+
v-if="!optionModel.optionItemValueType"
|
|
33
|
+
></el-input>
|
|
34
|
+
<base-input-number
|
|
35
|
+
v-model="optionModel.defaultValue"
|
|
36
|
+
size="mini"
|
|
37
|
+
style="width: 100%"
|
|
38
|
+
v-if="optionModel.optionItemValueType == 1"
|
|
39
|
+
/>
|
|
40
|
+
<el-select
|
|
41
|
+
v-model="optionModel.defaultValue"
|
|
42
|
+
style="width: 100%"
|
|
43
|
+
v-if="optionModel.optionItemValueType === 2"
|
|
44
|
+
clearable
|
|
45
|
+
@clear="optionModel.defaultValue = null"
|
|
46
|
+
>
|
|
23
47
|
<el-option :value="true" label="true"></el-option>
|
|
24
48
|
<el-option :value="false" label="false"></el-option>
|
|
25
49
|
</el-select>
|
|
26
50
|
</template>
|
|
27
|
-
|
|
28
51
|
</el-form-item>
|
|
29
52
|
<el-form-item :label="i18nt('显示字段')">
|
|
30
|
-
<el-input
|
|
53
|
+
<el-input
|
|
54
|
+
type="text"
|
|
55
|
+
v-model="optionModel.labelKey"
|
|
56
|
+
placeholder="默认label"
|
|
57
|
+
:disabled="optionModel.commonAttributeEnabled || !optionModel.formScriptEnabled"
|
|
58
|
+
></el-input>
|
|
31
59
|
</el-form-item>
|
|
32
60
|
<el-form-item :label="i18nt('关联字段')">
|
|
33
|
-
<el-input
|
|
61
|
+
<el-input
|
|
62
|
+
type="text"
|
|
63
|
+
v-model="optionModel.valueKey"
|
|
64
|
+
placeholder="默认value"
|
|
65
|
+
:disabled="optionModel.commonAttributeEnabled || !optionModel.formScriptEnabled"
|
|
66
|
+
></el-input>
|
|
34
67
|
</el-form-item>
|
|
35
|
-
<template
|
|
68
|
+
<template
|
|
69
|
+
v-if="!optionModel.commonAttributeEnabled && !optionModel.formScriptEnabled"
|
|
70
|
+
>
|
|
36
71
|
<el-radio-group
|
|
37
|
-
v-if="
|
|
72
|
+
v-if="
|
|
73
|
+
selectedWidget.type === 'radio' ||
|
|
74
|
+
(selectedWidget.type === 'select' && !selectedWidget.options.multiple)
|
|
75
|
+
"
|
|
38
76
|
v-model="optionModel.defaultValue"
|
|
39
77
|
@change="emitDefaultValueChange"
|
|
40
78
|
>
|
|
41
|
-
<draggable
|
|
79
|
+
<draggable
|
|
80
|
+
tag="ul"
|
|
81
|
+
class="draggable-box"
|
|
82
|
+
:list="optionModel.optionItems"
|
|
83
|
+
v-bind="{ group: 'optionsGroup', ghostClass: 'ghost', handle: '.drag-option' }"
|
|
84
|
+
>
|
|
42
85
|
<li v-for="(option, idx) in optionModel.optionItems" :key="idx">
|
|
43
86
|
<el-radio :label="option.value">
|
|
44
|
-
<el-input
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
87
|
+
<el-input
|
|
88
|
+
v-model="option.value"
|
|
89
|
+
size="mini"
|
|
90
|
+
style="width: 100px"
|
|
91
|
+
v-if="!optionModel.optionItemValueType"
|
|
92
|
+
></el-input>
|
|
93
|
+
<base-input-number
|
|
94
|
+
v-model="option.value"
|
|
95
|
+
size="mini"
|
|
96
|
+
style="width: 100px"
|
|
97
|
+
v-if="optionModel.optionItemValueType == 1"
|
|
98
|
+
/>
|
|
99
|
+
<!-- <el-input v-model="option.value" size="mini" style="width: 100px" v-if="optionModel.optionItemValueType===2" disabled></el-input>-->
|
|
100
|
+
<el-select
|
|
101
|
+
v-model="option.value"
|
|
102
|
+
style="width: 100px"
|
|
103
|
+
v-if="optionModel.optionItemValueType === 2"
|
|
104
|
+
>
|
|
48
105
|
<el-option :value="true" label="true"></el-option>
|
|
49
106
|
<el-option :value="false" label="false"></el-option>
|
|
50
107
|
</el-select>
|
|
51
|
-
<el-input
|
|
108
|
+
<el-input
|
|
109
|
+
v-model="option.label"
|
|
110
|
+
size="mini"
|
|
111
|
+
style="width: 100px"
|
|
112
|
+
></el-input>
|
|
52
113
|
<i class="el-icon-s-operation drag-option"></i>
|
|
53
|
-
<el-button
|
|
114
|
+
<el-button
|
|
115
|
+
circle
|
|
116
|
+
plain
|
|
117
|
+
size="mini"
|
|
118
|
+
type="danger"
|
|
119
|
+
@click="deleteOption(option, idx)"
|
|
120
|
+
icon="el-icon-minus"
|
|
121
|
+
class="col-delete-button"
|
|
122
|
+
></el-button>
|
|
54
123
|
</el-radio>
|
|
55
124
|
</li>
|
|
56
125
|
</draggable>
|
|
57
126
|
</el-radio-group>
|
|
58
127
|
<el-checkbox-group
|
|
59
|
-
v-else-if="
|
|
128
|
+
v-else-if="
|
|
129
|
+
selectedWidget.type === 'checkbox' ||
|
|
130
|
+
(selectedWidget.type === 'select' && selectedWidget.options.multiple)
|
|
131
|
+
"
|
|
60
132
|
v-model="optionModel.defaultValue"
|
|
61
133
|
@change="emitDefaultValueChange"
|
|
62
134
|
>
|
|
63
|
-
<draggable
|
|
135
|
+
<draggable
|
|
136
|
+
tag="ul"
|
|
137
|
+
class="draggable-box"
|
|
138
|
+
:list="optionModel.optionItems"
|
|
139
|
+
v-bind="{ group: 'optionsGroup', ghostClass: 'ghost', handle: '.drag-option' }"
|
|
140
|
+
>
|
|
64
141
|
<li v-for="(option, idx) in optionModel.optionItems" :key="idx">
|
|
65
142
|
<el-checkbox :label="option.value">
|
|
66
|
-
<el-input
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
143
|
+
<el-input
|
|
144
|
+
v-model="option.value"
|
|
145
|
+
size="mini"
|
|
146
|
+
style="width: 100px"
|
|
147
|
+
v-if="!optionModel.optionItemValueType"
|
|
148
|
+
></el-input>
|
|
149
|
+
<base-input-number
|
|
150
|
+
v-model="option.value"
|
|
151
|
+
size="mini"
|
|
152
|
+
style="width: 100px"
|
|
153
|
+
v-if="optionModel.optionItemValueType == 1"
|
|
154
|
+
/>
|
|
155
|
+
<el-input
|
|
156
|
+
v-model="option.value"
|
|
157
|
+
size="mini"
|
|
158
|
+
style="width: 100px"
|
|
159
|
+
v-if="optionModel.optionItemValueType === 2"
|
|
160
|
+
disabled
|
|
161
|
+
></el-input>
|
|
162
|
+
<el-input
|
|
163
|
+
v-model="option.label"
|
|
164
|
+
size="mini"
|
|
165
|
+
style="width: 100px"
|
|
166
|
+
></el-input>
|
|
70
167
|
<i class="el-icon-s-operation drag-option"></i>
|
|
71
|
-
<el-button
|
|
168
|
+
<el-button
|
|
169
|
+
circle
|
|
170
|
+
plain
|
|
171
|
+
size="mini"
|
|
172
|
+
type="danger"
|
|
173
|
+
@click="deleteOption(option, idx)"
|
|
174
|
+
icon="el-icon-minus"
|
|
175
|
+
class="col-delete-button"
|
|
176
|
+
></el-button>
|
|
72
177
|
</el-checkbox>
|
|
73
178
|
</li>
|
|
74
179
|
</draggable>
|
|
@@ -82,55 +187,83 @@
|
|
|
82
187
|
style="width: 100%"
|
|
83
188
|
></el-cascader>
|
|
84
189
|
<div v-if="selectedWidget.type === 'cascader'">
|
|
85
|
-
<el-button type="text" @click="importCascaderOptions">{{
|
|
86
|
-
|
|
190
|
+
<el-button type="text" @click="importCascaderOptions">{{
|
|
191
|
+
i18nt("designer.setting.importOptions")
|
|
192
|
+
}}</el-button>
|
|
193
|
+
<el-button type="text" @click="resetDefault">{{
|
|
194
|
+
i18nt("designer.setting.resetDefault")
|
|
195
|
+
}}</el-button>
|
|
87
196
|
</div>
|
|
88
197
|
|
|
89
|
-
<div
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
198
|
+
<div
|
|
199
|
+
v-if="
|
|
200
|
+
selectedWidget.type === 'radio' ||
|
|
201
|
+
selectedWidget.type === 'checkbox' ||
|
|
202
|
+
selectedWidget.type === 'select'
|
|
203
|
+
"
|
|
204
|
+
>
|
|
205
|
+
<el-button type="text" @click="addOption">{{
|
|
206
|
+
i18nt("designer.setting.addOption")
|
|
207
|
+
}}</el-button>
|
|
208
|
+
<el-button
|
|
209
|
+
type="text"
|
|
210
|
+
@click="importOptions"
|
|
211
|
+
v-if="optionModel.optionItemValueType !== 2"
|
|
212
|
+
>{{ i18nt("designer.setting.importOptions") }}</el-button
|
|
213
|
+
>
|
|
214
|
+
<el-button type="text" @click="resetDefault">{{
|
|
215
|
+
i18nt("designer.setting.resetDefault")
|
|
216
|
+
}}</el-button>
|
|
93
217
|
</div>
|
|
94
218
|
</template>
|
|
95
219
|
|
|
220
|
+
<el-dialog
|
|
221
|
+
:title="i18nt('designer.setting.importOptions')"
|
|
222
|
+
:visible.sync="showImportDialogFlag"
|
|
223
|
+
v-if="showImportDialogFlag"
|
|
224
|
+
:show-close="true"
|
|
225
|
+
class="small-padding-dialog"
|
|
226
|
+
:close-on-click-modal="false"
|
|
227
|
+
:close-on-press-escape="false"
|
|
228
|
+
:destroy-on-close="true"
|
|
229
|
+
:append-to-body="true"
|
|
230
|
+
:modal-append-to-body="true"
|
|
231
|
+
>
|
|
232
|
+
<el-form-item
|
|
233
|
+
><el-input type="textarea" rows="10" v-model="optionLines"></el-input
|
|
234
|
+
></el-form-item>
|
|
235
|
+
<div slot="footer" class="dialog-footer">
|
|
236
|
+
<el-button size="large" type="primary" @click="saveOptions">{{
|
|
237
|
+
i18nt("designer.hint.confirm")
|
|
238
|
+
}}</el-button>
|
|
239
|
+
<el-button size="large" type="" @click="showImportDialogFlag = false">{{
|
|
240
|
+
i18nt("designer.hint.cancel")
|
|
241
|
+
}}</el-button>
|
|
242
|
+
</div>
|
|
243
|
+
</el-dialog>
|
|
96
244
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
v-if="showImportCascaderDialogFlag"
|
|
120
|
-
:show-close="true"
|
|
121
|
-
class="small-padding-dialog"
|
|
122
|
-
:close-on-click-modal="false"
|
|
123
|
-
:close-on-press-escape="false"
|
|
124
|
-
:destroy-on-close="true"
|
|
125
|
-
:append-to-body="true"
|
|
126
|
-
:modal-append-to-body="true"
|
|
127
|
-
>
|
|
128
|
-
<code-editor v-model="cascaderOptions" mode="json" :readonly="false"></code-editor>
|
|
129
|
-
<div slot="footer" class="dialog-footer">
|
|
130
|
-
<el-button size="large" type="primary" @click="saveCascaderOptions">{{ i18nt('designer.hint.confirm') }}</el-button>
|
|
131
|
-
<el-button size="large" type="" @click="showImportCascaderDialogFlag = false">{{ i18nt('designer.hint.cancel') }}</el-button>
|
|
132
|
-
</div>
|
|
133
|
-
</el-dialog>
|
|
245
|
+
<el-dialog
|
|
246
|
+
:title="i18nt('designer.setting.importOptions')"
|
|
247
|
+
:visible.sync="showImportCascaderDialogFlag"
|
|
248
|
+
v-if="showImportCascaderDialogFlag"
|
|
249
|
+
:show-close="true"
|
|
250
|
+
class="small-padding-dialog"
|
|
251
|
+
:close-on-click-modal="false"
|
|
252
|
+
:close-on-press-escape="false"
|
|
253
|
+
:destroy-on-close="true"
|
|
254
|
+
:append-to-body="true"
|
|
255
|
+
:modal-append-to-body="true"
|
|
256
|
+
>
|
|
257
|
+
<code-editor v-model="cascaderOptions" mode="json" :readonly="false"></code-editor>
|
|
258
|
+
<div slot="footer" class="dialog-footer">
|
|
259
|
+
<el-button size="large" type="primary" @click="saveCascaderOptions">{{
|
|
260
|
+
i18nt("designer.hint.confirm")
|
|
261
|
+
}}</el-button>
|
|
262
|
+
<el-button size="large" type="" @click="showImportCascaderDialogFlag = false">{{
|
|
263
|
+
i18nt("designer.hint.cancel")
|
|
264
|
+
}}</el-button>
|
|
265
|
+
</div>
|
|
266
|
+
</el-dialog>
|
|
134
267
|
<el-dialog
|
|
135
268
|
v-if="dataDialogVisible"
|
|
136
269
|
custom-class="dialog-style list-dialog"
|
|
@@ -146,231 +279,259 @@
|
|
|
146
279
|
>
|
|
147
280
|
<template slot="footer">
|
|
148
281
|
<div class="dialog-footer">
|
|
149
|
-
<el-button
|
|
150
|
-
|
|
282
|
+
<el-button
|
|
283
|
+
type=""
|
|
284
|
+
@click="dataDialogVisible = !1"
|
|
285
|
+
class="button-sty"
|
|
286
|
+
icon="el-icon-close"
|
|
287
|
+
>
|
|
288
|
+
{{ i18nt("designer.hint.cancel") }}
|
|
151
289
|
</el-button>
|
|
152
|
-
<el-button
|
|
153
|
-
|
|
290
|
+
<el-button
|
|
291
|
+
type="primary"
|
|
292
|
+
@click="saveTableData"
|
|
293
|
+
class="button-sty"
|
|
294
|
+
icon="el-icon-check"
|
|
295
|
+
>
|
|
296
|
+
{{ i18nt("designer.hint.confirm") }}
|
|
154
297
|
</el-button>
|
|
155
298
|
</div>
|
|
156
299
|
</template>
|
|
157
300
|
<code-editor mode="json" :readonly="!1" v-model="tableDataOptions"></code-editor>
|
|
158
301
|
</el-dialog>
|
|
159
|
-
|
|
302
|
+
</div>
|
|
160
303
|
</template>
|
|
161
304
|
|
|
162
305
|
<script>
|
|
163
|
-
import Draggable from
|
|
164
|
-
import i18n from
|
|
306
|
+
import Draggable from "vuedraggable";
|
|
307
|
+
import i18n from "../../../../components/xform/utils/i18n";
|
|
165
308
|
|
|
166
309
|
export default {
|
|
167
|
-
|
|
168
|
-
componentName:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
310
|
+
name: "OptionItemsSetting",
|
|
311
|
+
componentName: "PropertyEditor",
|
|
312
|
+
mixins: [i18n],
|
|
313
|
+
components: {
|
|
314
|
+
Draggable,
|
|
315
|
+
},
|
|
316
|
+
props: {
|
|
317
|
+
designer: Object,
|
|
318
|
+
selectedWidget: Object,
|
|
319
|
+
},
|
|
320
|
+
data() {
|
|
321
|
+
return {
|
|
322
|
+
showImportDialogFlag: false,
|
|
323
|
+
optionLines: "",
|
|
181
324
|
|
|
182
|
-
|
|
183
|
-
|
|
325
|
+
cascaderOptions: "",
|
|
326
|
+
showImportCascaderDialogFlag: false,
|
|
184
327
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
dataDialogVisible:false,
|
|
188
|
-
tableDataOptions:[],
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
328
|
+
//separator: '||',
|
|
329
|
+
separator: ",",
|
|
330
|
+
dataDialogVisible: false,
|
|
331
|
+
tableDataOptions: [],
|
|
332
|
+
};
|
|
333
|
+
},
|
|
334
|
+
computed: {
|
|
335
|
+
optionModel() {
|
|
336
|
+
return this.selectedWidget.options;
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
watch: {
|
|
340
|
+
"selectedWidget.options": {
|
|
341
|
+
deep: true,
|
|
342
|
+
handler(val) {
|
|
343
|
+
//console.log('888888', 'Options change!')
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
},
|
|
204
347
|
created() {
|
|
205
|
-
if(!this.optionModel.hasOwnProperty(
|
|
348
|
+
if (!this.optionModel.hasOwnProperty("optionItemValueType")) {
|
|
206
349
|
this.optionModel.optionItemValueType = 0;
|
|
207
350
|
}
|
|
351
|
+
if (this.optionModel.optionItemValueType == 1) {
|
|
352
|
+
if (
|
|
353
|
+
this.optionModel.defaultValue === null ||
|
|
354
|
+
this.optionModel.defaultValue === ""
|
|
355
|
+
) {
|
|
356
|
+
this.optionModel.defaultValue = undefined;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
208
359
|
},
|
|
209
360
|
methods: {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
361
|
+
emitDefaultValueChange() {
|
|
362
|
+
if (!!this.designer && !!this.designer.formWidget) {
|
|
363
|
+
let fieldWidget = this.designer.formWidget.getWidgetRef(
|
|
364
|
+
this.selectedWidget.options.name
|
|
365
|
+
);
|
|
366
|
+
if (!!fieldWidget && !!fieldWidget.refreshDefaultValue) {
|
|
367
|
+
fieldWidget.refreshDefaultValue();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
},
|
|
218
371
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
372
|
+
deleteOption(option, index) {
|
|
373
|
+
this.optionModel.optionItems.splice(index, 1);
|
|
374
|
+
},
|
|
222
375
|
|
|
223
|
-
|
|
376
|
+
addOption() {
|
|
224
377
|
let optionItemValueType = this.optionModel.optionItemValueType;
|
|
225
|
-
|
|
226
|
-
if(!optionItemValueType){
|
|
227
|
-
newValue = newValue+
|
|
228
|
-
}else if(optionItemValueType==2){
|
|
378
|
+
let newValue = this.optionModel.optionItems.length + 1;
|
|
379
|
+
if (!optionItemValueType) {
|
|
380
|
+
newValue = newValue + "";
|
|
381
|
+
} else if (optionItemValueType == 2) {
|
|
229
382
|
newValue = true;
|
|
230
383
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
384
|
+
this.optionModel.optionItems.push({
|
|
385
|
+
value: newValue,
|
|
386
|
+
label: "new option",
|
|
387
|
+
});
|
|
388
|
+
},
|
|
236
389
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
390
|
+
importOptions() {
|
|
391
|
+
this.optionLines = "";
|
|
392
|
+
if (this.optionModel.optionItems.length > 0) {
|
|
393
|
+
this.optionModel.optionItems.forEach((opt) => {
|
|
394
|
+
if (opt.value === opt.label) {
|
|
395
|
+
this.optionLines += opt.value + "\n";
|
|
396
|
+
} else {
|
|
397
|
+
this.optionLines += opt.value + this.separator + opt.label + "\n";
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}
|
|
248
401
|
|
|
249
|
-
|
|
250
|
-
|
|
402
|
+
this.showImportDialogFlag = true;
|
|
403
|
+
},
|
|
251
404
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
405
|
+
saveOptions() {
|
|
406
|
+
let lineArray = this.optionLines.split("\n");
|
|
407
|
+
//console.log('test', lineArray)
|
|
408
|
+
if (lineArray.length > 0) {
|
|
256
409
|
let isNumericOptionItemValue = this.optionModel.optionItemValueType === 1;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
410
|
+
this.optionModel.optionItems = [];
|
|
411
|
+
lineArray.forEach((optLine) => {
|
|
412
|
+
if (!!optLine && !!optLine.trim()) {
|
|
413
|
+
if (optLine.indexOf(this.separator) !== -1) {
|
|
261
414
|
let valueStr = optLine.split(this.separator)[0];
|
|
262
|
-
let value = isNumericOptionItemValue?Number(valueStr):valueStr;
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
let value = isNumericOptionItemValue?Number(optLine):optLine;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
415
|
+
let value = isNumericOptionItemValue ? Number(valueStr) : valueStr;
|
|
416
|
+
this.optionModel.optionItems.push({
|
|
417
|
+
value: value,
|
|
418
|
+
label: optLine.split(this.separator)[1],
|
|
419
|
+
});
|
|
420
|
+
} else {
|
|
421
|
+
let value = isNumericOptionItemValue ? Number(optLine) : optLine;
|
|
422
|
+
this.optionModel.optionItems.push({
|
|
423
|
+
value: value,
|
|
424
|
+
label: optLine,
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
} else {
|
|
430
|
+
this.optionModel.optionItems = [];
|
|
431
|
+
}
|
|
279
432
|
|
|
280
|
-
|
|
281
|
-
|
|
433
|
+
this.showImportDialogFlag = false;
|
|
434
|
+
},
|
|
282
435
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
436
|
+
resetDefault() {
|
|
437
|
+
if (
|
|
438
|
+
this.selectedWidget.type === "checkbox" ||
|
|
439
|
+
(this.selectedWidget.type === "select" && this.selectedWidget.options.multiple)
|
|
440
|
+
) {
|
|
441
|
+
this.optionModel.defaultValue = [];
|
|
442
|
+
} else {
|
|
443
|
+
this.optionModel.defaultValue = undefined;
|
|
444
|
+
}
|
|
289
445
|
|
|
290
|
-
|
|
291
|
-
|
|
446
|
+
this.emitDefaultValueChange();
|
|
447
|
+
},
|
|
292
448
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
449
|
+
importCascaderOptions() {
|
|
450
|
+
this.cascaderOptions = JSON.stringify(this.optionModel.optionItems, null, " ");
|
|
451
|
+
this.showImportCascaderDialogFlag = true;
|
|
452
|
+
},
|
|
297
453
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
454
|
+
saveCascaderOptions() {
|
|
455
|
+
try {
|
|
456
|
+
let newOptions = JSON.parse(this.cascaderOptions);
|
|
457
|
+
this.optionModel.optionItems = newOptions;
|
|
458
|
+
//TODO: 是否需要重置选项默认值??
|
|
303
459
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
changeValueType(val){
|
|
460
|
+
this.showImportCascaderDialogFlag = false;
|
|
461
|
+
} catch (ex) {
|
|
462
|
+
this.$message.error(this.i18nt("designer.hint.invalidOptionsData") + ex.message);
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
changeValueType(val) {
|
|
310
466
|
let optionItems = this.optionModel.optionItems;
|
|
311
467
|
// this.optionModel.defaultValue = undefined;
|
|
312
468
|
this.resetDefault();
|
|
313
469
|
this.optionModel.optionItems.length = 0;
|
|
314
|
-
if(val==2){
|
|
470
|
+
if (val == 2) {
|
|
315
471
|
optionItems.push({
|
|
316
|
-
label:"是",
|
|
317
|
-
value:true,
|
|
472
|
+
label: "是",
|
|
473
|
+
value: true,
|
|
318
474
|
});
|
|
319
475
|
optionItems.push({
|
|
320
|
-
label:"否",
|
|
321
|
-
value:false
|
|
476
|
+
label: "否",
|
|
477
|
+
value: false,
|
|
322
478
|
});
|
|
323
|
-
}else{
|
|
479
|
+
} else {
|
|
324
480
|
this.addOption();
|
|
325
481
|
}
|
|
326
|
-
this.$forceUpdate()
|
|
482
|
+
this.$forceUpdate();
|
|
327
483
|
this.emitDefaultValueChange();
|
|
328
484
|
},
|
|
329
485
|
|
|
330
|
-
|
|
331
486
|
openTableDataEdit: function () {
|
|
332
|
-
(this.dataDialogVisible = !0),
|
|
487
|
+
(this.dataDialogVisible = !0),
|
|
488
|
+
(this.tableDataOptions = JSON.stringify(
|
|
489
|
+
this.optionModel.defaultValue,
|
|
490
|
+
null,
|
|
491
|
+
" "
|
|
492
|
+
));
|
|
333
493
|
},
|
|
334
494
|
saveTableData: function () {
|
|
335
495
|
try {
|
|
336
|
-
(this.optionModel.defaultValue = JSON.parse(this.tableDataOptions)),
|
|
496
|
+
(this.optionModel.defaultValue = JSON.parse(this.tableDataOptions)),
|
|
497
|
+
(this.dataDialogVisible = !1);
|
|
337
498
|
} catch (e) {
|
|
338
|
-
this.$message.error(this.i18nt(
|
|
499
|
+
this.$message.error(this.i18nt("designer.hint.invalidOptionsData") + e.message);
|
|
339
500
|
}
|
|
340
501
|
},
|
|
341
|
-
getDefaultValue(){
|
|
502
|
+
getDefaultValue() {
|
|
342
503
|
let result = this.optionModel.defaultValue;
|
|
343
|
-
if(result){
|
|
344
|
-
if(Array.isArray(result)){
|
|
504
|
+
if (result) {
|
|
505
|
+
if (Array.isArray(result)) {
|
|
345
506
|
result = result.join(",");
|
|
346
507
|
}
|
|
347
508
|
}
|
|
348
509
|
return result;
|
|
349
510
|
},
|
|
350
|
-
|
|
511
|
+
},
|
|
351
512
|
};
|
|
352
513
|
</script>
|
|
353
514
|
|
|
354
515
|
<style lang="scss" scoped>
|
|
355
516
|
.option-items-pane ul {
|
|
356
|
-
|
|
357
|
-
|
|
517
|
+
padding-inline-start: 6px;
|
|
518
|
+
padding-left: 6px; /* 重置IE11默认样式 */
|
|
358
519
|
}
|
|
359
520
|
|
|
360
521
|
li.ghost {
|
|
361
|
-
|
|
362
|
-
|
|
522
|
+
background: #fff;
|
|
523
|
+
border: 2px dotted $--color-primary;
|
|
363
524
|
}
|
|
364
525
|
|
|
365
526
|
.drag-option {
|
|
366
|
-
|
|
527
|
+
cursor: move;
|
|
367
528
|
}
|
|
368
529
|
|
|
369
530
|
.small-padding-dialog ::v-deep .el-dialog__body {
|
|
370
|
-
|
|
531
|
+
padding: 10px 15px;
|
|
371
532
|
}
|
|
372
533
|
|
|
373
534
|
.dialog-footer .el-button {
|
|
374
|
-
|
|
535
|
+
width: 100px;
|
|
375
536
|
}
|
|
376
537
|
</style>
|