cloud-web-corejs 1.0.128 → 1.0.130

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.
Files changed (55) hide show
  1. package/package.json +1 -1
  2. package/src/components/VabUpload/view.vue +138 -55
  3. package/src/components/baseInputExport/mixins.js +1 -1
  4. package/src/components/errorMsg/mixins.js +1 -2
  5. package/src/components/excelImport/mixins.js +2 -1
  6. package/src/components/jsonImport/mixins.js +2 -1
  7. package/src/components/langImport/mixins.js +17 -16
  8. package/src/components/wf/content.vue +772 -411
  9. package/src/components/wf/mixins/wfFlowEleScriptDialog.js +3 -0
  10. package/src/components/wf/wf.js +1 -1
  11. package/src/components/wf/wfFlowEleScriptDialog.vue +89 -0
  12. package/src/components/xform/form-designer/designer.js +3 -2
  13. package/src/components/xform/form-designer/form-widget/container-widget/containerMixin.js +3 -3
  14. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +9 -9
  15. package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +4 -1
  16. package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +2 -1
  17. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +3 -1
  18. package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +17 -4
  19. package/src/components/xform/form-designer/form-widget/field-widget/import-button-widget.vue +4 -0
  20. package/src/components/xform/form-designer/form-widget/field-widget/oplog-widget.vue +185 -0
  21. package/src/components/xform/form-designer/form-widget/field-widget/print-button-widget.vue +1 -1
  22. package/src/components/xform/form-designer/form-widget/field-widget/print-detail-button-widget.vue +108 -0
  23. package/src/components/xform/form-designer/form-widget/field-widget/singleUpload-widget.vue +145 -0
  24. package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +13 -4
  25. package/src/components/xform/form-designer/form-widget/field-widget/vabUpload2-widget.vue +725 -0
  26. package/src/components/xform/form-designer/indexMixin.js +3 -2
  27. package/src/components/xform/form-designer/setting-panel/form-setting.vue +1 -1
  28. package/src/components/xform/form-designer/setting-panel/option-items-setting.vue +376 -366
  29. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/columnRenderDialog.vue +0 -1
  30. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +372 -253
  31. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +9 -43
  32. package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import-button-editor.vue +7 -0
  33. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-button-editor.vue +8 -0
  34. package/src/components/xform/form-designer/setting-panel/property-editor/field-print-button/print-detail-button-editor.vue +91 -0
  35. package/src/components/xform/form-designer/setting-panel/property-editor/field-status/field-status-editor.vue +37 -30
  36. package/src/components/xform/form-designer/setting-panel/property-editor/field-vabUpload2/field-vabUpload2-editor.vue +62 -0
  37. package/src/components/xform/form-designer/setting-panel/property-editor/formScriptEnabled-editor.vue +19 -14
  38. package/src/components/xform/form-designer/setting-panel/property-editor/oplog-editor.vue +31 -0
  39. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +5 -1
  40. package/src/components/xform/form-designer/widget-panel/indexMixin.js +19 -19
  41. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +132 -0
  42. package/src/components/xform/form-render/container-item/containerItemMixin.js +12 -11
  43. package/src/components/xform/form-render/container-item/data-table-item.vue +13 -10
  44. package/src/components/xform/form-render/container-item/data-table-mixin.js +5 -4
  45. package/src/components/xform/form-render/indexMixin.js +3 -2
  46. package/src/components/xform/lang/zh-CN.js +3 -0
  47. package/src/components/xform/utils/util.js +1 -1451
  48. package/src/utils/request.js +1 -1
  49. package/src/utils/vab.js +1 -1
  50. package/src/views/user/notify_message/dialog.vue +24 -19
  51. package/src/views/user/outLink/form_view.vue +211 -211
  52. package/src/views/user/wf/wfReport/index.vue +448 -0
  53. package/src/views/user/wf/wf_manage/list.vue +344 -251
  54. package/src/views/user/wf/wf_transfer_setting/edit.vue +229 -0
  55. package/src/views/user/wf/wf_transfer_setting/list.vue +308 -0
