kts-component-invoice-operate 3.2.79 → 3.2.80

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/dist/index.esm.js CHANGED
@@ -22082,7 +22082,9 @@ function TaxClassificationModal(props) {
22082
22082
 
22083
22083
  React.useEffect(function () {
22084
22084
  if (!props.open) {
22085
- form.resetFields();
22085
+ setTimeout(function () {
22086
+ form.resetFields();
22087
+ }, 500);
22086
22088
  }
22087
22089
  }, [form, props.open]);
22088
22090
  return React.createElement(Drawer$1, {
@@ -22098,14 +22100,16 @@ function TaxClassificationModal(props) {
22098
22100
  }, React.createElement(Input$1, {
22099
22101
  placeholder: "\u8BF7\u8F93\u5165\u7A0E\u6536\u5206\u7C7B\u7F16\u7801\u3001\u7A0E\u6536\u5206\u7C7B\u540D\u79F0\u8FDB\u884C\u68C0\u7D22",
22100
22102
  onChange: props.onSearch
22101
- })), React.createElement(Tree, {
22103
+ })), React.createElement(Form$1.Item, {
22104
+ name: 'tree'
22105
+ }, React.createElement(Tree, {
22102
22106
  onSelect: props.onSelect,
22103
22107
  loadData: props.onLoad,
22104
22108
  treeData: props.list,
22105
22109
  switcherIcon: React.createElement(Icon$1, {
22106
22110
  type: "down"
22107
22111
  })
22108
- })));
22112
+ }))));
22109
22113
  }
22110
22114
 
22111
22115
  var TreeNode = Tree$1.TreeNode;
@@ -22622,93 +22626,118 @@ var DrawerBody$3 = function DrawerBody(props) {
22622
22626
  setList = _React$useState16[1];
22623
22627
 
22624
22628
  var onSearch = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
22625
- var _value$target;
22626
-
22627
22629
  var value,
22630
+ _value$target,
22628
22631
  arr,
22629
- list,
22632
+ _list,
22630
22633
  _args11 = arguments;
22634
+
22631
22635
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
22632
22636
  while (1) {
22633
22637
  switch (_context11.prev = _context11.next) {
22634
22638
  case 0:
22635
22639
  value = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : null;
22636
- _context11.next = 3;
22640
+
22641
+ if (!value) {
22642
+ _context11.next = 9;
22643
+ break;
22644
+ }
22645
+
22646
+ _context11.next = 4;
22637
22647
  return controller.state.goodsListState.endowCode.onSearchTaxClassificationCode(value === null || value === void 0 ? void 0 : (_value$target = value.target) === null || _value$target === void 0 ? void 0 : _value$target.value);
22638
22648
 
22639
- case 3:
22649
+ case 4:
22640
22650
  arr = _context11.sent;
22641
- list = arr.map(function (item) {
22642
- var _value$target2;
22643
-
22644
- var data = _objectSpread2(_objectSpread2({}, item), {}, {
22651
+ _list = arr.map(function (item) {
22652
+ return _objectSpread2(_objectSpread2({}, item), {}, {
22645
22653
  title: "".concat(item.productName, " ").concat(item.taxCategoryCode),
22646
- key: item.taxCategoryCode
22654
+ key: item.taxCategoryCode,
22655
+ isLeaf: true
22647
22656
  });
22648
-
22649
- if (value === null || value === void 0 ? void 0 : (_value$target2 = value.target) === null || _value$target2 === void 0 ? void 0 : _value$target2.value) {
22650
- data.isLeaf = true;
22651
- } else {
22652
- data.selectable = false;
22653
- }
22654
-
22655
- return data;
22656
22657
  });
22657
- setList(list);
22658
+ setList(_list);
22659
+ _context11.next = 11;
22660
+ break;
22658
22661
 
22659
- case 6:
22662
+ case 9:
22663
+ _context11.next = 11;
22664
+ return onLoad();
22665
+
22666
+ case 11:
22660
22667
  case "end":
22661
22668
  return _context11.stop();
22662
22669
  }
22663
22670
  }
22664
22671
  }, _callee11);
22665
22672
  })), []);
