fmui-base 2.3.7 → 2.3.8
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/form.js +11 -0
- package/lib/form/formExtHelper.js +161 -0
- package/lib/form/subForm.js +139 -42
- package/lib/nvoice/index.js +16 -0
- package/lib/nvoice/nvoice.js +177 -0
- package/lib/nvoice/nvoice.less +0 -0
- package/lib/tblform/FlowCommentPane.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/form/form.js
CHANGED
|
@@ -1610,6 +1610,10 @@ var PageHome = function (_React$Component) {
|
|
|
1610
1610
|
}
|
|
1611
1611
|
if (t.props.dataType === 'sub') {
|
|
1612
1612
|
t.applySubFormLabelStyle(itemParam);
|
|
1613
|
+
// 子表多列:loadComponet 完成后同步排版(预判与 ref 不一致时需重排)
|
|
1614
|
+
if (t.props.onSubFieldLayoutChange) {
|
|
1615
|
+
t.props.onSubFieldLayoutChange();
|
|
1616
|
+
}
|
|
1613
1617
|
}
|
|
1614
1618
|
this.props.onChange(data, itemParam);
|
|
1615
1619
|
});
|
|
@@ -2047,6 +2051,7 @@ var PageHome = function (_React$Component) {
|
|
|
2047
2051
|
var itemParam = this.state.itemParam;
|
|
2048
2052
|
var selectText = ''; //多选值修改的显示文本
|
|
2049
2053
|
var checkboxValueHas = false; //是否有多选值修改
|
|
2054
|
+
var layoutNeedRefresh = false;
|
|
2050
2055
|
for (var i = 0; i < itemNew.length; i++) {
|
|
2051
2056
|
var key = itemNew[i].key;
|
|
2052
2057
|
if (key == 'value') {
|
|
@@ -2099,6 +2104,9 @@ var PageHome = function (_React$Component) {
|
|
|
2099
2104
|
if (key == 'isHidden' && itemNew[i].value) {
|
|
2100
2105
|
itemParam.required = false;
|
|
2101
2106
|
}
|
|
2107
|
+
if (key === 'isHidden') {
|
|
2108
|
+
layoutNeedRefresh = true;
|
|
2109
|
+
}
|
|
2102
2110
|
}
|
|
2103
2111
|
}
|
|
2104
2112
|
this.setState({
|
|
@@ -2130,6 +2138,9 @@ var PageHome = function (_React$Component) {
|
|
|
2130
2138
|
var formData = this.props.data;
|
|
2131
2139
|
this.dealwithData(itemParam, formData.mainTblData || [], formData.relatedTbl || []);
|
|
2132
2140
|
}
|
|
2141
|
+
if (layoutNeedRefresh && this.props.dataType === 'sub' && this.props.onSubFieldLayoutChange) {
|
|
2142
|
+
this.props.onSubFieldLayoutChange();
|
|
2143
|
+
}
|
|
2133
2144
|
if (!silent && this.props.onChange) {
|
|
2134
2145
|
this.props.onChange(this.props.data, itemParam);
|
|
2135
2146
|
}
|
|
@@ -9,6 +9,10 @@ exports.clampSubColumnCount = clampSubColumnCount;
|
|
|
9
9
|
exports.buildDetailItemParam = buildDetailItemParam;
|
|
10
10
|
exports.applyDealwithFormParamExt = applyDealwithFormParamExt;
|
|
11
11
|
exports.resolveSubColumnCountFromConfig = resolveSubColumnCountFromConfig;
|
|
12
|
+
exports.normalizeRelaTriggerValue = normalizeRelaTriggerValue;
|
|
13
|
+
exports.isRelaRuleMatched = isRelaRuleMatched;
|
|
14
|
+
exports.getRelaTriggerFieldValueForLayout = getRelaTriggerFieldValueForLayout;
|
|
15
|
+
exports.resolveFieldRelaHidden = resolveFieldRelaHidden;
|
|
12
16
|
exports.mapCommentAttitudeSaveValue = mapCommentAttitudeSaveValue;
|
|
13
17
|
/**
|
|
14
18
|
* 表单扩展加载:流程 flow_common / 纯表单 form_common
|
|
@@ -228,6 +232,163 @@ function resolveSubColumnCountFromConfig(options) {
|
|
|
228
232
|
return 1;
|
|
229
233
|
}
|
|
230
234
|
|
|
235
|
+
/** 关联触发值规范化(与 form.jsx / table.jsx normalizeRelaTriggerValue 一致) */
|
|
236
|
+
function normalizeRelaTriggerValue(nowValue) {
|
|
237
|
+
if (nowValue == null || typeof nowValue === 'undefined') {
|
|
238
|
+
return '';
|
|
239
|
+
}
|
|
240
|
+
nowValue = String(nowValue);
|
|
241
|
+
if (nowValue.indexOf('[') >= 0 && nowValue.indexOf(']') >= 0) {
|
|
242
|
+
try {
|
|
243
|
+
var nowValueArray = JSON.parse(nowValue);
|
|
244
|
+
if (nowValueArray.length === 1) {
|
|
245
|
+
return nowValueArray[0];
|
|
246
|
+
}
|
|
247
|
+
return nowValueArray.join(',');
|
|
248
|
+
} catch (e) {
|
|
249
|
+
return nowValue;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (nowValue !== '' && (nowValue.indexOf('$#$#') >= 0 || nowValue.indexOf('#$#$') >= 0)) {
|
|
253
|
+
if (nowValue.indexOf('#$#$') >= 0) {
|
|
254
|
+
var nowValueList = nowValue.split('#$#$');
|
|
255
|
+
if (nowValueList.length === 1) {
|
|
256
|
+
return nowValueList[0].replace(/\$#\$#/g, '');
|
|
257
|
+
}
|
|
258
|
+
return nowValueList.map(function (item) {
|
|
259
|
+
return item.replace(/\$#\$#/g, '');
|
|
260
|
+
}).join(',');
|
|
261
|
+
}
|
|
262
|
+
return nowValue.replace(/\$#\$#/g, '');
|
|
263
|
+
}
|
|
264
|
+
return nowValue;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** 关联规则是否命中(与 form.jsx isRelaRuleMatched 一致) */
|
|
268
|
+
function isRelaRuleMatched(rule, nowValue) {
|
|
269
|
+
var triggerFieldVal = rule.triggerFieldVal;
|
|
270
|
+
if (triggerFieldVal == ' ') {
|
|
271
|
+
triggerFieldVal = '';
|
|
272
|
+
}
|
|
273
|
+
if (triggerFieldVal === '') {
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
nowValue = nowValue == null ? '' : String(nowValue);
|
|
277
|
+
return triggerFieldVal == nowValue || nowValue.split(',').indexOf(triggerFieldVal) !== -1;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** 读取关联触发字段当前值(布局预判,与 form.jsx 子表场景一致) */
|
|
281
|
+
function getRelaTriggerFieldValueForLayout(rule, fullFormData, rowIndex) {
|
|
282
|
+
var nowValue = '';
|
|
283
|
+
if (!rule || !fullFormData) {
|
|
284
|
+
return '';
|
|
285
|
+
}
|
|
286
|
+
var mainTblName = fullFormData.mainTblName;
|
|
287
|
+
var mainTblData = fullFormData.mainTblData || [];
|
|
288
|
+
if (rule.triggerTblName === mainTblName) {
|
|
289
|
+
for (var i = 0; i < mainTblData.length; i++) {
|
|
290
|
+
if (mainTblData[i].key === rule.triggerFieldName) {
|
|
291
|
+
nowValue = mainTblData[i].value ? mainTblData[i].value : '';
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
} else if (fullFormData.subTbl && fullFormData.subTbl.length > 0) {
|
|
296
|
+
var ridx = typeof rowIndex !== 'undefined' ? rowIndex : 0;
|
|
297
|
+
for (var j = 0; j < fullFormData.subTbl.length; j++) {
|
|
298
|
+
var subItem = fullFormData.subTbl[j];
|
|
299
|
+
if (subItem.subTblName === rule.triggerTblName && subItem.subTblData && subItem.subTblData.length > ridx) {
|
|
300
|
+
var subRow = subItem.subTblData[ridx];
|
|
301
|
+
for (var k = 0; k < subRow.length; k++) {
|
|
302
|
+
if (subRow[k].key === rule.triggerFieldName) {
|
|
303
|
+
nowValue = subRow[k].value ? subRow[k].value : '';
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return normalizeRelaTriggerValue(nowValue);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* 预判字段是否被关联规则隐藏(与 form.jsx dealwithRelaField 的 isHidden 逻辑一致)
|
|
314
|
+
* 用于子表多列首帧排版,避免等待 Form ref 就绪才隐藏。
|
|
315
|
+
*/
|
|
316
|
+
function resolveFieldRelaHidden(options) {
|
|
317
|
+
options = options || {};
|
|
318
|
+
var uniqueName = options.uniqueName;
|
|
319
|
+
var formRelaFieldMaps = options.formRelaFieldMaps;
|
|
320
|
+
var fieldControll = options.fieldControll || {};
|
|
321
|
+
var formReadOnly = !!options.formReadOnly;
|
|
322
|
+
|
|
323
|
+
if (!uniqueName || !formRelaFieldMaps || !formRelaFieldMaps[uniqueName]) {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
var defaulthideFields = [];
|
|
328
|
+
var defaultshowFields = [];
|
|
329
|
+
var defaultmustFields = [];
|
|
330
|
+
if (fieldControll.hiddenFields) {
|
|
331
|
+
fieldControll.hiddenFields.split(',').forEach(function (f) {
|
|
332
|
+
if (f) {
|
|
333
|
+
defaulthideFields.push(f);
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
if (fieldControll.showFields) {
|
|
338
|
+
fieldControll.showFields.split(',').forEach(function (f) {
|
|
339
|
+
if (f) {
|
|
340
|
+
defaultshowFields.push(f);
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
if (fieldControll.mustFields) {
|
|
345
|
+
fieldControll.mustFields.split(',').forEach(function (f) {
|
|
346
|
+
if (f) {
|
|
347
|
+
defaultmustFields.push(f);
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
var baseline = {
|
|
353
|
+
isHidden: defaulthideFields.indexOf(uniqueName) !== -1 || !!options.baselineHidden,
|
|
354
|
+
required: defaultmustFields.indexOf(uniqueName) !== -1 || options.fieldValid === true,
|
|
355
|
+
readOnly: defaultshowFields.indexOf(uniqueName) !== -1 || formReadOnly
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
var skipEditMust = defaultshowFields.indexOf(uniqueName) !== -1 || defaultmustFields.indexOf(uniqueName) !== -1 || baseline.readOnly === true || formReadOnly;
|
|
359
|
+
|
|
360
|
+
var isHidden = baseline.isHidden;
|
|
361
|
+
var hideFlag = baseline.isHidden;
|
|
362
|
+
var mustFlag = baseline.required;
|
|
363
|
+
|
|
364
|
+
var rules = formRelaFieldMaps[uniqueName];
|
|
365
|
+
var sortedRules = rules.slice().sort(function (a, b) {
|
|
366
|
+
return (parseInt(a.sortNo, 10) || 0) - (parseInt(b.sortNo, 10) || 0);
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
for (var ri = sortedRules.length - 1; ri >= 0; ri--) {
|
|
370
|
+
var rule = sortedRules[ri];
|
|
371
|
+
var nowValue = getRelaTriggerFieldValueForLayout(rule, options.fullFormData, options.rowIndex);
|
|
372
|
+
var matched = isRelaRuleMatched(rule, nowValue);
|
|
373
|
+
var editType = rule.editType;
|
|
374
|
+
if (editType === 'hide' || editType === 'rowhide') {
|
|
375
|
+
if (matched) {
|
|
376
|
+
isHidden = true;
|
|
377
|
+
hideFlag = true;
|
|
378
|
+
} else if (!hideFlag) {
|
|
379
|
+
isHidden = baseline.isHidden;
|
|
380
|
+
}
|
|
381
|
+
} else if (editType === 'must') {
|
|
382
|
+
if (!skipEditMust && matched && !hideFlag) {
|
|
383
|
+
mustFlag = true;
|
|
384
|
+
isHidden = false;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return !!isHidden;
|
|
390
|
+
}
|
|
391
|
+
|
|
231
392
|
/** 批示意见态度显示值转存库值(与 PC comment_idea_radio 一致) */
|
|
232
393
|
function mapCommentAttitudeSaveValue(displayValue) {
|
|
233
394
|
var val = displayValue == null ? '' : String(displayValue);
|
package/lib/form/subForm.js
CHANGED
|
@@ -584,7 +584,112 @@ var PageHome = function (_React$Component) {
|
|
|
584
584
|
var text = scope + ' .subform-col-field-slot-text';
|
|
585
585
|
var pick = scope + ' .subform-col-field-slot-pick';
|
|
586
586
|
var pickCol = pick + ' ' + col;
|
|
587
|
-
return _react2.default.createElement('style', { dangerouslySetInnerHTML: { __html: [scope + '{display:block;}', row + '{display:flex;align-items:stretch;width:100%;border-bottom:0.5px solid #e9ebee;box-sizing:border-box;}', scope + ' .subform-field-full{width:100%;box-sizing:border-box;border-bottom:0.5px solid #e9ebee;}', scope + ' .subform-field-col{display:flex;flex-direction:column;box-sizing:border-box;}', scope + ' .subform-field-
|
|
587
|
+
return _react2.default.createElement('style', { dangerouslySetInnerHTML: { __html: [scope + '{display:block;}', scope + ' .subform-fields-flow{display:flex;flex-wrap:wrap;align-items:stretch;width:100%;box-sizing:border-box;}', row + '{display:flex;align-items:stretch;width:100%;border-bottom:0.5px solid #e9ebee;box-sizing:border-box;}', scope + ' .subform-field-full{width:100%;box-sizing:border-box;border-bottom:0.5px solid #e9ebee;}', scope + ' .subform-field-col{display:flex;flex-direction:column;box-sizing:border-box;border-bottom:0.5px solid #e9ebee;}', scope + ' .subform-field-slot-hidden{display:none!important;width:0!important;height:0!important;overflow:hidden!important;margin:0!important;padding:0!important;border:none!important;}', slot + '{box-sizing:border-box;padding:8px 16px 8px 0;overflow:hidden;}', col + '{width:100%;}', col + ' .t-group-list{border-bottom:none!important;background:transparent;}', col + ' .t-group-list-item::after{display:none!important;}', col + '>.t-group-list>.t-group-list-item::after{display:none!important;}', col + ' .t-field-box.t-field-content-box{display:flex!important;flex-direction:column!important;align-items:stretch!important;width:100%!important;min-height:0!important;padding-left:0!important;padding-right:0!important;}', col + ' .t-field-layout-h-label,' + col + ' .t-field-layout-v-label,' + col + ' .t-field-layout-v-label-left{width:100%!important;max-width:100%!important;margin-left:0!important;padding-left:0!important;padding-right:0!important;color:rgb(51,51,51)!important;background:transparent!important;}', col + ' .t-field-box{padding-left:0!important;padding-right:0!important;}', col + ' .t-field-content-box{justify-content:flex-start!important;align-items:flex-start!important;}', col + ' .t-field-content-box .t-FB1,' + col + ' .t-field-multi{width:100%!important;max-width:100%!important;padding:0 0 4px 0!important;text-align:left!important;}', col + ' .t-field-content-box .t-FB1 span,' + col + ' .t-field-multi span,' + col + ' .t-text-field-content-main span{text-align:left!important;word-break:break-word;}', col + ' .t-text-field-content{width:100%;justify-content:flex-start!important;}', col + ' .t-text-field-input{text-align:left!important;}', text + ' .t-text-field-input,' + text + ' .t-text-field-content-main span{white-space:normal!important;word-wrap:break-word;word-break:break-word;line-height:20px;}', text + ' .t-text-field-placeholder.t-DN{display:none!important;}', pickCol + '.t-field.t-select-field.t-FBH,' + pickCol + '.t-field.t-radio-field.t-FBH,' + pickCol + '.t-field.t-datetime-field.t-FBH{display:block!important;position:relative!important;width:100%!important;}', pickCol + '.t-field-pos-box{width:100%!important;padding-right:28px!important;box-sizing:border-box;}', pickCol + '.t-field-layout-v-label{margin-left:0!important;padding-left:0!important;}', pickCol + '.t-field-content-box{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:flex-start!important;width:100%!important;min-height:24px!important;padding:2px 0 11px 0!important;}', pickCol + '.t-field-pos-icon{position:absolute!important;right:0!important;top:auto!important;bottom:10px!important;margin:0!important;height:26px!important;display:flex!important;align-items:center!important;justify-content:center!important;}', pickCol + '.t-select-field-content,' + pickCol + '.t-radio-field-value,' + pickCol + '.t-datetime-field-value,' + pickCol + '.t-datetime-field-placeholder,' + pickCol + '.t-select-field-placeholder{min-height:24px!important;line-height:24px!important;}', pickCol + '.t-field-content-box>.t-FB1{flex:1!important;width:100%!important;min-width:0!important;max-width:100%!important;padding:0!important;text-align:left!important;}', pickCol + '.t-select-field-content,' + pickCol + '.t-field-content-box>.t-FB1>div{width:100%!important;text-align:left!important;}', pickCol + '.t-select-field-placeholder,' + pickCol + '.t-datetime-field-placeholder,' + pickCol + '.t-select-field-value,' + pickCol + '.t-radio-field-value,' + pickCol + '.t-datetime-field-value{text-align:left!important;justify-content:flex-start!important;width:100%!important;}', pickCol + '.t-select-field-placeholder,' + pickCol + '.t-datetime-field-placeholder{position:static!important;height:auto!important;line-height:24px!important;flex:none!important;max-width:100%!important;}', pickCol + '.t-select-field-value,' + pickCol + '.t-radio-field-value,' + pickCol + '.t-datetime-field-value{display:flex!important;flex-direction:row!important;align-items:flex-start!important;flex-wrap:wrap!important;}', pickCol + '.t-select-field-value .t-FB1,' + pickCol + '.t-radio-field-value .t-FB1,' + pickCol + '.t-datetime-field-value .t-FB1,' + pickCol + '.t-select-field-value span,' + pickCol + '.t-radio-field-value span,' + pickCol + '.t-datetime-field-value span{display:block!important;width:100%!important;max-width:100%!important;white-space:normal!important;word-break:normal!important;overflow-wrap:break-word!important;-webkit-line-clamp:unset!important;line-clamp:unset!important;-webkit-box-orient:horizontal!important;text-align:left!important;}'].join('') } });
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// 子表字段是否隐藏(设计隐藏 / 流程权限 / 关联规则 / 扩展方法)
|
|
591
|
+
|
|
592
|
+
}, {
|
|
593
|
+
key: 'isSubFormFieldHidden',
|
|
594
|
+
value: function isSubFormFieldHidden(field, rowIndex) {
|
|
595
|
+
if (field && field.isHidden) {
|
|
596
|
+
return true;
|
|
597
|
+
}
|
|
598
|
+
var fieldControll = this.state.fieldControll || this.props.fieldControll;
|
|
599
|
+
if (fieldControll && fieldControll.hiddenFields && field) {
|
|
600
|
+
var hiddenCsv = ',' + fieldControll.hiddenFields + ',';
|
|
601
|
+
if (field.uniqueName && hiddenCsv.indexOf(',' + field.uniqueName + ',') >= 0) {
|
|
602
|
+
return true;
|
|
603
|
+
}
|
|
604
|
+
var subTblName = this.state.itemParam && this.state.itemParam.key;
|
|
605
|
+
if (subTblName && field.itemCode && hiddenCsv.indexOf(',' + subTblName + '_' + field.itemCode + ',') >= 0) {
|
|
606
|
+
return true;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
if (field && field.uniqueName != null && rowIndex != null) {
|
|
610
|
+
var fieldRef = this.refs[field.uniqueName + '_' + rowIndex];
|
|
611
|
+
if (fieldRef && fieldRef.state && fieldRef.state.loaded && fieldRef.state.itemParam) {
|
|
612
|
+
return !!fieldRef.state.itemParam.isHidden;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
return this.predictSubFormFieldRelaHidden(field, rowIndex);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// ref 未就绪时按关联规则预判隐藏(与 Form.dealwithRelaField 一致)
|
|
619
|
+
|
|
620
|
+
}, {
|
|
621
|
+
key: 'predictSubFormFieldRelaHidden',
|
|
622
|
+
value: function predictSubFormFieldRelaHidden(field, rowIndex) {
|
|
623
|
+
if (!field || !field.uniqueName) {
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
return (0, _formExtHelper.resolveFieldRelaHidden)({
|
|
627
|
+
uniqueName: field.uniqueName,
|
|
628
|
+
formRelaFieldMaps: this.props.formRelaFieldMaps,
|
|
629
|
+
fieldControll: this.state.fieldControll || this.props.fieldControll,
|
|
630
|
+
fullFormData: this.props.data,
|
|
631
|
+
rowIndex: rowIndex,
|
|
632
|
+
baselineHidden: false,
|
|
633
|
+
formReadOnly: field.readOnly === true,
|
|
634
|
+
fieldValid: field.valid == 'true'
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
// 过滤当前行可见字段(多列排版仅参与可见字段)
|
|
639
|
+
|
|
640
|
+
}, {
|
|
641
|
+
key: 'getVisibleSubFormFields',
|
|
642
|
+
value: function getVisibleSubFormFields(formFields, rowIndex) {
|
|
643
|
+
var t = this;
|
|
644
|
+
return (formFields || []).filter(function (field) {
|
|
645
|
+
return !t.isSubFormFieldHidden(field, rowIndex);
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// 子表字段显隐变化后刷新多列排版
|
|
650
|
+
|
|
651
|
+
}, {
|
|
652
|
+
key: 'notifySubFormLayoutChange',
|
|
653
|
+
value: function notifySubFormLayoutChange() {
|
|
654
|
+
if (this.resolveSubColumnCount(this.props) <= 1) {
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
if (this._layoutRefreshTimer) {
|
|
658
|
+
clearTimeout(this._layoutRefreshTimer);
|
|
659
|
+
}
|
|
660
|
+
var t = this;
|
|
661
|
+
this._layoutRefreshTimer = setTimeout(function () {
|
|
662
|
+
t._layoutRefreshTimer = null;
|
|
663
|
+
t.forceUpdate();
|
|
664
|
+
}, 0);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// 基于可见字段计算多列排版元数据(保持 formFields 原始顺序挂载,避免 remount)
|
|
668
|
+
|
|
669
|
+
}, {
|
|
670
|
+
key: 'buildSubFormFieldLayoutMeta',
|
|
671
|
+
value: function buildSubFormFieldLayoutMeta(formFields, rowIndex, subColumnCount) {
|
|
672
|
+
var t = this;
|
|
673
|
+
var meta = {};
|
|
674
|
+
var visibleFields = t.getVisibleSubFormFields(formFields, rowIndex);
|
|
675
|
+
var rows = t.buildSubFormFieldRows(visibleFields, subColumnCount);
|
|
676
|
+
var order = 0;
|
|
677
|
+
rows.forEach(function (row) {
|
|
678
|
+
if (row.type === 'full') {
|
|
679
|
+
meta[row.field.uniqueName] = { type: 'full', order: order++, rowFieldCount: 1 };
|
|
680
|
+
} else {
|
|
681
|
+
var rowFieldCount = row.fields.length;
|
|
682
|
+
row.fields.forEach(function (field) {
|
|
683
|
+
meta[field.uniqueName] = { type: 'col', order: order++, rowFieldCount: rowFieldCount };
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
(formFields || []).forEach(function (field) {
|
|
688
|
+
if (!meta[field.uniqueName]) {
|
|
689
|
+
meta[field.uniqueName] = { type: 'hidden' };
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
return meta;
|
|
588
693
|
}
|
|
589
694
|
|
|
590
695
|
// 将字段列表按列数拆成行(整行字段单独成行)
|
|
@@ -642,7 +747,8 @@ var PageHome = function (_React$Component) {
|
|
|
642
747
|
formRelaFieldMaps: t.props.formRelaFieldMaps,
|
|
643
748
|
linkFields: t.props.linkFields,
|
|
644
749
|
onChange: t.changeSub.bind(t, t.state.itemParam, rowIndex),
|
|
645
|
-
reloadSubItemParam: t.reloadSubItemParam.bind(t)
|
|
750
|
+
reloadSubItemParam: t.reloadSubItemParam.bind(t),
|
|
751
|
+
onSubFieldLayoutChange: t.notifySubFormLayoutChange.bind(t)
|
|
646
752
|
});
|
|
647
753
|
if (subColumnCount > 1) {
|
|
648
754
|
return _react2.default.cloneElement(formEl, { subColumnCount: subColumnCount });
|
|
@@ -664,8 +770,7 @@ var PageHome = function (_React$Component) {
|
|
|
664
770
|
});
|
|
665
771
|
}
|
|
666
772
|
|
|
667
|
-
var
|
|
668
|
-
var rows = t.buildSubFormFieldRows(formFields, subColumnCount);
|
|
773
|
+
var layoutMeta = t.buildSubFormFieldLayoutMeta(formFields, rowIndex, subColumnCount);
|
|
669
774
|
return _react2.default.createElement(
|
|
670
775
|
'div',
|
|
671
776
|
null,
|
|
@@ -673,50 +778,42 @@ var PageHome = function (_React$Component) {
|
|
|
673
778
|
_react2.default.createElement(
|
|
674
779
|
'div',
|
|
675
780
|
{ className: 'subform-fields-wrap subform-fields-multi' },
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
781
|
+
_react2.default.createElement(
|
|
782
|
+
'div',
|
|
783
|
+
{ className: 'subform-fields-flow' },
|
|
784
|
+
formFields.map(function (field) {
|
|
785
|
+
var fieldMeta = layoutMeta[field.uniqueName] || { type: 'hidden' };
|
|
786
|
+
var hidden = fieldMeta.type === 'hidden';
|
|
787
|
+
var fullWidth = fieldMeta.type === 'full';
|
|
788
|
+
var colWidth = hidden ? undefined : fullWidth ? '100%' : 100 / fieldMeta.rowFieldCount + '%';
|
|
789
|
+
var wrapperClass = 'subform-field-slot';
|
|
790
|
+
if (hidden) {
|
|
791
|
+
wrapperClass += ' subform-field-slot-hidden';
|
|
792
|
+
} else if (fullWidth) {
|
|
793
|
+
wrapperClass += ' subform-field-full';
|
|
794
|
+
} else {
|
|
795
|
+
wrapperClass += ' subform-field-col';
|
|
796
|
+
}
|
|
679
797
|
return _react2.default.createElement(
|
|
680
798
|
'div',
|
|
681
|
-
{
|
|
799
|
+
{
|
|
800
|
+
key: field.uniqueName,
|
|
801
|
+
className: wrapperClass,
|
|
802
|
+
style: {
|
|
803
|
+
order: hidden ? undefined : fieldMeta.order,
|
|
804
|
+
width: colWidth,
|
|
805
|
+
boxSizing: 'border-box'
|
|
806
|
+
},
|
|
807
|
+
'aria-hidden': hidden ? 'true' : undefined
|
|
808
|
+
},
|
|
682
809
|
_react2.default.createElement(
|
|
683
810
|
'div',
|
|
684
|
-
{ className: t.getSubFormFieldSlotClass(true,
|
|
685
|
-
t.renderSubFormFieldForm(
|
|
811
|
+
{ className: t.getSubFormFieldSlotClass(true, fullWidth, field.itemType) },
|
|
812
|
+
t.renderSubFormFieldForm(field, rowIndex, subColumnCount)
|
|
686
813
|
)
|
|
687
814
|
);
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
for (var ci = 0; ci < subColumnCount; ci++) {
|
|
691
|
-
var cellField = row.fields[ci];
|
|
692
|
-
if (cellField) {
|
|
693
|
-
cells.push(_react2.default.createElement(
|
|
694
|
-
'div',
|
|
695
|
-
{
|
|
696
|
-
key: cellField.uniqueName || 'col_' + ri + '_' + ci,
|
|
697
|
-
className: 'subform-field-col',
|
|
698
|
-
style: { width: colWidth, boxSizing: 'border-box' }
|
|
699
|
-
},
|
|
700
|
-
_react2.default.createElement(
|
|
701
|
-
'div',
|
|
702
|
-
{ className: t.getSubFormFieldSlotClass(true, false, cellField.itemType) },
|
|
703
|
-
t.renderSubFormFieldForm(cellField, rowIndex, subColumnCount)
|
|
704
|
-
)
|
|
705
|
-
));
|
|
706
|
-
} else {
|
|
707
|
-
cells.push(_react2.default.createElement('div', {
|
|
708
|
-
key: 'empty_' + ri + '_' + ci,
|
|
709
|
-
className: 'subform-field-col subform-field-col-empty',
|
|
710
|
-
style: { width: colWidth, boxSizing: 'border-box' }
|
|
711
|
-
}));
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
return _react2.default.createElement(
|
|
715
|
-
'div',
|
|
716
|
-
{ key: 'row_' + ri, className: 'subform-fields-row' },
|
|
717
|
-
cells
|
|
718
|
-
);
|
|
719
|
-
})
|
|
815
|
+
})
|
|
816
|
+
)
|
|
720
817
|
)
|
|
721
818
|
);
|
|
722
819
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _nvoice = require('./nvoice');
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'default', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function get() {
|
|
12
|
+
return _interopRequireDefault(_nvoice).default;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = undefined;
|
|
7
|
+
|
|
8
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
9
|
+
|
|
10
|
+
var _react = require('react');
|
|
11
|
+
|
|
12
|
+
var _react2 = _interopRequireDefault(_react);
|
|
13
|
+
|
|
14
|
+
var _Group = require('saltui/lib/Group');
|
|
15
|
+
|
|
16
|
+
var _Group2 = _interopRequireDefault(_Group);
|
|
17
|
+
|
|
18
|
+
var _Field = require('saltui/lib/Field');
|
|
19
|
+
|
|
20
|
+
var _Field2 = _interopRequireDefault(_Field);
|
|
21
|
+
|
|
22
|
+
var _upload = require('../upload/upload');
|
|
23
|
+
|
|
24
|
+
var _upload2 = _interopRequireDefault(_upload);
|
|
25
|
+
|
|
26
|
+
var _Boxs = require('saltui/lib/Boxs');
|
|
27
|
+
|
|
28
|
+
var _Boxs2 = _interopRequireDefault(_Boxs);
|
|
29
|
+
|
|
30
|
+
var _db = require('../db/db');
|
|
31
|
+
|
|
32
|
+
var _db2 = _interopRequireDefault(_db);
|
|
33
|
+
|
|
34
|
+
require('./nvoice.less');
|
|
35
|
+
|
|
36
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
|
+
|
|
38
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
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; }
|
|
43
|
+
|
|
44
|
+
var HBox = _Boxs2.default.HBox,
|
|
45
|
+
Box = _Boxs2.default.Box,
|
|
46
|
+
VBox = _Boxs2.default.VBox;
|
|
47
|
+
|
|
48
|
+
var Nvoice = function (_React$Component) {
|
|
49
|
+
_inherits(Nvoice, _React$Component);
|
|
50
|
+
|
|
51
|
+
function Nvoice(props) {
|
|
52
|
+
_classCallCheck(this, Nvoice);
|
|
53
|
+
|
|
54
|
+
// 传入的props参数
|
|
55
|
+
var _this = _possibleConstructorReturn(this, (Nvoice.__proto__ || Object.getPrototypeOf(Nvoice)).call(this, props));
|
|
56
|
+
|
|
57
|
+
_this.initFn = function (id) {
|
|
58
|
+
|
|
59
|
+
// 初始发票详情数据
|
|
60
|
+
_db2.default.form.getNoInvoiceList({
|
|
61
|
+
invoicedataid: id
|
|
62
|
+
}).then(function (content) {
|
|
63
|
+
_this.setState({
|
|
64
|
+
invoicedata: content
|
|
65
|
+
});
|
|
66
|
+
}).catch(function (error) {
|
|
67
|
+
console.error('获取详情数据失败', error);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var invoicedataid = _this.props.id;
|
|
72
|
+
var title = _this.props.label || '发票详情';
|
|
73
|
+
var required = _this.props.required || false;
|
|
74
|
+
|
|
75
|
+
_this.state = {
|
|
76
|
+
invoicedataid: invoicedataid,
|
|
77
|
+
invoicedata: [],
|
|
78
|
+
title: title,
|
|
79
|
+
required: required
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return _this;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
_createClass(Nvoice, [{
|
|
86
|
+
key: 'componentDidMount',
|
|
87
|
+
value: function componentDidMount() {
|
|
88
|
+
this.initFn(this.state.invoicedataid);
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: 'downloadFile',
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
// 下载函数
|
|
95
|
+
value: function (_downloadFile) {
|
|
96
|
+
function downloadFile(_x) {
|
|
97
|
+
return _downloadFile.apply(this, arguments);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
downloadFile.toString = function () {
|
|
101
|
+
return _downloadFile.toString();
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return downloadFile;
|
|
105
|
+
}(function (file) {
|
|
106
|
+
downloadFile(file.relaObjId);
|
|
107
|
+
})
|
|
108
|
+
}, {
|
|
109
|
+
key: 'render',
|
|
110
|
+
value: function render() {
|
|
111
|
+
return _react2.default.createElement(
|
|
112
|
+
_Group2.default.List,
|
|
113
|
+
{ borderTopNone: true },
|
|
114
|
+
_react2.default.createElement(
|
|
115
|
+
_Field2.default,
|
|
116
|
+
{ required: this.state.required, label: this.state.title, layout: 'h', multiLine: true },
|
|
117
|
+
_react2.default.createElement(
|
|
118
|
+
'div',
|
|
119
|
+
null,
|
|
120
|
+
this.state.invoicedata.map(function (item, index) {
|
|
121
|
+
var fileList = [];
|
|
122
|
+
try {
|
|
123
|
+
if (item.invoicefileInfo) {
|
|
124
|
+
fileList = JSON.parse(item.invoicefileInfo);
|
|
125
|
+
}
|
|
126
|
+
} catch (e) {
|
|
127
|
+
console.error('发票附件解析失败', e);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return _react2.default.createElement(
|
|
131
|
+
'div',
|
|
132
|
+
{ key: item.id, className: 't-MT2' },
|
|
133
|
+
_react2.default.createElement(
|
|
134
|
+
VBox,
|
|
135
|
+
{ className: 'nvoice-filetitle', hAlign: 'start' },
|
|
136
|
+
_react2.default.createElement(
|
|
137
|
+
Box,
|
|
138
|
+
null,
|
|
139
|
+
item.invoicename
|
|
140
|
+
),
|
|
141
|
+
_react2.default.createElement(
|
|
142
|
+
HBox,
|
|
143
|
+
{ vAlign: 'center' },
|
|
144
|
+
_react2.default.createElement(
|
|
145
|
+
Box,
|
|
146
|
+
{ className: 'label label-primary' },
|
|
147
|
+
item.invoicetype
|
|
148
|
+
),
|
|
149
|
+
_react2.default.createElement(
|
|
150
|
+
Box,
|
|
151
|
+
null,
|
|
152
|
+
'\uFFE5',
|
|
153
|
+
item.invoiceamount
|
|
154
|
+
)
|
|
155
|
+
)
|
|
156
|
+
),
|
|
157
|
+
_react2.default.createElement(_upload2.default, {
|
|
158
|
+
required: false,
|
|
159
|
+
canDel: false,
|
|
160
|
+
canPreview: true,
|
|
161
|
+
canDownload: true,
|
|
162
|
+
initList: fileList,
|
|
163
|
+
dir: 'form_invoice',
|
|
164
|
+
ref: 'upload_invoice'
|
|
165
|
+
})
|
|
166
|
+
);
|
|
167
|
+
})
|
|
168
|
+
)
|
|
169
|
+
)
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
}]);
|
|
173
|
+
|
|
174
|
+
return Nvoice;
|
|
175
|
+
}(_react2.default.Component);
|
|
176
|
+
|
|
177
|
+
exports.default = Nvoice;
|
|
File without changes
|
|
@@ -49,8 +49,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
49
49
|
|
|
50
50
|
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; }
|
|
51
51
|
|
|
52
|
-
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; } /**
|
|
53
|
-
* 流程批示意见区块(默认意见、退回意见等),与 TblForm 纯表单分离使用
|
|
52
|
+
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; } /**
|
|
53
|
+
* 流程批示意见区块(默认意见、退回意见等),与 TblForm 纯表单分离使用
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
56
|
|