@@ -1,366 +1,376 @@
1
- <template>
2
- <div class="option-items-pane">
3
- <el-form-item label="选项值类型">
4
- <el-radio-group v-model="optionModel.optionItemValueType" @change="changeValueType">
5
- <el-radio :label="0">文本</el-radio>
6
- <el-radio :label="1">数值</el-radio>
7
- <el-radio :label="2">布尔值</el-radio>
8
- </el-radio-group>
9
- </el-form-item>
10
-
11
- <el-form-item label="默认值">
12
- <template v-if="selectedWidget.type === 'checkbox' || (selectedWidget.type === 'select' && selectedWidget.options.multiple)">
13
- <a href="javascript:void(0);" class="a-link link-oneLind"
14
- @click="openTableDataEdit()">
15
- <span>{{ getDefaultValue() }}</span>
16
- <i class="el-icon-edit"></i>
17
- </a>
18
- </template>
19
- <template v-else>
20
- <el-input v-model="optionModel.defaultValue" size="mini" style="width: 100px" v-if="!optionModel.optionItemValueType"></el-input>
21
- <base-input-number v-model="optionModel.defaultValue" size="mini" style="width: 100px" v-if="optionModel.optionItemValueType==1" />
22
- <el-select v-model="optionModel.defaultValue" style="width: 100px" v-if="optionModel.optionItemValueType===2" clearable @clear="optionModel.defaultValue=null">
23
- <el-option :value="true" label="true"></el-option>
24
- <el-option :value="false" label="false"></el-option>
25
- </el-select>
26
- </template>
27
-
28
- </el-form-item>
29
- <el-radio-group
30
- v-if="selectedWidget.type === 'radio' || (selectedWidget.type === 'select' && !selectedWidget.options.multiple)"
31
- v-model="optionModel.defaultValue"
32
- @change="emitDefaultValueChange"
33
- >
34
- <draggable tag="ul" class="draggable-box" :list="optionModel.optionItems" v-bind="{ group: 'optionsGroup', ghostClass: 'ghost', handle: '.drag-option' }">
35
- <li v-for="(option, idx) in optionModel.optionItems" :key="idx">
36
- <el-radio :label="option.value">
37
- <el-input v-model="option.value" size="mini" style="width: 100px" v-if="!optionModel.optionItemValueType"></el-input>
38
- <base-input-number v-model="option.value" size="mini" style="width: 100px" v-if="optionModel.optionItemValueType==1" />
39
- <!-- <el-input v-model="option.value" size="mini" style="width: 100px" v-if="optionModel.optionItemValueType===2" disabled></el-input>-->
40
- <el-select v-model="option.value" style="width: 100px" v-if="optionModel.optionItemValueType===2">
41
- <el-option :value="true" label="true"></el-option>
42
- <el-option :value="false" label="false"></el-option>
43
- </el-select>
44
- <el-input v-model="option.label" size="mini" style="width: 100px"></el-input>
45
- <i class="el-icon-s-operation drag-option"></i>
46
- <el-button circle plain size="mini" type="danger" @click="deleteOption(option, idx)" icon="el-icon-minus" class="col-delete-button"></el-button>
47
- </el-radio>
48
- </li>
49
- </draggable>
50
- </el-radio-group>
51
- <el-checkbox-group
52
- v-else-if="selectedWidget.type === 'checkbox' || (selectedWidget.type === 'select' && selectedWidget.options.multiple)"
53
- v-model="optionModel.defaultValue"
54
- @change="emitDefaultValueChange"
55
- >
56
- <draggable tag="ul" class="draggable-box" :list="optionModel.optionItems" v-bind="{ group: 'optionsGroup', ghostClass: 'ghost', handle: '.drag-option' }">
57
- <li v-for="(option, idx) in optionModel.optionItems" :key="idx">
58
- <el-checkbox :label="option.value">
59
- <el-input v-model="option.value" size="mini" style="width: 100px" v-if="!optionModel.optionItemValueType"></el-input>
60
- <base-input-number v-model="option.value" size="mini" style="width: 100px" v-if="optionModel.optionItemValueType==1" />
61
- <el-input v-model="option.value" size="mini" style="width: 100px" v-if="optionModel.optionItemValueType===2" disabled></el-input>
62
- <el-input v-model="option.label" size="mini" style="width: 100px"></el-input>
63
- <i class="el-icon-s-operation drag-option"></i>
64
- <el-button circle plain size="mini" type="danger" @click="deleteOption(option, idx)" icon="el-icon-minus" class="col-delete-button"></el-button>
65
- </el-checkbox>
66
- </li>
67
- </draggable>
68
- </el-checkbox-group>
69
- <el-cascader
70
- v-else-if="selectedWidget.type === 'cascader'"
71
- v-model="optionModel.defaultValue"
72
- :options="optionModel.optionItems"
73
- @change="emitDefaultValueChange"
74
- :placeholder="i18nt('render.hint.selectPlaceholder')"
75
- style="width: 100%"
76
- ></el-cascader>
77
- <div v-if="selectedWidget.type === 'cascader'">
78
- <el-button type="text" @click="importCascaderOptions">{{ i18nt('designer.setting.importOptions') }}</el-button>
79
- <el-button type="text" @click="resetDefault">{{ i18nt('designer.setting.resetDefault') }}</el-button>
80
- </div>
81
-
82
- <div v-if="selectedWidget.type === 'radio' || selectedWidget.type === 'checkbox' || selectedWidget.type === 'select'">
83
- <el-button type="text" @click="addOption">{{ i18nt('designer.setting.addOption') }}</el-button>
84
- <el-button type="text" @click="importOptions" v-if="optionModel.optionItemValueType!==2">{{ i18nt('designer.setting.importOptions') }}</el-button>
85
- <el-button type="text" @click="resetDefault">{{ i18nt('designer.setting.resetDefault') }}</el-button>
86
- </div>
87
-
88
- <el-dialog
89
- :title="i18nt('designer.setting.importOptions')"
90
- :visible.sync="showImportDialogFlag"
91
- v-if="showImportDialogFlag"
92
- :show-close="true"
93
- class="small-padding-dialog"
94
- :close-on-click-modal="false"
95
- :close-on-press-escape="false"
96
- :destroy-on-close="true"
97
- :append-to-body="true"
98
- :modal-append-to-body="true"
99
- >
100
- <el-form-item><el-input type="textarea" rows="10" v-model="optionLines"></el-input></el-form-item>
101
- <div slot="footer" class="dialog-footer">
102
- <el-button size="large" type="primary" @click="saveOptions">{{ i18nt('designer.hint.confirm') }}</el-button>
103
- <el-button size="large" type="" @click="showImportDialogFlag = false">{{ i18nt('designer.hint.cancel') }}</el-button>
104
- </div>
105
- </el-dialog>
106
-
107
- <el-dialog
108
- :title="i18nt('designer.setting.importOptions')"
109
- :visible.sync="showImportCascaderDialogFlag"
110
- v-if="showImportCascaderDialogFlag"
111
- :show-close="true"
112
- class="small-padding-dialog"
113
- :close-on-click-modal="false"
114
- :close-on-press-escape="false"
115
- :destroy-on-close="true"
116
- :append-to-body="true"
117
- :modal-append-to-body="true"
118
- >
119
- <code-editor v-model="cascaderOptions" mode="json" :readonly="false"></code-editor>
120
- <div slot="footer" class="dialog-footer">
121
- <el-button size="large" type="primary" @click="saveCascaderOptions">{{ i18nt('designer.hint.confirm') }}</el-button>
122
- <el-button size="large" type="" @click="showImportCascaderDialogFlag = false">{{ i18nt('designer.hint.cancel') }}</el-button>
123
- </div>
124
- </el-dialog>
125
- <el-dialog
126
- v-if="dataDialogVisible"
127
- custom-class="dialog-style list-dialog"
128
- :title="i18nt('默认值编辑')"
129
- :visible.sync="dataDialogVisible"
130
- :show-close="!0"
131
- append-to-body=""
132
- :close-on-click-modal="!1"
133
- :close-on-press-escape="!1"
134
- :destroy-on-close="!0"
135
- width="75%"
136
- v-dialog-drag
137
- >
138
- <template slot="footer">
139
- <div class="dialog-footer">
140
- <el-button type="" @click="dataDialogVisible = !1" class="button-sty" icon="el-icon-close">
141
- {{ i18nt('designer.hint.cancel') }}
142
- </el-button>
143
- <el-button type="primary" @click="saveTableData" class="button-sty" icon="el-icon-check">
144
- {{ i18nt('designer.hint.confirm') }}
145
- </el-button>
146
- </div>
147
- </template>
148
- <code-editor mode="json" :readonly="!1" v-model="tableDataOptions"></code-editor>
149
- </el-dialog>
150
- </div>
151
- </template>
152
-
153
- <script>
154
- import Draggable from 'vuedraggable';
155
- import i18n from '../../../../components/xform/utils/i18n';
156
-
157
- export default {
158
- name: 'OptionItemsSetting',
159
- mixins: [i18n],
160
- components: {
161
- Draggable,
162
- },
163
- props: {
164
- designer: Object,
165
- selectedWidget: Object
166
- },
167
- data() {
168
- return {
169
- showImportDialogFlag: false,
170
- optionLines: '',
171
-
172
- cascaderOptions: '',
173
- showImportCascaderDialogFlag: false,
174
-
175
- //separator: '||',
176
- separator: ',',
177
- dataDialogVisible:false,
178
- tableDataOptions:[],
179
- };
180
- },
181
- computed: {
182
- optionModel() {
183
- return this.selectedWidget.options;
184
- }
185
- },
186
- watch: {
187
- 'selectedWidget.options': {
188
- deep: true,
189
- handler(val) {
190
- //console.log('888888', 'Options change!')
191
- }
192
- }
193
- },
194
- created() {
195
- if(!this.optionModel.hasOwnProperty('optionItemValueType')){
196
- this.optionModel.optionItemValueType = 0;
197
- }
198
- },
199
- methods: {
200
- emitDefaultValueChange() {
201
- if (!!this.designer && !!this.designer.formWidget) {
202
- let fieldWidget = this.designer.formWidget.getWidgetRef(this.selectedWidget.options.name);
203
- if (!!fieldWidget && !!fieldWidget.refreshDefaultValue) {
204
- fieldWidget.refreshDefaultValue();
205
- }
206
- }
207
- },
208
-
209
- deleteOption(option, index) {
210
- this.optionModel.optionItems.splice(index, 1);
211
- },
212
-
213
- addOption() {
214
- let optionItemValueType = this.optionModel.optionItemValueType;
215
- let newValue = this.optionModel.optionItems.length + 1;
216
- if(!optionItemValueType){
217
- newValue = newValue+'';
218
- }else if(optionItemValueType==2){
219
- newValue = true;
220
- }
221
- this.optionModel.optionItems.push({
222
- value: newValue,
223
- label: 'new option'
224
- });
225
- },
226
-
227
- importOptions() {
228
- this.optionLines = '';
229
- if (this.optionModel.optionItems.length > 0) {
230
- this.optionModel.optionItems.forEach(opt => {
231
- if (opt.value === opt.label) {
232
- this.optionLines += opt.value + '\n';
233
- } else {
234
- this.optionLines += opt.value + this.separator + opt.label + '\n';
235
- }
236
- });
237
- }
238
-
239
- this.showImportDialogFlag = true;
240
- },
241
-
242
- saveOptions() {
243
- let lineArray = this.optionLines.split('\n');
244
- //console.log('test', lineArray)
245
- if (lineArray.length > 0) {
246
- let isNumericOptionItemValue = this.optionModel.optionItemValueType === 1;
247
- this.optionModel.optionItems = [];
248
- lineArray.forEach(optLine => {
249
- if (!!optLine && !!optLine.trim()) {
250
- if (optLine.indexOf(this.separator) !== -1) {
251
- let valueStr = optLine.split(this.separator)[0];
252
- let value = isNumericOptionItemValue?Number(valueStr):valueStr;
253
- this.optionModel.optionItems.push({
254
- value: value,
255
- label: optLine.split(this.separator)[1]
256
- });
257
- } else {
258
- let value = isNumericOptionItemValue?Number(optLine):optLine;
259
- this.optionModel.optionItems.push({
260
- value: value,
261
- label: optLine
262
- });
263
- }
264
- }
265
- });
266
- } else {
267
- this.optionModel.optionItems = [];
268
- }
269
-
270
- this.showImportDialogFlag = false;
271
- },
272
-
273
- resetDefault() {
274
- if (this.selectedWidget.type === 'checkbox' || (this.selectedWidget.type === 'select' && this.selectedWidget.options.multiple)) {
275
- this.optionModel.defaultValue = [];
276
- } else {
277
- this.optionModel.defaultValue = undefined;
278
- }
279
-
280
- this.emitDefaultValueChange();
281
- },
282
-
283
- importCascaderOptions() {
284
- this.cascaderOptions = JSON.stringify(this.optionModel.optionItems, null, ' ');
285
- this.showImportCascaderDialogFlag = true;
286
- },
287
-
288
- saveCascaderOptions() {
289
- try {
290
- let newOptions = JSON.parse(this.cascaderOptions);
291
- this.optionModel.optionItems = newOptions;
292
- //TODO: 是否需要重置选项默认值??
293
-
294
- this.showImportCascaderDialogFlag = false;
295
- } catch (ex) {
296
- this.$message.error(this.i18nt('designer.hint.invalidOptionsData') + ex.message);
297
- }
298
- },
299
- changeValueType(val){
300
- let optionItems = this.optionModel.optionItems;
301
- // this.optionModel.defaultValue = undefined;
302
- this.resetDefault();
303
- this.optionModel.optionItems.length = 0;
304
- if(val==2){
305
- optionItems.push({
306
- label:"是",
307
- value:true,
308
- });
309
- optionItems.push({
310
- label:"否",
311
- value:false
312
- });
313
- }else{
314
- this.addOption();
315
- }
316
- this.$forceUpdate()
317
- this.emitDefaultValueChange();
318
- },
319
-
320
-
321
- openTableDataEdit: function () {
322
- (this.dataDialogVisible = !0), (this.tableDataOptions = JSON.stringify(this.optionModel.defaultValue, null, ' '));
323
- },
324
- saveTableData: function () {
325
- try {
326
- (this.optionModel.defaultValue = JSON.parse(this.tableDataOptions)), (this.dataDialogVisible = !1);
327
- } catch (e) {
328
- this.$message.error(this.i18nt('designer.hint.invalidOptionsData') + e.message);
329
- }
330
- },
331
- getDefaultValue(){
332
- let result = this.optionModel.defaultValue;
333
- if(result){
334
- if(Array.isArray(result)){
335
- result = result.join(",");
336
- }
337
- }
338
- return result;
339
- },
340
- }
341
- };
342
- </script>
343
-
344
- <style lang="scss" scoped>
345
- .option-items-pane ul {
346
- padding-inline-start: 6px;
347
- padding-left: 6px; /* 重置IE11默认样式 */
348
- }
349
-
350
- li.ghost {
351
- background: #fff;
352
- border: 2px dotted $--color-primary;
353
- }
354
-
355
- .drag-option {
356
- cursor: move;
357
- }
358
-
359
- .small-padding-dialog ::v-deep .el-dialog__body {
360
- padding: 10px 15px;
361
- }
362
-
363
- .dialog-footer .el-button {
364
- width: 100px;
365
- }
366
- </style>
1
+ <template>
2
+ <div class="option-items-pane">
3
+ <el-form-item label="选项值类型">
4
+ <el-radio-group v-model="optionModel.optionItemValueType" @change="changeValueType">
5
+ <el-radio :label="0">文本</el-radio>
6
+ <el-radio :label="1">数值</el-radio>
7
+ <el-radio :label="2">布尔值</el-radio>
8
+ </el-radio-group>
9
+ </el-form-item>
10
+
11
+ <el-form-item label="默认值">
12
+ <template v-if="selectedWidget.type === 'checkbox' || (selectedWidget.type === 'select' && selectedWidget.options.multiple)">
13
+ <a href="javascript:void(0);" class="a-link link-oneLind"
14
+ @click="openTableDataEdit()">
15
+ <span>{{ getDefaultValue() }}</span>
16
+ <i class="el-icon-edit"></i>
17
+ </a>
18
+ </template>
19
+ <template v-else>
20
+ <el-input v-model="optionModel.defaultValue" size="mini" style="width: 100px" v-if="!optionModel.optionItemValueType"></el-input>
21
+ <base-input-number v-model="optionModel.defaultValue" size="mini" style="width: 100%" v-if="optionModel.optionItemValueType==1" />
22
+ <el-select v-model="optionModel.defaultValue" style="width: 100%" v-if="optionModel.optionItemValueType===2" clearable @clear="optionModel.defaultValue=null">
23
+ <el-option :value="true" label="true"></el-option>
24
+ <el-option :value="false" label="false"></el-option>
25
+ </el-select>
26
+ </template>
27
+
28
+ </el-form-item>
29
+ <el-form-item :label="i18nt('显示字段')">
30
+ <el-input type="text" v-model="optionModel.labelKey" placeholder="默认label" :disabled="optionModel.commonAttributeEnabled || !optionModel.formScriptEnabled"></el-input>
31
+ </el-form-item>
32
+ <el-form-item :label="i18nt('关联字段')">
33
+ <el-input type="text" v-model="optionModel.valueKey" placeholder="默认value" :disabled="optionModel.commonAttributeEnabled || !optionModel.formScriptEnabled"></el-input>
34
+ </el-form-item>
35
+ <template v-if="!optionModel.commonAttributeEnabled && !optionModel.formScriptEnabled">
36
+ <el-radio-group
37
+ v-if="selectedWidget.type === 'radio' || (selectedWidget.type === 'select' && !selectedWidget.options.multiple)"
38
+ v-model="optionModel.defaultValue"
39
+ @change="emitDefaultValueChange"
40
+ >
41
+ <draggable tag="ul" class="draggable-box" :list="optionModel.optionItems" v-bind="{ group: 'optionsGroup', ghostClass: 'ghost', handle: '.drag-option' }">
42
+ <li v-for="(option, idx) in optionModel.optionItems" :key="idx">
43
+ <el-radio :label="option.value">
44
+ <el-input v-model="option.value" size="mini" style="width: 100px" v-if="!optionModel.optionItemValueType"></el-input>
45
+ <base-input-number v-model="option.value" size="mini" style="width: 100px" v-if="optionModel.optionItemValueType==1" />
46
+ <!-- <el-input v-model="option.value" size="mini" style="width: 100px" v-if="optionModel.optionItemValueType===2" disabled></el-input>-->
47
+ <el-select v-model="option.value" style="width: 100px" v-if="optionModel.optionItemValueType===2">
48
+ <el-option :value="true" label="true"></el-option>
49
+ <el-option :value="false" label="false"></el-option>
50
+ </el-select>
51
+ <el-input v-model="option.label" size="mini" style="width: 100px"></el-input>
52
+ <i class="el-icon-s-operation drag-option"></i>
53
+ <el-button circle plain size="mini" type="danger" @click="deleteOption(option, idx)" icon="el-icon-minus" class="col-delete-button"></el-button>
54
+ </el-radio>
55
+ </li>
56
+ </draggable>
57
+ </el-radio-group>
58
+ <el-checkbox-group
59
+ v-else-if="selectedWidget.type === 'checkbox' || (selectedWidget.type === 'select' && selectedWidget.options.multiple)"
60
+ v-model="optionModel.defaultValue"
61
+ @change="emitDefaultValueChange"
62
+ >
63
+ <draggable tag="ul" class="draggable-box" :list="optionModel.optionItems" v-bind="{ group: 'optionsGroup', ghostClass: 'ghost', handle: '.drag-option' }">
64
+ <li v-for="(option, idx) in optionModel.optionItems" :key="idx">
65
+ <el-checkbox :label="option.value">
66
+ <el-input v-model="option.value" size="mini" style="width: 100px" v-if="!optionModel.optionItemValueType"></el-input>
67
+ <base-input-number v-model="option.value" size="mini" style="width: 100px" v-if="optionModel.optionItemValueType==1" />
68
+ <el-input v-model="option.value" size="mini" style="width: 100px" v-if="optionModel.optionItemValueType===2" disabled></el-input>
69
+ <el-input v-model="option.label" size="mini" style="width: 100px"></el-input>
70
+ <i class="el-icon-s-operation drag-option"></i>
71
+ <el-button circle plain size="mini" type="danger" @click="deleteOption(option, idx)" icon="el-icon-minus" class="col-delete-button"></el-button>
72
+ </el-checkbox>
73
+ </li>
74
+ </draggable>
75
+ </el-checkbox-group>
76
+ <el-cascader
77
+ v-else-if="selectedWidget.type === 'cascader'"
78
+ v-model="optionModel.defaultValue"
79
+ :options="optionModel.optionItems"
80
+ @change="emitDefaultValueChange"
81
+ :placeholder="i18nt('render.hint.selectPlaceholder')"
82
+ style="width: 100%"
83
+ ></el-cascader>
84
+ <div v-if="selectedWidget.type === 'cascader'">
85
+ <el-button type="text" @click="importCascaderOptions">{{ i18nt('designer.setting.importOptions') }}</el-button>
86
+ <el-button type="text" @click="resetDefault">{{ i18nt('designer.setting.resetDefault') }}</el-button>
87
+ </div>
88
+
89
+ <div v-if="selectedWidget.type === 'radio' || selectedWidget.type === 'checkbox' || selectedWidget.type === 'select'">
90
+ <el-button type="text" @click="addOption">{{ i18nt('designer.setting.addOption') }}</el-button>
91
+ <el-button type="text" @click="importOptions" v-if="optionModel.optionItemValueType!==2">{{ i18nt('designer.setting.importOptions') }}</el-button>
92
+ <el-button type="text" @click="resetDefault">{{ i18nt('designer.setting.resetDefault') }}</el-button>
93
+ </div>
94
+ </template>
95
+
96
+
97
+ <el-dialog
98
+ :title="i18nt('designer.setting.importOptions')"
99
+ :visible.sync="showImportDialogFlag"
100
+ v-if="showImportDialogFlag"
101
+ :show-close="true"
102
+ class="small-padding-dialog"
103
+ :close-on-click-modal="false"
104
+ :close-on-press-escape="false"
105
+ :destroy-on-close="true"
106
+ :append-to-body="true"
107
+ :modal-append-to-body="true"
108
+ >
109
+ <el-form-item><el-input type="textarea" rows="10" v-model="optionLines"></el-input></el-form-item>
110
+ <div slot="footer" class="dialog-footer">
111
+ <el-button size="large" type="primary" @click="saveOptions">{{ i18nt('designer.hint.confirm') }}</el-button>
112
+ <el-button size="large" type="" @click="showImportDialogFlag = false">{{ i18nt('designer.hint.cancel') }}</el-button>
113
+ </div>
114
+ </el-dialog>
115
+
116
+ <el-dialog
117
+ :title="i18nt('designer.setting.importOptions')"
118
+ :visible.sync="showImportCascaderDialogFlag"
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>
134
+ <el-dialog
135
+ v-if="dataDialogVisible"
136
+ custom-class="dialog-style list-dialog"
137
+ :title="i18nt('默认值编辑')"
138
+ :visible.sync="dataDialogVisible"
139
+ :show-close="!0"
140
+ append-to-body=""
141
+ :close-on-click-modal="!1"
142
+ :close-on-press-escape="!1"
143
+ :destroy-on-close="!0"
144
+ width="75%"
145
+ v-dialog-drag
146
+ >
147
+ <template slot="footer">
148
+ <div class="dialog-footer">
149
+ <el-button type="" @click="dataDialogVisible = !1" class="button-sty" icon="el-icon-close">
150
+ {{ i18nt('designer.hint.cancel') }}
151
+ </el-button>
152
+ <el-button type="primary" @click="saveTableData" class="button-sty" icon="el-icon-check">
153
+ {{ i18nt('designer.hint.confirm') }}
154
+ </el-button>
155
+ </div>
156
+ </template>
157
+ <code-editor mode="json" :readonly="!1" v-model="tableDataOptions"></code-editor>
158
+ </el-dialog>
159
+ </div>
160
+ </template>
161
+
162
+ <script>
163
+ import Draggable from 'vuedraggable';
164
+ import i18n from '../../../../components/xform/utils/i18n';
165
+
166
+ export default {
167
+ name: 'OptionItemsSetting',
168
+ componentName: 'PropertyEditor',
169
+ mixins: [i18n],
170
+ components: {
171
+ Draggable,
172
+ },
173
+ props: {
174
+ designer: Object,
175
+ selectedWidget: Object
176
+ },
177
+ data() {
178
+ return {
179
+ showImportDialogFlag: false,
180
+ optionLines: '',
181
+
182
+ cascaderOptions: '',
183
+ showImportCascaderDialogFlag: false,
184
+
185
+ //separator: '||',
186
+ separator: ',',
187
+ dataDialogVisible:false,
188
+ tableDataOptions:[],
189
+ };
190
+ },
191
+ computed: {
192
+ optionModel() {
193
+ return this.selectedWidget.options;
194
+ }
195
+ },
196
+ watch: {
197
+ 'selectedWidget.options': {
198
+ deep: true,
199
+ handler(val) {
200
+ //console.log('888888', 'Options change!')
201
+ }
202
+ }
203
+ },
204
+ created() {
205
+ if(!this.optionModel.hasOwnProperty('optionItemValueType')){
206
+ this.optionModel.optionItemValueType = 0;
207
+ }
208
+ },
209
+ methods: {
210
+ emitDefaultValueChange() {
211
+ if (!!this.designer && !!this.designer.formWidget) {
212
+ let fieldWidget = this.designer.formWidget.getWidgetRef(this.selectedWidget.options.name);
213
+ if (!!fieldWidget && !!fieldWidget.refreshDefaultValue) {
214
+ fieldWidget.refreshDefaultValue();
215
+ }
216
+ }
217
+ },
218
+
219
+ deleteOption(option, index) {
220
+ this.optionModel.optionItems.splice(index, 1);
221
+ },
222
+
223
+ addOption() {
224
+ let optionItemValueType = this.optionModel.optionItemValueType;
225
+ let newValue = this.optionModel.optionItems.length + 1;
226
+ if(!optionItemValueType){
227
+ newValue = newValue+'';
228
+ }else if(optionItemValueType==2){
229
+ newValue = true;
230
+ }
231
+ this.optionModel.optionItems.push({
232
+ value: newValue,
233
+ label: 'new option'
234
+ });
235
+ },
236
+
237
+ importOptions() {
238
+ this.optionLines = '';
239
+ if (this.optionModel.optionItems.length > 0) {
240
+ this.optionModel.optionItems.forEach(opt => {
241
+ if (opt.value === opt.label) {
242
+ this.optionLines += opt.value + '\n';
243
+ } else {
244
+ this.optionLines += opt.value + this.separator + opt.label + '\n';
245
+ }
246
+ });
247
+ }
248
+
249
+ this.showImportDialogFlag = true;
250
+ },
251
+
252
+ saveOptions() {
253
+ let lineArray = this.optionLines.split('\n');
254
+ //console.log('test', lineArray)
255
+ if (lineArray.length > 0) {
256
+ let isNumericOptionItemValue = this.optionModel.optionItemValueType === 1;
257
+ this.optionModel.optionItems = [];
258
+ lineArray.forEach(optLine => {
259
+ if (!!optLine && !!optLine.trim()) {
260
+ if (optLine.indexOf(this.separator) !== -1) {
261
+ let valueStr = optLine.split(this.separator)[0];
262
+ let value = isNumericOptionItemValue?Number(valueStr):valueStr;
263
+ this.optionModel.optionItems.push({
264
+ value: value,
265
+ label: optLine.split(this.separator)[1]
266
+ });
267
+ } else {
268
+ let value = isNumericOptionItemValue?Number(optLine):optLine;
269
+ this.optionModel.optionItems.push({
270
+ value: value,
271
+ label: optLine
272
+ });
273
+ }
274
+ }
275
+ });
276
+ } else {
277
+ this.optionModel.optionItems = [];
278
+ }
279
+
280
+ this.showImportDialogFlag = false;
281
+ },
282
+
283
+ resetDefault() {
284
+ if (this.selectedWidget.type === 'checkbox' || (this.selectedWidget.type === 'select' && this.selectedWidget.options.multiple)) {
285
+ this.optionModel.defaultValue = [];
286
+ } else {
287
+ this.optionModel.defaultValue = undefined;
288
+ }
289
+
290
+ this.emitDefaultValueChange();
291
+ },
292
+
293
+ importCascaderOptions() {
294
+ this.cascaderOptions = JSON.stringify(this.optionModel.optionItems, null, ' ');
295
+ this.showImportCascaderDialogFlag = true;
296
+ },
297
+
298
+ saveCascaderOptions() {
299
+ try {
300
+ let newOptions = JSON.parse(this.cascaderOptions);
301
+ this.optionModel.optionItems = newOptions;
302
+ //TODO: 是否需要重置选项默认值??
303
+
304
+ this.showImportCascaderDialogFlag = false;
305
+ } catch (ex) {
306
+ this.$message.error(this.i18nt('designer.hint.invalidOptionsData') + ex.message);
307
+ }
308
+ },
309
+ changeValueType(val){
310
+ let optionItems = this.optionModel.optionItems;
311
+ // this.optionModel.defaultValue = undefined;
312
+ this.resetDefault();
313
+ this.optionModel.optionItems.length = 0;
314
+ if(val==2){
315
+ optionItems.push({
316
+ label:"是",
317
+ value:true,
318
+ });
319
+ optionItems.push({
320
+ label:"否",
321
+ value:false
322
+ });
323
+ }else{
324
+ this.addOption();
325
+ }
326
+ this.$forceUpdate()
327
+ this.emitDefaultValueChange();
328
+ },
329
+
330
+
331
+ openTableDataEdit: function () {
332
+ (this.dataDialogVisible = !0), (this.tableDataOptions = JSON.stringify(this.optionModel.defaultValue, null, ' '));
333
+ },
334
+ saveTableData: function () {
335
+ try {
336
+ (this.optionModel.defaultValue = JSON.parse(this.tableDataOptions)), (this.dataDialogVisible = !1);
337
+ } catch (e) {
338
+ this.$message.error(this.i18nt('designer.hint.invalidOptionsData') + e.message);
339
+ }
340
+ },
341
+ getDefaultValue(){
342
+ let result = this.optionModel.defaultValue;
343
+ if(result){
344
+ if(Array.isArray(result)){
345
+ result = result.join(",");
346
+ }
347
+ }
348
+ return result;
349
+ },
350
+ }
351
+ };
352
+ </script>
353
+
354
+ <style lang="scss" scoped>
355
+ .option-items-pane ul {
356
+ padding-inline-start: 6px;
357
+ padding-left: 6px; /* 重置IE11默认样式 */
358
+ }
359
+
360
+ li.ghost {
361
+ background: #fff;
362
+ border: 2px dotted $--color-primary;
363
+ }
364
+
365
+ .drag-option {
366
+ cursor: move;
367
+ }
368
+
369
+ .small-padding-dialog ::v-deep .el-dialog__body {
370
+ padding: 10px 15px;
371
+ }
372
+
373
+ .dialog-footer .el-button {
374
+ width: 100px;
375
+ }
376
+ </style>