@bchr/bchr-front-lib 0.3.88 → 0.3.89
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
CHANGED
|
@@ -35,6 +35,23 @@ class FormForModify extends React.Component{
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
componentDidMount() {
|
|
38
|
+
let {data, info_set_fields} = this.props;
|
|
39
|
+
let {editFormulasState} = this.state;
|
|
40
|
+
info_set_fields.forEach(formItem => {
|
|
41
|
+
this.preParseFormItemExtConfig(formItem);
|
|
42
|
+
if (formItem.editFormulaConfigs) {
|
|
43
|
+
for (let i = 0, len = formItem.editFormulaConfigs.length; i < len; i++) {
|
|
44
|
+
let editFormulaConfig = formItem.editFormulaConfigs[i];
|
|
45
|
+
let initialValue = formItem.ui_render_type === 'switch' ? (data[formItem.code] || '').toLowerCase() !== 'true' : data[formItem.code];
|
|
46
|
+
let formulaValueOf = formItem.ui_render_type === 'switch' ? (editFormulaConfig.onValueOf || '').toLowerCase() !== 'true' : editFormulaConfig.onValueOf;
|
|
47
|
+
|
|
48
|
+
if (formulaValueOf === initialValue) {
|
|
49
|
+
editFormulasState.push({editFormulasStateCode: formItem.code, editFormulaItem: editFormulaConfig})
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
this.setState({editFormulasState})
|
|
38
55
|
}
|
|
39
56
|
|
|
40
57
|
buildExtFormItems = () => {
|
|
@@ -115,7 +132,6 @@ class FormForModify extends React.Component{
|
|
|
115
132
|
buildFormItems = (editFormulasState) => {
|
|
116
133
|
let {data, info_set_fields, ext_form_items} = this.props;
|
|
117
134
|
if (info_set_fields && info_set_fields.length > 0) {
|
|
118
|
-
|
|
119
135
|
info_set_fields.forEach(formItem => {
|
|
120
136
|
formItem.initialValue = null;
|
|
121
137
|
|
|
@@ -133,7 +149,7 @@ class FormForModify extends React.Component{
|
|
|
133
149
|
} else if (item.formItemValue === 'enabled') {
|
|
134
150
|
formItem.b_disabled = false;
|
|
135
151
|
} else {
|
|
136
|
-
formItem.initialValue = item.formItemValue ||
|
|
152
|
+
formItem.initialValue = item.formItemValue || data[formItem.display_code];
|
|
137
153
|
}
|
|
138
154
|
}
|
|
139
155
|
})
|
|
@@ -141,16 +157,13 @@ class FormForModify extends React.Component{
|
|
|
141
157
|
}
|
|
142
158
|
|
|
143
159
|
} else {
|
|
144
|
-
|
|
145
160
|
if (formItem.editFormulaConfigs) {
|
|
146
|
-
|
|
147
161
|
for (let i = 0, len = formItem.editFormulaConfigs.length; i < len; i++) {
|
|
148
162
|
let editFormulaConfig = formItem.editFormulaConfigs[i];
|
|
149
163
|
let initialValue = formItem.ui_render_type === 'switch' ? (data[formItem.code] || '').toLowerCase() !== 'true' : data[formItem.code];
|
|
150
164
|
let formulaValueOf = formItem.ui_render_type === 'switch' ? (editFormulaConfig.onValueOf || '').toLowerCase() !== 'true' : editFormulaConfig.onValueOf;
|
|
151
165
|
|
|
152
166
|
if (formulaValueOf === initialValue) {
|
|
153
|
-
editFormulasState.push({editFormulasStateCode: formItem.code, editFormulaItem: editFormulaConfig});
|
|
154
167
|
let currentOtherFormItemResponses = editFormulaConfig.otherFormItemResponses;
|
|
155
168
|
currentOtherFormItemResponses.forEach(item => {
|
|
156
169
|
info_set_fields.forEach(formItemInner => {
|
|
@@ -160,7 +173,7 @@ class FormForModify extends React.Component{
|
|
|
160
173
|
} else if (item.formItemValue === 'enabled') {
|
|
161
174
|
formItemInner.b_disabled = false;
|
|
162
175
|
} else {
|
|
163
|
-
formItemInner.initialValue = item.formItemValue ||
|
|
176
|
+
formItemInner.initialValue = item.formItemValue || data[formItem.display_code];
|
|
164
177
|
}
|
|
165
178
|
}
|
|
166
179
|
})
|
|
@@ -341,7 +354,11 @@ class FormForModify extends React.Component{
|
|
|
341
354
|
|
|
342
355
|
display_code = display_code || code;
|
|
343
356
|
let initialValue = dataItem.initialValue || data[code];
|
|
344
|
-
let displayValue =
|
|
357
|
+
let displayValue = data[display_code];
|
|
358
|
+
|
|
359
|
+
if (code === 'old__end_date$i_hi_person_contract') {
|
|
360
|
+
console.log(code, initialValue)
|
|
361
|
+
}
|
|
345
362
|
|
|
346
363
|
let component, valuePropName;
|
|
347
364
|
if (custom_form_items && custom_form_items[code + "_form_item"] && typeof custom_form_items[code + "_form_item"] === "function") {
|
|
@@ -455,50 +472,6 @@ class FormForModify extends React.Component{
|
|
|
455
472
|
/>
|
|
456
473
|
);
|
|
457
474
|
break;
|
|
458
|
-
case UI_RENDER_TYPE.DATE_YEAR:
|
|
459
|
-
initialValue = (initialValue ? moment(initialValue) : "");
|
|
460
|
-
displayValue = (displayValue ? moment(displayValue).format("YYYY") : "");
|
|
461
|
-
|
|
462
|
-
component = (b_disabled !== undefined ? b_disabled : b_readonly) ? (
|
|
463
|
-
<div>
|
|
464
|
-
<span>{displayValue}</span>
|
|
465
|
-
</div>
|
|
466
|
-
)
|
|
467
|
-
:
|
|
468
|
-
(
|
|
469
|
-
<DatePicker
|
|
470
|
-
key={form_id + "_" + code}
|
|
471
|
-
getPopupContainer={() => document.getElementById(`ant_form_item_${code}`)}
|
|
472
|
-
placeholder={"请选择" + name}
|
|
473
|
-
picker="year"
|
|
474
|
-
onChange={this.datePickerOnChange.bind(this, dataItem, onChange)}
|
|
475
|
-
disabledDate={this.disabledDate.bind(this, dataItem)}
|
|
476
|
-
{...ext_props}
|
|
477
|
-
/>
|
|
478
|
-
);
|
|
479
|
-
break;
|
|
480
|
-
case UI_RENDER_TYPE.DATE_MONTH:
|
|
481
|
-
initialValue = (initialValue ? moment(initialValue) : "");
|
|
482
|
-
displayValue = (displayValue ? moment(displayValue).format("YYYY-MM") : "");
|
|
483
|
-
|
|
484
|
-
component = (b_disabled !== undefined ? b_disabled : b_readonly) ? (
|
|
485
|
-
<div>
|
|
486
|
-
<span>{displayValue}</span>
|
|
487
|
-
</div>
|
|
488
|
-
)
|
|
489
|
-
:
|
|
490
|
-
(
|
|
491
|
-
<DatePicker
|
|
492
|
-
key={form_id + "_" + code}
|
|
493
|
-
getPopupContainer={() => document.getElementById(`ant_form_item_${code}`)}
|
|
494
|
-
placeholder={"请选择" + name}
|
|
495
|
-
picker="month"
|
|
496
|
-
onChange={this.datePickerOnChange.bind(this, dataItem, onChange)}
|
|
497
|
-
disabledDate={this.disabledDate.bind(this, dataItem)}
|
|
498
|
-
{...ext_props}
|
|
499
|
-
/>
|
|
500
|
-
);
|
|
501
|
-
break;
|
|
502
475
|
case UI_RENDER_TYPE.DATE_TIME:
|
|
503
476
|
initialValue = (initialValue ? moment(initialValue) : "");
|
|
504
477
|
displayValue = (displayValue ? moment(displayValue).format("YYYY-MM-DD hh:mm:ss") : "");
|
|
@@ -953,6 +926,7 @@ class FormForModify extends React.Component{
|
|
|
953
926
|
}
|
|
954
927
|
|
|
955
928
|
if (config.editFormulaConfigs && config.editFormulaConfigs.length) {
|
|
929
|
+
let {data} = this.props;
|
|
956
930
|
let {editFormulasState} = this.state;
|
|
957
931
|
let {setFieldsValue} = this.ref.current;
|
|
958
932
|
if (value) {
|
|
@@ -961,7 +935,11 @@ class FormForModify extends React.Component{
|
|
|
961
935
|
if (value) {
|
|
962
936
|
editFormulaItem.otherFormItemResponses.forEach(item => {
|
|
963
937
|
if (item.formItemValue === 'disabled') {
|
|
964
|
-
|
|
938
|
+
if (item.formItemCode.indexOf('date') !== -1) {
|
|
939
|
+
setFieldsValue({[item.formItemCode]: moment(data[item.formItemCode]) || ''})
|
|
940
|
+
} else {
|
|
941
|
+
setFieldsValue({[item.formItemCode]: data[item.formItemCode] || ''})
|
|
942
|
+
}
|
|
965
943
|
}
|
|
966
944
|
})
|
|
967
945
|
}
|
|
@@ -1092,15 +1070,20 @@ class FormForModify extends React.Component{
|
|
|
1092
1070
|
}
|
|
1093
1071
|
|
|
1094
1072
|
switchOnChange(config, callback, checked, event) {
|
|
1095
|
-
let {code} = config;
|
|
1096
1073
|
if (config.editFormulaConfigs && config.editFormulaConfigs.length) {
|
|
1074
|
+
let {data} = this.props;
|
|
1075
|
+
let {code} = config;
|
|
1097
1076
|
let {editFormulasState} = this.state;
|
|
1098
1077
|
let {setFieldsValue} = this.ref.current;
|
|
1099
1078
|
let editFormulaItem = config.editFormulaConfigs.filter(editFormulaItem => editFormulaItem.onValueOf === checked.toString())[0];
|
|
1100
1079
|
if (editFormulaItem) {
|
|
1101
1080
|
if (!checked) {
|
|
1102
1081
|
editFormulaItem.otherFormItemResponses.forEach(item => {
|
|
1103
|
-
|
|
1082
|
+
if (item.formItemCode.indexOf('date') !== -1) {
|
|
1083
|
+
setFieldsValue({[item.formItemCode]: moment(data[item.formItemCode]) || ''})
|
|
1084
|
+
} else {
|
|
1085
|
+
setFieldsValue({[item.formItemCode]: data[item.formItemCode] || ''})
|
|
1086
|
+
}
|
|
1104
1087
|
})
|
|
1105
1088
|
}
|
|
1106
1089
|
if (editFormulasState.filter(item => item.editFormulasStateCode === code).length) {
|