22666
- var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
22667
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
22673
+ var onLoad = React.useCallback( /*#__PURE__*/function () {
22674
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(value) {
22675
+ var arr, data, treeData;
22676
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
22677
+ while (1) {
22678
+ switch (_context12.prev = _context12.next) {
22679
+ case 0:
22680
+ _context12.next = 2;
22681
+ return controller.state.goodsListState.endowCode.onLoadTaxClassificationCode(value === null || value === void 0 ? void 0 : value.taxCategoryCode);
22682
+
22683
+ case 2:
22684
+ arr = _context12.sent;
22685
+ data = arr.map(function (item) {
22686
+ return _objectSpread2(_objectSpread2({}, item), {}, {
22687
+ title: "".concat(item.productName, " ").concat(item.taxCategoryCode),
22688
+ key: item.taxCategoryCode
22689
+ });
22690
+ });
22691
+ treeData = optimizeTreeData(data);
22692
+
22693
+ if (value === null || value === void 0 ? void 0 : value.key) {
22694
+ setList(function (origin) {
22695
+ updateTreeData(origin, value.key, treeData);
22696
+ });
22697
+ } else {
22698
+ setList(treeData);
22699
+ }
22700
+
22701
+ return _context12.abrupt("return", []);
22702
+
22703
+ case 7:
22704
+ case "end":
22705
+ return _context12.stop();
22706
+ }
22707
+ }
22708
+ }, _callee12);
22709
+ }));
22710
+
22711
+ return function (_x9) {
22712
+ return _ref12.apply(this, arguments);
22713
+ };
22714
+ }(), []);
22715
+ var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
22716
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
22668
22717
  while (1) {
22669
- switch (_context12.prev = _context12.next) {
22718
+ switch (_context13.prev = _context13.next) {
22670
22719
  case 0:
22671
- _context12.next = 2;
22672
- return onSearch();
22720
+ _context13.next = 2;
22721
+ return onLoad();
22673
22722
 
22674
22723
  case 2:
22675
22724
  setOpen(true);
22676
22725
 
22677
22726
  case 3:
22678
22727
  case "end":
22679
- return _context12.stop();
22728
+ return _context13.stop();
22680
22729
  }
22681
22730
  }
22682
- }, _callee12);
22731
+ }, _callee13);
22683
22732
  })), []);
