cloud-web-corejs 1.0.54-dev.757 → 1.0.54-dev.759
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/jsonImport/mixins.js +350 -350
- package/src/components/langImport/mixins.js +502 -502
- package/src/components/wf/wf.js +2221 -2221
- package/src/components/xform/form-designer/designer.js +2027 -2027
- package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +1774 -1774
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +1553 -1553
- package/src/components/xform/form-designer/setting-panel/indexMixin.js +370 -370
- package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +655 -655
- package/src/components/xform/form-render/container-item/detail-h5-item.vue +173 -173
- package/src/components/xform/form-render/container-item/detail-item.vue +287 -287
- package/src/components/xform/form-render/indexMixin.js +23 -23
- package/src/components/xform/utils/util.js +5 -5
- package/src/index.js +2 -0
- package/src/microRouter/index.js +68 -7
- package/src/store/modules/micro.js +5 -0
- package/src/store/modules/permission.js +46 -1
- package/src/views/user/home/default2.vue +1158 -1158
- package/src/views/user/login/indexMixin.js +661 -661
|
@@ -1,370 +1,370 @@
|
|
|
1
|
-
import WidgetProperties from "./propertyRegister";
|
|
2
|
-
import { addWindowResizeHandler } from "../../../../components/xform/utils/util";
|
|
3
|
-
import i18n from "../../../../components/xform/utils/i18n";
|
|
4
|
-
import { propertyRegistered } from "../../../../components/xform/form-designer/setting-panel/propertyRegister";
|
|
5
|
-
|
|
6
|
-
let modules = {};
|
|
7
|
-
const {
|
|
8
|
-
COMMON_PROPERTIES,
|
|
9
|
-
ADVANCED_PROPERTIES,
|
|
10
|
-
EVENT_PROPERTIES,
|
|
11
|
-
WF_PROPERTIES,
|
|
12
|
-
} = WidgetProperties;
|
|
13
|
-
|
|
14
|
-
const baseRefUtil = {
|
|
15
|
-
addWindowResizeHandler,
|
|
16
|
-
i18n,
|
|
17
|
-
propertyRegistered,
|
|
18
|
-
COMMON_PROPERTIES,
|
|
19
|
-
ADVANCED_PROPERTIES,
|
|
20
|
-
EVENT_PROPERTIES,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
modules = {
|
|
24
|
-
componentName: "SettingPanel",
|
|
25
|
-
mixins: [baseRefUtil.i18n],
|
|
26
|
-
props: {
|
|
27
|
-
designer: Object,
|
|
28
|
-
selectedWidget: Object,
|
|
29
|
-
formConfig: Object,
|
|
30
|
-
globalDsv: {
|
|
31
|
-
type: Object,
|
|
32
|
-
default: function () {
|
|
33
|
-
return {};
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
provide() {
|
|
38
|
-
return {
|
|
39
|
-
isSubFormChildWidget: () => this.subFormChildWidgetFlag,
|
|
40
|
-
isDataTableChildWidget: () => this.dataTableChildWidgetFlag,
|
|
41
|
-
getGlobalDsv: () => this.globalDsv,
|
|
42
|
-
showEventCollapse: this.showEventCollapse,
|
|
43
|
-
openWidgetPropertyDialog: this.openWidgetPropertyDialog,
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
inject: ["getDesignerConfig"],
|
|
47
|
-
data() {
|
|
48
|
-
return {
|
|
49
|
-
designerConfig: this.getDesignerConfig(),
|
|
50
|
-
|
|
51
|
-
scrollerHeight: 0,
|
|
52
|
-
|
|
53
|
-
activeTab: "1",
|
|
54
|
-
widgetActiveCollapseNames: ["1", "3", "4"], //['1', '2', '3'],
|
|
55
|
-
formActiveCollapseNames: ["1", "2"],
|
|
56
|
-
|
|
57
|
-
commonProps: baseRefUtil.COMMON_PROPERTIES,
|
|
58
|
-
advProps: baseRefUtil.ADVANCED_PROPERTIES,
|
|
59
|
-
eventProps: baseRefUtil.EVENT_PROPERTIES,
|
|
60
|
-
wfProps: WF_PROPERTIES,
|
|
61
|
-
|
|
62
|
-
showWidgetEventDialogFlag: false,
|
|
63
|
-
eventHandlerCode: "",
|
|
64
|
-
curEventName: "",
|
|
65
|
-
eventHeader: "",
|
|
66
|
-
eventOption: {},
|
|
67
|
-
|
|
68
|
-
subFormChildWidgetFlag: false,
|
|
69
|
-
dataTableChildWidgetFlag: false,
|
|
70
|
-
|
|
71
|
-
showDateConfigDialog: false,
|
|
72
|
-
columnOption: {},
|
|
73
|
-
columnSelectedWidget: {},
|
|
74
|
-
columnEditFields: [],
|
|
75
|
-
widgetActiveCollapseName1s: ["1", "3"], //['1', '2', '3'],
|
|
76
|
-
tableColumns: null,
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
computed: {
|
|
80
|
-
optionModel: {
|
|
81
|
-
get() {
|
|
82
|
-
return this.selectedWidget?.options || {};
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
set(newValue) {
|
|
86
|
-
if (this.selectedWidget) this.selectedWidget.options = newValue;
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
watch: {
|
|
91
|
-
"designer.selectedWidget": {
|
|
92
|
-
handler(val) {
|
|
93
|
-
if (!!val) {
|
|
94
|
-
this.activeTab = "1";
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
"selectedWidget.options": {
|
|
100
|
-
//组件属性变动后,立即保存表单JSON!!
|
|
101
|
-
deep: true,
|
|
102
|
-
handler() {
|
|
103
|
-
this.designer.saveCurrentHistoryStep();
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
formConfig: {
|
|
108
|
-
deep: true,
|
|
109
|
-
handler() {
|
|
110
|
-
this.designer.saveCurrentHistoryStep();
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
created() {
|
|
115
|
-
this.$on("editEventHandler", function (eventName, eventParams, option) {
|
|
116
|
-
this.editEventHandler(eventName, eventParams, option);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
this.designer.handleEvent("form-css-updated", (cssClassList) => {
|
|
120
|
-
this.designer.setCssClassList(cssClassList);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
//监听字段组件选中事件
|
|
124
|
-
this.designer.handleEvent("field-selected", (parentWidget) => {
|
|
125
|
-
let widgetType = parentWidget?.type;
|
|
126
|
-
this.subFormChildWidgetFlag =
|
|
127
|
-
widgetType === "sub-form" || widgetType === "data-table";
|
|
128
|
-
this.dataTableChildWidgetFlag = widgetType === "data-table";
|
|
129
|
-
//console.log('subFormChildWidgetFlag', this.subFormChildWidgetFlag)
|
|
130
|
-
});
|
|
131
|
-
},
|
|
132
|
-
mounted() {
|
|
133
|
-
if (!this.designer.selectedWidget) {
|
|
134
|
-
// this.activeTab = '2';
|
|
135
|
-
this.activeTab = "1";
|
|
136
|
-
} else {
|
|
137
|
-
this.activeTab = "1";
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
this.scrollerHeight = window.innerHeight - 125 + "px";
|
|
141
|
-
this.winResizeUnbind = baseRefUtil.addWindowResizeHandler(() => {
|
|
142
|
-
this.$nextTick(() => {
|
|
143
|
-
this.scrollerHeight = window.innerHeight - 125 + "px";
|
|
144
|
-
//console.log(this.scrollerHeight)
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
window.formSettingPanelRef = this;
|
|
148
|
-
},
|
|
149
|
-
beforeDestroy() {
|
|
150
|
-
// window 级监听/全局引用持有本实例,销毁时必须清理,否则设置面板整树泄露
|
|
151
|
-
if (this.winResizeUnbind) {
|
|
152
|
-
this.winResizeUnbind();
|
|
153
|
-
this.winResizeUnbind = null;
|
|
154
|
-
}
|
|
155
|
-
if (window.formSettingPanelRef === this) {
|
|
156
|
-
window.formSettingPanelRef = null;
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
methods: {
|
|
160
|
-
showEventCollapse() {
|
|
161
|
-
if (this.designerConfig["eventCollapse"] === undefined) {
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return !!this.designerConfig["eventCollapse"];
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
hasPropEditor(propName, editorName) {
|
|
169
|
-
if (!editorName) {
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/* alert组件注册了两个type属性编辑器,跳过第一个type属性编辑器,只显示第二个alert-type属性编辑器!! */
|
|
174
|
-
if (propName.indexOf("-") <= -1) {
|
|
175
|
-
let uniquePropName = this.selectedWidget.type + "-" + propName;
|
|
176
|
-
if (baseRefUtil.propertyRegistered(uniquePropName)) {
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
let originalPropName = propName.replace(
|
|
182
|
-
this.selectedWidget.type + "-",
|
|
183
|
-
""
|
|
184
|
-
); //去掉组件名称前缀-,如果有的话!!
|
|
185
|
-
return this.designer.hasConfig(this.selectedWidget, originalPropName);
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
getPropEditor(propName, editorName) {
|
|
189
|
-
let originalPropName = propName.replace(
|
|
190
|
-
this.selectedWidget.type + "-",
|
|
191
|
-
""
|
|
192
|
-
); //去掉组件名称前缀-,如果有的话!!
|
|
193
|
-
let ownPropEditorName = `${this.selectedWidget.type}-${originalPropName}-editor`;
|
|
194
|
-
//console.log(ownPropEditorName, this.$options.components[ownPropEditorName])
|
|
195
|
-
if (!!this.$options.components[ownPropEditorName]) {
|
|
196
|
-
//局部注册的属性编辑器组件
|
|
197
|
-
return ownPropEditorName;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return !!this.$root.$options.components[ownPropEditorName]
|
|
201
|
-
? ownPropEditorName
|
|
202
|
-
: editorName; //全局注册的属性编辑器组件
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
showCollapse(propsObj) {
|
|
206
|
-
let result = false;
|
|
207
|
-
for (let propName in propsObj) {
|
|
208
|
-
if (!propsObj.hasOwnProperty(propName)) {
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
if (this.hasPropEditor(propName, propsObj[propName])) {
|
|
213
|
-
result = true;
|
|
214
|
-
break;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return result;
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
editEventHandler(eventName, eventParams, option) {
|
|
222
|
-
this.curEventName = eventName;
|
|
223
|
-
option = option || {};
|
|
224
|
-
// if (!isFormSetiing) {
|
|
225
|
-
let selectedWidget = this.showDateConfigDialog
|
|
226
|
-
? this.columnSelectedWidget
|
|
227
|
-
: this.selectedWidget;
|
|
228
|
-
this.eventHeader = `${
|
|
229
|
-
this.optionModel.name
|
|
230
|
-
}.${eventName}(${eventParams.join(", ")}) {`;
|
|
231
|
-
if (option.customCode) {
|
|
232
|
-
this.eventHandlerCode = option.customCode() || "";
|
|
233
|
-
} else {
|
|
234
|
-
this.eventHandlerCode = selectedWidget.options[eventName] || "";
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
this.eventOption = option;
|
|
238
|
-
|
|
239
|
-
// 设置字段校验函数示例代码
|
|
240
|
-
if (eventName === "onValidate" && !this.optionModel["onValidate"]) {
|
|
241
|
-
this.eventHandlerCode =
|
|
242
|
-
" /* sample code */\n /*\n if ((value > 100) || (value < 0)) {\n callback(new Error('error message')) //fail\n } else {\n callback(); //pass\n }\n */";
|
|
243
|
-
}
|
|
244
|
-
/*} else {
|
|
245
|
-
this.eventHeader = `formSetting.${eventName}(${eventParams.join(', ')}) {`;
|
|
246
|
-
}*/
|
|
247
|
-
|
|
248
|
-
this.showWidgetEventDialogFlag = true;
|
|
249
|
-
},
|
|
250
|
-
|
|
251
|
-
saveEventHandler() {
|
|
252
|
-
const codeHints = this.$refs.ecEditor.getEditorAnnotations();
|
|
253
|
-
let syntaxErrorFlag = false;
|
|
254
|
-
if (!!codeHints && codeHints.length > 0) {
|
|
255
|
-
codeHints.forEach((chItem) => {
|
|
256
|
-
if (chItem.type === "error") {
|
|
257
|
-
syntaxErrorFlag = true;
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
if (syntaxErrorFlag) {
|
|
262
|
-
this.$message.error(
|
|
263
|
-
this.i18nt("designer.setting.syntaxCheckWarning")
|
|
264
|
-
);
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
let eventOption = this.eventOption || {};
|
|
269
|
-
if (!eventOption.callback) {
|
|
270
|
-
let selectedWidget = this.showDateConfigDialog
|
|
271
|
-
? this.columnSelectedWidget
|
|
272
|
-
: this.selectedWidget;
|
|
273
|
-
|
|
274
|
-
if (selectedWidget)
|
|
275
|
-
selectedWidget.options[this.curEventName] = this.eventHandlerCode;
|
|
276
|
-
} else {
|
|
277
|
-
eventOption.callback(this.eventHandlerCode);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
this.showWidgetEventDialogFlag = false;
|
|
281
|
-
},
|
|
282
|
-
|
|
283
|
-
showEventCollapse1() {
|
|
284
|
-
if (this.designerConfig["eventCollapse"] === undefined) {
|
|
285
|
-
return true;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
return !!this.designerConfig["eventCollapse"];
|
|
289
|
-
},
|
|
290
|
-
|
|
291
|
-
hasPropEditor1(propName, editorName) {
|
|
292
|
-
if (!editorName) {
|
|
293
|
-
return false;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
if (this.columnEditFields) {
|
|
297
|
-
if (!this.columnEditFields.includes(propName)) {
|
|
298
|
-
return false;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/* alert组件注册了两个type属性编辑器,跳过第一个type属性编辑器,只显示第二个alert-type属性编辑器!! */
|
|
303
|
-
if (propName.indexOf("-") <= -1) {
|
|
304
|
-
let uniquePropName = this.columnSelectedWidget.type + "-" + propName;
|
|
305
|
-
if (baseRefUtil.propertyRegistered(uniquePropName)) {
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
let originalPropName = propName.replace(
|
|
311
|
-
this.columnSelectedWidget.type + "-",
|
|
312
|
-
""
|
|
313
|
-
); //去掉组件名称前缀-,如果有的话!!
|
|
314
|
-
return this.designer.hasConfig(
|
|
315
|
-
this.columnSelectedWidget,
|
|
316
|
-
originalPropName
|
|
317
|
-
);
|
|
318
|
-
},
|
|
319
|
-
|
|
320
|
-
getPropEditor1(propName, editorName) {
|
|
321
|
-
let originalPropName = propName.replace(
|
|
322
|
-
this.columnSelectedWidget.type + "-",
|
|
323
|
-
""
|
|
324
|
-
); //去掉组件名称前缀-,如果有的话!!
|
|
325
|
-
let ownPropEditorName = `${this.columnSelectedWidget.type}-${originalPropName}-editor`;
|
|
326
|
-
//console.log(ownPropEditorName, this.$options.components[ownPropEditorName])
|
|
327
|
-
if (!!this.$options.components[ownPropEditorName]) {
|
|
328
|
-
//局部注册的属性编辑器组件
|
|
329
|
-
return ownPropEditorName;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
return !!this.$root.$options.components[ownPropEditorName]
|
|
333
|
-
? ownPropEditorName
|
|
334
|
-
: editorName; //全局注册的属性编辑器组件
|
|
335
|
-
},
|
|
336
|
-
|
|
337
|
-
showCollapse1(propsObj) {
|
|
338
|
-
let result = false;
|
|
339
|
-
for (let propName in propsObj) {
|
|
340
|
-
if (!propsObj.hasOwnProperty(propName)) {
|
|
341
|
-
continue;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
if (this.hasPropEditor1(propName, propsObj[propName])) {
|
|
345
|
-
result = true;
|
|
346
|
-
break;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
return result;
|
|
351
|
-
},
|
|
352
|
-
openWidgetPropertyDialog(option) {
|
|
353
|
-
this.formatConfig = option;
|
|
354
|
-
this.tableColumns = option.tableColumns;
|
|
355
|
-
this.columnSelectedWidget = option.columnSelectedWidget;
|
|
356
|
-
this.columnEditFields = option.columnEditFields;
|
|
357
|
-
this.widgetActiveCollapseName1s = ["1", "3"];
|
|
358
|
-
this.showDateConfigDialog = true;
|
|
359
|
-
},
|
|
360
|
-
confirmWidgetPropertyDialog() {
|
|
361
|
-
let columnOption = this.$baseLodash.cloneDeep(
|
|
362
|
-
this.columnSelectedWidget.options
|
|
363
|
-
);
|
|
364
|
-
this.formatConfig.callback(columnOption);
|
|
365
|
-
this.showDateConfigDialog = false;
|
|
366
|
-
},
|
|
367
|
-
},
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
export default modules;
|
|
1
|
+
import WidgetProperties from "./propertyRegister";
|
|
2
|
+
import { addWindowResizeHandler } from "../../../../components/xform/utils/util";
|
|
3
|
+
import i18n from "../../../../components/xform/utils/i18n";
|
|
4
|
+
import { propertyRegistered } from "../../../../components/xform/form-designer/setting-panel/propertyRegister";
|
|
5
|
+
|
|
6
|
+
let modules = {};
|
|
7
|
+
const {
|
|
8
|
+
COMMON_PROPERTIES,
|
|
9
|
+
ADVANCED_PROPERTIES,
|
|
10
|
+
EVENT_PROPERTIES,
|
|
11
|
+
WF_PROPERTIES,
|
|
12
|
+
} = WidgetProperties;
|
|
13
|
+
|
|
14
|
+
const baseRefUtil = {
|
|
15
|
+
addWindowResizeHandler,
|
|
16
|
+
i18n,
|
|
17
|
+
propertyRegistered,
|
|
18
|
+
COMMON_PROPERTIES,
|
|
19
|
+
ADVANCED_PROPERTIES,
|
|
20
|
+
EVENT_PROPERTIES,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
modules = {
|
|
24
|
+
componentName: "SettingPanel",
|
|
25
|
+
mixins: [baseRefUtil.i18n],
|
|
26
|
+
props: {
|
|
27
|
+
designer: Object,
|
|
28
|
+
selectedWidget: Object,
|
|
29
|
+
formConfig: Object,
|
|
30
|
+
globalDsv: {
|
|
31
|
+
type: Object,
|
|
32
|
+
default: function () {
|
|
33
|
+
return {};
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
provide() {
|
|
38
|
+
return {
|
|
39
|
+
isSubFormChildWidget: () => this.subFormChildWidgetFlag,
|
|
40
|
+
isDataTableChildWidget: () => this.dataTableChildWidgetFlag,
|
|
41
|
+
getGlobalDsv: () => this.globalDsv,
|
|
42
|
+
showEventCollapse: this.showEventCollapse,
|
|
43
|
+
openWidgetPropertyDialog: this.openWidgetPropertyDialog,
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
inject: ["getDesignerConfig"],
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
designerConfig: this.getDesignerConfig(),
|
|
50
|
+
|
|
51
|
+
scrollerHeight: 0,
|
|
52
|
+
|
|
53
|
+
activeTab: "1",
|
|
54
|
+
widgetActiveCollapseNames: ["1", "3", "4"], //['1', '2', '3'],
|
|
55
|
+
formActiveCollapseNames: ["1", "2"],
|
|
56
|
+
|
|
57
|
+
commonProps: baseRefUtil.COMMON_PROPERTIES,
|
|
58
|
+
advProps: baseRefUtil.ADVANCED_PROPERTIES,
|
|
59
|
+
eventProps: baseRefUtil.EVENT_PROPERTIES,
|
|
60
|
+
wfProps: WF_PROPERTIES,
|
|
61
|
+
|
|
62
|
+
showWidgetEventDialogFlag: false,
|
|
63
|
+
eventHandlerCode: "",
|
|
64
|
+
curEventName: "",
|
|
65
|
+
eventHeader: "",
|
|
66
|
+
eventOption: {},
|
|
67
|
+
|
|
68
|
+
subFormChildWidgetFlag: false,
|
|
69
|
+
dataTableChildWidgetFlag: false,
|
|
70
|
+
|
|
71
|
+
showDateConfigDialog: false,
|
|
72
|
+
columnOption: {},
|
|
73
|
+
columnSelectedWidget: {},
|
|
74
|
+
columnEditFields: [],
|
|
75
|
+
widgetActiveCollapseName1s: ["1", "3"], //['1', '2', '3'],
|
|
76
|
+
tableColumns: null,
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
computed: {
|
|
80
|
+
optionModel: {
|
|
81
|
+
get() {
|
|
82
|
+
return this.selectedWidget?.options || {};
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
set(newValue) {
|
|
86
|
+
if (this.selectedWidget) this.selectedWidget.options = newValue;
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
watch: {
|
|
91
|
+
"designer.selectedWidget": {
|
|
92
|
+
handler(val) {
|
|
93
|
+
if (!!val) {
|
|
94
|
+
this.activeTab = "1";
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
"selectedWidget.options": {
|
|
100
|
+
//组件属性变动后,立即保存表单JSON!!
|
|
101
|
+
deep: true,
|
|
102
|
+
handler() {
|
|
103
|
+
this.designer.saveCurrentHistoryStep();
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
formConfig: {
|
|
108
|
+
deep: true,
|
|
109
|
+
handler() {
|
|
110
|
+
this.designer.saveCurrentHistoryStep();
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
created() {
|
|
115
|
+
this.$on("editEventHandler", function (eventName, eventParams, option) {
|
|
116
|
+
this.editEventHandler(eventName, eventParams, option);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
this.designer.handleEvent("form-css-updated", (cssClassList) => {
|
|
120
|
+
this.designer.setCssClassList(cssClassList);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
//监听字段组件选中事件
|
|
124
|
+
this.designer.handleEvent("field-selected", (parentWidget) => {
|
|
125
|
+
let widgetType = parentWidget?.type;
|
|
126
|
+
this.subFormChildWidgetFlag =
|
|
127
|
+
widgetType === "sub-form" || widgetType === "data-table";
|
|
128
|
+
this.dataTableChildWidgetFlag = widgetType === "data-table";
|
|
129
|
+
//console.log('subFormChildWidgetFlag', this.subFormChildWidgetFlag)
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
mounted() {
|
|
133
|
+
if (!this.designer.selectedWidget) {
|
|
134
|
+
// this.activeTab = '2';
|
|
135
|
+
this.activeTab = "1";
|
|
136
|
+
} else {
|
|
137
|
+
this.activeTab = "1";
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
this.scrollerHeight = window.innerHeight - 125 + "px";
|
|
141
|
+
this.winResizeUnbind = baseRefUtil.addWindowResizeHandler(() => {
|
|
142
|
+
this.$nextTick(() => {
|
|
143
|
+
this.scrollerHeight = window.innerHeight - 125 + "px";
|
|
144
|
+
//console.log(this.scrollerHeight)
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
window.formSettingPanelRef = this;
|
|
148
|
+
},
|
|
149
|
+
beforeDestroy() {
|
|
150
|
+
// window 级监听/全局引用持有本实例,销毁时必须清理,否则设置面板整树泄露
|
|
151
|
+
if (this.winResizeUnbind) {
|
|
152
|
+
this.winResizeUnbind();
|
|
153
|
+
this.winResizeUnbind = null;
|
|
154
|
+
}
|
|
155
|
+
if (window.formSettingPanelRef === this) {
|
|
156
|
+
window.formSettingPanelRef = null;
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
methods: {
|
|
160
|
+
showEventCollapse() {
|
|
161
|
+
if (this.designerConfig["eventCollapse"] === undefined) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return !!this.designerConfig["eventCollapse"];
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
hasPropEditor(propName, editorName) {
|
|
169
|
+
if (!editorName) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* alert组件注册了两个type属性编辑器,跳过第一个type属性编辑器,只显示第二个alert-type属性编辑器!! */
|
|
174
|
+
if (propName.indexOf("-") <= -1) {
|
|
175
|
+
let uniquePropName = this.selectedWidget.type + "-" + propName;
|
|
176
|
+
if (baseRefUtil.propertyRegistered(uniquePropName)) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
let originalPropName = propName.replace(
|
|
182
|
+
this.selectedWidget.type + "-",
|
|
183
|
+
""
|
|
184
|
+
); //去掉组件名称前缀-,如果有的话!!
|
|
185
|
+
return this.designer.hasConfig(this.selectedWidget, originalPropName);
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
getPropEditor(propName, editorName) {
|
|
189
|
+
let originalPropName = propName.replace(
|
|
190
|
+
this.selectedWidget.type + "-",
|
|
191
|
+
""
|
|
192
|
+
); //去掉组件名称前缀-,如果有的话!!
|
|
193
|
+
let ownPropEditorName = `${this.selectedWidget.type}-${originalPropName}-editor`;
|
|
194
|
+
//console.log(ownPropEditorName, this.$options.components[ownPropEditorName])
|
|
195
|
+
if (!!this.$options.components[ownPropEditorName]) {
|
|
196
|
+
//局部注册的属性编辑器组件
|
|
197
|
+
return ownPropEditorName;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return !!this.$root.$options.components[ownPropEditorName]
|
|
201
|
+
? ownPropEditorName
|
|
202
|
+
: editorName; //全局注册的属性编辑器组件
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
showCollapse(propsObj) {
|
|
206
|
+
let result = false;
|
|
207
|
+
for (let propName in propsObj) {
|
|
208
|
+
if (!propsObj.hasOwnProperty(propName)) {
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (this.hasPropEditor(propName, propsObj[propName])) {
|
|
213
|
+
result = true;
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return result;
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
editEventHandler(eventName, eventParams, option) {
|
|
222
|
+
this.curEventName = eventName;
|
|
223
|
+
option = option || {};
|
|
224
|
+
// if (!isFormSetiing) {
|
|
225
|
+
let selectedWidget = this.showDateConfigDialog
|
|
226
|
+
? this.columnSelectedWidget
|
|
227
|
+
: this.selectedWidget;
|
|
228
|
+
this.eventHeader = `${
|
|
229
|
+
this.optionModel.name
|
|
230
|
+
}.${eventName}(${eventParams.join(", ")}) {`;
|
|
231
|
+
if (option.customCode) {
|
|
232
|
+
this.eventHandlerCode = option.customCode() || "";
|
|
233
|
+
} else {
|
|
234
|
+
this.eventHandlerCode = selectedWidget.options[eventName] || "";
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
this.eventOption = option;
|
|
238
|
+
|
|
239
|
+
// 设置字段校验函数示例代码
|
|
240
|
+
if (eventName === "onValidate" && !this.optionModel["onValidate"]) {
|
|
241
|
+
this.eventHandlerCode =
|
|
242
|
+
" /* sample code */\n /*\n if ((value > 100) || (value < 0)) {\n callback(new Error('error message')) //fail\n } else {\n callback(); //pass\n }\n */";
|
|
243
|
+
}
|
|
244
|
+
/*} else {
|
|
245
|
+
this.eventHeader = `formSetting.${eventName}(${eventParams.join(', ')}) {`;
|
|
246
|
+
}*/
|
|
247
|
+
|
|
248
|
+
this.showWidgetEventDialogFlag = true;
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
saveEventHandler() {
|
|
252
|
+
const codeHints = this.$refs.ecEditor.getEditorAnnotations();
|
|
253
|
+
let syntaxErrorFlag = false;
|
|
254
|
+
if (!!codeHints && codeHints.length > 0) {
|
|
255
|
+
codeHints.forEach((chItem) => {
|
|
256
|
+
if (chItem.type === "error") {
|
|
257
|
+
syntaxErrorFlag = true;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
if (syntaxErrorFlag) {
|
|
262
|
+
this.$message.error(
|
|
263
|
+
this.i18nt("designer.setting.syntaxCheckWarning")
|
|
264
|
+
);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
let eventOption = this.eventOption || {};
|
|
269
|
+
if (!eventOption.callback) {
|
|
270
|
+
let selectedWidget = this.showDateConfigDialog
|
|
271
|
+
? this.columnSelectedWidget
|
|
272
|
+
: this.selectedWidget;
|
|
273
|
+
|
|
274
|
+
if (selectedWidget)
|
|
275
|
+
selectedWidget.options[this.curEventName] = this.eventHandlerCode;
|
|
276
|
+
} else {
|
|
277
|
+
eventOption.callback(this.eventHandlerCode);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
this.showWidgetEventDialogFlag = false;
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
showEventCollapse1() {
|
|
284
|
+
if (this.designerConfig["eventCollapse"] === undefined) {
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return !!this.designerConfig["eventCollapse"];
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
hasPropEditor1(propName, editorName) {
|
|
292
|
+
if (!editorName) {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (this.columnEditFields) {
|
|
297
|
+
if (!this.columnEditFields.includes(propName)) {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/* alert组件注册了两个type属性编辑器,跳过第一个type属性编辑器,只显示第二个alert-type属性编辑器!! */
|
|
303
|
+
if (propName.indexOf("-") <= -1) {
|
|
304
|
+
let uniquePropName = this.columnSelectedWidget.type + "-" + propName;
|
|
305
|
+
if (baseRefUtil.propertyRegistered(uniquePropName)) {
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
let originalPropName = propName.replace(
|
|
311
|
+
this.columnSelectedWidget.type + "-",
|
|
312
|
+
""
|
|
313
|
+
); //去掉组件名称前缀-,如果有的话!!
|
|
314
|
+
return this.designer.hasConfig(
|
|
315
|
+
this.columnSelectedWidget,
|
|
316
|
+
originalPropName
|
|
317
|
+
);
|
|
318
|
+
},
|
|
319
|
+
|
|
320
|
+
getPropEditor1(propName, editorName) {
|
|
321
|
+
let originalPropName = propName.replace(
|
|
322
|
+
this.columnSelectedWidget.type + "-",
|
|
323
|
+
""
|
|
324
|
+
); //去掉组件名称前缀-,如果有的话!!
|
|
325
|
+
let ownPropEditorName = `${this.columnSelectedWidget.type}-${originalPropName}-editor`;
|
|
326
|
+
//console.log(ownPropEditorName, this.$options.components[ownPropEditorName])
|
|
327
|
+
if (!!this.$options.components[ownPropEditorName]) {
|
|
328
|
+
//局部注册的属性编辑器组件
|
|
329
|
+
return ownPropEditorName;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return !!this.$root.$options.components[ownPropEditorName]
|
|
333
|
+
? ownPropEditorName
|
|
334
|
+
: editorName; //全局注册的属性编辑器组件
|
|
335
|
+
},
|
|
336
|
+
|
|
337
|
+
showCollapse1(propsObj) {
|
|
338
|
+
let result = false;
|
|
339
|
+
for (let propName in propsObj) {
|
|
340
|
+
if (!propsObj.hasOwnProperty(propName)) {
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (this.hasPropEditor1(propName, propsObj[propName])) {
|
|
345
|
+
result = true;
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return result;
|
|
351
|
+
},
|
|
352
|
+
openWidgetPropertyDialog(option) {
|
|
353
|
+
this.formatConfig = option;
|
|
354
|
+
this.tableColumns = option.tableColumns;
|
|
355
|
+
this.columnSelectedWidget = option.columnSelectedWidget;
|
|
356
|
+
this.columnEditFields = option.columnEditFields;
|
|
357
|
+
this.widgetActiveCollapseName1s = ["1", "3"];
|
|
358
|
+
this.showDateConfigDialog = true;
|
|
359
|
+
},
|
|
360
|
+
confirmWidgetPropertyDialog() {
|
|
361
|
+
let columnOption = this.$baseLodash.cloneDeep(
|
|
362
|
+
this.columnSelectedWidget.options
|
|
363
|
+
);
|
|
364
|
+
this.formatConfig.callback(columnOption);
|
|
365
|
+
this.showDateConfigDialog = false;
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
export default modules;
|