fmui-base 2.3.47 → 2.3.48
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/README.md +1 -0
- package/lib/form/table.js +76 -41
- package/lib/form_info/formInfo.js +26 -9
- package/lib/process_info/processInfo.js +82 -23
- package/lib/tblform/README.md +12 -7
- package/lib/tblform/TblForm.js +17 -4
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/form/table.js
CHANGED
|
@@ -165,6 +165,63 @@ function buildFormRelaFieldMapsByRelaField(triggerFieldsMap) {
|
|
|
165
165
|
return relaFieldsMap;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
/**
|
|
169
|
+
* 解析 getRelaFieldsMap 接口返回,写入模块级 triggerFieldsMap,并返回按关联字段分组的 relaFieldsMap
|
|
170
|
+
*/
|
|
171
|
+
function parseRelaFieldsMapResponse(responseData) {
|
|
172
|
+
var formRelaFieldMapsNew = {};
|
|
173
|
+
if (!responseData) {
|
|
174
|
+
formRelaFieldMaps = null;
|
|
175
|
+
return formRelaFieldMapsNew;
|
|
176
|
+
}
|
|
177
|
+
// 兼容新老接口:新结构 {triggerFieldsMap,relaFieldsMap};老结构直接为按触发字段分组的 Map
|
|
178
|
+
if (responseData.triggerFieldsMap) {
|
|
179
|
+
formRelaFieldMaps = responseData.triggerFieldsMap;
|
|
180
|
+
formRelaFieldMapsNew = responseData.relaFieldsMap;
|
|
181
|
+
} else {
|
|
182
|
+
formRelaFieldMaps = responseData;
|
|
183
|
+
formRelaFieldMapsNew = null;
|
|
184
|
+
}
|
|
185
|
+
// 老接口或新接口未返回 relaFieldsMap 时,前端按 sortNo 本地转换,保证联动逻辑一致
|
|
186
|
+
if (!formRelaFieldMapsNew || Object.keys(formRelaFieldMapsNew).length === 0) {
|
|
187
|
+
formRelaFieldMapsNew = buildFormRelaFieldMapsByRelaField(formRelaFieldMaps);
|
|
188
|
+
}
|
|
189
|
+
return formRelaFieldMapsNew || {};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 同步拉取关联字段配置(setId = formRelaField)
|
|
194
|
+
*/
|
|
195
|
+
function fetchFormRelaFieldMapsSync(formId, formRelaField) {
|
|
196
|
+
var formRelaFieldMapsNew = {};
|
|
197
|
+
if (!formRelaField) {
|
|
198
|
+
formRelaFieldMaps = null;
|
|
199
|
+
return formRelaFieldMapsNew;
|
|
200
|
+
}
|
|
201
|
+
$.ajax({
|
|
202
|
+
type: 'GET',
|
|
203
|
+
url: getLoginUserInfo().context + "/api/m/model/formmgr/relafield/getRelaFieldsMap",
|
|
204
|
+
data: {
|
|
205
|
+
formId: formId,
|
|
206
|
+
setId: formRelaField
|
|
207
|
+
},
|
|
208
|
+
headers: {
|
|
209
|
+
Authorization: 'Bearer ' + getLoginUserInfo().token
|
|
210
|
+
},
|
|
211
|
+
dataType: "json",
|
|
212
|
+
async: false,
|
|
213
|
+
success: function success(data) {
|
|
214
|
+
if (data.code == "0") {
|
|
215
|
+
formRelaFieldMapsNew = parseRelaFieldsMapResponse(data.data || {});
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
error: function error() {
|
|
219
|
+
console.log("异常");
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
return formRelaFieldMapsNew;
|
|
223
|
+
}
|
|
224
|
+
|
|
168
225
|
// 构建联动下拉选项(对齐 PC:从联动结果 + 已保存 multiItemsLinkField 取显示文本)
|
|
169
226
|
function buildLinkageSelectOptions(contentValue, relateItemParam, fieldDataItem) {
|
|
170
227
|
var selectOptions = [];
|
|
@@ -242,47 +299,12 @@ var PageHome = function (_React$Component) {
|
|
|
242
299
|
|
|
243
300
|
var defaultValue = props.defaultValue;
|
|
244
301
|
var status = props.status;
|
|
245
|
-
var formRelaField = props.formRelaField; //关联字段
|
|
302
|
+
var formRelaField = props.formRelaField; //关联字段 setId(流程从表单接口带出;纯表单由 props 直接传入)
|
|
246
303
|
var linkFields = props.allForm ? props.allForm.linkFields : ""; //级联字段
|
|
247
304
|
var formId = props.data ? props.data.formId : ""; //表单id
|
|
248
305
|
|
|
249
306
|
//关联字段
|
|
250
|
-
var formRelaFieldMapsNew =
|
|
251
|
-
if (formRelaField) {
|
|
252
|
-
$.ajax({
|
|
253
|
-
type: 'GET',
|
|
254
|
-
url: getLoginUserInfo().context + "/api/m/model/formmgr/relafield/getRelaFieldsMap",
|
|
255
|
-
data: {
|
|
256
|
-
formId: formId,
|
|
257
|
-
setId: formRelaField
|
|
258
|
-
},
|
|
259
|
-
headers: {
|
|
260
|
-
Authorization: 'Bearer ' + getLoginUserInfo().token
|
|
261
|
-
},
|
|
262
|
-
dataType: "json",
|
|
263
|
-
async: false,
|
|
264
|
-
success: function success(data) {
|
|
265
|
-
if (data.code == "0") {
|
|
266
|
-
var responseData = data.data || {};
|
|
267
|
-
// 兼容新老接口:新结构 {triggerFieldsMap,relaFieldsMap};老结构直接为按触发字段分组的 Map
|
|
268
|
-
if (responseData.triggerFieldsMap) {
|
|
269
|
-
formRelaFieldMaps = responseData.triggerFieldsMap;
|
|
270
|
-
formRelaFieldMapsNew = responseData.relaFieldsMap;
|
|
271
|
-
} else {
|
|
272
|
-
formRelaFieldMaps = responseData;
|
|
273
|
-
formRelaFieldMapsNew = null;
|
|
274
|
-
}
|
|
275
|
-
// 老接口或新接口未返回 relaFieldsMap 时,前端按 sortNo 本地转换,保证联动逻辑一致
|
|
276
|
-
if (!formRelaFieldMapsNew || Object.keys(formRelaFieldMapsNew).length === 0) {
|
|
277
|
-
formRelaFieldMapsNew = buildFormRelaFieldMapsByRelaField(formRelaFieldMaps);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
error: function error() {
|
|
282
|
-
console.log("异常");
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
}
|
|
307
|
+
var formRelaFieldMapsNew = fetchFormRelaFieldMapsSync(formId, formRelaField);
|
|
286
308
|
|
|
287
309
|
var linkFieldsNew = {};
|
|
288
310
|
// if(linkFields){
|
|
@@ -420,7 +442,19 @@ var PageHome = function (_React$Component) {
|
|
|
420
442
|
return _this;
|
|
421
443
|
}
|
|
422
444
|
|
|
445
|
+
/**
|
|
446
|
+
* 按 formId + formRelaField(setId) 重新拉取关联字段配置(纯表单 formId/setId 变更时可调用)
|
|
447
|
+
*/
|
|
448
|
+
|
|
449
|
+
|
|
423
450
|
_createClass(PageHome, [{
|
|
451
|
+
key: 'reloadFormRelaFieldMaps',
|
|
452
|
+
value: function reloadFormRelaFieldMaps(formId, formRelaField) {
|
|
453
|
+
var formRelaFieldMapsNew = fetchFormRelaFieldMapsSync(formId, formRelaField);
|
|
454
|
+
this.setState({ formRelaFieldMaps: formRelaFieldMapsNew });
|
|
455
|
+
return formRelaFieldMapsNew;
|
|
456
|
+
}
|
|
457
|
+
}, {
|
|
424
458
|
key: 'componentDidMount',
|
|
425
459
|
value: function componentDidMount() {
|
|
426
460
|
var t = this;
|
|
@@ -436,7 +470,8 @@ var PageHome = function (_React$Component) {
|
|
|
436
470
|
key: 'initFormLinkageAndRelaFields',
|
|
437
471
|
value: function initFormLinkageAndRelaFields() {
|
|
438
472
|
var t = this;
|
|
439
|
-
|
|
473
|
+
// 流程 Table 用 props.data;纯表单 TblForm 用 state.editFormData
|
|
474
|
+
var data = t.props.data || t.state.editFormData;
|
|
440
475
|
if (!data) {
|
|
441
476
|
t._isFormInitialLoading = false;
|
|
442
477
|
return;
|
|
@@ -907,7 +942,7 @@ var PageHome = function (_React$Component) {
|
|
|
907
942
|
key: 'reloadFormRelaField',
|
|
908
943
|
value: function reloadFormRelaField(options) {
|
|
909
944
|
var t = this;
|
|
910
|
-
var data = t.props.data;
|
|
945
|
+
var data = t.props.data || t.state.editFormData;
|
|
911
946
|
var initFlag = options && options.initFlag === true;
|
|
912
947
|
t._isRelaFieldRefreshing = true;
|
|
913
948
|
try {
|
|
@@ -1340,7 +1375,7 @@ var PageHome = function (_React$Component) {
|
|
|
1340
1375
|
if (!relaFieldsMap) {
|
|
1341
1376
|
return;
|
|
1342
1377
|
}
|
|
1343
|
-
var fieldControll = t.props.fieldControll || {};
|
|
1378
|
+
var fieldControll = t.props.fieldControll || t.state.fieldControll || {};
|
|
1344
1379
|
var defaulthideFields = [];
|
|
1345
1380
|
var defaultmustFields = [];
|
|
1346
1381
|
var defaultshowFields = [];
|
|
@@ -1426,7 +1461,7 @@ var PageHome = function (_React$Component) {
|
|
|
1426
1461
|
var defaulthideFields = [];
|
|
1427
1462
|
var defaultshowFields = [];
|
|
1428
1463
|
|
|
1429
|
-
var fieldControll = this.props.fieldControll;
|
|
1464
|
+
var fieldControll = this.props.fieldControll || this.state.fieldControll || {};
|
|
1430
1465
|
var hiddenFields = fieldControll.hiddenFields;
|
|
1431
1466
|
var mustFieldsStr = fieldControll.mustFields;
|
|
1432
1467
|
var showFieldsStr = fieldControll.showFields;
|
|
@@ -528,17 +528,34 @@ var PageHome = function (_React$Component) {
|
|
|
528
528
|
});
|
|
529
529
|
}
|
|
530
530
|
|
|
531
|
+
// 办结状态弹窗:仅待办 type=0 或推送 isPush=1
|
|
532
|
+
var showDoneStatusAlert = String(t.state.listType) === '0' || String(t.state.isPush) === '1';
|
|
533
|
+
if (showDoneStatusAlert) {
|
|
534
|
+
if (content['buttons'] == '' && content['message']) {
|
|
535
|
+
var doneMsgMap = {
|
|
536
|
+
'delete': '此文件已删除',
|
|
537
|
+
'transfer': '此文件已转交',
|
|
538
|
+
'jump': '此文件已跳转',
|
|
539
|
+
'zf': '此文件已作废',
|
|
540
|
+
'end': '此文件已结束',
|
|
541
|
+
'withdraw': '此文件已撤回',
|
|
542
|
+
'back': '此文件已退回',
|
|
543
|
+
'view': '此文件已办理'
|
|
544
|
+
};
|
|
545
|
+
var doneAlert = doneMsgMap[content['message']];
|
|
546
|
+
if (doneAlert) {
|
|
547
|
+
t.setState({
|
|
548
|
+
status: '2'
|
|
549
|
+
});
|
|
550
|
+
_Dialog2.default.alert({
|
|
551
|
+
title: '',
|
|
552
|
+
content: doneAlert
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
531
557
|
if (t.state.listType == '0') {
|
|
532
558
|
var tipsTitle = content['tipsTitle'];
|
|
533
|
-
if (content['buttons'] == '' && content['message'] == 'view') {
|
|
534
|
-
t.setState({
|
|
535
|
-
status: '2'
|
|
536
|
-
});
|
|
537
|
-
_Dialog2.default.alert({
|
|
538
|
-
title: '',
|
|
539
|
-
content: '此文件已办理'
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
559
|
if (t.state.operationDetails != null && t.state.operationDetails != '') {
|
|
543
560
|
if (tipsTitle != null && tipsTitle != '' && tipsTitle != 'undefined') {
|
|
544
561
|
var tipsContent = content['tipsContent'];
|
|
@@ -541,6 +541,9 @@ var PageHome = function (_React$Component) {
|
|
|
541
541
|
param.nextTaskId = '';
|
|
542
542
|
param.autoSendFlag = false; //是否是自动通过选人界面
|
|
543
543
|
param.autoSendText = ''; //自动通过选人界面标题
|
|
544
|
+
param.autoPassCommentSynced = false; //Hold 路径是否已按设置同步意见
|
|
545
|
+
param.autoPassCommentContent = ''; //同步出的源意见原文
|
|
546
|
+
param.autoPassCommentId = '';
|
|
544
547
|
param.nextActivityName = '';
|
|
545
548
|
param.backAttachId = ""; //退回增加附件
|
|
546
549
|
param.backInitList = [];
|
|
@@ -841,9 +844,14 @@ var PageHome = function (_React$Component) {
|
|
|
841
844
|
var shortMessageList1=[];
|
|
842
845
|
var readShortMessageList1=[];*/
|
|
843
846
|
if (!content.code) {
|
|
847
|
+
var failMsg = (content.message || content.msg || '') + '';
|
|
848
|
+
var alertContent = '此文件已作废';
|
|
849
|
+
if (failMsg.indexOf('删除') >= 0) {
|
|
850
|
+
alertContent = '此文件已删除';
|
|
851
|
+
}
|
|
844
852
|
_Dialog2.default.alert({
|
|
845
853
|
title: '',
|
|
846
|
-
content:
|
|
854
|
+
content: alertContent
|
|
847
855
|
});
|
|
848
856
|
if (isPush == '1') {
|
|
849
857
|
closePage();
|
|
@@ -1151,25 +1159,34 @@ var PageHome = function (_React$Component) {
|
|
|
1151
1159
|
});
|
|
1152
1160
|
}
|
|
1153
1161
|
|
|
1162
|
+
// 办结状态弹窗:仅待办 type=0 或推送 isPush=1(推送待办 listType 仍为 0)
|
|
1163
|
+
var showDoneStatusAlert = String(t.state.listType) === '0' || String(t.state.isPush) === '1';
|
|
1164
|
+
if (showDoneStatusAlert) {
|
|
1165
|
+
if (content['buttons'] == '' && content['message']) {
|
|
1166
|
+
var doneMsgMap = {
|
|
1167
|
+
'delete': '此文件已删除',
|
|
1168
|
+
'transfer': '此文件已转交',
|
|
1169
|
+
'jump': '此文件已跳转',
|
|
1170
|
+
'zf': '此文件已作废',
|
|
1171
|
+
'end': '此文件已结束',
|
|
1172
|
+
'withdraw': '此文件已撤回',
|
|
1173
|
+
'back': '此文件已退回',
|
|
1174
|
+
'view': '此文件已办理'
|
|
1175
|
+
};
|
|
1176
|
+
var doneAlert = doneMsgMap[content['message']];
|
|
1177
|
+
if (doneAlert) {
|
|
1178
|
+
t.setState({
|
|
1179
|
+
status: '2'
|
|
1180
|
+
});
|
|
1181
|
+
_Dialog2.default.alert({
|
|
1182
|
+
title: '',
|
|
1183
|
+
content: doneAlert
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1154
1188
|
if (t.state.listType == '0') {
|
|
1155
1189
|
var tipsTitle = content['tipsTitle'];
|
|
1156
|
-
if (content['buttons'] == '' && content['message'] == 'delete') {
|
|
1157
|
-
t.setState({
|
|
1158
|
-
status: '2'
|
|
1159
|
-
});
|
|
1160
|
-
_Dialog2.default.alert({
|
|
1161
|
-
title: '',
|
|
1162
|
-
content: '该流程已被删除'
|
|
1163
|
-
});
|
|
1164
|
-
} else if (content['buttons'] == '' && content['message'] == 'view') {
|
|
1165
|
-
t.setState({
|
|
1166
|
-
status: '2'
|
|
1167
|
-
});
|
|
1168
|
-
_Dialog2.default.alert({
|
|
1169
|
-
title: '',
|
|
1170
|
-
content: '此文件已办理'
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
1190
|
if (t.state.operationDetails != null && t.state.operationDetails != '') {
|
|
1174
1191
|
if (tipsTitle != null && tipsTitle != '' && tipsTitle != 'undefined') {
|
|
1175
1192
|
var tipsContent = content['tipsContent'];
|
|
@@ -2304,6 +2321,18 @@ var PageHome = function (_React$Component) {
|
|
|
2304
2321
|
if (operate == 3) {
|
|
2305
2322
|
commentRequired = commentRequired && isSysTransferCommentRequired();
|
|
2306
2323
|
}
|
|
2324
|
+
// 自动通过继续办理:有同步则预填;查不到也不拦截弹窗
|
|
2325
|
+
if (t.state.autoSendFlag) {
|
|
2326
|
+
commentRequired = false;
|
|
2327
|
+
if (t.state.autoPassCommentSynced && t.state.autoPassCommentContent) {
|
|
2328
|
+
newComment = t.state.autoPassCommentContent;
|
|
2329
|
+
t.setState({
|
|
2330
|
+
spyj: newComment,
|
|
2331
|
+
defaultValue: newComment,
|
|
2332
|
+
newspyj: Object.assign({}, t.state.newspyj, { content: newComment })
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2307
2336
|
if (commentRequired) {
|
|
2308
2337
|
//不可为空
|
|
2309
2338
|
var documentId = t.state.newspyj.documentId;
|
|
@@ -4007,7 +4036,17 @@ var PageHome = function (_React$Component) {
|
|
|
4007
4036
|
return false;
|
|
4008
4037
|
}
|
|
4009
4038
|
} else if (hasCommentField == '1' && defaultComValue == '') {
|
|
4010
|
-
if (
|
|
4039
|
+
if (t.state.autoSendFlag) {
|
|
4040
|
+
// 自动通过继续办理:查不到同步意见也不拦截
|
|
4041
|
+
if (t.state.autoPassCommentSynced && t.state.autoPassCommentContent) {
|
|
4042
|
+
newComment = t.state.autoPassCommentContent;
|
|
4043
|
+
t.setState({
|
|
4044
|
+
spyj: newComment,
|
|
4045
|
+
defaultValue: newComment,
|
|
4046
|
+
newspyj: Object.assign({}, t.state.newspyj, { content: newComment })
|
|
4047
|
+
});
|
|
4048
|
+
}
|
|
4049
|
+
} else if (commentIsNull == '1' || commentIsNotNull == '1') {
|
|
4011
4050
|
//不可为空
|
|
4012
4051
|
_Toast2.default.show({
|
|
4013
4052
|
type: 'error',
|
|
@@ -5334,7 +5373,7 @@ var PageHome = function (_React$Component) {
|
|
|
5334
5373
|
dataId: t.state.dataId,
|
|
5335
5374
|
formId: t.state.formId
|
|
5336
5375
|
}).then(function (content) {
|
|
5337
|
-
if (!content || content.message === 'delete' || content.message === 'view' || content.buttons === '') {
|
|
5376
|
+
if (!content || content.message === 'delete' || content.message === 'view' || content.message === 'transfer' || content.message === 'jump' || content.message === 'zf' || content.message === 'end' || content.message === 'withdraw' || content.message === 'back' || content.buttons === '') {
|
|
5338
5377
|
_Toast2.default.show({ type: 'error', content: '流程已被他人办理' });
|
|
5339
5378
|
setTimeout(function () {
|
|
5340
5379
|
if (t.state.isPush == '1') {
|
|
@@ -5547,20 +5586,40 @@ var PageHome = function (_React$Component) {
|
|
|
5547
5586
|
nextTaskId = content.nextTaskId;
|
|
5548
5587
|
autoSendText = content.nextTaskName;
|
|
5549
5588
|
newdataId = content.dataId;
|
|
5589
|
+
var synced = content.autoPassCommentSynced === true || content.autoPassCommentSynced === 'true' || content.autoPassCommentSynced === 1 || content.autoPassCommentSynced === '1';
|
|
5590
|
+
var syncedContent = content.autoPassCommentContent || '';
|
|
5591
|
+
var syncedId = content.autoPassCommentId || '';
|
|
5550
5592
|
try {
|
|
5551
5593
|
t.handleCancelClick();
|
|
5552
5594
|
} catch (e) {}
|
|
5553
|
-
|
|
5595
|
+
var nextState = {
|
|
5554
5596
|
autoSendFlag: true,
|
|
5555
5597
|
taskId: nextTaskId,
|
|
5556
5598
|
nextTaskId: nextTaskId,
|
|
5557
5599
|
operate: 1,
|
|
5558
5600
|
autoSendText: autoSendText,
|
|
5559
|
-
dataId: newdataId
|
|
5560
|
-
|
|
5601
|
+
dataId: newdataId,
|
|
5602
|
+
autoPassCommentSynced: !!synced,
|
|
5603
|
+
autoPassCommentContent: syncedContent,
|
|
5604
|
+
autoPassCommentId: syncedId
|
|
5605
|
+
};
|
|
5606
|
+
if (synced && syncedContent) {
|
|
5607
|
+
nextState.defaultValue = syncedContent;
|
|
5608
|
+
nextState.spyj = syncedContent;
|
|
5609
|
+
nextState.newspyj = Object.assign({}, t.state.newspyj, { content: syncedContent });
|
|
5610
|
+
}
|
|
5611
|
+
if (synced && syncedId) {
|
|
5612
|
+
nextState.commentId = syncedId;
|
|
5613
|
+
}
|
|
5614
|
+
t.setState(nextState, function () {
|
|
5561
5615
|
t.handleSubmit(1);
|
|
5562
5616
|
});
|
|
5563
5617
|
} else {
|
|
5618
|
+
t.setState({
|
|
5619
|
+
autoPassCommentSynced: false,
|
|
5620
|
+
autoPassCommentContent: '',
|
|
5621
|
+
autoPassCommentId: ''
|
|
5622
|
+
});
|
|
5564
5623
|
if (isSub == '1') {
|
|
5565
5624
|
backPage(2);
|
|
5566
5625
|
}
|
package/lib/tblform/README.md
CHANGED
|
@@ -30,7 +30,7 @@ src/tblform/
|
|
|
30
30
|
|
|
31
31
|
| 能力 | `form/table`(流程) | `tblform/TblForm`(纯表单) |
|
|
32
32
|
|------|----------------------|------------------------------|
|
|
33
|
-
| 入参 | 大量流程参数(批示意见、commentField 等) |
|
|
33
|
+
| 入参 | 大量流程参数(批示意见、commentField 等) | **formId、editType、dataId**;可选 **formRelaField**(关联设置 setId,直接入参) |
|
|
34
34
|
| 数据加载 | 流程接口 `getMobileForm` | `getPureMobileForm` |
|
|
35
35
|
| 数据保存 | `saveForm`(流程草稿) | `runtimeDataSave` |
|
|
36
36
|
| 批示意见 UI | 内置 | 无(可用 `FlowCommentPane` 单独挂载) |
|
|
@@ -142,14 +142,18 @@ export default class PureFormPage extends React.Component {
|
|
|
142
142
|
| `editType` | string | `'add'` | 编辑类型,见下表 |
|
|
143
143
|
| `dataId` | string | `''` | 数据 ID |
|
|
144
144
|
| `formCode` | string | `''` | 扩展编码;不传则使用接口返回的 `form.formcode` |
|
|
145
|
+
| `formRelaField` | string | `''` | 关联字段设置 setId;**直接入参**,无需从流程/表单加载接口获取。有值时内部请求 `getRelaFieldsMap` 启用字段关联(显隐/必填等) |
|
|
145
146
|
|
|
146
|
-
|
|
147
|
+
```jsx
|
|
148
|
+
<TblForm
|
|
149
|
+
formId="4028b28a9cf4442a019cf45667820020"
|
|
150
|
+
editType="add"
|
|
151
|
+
dataId=""
|
|
152
|
+
formRelaField="4028b2c6a03bd3a401a03d9421b00bfb"
|
|
153
|
+
/>
|
|
154
|
+
```
|
|
147
155
|
|
|
148
|
-
|
|
149
|
-
|----------|--------|----------|
|
|
150
|
-
| `add` | `0` | 可编辑(新增) |
|
|
151
|
-
| `edit` | `1` | 可编辑(修改) |
|
|
152
|
-
| `view` | `2` | 只读(查看) |
|
|
156
|
+
> 流程场景下 `formRelaField` 由 `getMobileForm` 等接口返回;纯表单场景不依赖该接口,由业务页直接传入关联设置 ID 即可。
|
|
153
157
|
|
|
154
158
|
### 回调参数(可选)
|
|
155
159
|
|
|
@@ -489,4 +493,5 @@ onSaveSuccess={(result) => {
|
|
|
489
493
|
|
|
490
494
|
| 版本 | 说明 |
|
|
491
495
|
|------|------|
|
|
496
|
+
| 1.0.1 | 支持 props 直接传入 `formRelaField`(关联设置 setId),启用字段关联 |
|
|
492
497
|
| 1.0.0 | 初始版本:纯表单加载/保存、form_common 扩展、FlowCommentPane 分离 |
|
package/lib/tblform/TblForm.js
CHANGED
|
@@ -54,7 +54,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
54
54
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
55
55
|
|
|
56
56
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
|
|
57
|
-
*
|
|
57
|
+
* 纯表单容器:接收 formId、editType、dataId,可选 formRelaField(关联设置 setId,直接入参,无需从流程接口获取)
|
|
58
|
+
* 内部请求 getPureMobileForm 并渲染表单
|
|
58
59
|
*/
|
|
59
60
|
|
|
60
61
|
|
|
@@ -66,7 +67,7 @@ var TblForm = function (_BaseTable) {
|
|
|
66
67
|
|
|
67
68
|
var _this = _possibleConstructorReturn(this, (TblForm.__proto__ || Object.getPrototypeOf(TblForm)).call(this, {
|
|
68
69
|
module: '',
|
|
69
|
-
formRelaField: '',
|
|
70
|
+
formRelaField: props.formRelaField || '',
|
|
70
71
|
defaultValue: '',
|
|
71
72
|
data: { formId: props.formId },
|
|
72
73
|
allForm: {}
|
|
@@ -100,7 +101,7 @@ var TblForm = function (_BaseTable) {
|
|
|
100
101
|
}, {
|
|
101
102
|
key: 'componentDidUpdate',
|
|
102
103
|
value: function componentDidUpdate(prevProps) {
|
|
103
|
-
if (prevProps.formId !== this.props.formId || prevProps.editType !== this.props.editType || prevProps.dataId !== this.props.dataId) {
|
|
104
|
+
if (prevProps.formId !== this.props.formId || prevProps.editType !== this.props.editType || prevProps.dataId !== this.props.dataId || prevProps.formRelaField !== this.props.formRelaField) {
|
|
104
105
|
this.loadPureForm();
|
|
105
106
|
}
|
|
106
107
|
}
|
|
@@ -111,7 +112,8 @@ var TblForm = function (_BaseTable) {
|
|
|
111
112
|
var _props = this.props,
|
|
112
113
|
formId = _props.formId,
|
|
113
114
|
editType = _props.editType,
|
|
114
|
-
dataId = _props.dataId
|
|
115
|
+
dataId = _props.dataId,
|
|
116
|
+
formRelaField = _props.formRelaField;
|
|
115
117
|
|
|
116
118
|
if (!formId) {
|
|
117
119
|
t.setState({ loading: false, loadError: '缺少 formId' });
|
|
@@ -120,6 +122,13 @@ var TblForm = function (_BaseTable) {
|
|
|
120
122
|
|
|
121
123
|
t.setState({ loading: true, loadError: '' });
|
|
122
124
|
|
|
125
|
+
// formId / formRelaField 变更时刷新关联字段配置(构造时已按入参拉过一次)
|
|
126
|
+
if (formRelaField) {
|
|
127
|
+
t.reloadFormRelaFieldMaps(formId, formRelaField);
|
|
128
|
+
} else {
|
|
129
|
+
t.reloadFormRelaFieldMaps(formId, '');
|
|
130
|
+
}
|
|
131
|
+
|
|
123
132
|
_db2.default.form.getPureMobileForm({
|
|
124
133
|
formId: formId,
|
|
125
134
|
editType: editType || 'add',
|
|
@@ -143,6 +152,10 @@ var TblForm = function (_BaseTable) {
|
|
|
143
152
|
savedDataId: loadedDataId,
|
|
144
153
|
formCode: formCode
|
|
145
154
|
}, function () {
|
|
155
|
+
// 表单数据就绪后再跑一遍关联初始化,与流程 Table.componentDidMount 对齐
|
|
156
|
+
setTimeout(function () {
|
|
157
|
+
t.initFormLinkageAndRelaFields();
|
|
158
|
+
}, 500);
|
|
146
159
|
if (typeof t.props.onLoad === 'function') {
|
|
147
160
|
t.props.onLoad(normalized.editFormData, normalized);
|
|
148
161
|
}
|