@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.
@@ -163,7 +163,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
163
163
  } else if (item.formItemValue === 'enabled') {
164
164
  formItem.b_disabled = false;
165
165
  } else {
166
- formItem.initialValue = item.formItemValue || '';
166
+ formItem.initialValue = item.formItemValue || data[formItem.display_code];
167
167
  }
168
168
  }
169
169
  });
@@ -177,10 +177,6 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
177
177
  var formulaValueOf = formItem.ui_render_type === 'switch' ? (editFormulaConfig.onValueOf || '').toLowerCase() !== 'true' : editFormulaConfig.onValueOf;
178
178
 
179
179
  if (formulaValueOf === initialValue) {
180
- editFormulasState.push({
181
- editFormulasStateCode: formItem.code,
182
- editFormulaItem: editFormulaConfig
183
- });
184
180
  var currentOtherFormItemResponses = editFormulaConfig.otherFormItemResponses;
185
181
  currentOtherFormItemResponses.forEach(function (item) {
186
182
  info_set_fields.forEach(function (formItemInner) {
@@ -190,7 +186,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
190
186
  } else if (item.formItemValue === 'enabled') {
191
187
  formItemInner.b_disabled = false;
192
188
  } else {
193
- formItemInner.initialValue = item.formItemValue || '';
189
+ formItemInner.initialValue = item.formItemValue || data[formItem.display_code];
194
190
  }
195
191
  }
196
192
  });
@@ -385,7 +381,12 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
385
381
 
386
382
  display_code = display_code || code;
387
383
  var initialValue = dataItem.initialValue || data[code];
388
- var displayValue = dataItem.initialValue || data[display_code];
384
+ var displayValue = data[display_code];
385
+
386
+ if (code === 'old__end_date$i_hi_person_contract') {
387
+ console.log(code, initialValue);
388
+ }
389
+
389
390
  var component, valuePropName;
390
391
 
391
392
  if (custom_form_items && custom_form_items[code + "_form_item"] && typeof custom_form_items[code + "_form_item"] === "function") {
@@ -464,36 +465,6 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
464
465
  }, ext_props));
465
466
  break;
466
467
 
467
- case _consts.UI_RENDER_TYPE.DATE_YEAR:
468
- initialValue = initialValue ? (0, _moment["default"])(initialValue) : "";
469
- displayValue = displayValue ? (0, _moment["default"])(displayValue).format("YYYY") : "";
470
- component = (b_disabled !== undefined ? b_disabled : b_readonly) ? /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("span", null, displayValue)) : /*#__PURE__*/_react["default"].createElement(_antd.DatePicker, _extends({
471
- key: form_id + "_" + code,
472
- getPopupContainer: function getPopupContainer() {
473
- return document.getElementById("ant_form_item_".concat(code));
474
- },
475
- placeholder: "请选择" + name,
476
- picker: "year",
477
- onChange: _this2.datePickerOnChange.bind(_assertThisInitialized(_this2), dataItem, onChange),
478
- disabledDate: _this2.disabledDate.bind(_assertThisInitialized(_this2), dataItem)
479
- }, ext_props));
480
- break;
481
-
482
- case _consts.UI_RENDER_TYPE.DATE_MONTH:
483
- initialValue = initialValue ? (0, _moment["default"])(initialValue) : "";
484
- displayValue = displayValue ? (0, _moment["default"])(displayValue).format("YYYY-MM") : "";
485
- component = (b_disabled !== undefined ? b_disabled : b_readonly) ? /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("span", null, displayValue)) : /*#__PURE__*/_react["default"].createElement(_antd.DatePicker, _extends({
486
- key: form_id + "_" + code,
487
- getPopupContainer: function getPopupContainer() {
488
- return document.getElementById("ant_form_item_".concat(code));
489
- },
490
- placeholder: "请选择" + name,
491
- picker: "month",
492
- onChange: _this2.datePickerOnChange.bind(_assertThisInitialized(_this2), dataItem, onChange),
493
- disabledDate: _this2.disabledDate.bind(_assertThisInitialized(_this2), dataItem)
494
- }, ext_props));
495
- break;
496
-
497
468
  case _consts.UI_RENDER_TYPE.DATE_TIME:
498
469
  initialValue = initialValue ? (0, _moment["default"])(initialValue) : "";
499
470
  displayValue = displayValue ? (0, _moment["default"])(displayValue).format("YYYY-MM-DD hh:mm:ss") : "";
@@ -747,7 +718,35 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
747
718
 