22684
22733
  var onSelect = React.useCallback(function (key, info) {
22685
22734
  actions.setFieldState('taxClassificationCode', /*#__PURE__*/function () {
22686
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(s) {
22687
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
22688
- while (1) {
22689
- switch (_context13.prev = _context13.next) {
22690
- case 0:
22691
- s.value = info.node.taxCategoryCode;
22692
-
22693
- case 1:
22694
- case "end":
22695
- return _context13.stop();
22696
- }
22697
- }
22698
- }, _callee13);
22699
- }));
22700
-
22701
- return function (_x9) {
22702
- return _ref13.apply(this, arguments);
22703
- };
22704
- }());
22705
- actions.setFieldState('productName', /*#__PURE__*/function () {
22706
22735
  var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(s) {
22707
22736
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
22708
22737
  while (1) {
22709
22738
  switch (_context14.prev = _context14.next) {
22710
22739
  case 0:
22711
- s.value = info.node.productName;
22740
+ s.value = info.node.taxCategoryCode;
22712
22741
 
22713
22742
  case 1:
22714
22743
  case "end":
@@ -22722,13 +22751,13 @@ var DrawerBody$3 = function DrawerBody(props) {
22722
22751
  return _ref14.apply(this, arguments);
22723
22752
  };
22724
22753
  }());
22725
- actions.setFieldState('shorthand', /*#__PURE__*/function () {
22754
+ actions.setFieldState('productName', /*#__PURE__*/function () {
22726
22755
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
22727
22756
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
22728
22757
  while (1) {
22729
22758
  switch (_context15.prev = _context15.next) {
22730
22759
  case 0:
22731
- s.value = info.node.shorthand;
22760
+ s.value = info.node.productName;
22732
22761
 
22733
22762
  case 1:
22734
22763
  case "end":
@@ -22742,13 +22771,13 @@ var DrawerBody$3 = function DrawerBody(props) {
22742
22771
  return _ref15.apply(this, arguments);
22743
22772
  };
22744
22773
  }());
22745
- actions.setFieldState('taxRate', /*#__PURE__*/function () {
22774
+ actions.setFieldState('shorthand', /*#__PURE__*/function () {
22746
22775
  var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(s) {
22747
22776
  return _regeneratorRuntime().wrap(function _callee16$(_context16) {
22748
22777
  while (1) {
22749
22778
  switch (_context16.prev = _context16.next) {
22750
22779
  case 0:
22751
- s.value = info.node.taxRate;
22780
+ s.value = info.node.shorthand;
22752
22781
 
22753
22782
  case 1:
22754
22783
  case "end":
@@ -22762,11 +22791,40 @@ var DrawerBody$3 = function DrawerBody(props) {
22762
22791
  return _ref16.apply(this, arguments);
22763
22792
  };
22764
22793
  }());
22794
+ actions.setFieldState('taxRate', /*#__PURE__*/function () {
22795
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(s) {
22796
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
22797
+ while (1) {
22798
+ switch (_context17.prev = _context17.next) {
22799
+ case 0:
22800
+ s.value = info.node.taxRate;
22801
+
22802
+ case 1:
22803
+ case "end":
22804
+ return _context17.stop();
22805
+ }
22806
+ }
22807
+ }, _callee17);
22808
+ }));
22809
+
22810
+ return function (_x13) {
22811
+ return _ref17.apply(this, arguments);
22812
+ };
22813
+ }());
22765
22814
  setOpen(false);
22766
22815
  }, [controller, actions]);
22767
22816
 
22817
+ var optimizeTreeData = function optimizeTreeData(data) {
22818
+ return data.map(function (item) {
22819
+ return _objectSpread2(_objectSpread2({}, item), {}, {
22820
+ selectable: (item === null || item === void 0 ? void 0 : item.hzx) === 'N',
22821
+ isLeaf: (item === null || item === void 0 ? void 0 : item.hzx) === 'N'
22822
+ });
22823
+ });
22824
+ };
22825
+
22768
22826
  var updateTreeData = function updateTreeData(list, key, children) {
22769
- var demo = list.map(function (node) {
22827
+ return list.map(function (node) {
22770
22828
  if (node.key === key) {
22771
22829
  return _objectSpread2(_objectSpread2({}, node), {}, {
22772
22830
  children: children
@@ -22781,52 +22839,8 @@ var DrawerBody$3 = function DrawerBody(props) {
22781
22839
 
22782
22840
  return node;
22783
22841
  });
22784
- setList(demo);
22785
22842
  };
22786
22843
 
22787
- var onLoad = React.useCallback( /*#__PURE__*/function () {
22788
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(value) {
22789
- var arr, data;
22790
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
22791
- while (1) {
22792
- switch (_context17.prev = _context17.next) {
22793
- case 0:
22794
- if (!value.children) {
22795
- _context17.next = 2;
22796
- break;
22797
- }
22798
-
22799
- return _context17.abrupt("return", []);
22800
-
22801
- case 2:
22802
- _context17.next = 4;
22803
- return controller.state.goodsListState.endowCode.onLoadTaxClassificationCode(value.taxCategoryCode);
22804
-
22805
- case 4:
22806
- arr = _context17.sent;
22807
- data = arr.map(function (item) {
22808
- return _objectSpread2(_objectSpread2({}, item), {}, {
22809
- title: "".concat(item.productName, " ").concat(item.taxCategoryCode),
22810
- key: item.taxCategoryCode
22811
- });
22812
- });
22813
- setList(function (origin) {
22814
- updateTreeData(origin, value.key, data);
22815
- });
22816
- return _context17.abrupt("return", []);
22817
-
22818
- case 8:
22819
- case "end":
22820
- return _context17.stop();
22821
- }
22822
- }
22823
- }, _callee17);
22824
- }));
22825
-
22826
- return function (_x13) {
22827
- return _ref17.apply(this, arguments);
22828
- };
22829
- }(), []);
22830
22844
  return React.createElement(React.Fragment, null, React.createElement(Input, {
22831
22845
  readOnly: true,
22832
22846
  onClick: onClick,
@@ -22951,7 +22965,7 @@ var DrawerBody$3 = function DrawerBody(props) {
22951
22965
  actions: actions,
22952
22966
  previewPlaceholder: " ",
22953
22967
  components: _objectSpread2(_objectSpread2({}, components), {}, {
22954
- showSearch: !!controller.state.goodsListState.endowCode.onSearchTaxClassificationCode() ? ShowSearch3 : ShowSearch
22968
+ showSearch: !!controller.state.goodsListState.endowCode.onLoadTaxClassificationCode() ? ShowSearch3 : ShowSearch
22955
22969
  }),
22956
22970
  effects: effects
22957
22971
  }, React.createElement(FormButtonGroup, null, React.createElement(SchemaMarkupField, {
package/dist/index.js CHANGED
@@ -22092,7 +22092,9 @@ function TaxClassificationModal(props) {
22092
22092
 
22093
22093
  React__default['default'].useEffect(function () {
22094
22094
  if (!props.open) {
22095
- form.resetFields();
22095
+ setTimeout(function () {
22096
+ form.resetFields();
22097
+ }, 500);
22096
22098
  }
22097
22099
  }, [form, props.open]);
22098
22100
  return React__default['default'].createElement(ktsXui.Drawer, {
@@ -22108,14 +22110,16 @@ function TaxClassificationModal(props) {
22108
22110
  }, React__default['default'].createElement(ktsXui.Input, {
22109
22111
  placeholder: "\u8BF7\u8F93\u5165\u7A0E\u6536\u5206\u7C7B\u7F16\u7801\u3001\u7A0E\u6536\u5206\u7C7B\u540D\u79F0\u8FDB\u884C\u68C0\u7D22",
22110
22112
  onChange: props.onSearch
22111
- })), React__default['default'].createElement(ktsXui.Tree, {
22113
+ })), React__default['default'].createElement(ktsXui.Form.Item, {
22114
+ name: 'tree'
22115
+ }, React__default['default'].createElement(ktsXui.Tree, {
22112
22116
  onSelect: props.onSelect,
22113
22117
  loadData: props.onLoad,
22114
22118
  treeData: props.list,
22115
22119
  switcherIcon: React__default['default'].createElement(ktsComponentsAntdX3.Icon, {
22116
22120
  type: "down"
22117
22121
  })
22118
- })));
22122
+ }))));
22119
22123
  }
22120
22124
 
22121
22125
  var TreeNode = ktsComponentsAntdX3.Tree.TreeNode;
@@ -22632,93 +22636,118 @@ var DrawerBody$3 = function DrawerBody(props) {
22632
22636
  setList = _React$useState16[1];
22633
22637
 
22634
22638
  var onSearch = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
22635
- var _value$target;
22636
-
22637
22639
  var value,
22640
+ _value$target,
22638
22641
  arr,
22639
- list,
22642
+ _list,
22640
22643
  _args11 = arguments;
22644
+
22641
22645
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
22642
22646
  while (1) {
22643
22647
  switch (_context11.prev = _context11.next) {
22644
22648
  case 0:
22645
22649
  value = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : null;
22646
- _context11.next = 3;
22650
+
22651
+ if (!value) {
22652
+ _context11.next = 9;
22653
+ break;
22654
+ }
22655
+
22656
+ _context11.next = 4;
22647
22657
  return controller.state.goodsListState.endowCode.onSearchTaxClassificationCode(value === null || value === void 0 ? void 0 : (_value$target = value.target) === null || _value$target === void 0 ? void 0 : _value$target.value);
22648
22658
 
22649
- case 3:
22659
+ case 4:
22650
22660
  arr = _context11.sent;
22651
- list = arr.map(function (item) {
22652
- var _value$target2;
22653
-
22654
- var data = _objectSpread2(_objectSpread2({}, item), {}, {
22661
+ _list = arr.map(function (item) {
22662
+ return _objectSpread2(_objectSpread2({}, item), {}, {
22655
22663
  title: "".concat(item.productName, " ").concat(item.taxCategoryCode),
22656
- key: item.taxCategoryCode
22664
+ key: item.taxCategoryCode,
22665
+ isLeaf: true
22657
22666
  });
22658
-
22659
- if (value === null || value === void 0 ? void 0 : (_value$target2 = value.target) === null || _value$target2 === void 0 ? void 0 : _value$target2.value) {
22660
- data.isLeaf = true;
22661
- } else {
22662
- data.selectable = false;
22663
- }
22664
-
22665
- return data;
22666
22667
  });
22667
- setList(list);
22668
+ setList(_list);
22669
+ _context11.next = 11;
22670
+ break;
22668
22671
 
22669
- case 6:
22672
+ case 9:
22673
+ _context11.next = 11;
22674
+ return onLoad();
22675
+
22676
+ case 11:
22670
22677
  case "end":
22671
22678
  return _context11.stop();
22672
22679
  }
22673
22680
  }
22674
22681
  }, _callee11);
22675
22682
  })), []);
22676
- var onClick = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
22677
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
22683
+ var onLoad = React__default['default'].useCallback( /*#__PURE__*/function () {
22684
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(value) {
22685
+ var arr, data, treeData;
22686
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
22687
+ while (1) {
22688
+ switch (_context12.prev = _context12.next) {
22689
+ case 0:
22690
+ _context12.next = 2;
22691
+ return controller.state.goodsListState.endowCode.onLoadTaxClassificationCode(value === null || value === void 0 ? void 0 : value.taxCategoryCode);
22692
+
22693
+ case 2:
22694
+ arr = _context12.sent;
22695
+ data = arr.map(function (item) {
22696
+ return _objectSpread2(_objectSpread2({}, item), {}, {
22697
+ title: "".concat(item.productName, " ").concat(item.taxCategoryCode),
22698
+ key: item.taxCategoryCode
22699
+ });
22700
+ });
22701
+ treeData = optimizeTreeData(data);
22702
+
22703
+ if (value === null || value === void 0 ? void 0 : value.key) {
22704
+ setList(function (origin) {
22705
+ updateTreeData(origin, value.key, treeData);
22706
+ });
22707
+ } else {
22708
+ setList(treeData);
22709
+ }
22710
+
22711
+ return _context12.abrupt("return", []);
22712
+
22713
+ case 7:
22714
+ case "end":
22715
+ return _context12.stop();
22716
+ }
22717
+ }
22718
+ }, _callee12);
22719
+ }));
22720
+
22721
+ return function (_x9) {
22722
+ return _ref12.apply(this, arguments);
22723
+ };
22724
+ }(), []);
22725
+ var onClick = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
22726
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
22678
22727
  while (1) {
22679
- switch (_context12.prev = _context12.next) {
22728
+ switch (_context13.prev = _context13.next) {
22680
22729
  case 0:
22681
- _context12.next = 2;
22682
- return onSearch();
22730
+ _context13.next = 2;
22731
+ return onLoad();
22683
22732
 
22684
22733
  case 2:
22685
22734
  setOpen(true);
22686
22735
 
22687
22736
  case 3:
22688
22737
  case "end":
22689
- return _context12.stop();
22738
+ return _context13.stop();
22690
22739
  }
22691
22740
  }
22692
- }, _callee12);
22741
+ }, _callee13);
22693
22742
  })), []);
