cloud-web-corejs 1.0.54-dev.744 → 1.0.54-dev.746
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 +192 -192
- package/src/App.vue +73 -71
- package/src/components/baseArea/index.vue +1628 -1628
- package/src/components/fileLibrary/categoryMoveDialog.vue +109 -109
- package/src/components/fileLibrary/fileObjAuthDialog.vue +297 -298
- package/src/components/fileLibrary/index.vue +1109 -1110
- package/src/components/fileLibrary/propertiesDialog.vue +190 -190
- package/src/components/fileLibrary/recycleBinDialog.vue +237 -236
- package/src/components/wf/mixins/setCandidateDialog.js +217 -217
- package/src/components/wf/mixins/setCandidateDialog2.js +252 -252
- package/src/components/xform/docs//345/257/271/346/257/224/345/212/237/350/203/275/350/220/275/345/234/260/346/226/271/346/241/210.md +986 -986
- package/src/components/xform/form-designer/form-widget/dialog/baseFormulaDialog copy.vue +971 -0
- package/src/components/xform/form-designer/form-widget/dialog/vabSearchDialog.vue +408 -0
- package/src/components/xform/form-designer/form-widget/field-widget/area-select-widget.vue +272 -272
- package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue +216 -216
- package/src/components/xform/form-designer/form-widget/field-widget/form-item-wrapper.vue +928 -928
- package/src/components/xform/form-designer/index.vue +195 -195
- package/src/components/xform/form-designer/indexMixin.js +848 -848
- package/src/components/xform/form-designer/setting-panel/index.vue +313 -314
- package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/columnRenderDialog.vue +124 -124
- package/src/components/xform/form-designer/setting-panel/propertyRegister.js +369 -369
- package/src/components/xform/form-designer/widget-panel/index.vue +389 -389
- package/src/components/xform/form-designer/widget-panel/indexMixin.js +343 -343
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +4531 -4531
- package/src/components/xform/form-render/container-item/data-table-mixin.js +4748 -4576
- package/src/components/xform/form-render/container-item/tab-item.vue +125 -125
- package/src/components/xform/form-render/indexMixin.js +5061 -5078
- package/src/components/xform/lang/en-US.js +457 -457
- package/src/components/xform/lang/zh-CN.js +628 -628
- package/src/components/xform/utils/formHttp.js +162 -0
- package/src/components/xform/utils/util.js +1585 -1554
- package/src/index.js +344 -230
- package/src/layout/components/AppMain.vue +122 -122
- package/src/layout/components/extractedCode/viewDialog.vue +207 -207
- package/src/layout/components/langTool.vue +128 -123
- package/src/layout/defaultLayout.vue +164 -158
- package/src/permission.js +185 -135
- package/src/store/config/index.js +667 -669
- package/src/store/modules/micro.js +46 -0
- package/src/store/modules/permission.js +461 -373
- package/src/store/modules/user.js +419 -415
- package/src/utils/auth.js +27 -1
- package/src/utils/index.js +579 -6
- package/src/utils/keepAlive.js +4 -0
- package/src/utils/menuAdapter.js +183 -0
- package/src/utils/request.js +417 -28
- package/src/views/bd/setting/formVersion/ftHistoryDialog.vue +483 -491
- package/src/views/bd/setting/form_script/form_list.vue +174 -174
- package/src/views/bd/setting/form_script/mixins/form_list.js +330 -330
- package/src/views/bd/setting/form_template/formDesignerDialog.vue +171 -171
- package/src/views/bd/setting/form_template/wfObjConfigDialog.vue +253 -254
- package/src/views/user/menuFallback/index.vue +123 -0
- package/src/views/user/wf/wfReport/index.vue +625 -619
|
@@ -1,848 +1,848 @@
|
|
|
1
|
-
import { createDesigner } from "../../../components/xform/form-designer/designer";
|
|
2
|
-
import {
|
|
3
|
-
addWindowResizeHandler,
|
|
4
|
-
deepClone,
|
|
5
|
-
getAllContainerWidgets,
|
|
6
|
-
getAllFieldWidgets,
|
|
7
|
-
getQueryParam,
|
|
8
|
-
traverseAllWidgets,
|
|
9
|
-
traverseAllWidgetsNew,
|
|
10
|
-
} from "../../../components/xform/utils/util";
|
|
11
|
-
import {
|
|
12
|
-
MOCK_CASE_URL,
|
|
13
|
-
VARIANT_FORM_VERSION,
|
|
14
|
-
} from "../../../components/xform/utils/config";
|
|
15
|
-
import i18n, { changeLocale } from "../../../components/xform/utils/i18n";
|
|
16
|
-
import axios from "axios";
|
|
17
|
-
import { getBdFlag } from "@base/api/user";
|
|
18
|
-
|
|
19
|
-
let modules = {};
|
|
20
|
-
|
|
21
|
-
const baseRefUtil = {
|
|
22
|
-
createDesigner,
|
|
23
|
-
MOCK_CASE_URL,
|
|
24
|
-
VARIANT_FORM_VERSION,
|
|
25
|
-
i18n,
|
|
26
|
-
changeLocale,
|
|
27
|
-
axios,
|
|
28
|
-
addWindowResizeHandler,
|
|
29
|
-
deepClone,
|
|
30
|
-
getAllContainerWidgets,
|
|
31
|
-
getAllFieldWidgets,
|
|
32
|
-
getQueryParam,
|
|
33
|
-
traverseAllWidgets,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
modules = {
|
|
37
|
-
componentName: "VFormDesigner",
|
|
38
|
-
mixins: [baseRefUtil.i18n],
|
|
39
|
-
props: {
|
|
40
|
-
reportTemplate: {
|
|
41
|
-
type: Object,
|
|
42
|
-
default: null,
|
|
43
|
-
},
|
|
44
|
-
/* 后端字段列表API */
|
|
45
|
-
fieldListApi: {
|
|
46
|
-
type: Object,
|
|
47
|
-
default: null,
|
|
48
|
-
},
|
|
49
|
-
fieldListData: { type: Object, default: null },
|
|
50
|
-
/* 禁止显示的组件名称数组 */
|
|
51
|
-
bannedWidgets: {
|
|
52
|
-
type: Array,
|
|
53
|
-
default: () => [],
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
designerConfig: {
|
|
57
|
-
type: Object,
|
|
58
|
-
default: () => {
|
|
59
|
-
return {
|
|
60
|
-
languageMenu: true, //是否显示语言切换菜单
|
|
61
|
-
externalLink: true, //是否显示GitHub、文档等外部链接
|
|
62
|
-
formTemplates: true, //是否显示表单模板
|
|
63
|
-
|
|
64
|
-
componentLib: !0,
|
|
65
|
-
chartLib: !1,
|
|
66
|
-
metadataLib: !1,
|
|
67
|
-
layoutTypeButton: !0,
|
|
68
|
-
|
|
69
|
-
eventCollapse: true, //是否显示组件事件属性折叠面板
|
|
70
|
-
widgetNameReadonly: false, //禁止修改组件名称
|
|
71
|
-
|
|
72
|
-
clearDesignerButton: true, //是否显示清空设计器按钮
|
|
73
|
-
previewFormButton: true, //是否显示预览表单按钮
|
|
74
|
-
importJsonButton: true, //是否显示导入JSON按钮
|
|
75
|
-
exportJsonButton: true, //是否显示导出JSON器按钮
|
|
76
|
-
exportCodeButton: true, //是否显示导出代码按钮
|
|
77
|
-
generateSFCButton: true, //是否显示生成SFC按钮
|
|
78
|
-
logoHeader: !0,
|
|
79
|
-
toolbarMaxWidth: 420, //设计器工具按钮栏最大宽度(单位像素)
|
|
80
|
-
toolbarMinWidth: 300, //设计器工具按钮栏最小宽度(单位像素)
|
|
81
|
-
productName: "",
|
|
82
|
-
productTitle: "",
|
|
83
|
-
presetCssCode: "", //设计器预设CSS样式代码
|
|
84
|
-
languageName: "zh-CN",
|
|
85
|
-
resetFormJson: true, //是否在设计器初始化时将表单内容重置为空
|
|
86
|
-
};
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
globalDsv: { type: Object, default: () => ({}) },
|
|
90
|
-
formTemplates: { type: Array, default: null },
|
|
91
|
-
testOptionData: { type: Object, default: null },
|
|
92
|
-
readonly: Boolean,
|
|
93
|
-
columnFlag: Boolean,
|
|
94
|
-
sourceData: Object,
|
|
95
|
-
},
|
|
96
|
-
data() {
|
|
97
|
-
return {
|
|
98
|
-
vFormVersion: baseRefUtil.VARIANT_FORM_VERSION,
|
|
99
|
-
curLangName: "",
|
|
100
|
-
|
|
101
|
-
vsCodeFlag: false,
|
|
102
|
-
caseName: "",
|
|
103
|
-
|
|
104
|
-
docUrl: "https://www.vform666.com/document.html",
|
|
105
|
-
gitUrl: "https://github.com/vform666/variant-form",
|
|
106
|
-
chatUrl: "https://www.vform666.com/pages/chat-group/",
|
|
107
|
-
subScribeUrl: "https://www.vform666.com/subscribe.html",
|
|
108
|
-
|
|
109
|
-
scrollerHeight: 0,
|
|
110
|
-
|
|
111
|
-
designer: baseRefUtil.createDesigner(this),
|
|
112
|
-
|
|
113
|
-
fieldList: [],
|
|
114
|
-
subFormList: [],
|
|
115
|
-
optionData: this.testOptionData,
|
|
116
|
-
externalComponents: {},
|
|
117
|
-
leftAsideVisible: !0,
|
|
118
|
-
rightAsideVisible: !0,
|
|
119
|
-
isDev: true,
|
|
120
|
-
menuKindAuth: {
|
|
121
|
-
editAuth: 0,
|
|
122
|
-
},
|
|
123
|
-
showPreformDialog: false,
|
|
124
|
-
itemFieldMap: {
|
|
125
|
-
grid: "cols",
|
|
126
|
-
table: "rows",
|
|
127
|
-
"table-cell": "widgetList",
|
|
128
|
-
"h5-table": "rows",
|
|
129
|
-
"h5-table-cell": "widgetList",
|
|
130
|
-
tab: "tabs",
|
|
131
|
-
"tab-pane": "widgetList",
|
|
132
|
-
"grid-col": "widgetList",
|
|
133
|
-
"vf-box": "widgetList",
|
|
134
|
-
card: "widgetList",
|
|
135
|
-
detail: "panes",
|
|
136
|
-
"detail-pane": "widgetList",
|
|
137
|
-
"detail-h5": "panes",
|
|
138
|
-
"h5-card": "panes",
|
|
139
|
-
"h5-card-pane": "widgetList",
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
},
|
|
143
|
-
provide() {
|
|
144
|
-
return {
|
|
145
|
-
serverFieldList: this.fieldList,
|
|
146
|
-
getServerSubFormList: () => this.subFormList,
|
|
147
|
-
getDesignerConfig: () => this.designerConfig,
|
|
148
|
-
getBannedWidgets: () => this.bannedWidgets,
|
|
149
|
-
saveReportTemplate: this.saveReportTemplate,
|
|
150
|
-
getReportTemplate: () => this.reportTemplate,
|
|
151
|
-
getFormTemplateTableDTOs: this.getFormTemplateTableDTOs,
|
|
152
|
-
getObjectFieldFlag: () => !1,
|
|
153
|
-
getObjectName: () => "",
|
|
154
|
-
getHasWf: () => false,
|
|
155
|
-
readonly: this.readonly,
|
|
156
|
-
columnFlag: this.columnFlag,
|
|
157
|
-
widgetKeyNameMap: {},
|
|
158
|
-
sourceData: this.sourceData,
|
|
159
|
-
setCETriggerFlag: () => {},
|
|
160
|
-
clearCETriggerFlag: () => {},
|
|
161
|
-
};
|
|
162
|
-
},
|
|
163
|
-
created() {
|
|
164
|
-
this.vsCodeFlag = baseRefUtil.getQueryParam("vscode") === 1;
|
|
165
|
-
this.caseName = baseRefUtil.getQueryParam("case");
|
|
166
|
-
this.designer.handleEvent("canvas-select-field", (o) => {
|
|
167
|
-
this.$emit("field-widget-used", o);
|
|
168
|
-
}),
|
|
169
|
-
this.designer.handleEvent("canvas-remove-field", (o) => {
|
|
170
|
-
this.$emit("field-widget-removed", o);
|
|
171
|
-
}),
|
|
172
|
-
this.designer.handleEvent("form-json-imported", () => {
|
|
173
|
-
this.$emit("form-json-updated", "form-json-imported");
|
|
174
|
-
}),
|
|
175
|
-
this.designer.handleEvent("canvas-undo", () => {
|
|
176
|
-
this.$emit("form-json-updated", "canvas-undo");
|
|
177
|
-
}),
|
|
178
|
-
this.designer.handleEvent("canvas-redo", () => {
|
|
179
|
-
this.$emit("form-json-updated", "canvas-redo");
|
|
180
|
-
}),
|
|
181
|
-
this.designer.handleEvent("canvas-remove-container", () => {
|
|
182
|
-
this.$emit("form-json-updated", "canvas-remove-container");
|
|
183
|
-
});
|
|
184
|
-
},
|
|
185
|
-
mounted() {
|
|
186
|
-
this.initLocale();
|
|
187
|
-
|
|
188
|
-
this.scrollerHeight = window.innerHeight -
|
|
189
|
-
baseRefUtil.addWindowResizeHandler(() => {
|
|
190
|
-
this.$nextTick(() => {
|
|
191
|
-
this.scrollerHeight = window.innerHeight -
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
this.loadCase();
|
|
196
|
-
|
|
197
|
-
// this.loadFieldListFromServer();
|
|
198
|
-
this.initServerFields();
|
|
199
|
-
this.getBdEnv();
|
|
200
|
-
this.getMenuKindAuth();
|
|
201
|
-
},
|
|
202
|
-
methods: {
|
|
203
|
-
showLink(configName) {
|
|
204
|
-
if (this.designerConfig[configName] === undefined) {
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return !!this.designerConfig[configName];
|
|
209
|
-
},
|
|
210
|
-
|
|
211
|
-
openHome() {
|
|
212
|
-
if (!!this.vsCodeFlag) {
|
|
213
|
-
const msgObj = {
|
|
214
|
-
cmd: "openUrl",
|
|
215
|
-
data: {
|
|
216
|
-
url: "https://www.vform666.com/",
|
|
217
|
-
},
|
|
218
|
-
};
|
|
219
|
-
window.parent.postMessage(msgObj, "*");
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
|
|
223
|
-
openUrl(event, url) {
|
|
224
|
-
if (!!this.vsCodeFlag) {
|
|
225
|
-
const msgObj = {
|
|
226
|
-
cmd: "openUrl",
|
|
227
|
-
data: {
|
|
228
|
-
url,
|
|
229
|
-
},
|
|
230
|
-
};
|
|
231
|
-
window.parent.postMessage(msgObj, "*");
|
|
232
|
-
} else {
|
|
233
|
-
let aDom = event.currentTarget;
|
|
234
|
-
aDom.href = url;
|
|
235
|
-
//window.open(url, '_blank') //直接打开新窗口,会被浏览器拦截
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
|
|
239
|
-
loadCase() {
|
|
240
|
-
if (!this.caseName) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
baseRefUtil.axios
|
|
245
|
-
.get(baseRefUtil.MOCK_CASE_URL + this.caseName + ".txt")
|
|
246
|
-
.then((res) => {
|
|
247
|
-
if (!!res.data.code) {
|
|
248
|
-
this.$message.error(this.i18nt("designer.hint.sampleLoadedFail"));
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
this.setFormJson(res.data);
|
|
253
|
-
this.$message.success(
|
|
254
|
-
this.i18nt("designer.hint.sampleLoadedSuccess")
|
|
255
|
-
);
|
|
256
|
-
})
|
|
257
|
-
.catch((error) => {
|
|
258
|
-
this.$message.error(
|
|
259
|
-
this.i18nt("designer.hint.sampleLoadedFail") + ":" + error
|
|
260
|
-
);
|
|
261
|
-
});
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
initLocale() {
|
|
265
|
-
let curLocale = localStorage.getItem("v_form_locale");
|
|
266
|
-
if (!!this.vsCodeFlag) {
|
|
267
|
-
curLocale = curLocale || "en-US";
|
|
268
|
-
} else {
|
|
269
|
-
curLocale = curLocale || "zh-CN";
|
|
270
|
-
}
|
|
271
|
-
this.curLangName = this.i18nt("application." + curLocale);
|
|
272
|
-
this.changeLanguage(curLocale);
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
loadFieldListFromServer() {
|
|
276
|
-
if (!this.fieldListApi) {
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
let headers = this.fieldListApi.headers || {};
|
|
281
|
-
baseRefUtil.axios
|
|
282
|
-
.get(this.fieldListApi.URL, {
|
|
283
|
-
headers: headers,
|
|
284
|
-
})
|
|
285
|
-
.then((res) => {
|
|
286
|
-
let labelKey = this.fieldListApi.labelKey || "label";
|
|
287
|
-
let nameKey = this.fieldListApi.nameKey || "name";
|
|
288
|
-
|
|
289
|
-
this.fieldList.splice(0, this.fieldList.length); //清空已有
|
|
290
|
-
res.data.forEach((fieldItem) => {
|
|
291
|
-
this.fieldList.push({
|
|
292
|
-
label: fieldItem[labelKey],
|
|
293
|
-
name: fieldItem[nameKey],
|
|
294
|
-
});
|
|
295
|
-
});
|
|
296
|
-
})
|
|
297
|
-
.catch((error) => {
|
|
298
|
-
this.$message.error(error);
|
|
299
|
-
});
|
|
300
|
-
},
|
|
301
|
-
initServerFields() {
|
|
302
|
-
!!this.fieldListData && !!this.fieldListData.fieldList
|
|
303
|
-
? (this.fieldList.splice(
|
|
304
|
-
0,
|
|
305
|
-
this.fieldList.length,
|
|
306
|
-
...this.fieldListData.fieldList
|
|
307
|
-
),
|
|
308
|
-
this.fieldListData.subFormList &&
|
|
309
|
-
this.subFormList.splice(
|
|
310
|
-
0,
|
|
311
|
-
this.subFormList.length,
|
|
312
|
-
...this.fieldListData.subFormList
|
|
313
|
-
))
|
|
314
|
-
: this.loadFieldListFromServer();
|
|
315
|
-
},
|
|
316
|
-
setFieldListData(o) {
|
|
317
|
-
!!o &&
|
|
318
|
-
!!o.fieldList &&
|
|
319
|
-
(this.fieldList.splice(0, this.fieldList.length, ...o.fieldList),
|
|
320
|
-
o.subFormList &&
|
|
321
|
-
this.subFormList.splice(
|
|
322
|
-
0,
|
|
323
|
-
this.subFormList.length,
|
|
324
|
-
...o.subFormList
|
|
325
|
-
));
|
|
326
|
-
},
|
|
327
|
-
setMetaFields(o) {
|
|
328
|
-
this.$refs.widgetPanelRef.setMetaFields(o);
|
|
329
|
-
},
|
|
330
|
-
handleLanguageChanged(command) {
|
|
331
|
-
this.changeLanguage(command);
|
|
332
|
-
this.curLangName = this.i18nt("application." + command);
|
|
333
|
-
},
|
|
334
|
-
|
|
335
|
-
changeLanguage(langName) {
|
|
336
|
-
baseRefUtil.changeLocale(langName);
|
|
337
|
-
},
|
|
338
|
-
|
|
339
|
-
setFormJson(formJson) {
|
|
340
|
-
let modifiedFlag = false;
|
|
341
|
-
if (!!formJson) {
|
|
342
|
-
if (typeof formJson === "string") {
|
|
343
|
-
let newFormJson = JSON.parse(formJson);
|
|
344
|
-
this.upgradeFormJson(newFormJson);
|
|
345
|
-
modifiedFlag = this.designer.loadFormJson(newFormJson);
|
|
346
|
-
} else if (formJson.constructor === Object) {
|
|
347
|
-
this.upgradeFormJson(formJson);
|
|
348
|
-
modifiedFlag = this.designer.loadFormJson(formJson);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
if (modifiedFlag) {
|
|
352
|
-
this.designer.emitHistoryChange();
|
|
353
|
-
}
|
|
354
|
-
} else {
|
|
355
|
-
this.clearDesigner();
|
|
356
|
-
}
|
|
357
|
-
},
|
|
358
|
-
|
|
359
|
-
getFormJson() {
|
|
360
|
-
return {
|
|
361
|
-
widgetList: baseRefUtil.deepClone(this.designer.widgetList),
|
|
362
|
-
formConfig: baseRefUtil.deepClone(this.designer.formConfig),
|
|
363
|
-
};
|
|
364
|
-
},
|
|
365
|
-
|
|
366
|
-
clearDesigner() {
|
|
367
|
-
this.$refs.toolbarRef.clearFormWidget();
|
|
368
|
-
},
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* 刷新表单设计器
|
|
372
|
-
*/
|
|
373
|
-
refreshDesigner() {
|
|
374
|
-
//this.designer.loadFormJson( this.getFormJson() ) //只有第一次调用生效??
|
|
375
|
-
|
|
376
|
-
let fJson = this.getFormJson();
|
|
377
|
-
this.designer.clearDesigner(true); //不触发历史记录变更
|
|
378
|
-
this.designer.loadFormJson(fJson);
|
|
379
|
-
},
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* 预览表单
|
|
383
|
-
*/
|
|
384
|
-
previewForm() {
|
|
385
|
-
this.$refs.toolbarRef.previewForm();
|
|
386
|
-
},
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* 导入表单JSON
|
|
390
|
-
*/
|
|
391
|
-
importJson() {
|
|
392
|
-
this.$refs.toolbarRef.importJson();
|
|
393
|
-
},
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* 导出表单JSON
|
|
397
|
-
*/
|
|
398
|
-
exportJson() {
|
|
399
|
-
this.$refs.toolbarRef.exportJson();
|
|
400
|
-
},
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* 导出Vue/HTML代码
|
|
404
|
-
*/
|
|
405
|
-
exportCode() {
|
|
406
|
-
this.$refs.toolbarRef.exportCode();
|
|
407
|
-
},
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* 生成SFC代码
|
|
411
|
-
*/
|
|
412
|
-
generateSFC() {
|
|
413
|
-
this.$refs.toolbarRef.generateSFC();
|
|
414
|
-
},
|
|
415
|
-
|
|
416
|
-
/**
|
|
417
|
-
* 获取所有字段组件
|
|
418
|
-
* @returns {*[]}
|
|
419
|
-
*/
|
|
420
|
-
getFieldWidgets(widgetList = null) {
|
|
421
|
-
return !!widgetList
|
|
422
|
-
? baseRefUtil.getAllFieldWidgets(widgetList)
|
|
423
|
-
: baseRefUtil.getAllFieldWidgets(this.designer.widgetList);
|
|
424
|
-
},
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* 获取所有容器组件
|
|
428
|
-
* @returns {*[]}
|
|
429
|
-
*/
|
|
430
|
-
getContainerWidgets(widgetList = null) {
|
|
431
|
-
return !!widgetList
|
|
432
|
-
? baseRefUtil.getAllContainerWidgets(widgetList)
|
|
433
|
-
: baseRefUtil.getAllContainerWidgets(this.designer.widgetList);
|
|
434
|
-
},
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* 升级表单json,以补充最新的组件属性
|
|
438
|
-
* @param formJson
|
|
439
|
-
*/
|
|
440
|
-
upgradeFormJson(formJson) {
|
|
441
|
-
if (!formJson.widgetList || !formJson.formConfig) {
|
|
442
|
-
this.$message.error("Invalid form json!");
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
traverseAllWidgetsNew(formJson.widgetList, (w) => {
|
|
447
|
-
this.designer.upgradeWidgetConfig(w);
|
|
448
|
-
});
|
|
449
|
-
this.designer.upgradeFormConfig(formJson.formConfig);
|
|
450
|
-
|
|
451
|
-
return formJson;
|
|
452
|
-
},
|
|
453
|
-
|
|
454
|
-
getWidgetRef(widgetName, showError = false) {
|
|
455
|
-
return this.$refs["formRef"].getWidgetRef(widgetName, showError);
|
|
456
|
-
},
|
|
457
|
-
|
|
458
|
-
getSelectedWidgetRef() {
|
|
459
|
-
return this.$refs["formRef"].getSelectedWidgetRef();
|
|
460
|
-
},
|
|
461
|
-
getWfBizDataSettingDTOs(formJson, code) {
|
|
462
|
-
let result = [];
|
|
463
|
-
let formCode = code || this.reportTemplate.formCode;
|
|
464
|
-
let fields = [];
|
|
465
|
-
let fJson = formJson || this.getFormJson();
|
|
466
|
-
let formConfig = fJson.formConfig;
|
|
467
|
-
let entity = formConfig.entity;
|
|
468
|
-
if (!entity) return [];
|
|
469
|
-
if (formConfig.wfTheme) {
|
|
470
|
-
result.push({
|
|
471
|
-
action: "setWfName",
|
|
472
|
-
toValue: formConfig.wfTheme,
|
|
473
|
-
tableName: entity,
|
|
474
|
-
tableField: null,
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
let itemFieldMap = this.itemFieldMap;
|
|
478
|
-
|
|
479
|
-
let loopDo = (widgetList) => {
|
|
480
|
-
if (!widgetList) return;
|
|
481
|
-
widgetList.forEach((widget) => {
|
|
482
|
-
let widgetName = widget.options.name;
|
|
483
|
-
let optionModel = widget.options;
|
|
484
|
-
if (widget.category !== "container") {
|
|
485
|
-
if (optionModel.wfModifyDataEnabled) {
|
|
486
|
-
let wfModifyDataConfig = optionModel.wfModifyDataConfig || [];
|
|
487
|
-
if (wfModifyDataConfig.length) {
|
|
488
|
-
let fieldKeyName = this.getFieldKeyName(widget);
|
|
489
|
-
let items = wfModifyDataConfig
|
|
490
|
-
.filter((item) => {
|
|
491
|
-
return !!item.action;
|
|
492
|
-
})
|
|
493
|
-
.map((item) => {
|
|
494
|
-
return {
|
|
495
|
-
action: item.action,
|
|
496
|
-
toValue: item.toValue,
|
|
497
|
-
tableName: entity,
|
|
498
|
-
tableField: fieldKeyName,
|
|
499
|
-
};
|
|
500
|
-
});
|
|
501
|
-
result.push(...items);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
} else {
|
|
505
|
-
let itemField = itemFieldMap[widget.type];
|
|
506
|
-
if (itemField) {
|
|
507
|
-
if ("table" === widget.type) {
|
|
508
|
-
widget[itemField].forEach((item) => {
|
|
509
|
-
loopDo(item.cols);
|
|
510
|
-
});
|
|
511
|
-
} else if ("h5-table" === widget.type) {
|
|
512
|
-
widget[itemField].forEach((item) => {
|
|
513
|
-
loopDo(item.cols);
|
|
514
|
-
});
|
|
515
|
-
} else {
|
|
516
|
-
loopDo(widget[itemField]);
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
});
|
|
521
|
-
};
|
|
522
|
-
loopDo(fJson.widgetList);
|
|
523
|
-
return result;
|
|
524
|
-
},
|
|
525
|
-
getFormTemplateTableDTOs(formJson, code) {
|
|
526
|
-
let formTemplateTableDTOs = [];
|
|
527
|
-
let formCode = code || this.reportTemplate.formCode;
|
|
528
|
-
let fields = [];
|
|
529
|
-
let fJson = formJson || this.getFormJson();
|
|
530
|
-
/*let itemFieldMap = {
|
|
531
|
-
grid: "cols",
|
|
532
|
-
table: "rows",
|
|
533
|
-
"table-cell": "widgetList",
|
|
534
|
-
'h5-table': "rows",
|
|
535
|
-
"h5-table-cell": "widgetList",
|
|
536
|
-
tab: "tabs",
|
|
537
|
-
"tab-pane": "widgetList",
|
|
538
|
-
"grid-col": "widgetList",
|
|
539
|
-
"vf-box": "widgetList",
|
|
540
|
-
"card": "widgetList",
|
|
541
|
-
"detail": "panes",
|
|
542
|
-
"detail-pane": "widgetList",
|
|
543
|
-
"detail-h5": "panes",
|
|
544
|
-
"h5-card": "panes",
|
|
545
|
-
"h5-card-pane": "widgetList",
|
|
546
|
-
}*/
|
|
547
|
-
let itemFieldMap = this.itemFieldMap;
|
|
548
|
-
let loopDo = (widgetList) => {
|
|
549
|
-
if (!widgetList) return;
|
|
550
|
-
widgetList.forEach((widget) => {
|
|
551
|
-
let widgetName = widget.options.name;
|
|
552
|
-
if (
|
|
553
|
-
widget.tableField &&
|
|
554
|
-
(widget.type === "data-table" || widget.type === "list-h5")
|
|
555
|
-
) {
|
|
556
|
-
let vailColumns = widget.options.tableColumns.filter(
|
|
557
|
-
(item) => item.prop && item.label
|
|
558
|
-
);
|
|
559
|
-
let itemFields = [];
|
|
560
|
-
vailColumns.forEach((item) => {
|
|
561
|
-
if (item.formatS === "editSearch") {
|
|
562
|
-
itemFields.push({
|
|
563
|
-
fieldDesc: item.label + "ID",
|
|
564
|
-
fieldName: item.prop,
|
|
565
|
-
});
|
|
566
|
-
let vabSearchName = item?.columnOption?.vabSearchName;
|
|
567
|
-
if (vabSearchName) {
|
|
568
|
-
itemFields.push({
|
|
569
|
-
fieldDesc: item.label,
|
|
570
|
-
fieldName: vabSearchName,
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
} else {
|
|
574
|
-
itemFields.push({
|
|
575
|
-
fieldDesc: item.label,
|
|
576
|
-
fieldName: item.prop,
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
/*let itemFields = widget.options.tableColumns.filter(item => item.prop && item.label).map(item => {
|
|
581
|
-
return {
|
|
582
|
-
fieldDesc: item.label,
|
|
583
|
-
fieldName: item.prop
|
|
584
|
-
}
|
|
585
|
-
})*/
|
|
586
|
-
if (itemFields.length) {
|
|
587
|
-
let formTemplateTable = {
|
|
588
|
-
tableAlias: widgetName,
|
|
589
|
-
formCode: formCode,
|
|
590
|
-
tableType: 1,
|
|
591
|
-
formTemplateFieldDTOs: [],
|
|
592
|
-
};
|
|
593
|
-
formTemplateTable.formTemplateFieldDTOs = itemFields;
|
|
594
|
-
formTemplateTableDTOs.push(formTemplateTable);
|
|
595
|
-
}
|
|
596
|
-
} else if (widget.tableField && widget.type === "vabUpload") {
|
|
597
|
-
let formTemplateTable = {
|
|
598
|
-
tableAlias: widgetName,
|
|
599
|
-
formCode: formCode,
|
|
600
|
-
tableType: 2,
|
|
601
|
-
};
|
|
602
|
-
formTemplateTableDTOs.push(formTemplateTable);
|
|
603
|
-
} else if (widget.tableField && this.isVabsearchFlagWidget(widget)) {
|
|
604
|
-
fields.push({
|
|
605
|
-
fieldDesc: widget.options.label + "ID",
|
|
606
|
-
fieldName: widgetName,
|
|
607
|
-
});
|
|
608
|
-
let vabSearchName = widget.options.vabSearchName;
|
|
609
|
-
if (vabSearchName) {
|
|
610
|
-
fields.push({
|
|
611
|
-
fieldDesc: widget.options.label,
|
|
612
|
-
fieldName: vabSearchName,
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
} else if (widget.tableField) {
|
|
616
|
-
fields.push({
|
|
617
|
-
fieldDesc: widget.options.label,
|
|
618
|
-
fieldName: widgetName,
|
|
619
|
-
});
|
|
620
|
-
} else {
|
|
621
|
-
if (widget.category === "container") {
|
|
622
|
-
let itemField = itemFieldMap[widget.type];
|
|
623
|
-
if (itemField) {
|
|
624
|
-
if ("table" === widget.type) {
|
|
625
|
-
widget[itemField].forEach((item) => {
|
|
626
|
-
loopDo(item.cols);
|
|
627
|
-
});
|
|
628
|
-
} else if ("h5-table" === widget.type) {
|
|
629
|
-
widget[itemField].forEach((item) => {
|
|
630
|
-
loopDo(item.cols);
|
|
631
|
-
});
|
|
632
|
-
} else {
|
|
633
|
-
loopDo(widget[itemField]);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
});
|
|
639
|
-
};
|
|
640
|
-
|
|
641
|
-
loopDo(fJson.widgetList);
|
|
642
|
-
if (fields.length) {
|
|
643
|
-
let formTemplateTable = {
|
|
644
|
-
tableAlias: null,
|
|
645
|
-
formCode: formCode,
|
|
646
|
-
tableType: 0,
|
|
647
|
-
formTemplateFieldDTOs: fields,
|
|
648
|
-
};
|
|
649
|
-
formTemplateTableDTOs.push(formTemplateTable);
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
return formTemplateTableDTOs;
|
|
653
|
-
},
|
|
654
|
-
isVabsearchFlagWidget(widget) {
|
|
655
|
-
let type = widget?.type;
|
|
656
|
-
return (
|
|
657
|
-
type === "vabsearch" ||
|
|
658
|
-
type === "singerSearch" ||
|
|
659
|
-
type === "multiSearch"
|
|
660
|
-
);
|
|
661
|
-
},
|
|
662
|
-
getTableFileds() {
|
|
663
|
-
let fields = [];
|
|
664
|
-
let fJson = this.getFormJson();
|
|
665
|
-
/*let itemFieldMap = {
|
|
666
|
-
grid: "cols",
|
|
667
|
-
table: "rows",
|
|
668
|
-
"table-cell": "widgetList",
|
|
669
|
-
'h5-table': "rows",
|
|
670
|
-
"h5-table-cell": "widgetList",
|
|
671
|
-
tab: "tabs",
|
|
672
|
-
"tab-pane": "widgetList",
|
|
673
|
-
"grid-col": "widgetList",
|
|
674
|
-
"vf-box": "widgetList",
|
|
675
|
-
"card": "widgetList",
|
|
676
|
-
"detail": "panes",
|
|
677
|
-
"detail-pane": "widgetList",
|
|
678
|
-
"detail-h5": "panes",
|
|
679
|
-
"h5-card": "panes",
|
|
680
|
-
"h5-card-pane": "widgetList",
|
|
681
|
-
}*/
|
|
682
|
-
let itemFieldMap = this.itemFieldMap;
|
|
683
|
-
let loopDo = (widgetList) => {
|
|
684
|
-
if (!widgetList) return;
|
|
685
|
-
widgetList.forEach((widget) => {
|
|
686
|
-
/*if (widget.tableField && widget.type === 'data-table') {
|
|
687
|
-
let itemFields = widget.options.tableColumns.filter(item.prop && item.label).map(item => {
|
|
688
|
-
return {
|
|
689
|
-
fieldDesc: item.options.label,
|
|
690
|
-
fieldName: item.prop
|
|
691
|
-
}
|
|
692
|
-
})
|
|
693
|
-
}*/
|
|
694
|
-
let widgetName = widget.options.name;
|
|
695
|
-
if (widget.tableField) {
|
|
696
|
-
fields.push({
|
|
697
|
-
fieldDesc: widget.options.label,
|
|
698
|
-
fieldName: widgetName,
|
|
699
|
-
});
|
|
700
|
-
} else {
|
|
701
|
-
if (widget.category === "container") {
|
|
702
|
-
let itemField = itemFieldMap[widget.type];
|
|
703
|
-
if (itemField) {
|
|
704
|
-
if ("table" === widget.type) {
|
|
705
|
-
widget[itemField].forEach((item) => {
|
|
706
|
-
loopDo(item.cols);
|
|
707
|
-
});
|
|
708
|
-
} else if ("h5-table" === widget.type) {
|
|
709
|
-
widget[itemField].forEach((item) => {
|
|
710
|
-
loopDo(item.cols);
|
|
711
|
-
});
|
|
712
|
-
} else {
|
|
713
|
-
loopDo(widget[itemField]);
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
});
|
|
719
|
-
};
|
|
720
|
-
loopDo(fJson.widgetList);
|
|
721
|
-
return fields;
|
|
722
|
-
},
|
|
723
|
-
getFormScriptDTOs() {
|
|
724
|
-
let reportTemplate = this.reportTemplate;
|
|
725
|
-
let fJson = this.getFormJson();
|
|
726
|
-
let scripts = fJson.formConfig.scriptList || [];
|
|
727
|
-
return scripts
|
|
728
|
-
.filter((item) => {
|
|
729
|
-
return !!item.uuid && !!item.script;
|
|
730
|
-
})
|
|
731
|
-
.map((item) => {
|
|
732
|
-
return {
|
|
733
|
-
formCode: reportTemplate.formCode,
|
|
734
|
-
formVersion: reportTemplate.formVersion,
|
|
735
|
-
scriptCode: item.uuid,
|
|
736
|
-
scriptName: item.uuid,
|
|
737
|
-
script: item.script,
|
|
738
|
-
};
|
|
739
|
-
});
|
|
740
|
-
},
|
|
741
|
-
handleColumnConfirm() {
|
|
742
|
-
let fJson = this.getFormJson();
|
|
743
|
-
this.$emit("customConfirm", fJson);
|
|
744
|
-
},
|
|
745
|
-
saveReportTemplate() {
|
|
746
|
-
if (this.columnFlag) {
|
|
747
|
-
this.handleColumnConfirm();
|
|
748
|
-
return;
|
|
749
|
-
}
|
|
750
|
-
this.openPreformDialog();
|
|
751
|
-
},
|
|
752
|
-
saveDataHandle(preformData) {
|
|
753
|
-
if (this.reportTemplate) {
|
|
754
|
-
let formTemplateTableDTOs = this.getFormTemplateTableDTOs();
|
|
755
|
-
let fJson = this.getFormJson();
|
|
756
|
-
let formViewContent = JSON.stringify(fJson);
|
|
757
|
-
let tableFileds = this.getTableFileds();
|
|
758
|
-
let reportTemplate = baseRefUtil.deepClone(this.reportTemplate);
|
|
759
|
-
reportTemplate.formViewContent = formViewContent;
|
|
760
|
-
reportTemplate.formTemplateTableDTOs = formTemplateTableDTOs;
|
|
761
|
-
|
|
762
|
-
let formScriptDTOs = this.getFormScriptDTOs();
|
|
763
|
-
reportTemplate.formScriptDTOs = formScriptDTOs;
|
|
764
|
-
reportTemplate.hasWf = fJson.formConfig.wfEnabled || false;
|
|
765
|
-
|
|
766
|
-
let wfBizDataSettingDTOs = this.getWfBizDataSettingDTOs();
|
|
767
|
-
|
|
768
|
-
let formData = {
|
|
769
|
-
...reportTemplate,
|
|
770
|
-
wfBizDataSettingDTOs,
|
|
771
|
-
logContent: preformData.logContent,
|
|
772
|
-
};
|
|
773
|
-
|
|
774
|
-
let url = USER_PREFIX + `/formTemplate/updateDesign`;
|
|
775
|
-
this.$http({
|
|
776
|
-
url: url,
|
|
777
|
-
method: `post`,
|
|
778
|
-
data: formData,
|
|
779
|
-
isLoading: true,
|
|
780
|
-
loadingTarget: document.body,
|
|
781
|
-
success: (res) => {
|
|
782
|
-
this.reflushReportTemplate(res.objx);
|
|
783
|
-
this.$message({
|
|
784
|
-
message: res.content,
|
|
785
|
-
type: "success",
|
|
786
|
-
duration: 500,
|
|
787
|
-
onClose: (t) => {},
|
|
788
|
-
});
|
|
789
|
-
this.$emit("reflushTemplateList");
|
|
790
|
-
},
|
|
791
|
-
});
|
|
792
|
-
}
|
|
793
|
-
},
|
|
794
|
-
openPreformDialog() {
|
|
795
|
-
this.showPreformDialog = true;
|
|
796
|
-
},
|
|
797
|
-
confirmPreformDialog(preformData) {
|
|
798
|
-
this.saveDataHandle(preformData);
|
|
799
|
-
},
|
|
800
|
-
reflushReportTemplate(id) {
|
|
801
|
-
this.$http({
|
|
802
|
-
url: USER_PREFIX + `/formTemplate/get`,
|
|
803
|
-
method: `post`,
|
|
804
|
-
data: {
|
|
805
|
-
id: id,
|
|
806
|
-
},
|
|
807
|
-
isLoading: true,
|
|
808
|
-
loadingTarget: document.body,
|
|
809
|
-
modalStrictly: true,
|
|
810
|
-
success: (res) => {
|
|
811
|
-
let reportTemplate = res.objx || {};
|
|
812
|
-
this.$emit("update:reportTemplate", reportTemplate);
|
|
813
|
-
},
|
|
814
|
-
});
|
|
815
|
-
},
|
|
816
|
-
loadWidgets() {
|
|
817
|
-
this.$refs.widgetPanelRef.loadWidgets();
|
|
818
|
-
},
|
|
819
|
-
getBdEnv() {
|
|
820
|
-
getBdFlag({
|
|
821
|
-
success: (res) => {
|
|
822
|
-
this.isDev = res.objx === 1;
|
|
823
|
-
},
|
|
824
|
-
});
|
|
825
|
-
},
|
|
826
|
-
getMenuKindAuth() {
|
|
827
|
-
let menuKindCode = this.reportTemplate?.menuKindCode;
|
|
828
|
-
if (menuKindCode) {
|
|
829
|
-
this.$http({
|
|
830
|
-
aes: true,
|
|
831
|
-
url: USER_PREFIX + "/menu_kind_auth/getAuth",
|
|
832
|
-
method: `post`,
|
|
833
|
-
data: { stringOne: menuKindCode },
|
|
834
|
-
isLoading: true,
|
|
835
|
-
success: (res) => {
|
|
836
|
-
this.menuKindAuth = res.objx || {};
|
|
837
|
-
},
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
},
|
|
841
|
-
getFieldKeyName(widget) {
|
|
842
|
-
let o = widget.options.name;
|
|
843
|
-
return (widget.options.keyNameEnabled && widget.options.keyName) || o;
|
|
844
|
-
},
|
|
845
|
-
//TODO: 增加更多方法!!
|
|
846
|
-
},
|
|
847
|
-
};
|
|
848
|
-
export default modules;
|
|
1
|
+
import { createDesigner } from "../../../components/xform/form-designer/designer";
|
|
2
|
+
import {
|
|
3
|
+
addWindowResizeHandler,
|
|
4
|
+
deepClone,
|
|
5
|
+
getAllContainerWidgets,
|
|
6
|
+
getAllFieldWidgets,
|
|
7
|
+
getQueryParam,
|
|
8
|
+
traverseAllWidgets,
|
|
9
|
+
traverseAllWidgetsNew,
|
|
10
|
+
} from "../../../components/xform/utils/util";
|
|
11
|
+
import {
|
|
12
|
+
MOCK_CASE_URL,
|
|
13
|
+
VARIANT_FORM_VERSION,
|
|
14
|
+
} from "../../../components/xform/utils/config";
|
|
15
|
+
import i18n, { changeLocale } from "../../../components/xform/utils/i18n";
|
|
16
|
+
import axios from "axios";
|
|
17
|
+
import { getBdFlag } from "@base/api/user";
|
|
18
|
+
|
|
19
|
+
let modules = {};
|
|
20
|
+
|
|
21
|
+
const baseRefUtil = {
|
|
22
|
+
createDesigner,
|
|
23
|
+
MOCK_CASE_URL,
|
|
24
|
+
VARIANT_FORM_VERSION,
|
|
25
|
+
i18n,
|
|
26
|
+
changeLocale,
|
|
27
|
+
axios,
|
|
28
|
+
addWindowResizeHandler,
|
|
29
|
+
deepClone,
|
|
30
|
+
getAllContainerWidgets,
|
|
31
|
+
getAllFieldWidgets,
|
|
32
|
+
getQueryParam,
|
|
33
|
+
traverseAllWidgets,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
modules = {
|
|
37
|
+
componentName: "VFormDesigner",
|
|
38
|
+
mixins: [baseRefUtil.i18n],
|
|
39
|
+
props: {
|
|
40
|
+
reportTemplate: {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: null,
|
|
43
|
+
},
|
|
44
|
+
/* 后端字段列表API */
|
|
45
|
+
fieldListApi: {
|
|
46
|
+
type: Object,
|
|
47
|
+
default: null,
|
|
48
|
+
},
|
|
49
|
+
fieldListData: { type: Object, default: null },
|
|
50
|
+
/* 禁止显示的组件名称数组 */
|
|
51
|
+
bannedWidgets: {
|
|
52
|
+
type: Array,
|
|
53
|
+
default: () => [],
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
designerConfig: {
|
|
57
|
+
type: Object,
|
|
58
|
+
default: () => {
|
|
59
|
+
return {
|
|
60
|
+
languageMenu: true, //是否显示语言切换菜单
|
|
61
|
+
externalLink: true, //是否显示GitHub、文档等外部链接
|
|
62
|
+
formTemplates: true, //是否显示表单模板
|
|
63
|
+
|
|
64
|
+
componentLib: !0,
|
|
65
|
+
chartLib: !1,
|
|
66
|
+
metadataLib: !1,
|
|
67
|
+
layoutTypeButton: !0,
|
|
68
|
+
|
|
69
|
+
eventCollapse: true, //是否显示组件事件属性折叠面板
|
|
70
|
+
widgetNameReadonly: false, //禁止修改组件名称
|
|
71
|
+
|
|
72
|
+
clearDesignerButton: true, //是否显示清空设计器按钮
|
|
73
|
+
previewFormButton: true, //是否显示预览表单按钮
|
|
74
|
+
importJsonButton: true, //是否显示导入JSON按钮
|
|
75
|
+
exportJsonButton: true, //是否显示导出JSON器按钮
|
|
76
|
+
exportCodeButton: true, //是否显示导出代码按钮
|
|
77
|
+
generateSFCButton: true, //是否显示生成SFC按钮
|
|
78
|
+
logoHeader: !0,
|
|
79
|
+
toolbarMaxWidth: 420, //设计器工具按钮栏最大宽度(单位像素)
|
|
80
|
+
toolbarMinWidth: 300, //设计器工具按钮栏最小宽度(单位像素)
|
|
81
|
+
productName: "",
|
|
82
|
+
productTitle: "",
|
|
83
|
+
presetCssCode: "", //设计器预设CSS样式代码
|
|
84
|
+
languageName: "zh-CN",
|
|
85
|
+
resetFormJson: true, //是否在设计器初始化时将表单内容重置为空
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
globalDsv: { type: Object, default: () => ({}) },
|
|
90
|
+
formTemplates: { type: Array, default: null },
|
|
91
|
+
testOptionData: { type: Object, default: null },
|
|
92
|
+
readonly: Boolean,
|
|
93
|
+
columnFlag: Boolean,
|
|
94
|
+
sourceData: Object,
|
|
95
|
+
},
|
|
96
|
+
data() {
|
|
97
|
+
return {
|
|
98
|
+
vFormVersion: baseRefUtil.VARIANT_FORM_VERSION,
|
|
99
|
+
curLangName: "",
|
|
100
|
+
|
|
101
|
+
vsCodeFlag: false,
|
|
102
|
+
caseName: "",
|
|
103
|
+
|
|
104
|
+
docUrl: "https://www.vform666.com/document.html",
|
|
105
|
+
gitUrl: "https://github.com/vform666/variant-form",
|
|
106
|
+
chatUrl: "https://www.vform666.com/pages/chat-group/",
|
|
107
|
+
subScribeUrl: "https://www.vform666.com/subscribe.html",
|
|
108
|
+
|
|
109
|
+
scrollerHeight: 0,
|
|
110
|
+
|
|
111
|
+
designer: baseRefUtil.createDesigner(this),
|
|
112
|
+
|
|
113
|
+
fieldList: [],
|
|
114
|
+
subFormList: [],
|
|
115
|
+
optionData: this.testOptionData,
|
|
116
|
+
externalComponents: {},
|
|
117
|
+
leftAsideVisible: !0,
|
|
118
|
+
rightAsideVisible: !0,
|
|
119
|
+
isDev: true,
|
|
120
|
+
menuKindAuth: {
|
|
121
|
+
editAuth: 0,
|
|
122
|
+
},
|
|
123
|
+
showPreformDialog: false,
|
|
124
|
+
itemFieldMap: {
|
|
125
|
+
grid: "cols",
|
|
126
|
+
table: "rows",
|
|
127
|
+
"table-cell": "widgetList",
|
|
128
|
+
"h5-table": "rows",
|
|
129
|
+
"h5-table-cell": "widgetList",
|
|
130
|
+
tab: "tabs",
|
|
131
|
+
"tab-pane": "widgetList",
|
|
132
|
+
"grid-col": "widgetList",
|
|
133
|
+
"vf-box": "widgetList",
|
|
134
|
+
card: "widgetList",
|
|
135
|
+
detail: "panes",
|
|
136
|
+
"detail-pane": "widgetList",
|
|
137
|
+
"detail-h5": "panes",
|
|
138
|
+
"h5-card": "panes",
|
|
139
|
+
"h5-card-pane": "widgetList",
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
provide() {
|
|
144
|
+
return {
|
|
145
|
+
serverFieldList: this.fieldList,
|
|
146
|
+
getServerSubFormList: () => this.subFormList,
|
|
147
|
+
getDesignerConfig: () => this.designerConfig,
|
|
148
|
+
getBannedWidgets: () => this.bannedWidgets,
|
|
149
|
+
saveReportTemplate: this.saveReportTemplate,
|
|
150
|
+
getReportTemplate: () => this.reportTemplate,
|
|
151
|
+
getFormTemplateTableDTOs: this.getFormTemplateTableDTOs,
|
|
152
|
+
getObjectFieldFlag: () => !1,
|
|
153
|
+
getObjectName: () => "",
|
|
154
|
+
getHasWf: () => false,
|
|
155
|
+
readonly: this.readonly,
|
|
156
|
+
columnFlag: this.columnFlag,
|
|
157
|
+
widgetKeyNameMap: {},
|
|
158
|
+
sourceData: this.sourceData,
|
|
159
|
+
setCETriggerFlag: () => {},
|
|
160
|
+
clearCETriggerFlag: () => {},
|
|
161
|
+
};
|
|
162
|
+
},
|
|
163
|
+
created() {
|
|
164
|
+
this.vsCodeFlag = baseRefUtil.getQueryParam("vscode") === 1;
|
|
165
|
+
this.caseName = baseRefUtil.getQueryParam("case");
|
|
166
|
+
this.designer.handleEvent("canvas-select-field", (o) => {
|
|
167
|
+
this.$emit("field-widget-used", o);
|
|
168
|
+
}),
|
|
169
|
+
this.designer.handleEvent("canvas-remove-field", (o) => {
|
|
170
|
+
this.$emit("field-widget-removed", o);
|
|
171
|
+
}),
|
|
172
|
+
this.designer.handleEvent("form-json-imported", () => {
|
|
173
|
+
this.$emit("form-json-updated", "form-json-imported");
|
|
174
|
+
}),
|
|
175
|
+
this.designer.handleEvent("canvas-undo", () => {
|
|
176
|
+
this.$emit("form-json-updated", "canvas-undo");
|
|
177
|
+
}),
|
|
178
|
+
this.designer.handleEvent("canvas-redo", () => {
|
|
179
|
+
this.$emit("form-json-updated", "canvas-redo");
|
|
180
|
+
}),
|
|
181
|
+
this.designer.handleEvent("canvas-remove-container", () => {
|
|
182
|
+
this.$emit("form-json-updated", "canvas-remove-container");
|
|
183
|
+
});
|
|
184
|
+
},
|
|
185
|
+
mounted() {
|
|
186
|
+
this.initLocale();
|
|
187
|
+
|
|
188
|
+
this.scrollerHeight = window.innerHeight - 42 + "px";
|
|
189
|
+
baseRefUtil.addWindowResizeHandler(() => {
|
|
190
|
+
this.$nextTick(() => {
|
|
191
|
+
this.scrollerHeight = window.innerHeight - 42 + "px";
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
this.loadCase();
|
|
196
|
+
|
|
197
|
+
// this.loadFieldListFromServer();
|
|
198
|
+
this.initServerFields();
|
|
199
|
+
this.getBdEnv();
|
|
200
|
+
this.getMenuKindAuth();
|
|
201
|
+
},
|
|
202
|
+
methods: {
|
|
203
|
+
showLink(configName) {
|
|
204
|
+
if (this.designerConfig[configName] === undefined) {
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return !!this.designerConfig[configName];
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
openHome() {
|
|
212
|
+
if (!!this.vsCodeFlag) {
|
|
213
|
+
const msgObj = {
|
|
214
|
+
cmd: "openUrl",
|
|
215
|
+
data: {
|
|
216
|
+
url: "https://www.vform666.com/",
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
window.parent.postMessage(msgObj, "*");
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
openUrl(event, url) {
|
|
224
|
+
if (!!this.vsCodeFlag) {
|
|
225
|
+
const msgObj = {
|
|
226
|
+
cmd: "openUrl",
|
|
227
|
+
data: {
|
|
228
|
+
url,
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
window.parent.postMessage(msgObj, "*");
|
|
232
|
+
} else {
|
|
233
|
+
let aDom = event.currentTarget;
|
|
234
|
+
aDom.href = url;
|
|
235
|
+
//window.open(url, '_blank') //直接打开新窗口,会被浏览器拦截
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
loadCase() {
|
|
240
|
+
if (!this.caseName) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
baseRefUtil.axios
|
|
245
|
+
.get(baseRefUtil.MOCK_CASE_URL + this.caseName + ".txt")
|
|
246
|
+
.then((res) => {
|
|
247
|
+
if (!!res.data.code) {
|
|
248
|
+
this.$message.error(this.i18nt("designer.hint.sampleLoadedFail"));
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
this.setFormJson(res.data);
|
|
253
|
+
this.$message.success(
|
|
254
|
+
this.i18nt("designer.hint.sampleLoadedSuccess")
|
|
255
|
+
);
|
|
256
|
+
})
|
|
257
|
+
.catch((error) => {
|
|
258
|
+
this.$message.error(
|
|
259
|
+
this.i18nt("designer.hint.sampleLoadedFail") + ":" + error
|
|
260
|
+
);
|
|
261
|
+
});
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
initLocale() {
|
|
265
|
+
let curLocale = localStorage.getItem("v_form_locale");
|
|
266
|
+
if (!!this.vsCodeFlag) {
|
|
267
|
+
curLocale = curLocale || "en-US";
|
|
268
|
+
} else {
|
|
269
|
+
curLocale = curLocale || "zh-CN";
|
|
270
|
+
}
|
|
271
|
+
this.curLangName = this.i18nt("application." + curLocale);
|
|
272
|
+
this.changeLanguage(curLocale);
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
loadFieldListFromServer() {
|
|
276
|
+
if (!this.fieldListApi) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
let headers = this.fieldListApi.headers || {};
|
|
281
|
+
baseRefUtil.axios
|
|
282
|
+
.get(this.fieldListApi.URL, {
|
|
283
|
+
headers: headers,
|
|
284
|
+
})
|
|
285
|
+
.then((res) => {
|
|
286
|
+
let labelKey = this.fieldListApi.labelKey || "label";
|
|
287
|
+
let nameKey = this.fieldListApi.nameKey || "name";
|
|
288
|
+
|
|
289
|
+
this.fieldList.splice(0, this.fieldList.length); //清空已有
|
|
290
|
+
res.data.forEach((fieldItem) => {
|
|
291
|
+
this.fieldList.push({
|
|
292
|
+
label: fieldItem[labelKey],
|
|
293
|
+
name: fieldItem[nameKey],
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
})
|
|
297
|
+
.catch((error) => {
|
|
298
|
+
this.$message.error(error);
|
|
299
|
+
});
|
|
300
|
+
},
|
|
301
|
+
initServerFields() {
|
|
302
|
+
!!this.fieldListData && !!this.fieldListData.fieldList
|
|
303
|
+
? (this.fieldList.splice(
|
|
304
|
+
0,
|
|
305
|
+
this.fieldList.length,
|
|
306
|
+
...this.fieldListData.fieldList
|
|
307
|
+
),
|
|
308
|
+
this.fieldListData.subFormList &&
|
|
309
|
+
this.subFormList.splice(
|
|
310
|
+
0,
|
|
311
|
+
this.subFormList.length,
|
|
312
|
+
...this.fieldListData.subFormList
|
|
313
|
+
))
|
|
314
|
+
: this.loadFieldListFromServer();
|
|
315
|
+
},
|
|
316
|
+
setFieldListData(o) {
|
|
317
|
+
!!o &&
|
|
318
|
+
!!o.fieldList &&
|
|
319
|
+
(this.fieldList.splice(0, this.fieldList.length, ...o.fieldList),
|
|
320
|
+
o.subFormList &&
|
|
321
|
+
this.subFormList.splice(
|
|
322
|
+
0,
|
|
323
|
+
this.subFormList.length,
|
|
324
|
+
...o.subFormList
|
|
325
|
+
));
|
|
326
|
+
},
|
|
327
|
+
setMetaFields(o) {
|
|
328
|
+
this.$refs.widgetPanelRef.setMetaFields(o);
|
|
329
|
+
},
|
|
330
|
+
handleLanguageChanged(command) {
|
|
331
|
+
this.changeLanguage(command);
|
|
332
|
+
this.curLangName = this.i18nt("application." + command);
|
|
333
|
+
},
|
|
334
|
+
|
|
335
|
+
changeLanguage(langName) {
|
|
336
|
+
baseRefUtil.changeLocale(langName);
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
setFormJson(formJson) {
|
|
340
|
+
let modifiedFlag = false;
|
|
341
|
+
if (!!formJson) {
|
|
342
|
+
if (typeof formJson === "string") {
|
|
343
|
+
let newFormJson = JSON.parse(formJson);
|
|
344
|
+
this.upgradeFormJson(newFormJson);
|
|
345
|
+
modifiedFlag = this.designer.loadFormJson(newFormJson);
|
|
346
|
+
} else if (formJson.constructor === Object) {
|
|
347
|
+
this.upgradeFormJson(formJson);
|
|
348
|
+
modifiedFlag = this.designer.loadFormJson(formJson);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
if (modifiedFlag) {
|
|
352
|
+
this.designer.emitHistoryChange();
|
|
353
|
+
}
|
|
354
|
+
} else {
|
|
355
|
+
this.clearDesigner();
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
getFormJson() {
|
|
360
|
+
return {
|
|
361
|
+
widgetList: baseRefUtil.deepClone(this.designer.widgetList),
|
|
362
|
+
formConfig: baseRefUtil.deepClone(this.designer.formConfig),
|
|
363
|
+
};
|
|
364
|
+
},
|
|
365
|
+
|
|
366
|
+
clearDesigner() {
|
|
367
|
+
this.$refs.toolbarRef.clearFormWidget();
|
|
368
|
+
},
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* 刷新表单设计器
|
|
372
|
+
*/
|
|
373
|
+
refreshDesigner() {
|
|
374
|
+
//this.designer.loadFormJson( this.getFormJson() ) //只有第一次调用生效??
|
|
375
|
+
|
|
376
|
+
let fJson = this.getFormJson();
|
|
377
|
+
this.designer.clearDesigner(true); //不触发历史记录变更
|
|
378
|
+
this.designer.loadFormJson(fJson);
|
|
379
|
+
},
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* 预览表单
|
|
383
|
+
*/
|
|
384
|
+
previewForm() {
|
|
385
|
+
this.$refs.toolbarRef.previewForm();
|
|
386
|
+
},
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* 导入表单JSON
|
|
390
|
+
*/
|
|
391
|
+
importJson() {
|
|
392
|
+
this.$refs.toolbarRef.importJson();
|
|
393
|
+
},
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* 导出表单JSON
|
|
397
|
+
*/
|
|
398
|
+
exportJson() {
|
|
399
|
+
this.$refs.toolbarRef.exportJson();
|
|
400
|
+
},
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* 导出Vue/HTML代码
|
|
404
|
+
*/
|
|
405
|
+
exportCode() {
|
|
406
|
+
this.$refs.toolbarRef.exportCode();
|
|
407
|
+
},
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* 生成SFC代码
|
|
411
|
+
*/
|
|
412
|
+
generateSFC() {
|
|
413
|
+
this.$refs.toolbarRef.generateSFC();
|
|
414
|
+
},
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* 获取所有字段组件
|
|
418
|
+
* @returns {*[]}
|
|
419
|
+
*/
|
|
420
|
+
getFieldWidgets(widgetList = null) {
|
|
421
|
+
return !!widgetList
|
|
422
|
+
? baseRefUtil.getAllFieldWidgets(widgetList)
|
|
423
|
+
: baseRefUtil.getAllFieldWidgets(this.designer.widgetList);
|
|
424
|
+
},
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* 获取所有容器组件
|
|
428
|
+
* @returns {*[]}
|
|
429
|
+
*/
|
|
430
|
+
getContainerWidgets(widgetList = null) {
|
|
431
|
+
return !!widgetList
|
|
432
|
+
? baseRefUtil.getAllContainerWidgets(widgetList)
|
|
433
|
+
: baseRefUtil.getAllContainerWidgets(this.designer.widgetList);
|
|
434
|
+
},
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* 升级表单json,以补充最新的组件属性
|
|
438
|
+
* @param formJson
|
|
439
|
+
*/
|
|
440
|
+
upgradeFormJson(formJson) {
|
|
441
|
+
if (!formJson.widgetList || !formJson.formConfig) {
|
|
442
|
+
this.$message.error("Invalid form json!");
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
traverseAllWidgetsNew(formJson.widgetList, (w) => {
|
|
447
|
+
this.designer.upgradeWidgetConfig(w);
|
|
448
|
+
});
|
|
449
|
+
this.designer.upgradeFormConfig(formJson.formConfig);
|
|
450
|
+
|
|
451
|
+
return formJson;
|
|
452
|
+
},
|
|
453
|
+
|
|
454
|
+
getWidgetRef(widgetName, showError = false) {
|
|
455
|
+
return this.$refs["formRef"].getWidgetRef(widgetName, showError);
|
|
456
|
+
},
|
|
457
|
+
|
|
458
|
+
getSelectedWidgetRef() {
|
|
459
|
+
return this.$refs["formRef"].getSelectedWidgetRef();
|
|
460
|
+
},
|
|
461
|
+
getWfBizDataSettingDTOs(formJson, code) {
|
|
462
|
+
let result = [];
|
|
463
|
+
let formCode = code || this.reportTemplate.formCode;
|
|
464
|
+
let fields = [];
|
|
465
|
+
let fJson = formJson || this.getFormJson();
|
|
466
|
+
let formConfig = fJson.formConfig;
|
|
467
|
+
let entity = formConfig.entity;
|
|
468
|
+
if (!entity) return [];
|
|
469
|
+
if (formConfig.wfTheme) {
|
|
470
|
+
result.push({
|
|
471
|
+
action: "setWfName",
|
|
472
|
+
toValue: formConfig.wfTheme,
|
|
473
|
+
tableName: entity,
|
|
474
|
+
tableField: null,
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
let itemFieldMap = this.itemFieldMap;
|
|
478
|
+
|
|
479
|
+
let loopDo = (widgetList) => {
|
|
480
|
+
if (!widgetList) return;
|
|
481
|
+
widgetList.forEach((widget) => {
|
|
482
|
+
let widgetName = widget.options.name;
|
|
483
|
+
let optionModel = widget.options;
|
|
484
|
+
if (widget.category !== "container") {
|
|
485
|
+
if (optionModel.wfModifyDataEnabled) {
|
|
486
|
+
let wfModifyDataConfig = optionModel.wfModifyDataConfig || [];
|
|
487
|
+
if (wfModifyDataConfig.length) {
|
|
488
|
+
let fieldKeyName = this.getFieldKeyName(widget);
|
|
489
|
+
let items = wfModifyDataConfig
|
|
490
|
+
.filter((item) => {
|
|
491
|
+
return !!item.action;
|
|
492
|
+
})
|
|
493
|
+
.map((item) => {
|
|
494
|
+
return {
|
|
495
|
+
action: item.action,
|
|
496
|
+
toValue: item.toValue,
|
|
497
|
+
tableName: entity,
|
|
498
|
+
tableField: fieldKeyName,
|
|
499
|
+
};
|
|
500
|
+
});
|
|
501
|
+
result.push(...items);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
} else {
|
|
505
|
+
let itemField = itemFieldMap[widget.type];
|
|
506
|
+
if (itemField) {
|
|
507
|
+
if ("table" === widget.type) {
|
|
508
|
+
widget[itemField].forEach((item) => {
|
|
509
|
+
loopDo(item.cols);
|
|
510
|
+
});
|
|
511
|
+
} else if ("h5-table" === widget.type) {
|
|
512
|
+
widget[itemField].forEach((item) => {
|
|
513
|
+
loopDo(item.cols);
|
|
514
|
+
});
|
|
515
|
+
} else {
|
|
516
|
+
loopDo(widget[itemField]);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
};
|
|
522
|
+
loopDo(fJson.widgetList);
|
|
523
|
+
return result;
|
|
524
|
+
},
|
|
525
|
+
getFormTemplateTableDTOs(formJson, code) {
|
|
526
|
+
let formTemplateTableDTOs = [];
|
|
527
|
+
let formCode = code || this.reportTemplate.formCode;
|
|
528
|
+
let fields = [];
|
|
529
|
+
let fJson = formJson || this.getFormJson();
|
|
530
|
+
/*let itemFieldMap = {
|
|
531
|
+
grid: "cols",
|
|
532
|
+
table: "rows",
|
|
533
|
+
"table-cell": "widgetList",
|
|
534
|
+
'h5-table': "rows",
|
|
535
|
+
"h5-table-cell": "widgetList",
|
|
536
|
+
tab: "tabs",
|
|
537
|
+
"tab-pane": "widgetList",
|
|
538
|
+
"grid-col": "widgetList",
|
|
539
|
+
"vf-box": "widgetList",
|
|
540
|
+
"card": "widgetList",
|
|
541
|
+
"detail": "panes",
|
|
542
|
+
"detail-pane": "widgetList",
|
|
543
|
+
"detail-h5": "panes",
|
|
544
|
+
"h5-card": "panes",
|
|
545
|
+
"h5-card-pane": "widgetList",
|
|
546
|
+
}*/
|
|
547
|
+
let itemFieldMap = this.itemFieldMap;
|
|
548
|
+
let loopDo = (widgetList) => {
|
|
549
|
+
if (!widgetList) return;
|
|
550
|
+
widgetList.forEach((widget) => {
|
|
551
|
+
let widgetName = widget.options.name;
|
|
552
|
+
if (
|
|
553
|
+
widget.tableField &&
|
|
554
|
+
(widget.type === "data-table" || widget.type === "list-h5")
|
|
555
|
+
) {
|
|
556
|
+
let vailColumns = widget.options.tableColumns.filter(
|
|
557
|
+
(item) => item.prop && item.label
|
|
558
|
+
);
|
|
559
|
+
let itemFields = [];
|
|
560
|
+
vailColumns.forEach((item) => {
|
|
561
|
+
if (item.formatS === "editSearch") {
|
|
562
|
+
itemFields.push({
|
|
563
|
+
fieldDesc: item.label + "ID",
|
|
564
|
+
fieldName: item.prop,
|
|
565
|
+
});
|
|
566
|
+
let vabSearchName = item?.columnOption?.vabSearchName;
|
|
567
|
+
if (vabSearchName) {
|
|
568
|
+
itemFields.push({
|
|
569
|
+
fieldDesc: item.label,
|
|
570
|
+
fieldName: vabSearchName,
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
} else {
|
|
574
|
+
itemFields.push({
|
|
575
|
+
fieldDesc: item.label,
|
|
576
|
+
fieldName: item.prop,
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
/*let itemFields = widget.options.tableColumns.filter(item => item.prop && item.label).map(item => {
|
|
581
|
+
return {
|
|
582
|
+
fieldDesc: item.label,
|
|
583
|
+
fieldName: item.prop
|
|
584
|
+
}
|
|
585
|
+
})*/
|
|
586
|
+
if (itemFields.length) {
|
|
587
|
+
let formTemplateTable = {
|
|
588
|
+
tableAlias: widgetName,
|
|
589
|
+
formCode: formCode,
|
|
590
|
+
tableType: 1,
|
|
591
|
+
formTemplateFieldDTOs: [],
|
|
592
|
+
};
|
|
593
|
+
formTemplateTable.formTemplateFieldDTOs = itemFields;
|
|
594
|
+
formTemplateTableDTOs.push(formTemplateTable);
|
|
595
|
+
}
|
|
596
|
+
} else if (widget.tableField && widget.type === "vabUpload") {
|
|
597
|
+
let formTemplateTable = {
|
|
598
|
+
tableAlias: widgetName,
|
|
599
|
+
formCode: formCode,
|
|
600
|
+
tableType: 2,
|
|
601
|
+
};
|
|
602
|
+
formTemplateTableDTOs.push(formTemplateTable);
|
|
603
|
+
} else if (widget.tableField && this.isVabsearchFlagWidget(widget)) {
|
|
604
|
+
fields.push({
|
|
605
|
+
fieldDesc: widget.options.label + "ID",
|
|
606
|
+
fieldName: widgetName,
|
|
607
|
+
});
|
|
608
|
+
let vabSearchName = widget.options.vabSearchName;
|
|
609
|
+
if (vabSearchName) {
|
|
610
|
+
fields.push({
|
|
611
|
+
fieldDesc: widget.options.label,
|
|
612
|
+
fieldName: vabSearchName,
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
} else if (widget.tableField) {
|
|
616
|
+
fields.push({
|
|
617
|
+
fieldDesc: widget.options.label,
|
|
618
|
+
fieldName: widgetName,
|
|
619
|
+
});
|
|
620
|
+
} else {
|
|
621
|
+
if (widget.category === "container") {
|
|
622
|
+
let itemField = itemFieldMap[widget.type];
|
|
623
|
+
if (itemField) {
|
|
624
|
+
if ("table" === widget.type) {
|
|
625
|
+
widget[itemField].forEach((item) => {
|
|
626
|
+
loopDo(item.cols);
|
|
627
|
+
});
|
|
628
|
+
} else if ("h5-table" === widget.type) {
|
|
629
|
+
widget[itemField].forEach((item) => {
|
|
630
|
+
loopDo(item.cols);
|
|
631
|
+
});
|
|
632
|
+
} else {
|
|
633
|
+
loopDo(widget[itemField]);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
loopDo(fJson.widgetList);
|
|
642
|
+
if (fields.length) {
|
|
643
|
+
let formTemplateTable = {
|
|
644
|
+
tableAlias: null,
|
|
645
|
+
formCode: formCode,
|
|
646
|
+
tableType: 0,
|
|
647
|
+
formTemplateFieldDTOs: fields,
|
|
648
|
+
};
|
|
649
|
+
formTemplateTableDTOs.push(formTemplateTable);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
return formTemplateTableDTOs;
|
|
653
|
+
},
|
|
654
|
+
isVabsearchFlagWidget(widget) {
|
|
655
|
+
let type = widget?.type;
|
|
656
|
+
return (
|
|
657
|
+
type === "vabsearch" ||
|
|
658
|
+
type === "singerSearch" ||
|
|
659
|
+
type === "multiSearch"
|
|
660
|
+
);
|
|
661
|
+
},
|
|
662
|
+
getTableFileds() {
|
|
663
|
+
let fields = [];
|
|
664
|
+
let fJson = this.getFormJson();
|
|
665
|
+
/*let itemFieldMap = {
|
|
666
|
+
grid: "cols",
|
|
667
|
+
table: "rows",
|
|
668
|
+
"table-cell": "widgetList",
|
|
669
|
+
'h5-table': "rows",
|
|
670
|
+
"h5-table-cell": "widgetList",
|
|
671
|
+
tab: "tabs",
|
|
672
|
+
"tab-pane": "widgetList",
|
|
673
|
+
"grid-col": "widgetList",
|
|
674
|
+
"vf-box": "widgetList",
|
|
675
|
+
"card": "widgetList",
|
|
676
|
+
"detail": "panes",
|
|
677
|
+
"detail-pane": "widgetList",
|
|
678
|
+
"detail-h5": "panes",
|
|
679
|
+
"h5-card": "panes",
|
|
680
|
+
"h5-card-pane": "widgetList",
|
|
681
|
+
}*/
|
|
682
|
+
let itemFieldMap = this.itemFieldMap;
|
|
683
|
+
let loopDo = (widgetList) => {
|
|
684
|
+
if (!widgetList) return;
|
|
685
|
+
widgetList.forEach((widget) => {
|
|
686
|
+
/*if (widget.tableField && widget.type === 'data-table') {
|
|
687
|
+
let itemFields = widget.options.tableColumns.filter(item.prop && item.label).map(item => {
|
|
688
|
+
return {
|
|
689
|
+
fieldDesc: item.options.label,
|
|
690
|
+
fieldName: item.prop
|
|
691
|
+
}
|
|
692
|
+
})
|
|
693
|
+
}*/
|
|
694
|
+
let widgetName = widget.options.name;
|
|
695
|
+
if (widget.tableField) {
|
|
696
|
+
fields.push({
|
|
697
|
+
fieldDesc: widget.options.label,
|
|
698
|
+
fieldName: widgetName,
|
|
699
|
+
});
|
|
700
|
+
} else {
|
|
701
|
+
if (widget.category === "container") {
|
|
702
|
+
let itemField = itemFieldMap[widget.type];
|
|
703
|
+
if (itemField) {
|
|
704
|
+
if ("table" === widget.type) {
|
|
705
|
+
widget[itemField].forEach((item) => {
|
|
706
|
+
loopDo(item.cols);
|
|
707
|
+
});
|
|
708
|
+
} else if ("h5-table" === widget.type) {
|
|
709
|
+
widget[itemField].forEach((item) => {
|
|
710
|
+
loopDo(item.cols);
|
|
711
|
+
});
|
|
712
|
+
} else {
|
|
713
|
+
loopDo(widget[itemField]);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
};
|
|
720
|
+
loopDo(fJson.widgetList);
|
|
721
|
+
return fields;
|
|
722
|
+
},
|
|
723
|
+
getFormScriptDTOs() {
|
|
724
|
+
let reportTemplate = this.reportTemplate;
|
|
725
|
+
let fJson = this.getFormJson();
|
|
726
|
+
let scripts = fJson.formConfig.scriptList || [];
|
|
727
|
+
return scripts
|
|
728
|
+
.filter((item) => {
|
|
729
|
+
return !!item.uuid && !!item.script;
|
|
730
|
+
})
|
|
731
|
+
.map((item) => {
|
|
732
|
+
return {
|
|
733
|
+
formCode: reportTemplate.formCode,
|
|
734
|
+
formVersion: reportTemplate.formVersion,
|
|
735
|
+
scriptCode: item.uuid,
|
|
736
|
+
scriptName: item.uuid,
|
|
737
|
+
script: item.script,
|
|
738
|
+
};
|
|
739
|
+
});
|
|
740
|
+
},
|
|
741
|
+
handleColumnConfirm() {
|
|
742
|
+
let fJson = this.getFormJson();
|
|
743
|
+
this.$emit("customConfirm", fJson);
|
|
744
|
+
},
|
|
745
|
+
saveReportTemplate() {
|
|
746
|
+
if (this.columnFlag) {
|
|
747
|
+
this.handleColumnConfirm();
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
this.openPreformDialog();
|
|
751
|
+
},
|
|
752
|
+
saveDataHandle(preformData) {
|
|
753
|
+
if (this.reportTemplate) {
|
|
754
|
+
let formTemplateTableDTOs = this.getFormTemplateTableDTOs();
|
|
755
|
+
let fJson = this.getFormJson();
|
|
756
|
+
let formViewContent = JSON.stringify(fJson);
|
|
757
|
+
let tableFileds = this.getTableFileds();
|
|
758
|
+
let reportTemplate = baseRefUtil.deepClone(this.reportTemplate);
|
|
759
|
+
reportTemplate.formViewContent = formViewContent;
|
|
760
|
+
reportTemplate.formTemplateTableDTOs = formTemplateTableDTOs;
|
|
761
|
+
|
|
762
|
+
let formScriptDTOs = this.getFormScriptDTOs();
|
|
763
|
+
reportTemplate.formScriptDTOs = formScriptDTOs;
|
|
764
|
+
reportTemplate.hasWf = fJson.formConfig.wfEnabled || false;
|
|
765
|
+
|
|
766
|
+
let wfBizDataSettingDTOs = this.getWfBizDataSettingDTOs();
|
|
767
|
+
|
|
768
|
+
let formData = {
|
|
769
|
+
...reportTemplate,
|
|
770
|
+
wfBizDataSettingDTOs,
|
|
771
|
+
logContent: preformData.logContent,
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
let url = USER_PREFIX + `/formTemplate/updateDesign`;
|
|
775
|
+
this.$http({
|
|
776
|
+
url: url,
|
|
777
|
+
method: `post`,
|
|
778
|
+
data: formData,
|
|
779
|
+
isLoading: true,
|
|
780
|
+
loadingTarget: document.body,
|
|
781
|
+
success: (res) => {
|
|
782
|
+
this.reflushReportTemplate(res.objx);
|
|
783
|
+
this.$message({
|
|
784
|
+
message: res.content,
|
|
785
|
+
type: "success",
|
|
786
|
+
duration: 500,
|
|
787
|
+
onClose: (t) => {},
|
|
788
|
+
});
|
|
789
|
+
this.$emit("reflushTemplateList");
|
|
790
|
+
},
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
},
|
|
794
|
+
openPreformDialog() {
|
|
795
|
+
this.showPreformDialog = true;
|
|
796
|
+
},
|
|
797
|
+
confirmPreformDialog(preformData) {
|
|
798
|
+
this.saveDataHandle(preformData);
|
|
799
|
+
},
|
|
800
|
+
reflushReportTemplate(id) {
|
|
801
|
+
this.$http({
|
|
802
|
+
url: USER_PREFIX + `/formTemplate/get`,
|
|
803
|
+
method: `post`,
|
|
804
|
+
data: {
|
|
805
|
+
id: id,
|
|
806
|
+
},
|
|
807
|
+
isLoading: true,
|
|
808
|
+
loadingTarget: document.body,
|
|
809
|
+
modalStrictly: true,
|
|
810
|
+
success: (res) => {
|
|
811
|
+
let reportTemplate = res.objx || {};
|
|
812
|
+
this.$emit("update:reportTemplate", reportTemplate);
|
|
813
|
+
},
|
|
814
|
+
});
|
|
815
|
+
},
|
|
816
|
+
loadWidgets() {
|
|
817
|
+
this.$refs.widgetPanelRef.loadWidgets();
|
|
818
|
+
},
|
|
819
|
+
getBdEnv() {
|
|
820
|
+
getBdFlag({
|
|
821
|
+
success: (res) => {
|
|
822
|
+
this.isDev = res.objx === 1;
|
|
823
|
+
},
|
|
824
|
+
});
|
|
825
|
+
},
|
|
826
|
+
getMenuKindAuth() {
|
|
827
|
+
let menuKindCode = this.reportTemplate?.menuKindCode;
|
|
828
|
+
if (menuKindCode) {
|
|
829
|
+
this.$http({
|
|
830
|
+
aes: true,
|
|
831
|
+
url: USER_PREFIX + "/menu_kind_auth/getAuth",
|
|
832
|
+
method: `post`,
|
|
833
|
+
data: { stringOne: menuKindCode },
|
|
834
|
+
isLoading: true,
|
|
835
|
+
success: (res) => {
|
|
836
|
+
this.menuKindAuth = res.objx || {};
|
|
837
|
+
},
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
getFieldKeyName(widget) {
|
|
842
|
+
let o = widget.options.name;
|
|
843
|
+
return (widget.options.keyNameEnabled && widget.options.keyName) || o;
|
|
844
|
+
},
|
|
845
|
+
//TODO: 增加更多方法!!
|
|
846
|
+
},
|
|
847
|
+
};
|
|
848
|
+
export default modules;
|