748
719
  _createClass(FormForModify, [{
749
720
  key: "componentDidMount",
750
- value: function componentDidMount() {}
721
+ value: function componentDidMount() {
722
+ var _this3 = this;
723
+
724
+ var _this$props = this.props,
725
+ data = _this$props.data,
726
+ info_set_fields = _this$props.info_set_fields;
727
+ var editFormulasState = this.state.editFormulasState;
728
+ info_set_fields.forEach(function (formItem) {
729
+ _this3.preParseFormItemExtConfig(formItem);
730
+
731
+ if (formItem.editFormulaConfigs) {
732
+ for (var i = 0, len = formItem.editFormulaConfigs.length; i < len; i++) {
733
+ var editFormulaConfig = formItem.editFormulaConfigs[i];
734
+ var initialValue = formItem.ui_render_type === 'switch' ? (data[formItem.code] || '').toLowerCase() !== 'true' : data[formItem.code];
735
+ var formulaValueOf = formItem.ui_render_type === 'switch' ? (editFormulaConfig.onValueOf || '').toLowerCase() !== 'true' : editFormulaConfig.onValueOf;
736
+
737
+ if (formulaValueOf === initialValue) {
738
+ editFormulasState.push({
739
+ editFormulasStateCode: formItem.code,
740
+ editFormulaItem: editFormulaConfig
741
+ });
742
+ }
743
+ }
744
+ }
745
+ });
746
+ this.setState({
747
+ editFormulasState: editFormulasState
748
+ });
749
+ }
751
750
  }, {
752
751
  key: "validator",
753
752
  value: function validator(b_required, ui_render_type, rule, value) {
@@ -926,6 +925,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
926
925
  }
927
926
 
928
927
  if (config.editFormulaConfigs && config.editFormulaConfigs.length) {
928
+ var data = this.props.data;
929
929
  var editFormulasState = this.state.editFormulasState;
930
930
  var setFieldsValue = this.ref.current.setFieldsValue;
931
931
 
@@ -938,7 +938,11 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
938
938
  if (value) {
939
939
  editFormulaItem.otherFormItemResponses.forEach(function (item) {
940
940
  if (item.formItemValue === 'disabled') {
941
- setFieldsValue(_defineProperty({}, item.formItemCode, ''));
941
+ if (item.formItemCode.indexOf('date') !== -1) {
942
+ setFieldsValue(_defineProperty({}, item.formItemCode, (0, _moment["default"])(data[item.formItemCode]) || ''));
943
+ } else {
944
+ setFieldsValue(_defineProperty({}, item.formItemCode, data[item.formItemCode] || ''));
945
+ }
942
946
  }
943
947
  });
944
948
  }
@@ -1014,7 +1018,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
1014
1018
  }, {
1015
1019
  key: "buildTreeNode",
1016
1020
  value: function buildTreeNode(defNodes) {
1017
- var _this3 = this;
1021
+ var _this4 = this;
1018
1022
 
1019
1023
  if (!defNodes || defNodes.length === 0) {
1020
1024
  return null;
@@ -1035,7 +1039,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
1035
1039
  ext_attr_value: ext_attr_value,
1036
1040
  selectable: item.selectable,
1037
1041
  prop: ext_attr_value
1038
- }, _this3.buildTreeNode(item.children));
1042
+ }, _this4.buildTreeNode(item.children));
1039
1043
  });
1040
1044
  }
1041
1045
  }, {
@@ -1092,9 +1096,9 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
1092
1096
  }, {
1093
1097
  key: "switchOnChange",
1094
1098
  value: function switchOnChange(config, callback, checked, event) {
1095
- var code = config.code;
1096
-
1097
1099
  if (config.editFormulaConfigs && config.editFormulaConfigs.length) {
1100
+ var data = this.props.data;
1101
+ var code = config.code;
1098
1102
  var editFormulasState = this.state.editFormulasState;
1099
1103
  var setFieldsValue = this.ref.current.setFieldsValue;
1100
1104
  var editFormulaItem = config.editFormulaConfigs.filter(function (editFormulaItem) {
@@ -1104,7 +1108,11 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
1104
1108
  if (editFormulaItem) {
1105
1109
  if (!checked) {
1106
1110
  editFormulaItem.otherFormItemResponses.forEach(function (item) {
1107
- setFieldsValue(_defineProperty({}, item.formItemCode, ''));
1111
+ if (item.formItemCode.indexOf('date') !== -1) {
1112
+ setFieldsValue(_defineProperty({}, item.formItemCode, (0, _moment["default"])(data[item.formItemCode]) || ''));
1113
+ } else {
1114
+ setFieldsValue(_defineProperty({}, item.formItemCode, data[item.formItemCode] || ''));
1115
+ }
1108
1116
  });
1109
1117
  }
1110
1118
 
@@ -1159,14 +1167,14 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
1159
1167
  key: "deleteFile",
1160
1168
  value: function () {
1161
1169
  var _deleteFile = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dataItem) {
1162
- var file_pk, _this$props, file_service_path, appconfig, _this;
1170
+ var file_pk, _this$props2, file_service_path, appconfig, _this;
1163
1171
 
1164
1172
  return regeneratorRuntime.wrap(function _callee$(_context) {
1165
1173
  while (1) {
1166
1174
  switch (_context.prev = _context.next) {
1167
1175
  case 0:
1168
1176
  file_pk = this.props.data[dataItem.code];
1169
- _this$props = this.props, file_service_path = _this$props.file_service_path, appconfig = _this$props.appconfig;
1177
+ _this$props2 = this.props, file_service_path = _this$props2.file_service_path, appconfig = _this$props2.appconfig;
1170
1178
  _context.prev = 2;
1171
1179
  _this = this;
1172
1180
  _context.next = 6;