cloud-web-corejs 1.0.54-dev.794 → 1.0.54-dev.796
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/formDialog/README.md +32 -6
- package/src/components/luckysheet/dialog.vue +1 -1
- package/src/components/wf/wfButtonName.js +60 -0
- package/src/components/xform/form-designer/designer.js +2 -1
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +65 -29
- package/src/components/xform/form-designer/form-widget/field-widget/save_submit_wf_button-widget.vue +3 -0
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +111 -8
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/addTableData-event-editor.vue +0 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/clickBindActions.js +253 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/clickBindEvent-editor.vue +49 -40
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/form-host-event-editor.vue +175 -0
- package/src/components/xform/form-designer/setting-panel/property-editor/field-button/search-dialog-event-editor.vue +20 -5
- package/src/components/xform/form-designer/widget-panel/indexMixin.js +2 -1
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +3 -0
- package/src/components/xform/form-render/container-item/data-table-mixin.js +5 -11
- package/src/components/xform/form-render/container-item/detail-item.vue +116 -3
- package/src/components/xform/form-render/index.vue +0 -7
- package/src/components/xform/form-render/indexMixin.js +65 -31
- package/src/components/xform/mixins/defaultHandle.js +50 -38
- package/src/components/xform/utils/util.js +7 -0
- package/src/views/bd/setting/formVersion/ftHistoryDialog.vue +2 -0
- package/src/components/xform/form-designer/form-widget/dialog/formDrawer.vue +0 -307
|
@@ -44,6 +44,14 @@
|
|
|
44
44
|
>下一单<i class="el-icon-arrow-right el-icon--right"></i
|
|
45
45
|
></el-button>
|
|
46
46
|
</template>
|
|
47
|
+
<el-button
|
|
48
|
+
v-if="showSaveSubmitBtn()"
|
|
49
|
+
class="button-sty"
|
|
50
|
+
type="success"
|
|
51
|
+
icon="el-icon-video-play"
|
|
52
|
+
@click="saveAndSubmitWfHandle()"
|
|
53
|
+
>{{ saveSubmitButtonName }}</el-button
|
|
54
|
+
>
|
|
47
55
|
<el-button
|
|
48
56
|
v-if="showWfStartBtn()"
|
|
49
57
|
class="button-sty yyy"
|
|
@@ -120,6 +128,12 @@ import detailPaneWidget from "../../../../components/xform/form-render/container
|
|
|
120
128
|
import FieldComponents from "../../../../components/xform/form-designer/form-widget/field-widget/index";
|
|
121
129
|
|
|
122
130
|
import { initWf, openStartWfDialog } from "../../../../components/wf/wfUtil";
|
|
131
|
+
import {
|
|
132
|
+
getWfButtonNames,
|
|
133
|
+
loadWfButtonNames,
|
|
134
|
+
DEFAULT_SUBMIT_BTN,
|
|
135
|
+
DEFAULT_SAVE_SUBMIT_BTN,
|
|
136
|
+
} from "../../../../components/wf/wfButtonName";
|
|
123
137
|
import settingConfig from "@/settings.js";
|
|
124
138
|
|
|
125
139
|
export default {
|
|
@@ -138,6 +152,10 @@ export default {
|
|
|
138
152
|
created() {
|
|
139
153
|
this.initRefList();
|
|
140
154
|
this.handleOnCreated();
|
|
155
|
+
//只有流程表单才需要按钮名,避免给普通详情页平白多一次请求(模块内全局只发一次)
|
|
156
|
+
if (this.getFormRef()?.formConfig?.wfEnabled) {
|
|
157
|
+
loadWfButtonNames(this);
|
|
158
|
+
}
|
|
141
159
|
},
|
|
142
160
|
mounted() {
|
|
143
161
|
this.handleOnMounted();
|
|
@@ -167,10 +185,18 @@ export default {
|
|
|
167
185
|
showHeader() {
|
|
168
186
|
return !this.plainMode && !this.widget.options.hideHeader;
|
|
169
187
|
},
|
|
188
|
+
// 按钮名取值链:后台 param18 → 全局 settings(老部署兼容) → 默认。
|
|
189
|
+
// 只能用 $t1(找不到 key 原样返回):$t2 的第二参在 i18n 命中 key 时会把自定义名整个覆盖掉。
|
|
170
190
|
wfStartButtonName() {
|
|
171
191
|
return (
|
|
192
|
+
getWfButtonNames().submitBtn ||
|
|
172
193
|
settingConfig.wfStartButtonName ||
|
|
173
|
-
this.$
|
|
194
|
+
this.$t1(DEFAULT_SUBMIT_BTN)
|
|
195
|
+
);
|
|
196
|
+
},
|
|
197
|
+
saveSubmitButtonName() {
|
|
198
|
+
return (
|
|
199
|
+
getWfButtonNames().saveSubmitBtn || this.$t1(DEFAULT_SAVE_SUBMIT_BTN)
|
|
174
200
|
);
|
|
175
201
|
},
|
|
176
202
|
// 「上一单/下一单」翻单按钮状态:详情表单开启 billNavEnabled 且宿主列表有翻单快照时才显示。
|
|
@@ -222,13 +248,100 @@ export default {
|
|
|
222
248
|
let ws = this.wfStart();
|
|
223
249
|
if (!ws || this.previewState) return false;
|
|
224
250
|
let opt = ws.option || {};
|
|
225
|
-
|
|
251
|
+
if (opt.showStartBtn === false || ws.hasWf) return false;
|
|
252
|
+
return this.evalWfStartBtnShow();
|
|
253
|
+
},
|
|
254
|
+
/**
|
|
255
|
+
* 「提交流程」按钮显隐脚本(formConfig.wfStartBtnShow):return false 隐藏,不配则显示。
|
|
256
|
+
* 在渲染期求值,好处是随表单数据自动更新,代价是脚本会被反复执行——所以:
|
|
257
|
+
* 1) 编译结果按脚本原文缓存,避免每次渲染都 new Function;
|
|
258
|
+
* 2) 编译/执行异常一律放行(返回 true),不能因为脚本写错就把提交入口挡死;
|
|
259
|
+
* 3) formData 取轻量的 formRef.formData,不走 getSysFormData/getRealFormData 那套重加工。
|
|
260
|
+
* 脚本里务必只读数据、返回布尔,改数据会引发渲染循环。
|
|
261
|
+
*/
|
|
262
|
+
evalWfStartBtnShow() {
|
|
263
|
+
let formRef = this.getFormRef && this.getFormRef();
|
|
264
|
+
let src = formRef && formRef.formConfig && formRef.formConfig.wfStartBtnShow;
|
|
265
|
+
if (!src) return true;
|
|
266
|
+
let cache = this._wfStartShowFn; //挂实例属性即可,不需要响应式
|
|
267
|
+
if (!cache || cache.src !== src) {
|
|
268
|
+
try {
|
|
269
|
+
cache = {
|
|
270
|
+
src,
|
|
271
|
+
fn: new Function("dataId", "formCode", "formData", src),
|
|
272
|
+
};
|
|
273
|
+
} catch (error) {
|
|
274
|
+
console.error("wfStartBtnShow 脚本编译失败", error);
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
this._wfStartShowFn = cache;
|
|
278
|
+
}
|
|
279
|
+
try {
|
|
280
|
+
let ret = cache.fn.call(
|
|
281
|
+
formRef,
|
|
282
|
+
formRef.dataId,
|
|
283
|
+
formRef.reportTemplate && formRef.reportTemplate.formCode,
|
|
284
|
+
formRef.formData
|
|
285
|
+
);
|
|
286
|
+
return ret !== false;
|
|
287
|
+
} catch (error) {
|
|
288
|
+
console.error("wfStartBtnShow 脚本执行异常", error);
|
|
289
|
+
return true;
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
// 「保存并提交流程」内建按钮:表单设置里 saveSubmitEnabled 开启后渲染,只在新增页显示。
|
|
293
|
+
// 与 showWfStartBtn 一样用方法而非 computed:流程状态是异步就绪的,computed 缓存会漏更新。
|
|
294
|
+
showSaveSubmitBtn() {
|
|
295
|
+
if (this.previewState) return false;
|
|
296
|
+
let formRef = this.getFormRef && this.getFormRef();
|
|
297
|
+
let formConfig = formRef && formRef.formConfig;
|
|
298
|
+
if (!formConfig || !formConfig.wfEnabled || !formConfig.saveSubmitEnabled)
|
|
299
|
+
return false;
|
|
300
|
+
if (formRef.dataId) return false; //只有新增页(编辑态一律不显示)
|
|
301
|
+
let wfParam = formRef.wfParam || {};
|
|
302
|
+
//流程已启动不显示(与 save_submit_wf_button-widget 的 isWfStarted 同口径)
|
|
303
|
+
if (formRef.hasWf || wfParam.hasWf || wfParam.wfInfo?.procInstId)
|
|
304
|
+
return false;
|
|
305
|
+
return true;
|
|
226
306
|
},
|
|
227
307
|
// 声明式触发流程启动(替代原注入按钮的点击),复用 wfUtil 的 openStartWfDialog
|
|
228
308
|
startWf() {
|
|
229
309
|
let ws = this.wfStart();
|
|
230
310
|
if (!ws || !ws.option || !ws.ctx) return;
|
|
231
|
-
|
|
311
|
+
// 启动确认提示语跟随「提交流程按钮名」:包一层现成的 startConfirmText 钩子,
|
|
312
|
+
// 既保住模板脚本 wfStartConfirmText 的最高优先级,又不必改公共的 wf.js
|
|
313
|
+
// (wf.js 默认分支走 $t2(文案, key),i18n 命中 key 会把自定义按钮名吞掉)。
|
|
314
|
+
let inner = ws.option.startConfirmText;
|
|
315
|
+
//只有后台真配了按钮名才改提示语;没配就返空,让 wf.js 走它自己的默认链
|
|
316
|
+
let btnName = getWfButtonNames().submitBtn;
|
|
317
|
+
let innerOnStart = ws.option.onStart;
|
|
318
|
+
let formRef = this.getFormRef && this.getFormRef();
|
|
319
|
+
openStartWfDialog(ws.ctx, {
|
|
320
|
+
...ws.option, //浅拷贝:wfStartOption 是 formRef 上的共享对象,不可原地改
|
|
321
|
+
// 提交前置处理:确认框在 wfStartDialog 内部,这里(打开弹框前)是唯一能拦的位置。
|
|
322
|
+
// 既有的 onStart 是表单校验(仅 wfStartBindSave 开启时注入),把它的 done 换成
|
|
323
|
+
// 「跑前置脚本」,即得到「先校验、后脚本、再确认框」;没开自动保存时直接跑脚本。
|
|
324
|
+
onStart: (done) => {
|
|
325
|
+
let runBefore = () => {
|
|
326
|
+
if (!formRef || typeof formRef.runBeforeSubmitWf !== "function") {
|
|
327
|
+
return done();
|
|
328
|
+
}
|
|
329
|
+
formRef.runBeforeSubmitWf("wfStart").then((pass) => {
|
|
330
|
+
if (pass) done();
|
|
331
|
+
});
|
|
332
|
+
};
|
|
333
|
+
if (typeof innerOnStart === "function") {
|
|
334
|
+
innerOnStart(runBefore);
|
|
335
|
+
} else {
|
|
336
|
+
runBefore();
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
startConfirmText: async (ctx) => {
|
|
340
|
+
let text = typeof inner === "function" ? await inner.call(this, ctx) : inner;
|
|
341
|
+
if (typeof text === "string" && text.trim()) return text; //模板脚本优先
|
|
342
|
+
return btnName ? `您确定要${btnName}吗?` : ""; //返空 → wf.js 走自身默认
|
|
343
|
+
},
|
|
344
|
+
});
|
|
232
345
|
},
|
|
233
346
|
// 触发宿主翻单:step = -1 上一单 / +1 下一单
|
|
234
347
|
navBill(step) {
|
|
@@ -77,11 +77,6 @@
|
|
|
77
77
|
:param="importDialogOption"
|
|
78
78
|
:parentTarget="_self"
|
|
79
79
|
></importDialog>
|
|
80
|
-
<formDrawer
|
|
81
|
-
v-if="showFormDrawer"
|
|
82
|
-
:visiable.sync="showFormDrawer"
|
|
83
|
-
:option="formDrawerOption"
|
|
84
|
-
></formDrawer>
|
|
85
80
|
<fileReferenceDialog
|
|
86
81
|
v-if="showFileReferenceDialog"
|
|
87
82
|
:visiable.sync="showFileReferenceDialog"
|
|
@@ -134,8 +129,6 @@ export default {
|
|
|
134
129
|
import(
|
|
135
130
|
"../../../components/xform/form-designer/form-widget/dialog/importDialog.vue"
|
|
136
131
|
),
|
|
137
|
-
formDrawer: () =>
|
|
138
|
-
import("../../../components/xform/form-designer/form-widget/dialog/formDrawer.vue"),
|
|
139
132
|
fileReferenceDialog: () =>
|
|
140
133
|
import(
|
|
141
134
|
"../../../components/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue"
|
|
@@ -234,8 +234,6 @@ modules = {
|
|
|
234
234
|
formDialogOption: {},
|
|
235
235
|
showImportDialog: false,
|
|
236
236
|
importDialogOption: {},
|
|
237
|
-
formDrawerOption: {},
|
|
238
|
-
showFormDrawer: false,
|
|
239
237
|
userInfo: null,
|
|
240
238
|
userSaleOrgDTOs: [],
|
|
241
239
|
userRoleDTOs: [],
|
|
@@ -1822,6 +1820,46 @@ modules = {
|
|
|
1822
1820
|
);
|
|
1823
1821
|
},
|
|
1824
1822
|
|
|
1823
|
+
/**
|
|
1824
|
+
* 「提交流程」「保存并提交流程」共用的提交前置处理。
|
|
1825
|
+
* 执行时机:表单校验通过之后、确认框弹出之前。两条链路都调这里,业务规则只写一遍。
|
|
1826
|
+
*
|
|
1827
|
+
* 脚本契约(只认返回值,不用 done 回调):
|
|
1828
|
+
* return false → 中止提交
|
|
1829
|
+
* return Promise → 等它 settle;resolve(false) 或 reject 都算中止
|
|
1830
|
+
* 其他(含不写 return) → 放行
|
|
1831
|
+
* 之所以不做成 done 风格:本方法的调用方要 await 它,脚本一旦忘了调 done 就会永久挂起,
|
|
1832
|
+
* 「保存并提交」那条链路还会把 formSavePending 锁死,之后再也保存不了。
|
|
1833
|
+
*
|
|
1834
|
+
* @param {String} source "saveSubmit"(保存并提交流程) | "wfStart"(提交流程)
|
|
1835
|
+
* @returns {Promise<Boolean>} true 继续,false 中止
|
|
1836
|
+
*/
|
|
1837
|
+
runBeforeSubmitWf(source) {
|
|
1838
|
+
let script = this.formConfig?.onBeforeSubmitWf;
|
|
1839
|
+
if (!script) return Promise.resolve(true);
|
|
1840
|
+
let currentFormData = this.getSysFormData(this.getRealFormData());
|
|
1841
|
+
let ret;
|
|
1842
|
+
try {
|
|
1843
|
+
ret = this.handleCustomEvent(
|
|
1844
|
+
script,
|
|
1845
|
+
["formData", "source"],
|
|
1846
|
+
[currentFormData, source]
|
|
1847
|
+
);
|
|
1848
|
+
} catch (error) {
|
|
1849
|
+
//脚本自身报错不放行,避免带着未知状态继续提交
|
|
1850
|
+
console.error("onBeforeSubmitWf 执行异常", error);
|
|
1851
|
+
return Promise.resolve(false);
|
|
1852
|
+
}
|
|
1853
|
+
if (ret === false) return Promise.resolve(false);
|
|
1854
|
+
if (ret && typeof ret.then === "function") {
|
|
1855
|
+
return ret.then(
|
|
1856
|
+
(result) => result !== false,
|
|
1857
|
+
() => false
|
|
1858
|
+
);
|
|
1859
|
+
}
|
|
1860
|
+
return Promise.resolve(true);
|
|
1861
|
+
},
|
|
1862
|
+
|
|
1825
1863
|
handleOnCreated: function () {
|
|
1826
1864
|
this.handleCustomEvent(this.formConfig?.onFormCreated);
|
|
1827
1865
|
/*if (this.formConfig && this.formConfig.onFormCreated) {
|
|
@@ -4489,29 +4527,11 @@ modules = {
|
|
|
4489
4527
|
return Promise.reject(error);
|
|
4490
4528
|
}
|
|
4491
4529
|
},
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
throw new Error("缺少保存后的数据 ID,无法重新加载表单。");
|
|
4498
|
-
}
|
|
4499
|
-
let response = await this.loadFormData({
|
|
4500
|
-
dataId: nextDataId,
|
|
4501
|
-
replace: true,
|
|
4502
|
-
});
|
|
4503
|
-
if (!response || response.type !== "success") {
|
|
4504
|
-
throw new Error(response?.content || "保存后的表单数据重新加载失败。");
|
|
4505
|
-
}
|
|
4506
|
-
if (nextDataId !== undefined && nextDataId !== null) {
|
|
4507
|
-
this.$emit("update:dataId", nextDataId);
|
|
4508
|
-
}
|
|
4509
|
-
if (nextFormCode) {
|
|
4510
|
-
this.$emit("update:formCode", nextFormCode);
|
|
4511
|
-
}
|
|
4512
|
-
await new Promise((resolve) => this.$nextTick(resolve));
|
|
4513
|
-
return response;
|
|
4514
|
-
},
|
|
4530
|
+
// 注:此处曾有 reloadSavedFormData(就地整单取数 + setFormData)。它在表单已挂载时
|
|
4531
|
+
// 逐字段广播赋值,每个字段的 onChange 当场同步执行,先赋值组件的脚本读到的是后赋值
|
|
4532
|
+
// 组件的旧值(getFieldValue 取的是对方尚未刷新的 fieldModel),公式与 keyName 联动
|
|
4533
|
+
// 乱序,getOne 不返回的子表/表头附件字段还会被清空。整单刷新一律走 reloadForm
|
|
4534
|
+
// (宿主 toggle v-if 重挂载),保持「先填满 formDataModel 再挂载组件」这个前提。
|
|
4515
4535
|
saveForm(callback) {
|
|
4516
4536
|
this.validateForm((valid) => {
|
|
4517
4537
|
if (!valid) return;
|
|
@@ -4887,12 +4907,26 @@ modules = {
|
|
|
4887
4907
|
this.showImportDialog = true;
|
|
4888
4908
|
this.importDialogOption = option;
|
|
4889
4909
|
},
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4910
|
+
/**
|
|
4911
|
+
* 表单抽屉:委托给全局 $formDrawer(components/formDrawer)。
|
|
4912
|
+
* 原 xform 内部抽屉壳(dialog/formDrawer.vue)已删除——它零调用方,且 scoped 样式写的是
|
|
4913
|
+
* .el-dialog__body,在 el-drawer 下根本不匹配,内容区没有高度、列表型模板会塌。
|
|
4914
|
+
* 这里保留方法名与回调式签名,存量脚本按内部形态调用也不会断。
|
|
4915
|
+
*/
|
|
4916
|
+
openFormDrawer(option = {}) {
|
|
4917
|
+
let dialogConfig = option.dialogConfig || {};
|
|
4918
|
+
let drawerOption = Object.assign({}, option, option.formConfig, {
|
|
4919
|
+
title: option.title || dialogConfig.title,
|
|
4920
|
+
size: option.size || dialogConfig.size,
|
|
4921
|
+
direction: option.direction || dialogConfig.direction,
|
|
4922
|
+
});
|
|
4923
|
+
delete drawerOption.formConfig;
|
|
4924
|
+
delete drawerOption.dialogConfig;
|
|
4925
|
+
return this.$formDrawer(drawerOption).then((result) => {
|
|
4926
|
+
if (result != null) option.confirm && option.confirm(result);
|
|
4927
|
+
option.close && option.close(null, this);
|
|
4928
|
+
return result;
|
|
4929
|
+
});
|
|
4896
4930
|
},
|
|
4897
4931
|
|
|
4898
4932
|
openFileReferenceDialog(option) {
|
|
@@ -2,6 +2,7 @@ import moment from "moment";
|
|
|
2
2
|
import { saveUserLog } from "@base/api/user";
|
|
3
3
|
import settingConfig from "@/settings";
|
|
4
4
|
import { openStartWfDialog } from "../../../components/wf/wfUtil";
|
|
5
|
+
import { getWfButtonNames } from "../../../components/wf/wfButtonName";
|
|
5
6
|
|
|
6
7
|
let modules = {};
|
|
7
8
|
modules = {
|
|
@@ -148,10 +149,15 @@ modules = {
|
|
|
148
149
|
return;
|
|
149
150
|
}
|
|
150
151
|
|
|
152
|
+
// 提示语跟随后台 param18 下发的按钮名;没配就保持原文案不变。
|
|
153
|
+
// 只能用 $t1(找不到 key 原样返回),$t2 在 i18n 命中 key 时会把拼进去的名字吞掉。
|
|
154
|
+
let btnName = getWfButtonNames().saveSubmitBtn;
|
|
151
155
|
let confirmText =
|
|
152
156
|
option?.confirmText ||
|
|
153
157
|
option?.config?.confirmText ||
|
|
154
|
-
|
|
158
|
+
(btnName
|
|
159
|
+
? this.$t1(`您确定要${btnName}吗?`)
|
|
160
|
+
: this.$t1("您确定要保存并提交流程吗?"));
|
|
155
161
|
|
|
156
162
|
return this.saveDefaultHandle({
|
|
157
163
|
...option,
|
|
@@ -161,6 +167,11 @@ modules = {
|
|
|
161
167
|
isConfirm: option?.config?.isConfirm ?? true,
|
|
162
168
|
confirmText: option?.config?.confirmText || confirmText,
|
|
163
169
|
skipHostReloadAfterSave: true,
|
|
170
|
+
//提交前置处理(与「提交流程」按钮共用同一个表单脚本)
|
|
171
|
+
beforeConfirm: () =>
|
|
172
|
+
formRef.runBeforeSubmitWf
|
|
173
|
+
? formRef.runBeforeSubmitWf("saveSubmit")
|
|
174
|
+
: true,
|
|
164
175
|
success: (res) => {
|
|
165
176
|
// ★ 保存成功后,只升级新增页签的「元数据」为编辑态(设 dataId/isAdd/formCode/标题),
|
|
166
177
|
// 不重渲染详情内容。这样即便随后提交失败/取消候选人弹框,页签也已是编辑态,
|
|
@@ -220,6 +231,15 @@ modules = {
|
|
|
220
231
|
});
|
|
221
232
|
if (!valid) return false;
|
|
222
233
|
|
|
234
|
+
// 提交前置处理:校验通过后、确认框之前拦截。只有「保存并提交流程」入口会传,
|
|
235
|
+
// 普通保存不受影响。返回 false 即中止(finally 里会释放 formSavePending)。
|
|
236
|
+
let beforeConfirm = config.beforeConfirm;
|
|
237
|
+
delete config.beforeConfirm; //不能透传给 formHttp
|
|
238
|
+
if (typeof beforeConfirm === "function") {
|
|
239
|
+
let pass = await beforeConfirm();
|
|
240
|
+
if (pass === false) return false;
|
|
241
|
+
}
|
|
242
|
+
|
|
223
243
|
let submitFormData
|
|
224
244
|
= typeof formRef.buildSubmitPayload === "function"
|
|
225
245
|
? await formRef.buildSubmitPayload()
|
|
@@ -270,14 +290,37 @@ modules = {
|
|
|
270
290
|
if (editFormCode) {
|
|
271
291
|
updateParam.formCode = editFormCode;
|
|
272
292
|
}
|
|
273
|
-
let reloadMethod
|
|
274
|
-
= typeof formRef.reloadSavedFormData === "function"
|
|
275
|
-
? formRef.reloadSavedFormData
|
|
276
|
-
: formRef.reloadForm;
|
|
277
293
|
// 保存成功后一律让宿主整页重挂载(toggle v-if):新增/编辑都需要出流程信息、
|
|
278
|
-
//
|
|
294
|
+
// 切编辑模板、按新状态重算显隐与只读——这些就地取数做不到。
|
|
279
295
|
// 唯一例外是「保存并提交」路径(skipHostReloadAfterSave=true),
|
|
280
296
|
// 它的刷新交给流程结束后的 onWfStartSuccess / onWfStartAbort,避免刷两次。
|
|
297
|
+
//
|
|
298
|
+
// 刷新前只同步「元数据」,绝不做整单 setFormData:表单已挂载时那是逐字段同步
|
|
299
|
+
// 广播赋值,每个字段的 onChange 会当场执行,先赋值组件的脚本读到的是后赋值
|
|
300
|
+
// 组件的旧值,公式与 keyName 联动乱序,子表还会被整体清空(getOne 不返回子表)。
|
|
301
|
+
// 首屏之所以正确,靠的是「先填满 formDataModel 再挂载组件」,就地整单赋值破坏
|
|
302
|
+
// 了这个前提,故整单刷新只能走重挂载。
|
|
303
|
+
let syncSavedMeta = () => {
|
|
304
|
+
let nextDataId = updateParam.dataId;
|
|
305
|
+
if (
|
|
306
|
+
nextDataId !== undefined
|
|
307
|
+
&& nextDataId !== null
|
|
308
|
+
&& nextDataId !== ""
|
|
309
|
+
) {
|
|
310
|
+
// 提交报文的主表以 currentFormData 打底(见 form-render getSubData2),
|
|
311
|
+
// 主键 id 不是表单控件,只能在此回写;否则 skip 路径下再次保存会重复入库。
|
|
312
|
+
if (
|
|
313
|
+
formRef.currentFormData
|
|
314
|
+
&& formRef.currentFormData.id == null
|
|
315
|
+
) {
|
|
316
|
+
formRef.currentFormData.id = nextDataId;
|
|
317
|
+
}
|
|
318
|
+
formRef.$emit("update:dataId", nextDataId);
|
|
319
|
+
}
|
|
320
|
+
if (updateParam.formCode) {
|
|
321
|
+
formRef.$emit("update:formCode", updateParam.formCode);
|
|
322
|
+
}
|
|
323
|
+
};
|
|
281
324
|
let runHostReload = async () => {
|
|
282
325
|
if (skipHostReloadAfterSave) return;
|
|
283
326
|
await formRef.reloadForm({ updateParam });
|
|
@@ -356,38 +399,7 @@ modules = {
|
|
|
356
399
|
};
|
|
357
400
|
showHostReloadFailure(false, error);
|
|
358
401
|
};
|
|
359
|
-
|
|
360
|
-
await reloadMethod.call(formRef, { updateParam });
|
|
361
|
-
} catch (error) {
|
|
362
|
-
keepSaveLocked = true;
|
|
363
|
-
let retryPromise = null;
|
|
364
|
-
formRef.formSaveReconcileTask = () => {
|
|
365
|
-
if (retryPromise) return retryPromise;
|
|
366
|
-
retryPromise = (async () => {
|
|
367
|
-
try {
|
|
368
|
-
await reloadMethod.call(formRef, { updateParam });
|
|
369
|
-
} catch (retryError) {
|
|
370
|
-
showHostReloadFailure(true, retryError);
|
|
371
|
-
retryPromise = null;
|
|
372
|
-
return false;
|
|
373
|
-
}
|
|
374
|
-
let result = await runPostReloadCallbacks();
|
|
375
|
-
try {
|
|
376
|
-
await runHostReload();
|
|
377
|
-
} catch (hostReloadError) {
|
|
378
|
-
installHostReloadRetry(hostReloadError);
|
|
379
|
-
return false;
|
|
380
|
-
}
|
|
381
|
-
clearReconcileState();
|
|
382
|
-
return result;
|
|
383
|
-
})();
|
|
384
|
-
return retryPromise;
|
|
385
|
-
};
|
|
386
|
-
showHostReloadFailure(false, error);
|
|
387
|
-
rejectOnce(error);
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
|
|
402
|
+
syncSavedMeta();
|
|
391
403
|
await runPostReloadCallbacks();
|
|
392
404
|
try {
|
|
393
405
|
await runHostReload();
|
|
@@ -1045,6 +1045,13 @@ export function getDefaultFormConfig() {
|
|
|
1045
1045
|
wfConfig: null,
|
|
1046
1046
|
wfStartBindSave: false,
|
|
1047
1047
|
wfStartConfirmText: null,
|
|
1048
|
+
// 「保存并提交流程」内建按钮:由 detail-item 渲染,只在新增页(dataId 为空)显示。
|
|
1049
|
+
// 按钮名不在此处配,统一由后台 wf_diy_attribute(param18) 下发,见 components/wf/wfButtonName.js
|
|
1050
|
+
saveSubmitEnabled: false,
|
|
1051
|
+
// 「提交流程」「保存并提交流程」共用的提交前置处理脚本:校验通过后、确认框之前执行
|
|
1052
|
+
onBeforeSubmitWf: null,
|
|
1053
|
+
// 「提交流程」按钮显隐脚本:return false 隐藏,不配则显示
|
|
1054
|
+
wfStartBtnShow: null,
|
|
1048
1055
|
wfAgreenBindSave: false,
|
|
1049
1056
|
wfAgreeConfigData: [],
|
|
1050
1057
|
wfConfigDataEnabled: false,
|