cloud-web-corejs 1.0.226 → 1.0.228
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/package.json +1 -1
- package/src/components/xform/form-designer/designer.js +708 -378
- package/src/components/xform/form-designer/form-widget/container-widget/containerMixin.js +1 -110
- package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +1 -282
- package/src/components/xform/form-designer/form-widget/container-widget/detail-pane-widget.vue +3 -2
- package/src/components/xform/form-designer/form-widget/dialog/searchFormDialog.vue +29 -5
- package/src/components/xform/form-designer/form-widget/field-widget/dropdown-widget.vue +104 -62
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +38 -38
- package/src/components/xform/form-designer/form-widget/field-widget/status-widget.vue +65 -46
- package/src/components/xform/form-designer/form-widget/indexMixin.js +1 -179
- package/src/components/xform/form-designer/indexMixin.js +1 -823
- package/src/components/xform/form-designer/refMixinDesign.js +1 -28
- package/src/components/xform/form-designer/setting-panel/indexMixin.js +1 -324
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/data-table-editor.vue +3 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +102 -36
- package/src/components/xform/form-designer/setting-panel/property-editor/container-detail/detail-editor.vue +3 -3
- package/src/components/xform/form-designer/setting-panel/property-editor/dropdownFlag-editor.vue +68 -24
- package/src/components/xform/form-designer/setting-panel/property-editor/event-handler/onClick-editor.vue +14 -6
- package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +1 -566
- package/src/components/xform/form-designer/widget-panel/indexMixin.js +1 -290
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +3 -0
- package/src/components/xform/form-render/container-item/containerItemMixin.js +1 -378
- package/src/components/xform/form-render/container-item/data-table-mixin.js +214 -180
- package/src/components/xform/form-render/container-item/detail-item.vue +72 -48
- package/src/components/xform/form-render/container-item/table2-item.vue +40 -10
- package/src/components/xform/form-render/dynamicDialogRender.js +1 -195
- package/src/components/xform/form-render/refMixin.js +1 -29
- package/src/components/xform/mixins/scriptHttp.js +1 -172
- package/src/components/xform/utils/smart-vue-i18n/index.js +2 -1
- package/src/components/xform/utils/util.js +7 -1
- package/src/components/xform/utils/validators.js +1 -133
- package/src/router/index.js +2 -2
|
@@ -12,19 +12,17 @@ import {
|
|
|
12
12
|
getDefaultFormConfig,
|
|
13
13
|
overwriteObj,
|
|
14
14
|
createUUID,
|
|
15
|
-
columnFormatMap
|
|
16
|
-
} from "../../../components/xform/utils/util"
|
|
15
|
+
columnFormatMap,
|
|
16
|
+
} from "../../../components/xform/utils/util";
|
|
17
17
|
import {
|
|
18
18
|
containers,
|
|
19
19
|
advancedFields,
|
|
20
20
|
basicFields,
|
|
21
21
|
customFields,
|
|
22
|
-
businessFields
|
|
23
|
-
} from "../../../components/xform/form-designer/widget-panel/widgetsConfig.js"
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
} from "../../../components/xform/utils/config"
|
|
27
|
-
import {keyNamePrefixMap} from "../../../components/xform/form-designer/widget-panel/widgetsConfig";
|
|
22
|
+
businessFields,
|
|
23
|
+
} from "../../../components/xform/form-designer/widget-panel/widgetsConfig.js";
|
|
24
|
+
import { VARIANT_FORM_VERSION } from "../../../components/xform/utils/config";
|
|
25
|
+
import { keyNamePrefixMap } from "../../../components/xform/form-designer/widget-panel/widgetsConfig";
|
|
28
26
|
|
|
29
27
|
let createDesigner0;
|
|
30
28
|
const baseRefUtil = {
|
|
@@ -36,7 +34,7 @@ const baseRefUtil = {
|
|
|
36
34
|
advancedFields,
|
|
37
35
|
basicFields,
|
|
38
36
|
customFields,
|
|
39
|
-
VARIANT_FORM_VERSION
|
|
37
|
+
VARIANT_FORM_VERSION,
|
|
40
38
|
};
|
|
41
39
|
|
|
42
40
|
let chartContainers = [],
|
|
@@ -44,15 +42,17 @@ let chartContainers = [],
|
|
|
44
42
|
|
|
45
43
|
(function () {
|
|
46
44
|
createDesigner0 = function (vueInstance) {
|
|
47
|
-
let defaultFormConfig = baseRefUtil.deepClone(
|
|
45
|
+
let defaultFormConfig = baseRefUtil.deepClone(
|
|
46
|
+
baseRefUtil.getDefaultFormConfig()
|
|
47
|
+
);
|
|
48
48
|
|
|
49
49
|
return {
|
|
50
50
|
widgetList: [],
|
|
51
51
|
formConfig: {
|
|
52
|
-
cssCode:
|
|
52
|
+
cssCode: "",
|
|
53
53
|
gridConfig: {
|
|
54
54
|
accessReturnType: 1,
|
|
55
|
-
isLoadDataByAccess: false
|
|
55
|
+
isLoadDataByAccess: false,
|
|
56
56
|
},
|
|
57
57
|
scriptList: [],
|
|
58
58
|
formType: 0,
|
|
@@ -62,7 +62,7 @@ let chartContainers = [],
|
|
|
62
62
|
accessParam: null,
|
|
63
63
|
accessCallback: null,
|
|
64
64
|
scriptName: null,
|
|
65
|
-
scriptCode: null
|
|
65
|
+
scriptCode: null,
|
|
66
66
|
},
|
|
67
67
|
saveConfig: {
|
|
68
68
|
accessType: "1",
|
|
@@ -70,7 +70,7 @@ let chartContainers = [],
|
|
|
70
70
|
accessParam: null,
|
|
71
71
|
accessCallback: null,
|
|
72
72
|
scriptName: null,
|
|
73
|
-
scriptCode: null
|
|
73
|
+
scriptCode: null,
|
|
74
74
|
},
|
|
75
75
|
editFormCode: null,
|
|
76
76
|
editFormName: null,
|
|
@@ -84,20 +84,20 @@ let chartContainers = [],
|
|
|
84
84
|
formScriptSuccess: null,
|
|
85
85
|
saveScriptCode: "saveUpdate",
|
|
86
86
|
wfConfig: null,
|
|
87
|
-
wfStartBindSave:false,
|
|
88
|
-
wfAgreenBindSave:false,
|
|
89
|
-
wfAgreeConfigData:[],
|
|
90
|
-
wfConfigDataEnabled:false,
|
|
91
|
-
wfConfigData:[],
|
|
92
|
-
multiTabEnabled:false,
|
|
93
|
-
multiTabLabelField:null,
|
|
87
|
+
wfStartBindSave: false,
|
|
88
|
+
wfAgreenBindSave: false,
|
|
89
|
+
wfAgreeConfigData: [],
|
|
90
|
+
wfConfigDataEnabled: false,
|
|
91
|
+
wfConfigData: [],
|
|
92
|
+
multiTabEnabled: false,
|
|
93
|
+
multiTabLabelField: null,
|
|
94
94
|
addFormCode: null,
|
|
95
95
|
addFormName: null,
|
|
96
96
|
wfTheme: null,
|
|
97
|
-
otherTabEnabled:false,
|
|
98
|
-
otherTabList:[],
|
|
97
|
+
otherTabEnabled: false,
|
|
98
|
+
otherTabList: [],
|
|
99
99
|
customListTabLabel: null,
|
|
100
|
-
globalConfig: null
|
|
100
|
+
globalConfig: null,
|
|
101
101
|
},
|
|
102
102
|
dataSources: [], //数据源
|
|
103
103
|
|
|
@@ -108,7 +108,6 @@ let chartContainers = [],
|
|
|
108
108
|
|
|
109
109
|
formWidget: null, //表单设计容器
|
|
110
110
|
|
|
111
|
-
|
|
112
111
|
cssClassList: [], //自定义样式列表
|
|
113
112
|
|
|
114
113
|
historyData: {
|
|
@@ -135,7 +134,7 @@ let chartContainers = [],
|
|
|
135
134
|
},
|
|
136
135
|
|
|
137
136
|
clearDesigner(skipHistoryChange) {
|
|
138
|
-
let emptyWidgetListFlag =
|
|
137
|
+
let emptyWidgetListFlag = this.widgetList.length === 0;
|
|
139
138
|
this.widgetList = [];
|
|
140
139
|
this.selectedId = null;
|
|
141
140
|
this.selectedWidgetName = null;
|
|
@@ -153,13 +152,13 @@ let chartContainers = [],
|
|
|
153
152
|
},
|
|
154
153
|
|
|
155
154
|
loadPresetCssCode(preCssCode) {
|
|
156
|
-
if (
|
|
155
|
+
if (this.formConfig.cssCode === "" && !!preCssCode) {
|
|
157
156
|
this.formConfig.cssCode = preCssCode;
|
|
158
157
|
}
|
|
159
158
|
},
|
|
160
159
|
|
|
161
160
|
getLayoutType() {
|
|
162
|
-
return this.formConfig.layoutType ||
|
|
161
|
+
return this.formConfig.layoutType || "PC";
|
|
163
162
|
},
|
|
164
163
|
|
|
165
164
|
changeLayoutType(newType) {
|
|
@@ -170,8 +169,8 @@ let chartContainers = [],
|
|
|
170
169
|
return {
|
|
171
170
|
widgetList: [],
|
|
172
171
|
// formConfig: baseRefUtil.deepClone(this.formConfig)
|
|
173
|
-
formConfig: baseRefUtil.deepClone(defaultFormConfig)
|
|
174
|
-
}
|
|
172
|
+
formConfig: baseRefUtil.deepClone(defaultFormConfig),
|
|
173
|
+
};
|
|
175
174
|
},
|
|
176
175
|
|
|
177
176
|
handleImportJson(formJson) {
|
|
@@ -179,37 +178,39 @@ let chartContainers = [],
|
|
|
179
178
|
if (formConfig.formCode === vueInstance?.reportTemplate?.formCode) {
|
|
180
179
|
return;
|
|
181
180
|
}
|
|
182
|
-
let widgetArr = formJson.widgetList
|
|
181
|
+
let widgetArr = formJson.widgetList;
|
|
183
182
|
let itemFieldMap = {
|
|
184
183
|
grid: "cols",
|
|
185
184
|
table: "rows",
|
|
186
185
|
"table-cell": "widgetList",
|
|
187
|
-
|
|
186
|
+
"h5-table": "rows",
|
|
188
187
|
"h5-table-cell": "widgetList",
|
|
189
188
|
tab: "tabs",
|
|
190
189
|
"tab-pane": "widgetList",
|
|
191
190
|
"grid-col": "widgetList",
|
|
192
191
|
"vf-box": "widgetList",
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
card: "widgetList",
|
|
193
|
+
detail: "panes",
|
|
195
194
|
"detail-pane": "widgetList",
|
|
196
195
|
"detail-h5": "panes",
|
|
197
196
|
"h5-card": "panes",
|
|
198
197
|
"h5-card-pane": "widgetList",
|
|
199
|
-
}
|
|
198
|
+
};
|
|
200
199
|
let loopDo = (widgetList) => {
|
|
201
200
|
if (!widgetList) return;
|
|
202
|
-
widgetList.forEach(widget => {
|
|
203
|
-
if (
|
|
204
|
-
let vailColumns = widget.options.tableColumns.filter(
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
widgetList.forEach((widget) => {
|
|
202
|
+
if (widget.type === "data-table" || widget.type === "list-h5") {
|
|
203
|
+
let vailColumns = widget.options.tableColumns.filter(
|
|
204
|
+
(item) => item.prop && item.label
|
|
205
|
+
);
|
|
206
|
+
vailColumns.forEach((item) => {
|
|
207
|
+
if (item.formatS === "editAttachment") {
|
|
207
208
|
let prop = item.prop;
|
|
208
209
|
let columnOption = item.columnOption;
|
|
209
210
|
let editColumnOption = item.editColumnOption;
|
|
210
211
|
|
|
211
|
-
let suffix = this.createAttachmentSuffix()
|
|
212
|
-
let keyName = this.createAttachmentKeyName(suffix)
|
|
212
|
+
let suffix = this.createAttachmentSuffix();
|
|
213
|
+
let keyName = this.createAttachmentKeyName(suffix);
|
|
213
214
|
if (columnOption) {
|
|
214
215
|
columnOption.keyName = keyName;
|
|
215
216
|
columnOption.keyNameSuffix = suffix;
|
|
@@ -221,31 +222,34 @@ let chartContainers = [],
|
|
|
221
222
|
item.prop = keyName;
|
|
222
223
|
}
|
|
223
224
|
});
|
|
224
|
-
} else if (
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
} else if (
|
|
226
|
+
widget.type === "vabUpload" ||
|
|
227
|
+
widget.type === "baseAttachment"
|
|
228
|
+
) {
|
|
229
|
+
let suffix = this.createAttachmentSuffix();
|
|
230
|
+
let keyName = this.createAttachmentKeyName(suffix);
|
|
227
231
|
widget.options.keyName = keyName;
|
|
228
232
|
widget.options.keyNameSuffix = suffix;
|
|
229
233
|
} else {
|
|
230
|
-
if (widget.category
|
|
234
|
+
if (widget.category === "container") {
|
|
231
235
|
let itemField = itemFieldMap[widget.type];
|
|
232
236
|
if (itemField) {
|
|
233
|
-
if ("table"
|
|
234
|
-
widget[itemField].forEach(item => {
|
|
237
|
+
if ("table" === widget.type) {
|
|
238
|
+
widget[itemField].forEach((item) => {
|
|
235
239
|
loopDo(item.cols);
|
|
236
|
-
})
|
|
237
|
-
} else if ("h5-table"
|
|
238
|
-
widget[itemField].forEach(item => {
|
|
240
|
+
});
|
|
241
|
+
} else if ("h5-table" === widget.type) {
|
|
242
|
+
widget[itemField].forEach((item) => {
|
|
239
243
|
loopDo(item.cols);
|
|
240
|
-
})
|
|
244
|
+
});
|
|
241
245
|
} else {
|
|
242
246
|
loopDo(widget[itemField]);
|
|
243
247
|
}
|
|
244
248
|
}
|
|
245
249
|
}
|
|
246
250
|
}
|
|
247
|
-
})
|
|
248
|
-
}
|
|
251
|
+
});
|
|
252
|
+
};
|
|
249
253
|
loopDo(widgetArr);
|
|
250
254
|
},
|
|
251
255
|
loadFormJson(formJson) {
|
|
@@ -257,34 +261,45 @@ let chartContainers = [],
|
|
|
257
261
|
}
|
|
258
262
|
if (!!formJson && !!formJson.formConfig) {
|
|
259
263
|
//this.formConfig = importObj.formConfig
|
|
260
|
-
baseRefUtil.overwriteObj(
|
|
264
|
+
baseRefUtil.overwriteObj(
|
|
265
|
+
this.formConfig,
|
|
266
|
+
formJson.formConfig
|
|
267
|
+
); /* 用=赋值,会导致inject依赖注入的formConfig属性变成非响应式 */
|
|
261
268
|
modifiedFlag = true;
|
|
262
269
|
}
|
|
263
270
|
|
|
264
271
|
if (modifiedFlag) {
|
|
265
|
-
this.emitEvent(
|
|
272
|
+
this.emitEvent("form-json-imported", []); // 通知其他组件
|
|
266
273
|
}
|
|
267
|
-
this.setSelected()
|
|
274
|
+
this.setSelected();
|
|
268
275
|
return modifiedFlag;
|
|
269
276
|
},
|
|
270
277
|
handleSelectedWidget(selected) {
|
|
271
278
|
//处理历史未定义的属性
|
|
272
|
-
if (selected.formItemFlag || selected.type
|
|
279
|
+
if (selected.formItemFlag || selected.type === "data-table") {
|
|
273
280
|
if (selected.options.submitFlag === void 0) {
|
|
274
281
|
// selected.options.submitFlag = true;
|
|
275
|
-
this.vueInstance.$set(selected.options,
|
|
282
|
+
this.vueInstance.$set(selected.options, "submitFlag", true);
|
|
276
283
|
}
|
|
277
284
|
}
|
|
278
285
|
this.handleKeyNameSuffix(selected);
|
|
279
286
|
},
|
|
280
287
|
handleKeyNameSuffix(selected) {
|
|
281
288
|
if (!selected) return;
|
|
282
|
-
let optionModel = selected.options
|
|
289
|
+
let optionModel = selected.options;
|
|
283
290
|
let prefix = this.getKeyNamePrefix(selected.type);
|
|
284
|
-
if (
|
|
291
|
+
if (
|
|
292
|
+
optionModel.keyNameEnabled &&
|
|
293
|
+
!!prefix &&
|
|
294
|
+
!optionModel.keyNameSuffix
|
|
295
|
+
) {
|
|
285
296
|
let keyName = optionModel.keyName;
|
|
286
297
|
if (keyName.startsWith(prefix)) {
|
|
287
|
-
this.vueInstance.$set(
|
|
298
|
+
this.vueInstance.$set(
|
|
299
|
+
optionModel,
|
|
300
|
+
"keyNameSuffix",
|
|
301
|
+
keyName.substring(prefix.length)
|
|
302
|
+
);
|
|
288
303
|
}
|
|
289
304
|
}
|
|
290
305
|
},
|
|
@@ -302,24 +317,20 @@ let chartContainers = [],
|
|
|
302
317
|
this.selectedId = selected.id;
|
|
303
318
|
this.selectedWidgetName = selected.options.name;
|
|
304
319
|
if (!selected.category) {
|
|
305
|
-
this.emitEvent(
|
|
306
|
-
"canvas-select-field",
|
|
307
|
-
selected.options.name
|
|
308
|
-
);
|
|
320
|
+
this.emitEvent("canvas-select-field", selected.options.name);
|
|
309
321
|
} else {
|
|
310
|
-
this.emitEvent(
|
|
311
|
-
"canvas-select-container",
|
|
312
|
-
selected.options.name
|
|
313
|
-
);
|
|
322
|
+
this.emitEvent("canvas-select-container", selected.options.name);
|
|
314
323
|
}
|
|
315
|
-
|
|
316
324
|
}
|
|
317
325
|
},
|
|
318
326
|
|
|
319
327
|
updateSelectedWidgetNameAndLabel(selectedWidget, newName, newLabel) {
|
|
320
328
|
this.selectedWidgetName = newName;
|
|
321
329
|
//selectedWidget.options.name = newName //此行多余
|
|
322
|
-
if (
|
|
330
|
+
if (
|
|
331
|
+
!!newLabel &&
|
|
332
|
+
Object.keys(selectedWidget.options).indexOf("label") > -1
|
|
333
|
+
) {
|
|
323
334
|
selectedWidget.options.label = newLabel;
|
|
324
335
|
}
|
|
325
336
|
},
|
|
@@ -336,7 +347,10 @@ let chartContainers = [],
|
|
|
336
347
|
let wgCategory = evt.draggedContext.element.category;
|
|
337
348
|
let wgType = evt.draggedContext.element.type;
|
|
338
349
|
if (!!evt.to) {
|
|
339
|
-
if (
|
|
350
|
+
if (
|
|
351
|
+
evt.to.className === "sub-form-table" &&
|
|
352
|
+
wgCategory === "container"
|
|
353
|
+
) {
|
|
340
354
|
//this.$message.info(this.vueInstance.i18nt('designer.hint.onlyFieldWidgetAcceptable'))
|
|
341
355
|
return false;
|
|
342
356
|
}
|
|
@@ -349,10 +363,10 @@ let chartContainers = [],
|
|
|
349
363
|
checkFieldMove(evt) {
|
|
350
364
|
if (!!evt.draggedContext && !!evt.draggedContext.element) {
|
|
351
365
|
let wgCategory = evt.draggedContext.element.category;
|
|
352
|
-
let wgType = evt.draggedContext.element.type +
|
|
366
|
+
let wgType = evt.draggedContext.element.type + "";
|
|
353
367
|
//console.log('wgType======', wgType)
|
|
354
368
|
if (!!evt.to) {
|
|
355
|
-
if (
|
|
369
|
+
if (evt.to.className === "sub-form-table" && wgType === "slot") {
|
|
356
370
|
//this.$message.info(this.vueInstance.i18nt('designer.hint.onlyFieldWidgetAcceptable'))
|
|
357
371
|
return false;
|
|
358
372
|
}
|
|
@@ -369,10 +383,10 @@ let chartContainers = [],
|
|
|
369
383
|
appendTableRow(widget) {
|
|
370
384
|
let rowIdx = widget.rows.length; //确定插入行位置
|
|
371
385
|
let newRow = baseRefUtil.deepClone(widget.rows[widget.rows.length - 1]);
|
|
372
|
-
newRow.id =
|
|
386
|
+
newRow.id = "table-row-" + baseRefUtil.generateId();
|
|
373
387
|
newRow.merged = false;
|
|
374
|
-
newRow.cols.forEach(col => {
|
|
375
|
-
col.id =
|
|
388
|
+
newRow.cols.forEach((col) => {
|
|
389
|
+
col.id = "table-cell-" + baseRefUtil.generateId();
|
|
376
390
|
col.options.name = col.id;
|
|
377
391
|
col.merged = false;
|
|
378
392
|
col.options.colspan = 1;
|
|
@@ -390,9 +404,11 @@ let chartContainers = [],
|
|
|
390
404
|
*/
|
|
391
405
|
appendTableCol(widget) {
|
|
392
406
|
let colIdx = widget.rows[0].cols.length; //确定插入列位置
|
|
393
|
-
widget.rows.forEach(row => {
|
|
394
|
-
let newCol = baseRefUtil.deepClone(
|
|
395
|
-
|
|
407
|
+
widget.rows.forEach((row) => {
|
|
408
|
+
let newCol = baseRefUtil.deepClone(
|
|
409
|
+
this.getContainerByType("table-cell")
|
|
410
|
+
);
|
|
411
|
+
newCol.id = "table-cell-" + baseRefUtil.generateId();
|
|
396
412
|
newCol.options.name = newCol.id;
|
|
397
413
|
newCol.merged = false;
|
|
398
414
|
newCol.options.colspan = 1;
|
|
@@ -405,8 +421,9 @@ let chartContainers = [],
|
|
|
405
421
|
},
|
|
406
422
|
|
|
407
423
|
insertTableRow(widget, insertPos, cloneRowIdx, curCol, aboveFlag) {
|
|
408
|
-
let newRowIdx = !!aboveFlag ? insertPos :
|
|
409
|
-
if (!aboveFlag) {
|
|
424
|
+
let newRowIdx = !!aboveFlag ? insertPos : insertPos + 1; //初步确定插入行位置
|
|
425
|
+
if (!aboveFlag) {
|
|
426
|
+
//继续向下寻找同列第一个未被合并的单元格
|
|
410
427
|
let tmpRowIdx = newRowIdx;
|
|
411
428
|
let rowFoundFlag = false;
|
|
412
429
|
while (tmpRowIdx < widget.rows.length) {
|
|
@@ -425,10 +442,10 @@ let chartContainers = [],
|
|
|
425
442
|
}
|
|
426
443
|
|
|
427
444
|
let newRow = baseRefUtil.deepClone(widget.rows[cloneRowIdx]);
|
|
428
|
-
newRow.id =
|
|
445
|
+
newRow.id = "table-row-" + baseRefUtil.generateId();
|
|
429
446
|
newRow.merged = false;
|
|
430
|
-
newRow.cols.forEach(col => {
|
|
431
|
-
col.id =
|
|
447
|
+
newRow.cols.forEach((col) => {
|
|
448
|
+
col.id = "table-cell-" + baseRefUtil.generateId();
|
|
432
449
|
col.options.name = col.id;
|
|
433
450
|
col.merged = false;
|
|
434
451
|
col.options.colspan = 1;
|
|
@@ -438,24 +455,39 @@ let chartContainers = [],
|
|
|
438
455
|
widget.rows.splice(newRowIdx, 0, newRow);
|
|
439
456
|
|
|
440
457
|
let colNo = 0;
|
|
441
|
-
while (
|
|
458
|
+
while (
|
|
459
|
+
newRowIdx < widget.rows.length - 1 &&
|
|
460
|
+
colNo < widget.rows[0].cols.length
|
|
461
|
+
) {
|
|
462
|
+
//越界判断
|
|
442
463
|
const cellOfNextRow = widget.rows[newRowIdx + 1].cols[colNo];
|
|
443
464
|
const rowMerged = cellOfNextRow.merged; //确定插入位置下一行的单元格是否为合并单元格
|
|
444
465
|
if (!!rowMerged) {
|
|
445
466
|
let rowArray = widget.rows;
|
|
446
467
|
let unMergedCell = {};
|
|
447
468
|
let startRowIndex = null;
|
|
448
|
-
for (let i = newRowIdx; i >= 0; i--) {
|
|
449
|
-
|
|
469
|
+
for (let i = newRowIdx; i >= 0; i--) {
|
|
470
|
+
//查找该行已合并的主单元格
|
|
471
|
+
if (
|
|
472
|
+
!rowArray[i].cols[colNo].merged &&
|
|
473
|
+
rowArray[i].cols[colNo].options.rowspan > 1
|
|
474
|
+
) {
|
|
450
475
|
startRowIndex = i;
|
|
451
476
|
unMergedCell = rowArray[i].cols[colNo];
|
|
452
477
|
break;
|
|
453
478
|
}
|
|
454
479
|
}
|
|
455
480
|
|
|
456
|
-
if (!!unMergedCell.options) {
|
|
481
|
+
if (!!unMergedCell.options) {
|
|
482
|
+
//如果有符合条件的unMergedCell
|
|
457
483
|
let newRowspan = unMergedCell.options.rowspan + 1;
|
|
458
|
-
this.setPropsOfMergedRows(
|
|
484
|
+
this.setPropsOfMergedRows(
|
|
485
|
+
widget.rows,
|
|
486
|
+
startRowIndex,
|
|
487
|
+
colNo,
|
|
488
|
+
unMergedCell.options.colspan,
|
|
489
|
+
newRowspan
|
|
490
|
+
);
|
|
459
491
|
colNo += unMergedCell.options.colspan;
|
|
460
492
|
} else {
|
|
461
493
|
colNo += 1;
|
|
@@ -470,8 +502,9 @@ let chartContainers = [],
|
|
|
470
502
|
},
|
|
471
503
|
|
|
472
504
|
insertTableCol(widget, insertPos, curRow, leftFlag) {
|
|
473
|
-
let newColIdx = !!leftFlag ? insertPos :
|
|
474
|
-
if (!leftFlag) {
|
|
505
|
+
let newColIdx = !!leftFlag ? insertPos : insertPos + 1; //初步确定插入列位置
|
|
506
|
+
if (!leftFlag) {
|
|
507
|
+
//继续向右寻找同行第一个未被合并的单元格
|
|
475
508
|
let tmpColIdx = newColIdx;
|
|
476
509
|
let colFoundFlag = false;
|
|
477
510
|
while (tmpColIdx < widget.rows[curRow].cols.length) {
|
|
@@ -489,9 +522,11 @@ let chartContainers = [],
|
|
|
489
522
|
}
|
|
490
523
|
}
|
|
491
524
|
|
|
492
|
-
widget.rows.forEach(row => {
|
|
493
|
-
let newCol = baseRefUtil.deepClone(
|
|
494
|
-
|
|
525
|
+
widget.rows.forEach((row) => {
|
|
526
|
+
let newCol = baseRefUtil.deepClone(
|
|
527
|
+
this.getContainerByType("table-cell")
|
|
528
|
+
);
|
|
529
|
+
newCol.id = "table-cell-" + baseRefUtil.generateId();
|
|
495
530
|
newCol.options.name = newCol.id;
|
|
496
531
|
newCol.merged = false;
|
|
497
532
|
newCol.options.colspan = 1;
|
|
@@ -501,24 +536,36 @@ let chartContainers = [],
|
|
|
501
536
|
});
|
|
502
537
|
|
|
503
538
|
let rowNo = 0;
|
|
504
|
-
while (
|
|
539
|
+
while (
|
|
540
|
+
newColIdx < widget.rows[0].cols.length - 1 &&
|
|
541
|
+
rowNo < widget.rows.length
|
|
542
|
+
) {
|
|
543
|
+
//越界判断
|
|
505
544
|
const cellOfNextCol = widget.rows[rowNo].cols[newColIdx + 1];
|
|
506
545
|
const colMerged = cellOfNextCol.merged; //确定插入位置右侧列的单元格是否为合并单元格
|
|
507
546
|
if (!!colMerged) {
|
|
508
547
|
let colArray = widget.rows[rowNo].cols;
|
|
509
548
|
let unMergedCell = {};
|
|
510
549
|
let startColIndex = null;
|
|
511
|
-
for (let i = newColIdx; i >= 0; i--) {
|
|
512
|
-
|
|
550
|
+
for (let i = newColIdx; i >= 0; i--) {
|
|
551
|
+
//查找该行已合并的主单元格
|
|
552
|
+
if (!colArray[i].merged && colArray[i].options.colspan > 1) {
|
|
513
553
|
startColIndex = i;
|
|
514
554
|
unMergedCell = colArray[i];
|
|
515
555
|
break;
|
|
516
556
|
}
|
|
517
557
|
}
|
|
518
558
|
|
|
519
|
-
if (!!unMergedCell.options) {
|
|
559
|
+
if (!!unMergedCell.options) {
|
|
560
|
+
//如果有符合条件的unMergedCell
|
|
520
561
|
let newColspan = unMergedCell.options.colspan + 1;
|
|
521
|
-
this.setPropsOfMergedCols(
|
|
562
|
+
this.setPropsOfMergedCols(
|
|
563
|
+
widget.rows,
|
|
564
|
+
rowNo,
|
|
565
|
+
startColIndex,
|
|
566
|
+
newColspan,
|
|
567
|
+
unMergedCell.options.rowspan
|
|
568
|
+
);
|
|
522
569
|
rowNo += unMergedCell.options.rowspan;
|
|
523
570
|
} else {
|
|
524
571
|
rowNo += 1;
|
|
@@ -532,8 +579,9 @@ let chartContainers = [],
|
|
|
532
579
|
this.emitHistoryChange();
|
|
533
580
|
},
|
|
534
581
|
insertH5TableCol(widget, insertPos, curRow, leftFlag) {
|
|
535
|
-
let newColIdx = !!leftFlag ? insertPos :
|
|
536
|
-
if (!leftFlag) {
|
|
582
|
+
let newColIdx = !!leftFlag ? insertPos : insertPos + 1; //初步确定插入列位置
|
|
583
|
+
if (!leftFlag) {
|
|
584
|
+
//继续向右寻找同行第一个未被合并的单元格
|
|
537
585
|
let tmpColIdx = newColIdx;
|
|
538
586
|
let colFoundFlag = false;
|
|
539
587
|
while (tmpColIdx < widget.rows[curRow].cols.length) {
|
|
@@ -551,9 +599,11 @@ let chartContainers = [],
|
|
|
551
599
|
}
|
|
552
600
|
}
|
|
553
601
|
|
|
554
|
-
widget.rows.forEach(row => {
|
|
555
|
-
let newCol = baseRefUtil.deepClone(
|
|
556
|
-
|
|
602
|
+
widget.rows.forEach((row) => {
|
|
603
|
+
let newCol = baseRefUtil.deepClone(
|
|
604
|
+
this.getContainerByType("h5-table-cell")
|
|
605
|
+
);
|
|
606
|
+
newCol.id = "table-cell-" + baseRefUtil.generateId();
|
|
557
607
|
newCol.options.name = newCol.id;
|
|
558
608
|
newCol.merged = false;
|
|
559
609
|
newCol.options.colspan = 1;
|
|
@@ -563,24 +613,36 @@ let chartContainers = [],
|
|
|
563
613
|
});
|
|
564
614
|
|
|
565
615
|
let rowNo = 0;
|
|
566
|
-
while (
|
|
616
|
+
while (
|
|
617
|
+
newColIdx < widget.rows[0].cols.length - 1 &&
|
|
618
|
+
rowNo < widget.rows.length
|
|
619
|
+
) {
|
|
620
|
+
//越界判断
|
|
567
621
|
const cellOfNextCol = widget.rows[rowNo].cols[newColIdx + 1];
|
|
568
622
|
const colMerged = cellOfNextCol.merged; //确定插入位置右侧列的单元格是否为合并单元格
|
|
569
623
|
if (!!colMerged) {
|
|
570
624
|
let colArray = widget.rows[rowNo].cols;
|
|
571
625
|
let unMergedCell = {};
|
|
572
626
|
let startColIndex = null;
|
|
573
|
-
for (let i = newColIdx; i >= 0; i--) {
|
|
574
|
-
|
|
627
|
+
for (let i = newColIdx; i >= 0; i--) {
|
|
628
|
+
//查找该行已合并的主单元格
|
|
629
|
+
if (!colArray[i].merged && colArray[i].options.colspan > 1) {
|
|
575
630
|
startColIndex = i;
|
|
576
631
|
unMergedCell = colArray[i];
|
|
577
632
|
break;
|
|
578
633
|
}
|
|
579
634
|
}
|
|
580
635
|
|
|
581
|
-
if (!!unMergedCell.options) {
|
|
636
|
+
if (!!unMergedCell.options) {
|
|
637
|
+
//如果有符合条件的unMergedCell
|
|
582
638
|
let newColspan = unMergedCell.options.colspan + 1;
|
|
583
|
-
this.setPropsOfMergedCols(
|
|
639
|
+
this.setPropsOfMergedCols(
|
|
640
|
+
widget.rows,
|
|
641
|
+
rowNo,
|
|
642
|
+
startColIndex,
|
|
643
|
+
newColspan,
|
|
644
|
+
unMergedCell.options.rowspan
|
|
645
|
+
);
|
|
584
646
|
rowNo += unMergedCell.options.rowspan;
|
|
585
647
|
} else {
|
|
586
648
|
rowNo += 1;
|
|
@@ -593,10 +655,16 @@ let chartContainers = [],
|
|
|
593
655
|
|
|
594
656
|
this.emitHistoryChange();
|
|
595
657
|
},
|
|
596
|
-
setPropsOfMergedCols(
|
|
658
|
+
setPropsOfMergedCols(
|
|
659
|
+
rowArray,
|
|
660
|
+
startRowIndex,
|
|
661
|
+
startColIndex,
|
|
662
|
+
newColspan,
|
|
663
|
+
rowspan
|
|
664
|
+
) {
|
|
597
665
|
for (let i = startRowIndex; i < startRowIndex + rowspan; i++) {
|
|
598
666
|
for (let j = startColIndex; j < startColIndex + newColspan; j++) {
|
|
599
|
-
if (
|
|
667
|
+
if (i === startRowIndex && j === startColIndex) {
|
|
600
668
|
rowArray[i].cols[j].options.colspan = newColspan; //合并后的主单元格
|
|
601
669
|
continue;
|
|
602
670
|
}
|
|
@@ -608,10 +676,16 @@ let chartContainers = [],
|
|
|
608
676
|
}
|
|
609
677
|
},
|
|
610
678
|
|
|
611
|
-
setPropsOfMergedRows(
|
|
679
|
+
setPropsOfMergedRows(
|
|
680
|
+
rowArray,
|
|
681
|
+
startRowIndex,
|
|
682
|
+
startColIndex,
|
|
683
|
+
colspan,
|
|
684
|
+
newRowspan
|
|
685
|
+
) {
|
|
612
686
|
for (let i = startRowIndex; i < startRowIndex + newRowspan; i++) {
|
|
613
687
|
for (let j = startColIndex; j < startColIndex + colspan; j++) {
|
|
614
|
-
if (
|
|
688
|
+
if (i === startRowIndex && j === startColIndex) {
|
|
615
689
|
rowArray[i].cols[j].options.rowspan = newRowspan;
|
|
616
690
|
continue;
|
|
617
691
|
}
|
|
@@ -623,7 +697,13 @@ let chartContainers = [],
|
|
|
623
697
|
}
|
|
624
698
|
},
|
|
625
699
|
|
|
626
|
-
setPropsOfSplitCol(
|
|
700
|
+
setPropsOfSplitCol(
|
|
701
|
+
rowArray,
|
|
702
|
+
startRowIndex,
|
|
703
|
+
startColIndex,
|
|
704
|
+
colspan,
|
|
705
|
+
rowspan
|
|
706
|
+
) {
|
|
627
707
|
for (let i = startRowIndex; i < startRowIndex + rowspan; i++) {
|
|
628
708
|
for (let j = startColIndex; j < startColIndex + colspan; j++) {
|
|
629
709
|
rowArray[i].cols[j].merged = false;
|
|
@@ -633,7 +713,13 @@ let chartContainers = [],
|
|
|
633
713
|
}
|
|
634
714
|
},
|
|
635
715
|
|
|
636
|
-
setPropsOfSplitRow(
|
|
716
|
+
setPropsOfSplitRow(
|
|
717
|
+
rowArray,
|
|
718
|
+
startRowIndex,
|
|
719
|
+
startColIndex,
|
|
720
|
+
colspan,
|
|
721
|
+
rowspan
|
|
722
|
+
) {
|
|
637
723
|
for (let i = startRowIndex; i < startRowIndex + rowspan; i++) {
|
|
638
724
|
for (let j = startColIndex; j < startColIndex + colspan; j++) {
|
|
639
725
|
rowArray[i].cols[j].merged = false;
|
|
@@ -644,11 +730,14 @@ let chartContainers = [],
|
|
|
644
730
|
},
|
|
645
731
|
|
|
646
732
|
mergeTableCol(rowArray, colArray, curRow, curCol, leftFlag, cellWidget) {
|
|
647
|
-
let mergedColIdx = !!leftFlag
|
|
733
|
+
let mergedColIdx = !!leftFlag
|
|
734
|
+
? curCol
|
|
735
|
+
: curCol + colArray[curCol].options.colspan;
|
|
648
736
|
|
|
649
737
|
// let remainedColIdx = !!leftFlag ? curCol - colArray[curCol - 1].options.colspan : curCol
|
|
650
738
|
let remainedColIdx = !!leftFlag ? curCol - 1 : curCol;
|
|
651
|
-
if (!!leftFlag) {
|
|
739
|
+
if (!!leftFlag) {
|
|
740
|
+
//继续向左寻找同行未被合并的第一个单元格
|
|
652
741
|
let tmpColIdx = remainedColIdx;
|
|
653
742
|
while (tmpColIdx >= 0) {
|
|
654
743
|
if (!rowArray[curRow].cols[tmpColIdx].merged) {
|
|
@@ -660,19 +749,37 @@ let chartContainers = [],
|
|
|
660
749
|
}
|
|
661
750
|
}
|
|
662
751
|
|
|
663
|
-
if (
|
|
664
|
-
|
|
665
|
-
|
|
752
|
+
if (
|
|
753
|
+
!!colArray[mergedColIdx].widgetList &&
|
|
754
|
+
colArray[mergedColIdx].widgetList.length > 0
|
|
755
|
+
) {
|
|
756
|
+
//保留widgetList
|
|
757
|
+
if (
|
|
758
|
+
!colArray[remainedColIdx].widgetList ||
|
|
759
|
+
colArray[remainedColIdx].widgetList.length === 0
|
|
760
|
+
) {
|
|
761
|
+
colArray[remainedColIdx].widgetList = baseRefUtil.deepClone(
|
|
762
|
+
colArray[mergedColIdx].widgetList
|
|
763
|
+
);
|
|
666
764
|
}
|
|
667
765
|
}
|
|
668
766
|
|
|
669
|
-
let newColspan =
|
|
670
|
-
|
|
767
|
+
let newColspan =
|
|
768
|
+
colArray[mergedColIdx].options.colspan * 1 +
|
|
769
|
+
colArray[remainedColIdx].options.colspan * 1;
|
|
770
|
+
this.setPropsOfMergedCols(
|
|
771
|
+
rowArray,
|
|
772
|
+
curRow,
|
|
773
|
+
remainedColIdx,
|
|
774
|
+
newColspan,
|
|
775
|
+
cellWidget.options.rowspan
|
|
776
|
+
);
|
|
671
777
|
|
|
672
778
|
this.emitHistoryChange();
|
|
673
779
|
},
|
|
674
780
|
|
|
675
|
-
mergeTableWholeRow(rowArray, colArray, rowIndex, colIndex) {
|
|
781
|
+
mergeTableWholeRow(rowArray, colArray, rowIndex, colIndex) {
|
|
782
|
+
//需要考虑操作的行存在已合并的单元格!!
|
|
676
783
|
//整行所有单元格行高不一致不可合并!!
|
|
677
784
|
let startRowspan = rowArray[rowIndex].cols[0].options.rowspan;
|
|
678
785
|
let unmatchedFlag = false;
|
|
@@ -683,31 +790,53 @@ let chartContainers = [],
|
|
|
683
790
|
}
|
|
684
791
|
}
|
|
685
792
|
if (unmatchedFlag) {
|
|
686
|
-
this.vueInstance.$message.info(
|
|
793
|
+
this.vueInstance.$message.info(
|
|
794
|
+
this.vueInstance.i18nt(
|
|
795
|
+
"designer.hint.rowspanNotConsistentForMergeEntireRow"
|
|
796
|
+
)
|
|
797
|
+
);
|
|
687
798
|
return;
|
|
688
799
|
}
|
|
689
800
|
|
|
690
801
|
let widgetListCols = colArray.filter((colItem) => {
|
|
691
|
-
return
|
|
802
|
+
return (
|
|
803
|
+
!colItem.merged &&
|
|
804
|
+
!!colItem.widgetList &&
|
|
805
|
+
colItem.widgetList.length > 0
|
|
806
|
+
);
|
|
692
807
|
});
|
|
693
|
-
if (!!widgetListCols &&
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
808
|
+
if (!!widgetListCols && widgetListCols.length > 0) {
|
|
809
|
+
//保留widgetList
|
|
810
|
+
if (
|
|
811
|
+
widgetListCols[0].id !== colArray[0].id &&
|
|
812
|
+
(!colArray[0].widgetList || colArray[0].widgetList.length <= 0)
|
|
813
|
+
) {
|
|
814
|
+
colArray[0].widgetList = baseRefUtil.deepClone(
|
|
815
|
+
widgetListCols[0].widgetList
|
|
816
|
+
);
|
|
697
817
|
}
|
|
698
818
|
}
|
|
699
819
|
|
|
700
|
-
this.setPropsOfMergedCols(
|
|
820
|
+
this.setPropsOfMergedCols(
|
|
821
|
+
rowArray,
|
|
822
|
+
rowIndex,
|
|
823
|
+
0,
|
|
824
|
+
colArray.length,
|
|
825
|
+
colArray[colIndex].options.rowspan
|
|
826
|
+
);
|
|
701
827
|
|
|
702
828
|
this.emitHistoryChange();
|
|
703
829
|
},
|
|
704
830
|
|
|
705
831
|
mergeTableRow(rowArray, curRow, curCol, aboveFlag, cellWidget) {
|
|
706
|
-
let mergedRowIdx = !!aboveFlag
|
|
832
|
+
let mergedRowIdx = !!aboveFlag
|
|
833
|
+
? curRow
|
|
834
|
+
: curRow + cellWidget.options.rowspan;
|
|
707
835
|
|
|
708
836
|
//let remainedRowIdx = !!aboveFlag ? curRow - cellWidget.options.rowspan : curRow
|
|
709
837
|
let remainedRowIdx = !!aboveFlag ? curRow - 1 : curRow;
|
|
710
|
-
if (!!aboveFlag) {
|
|
838
|
+
if (!!aboveFlag) {
|
|
839
|
+
//继续向上寻找同列未被合并的第一个单元格
|
|
711
840
|
let tmpRowIdx = remainedRowIdx;
|
|
712
841
|
while (tmpRowIdx >= 0) {
|
|
713
842
|
if (!rowArray[tmpRowIdx].cols[curCol].merged) {
|
|
@@ -719,23 +848,38 @@ let chartContainers = [],
|
|
|
719
848
|
}
|
|
720
849
|
}
|
|
721
850
|
|
|
722
|
-
if (
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
851
|
+
if (
|
|
852
|
+
!!rowArray[mergedRowIdx].cols[curCol].widgetList &&
|
|
853
|
+
rowArray[mergedRowIdx].cols[curCol].widgetList.length > 0
|
|
854
|
+
) {
|
|
855
|
+
//保留widgetList
|
|
856
|
+
if (
|
|
857
|
+
!rowArray[remainedRowIdx].cols[curCol].widgetList ||
|
|
858
|
+
rowArray[remainedRowIdx].cols[curCol].widgetList.length === 0
|
|
859
|
+
) {
|
|
860
|
+
rowArray[remainedRowIdx].cols[curCol].widgetList =
|
|
861
|
+
baseRefUtil.deepClone(
|
|
862
|
+
rowArray[mergedRowIdx].cols[curCol].widgetList
|
|
863
|
+
);
|
|
728
864
|
}
|
|
729
865
|
}
|
|
730
866
|
|
|
731
|
-
let newRowspan =
|
|
732
|
-
.options.rowspan * 1
|
|
733
|
-
|
|
867
|
+
let newRowspan =
|
|
868
|
+
rowArray[mergedRowIdx].cols[curCol].options.rowspan * 1 +
|
|
869
|
+
rowArray[remainedRowIdx].cols[curCol].options.rowspan * 1;
|
|
870
|
+
this.setPropsOfMergedRows(
|
|
871
|
+
rowArray,
|
|
872
|
+
remainedRowIdx,
|
|
873
|
+
curCol,
|
|
874
|
+
cellWidget.options.colspan,
|
|
875
|
+
newRowspan
|
|
876
|
+
);
|
|
734
877
|
|
|
735
878
|
this.emitHistoryChange();
|
|
736
879
|
},
|
|
737
880
|
|
|
738
|
-
mergeTableWholeCol(rowArray, colArray, rowIndex, colIndex) {
|
|
881
|
+
mergeTableWholeCol(rowArray, colArray, rowIndex, colIndex) {
|
|
882
|
+
//需要考虑操作的列存在已合并的单元格!!
|
|
739
883
|
//整列所有单元格列宽不一致不可合并!!
|
|
740
884
|
let startColspan = rowArray[0].cols[colIndex].options.colspan;
|
|
741
885
|
let unmatchedFlag = false;
|
|
@@ -746,28 +890,47 @@ let chartContainers = [],
|
|
|
746
890
|
}
|
|
747
891
|
}
|
|
748
892
|
if (unmatchedFlag) {
|
|
749
|
-
this.vueInstance.$message.info(
|
|
750
|
-
|
|
893
|
+
this.vueInstance.$message.info(
|
|
894
|
+
this.vueInstance.i18nt(
|
|
895
|
+
"designer.hint.colspanNotConsistentForMergeEntireColumn"
|
|
896
|
+
)
|
|
897
|
+
);
|
|
751
898
|
return;
|
|
752
899
|
}
|
|
753
900
|
|
|
754
901
|
let widgetListCols = [];
|
|
755
|
-
rowArray.forEach(rowItem => {
|
|
902
|
+
rowArray.forEach((rowItem) => {
|
|
756
903
|
let tempCell = rowItem.cols[colIndex];
|
|
757
|
-
if (
|
|
904
|
+
if (
|
|
905
|
+
!tempCell.merged &&
|
|
906
|
+
!!tempCell.widgetList &&
|
|
907
|
+
tempCell.widgetList.length > 0
|
|
908
|
+
) {
|
|
758
909
|
widgetListCols.push(tempCell);
|
|
759
910
|
}
|
|
760
911
|
});
|
|
761
912
|
|
|
762
913
|
let firstCellOfCol = rowArray[0].cols[colIndex];
|
|
763
|
-
if (!!widgetListCols &&
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
914
|
+
if (!!widgetListCols && widgetListCols.length > 0) {
|
|
915
|
+
//保留widgetList
|
|
916
|
+
if (
|
|
917
|
+
widgetListCols[0].id !== firstCellOfCol.id &&
|
|
918
|
+
(!firstCellOfCol.widgetList ||
|
|
919
|
+
firstCellOfCol.widgetList.length <= 0)
|
|
920
|
+
) {
|
|
921
|
+
firstCellOfCol.widgetList = baseRefUtil.deepClone(
|
|
922
|
+
widgetListCols[0].widgetList
|
|
923
|
+
);
|
|
767
924
|
}
|
|
768
925
|
}
|
|
769
926
|
|
|
770
|
-
this.setPropsOfMergedRows(
|
|
927
|
+
this.setPropsOfMergedRows(
|
|
928
|
+
rowArray,
|
|
929
|
+
0,
|
|
930
|
+
colIndex,
|
|
931
|
+
firstCellOfCol.options.colspan,
|
|
932
|
+
rowArray.length
|
|
933
|
+
);
|
|
771
934
|
|
|
772
935
|
this.emitHistoryChange();
|
|
773
936
|
},
|
|
@@ -784,16 +947,19 @@ let chartContainers = [],
|
|
|
784
947
|
this.emitHistoryChange();
|
|
785
948
|
},
|
|
786
949
|
|
|
787
|
-
deleteTableWholeCol(rowArray, colIndex) {
|
|
950
|
+
deleteTableWholeCol(rowArray, colIndex) {
|
|
951
|
+
//需考虑删除的是合并列!!
|
|
788
952
|
let onlyOneColFlag = true;
|
|
789
|
-
rowArray.forEach(ri => {
|
|
953
|
+
rowArray.forEach((ri) => {
|
|
790
954
|
if (ri.cols[0].options.colspan !== rowArray[0].cols.length) {
|
|
791
955
|
onlyOneColFlag = false;
|
|
792
956
|
}
|
|
793
957
|
});
|
|
794
958
|
//仅剩一列则不可删除!!
|
|
795
959
|
if (onlyOneColFlag) {
|
|
796
|
-
this.vueInstance.$message.info(
|
|
960
|
+
this.vueInstance.$message.info(
|
|
961
|
+
this.vueInstance.i18nt("designer.hint.lastColCannotBeDeleted")
|
|
962
|
+
);
|
|
797
963
|
return;
|
|
798
964
|
}
|
|
799
965
|
|
|
@@ -807,8 +973,11 @@ let chartContainers = [],
|
|
|
807
973
|
}
|
|
808
974
|
}
|
|
809
975
|
if (unmatchedFlag) {
|
|
810
|
-
this.vueInstance.$message.info(
|
|
811
|
-
|
|
976
|
+
this.vueInstance.$message.info(
|
|
977
|
+
this.vueInstance.i18nt(
|
|
978
|
+
"designer.hint.colspanNotConsistentForDeleteEntireColumn"
|
|
979
|
+
)
|
|
980
|
+
);
|
|
812
981
|
return;
|
|
813
982
|
}
|
|
814
983
|
|
|
@@ -819,16 +988,19 @@ let chartContainers = [],
|
|
|
819
988
|
this.emitHistoryChange();
|
|
820
989
|
},
|
|
821
990
|
|
|
822
|
-
deleteTableWholeRow(rowArray, rowIndex) {
|
|
991
|
+
deleteTableWholeRow(rowArray, rowIndex) {
|
|
992
|
+
//需考虑删除的是合并行!!
|
|
823
993
|
let onlyOneRowFlag = true;
|
|
824
|
-
rowArray[0].cols.forEach(ci => {
|
|
994
|
+
rowArray[0].cols.forEach((ci) => {
|
|
825
995
|
if (ci.options.rowspan !== rowArray.length) {
|
|
826
996
|
onlyOneRowFlag = false;
|
|
827
997
|
}
|
|
828
998
|
});
|
|
829
999
|
//仅剩一行则不可删除!!
|
|
830
1000
|
if (onlyOneRowFlag) {
|
|
831
|
-
this.vueInstance.$message.info(
|
|
1001
|
+
this.vueInstance.$message.info(
|
|
1002
|
+
this.vueInstance.i18nt("designer.hint.lastRowCannotBeDeleted")
|
|
1003
|
+
);
|
|
832
1004
|
return;
|
|
833
1005
|
}
|
|
834
1006
|
|
|
@@ -842,8 +1014,11 @@ let chartContainers = [],
|
|
|
842
1014
|
}
|
|
843
1015
|
}
|
|
844
1016
|
if (unmatchedFlag) {
|
|
845
|
-
this.vueInstance.$message.info(
|
|
846
|
-
|
|
1017
|
+
this.vueInstance.$message.info(
|
|
1018
|
+
this.vueInstance.i18nt(
|
|
1019
|
+
"designer.hint.rowspanNotConsistentForDeleteEntireRow"
|
|
1020
|
+
)
|
|
1021
|
+
);
|
|
847
1022
|
return;
|
|
848
1023
|
}
|
|
849
1024
|
|
|
@@ -853,10 +1028,16 @@ let chartContainers = [],
|
|
|
853
1028
|
},
|
|
854
1029
|
|
|
855
1030
|
getContainerByType(typeName) {
|
|
856
|
-
let allWidgets = [
|
|
1031
|
+
let allWidgets = [
|
|
1032
|
+
...baseRefUtil.containers,
|
|
1033
|
+
...baseRefUtil.basicFields,
|
|
1034
|
+
...baseRefUtil.advancedFields,
|
|
1035
|
+
...baseRefUtil.customFields,
|
|
1036
|
+
...businessFields,
|
|
1037
|
+
];
|
|
857
1038
|
let foundCon = null;
|
|
858
|
-
allWidgets.forEach(con => {
|
|
859
|
-
if (!!con.category && !!con.type &&
|
|
1039
|
+
allWidgets.forEach((con) => {
|
|
1040
|
+
if (!!con.category && !!con.type && con.type === typeName) {
|
|
860
1041
|
foundCon = con;
|
|
861
1042
|
}
|
|
862
1043
|
});
|
|
@@ -865,12 +1046,18 @@ let chartContainers = [],
|
|
|
865
1046
|
},
|
|
866
1047
|
|
|
867
1048
|
getFieldWidgetByType(typeName) {
|
|
868
|
-
let allWidgets = [
|
|
1049
|
+
let allWidgets = [
|
|
1050
|
+
...baseRefUtil.containers,
|
|
1051
|
+
...baseRefUtil.basicFields,
|
|
1052
|
+
...baseRefUtil.advancedFields,
|
|
1053
|
+
...baseRefUtil.customFields,
|
|
869
1054
|
...chartContainers,
|
|
870
|
-
...chartWidgets,
|
|
1055
|
+
...chartWidgets,
|
|
1056
|
+
...businessFields,
|
|
1057
|
+
];
|
|
871
1058
|
let foundWidget = null;
|
|
872
|
-
allWidgets.forEach(widget => {
|
|
873
|
-
if (!!!widget.category && !!widget.type &&
|
|
1059
|
+
allWidgets.forEach((widget) => {
|
|
1060
|
+
if (!!!widget.category && !!widget.type && widget.type === typeName) {
|
|
874
1061
|
foundWidget = widget;
|
|
875
1062
|
}
|
|
876
1063
|
});
|
|
@@ -922,7 +1109,7 @@ let chartContainers = [],
|
|
|
922
1109
|
return;
|
|
923
1110
|
}
|
|
924
1111
|
|
|
925
|
-
Object.keys(newWidget.options).forEach(ck => {
|
|
1112
|
+
Object.keys(newWidget.options).forEach((ck) => {
|
|
926
1113
|
if (!oldWidget.options.hasOwnProperty(ck)) {
|
|
927
1114
|
let value = newWidget.options[ck];
|
|
928
1115
|
let nullValue = Array.isArray(value) ? [] : null;
|
|
@@ -932,7 +1119,7 @@ let chartContainers = [],
|
|
|
932
1119
|
},
|
|
933
1120
|
|
|
934
1121
|
upgradeFormConfig(oldFormConfig) {
|
|
935
|
-
Object.keys(this.formConfig).forEach(fc => {
|
|
1122
|
+
Object.keys(this.formConfig).forEach((fc) => {
|
|
936
1123
|
if (!oldFormConfig.hasOwnProperty(fc)) {
|
|
937
1124
|
let value = this.formConfig[fc];
|
|
938
1125
|
let nullValue = Array.isArray(value) ? [] : null;
|
|
@@ -942,39 +1129,45 @@ let chartContainers = [],
|
|
|
942
1129
|
},
|
|
943
1130
|
|
|
944
1131
|
cloneGridCol(widget, parentWidget) {
|
|
945
|
-
let newGridCol = baseRefUtil.deepClone(
|
|
1132
|
+
let newGridCol = baseRefUtil.deepClone(
|
|
1133
|
+
this.getContainerByType("grid-col")
|
|
1134
|
+
);
|
|
946
1135
|
newGridCol.options.span = widget.options.span;
|
|
947
1136
|
let tmpId = baseRefUtil.generateId();
|
|
948
|
-
newGridCol.id =
|
|
949
|
-
newGridCol.options.name =
|
|
1137
|
+
newGridCol.id = "grid-col-" + tmpId;
|
|
1138
|
+
newGridCol.options.name = "gridCol" + tmpId;
|
|
950
1139
|
|
|
951
1140
|
parentWidget.cols.push(newGridCol);
|
|
952
1141
|
},
|
|
953
1142
|
|
|
954
1143
|
cloneContainer(containWidget) {
|
|
955
|
-
if (containWidget.type ===
|
|
956
|
-
let newGrid = baseRefUtil.deepClone(this.getContainerByType(
|
|
1144
|
+
if (containWidget.type === "grid") {
|
|
1145
|
+
let newGrid = baseRefUtil.deepClone(this.getContainerByType("grid"));
|
|
957
1146
|
newGrid.id = newGrid.type + baseRefUtil.generateId();
|
|
958
1147
|
newGrid.options.name = newGrid.id;
|
|
959
|
-
containWidget.cols.forEach(gridCol => {
|
|
960
|
-
let newGridCol = baseRefUtil.deepClone(
|
|
1148
|
+
containWidget.cols.forEach((gridCol) => {
|
|
1149
|
+
let newGridCol = baseRefUtil.deepClone(
|
|
1150
|
+
this.getContainerByType("grid-col")
|
|
1151
|
+
);
|
|
961
1152
|
let tmpId = baseRefUtil.generateId();
|
|
962
|
-
newGridCol.id =
|
|
963
|
-
newGridCol.options.name =
|
|
1153
|
+
newGridCol.id = "grid-col-" + tmpId;
|
|
1154
|
+
newGridCol.options.name = "gridCol" + tmpId;
|
|
964
1155
|
newGridCol.options.span = gridCol.options.span;
|
|
965
1156
|
newGrid.cols.push(newGridCol);
|
|
966
1157
|
});
|
|
967
1158
|
|
|
968
1159
|
return newGrid;
|
|
969
|
-
} else if (containWidget.type ===
|
|
970
|
-
let newTable = baseRefUtil.deepClone(
|
|
1160
|
+
} else if (containWidget.type === "table") {
|
|
1161
|
+
let newTable = baseRefUtil.deepClone(
|
|
1162
|
+
this.getContainerByType("table")
|
|
1163
|
+
);
|
|
971
1164
|
newTable.id = newTable.type + baseRefUtil.generateId();
|
|
972
1165
|
newTable.options.name = newTable.id;
|
|
973
|
-
containWidget.rows.forEach(tRow => {
|
|
1166
|
+
containWidget.rows.forEach((tRow) => {
|
|
974
1167
|
let newRow = baseRefUtil.deepClone(tRow);
|
|
975
|
-
newRow.id =
|
|
976
|
-
newRow.cols.forEach(col => {
|
|
977
|
-
col.id =
|
|
1168
|
+
newRow.id = "table-row-" + baseRefUtil.generateId();
|
|
1169
|
+
newRow.cols.forEach((col) => {
|
|
1170
|
+
col.id = "table-cell-" + baseRefUtil.generateId();
|
|
978
1171
|
col.options.name = col.id;
|
|
979
1172
|
col.widgetList = []; //清空组件列表
|
|
980
1173
|
});
|
|
@@ -982,15 +1175,17 @@ let chartContainers = [],
|
|
|
982
1175
|
});
|
|
983
1176
|
|
|
984
1177
|
return newTable;
|
|
985
|
-
} else if (containWidget.type ===
|
|
986
|
-
let newTable = baseRefUtil.deepClone(
|
|
1178
|
+
} else if (containWidget.type === "h5-table") {
|
|
1179
|
+
let newTable = baseRefUtil.deepClone(
|
|
1180
|
+
this.getContainerByType("h5-table")
|
|
1181
|
+
);
|
|
987
1182
|
newTable.id = newTable.type + baseRefUtil.generateId();
|
|
988
1183
|
newTable.options.name = newTable.id;
|
|
989
|
-
containWidget.rows.forEach(tRow => {
|
|
1184
|
+
containWidget.rows.forEach((tRow) => {
|
|
990
1185
|
let newRow = baseRefUtil.deepClone(tRow);
|
|
991
|
-
newRow.id =
|
|
992
|
-
newRow.cols.forEach(col => {
|
|
993
|
-
col.id =
|
|
1186
|
+
newRow.id = "table-row-" + baseRefUtil.generateId();
|
|
1187
|
+
newRow.cols.forEach((col) => {
|
|
1188
|
+
col.id = "table-cell-" + baseRefUtil.generateId();
|
|
994
1189
|
col.options.name = col.id;
|
|
995
1190
|
col.widgetList = []; //清空组件列表
|
|
996
1191
|
});
|
|
@@ -998,7 +1193,8 @@ let chartContainers = [],
|
|
|
998
1193
|
});
|
|
999
1194
|
|
|
1000
1195
|
return newTable;
|
|
1001
|
-
} else {
|
|
1196
|
+
} else {
|
|
1197
|
+
//其他容器组件不支持clone操作
|
|
1002
1198
|
return null;
|
|
1003
1199
|
}
|
|
1004
1200
|
},
|
|
@@ -1006,7 +1202,9 @@ let chartContainers = [],
|
|
|
1006
1202
|
moveUpWidget(parentList, indexOfParentList) {
|
|
1007
1203
|
if (!!parentList) {
|
|
1008
1204
|
if (indexOfParentList === 0) {
|
|
1009
|
-
this.vueInstance.$message(
|
|
1205
|
+
this.vueInstance.$message(
|
|
1206
|
+
this.vueInstance.i18nt("designer.hint.moveUpFirstChildHint")
|
|
1207
|
+
);
|
|
1010
1208
|
return;
|
|
1011
1209
|
}
|
|
1012
1210
|
|
|
@@ -1019,7 +1217,9 @@ let chartContainers = [],
|
|
|
1019
1217
|
moveDownWidget(parentList, indexOfParentList) {
|
|
1020
1218
|
if (!!parentList) {
|
|
1021
1219
|
if (indexOfParentList === parentList.length - 1) {
|
|
1022
|
-
this.vueInstance.$message(
|
|
1220
|
+
this.vueInstance.$message(
|
|
1221
|
+
this.vueInstance.i18nt("designer.hint.moveDownLastChildHint")
|
|
1222
|
+
);
|
|
1023
1223
|
return;
|
|
1024
1224
|
}
|
|
1025
1225
|
|
|
@@ -1031,12 +1231,12 @@ let chartContainers = [],
|
|
|
1031
1231
|
copyNewFieldWidget(origin) {
|
|
1032
1232
|
let newWidget = baseRefUtil.deepClone(origin);
|
|
1033
1233
|
let sourceType = newWidget.type;
|
|
1034
|
-
newWidget.type =
|
|
1234
|
+
newWidget.type = newWidget.targetType || newWidget.type;
|
|
1035
1235
|
newWidget.sourceType = sourceType;
|
|
1036
1236
|
let tempId = baseRefUtil.generateId();
|
|
1037
|
-
newWidget.id = newWidget.type.replace(/-/g,
|
|
1237
|
+
newWidget.id = newWidget.type.replace(/-/g, "") + tempId;
|
|
1038
1238
|
if (newWidget.hasOwnProperty("tableField")) {
|
|
1039
|
-
newWidget.tableField = newWidget.id
|
|
1239
|
+
newWidget.tableField = newWidget.id; //表字段
|
|
1040
1240
|
}
|
|
1041
1241
|
|
|
1042
1242
|
// newWidget.options.name = newWidget.id;
|
|
@@ -1044,23 +1244,43 @@ let chartContainers = [],
|
|
|
1044
1244
|
|
|
1045
1245
|
newWidget.nameReadonly
|
|
1046
1246
|
? newWidget.options.label &&
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1247
|
+
newWidget.options.label.indexOf(".") > -1 &&
|
|
1248
|
+
(newWidget.options.label = newWidget.options.label.substring(
|
|
1249
|
+
newWidget.options.label.indexOf(".") + 1
|
|
1250
|
+
))
|
|
1051
1251
|
: ((newWidget.options.name = newWidget.id),
|
|
1052
|
-
(newWidget.options.label =
|
|
1252
|
+
(newWidget.options.label =
|
|
1253
|
+
newWidget.options.label || newWidget.type.toLowerCase()));
|
|
1053
1254
|
delete newWidget.displayName;
|
|
1054
1255
|
if (!newWidget.nameReadonly) {
|
|
1055
1256
|
newWidget.options.keyNameEnabled = true;
|
|
1056
|
-
if(!newWidget.options.keyName)
|
|
1057
|
-
|
|
1058
|
-
|
|
1257
|
+
if (!newWidget.options.keyName)
|
|
1258
|
+
newWidget.options.keyName = newWidget.id;
|
|
1259
|
+
if (
|
|
1260
|
+
newWidget.type === "vabUpload" ||
|
|
1261
|
+
newWidget.type === "baseAttachment"
|
|
1262
|
+
) {
|
|
1263
|
+
let keyNameSuffix = this.createKeyNameSuffix(newWidget.type);
|
|
1059
1264
|
// this.createKeyNameSuffix()
|
|
1060
|
-
newWidget.options.keyName = this.createKeyName(
|
|
1265
|
+
newWidget.options.keyName = this.createKeyName(
|
|
1266
|
+
newWidget.type,
|
|
1267
|
+
keyNameSuffix
|
|
1268
|
+
);
|
|
1061
1269
|
newWidget.options.keyNameSuffix = keyNameSuffix;
|
|
1062
1270
|
}
|
|
1063
1271
|
}
|
|
1272
|
+
if (newWidget.type === "dropdown") {
|
|
1273
|
+
let dropdownItem1 = this.copyNewFieldWidget(
|
|
1274
|
+
this.getFieldWidgetByType("dropdown-item")
|
|
1275
|
+
);
|
|
1276
|
+
dropdownItem1.options.label = "下拉按钮1";
|
|
1277
|
+
let dropdownItem2 = this.copyNewFieldWidget(
|
|
1278
|
+
this.getFieldWidgetByType("dropdown-item")
|
|
1279
|
+
);
|
|
1280
|
+
dropdownItem2.options.label = "下拉按钮2";
|
|
1281
|
+
newWidget.widgetList.push(dropdownItem1);
|
|
1282
|
+
newWidget.widgetList.push(dropdownItem2);
|
|
1283
|
+
}
|
|
1064
1284
|
this.emitEvent("canvas-add-field", newWidget.options.name);
|
|
1065
1285
|
return newWidget;
|
|
1066
1286
|
},
|
|
@@ -1077,7 +1297,7 @@ let chartContainers = [],
|
|
|
1077
1297
|
},
|
|
1078
1298
|
createKeyNameSuffix(type) {
|
|
1079
1299
|
let suffix = createUUID();
|
|
1080
|
-
/*if (type
|
|
1300
|
+
/*if (type === "vabUpload" || type === "baseAttachment") {
|
|
1081
1301
|
let formCode = vueInstance.reportTemplate.formCode;
|
|
1082
1302
|
suffix = formCode + "_" + suffix;
|
|
1083
1303
|
}*/
|
|
@@ -1088,7 +1308,8 @@ let chartContainers = [],
|
|
|
1088
1308
|
},
|
|
1089
1309
|
getFormCodePrefix(type) {
|
|
1090
1310
|
let prefix = this.getKeyNamePrefix(type) || "";
|
|
1091
|
-
let attachmentPrefix =
|
|
1311
|
+
let attachmentPrefix =
|
|
1312
|
+
prefix + vueInstance.reportTemplate.formCode + "_";
|
|
1092
1313
|
return attachmentPrefix;
|
|
1093
1314
|
},
|
|
1094
1315
|
createAttachmentSuffix() {
|
|
@@ -1112,37 +1333,41 @@ let chartContainers = [],
|
|
|
1112
1333
|
copyNewContainerWidget(origin) {
|
|
1113
1334
|
let newCon = baseRefUtil.deepClone(origin);
|
|
1114
1335
|
let sourceType = newCon.type;
|
|
1115
|
-
newCon.type =
|
|
1336
|
+
newCon.type = newCon.targetType || newCon.type;
|
|
1116
1337
|
newCon.sourceType = sourceType;
|
|
1117
|
-
newCon.id = newCon.type.replace(/-/g,
|
|
1338
|
+
newCon.id = newCon.type.replace(/-/g, "") + baseRefUtil.generateId();
|
|
1118
1339
|
newCon.options.name = newCon.id;
|
|
1119
|
-
if (newCon.options.keyNameEnabled = true) {
|
|
1340
|
+
if ((newCon.options.keyNameEnabled = true)) {
|
|
1120
1341
|
newCon.options.keyName = newCon.id;
|
|
1121
1342
|
}
|
|
1122
1343
|
if (newCon.hasOwnProperty("tableField")) {
|
|
1123
|
-
newCon.tableField = newCon.id
|
|
1344
|
+
newCon.tableField = newCon.id; //表字段
|
|
1124
1345
|
}
|
|
1125
|
-
if (newCon.type ===
|
|
1126
|
-
let newCol = baseRefUtil.deepClone(
|
|
1346
|
+
if (newCon.type === "grid") {
|
|
1347
|
+
let newCol = baseRefUtil.deepClone(
|
|
1348
|
+
this.getContainerByType("grid-col")
|
|
1349
|
+
);
|
|
1127
1350
|
let tmpId = baseRefUtil.generateId();
|
|
1128
|
-
newCol.id =
|
|
1129
|
-
newCol.options.name =
|
|
1351
|
+
newCol.id = "grid-col-" + tmpId;
|
|
1352
|
+
newCol.options.name = "gridCol" + tmpId;
|
|
1130
1353
|
newCon.cols.push(newCol);
|
|
1131
1354
|
//
|
|
1132
1355
|
newCol = baseRefUtil.deepClone(newCol);
|
|
1133
1356
|
tmpId = baseRefUtil.generateId();
|
|
1134
|
-
newCol.id =
|
|
1135
|
-
newCol.options.name =
|
|
1357
|
+
newCol.id = "grid-col-" + tmpId;
|
|
1358
|
+
newCol.options.name = "gridCol" + tmpId;
|
|
1136
1359
|
newCon.cols.push(newCol);
|
|
1137
|
-
} else if (newCon.type ===
|
|
1360
|
+
} else if (newCon.type === "table") {
|
|
1138
1361
|
let newRow = {
|
|
1139
|
-
cols: []
|
|
1362
|
+
cols: [],
|
|
1140
1363
|
};
|
|
1141
|
-
newRow.id =
|
|
1364
|
+
newRow.id = "table-row-" + baseRefUtil.generateId();
|
|
1142
1365
|
newRow.merged = false;
|
|
1143
1366
|
for (let i = 0; i < 4; i++) {
|
|
1144
|
-
let newCell = baseRefUtil.deepClone(
|
|
1145
|
-
|
|
1367
|
+
let newCell = baseRefUtil.deepClone(
|
|
1368
|
+
this.getContainerByType("table-cell")
|
|
1369
|
+
);
|
|
1370
|
+
newCell.id = "table-cell-" + baseRefUtil.generateId();
|
|
1146
1371
|
newCell.options.name = newCell.id;
|
|
1147
1372
|
newCell.merged = false;
|
|
1148
1373
|
newCell.options.colspan = 1;
|
|
@@ -1150,87 +1375,118 @@ let chartContainers = [],
|
|
|
1150
1375
|
newRow.cols.push(newCell);
|
|
1151
1376
|
}
|
|
1152
1377
|
newCon.rows.push(newRow);
|
|
1153
|
-
} else if (newCon.type ===
|
|
1154
|
-
let newTabPane = baseRefUtil.deepClone(
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
newTabPane.
|
|
1378
|
+
} else if (newCon.type === "tab") {
|
|
1379
|
+
let newTabPane = baseRefUtil.deepClone(
|
|
1380
|
+
this.getContainerByType("tab-pane")
|
|
1381
|
+
);
|
|
1382
|
+
newTabPane.id = "tab-pane-" + baseRefUtil.generateId();
|
|
1383
|
+
newTabPane.options.name = "tab1";
|
|
1384
|
+
newTabPane.options.label = "tab 1";
|
|
1158
1385
|
newCon.tabs.push(newTabPane);
|
|
1159
|
-
} else if (newCon.type ===
|
|
1160
|
-
let add_button = this.copyNewFieldWidget(
|
|
1161
|
-
|
|
1386
|
+
} else if (newCon.type === "data-table") {
|
|
1387
|
+
let add_button = this.copyNewFieldWidget(
|
|
1388
|
+
this.getFieldWidgetByType("add_button")
|
|
1389
|
+
);
|
|
1390
|
+
add_button.options.onClick =
|
|
1391
|
+
"this.getWidgetRef('" +
|
|
1392
|
+
newCon.options.name +
|
|
1393
|
+
"').openEditDialog();";
|
|
1162
1394
|
newCon.buttons.push(add_button);
|
|
1163
|
-
} else if (newCon.type ===
|
|
1164
|
-
let buttonCon1 = this.copyNewFieldWidget(
|
|
1165
|
-
|
|
1395
|
+
} else if (newCon.type === "detail") {
|
|
1396
|
+
let buttonCon1 = this.copyNewFieldWidget(
|
|
1397
|
+
this.getFieldWidgetByType("reset_button")
|
|
1398
|
+
);
|
|
1399
|
+
buttonCon1.options.label = "重置";
|
|
1166
1400
|
|
|
1167
|
-
let buttonCon2 = this.copyNewFieldWidget(
|
|
1168
|
-
|
|
1401
|
+
let buttonCon2 = this.copyNewFieldWidget(
|
|
1402
|
+
this.getFieldWidgetByType("save_button")
|
|
1403
|
+
);
|
|
1404
|
+
buttonCon2.options.label = "保存";
|
|
1169
1405
|
|
|
1170
1406
|
newCon.widgetList.push(buttonCon1);
|
|
1171
1407
|
newCon.widgetList.push(buttonCon2);
|
|
1172
1408
|
|
|
1173
|
-
let newCol = baseRefUtil.deepClone(
|
|
1409
|
+
let newCol = baseRefUtil.deepClone(
|
|
1410
|
+
this.getContainerByType("detail-pane")
|
|
1411
|
+
);
|
|
1174
1412
|
let tmpId = baseRefUtil.generateId();
|
|
1175
|
-
newCol.id =
|
|
1176
|
-
newCol.options.name =
|
|
1177
|
-
newCol.options.label =
|
|
1413
|
+
newCol.id = "detail-pane-" + tmpId;
|
|
1414
|
+
newCol.options.name = "detailPane" + tmpId;
|
|
1415
|
+
newCol.options.label = "隐藏信息";
|
|
1178
1416
|
newCol.options.hidden = true;
|
|
1179
1417
|
|
|
1180
|
-
let tableCon = this.copyNewContainerWidget(
|
|
1418
|
+
let tableCon = this.copyNewContainerWidget(
|
|
1419
|
+
this.getContainerByType("table")
|
|
1420
|
+
);
|
|
1181
1421
|
newCol.widgetList.push(tableCon);
|
|
1182
1422
|
newCon.panes.push(newCol);
|
|
1183
1423
|
|
|
1184
|
-
newCol = baseRefUtil.deepClone(
|
|
1424
|
+
newCol = baseRefUtil.deepClone(
|
|
1425
|
+
this.getContainerByType("detail-pane")
|
|
1426
|
+
);
|
|
1185
1427
|
tmpId = baseRefUtil.generateId();
|
|
1186
|
-
newCol.id =
|
|
1187
|
-
newCol.options.name =
|
|
1188
|
-
newCol.options.label =
|
|
1428
|
+
newCol.id = "detail-pane-" + tmpId;
|
|
1429
|
+
newCol.options.name = "detailPane" + tmpId;
|
|
1430
|
+
newCol.options.label = "基础信息";
|
|
1189
1431
|
|
|
1190
|
-
tableCon = this.copyNewContainerWidget(
|
|
1432
|
+
tableCon = this.copyNewContainerWidget(
|
|
1433
|
+
this.getContainerByType("table")
|
|
1434
|
+
);
|
|
1191
1435
|
newCol.widgetList.push(tableCon);
|
|
1192
1436
|
newCon.panes.push(newCol);
|
|
1193
1437
|
//
|
|
1194
|
-
newCol = baseRefUtil.deepClone(
|
|
1438
|
+
newCol = baseRefUtil.deepClone(
|
|
1439
|
+
this.getContainerByType("detail-pane")
|
|
1440
|
+
);
|
|
1195
1441
|
tmpId = baseRefUtil.generateId();
|
|
1196
|
-
newCol.id =
|
|
1197
|
-
newCol.options.name =
|
|
1198
|
-
newCol.options.label =
|
|
1442
|
+
newCol.id = "detail-pane-" + tmpId;
|
|
1443
|
+
newCol.options.name = "detailPane" + tmpId;
|
|
1444
|
+
newCol.options.label = "明细信息";
|
|
1199
1445
|
newCol.options.tableRef = tableCon.id;
|
|
1200
|
-
let dataTableCon = this.copyNewContainerWidget(
|
|
1446
|
+
let dataTableCon = this.copyNewContainerWidget(
|
|
1447
|
+
this.getContainerByType("data-table")
|
|
1448
|
+
);
|
|
1201
1449
|
newCol.widgetList.push(dataTableCon);
|
|
1202
1450
|
newCol.options.tableRef = dataTableCon.id;
|
|
1203
1451
|
|
|
1204
|
-
let buttonCon3 = this.copyNewFieldWidget(
|
|
1205
|
-
|
|
1452
|
+
let buttonCon3 = this.copyNewFieldWidget(
|
|
1453
|
+
this.getFieldWidgetByType("button")
|
|
1454
|
+
);
|
|
1455
|
+
buttonCon3.options.label = "新增";
|
|
1206
1456
|
buttonCon3.options.icon = "el-icon-search";
|
|
1207
1457
|
// buttonCon3.options.onClick = "this.getWidgetRef('" + dataTableCon.options.name + "').addTableData();"
|
|
1208
1458
|
buttonCon3.options.clickBindEvent = "2";
|
|
1209
1459
|
Object.assign(buttonCon3.options.addTableDataConfig, {
|
|
1210
|
-
tableRef: dataTableCon.options.name
|
|
1460
|
+
tableRef: dataTableCon.options.name,
|
|
1211
1461
|
});
|
|
1212
1462
|
|
|
1213
|
-
newCol.buttonWidgetList.push(buttonCon3)
|
|
1463
|
+
newCol.buttonWidgetList.push(buttonCon3);
|
|
1214
1464
|
newCon.panes.push(newCol);
|
|
1215
1465
|
|
|
1216
|
-
newCol = baseRefUtil.deepClone(
|
|
1466
|
+
newCol = baseRefUtil.deepClone(
|
|
1467
|
+
this.getContainerByType("detail-pane")
|
|
1468
|
+
);
|
|
1217
1469
|
tmpId = baseRefUtil.generateId();
|
|
1218
|
-
newCol.id =
|
|
1219
|
-
newCol.options.name =
|
|
1220
|
-
newCol.options.label =
|
|
1221
|
-
let vabUploadCon = this.copyNewFieldWidget(
|
|
1470
|
+
newCol.id = "detail-pane-" + tmpId;
|
|
1471
|
+
newCol.options.name = "detailPane" + tmpId;
|
|
1472
|
+
newCol.options.label = "附件信息";
|
|
1473
|
+
let vabUploadCon = this.copyNewFieldWidget(
|
|
1474
|
+
this.getFieldWidgetByType("vabUpload")
|
|
1475
|
+
); //vabUpload
|
|
1222
1476
|
newCol.widgetList.push(vabUploadCon);
|
|
1223
1477
|
newCon.panes.push(newCol);
|
|
1224
|
-
} else if (newCon.type ===
|
|
1225
|
-
newCon.options.label = "tableColumn"
|
|
1226
|
-
} else if (newCon.type ===
|
|
1227
|
-
let newCol = baseRefUtil.deepClone(
|
|
1478
|
+
} else if (newCon.type === "table-column") {
|
|
1479
|
+
newCon.options.label = "tableColumn";
|
|
1480
|
+
} else if (newCon.type === "h5-card") {
|
|
1481
|
+
let newCol = baseRefUtil.deepClone(
|
|
1482
|
+
this.getContainerByType("h5-card-pane")
|
|
1483
|
+
);
|
|
1228
1484
|
let tmpId = baseRefUtil.generateId();
|
|
1229
|
-
newCol.id =
|
|
1230
|
-
newCol.options.name =
|
|
1231
|
-
newCol.options.label =
|
|
1232
|
-
newCon.panes.push(newCol)
|
|
1233
|
-
} else if (newCon.type ===
|
|
1485
|
+
newCol.id = "h5-card-pane-" + tmpId;
|
|
1486
|
+
newCol.options.name = "h5CardPane" + tmpId;
|
|
1487
|
+
newCol.options.label = "基本信息";
|
|
1488
|
+
newCon.panes.push(newCol);
|
|
1489
|
+
} else if (newCon.type === "detail-h5") {
|
|
1234
1490
|
/*let newTab = this.copyNewContainerWidget(this.getContainerByType('tab'));
|
|
1235
1491
|
newCon.panes.push(newTab)
|
|
1236
1492
|
|
|
@@ -1239,69 +1495,89 @@ let chartContainers = [],
|
|
|
1239
1495
|
newTabPane.options.label = '基本信息';*/
|
|
1240
1496
|
|
|
1241
1497
|
//基本信息
|
|
1242
|
-
let newCard = this.copyNewContainerWidget(
|
|
1498
|
+
let newCard = this.copyNewContainerWidget(
|
|
1499
|
+
this.getContainerByType("h5-card")
|
|
1500
|
+
);
|
|
1243
1501
|
// newTabPane.widgetList.push(newCard);
|
|
1244
|
-
newCon.panes.push(newCard)
|
|
1502
|
+
newCon.panes.push(newCard);
|
|
1245
1503
|
|
|
1246
1504
|
//明细信息
|
|
1247
|
-
let newCardPane = this.copyNewContainerWidget(
|
|
1248
|
-
|
|
1505
|
+
let newCardPane = this.copyNewContainerWidget(
|
|
1506
|
+
this.getContainerByType("h5-card-pane")
|
|
1507
|
+
);
|
|
1508
|
+
newCardPane.options.label = "明细信息";
|
|
1249
1509
|
newCard.panes.push(newCardPane);
|
|
1250
1510
|
|
|
1251
1511
|
//列表
|
|
1252
|
-
let listH5 = this.copyNewContainerWidget(
|
|
1512
|
+
let listH5 = this.copyNewContainerWidget(
|
|
1513
|
+
this.getContainerByType("list-h5")
|
|
1514
|
+
); //vabUpload
|
|
1253
1515
|
newCardPane.widgetList.push(listH5);
|
|
1254
1516
|
|
|
1255
1517
|
//列表新增按钮
|
|
1256
|
-
let buttonCon = this.copyNewFieldWidget(
|
|
1257
|
-
|
|
1518
|
+
let buttonCon = this.copyNewFieldWidget(
|
|
1519
|
+
this.getFieldWidgetByType("button")
|
|
1520
|
+
);
|
|
1521
|
+
buttonCon.options.label = "新增";
|
|
1258
1522
|
buttonCon.options.icon = "el-icon-search";
|
|
1259
|
-
buttonCon.options.onClick =
|
|
1523
|
+
buttonCon.options.onClick =
|
|
1524
|
+
"this.getWidgetRef('" + listH5.options.name + "').addTableData();";
|
|
1260
1525
|
newCardPane.buttonWidgetList.push(buttonCon);
|
|
1261
1526
|
|
|
1262
1527
|
//列表行查看按钮
|
|
1263
|
-
buttonCon = this.copyNewFieldWidget(
|
|
1528
|
+
buttonCon = this.copyNewFieldWidget(
|
|
1529
|
+
this.getFieldWidgetByType("button")
|
|
1530
|
+
);
|
|
1264
1531
|
buttonCon.options.rowFlag = true;
|
|
1265
|
-
buttonCon.options.label =
|
|
1532
|
+
buttonCon.options.label = "查看";
|
|
1266
1533
|
buttonCon.options.icon = "el-icon-edit";
|
|
1267
|
-
buttonCon.options.onClick =
|
|
1534
|
+
buttonCon.options.onClick =
|
|
1535
|
+
"this.getWidgetRef('" +
|
|
1536
|
+
listH5.options.name +
|
|
1537
|
+
"').openRowDetailDialog(row);";
|
|
1268
1538
|
listH5.lineButtons.push(buttonCon);
|
|
1269
1539
|
|
|
1270
1540
|
//附件信息
|
|
1271
|
-
newCardPane = this.copyNewContainerWidget(
|
|
1272
|
-
|
|
1541
|
+
newCardPane = this.copyNewContainerWidget(
|
|
1542
|
+
this.getContainerByType("h5-card-pane")
|
|
1543
|
+
);
|
|
1544
|
+
newCardPane.options.label = "附件信息";
|
|
1273
1545
|
newCard.panes.push(newCardPane);
|
|
1274
1546
|
|
|
1275
|
-
let vabUploadCon = this.copyNewFieldWidget(
|
|
1547
|
+
let vabUploadCon = this.copyNewFieldWidget(
|
|
1548
|
+
this.getFieldWidgetByType("vabUpload")
|
|
1549
|
+
); //vabUpload
|
|
1276
1550
|
newCardPane.widgetList.push(vabUploadCon);
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
} else if (newCon.type === 'h5-table') {
|
|
1280
|
-
|
|
1551
|
+
} else if (newCon.type === "h5-table") {
|
|
1281
1552
|
for (let i = 0; i < 4; i++) {
|
|
1282
1553
|
let newRow = {
|
|
1283
|
-
cols: []
|
|
1554
|
+
cols: [],
|
|
1284
1555
|
};
|
|
1285
|
-
newRow.id =
|
|
1556
|
+
newRow.id = "table-row-" + baseRefUtil.generateId();
|
|
1286
1557
|
newRow.merged = false;
|
|
1287
1558
|
|
|
1288
|
-
let newCell = baseRefUtil.deepClone(
|
|
1289
|
-
|
|
1559
|
+
let newCell = baseRefUtil.deepClone(
|
|
1560
|
+
this.getContainerByType("h5-table-cell")
|
|
1561
|
+
);
|
|
1562
|
+
newCell.id = "table-cell-" + baseRefUtil.generateId();
|
|
1290
1563
|
newCell.options.name = newCell.id;
|
|
1291
1564
|
newCell.merged = false;
|
|
1292
1565
|
newCell.options.colspan = 1;
|
|
1293
1566
|
newCell.options.rowspan = 1;
|
|
1294
1567
|
newRow.cols.push(newCell);
|
|
1295
1568
|
|
|
1296
|
-
let newInput = this.copyNewFieldWidget(
|
|
1569
|
+
let newInput = this.copyNewFieldWidget(
|
|
1570
|
+
this.getFieldWidgetByType("input")
|
|
1571
|
+
);
|
|
1297
1572
|
newCell.widgetList.push(newInput);
|
|
1298
1573
|
|
|
1299
1574
|
newCon.rows.push(newRow);
|
|
1300
1575
|
}
|
|
1301
|
-
|
|
1302
|
-
} else if (newCon.type === 'tree-pane') {
|
|
1576
|
+
} else if (newCon.type === "tree-pane") {
|
|
1303
1577
|
//初始化列表
|
|
1304
|
-
let dataTableCon = this.copyNewContainerWidget(
|
|
1578
|
+
let dataTableCon = this.copyNewContainerWidget(
|
|
1579
|
+
this.getContainerByType("data-table")
|
|
1580
|
+
);
|
|
1305
1581
|
dataTableCon.options.showPagination = true;
|
|
1306
1582
|
dataTableCon.options.showSearchArea = true;
|
|
1307
1583
|
dataTableCon.options.isQueryTable = true;
|
|
@@ -1310,20 +1586,34 @@ let chartContainers = [],
|
|
|
1310
1586
|
|
|
1311
1587
|
newCon.widgetList.push(dataTableCon);
|
|
1312
1588
|
|
|
1313
|
-
let addButton = this.copyNewFieldWidget(
|
|
1314
|
-
|
|
1589
|
+
let addButton = this.copyNewFieldWidget(
|
|
1590
|
+
this.getFieldWidgetByType("add_button")
|
|
1591
|
+
);
|
|
1592
|
+
addButton.options.onClick =
|
|
1593
|
+
"this.getWidgetRef('" +
|
|
1594
|
+
dataTableCon.options.name +
|
|
1595
|
+
"').openEditDialog();";
|
|
1315
1596
|
dataTableCon.buttons.push(addButton);
|
|
1316
1597
|
|
|
1317
|
-
let tableExportButton = this.copyNewFieldWidget(
|
|
1318
|
-
|
|
1598
|
+
let tableExportButton = this.copyNewFieldWidget(
|
|
1599
|
+
this.getFieldWidgetByType("table-export-button")
|
|
1600
|
+
);
|
|
1601
|
+
tableExportButton.options.tableExportParam =
|
|
1602
|
+
"return { title: '导出', targetRef: '" +
|
|
1603
|
+
dataTableCon.options.name +
|
|
1604
|
+
"'}";
|
|
1319
1605
|
dataTableCon.buttons.push(tableExportButton);
|
|
1320
1606
|
|
|
1321
|
-
let searchInput = this.copyNewFieldWidget(
|
|
1607
|
+
let searchInput = this.copyNewFieldWidget(
|
|
1608
|
+
this.getFieldWidgetByType("input")
|
|
1609
|
+
);
|
|
1322
1610
|
searchInput.options.disabled = true;
|
|
1323
1611
|
searchInput.options.label = newCon.options.treeLabel;
|
|
1324
1612
|
dataTableCon.widgetList.push(searchInput);
|
|
1325
1613
|
|
|
1326
|
-
let searchIdInput = this.copyNewFieldWidget(
|
|
1614
|
+
let searchIdInput = this.copyNewFieldWidget(
|
|
1615
|
+
this.getFieldWidgetByType("input")
|
|
1616
|
+
);
|
|
1327
1617
|
searchIdInput.options.disabled = true;
|
|
1328
1618
|
searchIdInput.options.hidden = true;
|
|
1329
1619
|
searchIdInput.options.label = `隐藏${newCon.options.treeLabel}ID`;
|
|
@@ -1333,12 +1623,13 @@ let chartContainers = [],
|
|
|
1333
1623
|
dataTableCon.options.onResetTable = `this.resetEvent({\n ignoreFields:['${searchInput.options.name}', '${searchIdInput.options.name}']\n});`;
|
|
1334
1624
|
|
|
1335
1625
|
//初始化树
|
|
1336
|
-
let treeCon = this.copyNewContainerWidget(
|
|
1626
|
+
let treeCon = this.copyNewContainerWidget(
|
|
1627
|
+
this.getContainerByType("tree")
|
|
1628
|
+
);
|
|
1337
1629
|
treeCon.options.onNodeClick = `this.getWidgetRef('${searchInput.options.name}').setValue(data.label);\nthis.getWidgetRef('${searchIdInput.options.name}').setValue(data.id);\nthis.getWidgetRef('${dataTableCon.options.name}').searchEvent();`;
|
|
1338
1630
|
|
|
1339
1631
|
newCon.options.onTreeLabelClick = `this.getWidgetRef('${treeCon.options.name}').setCurrentKey();\nthis.getWidgetRef('${searchInput.options.name}').setValue(null);\nthis.getWidgetRef('${searchIdInput.options.name}').setValue(null);\nthis.getWidgetRef('${dataTableCon.options.name}').searchEvent();`;
|
|
1340
1632
|
newCon.leftWidgetList.push(treeCon);
|
|
1341
|
-
|
|
1342
1633
|
}
|
|
1343
1634
|
//newCon.options.customClass = []
|
|
1344
1635
|
|
|
@@ -1354,10 +1645,10 @@ let chartContainers = [],
|
|
|
1354
1645
|
|
|
1355
1646
|
addFieldByDbClick(widget) {
|
|
1356
1647
|
let newWidget = this.copyNewFieldWidget(widget);
|
|
1357
|
-
if (!!this.selectedWidget && this.selectedWidget.type ===
|
|
1648
|
+
if (!!this.selectedWidget && this.selectedWidget.type === "tab") {
|
|
1358
1649
|
//获取当前激活的tabPane
|
|
1359
1650
|
let activeTab = this.selectedWidget.tabs[0];
|
|
1360
|
-
this.selectedWidget.tabs.forEach(tabPane => {
|
|
1651
|
+
this.selectedWidget.tabs.forEach((tabPane) => {
|
|
1361
1652
|
if (!!tabPane.options.active) {
|
|
1362
1653
|
activeTab = tabPane;
|
|
1363
1654
|
}
|
|
@@ -1380,31 +1671,36 @@ let chartContainers = [],
|
|
|
1380
1671
|
}
|
|
1381
1672
|
},
|
|
1382
1673
|
cloneDetailPane(widget, parentWidget) {
|
|
1383
|
-
let newGridCol = baseRefUtil.deepClone(
|
|
1674
|
+
let newGridCol = baseRefUtil.deepClone(
|
|
1675
|
+
this.getContainerByType("detail-pane")
|
|
1676
|
+
);
|
|
1384
1677
|
let tmpId = baseRefUtil.generateId();
|
|
1385
|
-
newGridCol.id =
|
|
1386
|
-
newGridCol.options.name =
|
|
1387
|
-
newGridCol.options.label = widget.options.label
|
|
1678
|
+
newGridCol.id = "detail-pane-" + tmpId;
|
|
1679
|
+
newGridCol.options.name = "detailPane" + tmpId;
|
|
1680
|
+
newGridCol.options.label = widget.options.label;
|
|
1388
1681
|
parentWidget.panes.push(newGridCol);
|
|
1389
1682
|
},
|
|
1390
1683
|
cloneH5CardPanePane(widget, parentWidget) {
|
|
1391
|
-
let newGridCol = baseRefUtil.deepClone(
|
|
1684
|
+
let newGridCol = baseRefUtil.deepClone(
|
|
1685
|
+
this.getContainerByType("h5-card-pane")
|
|
1686
|
+
);
|
|
1392
1687
|
let tmpId = baseRefUtil.generateId();
|
|
1393
|
-
newGridCol.id =
|
|
1394
|
-
newGridCol.options.name =
|
|
1395
|
-
newGridCol.options.label = widget.options.label
|
|
1688
|
+
newGridCol.id = "h5-card-pane-" + tmpId;
|
|
1689
|
+
newGridCol.options.name = "h5CardPane" + tmpId;
|
|
1690
|
+
newGridCol.options.label = widget.options.label;
|
|
1396
1691
|
parentWidget.panes.push(newGridCol);
|
|
1397
1692
|
},
|
|
1398
1693
|
|
|
1399
1694
|
addNewPaneOfDetail(gridWidget) {
|
|
1400
1695
|
const cols = gridWidget.panes;
|
|
1401
|
-
let newGridCol = baseRefUtil.deepClone(
|
|
1696
|
+
let newGridCol = baseRefUtil.deepClone(
|
|
1697
|
+
this.getContainerByType("detail-pane")
|
|
1698
|
+
);
|
|
1402
1699
|
let tmpId = baseRefUtil.generateId();
|
|
1403
|
-
newGridCol.id =
|
|
1404
|
-
newGridCol.options.name =
|
|
1405
|
-
newGridCol.options.label =
|
|
1700
|
+
newGridCol.id = "detail-pane-" + tmpId;
|
|
1701
|
+
newGridCol.options.name = "detailPane" + tmpId;
|
|
1702
|
+
newGridCol.options.label = "detailPane" + tmpId;
|
|
1406
1703
|
gridWidget.panes.push(newGridCol);
|
|
1407
|
-
|
|
1408
1704
|
},
|
|
1409
1705
|
|
|
1410
1706
|
deleteColOfGrid(gridWidget, colIdx) {
|
|
@@ -1415,11 +1711,13 @@ let chartContainers = [],
|
|
|
1415
1711
|
|
|
1416
1712
|
addNewColOfGrid(gridWidget) {
|
|
1417
1713
|
const cols = gridWidget.cols;
|
|
1418
|
-
let newGridCol = baseRefUtil.deepClone(
|
|
1714
|
+
let newGridCol = baseRefUtil.deepClone(
|
|
1715
|
+
this.getContainerByType("grid-col")
|
|
1716
|
+
);
|
|
1419
1717
|
let tmpId = baseRefUtil.generateId();
|
|
1420
|
-
newGridCol.id =
|
|
1421
|
-
newGridCol.options.name =
|
|
1422
|
-
if (
|
|
1718
|
+
newGridCol.id = "grid-col-" + tmpId;
|
|
1719
|
+
newGridCol.options.name = "gridCol" + tmpId;
|
|
1720
|
+
if (!!cols && cols.length > 0) {
|
|
1423
1721
|
let spanSum = 0;
|
|
1424
1722
|
cols.forEach((col) => {
|
|
1425
1723
|
spanSum += col.options.span;
|
|
@@ -1427,10 +1725,10 @@ let chartContainers = [],
|
|
|
1427
1725
|
|
|
1428
1726
|
if (spanSum >= 24) {
|
|
1429
1727
|
//this.$message.info('列栅格之和超出24')
|
|
1430
|
-
console.log(
|
|
1728
|
+
console.log("列栅格之和超出24");
|
|
1431
1729
|
gridWidget.cols.push(newGridCol);
|
|
1432
1730
|
} else {
|
|
1433
|
-
newGridCol.options.span =
|
|
1731
|
+
newGridCol.options.span = 24 - spanSum > 12 ? 12 : 24 - spanSum;
|
|
1434
1732
|
gridWidget.cols.push(newGridCol);
|
|
1435
1733
|
}
|
|
1436
1734
|
} else {
|
|
@@ -1440,10 +1738,12 @@ let chartContainers = [],
|
|
|
1440
1738
|
|
|
1441
1739
|
addTabPaneOfTabs(tabsWidget) {
|
|
1442
1740
|
const tabPanes = tabsWidget.tabs;
|
|
1443
|
-
let newTabPane = baseRefUtil.deepClone(
|
|
1444
|
-
|
|
1741
|
+
let newTabPane = baseRefUtil.deepClone(
|
|
1742
|
+
this.getContainerByType("tab-pane")
|
|
1743
|
+
);
|
|
1744
|
+
newTabPane.id = "tab-pane-" + baseRefUtil.generateId();
|
|
1445
1745
|
newTabPane.options.name = newTabPane.id;
|
|
1446
|
-
newTabPane.options.label =
|
|
1746
|
+
newTabPane.options.label = "tab " + (tabPanes.length + 1);
|
|
1447
1747
|
tabPanes.push(newTabPane);
|
|
1448
1748
|
},
|
|
1449
1749
|
|
|
@@ -1453,10 +1753,12 @@ let chartContainers = [],
|
|
|
1453
1753
|
|
|
1454
1754
|
addDropdownItem(tabsWidget) {
|
|
1455
1755
|
const tabPanes = tabsWidget.widgetList;
|
|
1456
|
-
let newTabPane = baseRefUtil.deepClone(
|
|
1457
|
-
|
|
1756
|
+
let newTabPane = baseRefUtil.deepClone(
|
|
1757
|
+
this.getFieldWidgetByType("dropdown-item")
|
|
1758
|
+
);
|
|
1759
|
+
newTabPane.id = "dropdown-item-" + baseRefUtil.generateId();
|
|
1458
1760
|
newTabPane.options.name = newTabPane.id;
|
|
1459
|
-
newTabPane.options.label =
|
|
1761
|
+
newTabPane.options.label = "dropdown-item " + (tabPanes.length + 1);
|
|
1460
1762
|
tabPanes.push(newTabPane);
|
|
1461
1763
|
},
|
|
1462
1764
|
|
|
@@ -1464,11 +1766,13 @@ let chartContainers = [],
|
|
|
1464
1766
|
tabsWidget.widgetList.splice(tpIdx, 1);
|
|
1465
1767
|
},
|
|
1466
1768
|
|
|
1467
|
-
emitEvent(evtName, evtData) {
|
|
1769
|
+
emitEvent(evtName, evtData) {
|
|
1770
|
+
//用于兄弟组件发射事件
|
|
1468
1771
|
this.vueInstance.$emit(evtName, evtData);
|
|
1469
1772
|
},
|
|
1470
1773
|
|
|
1471
|
-
handleEvent(evtName, callback) {
|
|
1774
|
+
handleEvent(evtName, callback) {
|
|
1775
|
+
//用于兄弟组件接收事件
|
|
1472
1776
|
this.vueInstance.$on(evtName, (data) => callback(data));
|
|
1473
1777
|
},
|
|
1474
1778
|
|
|
@@ -1487,10 +1791,10 @@ let chartContainers = [],
|
|
|
1487
1791
|
initHistoryData() {
|
|
1488
1792
|
this.loadFormContentFromStorage();
|
|
1489
1793
|
this.historyData.index++;
|
|
1490
|
-
this.historyData.steps[this.historyData.index] =
|
|
1794
|
+
this.historyData.steps[this.historyData.index] = {
|
|
1491
1795
|
widgetList: baseRefUtil.deepClone(this.widgetList),
|
|
1492
|
-
formConfig: baseRefUtil.deepClone(this.formConfig)
|
|
1493
|
-
}
|
|
1796
|
+
formConfig: baseRefUtil.deepClone(this.formConfig),
|
|
1797
|
+
};
|
|
1494
1798
|
},
|
|
1495
1799
|
|
|
1496
1800
|
emitHistoryChange() {
|
|
@@ -1502,15 +1806,18 @@ let chartContainers = [],
|
|
|
1502
1806
|
this.historyData.index++;
|
|
1503
1807
|
}
|
|
1504
1808
|
|
|
1505
|
-
this.historyData.steps[this.historyData.index] =
|
|
1809
|
+
this.historyData.steps[this.historyData.index] = {
|
|
1506
1810
|
widgetList: baseRefUtil.deepClone(this.widgetList),
|
|
1507
|
-
formConfig: baseRefUtil.deepClone(this.formConfig)
|
|
1508
|
-
}
|
|
1811
|
+
formConfig: baseRefUtil.deepClone(this.formConfig),
|
|
1812
|
+
};
|
|
1509
1813
|
|
|
1510
1814
|
this.saveFormContentToStorage();
|
|
1511
1815
|
|
|
1512
1816
|
if (this.historyData.index < this.historyData.steps.length - 1) {
|
|
1513
|
-
this.historyData.steps = this.historyData.steps.slice(
|
|
1817
|
+
this.historyData.steps = this.historyData.steps.slice(
|
|
1818
|
+
0,
|
|
1819
|
+
this.historyData.index + 1
|
|
1820
|
+
);
|
|
1514
1821
|
}
|
|
1515
1822
|
|
|
1516
1823
|
//console.log('history', this.historyData.index)
|
|
@@ -1519,7 +1826,7 @@ let chartContainers = [],
|
|
|
1519
1826
|
saveCurrentHistoryStep() {
|
|
1520
1827
|
this.historyData.steps[this.historyData.index] = baseRefUtil.deepClone({
|
|
1521
1828
|
widgetList: this.widgetList,
|
|
1522
|
-
formConfig: this.formConfig
|
|
1829
|
+
formConfig: this.formConfig,
|
|
1523
1830
|
});
|
|
1524
1831
|
|
|
1525
1832
|
this.saveFormContentToStorage();
|
|
@@ -1531,52 +1838,73 @@ let chartContainers = [],
|
|
|
1531
1838
|
}
|
|
1532
1839
|
//console.log('undo', this.historyData.index)
|
|
1533
1840
|
|
|
1534
|
-
this.widgetList = baseRefUtil.deepClone(
|
|
1535
|
-
|
|
1841
|
+
this.widgetList = baseRefUtil.deepClone(
|
|
1842
|
+
this.historyData.steps[this.historyData.index].widgetList
|
|
1843
|
+
);
|
|
1844
|
+
this.formConfig = baseRefUtil.deepClone(
|
|
1845
|
+
this.historyData.steps[this.historyData.index].formConfig
|
|
1846
|
+
);
|
|
1536
1847
|
},
|
|
1537
1848
|
|
|
1538
1849
|
redoHistoryStep() {
|
|
1539
|
-
if (this.historyData.index !==
|
|
1850
|
+
if (this.historyData.index !== this.historyData.steps.length - 1) {
|
|
1540
1851
|
this.historyData.index++;
|
|
1541
1852
|
}
|
|
1542
1853
|
//console.log('redo', this.historyData.index)
|
|
1543
1854
|
|
|
1544
|
-
this.widgetList = baseRefUtil.deepClone(
|
|
1545
|
-
|
|
1855
|
+
this.widgetList = baseRefUtil.deepClone(
|
|
1856
|
+
this.historyData.steps[this.historyData.index].widgetList
|
|
1857
|
+
);
|
|
1858
|
+
this.formConfig = baseRefUtil.deepClone(
|
|
1859
|
+
this.historyData.steps[this.historyData.index].formConfig
|
|
1860
|
+
);
|
|
1546
1861
|
},
|
|
1547
1862
|
|
|
1548
1863
|
undoEnabled() {
|
|
1549
|
-
return
|
|
1864
|
+
return this.historyData.index > 0 && this.historyData.steps.length > 0;
|
|
1550
1865
|
},
|
|
1551
1866
|
|
|
1552
1867
|
redoEnabled() {
|
|
1553
|
-
return this.historyData.index <
|
|
1868
|
+
return this.historyData.index < this.historyData.steps.length - 1;
|
|
1554
1869
|
},
|
|
1555
1870
|
|
|
1556
1871
|
saveFormContentToStorage() {
|
|
1557
|
-
window.localStorage.setItem(
|
|
1558
|
-
|
|
1872
|
+
window.localStorage.setItem(
|
|
1873
|
+
"widget__list__backup",
|
|
1874
|
+
JSON.stringify(this.widgetList)
|
|
1875
|
+
);
|
|
1876
|
+
window.localStorage.setItem(
|
|
1877
|
+
"form__config__backup",
|
|
1878
|
+
JSON.stringify(this.formConfig)
|
|
1879
|
+
);
|
|
1559
1880
|
},
|
|
1560
1881
|
|
|
1561
1882
|
loadFormContentFromStorage() {
|
|
1562
|
-
let widgetListBackup = window.localStorage.getItem(
|
|
1883
|
+
let widgetListBackup = window.localStorage.getItem(
|
|
1884
|
+
"widget__list__backup"
|
|
1885
|
+
);
|
|
1563
1886
|
if (!!widgetListBackup) {
|
|
1564
1887
|
this.widgetList = JSON.parse(widgetListBackup);
|
|
1565
1888
|
}
|
|
1566
1889
|
|
|
1567
|
-
let formConfigBackup = window.localStorage.getItem(
|
|
1890
|
+
let formConfigBackup = window.localStorage.getItem(
|
|
1891
|
+
"form__config__backup"
|
|
1892
|
+
);
|
|
1568
1893
|
if (!!formConfigBackup) {
|
|
1569
1894
|
//this.formConfig = JSON.parse(formConfigBackup)
|
|
1570
|
-
baseRefUtil.overwriteObj(
|
|
1895
|
+
baseRefUtil.overwriteObj(
|
|
1896
|
+
this.formConfig,
|
|
1897
|
+
JSON.parse(formConfigBackup)
|
|
1898
|
+
); /* 用=赋值,会导致inject依赖注入的formConfig属性变成非响应式 */
|
|
1571
1899
|
}
|
|
1572
1900
|
},
|
|
1573
|
-
getColumnWidget(row, isEdit){
|
|
1901
|
+
getColumnWidget(row, isEdit) {
|
|
1574
1902
|
//获取
|
|
1575
1903
|
let formatS = isEdit ? row.editFormatS : row.formatS;
|
|
1576
1904
|
let type = columnFormatMap[formatS];
|
|
1577
|
-
if(!type)return null;
|
|
1578
|
-
if(isEdit){
|
|
1579
|
-
if(row.editWidget){
|
|
1905
|
+
if (!type) return null;
|
|
1906
|
+
if (isEdit) {
|
|
1907
|
+
if (row.editWidget) {
|
|
1580
1908
|
return row.editWidget;
|
|
1581
1909
|
}
|
|
1582
1910
|
if (row.editColumnOption) {
|
|
@@ -1584,10 +1912,10 @@ let chartContainers = [],
|
|
|
1584
1912
|
this.getFieldWidgetByType(type)
|
|
1585
1913
|
);
|
|
1586
1914
|
fieldWidget.options = row.editColumnOption;
|
|
1587
|
-
return fieldWidget
|
|
1915
|
+
return fieldWidget;
|
|
1588
1916
|
}
|
|
1589
|
-
}else{
|
|
1590
|
-
if(row.widget){
|
|
1917
|
+
} else {
|
|
1918
|
+
if (row.widget) {
|
|
1591
1919
|
return row.widget;
|
|
1592
1920
|
}
|
|
1593
1921
|
if (row.columnOption) {
|
|
@@ -1595,18 +1923,18 @@ let chartContainers = [],
|
|
|
1595
1923
|
this.getFieldWidgetByType(type)
|
|
1596
1924
|
);
|
|
1597
1925
|
fieldWidget.options = row.columnOption;
|
|
1598
|
-
return fieldWidget
|
|
1926
|
+
return fieldWidget;
|
|
1599
1927
|
}
|
|
1600
1928
|
}
|
|
1601
|
-
return this.createColumnWidget(row,isEdit)
|
|
1929
|
+
return this.createColumnWidget(row, isEdit);
|
|
1602
1930
|
},
|
|
1603
|
-
getIsFileWidget(type){
|
|
1604
|
-
return
|
|
1931
|
+
getIsFileWidget(type) {
|
|
1932
|
+
return type === "vabUpload" || type === "baseAttachment";
|
|
1605
1933
|
},
|
|
1606
|
-
createColumnWidget(row, isEdit){
|
|
1934
|
+
createColumnWidget(row, isEdit) {
|
|
1607
1935
|
let formatS = isEdit ? row.editFormatS : row.formatS;
|
|
1608
1936
|
let type = columnFormatMap[formatS];
|
|
1609
|
-
if(!type)return null;
|
|
1937
|
+
if (!type) return null;
|
|
1610
1938
|
|
|
1611
1939
|
let columnSelectedWidget = null;
|
|
1612
1940
|
if (type) {
|
|
@@ -1618,42 +1946,42 @@ let chartContainers = [],
|
|
|
1618
1946
|
columnSelectedWidget.options.required = row.required || false;
|
|
1619
1947
|
}
|
|
1620
1948
|
|
|
1621
|
-
if ("editDelete"
|
|
1949
|
+
if ("editDelete" === formatS) {
|
|
1622
1950
|
columnSelectedWidget.options.prefixIcon = "el-icon-delete";
|
|
1623
1951
|
columnSelectedWidget.options.label = "删除";
|
|
1624
1952
|
columnSelectedWidget.options.labelHidden = true;
|
|
1625
1953
|
columnSelectedWidget.options.hiddenByWf = true;
|
|
1626
1954
|
columnSelectedWidget.options.onClick =
|
|
1627
1955
|
"let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.deleteRow(tableParam.row,tableParam.rowIndex);";
|
|
1628
|
-
} else if ("editButton"
|
|
1956
|
+
} else if ("editButton" === formatS) {
|
|
1629
1957
|
columnSelectedWidget.options.prefixIcon = "el-icon-edit";
|
|
1630
1958
|
columnSelectedWidget.options.label = "查看";
|
|
1631
1959
|
columnSelectedWidget.options.labelHidden = true;
|
|
1632
1960
|
columnSelectedWidget.options.onClick =
|
|
1633
1961
|
"let tableParam = this.tableParam;\nlet tableRef = this.getWidgetRef(this.parentWidget.options.name);\ntableRef.openEditDialog(tableParam.row)";
|
|
1634
|
-
} else if ("addSiblingEditRow"
|
|
1962
|
+
} else if ("addSiblingEditRow" === formatS) {
|
|
1635
1963
|
columnSelectedWidget.options.prefixIcon = "el-icon-plus";
|
|
1636
1964
|
columnSelectedWidget.options.label = "新增兄弟节点";
|
|
1637
1965
|
columnSelectedWidget.options.labelHidden = false;
|
|
1638
1966
|
columnSelectedWidget.options.onClick =
|
|
1639
1967
|
"let tableParam = this.tableParam;\nthis.getParentTarget().addSiblingTreeRow(null,tableParam);";
|
|
1640
|
-
} else if ("addChildTreeRow"
|
|
1968
|
+
} else if ("addChildTreeRow" === formatS) {
|
|
1641
1969
|
columnSelectedWidget.options.prefixIcon = "el-icon-plus";
|
|
1642
1970
|
columnSelectedWidget.options.label = "新增子节点";
|
|
1643
1971
|
columnSelectedWidget.options.labelHidden = false;
|
|
1644
1972
|
columnSelectedWidget.options.onClick =
|
|
1645
1973
|
"let tableParam = this.tableParam;\nthis.getParentTarget().addChildTreeRow(null,tableParam);";
|
|
1646
|
-
} else if ("moveUpRow"
|
|
1974
|
+
} else if ("moveUpRow" === formatS) {
|
|
1647
1975
|
columnSelectedWidget.options.label = "↑上移";
|
|
1648
1976
|
columnSelectedWidget.options.labelHidden = false;
|
|
1649
1977
|
columnSelectedWidget.options.onClick =
|
|
1650
1978
|
"let tableParam = this.tableParam;\nthis.getParentTarget().moveUpRow(tableParam);";
|
|
1651
|
-
} else if ("moveDownRow"
|
|
1979
|
+
} else if ("moveDownRow" === formatS) {
|
|
1652
1980
|
columnSelectedWidget.options.label = "↓下移";
|
|
1653
1981
|
columnSelectedWidget.options.labelHidden = false;
|
|
1654
1982
|
columnSelectedWidget.options.onClick =
|
|
1655
1983
|
"let tableParam = this.tableParam;\nthis.getParentTarget().moveDownRow(tableParam);";
|
|
1656
|
-
} else if ("removeTreeRow"
|
|
1984
|
+
} else if ("removeTreeRow" === formatS) {
|
|
1657
1985
|
columnSelectedWidget.options.prefixIcon = "el-icon-delete";
|
|
1658
1986
|
columnSelectedWidget.options.label = "删除";
|
|
1659
1987
|
columnSelectedWidget.options.labelHidden = true;
|
|
@@ -1662,7 +1990,7 @@ let chartContainers = [],
|
|
|
1662
1990
|
}
|
|
1663
1991
|
|
|
1664
1992
|
if (columnSelectedWidget.options.hasOwnProperty("keyName")) {
|
|
1665
|
-
if(!this.getIsFileWidget(type)){
|
|
1993
|
+
if (!this.getIsFileWidget(type)) {
|
|
1666
1994
|
columnSelectedWidget.options.keyName = row.prop;
|
|
1667
1995
|
}
|
|
1668
1996
|
|
|
@@ -1671,14 +1999,16 @@ let chartContainers = [],
|
|
|
1671
1999
|
columnSelectedWidget.options.name = row.prop;
|
|
1672
2000
|
}
|
|
1673
2001
|
|
|
1674
|
-
if (type
|
|
2002
|
+
if (type === "dropdown") {
|
|
2003
|
+
columnSelectedWidget.options.dropdownType = "link";
|
|
2004
|
+
} else if (type !== "button" && type !== "a-link") {
|
|
1675
2005
|
columnSelectedWidget.options.label = row.label;
|
|
1676
2006
|
columnSelectedWidget.options.labelHidden = true;
|
|
1677
2007
|
}
|
|
1678
2008
|
}
|
|
1679
2009
|
return columnSelectedWidget;
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
2010
|
+
},
|
|
2011
|
+
};
|
|
1682
2012
|
};
|
|
1683
2013
|
})();
|
|
1684
2014
|
|