22694
22743
  var onSelect = React__default['default'].useCallback(function (key, info) {
22695
22744
  actions.setFieldState('taxClassificationCode', /*#__PURE__*/function () {
22696
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(s) {
22697
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
22698
- while (1) {
22699
- switch (_context13.prev = _context13.next) {
22700
- case 0:
22701
- s.value = info.node.taxCategoryCode;
22702
-
22703
- case 1:
22704
- case "end":
22705
- return _context13.stop();
22706
- }
22707
- }
22708
- }, _callee13);
22709
- }));
22710
-
22711
- return function (_x9) {
22712
- return _ref13.apply(this, arguments);
22713
- };
22714
- }());
22715
- actions.setFieldState('productName', /*#__PURE__*/function () {
22716
22745
  var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(s) {
22717
22746
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
22718
22747
  while (1) {
22719
22748
  switch (_context14.prev = _context14.next) {
22720
22749
  case 0:
22721
- s.value = info.node.productName;
22750
+ s.value = info.node.taxCategoryCode;
22722
22751
 
22723
22752
  case 1:
22724
22753
  case "end":
@@ -22732,13 +22761,13 @@ var DrawerBody$3 = function DrawerBody(props) {
22732
22761
  return _ref14.apply(this, arguments);
22733
22762
  };
22734
22763
  }());
22735
- actions.setFieldState('shorthand', /*#__PURE__*/function () {
22764
+ actions.setFieldState('productName', /*#__PURE__*/function () {
22736
22765
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
22737
22766
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
22738
22767
  while (1) {
22739
22768
  switch (_context15.prev = _context15.next) {
22740
22769
  case 0:
22741
- s.value = info.node.shorthand;
22770
+ s.value = info.node.productName;
22742
22771
 
22743
22772
  case 1:
22744
22773
  case "end":
@@ -22752,13 +22781,13 @@ var DrawerBody$3 = function DrawerBody(props) {
22752
22781
  return _ref15.apply(this, arguments);
22753
22782
  };
22754
22783
  }());
22755
- actions.setFieldState('taxRate', /*#__PURE__*/function () {
22784
+ actions.setFieldState('shorthand', /*#__PURE__*/function () {
22756
22785
  var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(s) {
22757
22786
  return _regeneratorRuntime().wrap(function _callee16$(_context16) {
22758
22787
  while (1) {
22759
22788
  switch (_context16.prev = _context16.next) {
22760
22789
  case 0:
22761
- s.value = info.node.taxRate;
22790
+ s.value = info.node.shorthand;
22762
22791
 
22763
22792
  case 1:
22764
22793
  case "end":
@@ -22772,11 +22801,40 @@ var DrawerBody$3 = function DrawerBody(props) {
22772
22801
  return _ref16.apply(this, arguments);
22773
22802
  };
22774
22803
  }());
22804
+ actions.setFieldState('taxRate', /*#__PURE__*/function () {
22805
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(s) {
22806
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
22807
+ while (1) {
22808
+ switch (_context17.prev = _context17.next) {
22809
+ case 0:
22810
+ s.value = info.node.taxRate;
22811
+
22812
+ case 1:
22813
+ case "end":
22814
+ return _context17.stop();
22815
+ }
22816
+ }
22817
+ }, _callee17);
22818
+ }));
22819
+
22820
+ return function (_x13) {
22821
+ return _ref17.apply(this, arguments);
22822
+ };
22823
+ }());
22775
22824
  setOpen(false);
22776
22825
  }, [controller, actions]);
22777
22826
 
22827
+ var optimizeTreeData = function optimizeTreeData(data) {
22828
+ return data.map(function (item) {
22829
+ return _objectSpread2(_objectSpread2({}, item), {}, {
22830
+ selectable: (item === null || item === void 0 ? void 0 : item.hzx) === 'N',
22831
+ isLeaf: (item === null || item === void 0 ? void 0 : item.hzx) === 'N'
22832
+ });
22833
+ });
22834
+ };
22835
+
22778
22836
  var updateTreeData = function updateTreeData(list, key, children) {
22779
- var demo = list.map(function (node) {
22837
+ return list.map(function (node) {
22780
22838
  if (node.key === key) {
22781
22839
  return _objectSpread2(_objectSpread2({}, node), {}, {
22782
22840
  children: children
@@ -22791,52 +22849,8 @@ var DrawerBody$3 = function DrawerBody(props) {
22791
22849
 
22792
22850
  return node;
22793
22851
  });
22794
- setList(demo);
22795
22852
  };
22796
22853
 
22797
- var onLoad = React__default['default'].useCallback( /*#__PURE__*/function () {
22798
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(value) {
22799
- var arr, data;
22800
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
22801
- while (1) {
22802
- switch (_context17.prev = _context17.next) {
22803
- case 0:
22804
- if (!value.children) {
22805
- _context17.next = 2;
22806
- break;
22807
- }
22808
-
22809
- return _context17.abrupt("return", []);
22810
-
22811
- case 2:
22812
- _context17.next = 4;
22813
- return controller.state.goodsListState.endowCode.onLoadTaxClassificationCode(value.taxCategoryCode);
22814
-
22815
- case 4:
22816
- arr = _context17.sent;
22817
- data = arr.map(function (item) {
22818
- return _objectSpread2(_objectSpread2({}, item), {}, {
22819
- title: "".concat(item.productName, " ").concat(item.taxCategoryCode),
22820
- key: item.taxCategoryCode
22821
- });
22822
- });
22823
- setList(function (origin) {
22824
- updateTreeData(origin, value.key, data);
22825
- });
22826
- return _context17.abrupt("return", []);
22827
-
22828
- case 8:
22829
- case "end":
22830
- return _context17.stop();
22831
- }
22832
- }
22833
- }, _callee17);
22834
- }));
22835
-
22836
- return function (_x13) {
22837
- return _ref17.apply(this, arguments);
22838
- };
22839
- }(), []);
22840
22854
  return React__default['default'].createElement(React__default['default'].Fragment, null, React__default['default'].createElement(ktsComponentsAntdX3.Input, {
22841
22855
  readOnly: true,
22842
22856
  onClick: onClick,
@@ -22961,7 +22975,7 @@ var DrawerBody$3 = function DrawerBody(props) {
22961
22975
  actions: actions,
22962
22976
  previewPlaceholder: " ",
22963
22977
  components: _objectSpread2(_objectSpread2({}, components), {}, {
22964
- showSearch: !!controller.state.goodsListState.endowCode.onSearchTaxClassificationCode() ? ShowSearch3 : ShowSearch
22978
+ showSearch: !!controller.state.goodsListState.endowCode.onLoadTaxClassificationCode() ? ShowSearch3 : ShowSearch
22965
22979
  }),
22966
22980
  effects: effects
22967
22981
  }, React__default['default'].createElement(antd.FormButtonGroup, null, React__default['default'].createElement(antd.SchemaMarkupField, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.79",
3
+ "version": "3.2.80",
4
4
  "scripts": {
5
5
  "dev": "dumi dev",
6
6
  "start": "dumi dev",
@@ -298,25 +298,46 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
298
298
  const [list, setList] = React.useState<any>([]);
299
299
 
300
300
  const onSearch = React.useCallback(async (value: any = null) => {
301
- const arr = await controller.state.goodsListState.endowCode.onSearchTaxClassificationCode(value?.target?.value);
302
- const list: any[] = arr.map((item: any)=> {
303
- const data = {
301
+ if(value){
302
+ const arr = await controller.state.goodsListState.endowCode.onSearchTaxClassificationCode(value?.target?.value);
303
+ const list: any[] = arr.map((item: any)=> {
304
+ return {
305
+ ...item,
306
+ title: `${item.productName} ${item.taxCategoryCode}`,
307
+ key: item.taxCategoryCode,
308
+ isLeaf: true
309
+ }
310
+ });
311
+ setList(list);
312
+ } else {
313
+ await onLoad();
314
+ }
315
+ }, []);
316
+
317
+ const onLoad = React.useCallback(async (value?: any) => {
318
+ const arr = await controller.state.goodsListState.endowCode.onLoadTaxClassificationCode(value?.taxCategoryCode);
319
+ const data: any[] = arr.map((item: any)=> {
320
+ return {
304
321
  ...item,
305
322
  title: `${item.productName} ${item.taxCategoryCode}`,
306
- key: item.taxCategoryCode,
307
- }
308
- if(value?.target?.value) {
309
- data.isLeaf = true;
310
- } else {
311
- data.selectable = false
323
+ key: item.taxCategoryCode
312
324
  }
313
- return data
314
325
  });
315
- setList(list);
326
+
327
+ const treeData = optimizeTreeData(data);
328
+
329
+ if(value?.key) {
330
+ setList((origin: any)=> {
331
+ updateTreeData(origin, value.key, treeData)
332
+ });
333
+ } else {
334
+ setList(treeData);
335
+ }
336
+ return [];
316
337
  }, []);
317
338
 
318
339
  const onClick = React.useCallback(async () => {
319
- await onSearch();
340
+ await onLoad();
320
341
  setOpen(true);
321
342
  }, []);
322
343
 
@@ -338,44 +359,34 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
338
359
  setOpen(false);
339
360
  }, [controller, actions]);
340
361
 
362
+ const optimizeTreeData = (data: any): any => {
363
+ return data.map((item: any)=> {
364
+ return {
365
+ ...item,
366
+ selectable: item?.hzx === 'N',
367
+ isLeaf: item?.hzx === 'N'
368
+ }
369
+ });
370
+ }
371
+
341
372
  const updateTreeData = (list: any, key: React.Key, children: any): any => {
342
- const demo = list.map((node: any) => {
373
+ return list.map((node: any) => {
343
374
  if (node.key === key) {
344
375
  return {
345
376
  ...node,
346
- children,
377
+ children
347
378
  };
348
379
  }
349
380
  if (node.children) {
350
381
  return {
351
382
  ...node,
352
- children: updateTreeData(node.children, key, children),
383
+ children: updateTreeData(node.children, key, children)
353
384
  };
354
385
  }
355
386
  return node;
356
387
  });
357
- setList(demo);
358
388
  }
359
389
 
360
- const onLoad = React.useCallback(async (value: any) => {
361
- if (value.children) {
362
- return [];
363
- }
364
- const arr = await controller.state.goodsListState.endowCode.onLoadTaxClassificationCode(value.taxCategoryCode);
365
- const data: any[] = arr.map((item: any)=> {
366
- return {
367
- ...item,
368
- title: `${item.productName} ${item.taxCategoryCode}`,
369
- key: item.taxCategoryCode
370
- }
371
- });
372
-
373
- setList((origin: any)=> {
374
- updateTreeData(origin, value.key, data)
375
- });
376
- return [];
377
- }, []);
378
-
379
390
  return (
380
391
  <>
381
392
  <InputAntd readOnly onClick={onClick} value={props.value} />
@@ -454,7 +465,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
454
465
  }, [controller]);
455
466
 
456
467
  return (
457
- <SchemaForm actions={actions} previewPlaceholder=" " components={{ ...components, showSearch: !!controller.state.goodsListState.endowCode.onSearchTaxClassificationCode() ? ShowSearch3 : ShowSearch }} effects={effects}>
468
+ <SchemaForm actions={actions} previewPlaceholder=" " components={{ ...components, showSearch: !!controller.state.goodsListState.endowCode.onLoadTaxClassificationCode() ? ShowSearch3 : ShowSearch }} effects={effects}>
458
469
  <FormButtonGroup>
459
470
  <Field
460
471
  name="taxClassificationCode"
@@ -9,6 +9,25 @@ export default () => {
9
9
 
10
10
  const [list, setList] = React.useState<any>([]);
11
11
 
12
+ const updateTreeData = (list: any, key: React.Key, children: any): any => {
13
+ const demo = list.map((node: any) => {
14
+ if (node.key === key) {
15
+ return {
16
+ ...node,
17
+ children,
18
+ };
19
+ }
20
+ if (node.children) {
21
+ return {
22
+ ...node,
23
+ children: updateTreeData(node.children, key, children),
24
+ };
25
+ }
26
+ return node;
27
+ });
28
+ setList(demo);
29
+ }
30
+
12
31
  const onSearch = React.useCallback(async (value: any = null) => {
13
32
  const arr = [
14
33
  {
@@ -70,38 +89,7 @@ export default () => {
70
89
  setList(list);
71
90
  }, []);
72
91
 
73
- const onClick = React.useCallback(async () => {
74
- await onSearch();
75
- setOpen(true);
76
- }, []);
77
-
78
- const onSelect = React.useCallback((key: any, info: any) => {
79
- setOpen(false);
80
- }, []);
81
-
82
- const updateTreeData = (list: any, key: React.Key, children: any): any => {
83
- const demo = list.map((node: any) => {
84
- if (node.key === key) {
85
- return {
86
- ...node,
87
- children,
88
- };
89
- }
90
- if (node.children) {
91
- return {
92
- ...node,
93
- children: updateTreeData(node.children, key, children),
94
- };
95
- }
96
- return node;
97
- });
98
- setList(demo);
99
- }
100
-
101
- const onLoad = React.useCallback(async (value: any) => {
102
- if (value.children) {
103
- return [];
104
- }
92
+ const onLoad = React.useCallback(async (value?: any) => {
105
93
  const arr = [
106
94
  {
107
95
  "id": "3a4eae5278cd428f975d4da278fd18eb",
@@ -150,16 +138,30 @@ export default () => {
150
138
  return {
151
139
  ...item,
152
140
  title: `${item.productName} ${item.taxCategoryCode}`,
153
- key: item.taxCategoryCode
141
+ key: item.taxCategoryCode,
142
+ selectable: false
154
143
  }
155
144
  });
156
145
 
157
- setList((origin: any)=> {
158
- updateTreeData(origin, value.key, data)
159
- });
146
+ if(value?.key) {
147
+ setList((origin: any)=> {
148
+ updateTreeData(origin, value.key, data)
149
+ });
150
+ } else {
151
+ setList(data);
152
+ }
160
153
  return [];
161
154
  }, []);
162
155
 
156
+ const onClick = React.useCallback(async () => {
157
+ await onLoad();
158
+ setOpen(true);
159
+ }, []);
160
+
161
+ const onSelect = React.useCallback((key: any, info: any) => {
162
+ setOpen(false);
163
+ }, []);
164
+
163
165
  return (
164
166
  <>
165
167
  <Button onClick={onClick} >打开</Button>
@@ -30,7 +30,9 @@ export default function TaxClassificationModal(props: TaxClassificationProps) {
30
30
 
31
31
  React.useEffect(() => {
32
32
  if (!props.open) {
33
- form.resetFields();
33
+ setTimeout(()=> {
34
+ form.resetFields();
35
+ }, 500)
34
36
  }
35
37
  }, [form, props.open])
36
38
 
@@ -51,12 +53,14 @@ export default function TaxClassificationModal(props: TaxClassificationProps) {
51
53
  onChange={props.onSearch}
52
54
  />
53
55
  </Form.Item>
54
- <Tree
55
- onSelect={props.onSelect}
56
- loadData={props.onLoad}
57
- treeData={props.list}
58
- switcherIcon={<Icon type="down" />}
59
- />
56
+ <Form.Item name='tree'>
57
+ <Tree
58
+ onSelect={props.onSelect}
59
+ loadData={props.onLoad}
60
+ treeData={props.list}
61
+ switcherIcon={<Icon type="down" />}
62
+ />
63
+ </Form.Item>
60
64
  </Form>
61
65
  </Drawer>
62
66
  )