@bchr/bchr-front-lib 0.3.101 → 0.3.105
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/lib/base/AppFormulaFunctions.js +45 -23
- package/lib/base/layout/ui_tpl/form/FormForBrowse.js +1 -1
- package/lib/base/layout/ui_tpl/form/FormForModify.js +171 -340
- package/lib/services/HttpService.js +14 -12
- package/package.json +1 -1
- package/src/base/AppFormulaFunctions.js +48 -24
- package/src/base/layout/ui_tpl/form/FormForBrowse.js +1 -1
- package/src/base/layout/ui_tpl/form/FormForModify.js +139 -248
- package/src/services/HttpService.js +14 -12
|
@@ -21,6 +21,8 @@ var _HttpService = _interopRequireDefault(require("../../../../services/HttpServ
|
|
|
21
21
|
|
|
22
22
|
var _InputPassword = _interopRequireDefault(require("../InputPassword"));
|
|
23
23
|
|
|
24
|
+
require("../../../AppFormulaFunctions");
|
|
25
|
+
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
27
|
|
|
26
28
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
@@ -57,6 +59,12 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
57
59
|
|
|
58
60
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
59
61
|
|
|
62
|
+
var FormulasValueType = {
|
|
63
|
+
Disabled: "disabled",
|
|
64
|
+
Enabled: "enabled",
|
|
65
|
+
Function: "AppFormulaFunctions"
|
|
66
|
+
};
|
|
67
|
+
|
|
60
68
|
var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
61
69
|
_inherits(FormForModify, _React$Component);
|
|
62
70
|
|
|
@@ -137,9 +145,8 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
137
145
|
}));
|
|
138
146
|
});
|
|
139
147
|
|
|
140
|
-
_defineProperty(_assertThisInitialized(_this2), "buildFormItems", function (
|
|
148
|
+
_defineProperty(_assertThisInitialized(_this2), "buildFormItems", function () {
|
|
141
149
|
var _this2$props2 = _this2.props,
|
|
142
|
-
data = _this2$props2.data,
|
|
143
150
|
info_set_fields = _this2$props2.info_set_fields,
|
|
144
151
|
ext_form_items = _this2$props2.ext_form_items;
|
|
145
152
|
|
|
@@ -147,120 +154,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
147
154
|
return;
|
|
148
155
|
}
|
|
149
156
|
|
|
150
|
-
var setFieldsValue = _this2.ref.current.setFieldsValue;
|
|
151
|
-
|
|
152
157
|
if (info_set_fields && info_set_fields.length > 0) {
|
|
153
|
-
info_set_fields.forEach(function (formItem) {
|
|
154
|
-
formItem.initialValue = null;
|
|
155
|
-
|
|
156
|
-
_this2.preParseFormItemExtConfig(formItem);
|
|
157
|
-
|
|
158
|
-
if (editFormulasState && editFormulasState.length) {
|
|
159
|
-
formItem.b_disabled = formItem.b_readonly;
|
|
160
|
-
|
|
161
|
-
var _loop = function _loop(i, len) {
|
|
162
|
-
var editFormulaStateItemCode = editFormulasState[i].editFormulasStateCode;
|
|
163
|
-
var editFormulaStateItem = editFormulasState[i].editFormulaItem;
|
|
164
|
-
|
|
165
|
-
if (editFormulaStateItem) {
|
|
166
|
-
editFormulaStateItem.otherFormItemResponses.forEach(function (item) {
|
|
167
|
-
if (formItem.code === item.formItemCode) {
|
|
168
|
-
if (item.formItemValue === 'disabled') {
|
|
169
|
-
formItem.b_disabled = true;
|
|
170
|
-
} else if (item.formItemValue === 'enabled') {
|
|
171
|
-
formItem.b_disabled = false;
|
|
172
|
-
} else if (item.formItemValue.indexOf('exp') !== -1) {
|
|
173
|
-
var expValue = '';
|
|
174
|
-
|
|
175
|
-
if (isNaN(data[formItem.code])) {
|
|
176
|
-
expValue = item.formItemValue.split('exp(')[1].split(')')[0].replace('#value#', data[formItem.code]);
|
|
177
|
-
} else {
|
|
178
|
-
expValue = String(item.formItemValue.split('exp(')[1].split(')')[0].replace('#value#', Number(data[formItem.code])));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
formItem.initialValue = eval(expValue);
|
|
182
|
-
} else if (item.formItemValue.indexOf('AppFormulaFunctions') !== -1) {
|
|
183
|
-
var formulaValue = '';
|
|
184
|
-
|
|
185
|
-
if (item.formItemValue.indexOf('currentDateToDeadline') !== -1) {
|
|
186
|
-
formulaValue = eval(item.formItemValue.replace('#value#', "data[editFormulaStateItemCode], 300"));
|
|
187
|
-
} else {
|
|
188
|
-
formulaValue = eval(item.formItemValue.replace('#value#', data[editFormulaStateItemCode]));
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (formItem.ui_render_type === _consts.UI_RENDER_TYPE.DATE || formItem.ui_render_type === _consts.UI_RENDER_TYPE.DATE_MONTH || formItem.ui_render_type === _consts.UI_RENDER_TYPE.DATE_YEAR || formItem.ui_render_type === _consts.UI_RENDER_TYPE.DATE_TIME) {
|
|
192
|
-
formulaValue = (0, _moment["default"])(formulaValue);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
formItem.initialValue = formulaValue;
|
|
196
|
-
} else {
|
|
197
|
-
formItem.initialValue = item.formItemValue || data[formItem.display_code];
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (formItem.initialValue || data[formItem.code]) {
|
|
201
|
-
if (formItem.code.indexOf('date') !== -1) {
|
|
202
|
-
setFieldsValue(_defineProperty({}, formItem.code, (0, _moment["default"])(formItem.initialValue || data[formItem.code])));
|
|
203
|
-
|
|
204
|
-
if (formItem.code.endsWith("_date")) {
|
|
205
|
-
data[formItem.code] = (0, _moment["default"])(formItem.initialValue || data[formItem.code]).valueOf();
|
|
206
|
-
} else if (formItem.code.indexOf('_date$') !== -1) {
|
|
207
|
-
data[formItem.code] = (0, _moment["default"])(formItem.initialValue || data[formItem.code]).format("YYYY-MM-DD");
|
|
208
|
-
}
|
|
209
|
-
} else {
|
|
210
|
-
setFieldsValue(_defineProperty({}, formItem.code, formItem.initialValue || data[formItem.code]));
|
|
211
|
-
data[formItem.code] = formItem.initialValue || data[formItem.code];
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
for (var i = 0, len = editFormulasState.length; i < len; i++) {
|
|
220
|
-
_loop(i, len);
|
|
221
|
-
}
|
|
222
|
-
} else {
|
|
223
|
-
if (formItem.editFormulaConfigs) {
|
|
224
|
-
for (var _i = 0, _len = formItem.editFormulaConfigs.length; _i < _len; _i++) {
|
|
225
|
-
var editFormulaConfig = formItem.editFormulaConfigs[_i];
|
|
226
|
-
var initialValue = formItem.ui_render_type === 'switch' ? (data[formItem.code] && data[formItem.code].toString() || '').toLowerCase() !== 'true' : data[formItem.code];
|
|
227
|
-
var formulaValueOf = formItem.ui_render_type === 'switch' ? (editFormulaConfig.onValueOf || '').toLowerCase() !== 'true' : editFormulaConfig.onValueOf;
|
|
228
|
-
|
|
229
|
-
if (formulaValueOf === initialValue) {
|
|
230
|
-
var currentOtherFormItemResponses = editFormulaConfig.otherFormItemResponses;
|
|
231
|
-
currentOtherFormItemResponses.forEach(function (item) {
|
|
232
|
-
info_set_fields.forEach(function (formItemInner) {
|
|
233
|
-
if (formItemInner.code === item.formItemCode) {
|
|
234
|
-
if (item.formItemValue === 'disabled') {
|
|
235
|
-
formItemInner.b_disabled = true;
|
|
236
|
-
} else if (item.formItemValue === 'enabled') {
|
|
237
|
-
formItemInner.b_disabled = false;
|
|
238
|
-
} else {
|
|
239
|
-
formItemInner.initialValue = item.formItemValue || data[formItemInner.display_code];
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (formItemInner.initialValue || data[formItemInner.code]) {
|
|
243
|
-
if (formItemInner.code.indexOf('date') !== -1) {
|
|
244
|
-
setFieldsValue(_defineProperty({}, formItemInner.code, (0, _moment["default"])(formItemInner.initialValue || data[formItemInner.code])));
|
|
245
|
-
|
|
246
|
-
if (formItemInner.code.endsWith("_date")) {
|
|
247
|
-
data[formItemInner.code] = (0, _moment["default"])(formItemInner.initialValue || data[formItemInner.code]).valueOf();
|
|
248
|
-
} else if (formItemInner.code.indexOf('_date$') !== -1) {
|
|
249
|
-
data[formItemInner.code] = (0, _moment["default"])(formItem.initialValue || data[formItemInner.code]).format("YYYY-MM-DD");
|
|
250
|
-
}
|
|
251
|
-
} else {
|
|
252
|
-
setFieldsValue(_defineProperty({}, formItemInner.code, formItemInner.initialValue || data[formItemInner.code]));
|
|
253
|
-
data[formItemInner.code] = formItemInner.initialValue || data[formItemInner.code];
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
158
|
var groupNames = info_set_fields.map(function (item) {
|
|
265
159
|
return item.belong_form_group;
|
|
266
160
|
}).filter(function (item, index, arr) {
|
|
@@ -340,8 +234,8 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
340
234
|
|
|
341
235
|
var editFormulaConfigs = [];
|
|
342
236
|
|
|
343
|
-
for (var
|
|
344
|
-
var formulaTextItem = pureFormulaTextItems[
|
|
237
|
+
for (var _i = 0, _len = pureFormulaTextItems.length; _i < _len; _i++) {
|
|
238
|
+
var formulaTextItem = pureFormulaTextItems[_i];
|
|
345
239
|
var formulaChildTextItems = formulaTextItem.split("=>");
|
|
346
240
|
|
|
347
241
|
if (formulaChildTextItems.length !== 2) {
|
|
@@ -676,7 +570,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
676
570
|
valuePropName = "checked";
|
|
677
571
|
|
|
678
572
|
if (typeof initialValue !== 'boolean') {
|
|
679
|
-
initialValue = (initialValue || '').toLowerCase() === 'true';
|
|
573
|
+
initialValue = (initialValue + '' || '').toLowerCase() === 'true' || (initialValue + '' || '').toLowerCase() === '1';
|
|
680
574
|
displayValue = initialValue ? "是" : "否";
|
|
681
575
|
}
|
|
682
576
|
|
|
@@ -799,9 +693,131 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
799
693
|
return dict.title;
|
|
800
694
|
});
|
|
801
695
|
|
|
696
|
+
_defineProperty(_assertThisInitialized(_this2), "formItemOnChangeForFormula", function (config, value) {
|
|
697
|
+
var formItemFormulaConfigs = config.editFormulaConfigs;
|
|
698
|
+
|
|
699
|
+
if (formItemFormulaConfigs && formItemFormulaConfigs.length > 0) {
|
|
700
|
+
var fieldCodeKeyMap = _this2.state.fieldCodeKeyMap;
|
|
701
|
+
var _this2$props4 = _this2.props,
|
|
702
|
+
data = _this2$props4.data,
|
|
703
|
+
def_docs = _this2$props4.def_docs;
|
|
704
|
+
var setFieldsValue = _this2.ref.current.setFieldsValue; // value exists
|
|
705
|
+
|
|
706
|
+
var editFormulaItem = config.editFormulaConfigs.find(function (editFormulaItem) {
|
|
707
|
+
return editFormulaItem.onValueOf === value.toString() || editFormulaItem.onValueOf === "value";
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
if (editFormulaItem) {
|
|
711
|
+
var otherFormItemResponses = editFormulaItem.otherFormItemResponses;
|
|
712
|
+
|
|
713
|
+
var _loop = function _loop(i, len) {
|
|
714
|
+
var otherFormItem = otherFormItemResponses[i];
|
|
715
|
+
|
|
716
|
+
if (!otherFormItem) {
|
|
717
|
+
return "continue";
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
var formItemCode = otherFormItem.formItemCode,
|
|
721
|
+
formItemValue = otherFormItem.formItemValue;
|
|
722
|
+
var otherFormItemConfig = fieldCodeKeyMap[formItemCode];
|
|
723
|
+
|
|
724
|
+
if (!otherFormItemConfig) {
|
|
725
|
+
return "continue";
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
if (!formItemValue) {
|
|
729
|
+
return "continue";
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
var code = otherFormItemConfig.code,
|
|
733
|
+
display_code = otherFormItemConfig.display_code,
|
|
734
|
+
ref_pk = otherFormItemConfig.ref_pk,
|
|
735
|
+
ui_render_type = otherFormItemConfig.ui_render_type;
|
|
736
|
+
|
|
737
|
+
if (FormulasValueType.Disabled == formItemValue) {
|
|
738
|
+
data[code] = null;
|
|
739
|
+
setFieldsValue(_defineProperty({}, code, null));
|
|
740
|
+
|
|
741
|
+
if (display_code) {
|
|
742
|
+
data[display_code] = null;
|
|
743
|
+
setFieldsValue(_defineProperty({}, display_code, null));
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
otherFormItemConfig.b_disabled = true;
|
|
747
|
+
otherFormItemConfig.b_readonly = true;
|
|
748
|
+
} else if (FormulasValueType.Enabled == formItemValue) {
|
|
749
|
+
otherFormItemConfig.b_disabled = false;
|
|
750
|
+
otherFormItemConfig.b_readonly = false;
|
|
751
|
+
} else if (formItemValue.startsWith(FormulasValueType.Function)) {
|
|
752
|
+
var formulaFunctionValue;
|
|
753
|
+
|
|
754
|
+
if (formItemValue.search("#value#") !== -1) {
|
|
755
|
+
formulaFunctionValue = eval(formItemValue.replace('#value#', "value").replace("@", ","));
|
|
756
|
+
} else {
|
|
757
|
+
var formItemValueList = formItemValue.split("#");
|
|
758
|
+
|
|
759
|
+
if (!formItemValueList || formItemValueList.length != 3) {
|
|
760
|
+
console.log("formula error, detail info: formItemCode=" + formItemValue + ", formItemValue=" + formItemValue);
|
|
761
|
+
return "continue";
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
var realFormulaValue = formItemValueList[0] + "data[formItemValueList[1]]" + formItemValueList[2];
|
|
765
|
+
formulaFunctionValue = eval(realFormulaValue.replace("@", ","));
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
if (!formulaFunctionValue) {
|
|
769
|
+
console.log("formula function return null, detail info: formItemCode=" + formItemValue + ", formItemValue=" + formItemValue);
|
|
770
|
+
return "continue";
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
data[code] = formulaFunctionValue;
|
|
774
|
+
var otherFormItemValue;
|
|
775
|
+
|
|
776
|
+
if (_consts.UI_RENDER_TYPE.DATE == ui_render_type) {
|
|
777
|
+
otherFormItemValue = (0, _moment["default"])(formulaFunctionValue, "YYYY-MM-DD");
|
|
778
|
+
} else {
|
|
779
|
+
otherFormItemValue = formulaFunctionValue;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
setFieldsValue(_defineProperty({}, code, otherFormItemValue));
|
|
783
|
+
} else {
|
|
784
|
+
data[code] = formItemValue;
|
|
785
|
+
setFieldsValue(_defineProperty({}, code, formItemValue));
|
|
786
|
+
|
|
787
|
+
if (display_code && display_code.trim().length > 0) {
|
|
788
|
+
var dictList = def_docs["def_" + ref_pk];
|
|
789
|
+
|
|
790
|
+
if (dictList && dictList.length > 0) {
|
|
791
|
+
var filteredDict = dictList.find(function (item) {
|
|
792
|
+
return item.pk.toString() == formItemValue;
|
|
793
|
+
});
|
|
794
|
+
|
|
795
|
+
if (filteredDict) {
|
|
796
|
+
var ref_title = filteredDict.title;
|
|
797
|
+
data[display_code] = ref_title;
|
|
798
|
+
setFieldsValue(_defineProperty({}, display_code, ref_title));
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
for (var i = 0, len = otherFormItemResponses.length; i < len; i++) {
|
|
806
|
+
var _ret = _loop(i, len);
|
|
807
|
+
|
|
808
|
+
if (_ret === "continue") continue;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
_this2.setState({
|
|
813
|
+
fieldCodeKeyMap: fieldCodeKeyMap
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
|
|
802
818
|
_this2.ref = _this2.props.formref || /*#__PURE__*/_react["default"].createRef();
|
|
803
819
|
_this2.state = {
|
|
804
|
-
|
|
820
|
+
fieldCodeKeyMap: {}
|
|
805
821
|
};
|
|
806
822
|
return _this2;
|
|
807
823
|
}
|
|
@@ -809,32 +825,36 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
809
825
|
_createClass(FormForModify, [{
|
|
810
826
|
key: "componentDidMount",
|
|
811
827
|
value: function componentDidMount() {
|
|
812
|
-
var _this3 = this;
|
|
813
|
-
|
|
814
828
|
var _this$props = this.props,
|
|
815
829
|
data = _this$props.data,
|
|
816
830
|
info_set_fields = _this$props.info_set_fields;
|
|
817
|
-
var
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
}
|
|
833
|
-
}
|
|
831
|
+
var fieldCodeKeyMap = this.state.fieldCodeKeyMap;
|
|
832
|
+
|
|
833
|
+
if (info_set_fields && info_set_fields.length <= 0) {
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
for (var i = 0, len = info_set_fields.length; i < len; i++) {
|
|
838
|
+
var formItem = info_set_fields[i];
|
|
839
|
+
this.preParseFormItemExtConfig(formItem);
|
|
840
|
+
var code = formItem.code,
|
|
841
|
+
ui_render_type = formItem.ui_render_type;
|
|
842
|
+
var fieldCodeValue = data[code];
|
|
843
|
+
|
|
844
|
+
if (_consts.UI_RENDER_TYPE.SWITCH == ui_render_type) {
|
|
845
|
+
fieldCodeValue = (fieldCodeValue + '' || '').toLowerCase() === 'true' || (fieldCodeValue + '' || '').toLowerCase() === '1' ? "true" : "false";
|
|
834
846
|
}
|
|
835
|
-
|
|
847
|
+
|
|
848
|
+
if (fieldCodeValue) {
|
|
849
|
+
this.formItemOnChangeForFormula(formItem, fieldCodeValue);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
formItem.b_disabled = formItem.b_readonly;
|
|
853
|
+
fieldCodeKeyMap[formItem.code] = formItem;
|
|
854
|
+
}
|
|
855
|
+
|
|
836
856
|
this.setState({
|
|
837
|
-
|
|
857
|
+
fieldCodeKeyMap: fieldCodeKeyMap
|
|
838
858
|
});
|
|
839
859
|
}
|
|
840
860
|
}, {
|
|
@@ -942,82 +962,14 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
942
962
|
}, {
|
|
943
963
|
key: "datePickerOnChange",
|
|
944
964
|
value: function datePickerOnChange(config, callback, formData, dateFormat, date, dateString) {
|
|
945
|
-
var _this4 = this;
|
|
946
|
-
|
|
947
|
-
if (config.editFormulaConfigs && config.editFormulaConfigs.length) {
|
|
948
|
-
var code = config.code;
|
|
949
|
-
var editFormulasState = this.state.editFormulasState;
|
|
950
|
-
var _this$ref$current = this.ref.current,
|
|
951
|
-
setFieldsValue = _this$ref$current.setFieldsValue,
|
|
952
|
-
resetFields = _this$ref$current.resetFields;
|
|
953
|
-
|
|
954
|
-
if (dateString) {
|
|
955
|
-
var editFormulaItem = config.editFormulaConfigs[0];
|
|
956
|
-
|
|
957
|
-
if (editFormulaItem) {
|
|
958
|
-
if (dateString) {
|
|
959
|
-
editFormulaItem.otherFormItemResponses.forEach(function (item) {
|
|
960
|
-
if (item.formItemValue === 'disabled') {
|
|
961
|
-
resetFields([item.formItemCode]);
|
|
962
|
-
setFieldsValue(_defineProperty({}, item.formItemCode, null));
|
|
963
|
-
|
|
964
|
-
if (item.formItemCode.endsWith('_pk') && _this4.props.data["".concat(item.formItemCode.split('_pk')[0], "_ext_name")]) {
|
|
965
|
-
_this4.props.data["".concat(item.formItemCode.split('_pk')[0], "_ext_name")] = null;
|
|
966
|
-
} else if (item.formItemCode.indexOf('_pk$') !== -1 && _this4.props.data["".concat(item.formItemCode.split('_pk$')[0], "_ext_name$").concat(item.formItemCode.split('_pk$')[1])]) {
|
|
967
|
-
_this4.props.data["".concat(item.formItemCode.split('_pk$')[0], "_ext_name$").concat(item.formItemCode.split('_pk$')[1])] = null;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
_this4.props.data[item.formItemCode] = null;
|
|
971
|
-
}
|
|
972
|
-
});
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
if (editFormulasState.filter(function (item) {
|
|
976
|
-
return item.editFormulasStateCode === code;
|
|
977
|
-
}).length) {
|
|
978
|
-
editFormulasState.forEach(function (item) {
|
|
979
|
-
if (item.editFormulasStateCode === code) {
|
|
980
|
-
item.editFormulaItem = editFormulaItem;
|
|
981
|
-
}
|
|
982
|
-
});
|
|
983
|
-
} else {
|
|
984
|
-
editFormulasState.push({
|
|
985
|
-
editFormulasStateCode: code,
|
|
986
|
-
editFormulaItem: editFormulaItem
|
|
987
|
-
});
|
|
988
|
-
}
|
|
989
|
-
} else {
|
|
990
|
-
if (editFormulasState.filter(function (item) {
|
|
991
|
-
return item.editFormulasStateCode === code;
|
|
992
|
-
}).length) {
|
|
993
|
-
editFormulasState.forEach(function (item) {
|
|
994
|
-
if (item.editFormulasStateCode === code) {
|
|
995
|
-
item.editFormulaItem = null;
|
|
996
|
-
}
|
|
997
|
-
});
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
} else {
|
|
1001
|
-
if (editFormulasState.filter(function (item) {
|
|
1002
|
-
return item.editFormulasStateCode === code;
|
|
1003
|
-
}).length) {
|
|
1004
|
-
editFormulasState.forEach(function (item) {
|
|
1005
|
-
if (item.editFormulasStateCode === code) {
|
|
1006
|
-
item.editFormulaItem = null;
|
|
1007
|
-
}
|
|
1008
|
-
});
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
this.setState({
|
|
1013
|
-
editFormulasState: editFormulasState
|
|
1014
|
-
});
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
965
|
if (dateFormat != null) {
|
|
1018
966
|
formData[config.code] = date.format(dateFormat);
|
|
1019
967
|
}
|
|
1020
968
|
|
|
969
|
+
if (dateString) {
|
|
970
|
+
this.formItemOnChangeForFormula(config, dateString);
|
|
971
|
+
}
|
|
972
|
+
|
|
1021
973
|
if (callback && typeof callback === "function") {
|
|
1022
974
|
callback(date, dateString);
|
|
1023
975
|
}
|
|
@@ -1047,8 +999,6 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
1047
999
|
}, {
|
|
1048
1000
|
key: "selectOnChange",
|
|
1049
1001
|
value: function selectOnChange(config, callback, value, option) {
|
|
1050
|
-
var _this5 = this;
|
|
1051
|
-
|
|
1052
1002
|
var display_code = config.display_code,
|
|
1053
1003
|
code = config.code;
|
|
1054
1004
|
|
|
@@ -1092,75 +1042,8 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
1092
1042
|
this.props.data[display_code] = display_value;
|
|
1093
1043
|
}
|
|
1094
1044
|
|
|
1095
|
-
if (
|
|
1096
|
-
|
|
1097
|
-
var _this$ref$current2 = this.ref.current,
|
|
1098
|
-
setFieldsValue = _this$ref$current2.setFieldsValue,
|
|
1099
|
-
resetFields = _this$ref$current2.resetFields;
|
|
1100
|
-
|
|
1101
|
-
if (value) {
|
|
1102
|
-
var editFormulaItem = config.editFormulaConfigs.filter(function (editFormulaItem) {
|
|
1103
|
-
return editFormulaItem.onValueOf === value.toString();
|
|
1104
|
-
})[0];
|
|
1105
|
-
|
|
1106
|
-
if (editFormulaItem) {
|
|
1107
|
-
if (value) {
|
|
1108
|
-
editFormulaItem.otherFormItemResponses.forEach(function (item) {
|
|
1109
|
-
if (item.formItemValue === 'disabled') {
|
|
1110
|
-
resetFields([item.formItemCode]);
|
|
1111
|
-
setFieldsValue(_defineProperty({}, item.formItemCode, null));
|
|
1112
|
-
|
|
1113
|
-
if (item.formItemCode.endsWith('_pk') && _this5.props.data["".concat(item.formItemCode.split('_pk')[0], "_ext_name")]) {
|
|
1114
|
-
_this5.props.data["".concat(item.formItemCode.split('_pk')[0], "_ext_name")] = null;
|
|
1115
|
-
} else if (item.formItemCode.indexOf('_pk$') !== -1 && _this5.props.data["".concat(item.formItemCode.split('_pk$')[0], "_ext_name$").concat(item.formItemCode.split('_pk$')[1])]) {
|
|
1116
|
-
_this5.props.data["".concat(item.formItemCode.split('_pk$')[0], "_ext_name$").concat(item.formItemCode.split('_pk$')[1])] = null;
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
_this5.props.data[item.formItemCode] = null;
|
|
1120
|
-
}
|
|
1121
|
-
});
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
if (editFormulasState.filter(function (item) {
|
|
1125
|
-
return item.editFormulasStateCode === code;
|
|
1126
|
-
}).length) {
|
|
1127
|
-
editFormulasState.forEach(function (item) {
|
|
1128
|
-
if (item.editFormulasStateCode === code) {
|
|
1129
|
-
item.editFormulaItem = editFormulaItem;
|
|
1130
|
-
}
|
|
1131
|
-
});
|
|
1132
|
-
} else {
|
|
1133
|
-
editFormulasState.push({
|
|
1134
|
-
editFormulasStateCode: code,
|
|
1135
|
-
editFormulaItem: editFormulaItem
|
|
1136
|
-
});
|
|
1137
|
-
}
|
|
1138
|
-
} else {
|
|
1139
|
-
if (editFormulasState.filter(function (item) {
|
|
1140
|
-
return item.editFormulasStateCode === code;
|
|
1141
|
-
}).length) {
|
|
1142
|
-
editFormulasState.forEach(function (item) {
|
|
1143
|
-
if (item.editFormulasStateCode === code) {
|
|
1144
|
-
item.editFormulaItem = null;
|
|
1145
|
-
}
|
|
1146
|
-
});
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
} else {
|
|
1150
|
-
if (editFormulasState.filter(function (item) {
|
|
1151
|
-
return item.editFormulasStateCode === code;
|
|
1152
|
-
}).length) {
|
|
1153
|
-
editFormulasState.forEach(function (item) {
|
|
1154
|
-
if (item.editFormulasStateCode === code) {
|
|
1155
|
-
item.editFormulaItem = null;
|
|
1156
|
-
}
|
|
1157
|
-
});
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
this.setState({
|
|
1162
|
-
editFormulasState: editFormulasState
|
|
1163
|
-
});
|
|
1045
|
+
if (value) {
|
|
1046
|
+
this.formItemOnChangeForFormula(config, value);
|
|
1164
1047
|
}
|
|
1165
1048
|
|
|
1166
1049
|
if (callback && typeof callback === "function") {
|
|
@@ -1192,7 +1075,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
1192
1075
|
}, {
|
|
1193
1076
|
key: "buildTreeNode",
|
|
1194
1077
|
value: function buildTreeNode(defNodes) {
|
|
1195
|
-
var
|
|
1078
|
+
var _this3 = this;
|
|
1196
1079
|
|
|
1197
1080
|
if (!defNodes || defNodes.length === 0) {
|
|
1198
1081
|
return null;
|
|
@@ -1213,7 +1096,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
1213
1096
|
ext_attr_value: ext_attr_value,
|
|
1214
1097
|
selectable: item.selectable,
|
|
1215
1098
|
prop: ext_attr_value
|
|
1216
|
-
},
|
|
1099
|
+
}, _this3.buildTreeNode(item.children));
|
|
1217
1100
|
});
|
|
1218
1101
|
}
|
|
1219
1102
|
}, {
|
|
@@ -1270,59 +1153,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
1270
1153
|
}, {
|
|
1271
1154
|
key: "switchOnChange",
|
|
1272
1155
|
value: function switchOnChange(config, callback, checked, event) {
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
if (config.editFormulaConfigs && config.editFormulaConfigs.length) {
|
|
1276
|
-
var code = config.code;
|
|
1277
|
-
var editFormulasState = this.state.editFormulasState;
|
|
1278
|
-
var _this$ref$current3 = this.ref.current,
|
|
1279
|
-
setFieldsValue = _this$ref$current3.setFieldsValue,
|
|
1280
|
-
resetFields = _this$ref$current3.resetFields;
|
|
1281
|
-
var editFormulaItem = config.editFormulaConfigs.filter(function (editFormulaItem) {
|
|
1282
|
-
return editFormulaItem.onValueOf === checked.toString();
|
|
1283
|
-
})[0];
|
|
1284
|
-
|
|
1285
|
-
if (editFormulaItem) {
|
|
1286
|
-
if (!checked) {
|
|
1287
|
-
editFormulaItem.otherFormItemResponses.forEach(function (item) {
|
|
1288
|
-
resetFields([item.formItemCode]);
|
|
1289
|
-
setFieldsValue(_defineProperty({}, item.formItemCode, null));
|
|
1290
|
-
|
|
1291
|
-
if (item.formItemCode.endsWith('_pk') && _this7.props.data["".concat(item.formItemCode.split('_pk')[0], "_ext_name")]) {
|
|
1292
|
-
_this7.props.data["".concat(item.formItemCode.split('_pk')[0], "_ext_name")] = null;
|
|
1293
|
-
} else if (item.formItemCode.indexOf('_pk$') !== -1 && _this7.props.data["".concat(item.formItemCode.split('_pk$')[0], "_ext_name$").concat(item.formItemCode.split('_pk$')[1])]) {
|
|
1294
|
-
_this7.props.data["".concat(item.formItemCode.split('_pk$')[0], "_ext_name$").concat(item.formItemCode.split('_pk$')[1])] = null;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
_this7.props.data[item.formItemCode] = null;
|
|
1298
|
-
});
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
if (editFormulasState.filter(function (item) {
|
|
1302
|
-
return item.editFormulasStateCode === code;
|
|
1303
|
-
}).length) {
|
|
1304
|
-
editFormulasState.forEach(function (item) {
|
|
1305
|
-
if (item.editFormulasStateCode === code) {
|
|
1306
|
-
item.editFormulaItem = editFormulaItem;
|
|
1307
|
-
}
|
|
1308
|
-
});
|
|
1309
|
-
} else {
|
|
1310
|
-
editFormulasState.push({
|
|
1311
|
-
editFormulasStateCode: code,
|
|
1312
|
-
editFormulaItem: editFormulaItem
|
|
1313
|
-
});
|
|
1314
|
-
}
|
|
1315
|
-
} else {
|
|
1316
|
-
editFormulasState.push({
|
|
1317
|
-
editFormulasStateCode: code,
|
|
1318
|
-
editFormulaItem: null
|
|
1319
|
-
});
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
this.setState({
|
|
1323
|
-
editFormulasState: editFormulasState
|
|
1324
|
-
});
|
|
1325
|
-
}
|
|
1156
|
+
this.formItemOnChangeForFormula(config, checked);
|
|
1326
1157
|
|
|
1327
1158
|
if (callback && typeof callback === "function") {
|
|
1328
1159
|
callback(checked, event);
|
|
@@ -1420,7 +1251,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
1420
1251
|
key: "render",
|
|
1421
1252
|
value: function render() {
|
|
1422
1253
|
var props = this.props;
|
|
1423
|
-
var
|
|
1254
|
+
var fieldCodeKeyMap = this.state.fieldCodeKeyMap;
|
|
1424
1255
|
return /*#__PURE__*/_react["default"].createElement(_antd.ConfigProvider, {
|
|
1425
1256
|
locale: _zh_CN["default"]
|
|
1426
1257
|
}, /*#__PURE__*/_react["default"].createElement(_antd.Form, _extends({}, props, {
|
|
@@ -1428,7 +1259,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
1428
1259
|
ref: this.ref,
|
|
1429
1260
|
scrollToFirstError: true,
|
|
1430
1261
|
onValuesChange: this.onValuesChange.bind(this)
|
|
1431
|
-
}), this.buildFormItems(
|
|
1262
|
+
}), this.buildFormItems(fieldCodeKeyMap), this.buildExtFormItems()));
|
|
1432
1263
|
}
|
|
1433
1264
|
}]);
|
|
1434
1265
|
|
|
@@ -131,22 +131,24 @@ var HttpService = /*#__PURE__*/function () {
|
|
|
131
131
|
rpcMethodName = "";
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
if (jsonObject) {
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
if (!this.__checkJSONObjectSecurity(jsonObject)) {
|
|
135
|
+
if (jsonObject) {
|
|
136
|
+
ajaxOptions.data = jsonObject;
|
|
137
|
+
}
|
|
137
138
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
if (ajaxOptions.rpcMethodName) {
|
|
140
|
+
delete ajaxOptions.rpcMethodName;
|
|
141
|
+
}
|
|
141
142
|
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
ajaxOptions.type = "post";
|
|
144
|
+
ajaxOptions.dataType = "json";
|
|
144
145
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
if (!ajaxOptions.url) {
|
|
147
|
+
ajaxOptions.url = this.requestContextPath + rpcMethodName;
|
|
148
|
+
}
|
|
148
149
|
|
|
149
|
-
|
|
150
|
+
return _jquery["default"].ajax(ajaxOptions);
|
|
151
|
+
}
|
|
150
152
|
}
|
|
151
153
|
}, {
|
|
152
154
|
key: "__postForMock",
|