@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.
@@ -1,24 +1,48 @@
1
- window.AppFormulaFunctions = {};
2
-
3
- window.AppFormulaFunctions.currentMonthStartDay = function (date) {
4
- var currentDate = new Date(date),
5
- currentYear = currentDate.getFullYear(),
6
- currentMouth = currentDate.getMonth() + 1;
7
- return currentYear + "-" + currentMouth + "-1"
8
- }
9
-
10
- window.AppFormulaFunctions.nextMonthStartDay = function (date) {
11
- var currentDate = new Date(date),
12
- currentYear = currentDate.getFullYear(),
13
- currentMouth = currentDate.getMonth() + 1;
14
- return new Date(currentYear, currentMouth, 1)
15
- }
16
-
17
- window.AppFormulaFunctions.currentDateToDeadline = function (date, during) {
18
- debugger
19
- var changeDate = new Date(new Date(date).getTime() + during * 24 * 60 * 60 * 1000);
20
- var changeYear = changeDate.getFullYear(),
21
- changeMouth = changeDate.getMonth() + 1,
22
- changeDay = changeDate.getDay();
23
- return changeYear + '-' + changeMouth + '-' + changeDay;
24
- }
1
+ import moment from "moment";
2
+
3
+ window.AppFormulaFunctions = {
4
+ currentMonthStartDay : function (dateStr) {
5
+ if (dateStr) {
6
+ let baseDate = moment(dateStr, "YYYY-MM-DD");
7
+ return baseDate.date(1).format("YYYY-MM-DD");
8
+ }
9
+
10
+ return null;
11
+ },
12
+
13
+ nextMonthStartDay : function (dateStr) {
14
+ if (dateStr) {
15
+ let baseDate = moment(dateStr, "YYYY-MM-DD");
16
+ return baseDate.add(1,'months').date(1).format("YYYY-MM-DD");
17
+ }
18
+
19
+ return null;
20
+ },
21
+
22
+ datePlusDays : function (dateStr, during_days) {
23
+ if (dateStr && during_days) {
24
+ let baseDate = moment(dateStr, "YYYY-MM-DD");
25
+ return baseDate.add(during_days, 'days').format("YYYY-MM-DD")
26
+ }
27
+
28
+ return null;
29
+ },
30
+
31
+ datePlusMonths : function (dateStr, during_months) {
32
+ if (dateStr && during_months) {
33
+ let baseDate = moment(dateStr, "YYYY-MM-DD");
34
+ return baseDate.add(during_months, 'months').format("YYYY-MM-DD")
35
+ }
36
+
37
+ return null;
38
+ },
39
+
40
+ datePlusYears : function (dateStr, during_years) {
41
+ if (dateStr && during_years) {
42
+ let baseDate = moment(dateStr, "YYYY-MM-DD");
43
+ return baseDate.add(during_years, 'years').format("YYYY-MM-DD")
44
+ }
45
+
46
+ return null;
47
+ }
48
+ };
@@ -334,7 +334,7 @@ class FormForBrowse extends React.Component{
334
334
  if (typeof initialValue === 'boolean') {
335
335
  value = (initialValues[display_code] ? "是" : "否");
336
336
  } else {
337
- value = ((initialValue || '').toLowerCase() === 'true' ? "是" : "否");
337
+ value = (((initialValue + '' || '').toLowerCase() === 'true' || (initialValue + '' || '').toLowerCase() === '1') ? "是" : "否");
338
338
  }
339
339
  break;
340
340
  default:
@@ -22,6 +22,13 @@ import {UI_RENDER_TYPE} from "../consts";
22
22
  import zhCN from "antd/es/locale/zh_CN";
23
23
  import HttpService from "../../../../services/HttpService";
24
24
  import InputPassword from "../InputPassword";
25
+ import '../../../AppFormulaFunctions'
26
+
27
+ const FormulasValueType = {
28
+ Disabled : "disabled",
29
+ Enabled : "enabled",
30
+ Function : "AppFormulaFunctions",
31
+ }
25
32
 
26
33
  class FormForModify extends React.Component{
27
34
  constructor(props) {
@@ -30,28 +37,41 @@ class FormForModify extends React.Component{
30
37
  this.ref = this.props.formref || React.createRef();
31
38
 
32
39
  this.state = {
33
- editFormulasState: []
40
+ fieldCodeKeyMap: {},
34
41
  }
35
42
  }
36
43
 
37
44
  componentDidMount() {
38
45
  let {data, info_set_fields} = this.props;
39
- let {editFormulasState} = this.state;
40
- info_set_fields.forEach(formItem => {
46
+ let {fieldCodeKeyMap} = this.state;
47
+
48
+ if (info_set_fields && info_set_fields.length <= 0) {
49
+ return;
50
+ }
51
+
52
+ for (let i = 0, len = info_set_fields.length; i < len; i++) {
53
+ let formItem = info_set_fields[i];
54
+
41
55
  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] && data[formItem.code].toString()) || '').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
- }
56
+
57
+ let {code, ui_render_type} = formItem;
58
+ let fieldCodeValue = data[code];
59
+
60
+ if (UI_RENDER_TYPE.SWITCH == ui_render_type) {
61
+ fieldCodeValue = (((fieldCodeValue + '' || '').toLowerCase() === 'true' || (fieldCodeValue + '' || '').toLowerCase() === '1') ? "true" : "false");
52
62
  }
63
+
64
+ if (fieldCodeValue) {
65
+ this.formItemOnChangeForFormula(formItem, fieldCodeValue);
66
+ }
67
+
68
+ formItem.b_disabled = formItem.b_readonly;
69
+ fieldCodeKeyMap[formItem.code] = formItem;
70
+ }
71
+
72
+ this.setState({
73
+ fieldCodeKeyMap,
53
74
  })
54
- this.setState({editFormulasState})
55
75
  }
56
76
 
57
77
  buildExtFormItems = () => {
@@ -129,114 +149,13 @@ class FormForModify extends React.Component{
129
149
  )
130
150
  }
131
151
 
132
- buildFormItems = (editFormulasState) => {
133
- let {data, info_set_fields, ext_form_items} = this.props;
152
+ buildFormItems = () => {
153
+ let {info_set_fields, ext_form_items} = this.props;
134
154
  if (this.ref.current == null) {
135
155
  return;
136
156
  }
137
157
 
138
- let {setFieldsValue} = this.ref.current;
139
158
  if (info_set_fields && info_set_fields.length > 0) {
140
- info_set_fields.forEach(formItem => {
141
- formItem.initialValue = null;
142
-
143
- this.preParseFormItemExtConfig(formItem);
144
-
145
- if (editFormulasState && editFormulasState.length) {
146
- formItem.b_disabled = formItem.b_readonly;
147
- for (let i = 0, len = editFormulasState.length; i < len; i++) {
148
- let editFormulaStateItemCode = editFormulasState[i].editFormulasStateCode;
149
- let editFormulaStateItem = editFormulasState[i].editFormulaItem;
150
- if (editFormulaStateItem) {
151
- editFormulaStateItem.otherFormItemResponses.forEach(item => {
152
- if (formItem.code === item.formItemCode) {
153
- if (item.formItemValue === 'disabled') {
154
- formItem.b_disabled = true;
155
- } else if (item.formItemValue === 'enabled') {
156
- formItem.b_disabled = false;
157
- } else if (item.formItemValue.indexOf('exp') !== -1) {
158
- let expValue = '';
159
- if (isNaN(data[formItem.code])) {
160
- expValue = item.formItemValue.split('exp(')[1].split(')')[0].replace('#value#', data[formItem.code]);
161
- } else {
162
- expValue = String(item.formItemValue.split('exp(')[1].split(')')[0].replace('#value#', Number(data[formItem.code])));
163
- }
164
- formItem.initialValue = eval(expValue);
165
- } else if (item.formItemValue.indexOf('AppFormulaFunctions') !== -1) {
166
- let formulaValue = '';
167
- if (item.formItemValue.indexOf('currentDateToDeadline') !== -1) {
168
- formulaValue = eval(item.formItemValue.replace('#value#', `data[editFormulaStateItemCode], 300`))
169
- } else {
170
- formulaValue = eval(item.formItemValue.replace('#value#', data[editFormulaStateItemCode]))
171
- }
172
- if (formItem.ui_render_type === UI_RENDER_TYPE.DATE || formItem.ui_render_type === UI_RENDER_TYPE.DATE_MONTH || formItem.ui_render_type === UI_RENDER_TYPE.DATE_YEAR || formItem.ui_render_type === UI_RENDER_TYPE.DATE_TIME) {
173
- formulaValue = moment(formulaValue);
174
- }
175
- formItem.initialValue = formulaValue;
176
- } else {
177
- formItem.initialValue = item.formItemValue || data[formItem.display_code];
178
- }
179
- if (formItem.initialValue || data[formItem.code]) {
180
- if (formItem.code.indexOf('date') !== -1) {
181
- setFieldsValue({[formItem.code]: moment(formItem.initialValue || data[formItem.code])});
182
- if (formItem.code.endsWith("_date")) {
183
- data[formItem.code] = moment(formItem.initialValue || data[formItem.code]).valueOf();
184
- } else if (formItem.code.indexOf('_date$') !== -1) {
185
- data[formItem.code] = moment(formItem.initialValue || data[formItem.code]).format("YYYY-MM-DD");
186
- }
187
- } else {
188
- setFieldsValue({[formItem.code]: formItem.initialValue || data[formItem.code]});
189
- data[formItem.code] = formItem.initialValue || data[formItem.code];
190
- }
191
- }
192
- }
193
- })
194
- }
195
- }
196
-
197
- } else {
198
- if (formItem.editFormulaConfigs) {
199
- for (let i = 0, len = formItem.editFormulaConfigs.length; i < len; i++) {
200
- let editFormulaConfig = formItem.editFormulaConfigs[i];
201
- let initialValue = formItem.ui_render_type === 'switch' ? ((data[formItem.code] && data[formItem.code].toString()) || '').toLowerCase() !== 'true' : data[formItem.code];
202
- let formulaValueOf = formItem.ui_render_type === 'switch' ? (editFormulaConfig.onValueOf || '').toLowerCase() !== 'true' : editFormulaConfig.onValueOf;
203
-
204
- if (formulaValueOf === initialValue) {
205
- let currentOtherFormItemResponses = editFormulaConfig.otherFormItemResponses;
206
- currentOtherFormItemResponses.forEach(item => {
207
- info_set_fields.forEach(formItemInner => {
208
- if (formItemInner.code === item.formItemCode) {
209
- if (item.formItemValue === 'disabled') {
210
- formItemInner.b_disabled = true;
211
- } else if (item.formItemValue === 'enabled') {
212
- formItemInner.b_disabled = false;
213
- } else {
214
- formItemInner.initialValue = item.formItemValue || data[formItemInner.display_code];
215
- }
216
- if (formItemInner.initialValue || data[formItemInner.code]) {
217
- if (formItemInner.code.indexOf('date') !== -1) {
218
- setFieldsValue({[formItemInner.code]: moment(formItemInner.initialValue || data[formItemInner.code])})
219
- if (formItemInner.code.endsWith("_date")) {
220
- data[formItemInner.code] = moment(formItemInner.initialValue || data[formItemInner.code]).valueOf();
221
- } else if (formItemInner.code.indexOf('_date$') !== -1) {
222
- data[formItemInner.code] = moment(formItem.initialValue || data[formItemInner.code]).format("YYYY-MM-DD");
223
- }
224
- } else {
225
- setFieldsValue({[formItemInner.code]: formItemInner.initialValue || data[formItemInner.code]});
226
- data[formItemInner.code] = formItemInner.initialValue || data[formItemInner.code];
227
- }
228
- }
229
- }
230
- })
231
- })
232
- }
233
-
234
- }
235
-
236
- }
237
-
238
- }
239
- })
240
159
 
241
160
  let groupNames = info_set_fields.map(item => item.belong_form_group).filter((item, index, arr) => item && item.trim().length > 0 && arr.indexOf(item) === index);
242
161
 
@@ -723,7 +642,7 @@ class FormForModify extends React.Component{
723
642
  valuePropName = "checked";
724
643
 
725
644
  if (typeof initialValue !== 'boolean') {
726
- initialValue = (initialValue || '').toLowerCase() === 'true';
645
+ initialValue = (initialValue + '' || '').toLowerCase() === 'true' || (initialValue + '' || '').toLowerCase() === '1';
727
646
  displayValue = (initialValue ? "是" : "否");
728
647
  }
729
648
 
@@ -943,61 +862,14 @@ class FormForModify extends React.Component{
943
862
  }
944
863
 
945
864
  datePickerOnChange(config, callback, formData, dateFormat, date, dateString) {
946
- if (config.editFormulaConfigs && config.editFormulaConfigs.length) {
947
- let {code} = config;
948
- let {editFormulasState} = this.state;
949
- let {setFieldsValue, resetFields} = this.ref.current;
950
- if (dateString) {
951
- let editFormulaItem = config.editFormulaConfigs[0];
952
- if (editFormulaItem) {
953
- if (dateString) {
954
- editFormulaItem.otherFormItemResponses.forEach(item => {
955
- if (item.formItemValue === 'disabled') {
956
- resetFields([item.formItemCode]);
957
- setFieldsValue({[item.formItemCode]: null});
958
- if (item.formItemCode.endsWith('_pk') && this.props.data[`${item.formItemCode.split('_pk')[0]}_ext_name`]) {
959
- this.props.data[`${item.formItemCode.split('_pk')[0]}_ext_name`] = null;
960
- } else if (item.formItemCode.indexOf('_pk$') !== -1 && this.props.data[`${item.formItemCode.split('_pk$')[0]}_ext_name$${item.formItemCode.split('_pk$')[1]}`]) {
961
- this.props.data[`${item.formItemCode.split('_pk$')[0]}_ext_name$${item.formItemCode.split('_pk$')[1]}`] = null;
962
- }
963
- this.props.data[item.formItemCode] = null;
964
- }
965
- })
966
- }
967
- if (editFormulasState.filter(item => item.editFormulasStateCode === code).length) {
968
- editFormulasState.forEach(item => {
969
- if (item.editFormulasStateCode === code) {
970
- item.editFormulaItem = editFormulaItem;
971
- }
972
- })
973
- } else {
974
- editFormulasState.push({editFormulasStateCode: code, editFormulaItem});
975
- }
976
- } else {
977
- if (editFormulasState.filter(item => item.editFormulasStateCode === code).length) {
978
- editFormulasState.forEach(item => {
979
- if (item.editFormulasStateCode === code) {
980
- item.editFormulaItem = null;
981
- }
982
- })
983
- }
984
- }
985
- } else {
986
- if (editFormulasState.filter(item => item.editFormulasStateCode === code).length) {
987
- editFormulasState.forEach(item => {
988
- if (item.editFormulasStateCode === code) {
989
- item.editFormulaItem = null;
990
- }
991
- })
992
- }
993
- }
994
- this.setState({editFormulasState})
995
- }
996
-
997
865
  if (dateFormat != null) {
998
866
  formData[config.code] = date.format(dateFormat);
999
867
  }
1000
868
 
869
+ if (dateString) {
870
+ this.formItemOnChangeForFormula(config, dateString);
871
+ }
872
+
1001
873
  if (callback && typeof callback === "function") {
1002
874
  callback(date, dateString);
1003
875
  }
@@ -1070,56 +942,8 @@ class FormForModify extends React.Component{
1070
942
  this.props.data[display_code] = display_value;
1071
943
  }
1072
944
 
1073
- if (config.editFormulaConfigs && config.editFormulaConfigs.length) {
1074
- let {editFormulasState} = this.state;
1075
- let {setFieldsValue, resetFields} = this.ref.current;
1076
-
1077
- if (value) {
1078
- let editFormulaItem = config.editFormulaConfigs.filter(editFormulaItem => editFormulaItem.onValueOf === value.toString())[0];
1079
- if (editFormulaItem) {
1080
- if (value) {
1081
- editFormulaItem.otherFormItemResponses.forEach(item => {
1082
- if (item.formItemValue === 'disabled') {
1083
- resetFields([item.formItemCode]);
1084
- setFieldsValue({[item.formItemCode]: null});
1085
- if (item.formItemCode.endsWith('_pk') && this.props.data[`${item.formItemCode.split('_pk')[0]}_ext_name`]) {
1086
- this.props.data[`${item.formItemCode.split('_pk')[0]}_ext_name`] = null;
1087
- } else if (item.formItemCode.indexOf('_pk$') !== -1 && this.props.data[`${item.formItemCode.split('_pk$')[0]}_ext_name$${item.formItemCode.split('_pk$')[1]}`]) {
1088
- this.props.data[`${item.formItemCode.split('_pk$')[0]}_ext_name$${item.formItemCode.split('_pk$')[1]}`] = null;
1089
- }
1090
- this.props.data[item.formItemCode] = null;
1091
- }
1092
- })
1093
- }
1094
- if (editFormulasState.filter(item => item.editFormulasStateCode === code).length) {
1095
- editFormulasState.forEach(item => {
1096
- if (item.editFormulasStateCode === code) {
1097
- item.editFormulaItem = editFormulaItem;
1098
- }
1099
- })
1100
- } else {
1101
- editFormulasState.push({editFormulasStateCode: code, editFormulaItem});
1102
- }
1103
- } else {
1104
- if (editFormulasState.filter(item => item.editFormulasStateCode === code).length) {
1105
- editFormulasState.forEach(item => {
1106
- if (item.editFormulasStateCode === code) {
1107
- item.editFormulaItem = null;
1108
- }
1109
- })
1110
- }
1111
- }
1112
- } else {
1113
- if (editFormulasState.filter(item => item.editFormulasStateCode === code).length) {
1114
- editFormulasState.forEach(item => {
1115
- if (item.editFormulasStateCode === code) {
1116
- item.editFormulaItem = null;
1117
- }
1118
- })
1119
- }
1120
- }
1121
-
1122
- this.setState({editFormulasState})
945
+ if (value) {
946
+ this.formItemOnChangeForFormula(config, value)
1123
947
  }
1124
948
 
1125
949
  if (callback && typeof callback === "function") {
@@ -1217,39 +1041,106 @@ class FormForModify extends React.Component{
1217
1041
  }
1218
1042
  }
1219
1043
 
1220
- switchOnChange(config, callback, checked, event) {
1221
- if (config.editFormulaConfigs && config.editFormulaConfigs.length) {
1222
- let {code} = config;
1223
- let {editFormulasState} = this.state;
1224
- let {setFieldsValue, resetFields} = this.ref.current;
1225
- let editFormulaItem = config.editFormulaConfigs.filter(editFormulaItem => editFormulaItem.onValueOf === checked.toString())[0];
1044
+ formItemOnChangeForFormula = (config, value) => {
1045
+ let formItemFormulaConfigs = config.editFormulaConfigs;
1046
+ if (formItemFormulaConfigs && formItemFormulaConfigs.length > 0) {
1047
+ let {fieldCodeKeyMap} = this.state;
1048
+ let {data, def_docs} = this.props;
1049
+ let {setFieldsValue} = this.ref.current;
1050
+ // value exists
1051
+ let editFormulaItem = config.editFormulaConfigs.find(editFormulaItem => editFormulaItem.onValueOf === value.toString() || editFormulaItem.onValueOf === "value");
1052
+
1226
1053
  if (editFormulaItem) {
1227
- if (!checked) {
1228
- editFormulaItem.otherFormItemResponses.forEach(item => {
1229
- resetFields([item.formItemCode]);
1230
- setFieldsValue({[item.formItemCode]: null});
1231
- if (item.formItemCode.endsWith('_pk') && this.props.data[`${item.formItemCode.split('_pk')[0]}_ext_name`]) {
1232
- this.props.data[`${item.formItemCode.split('_pk')[0]}_ext_name`] = null;
1233
- } else if (item.formItemCode.indexOf('_pk$') !== -1 && this.props.data[`${item.formItemCode.split('_pk$')[0]}_ext_name$${item.formItemCode.split('_pk$')[1]}`]) {
1234
- this.props.data[`${item.formItemCode.split('_pk$')[0]}_ext_name$${item.formItemCode.split('_pk$')[1]}`] = null;
1054
+ let otherFormItemResponses = editFormulaItem.otherFormItemResponses;
1055
+
1056
+ for (let i = 0, len = otherFormItemResponses.length; i < len; i++) {
1057
+ let otherFormItem = otherFormItemResponses[i];
1058
+ if (!otherFormItem) {
1059
+ continue;
1060
+ }
1061
+
1062
+ let {formItemCode, formItemValue} = otherFormItem;
1063
+ let otherFormItemConfig = fieldCodeKeyMap[formItemCode];
1064
+ if (!otherFormItemConfig) {
1065
+ continue;
1066
+ }
1067
+
1068
+ if (!formItemValue) {
1069
+ continue;
1070
+ }
1071
+
1072
+ let {code, display_code, ref_pk, ui_render_type} = otherFormItemConfig;
1073
+ if (FormulasValueType.Disabled == formItemValue) {
1074
+ data[code] = null;
1075
+ setFieldsValue({[code]: null});
1076
+
1077
+ if (display_code) {
1078
+ data[display_code] = null;
1079
+ setFieldsValue({[display_code]: null});
1235
1080
  }
1236
- this.props.data[item.formItemCode] = null;
1237
- })
1238
- }
1239
- if (editFormulasState.filter(item => item.editFormulasStateCode === code).length) {
1240
- editFormulasState.forEach(item => {
1241
- if (item.editFormulasStateCode === code) {
1242
- item.editFormulaItem = editFormulaItem;
1081
+
1082
+ otherFormItemConfig.b_disabled = true;
1083
+ otherFormItemConfig.b_readonly = true;
1084
+ } else if (FormulasValueType.Enabled == formItemValue) {
1085
+
1086
+ otherFormItemConfig.b_disabled = false;
1087
+ otherFormItemConfig.b_readonly = false;
1088
+ } else if (formItemValue.startsWith(FormulasValueType.Function)) {
1089
+ let formulaFunctionValue;
1090
+ if (formItemValue.search("#value#") !== -1) {
1091
+ formulaFunctionValue = eval(formItemValue.replace('#value#', `value`).replace("@", ","));
1092
+ } else {
1093
+ let formItemValueList = formItemValue.split("#");
1094
+ if (!formItemValueList || formItemValueList.length != 3) {
1095
+ console.log("formula error, detail info: formItemCode=" + formItemValue + ", formItemValue=" + formItemValue);
1096
+ continue;
1097
+ }
1098
+
1099
+ let realFormulaValue = formItemValueList[0] + `data[formItemValueList[1]]` + formItemValueList[2];
1100
+
1101
+ formulaFunctionValue = eval(realFormulaValue.replace("@", ","));
1243
1102
  }
1244
- })
1245
- } else {
1246
- editFormulasState.push({editFormulasStateCode: code, editFormulaItem});
1103
+
1104
+ if (!formulaFunctionValue) {
1105
+ console.log("formula function return null, detail info: formItemCode=" + formItemValue + ", formItemValue=" + formItemValue);
1106
+ continue;
1107
+ }
1108
+
1109
+ data[code] = formulaFunctionValue;
1110
+
1111
+ let otherFormItemValue;
1112
+ if (UI_RENDER_TYPE.DATE == ui_render_type) {
1113
+ otherFormItemValue = moment(formulaFunctionValue, "YYYY-MM-DD");
1114
+ } else {
1115
+ otherFormItemValue = formulaFunctionValue;
1116
+ }
1117
+ setFieldsValue({[code]: otherFormItemValue});
1118
+ } else {
1119
+ data[code] = formItemValue;
1120
+ setFieldsValue({[code]: formItemValue});
1121
+
1122
+ if (display_code && display_code.trim().length > 0) {
1123
+ let dictList = def_docs["def_" + ref_pk];
1124
+ if (dictList && dictList.length > 0) {
1125
+ let filteredDict = dictList.find(item => item.pk.toString() == formItemValue);
1126
+ if (filteredDict) {
1127
+ let ref_title = filteredDict.title;
1128
+
1129
+ data[display_code] = ref_title;
1130
+ setFieldsValue({[display_code]: ref_title});
1131
+ }
1132
+ }
1133
+ }
1134
+ }
1247
1135
  }
1248
- } else {
1249
- editFormulasState.push({editFormulasStateCode: code, editFormulaItem: null});
1250
1136
  }
1251
- this.setState({editFormulasState})
1137
+
1138
+ this.setState({fieldCodeKeyMap})
1252
1139
  }
1140
+ }
1141
+
1142
+ switchOnChange(config, callback, checked, event) {
1143
+ this.formItemOnChangeForFormula(config, checked);
1253
1144
 
1254
1145
  if (callback && typeof callback === "function") {
1255
1146
  callback(checked, event);
@@ -1312,7 +1203,7 @@ class FormForModify extends React.Component{
1312
1203
 
1313
1204
  render() {
1314
1205
  let {props} = this;
1315
- let {editFormulasState} = this.state;
1206
+ let {fieldCodeKeyMap} = this.state;
1316
1207
  return (
1317
1208
  <ConfigProvider locale={zhCN}>
1318
1209
  <Form
@@ -1322,7 +1213,7 @@ class FormForModify extends React.Component{
1322
1213
  scrollToFirstError
1323
1214
  onValuesChange={this.onValuesChange.bind(this)}
1324
1215
  >
1325
- {this.buildFormItems(editFormulasState)}
1216
+ {this.buildFormItems(fieldCodeKeyMap)}
1326
1217
  {this.buildExtFormItems()}
1327
1218
  </Form>
1328
1219
  </ConfigProvider>
@@ -114,22 +114,24 @@ class HttpService {
114
114
  rpcMethodName = "";
115
115
  }
116
116
 
117
- if (jsonObject) {
118
- ajaxOptions.data = jsonObject;
119
- }
117
+ if (!this.__checkJSONObjectSecurity(jsonObject)) {
118
+ if (jsonObject) {
119
+ ajaxOptions.data = jsonObject;
120
+ }
120
121
 
121
- if (ajaxOptions.rpcMethodName) {
122
- delete ajaxOptions.rpcMethodName;
123
- }
122
+ if (ajaxOptions.rpcMethodName) {
123
+ delete ajaxOptions.rpcMethodName;
124
+ }
124
125
 
125
- ajaxOptions.type = "post";
126
- ajaxOptions.dataType = "json";
126
+ ajaxOptions.type = "post";
127
+ ajaxOptions.dataType = "json";
127
128
 
128
- if (!ajaxOptions.url) {
129
- ajaxOptions.url = this.requestContextPath + rpcMethodName;
130
- }
129
+ if (!ajaxOptions.url) {
130
+ ajaxOptions.url = this.requestContextPath + rpcMethodName;
131
+ }
131
132
 
132
- return $.ajax(ajaxOptions);
133
+ return $.ajax(ajaxOptions);
134
+ }
133
135
  }
134
136
 
135
137
  __postForMock(mockOptions) {