kts-component-invoice-operate 1.0.107 → 1.1.3

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.
@@ -3,11 +3,24 @@ import IGood from './IGood';
3
3
  export default class EndowCode {
4
4
  /** 准备赋码的货物索引列表 */
5
5
  endowcodeGoodIndex: number[];
6
- /** 获取 税收分类编码列表 */
6
+ /**
7
+ * 获取 税收分类编码列表 (弃用)
8
+ * @deprecated 请使用 getTaxCategoryCodeTree 替换
9
+ * */
7
10
  getTaxCategoryCodeList: (value: string) => Promise<{
8
11
  value: string;
9
12
  label: string;
10
13
  }[]>;
14
+ /**
15
+ * 获取 税收分类编码树
16
+ * @param taxCategoryCode 税收分类编码
17
+ * @param val val
18
+ * @returns 税收分类编码树
19
+ */
20
+ getTaxCategoryCodeTree: (taxCategoryCode?: string, val?: string) => Promise<{
21
+ id: string;
22
+ pid: string;
23
+ }[]>;
11
24
  /** 税率 是否可以编辑 */
12
25
  getReadOnlyTaxRate?: (value?: GoodsListState) => boolean;
13
26
  /**
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import 'kts-components-antd-x3/dist/kts-components-antd-x3.css';
2
2
  import React, { createElement } from 'react';
3
3
  import GreyReactBox, { decorator } from 'grey-react-box';
4
4
  import { chain as chain$1, bignumber, create, all } from 'mathjs';
5
- import { message, Form, Input, Icon, Tag, Select, Row, Col, Table, Button, Switch, Typography, Drawer, Menu, Dropdown, AutoComplete, Spin, Checkbox, Descriptions, Modal } from 'kts-components-antd-x3';
5
+ import { message, Form, Input, Icon, Tag, Select, Row, Col, Table, Button, Switch, Typography, Drawer, Menu, Dropdown, AutoComplete, Spin, Checkbox, Descriptions, Tree, Modal } from 'kts-components-antd-x3';
6
6
  import { v4 } from 'uuid';
7
7
  import classnames from 'classnames';
8
8
  import { Input as Input$1, NumberPicker } from '@formily/antd-components';
@@ -586,6 +586,20 @@ var EndowCode = function EndowCode() {
586
586
  }
587
587
  }, _callee);
588
588
  }));
589
+ this.getTaxCategoryCodeTree = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
590
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
591
+ while (1) {
592
+ switch (_context2.prev = _context2.next) {
593
+ case 0:
594
+ return _context2.abrupt("return", []);
595
+
596
+ case 1:
597
+ case "end":
598
+ return _context2.stop();
599
+ }
600
+ }
601
+ }, _callee2);
602
+ }));
589
603
  this.getReadOnlyTaxRate = void 0;
590
604
  this.getDefaultValue = void 0;
591
605
  this.readOnlyTaxRateMap = {
@@ -5529,6 +5543,7 @@ function cutStr(str, L) {
5529
5543
  var css_248z$a = ".kts-invoice-operate-goods-endow-code-button-list {\n display: flex;\n flex-direction: column;\n}\n.kts-invoice-operate-goods-endow-code-button-list > button {\n margin-bottom: 10px;\n}\n";
5530
5544
  styleInject(css_248z$a);
5531
5545
 
5546
+ var TreeNode = Tree.TreeNode;
5532
5547
  var confirm = Modal.confirm;
5533
5548
  var EndowCodeDrawer = (function () {
5534
5549
  var controller = default_1.useInvoiceController();
@@ -5788,21 +5803,229 @@ var DrawerBody$3 = function DrawerBody(props) {
5788
5803
  value: e.value
5789
5804
  }, e.label);
5790
5805
  }));
5806
+ }, [controller, actions]);
5807
+ /** 税收分类编码 选择组件2 */
5808
+
5809
+ var ShowSearch2 = React.useCallback(function (props) {
5810
+ // 是否显示
5811
+ var _React$useState7 = React.useState(false),
5812
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
5813
+ visible = _React$useState8[0],
5814
+ setVisible = _React$useState8[1]; // 税收分类编码树
5815
+
5816
+
5817
+ var _React$useState9 = React.useState(),
5818
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
5819
+ list = _React$useState10[0],
5820
+ setList = _React$useState10[1]; // 搜索条件
5821
+
5822
+
5823
+ var _React$useState11 = React.useState(),
5824
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
5825
+ filter = _React$useState12[0],
5826
+ setFilter = _React$useState12[1];
5827
+ /** 创建 树节点 */
5828
+
5829
+
5830
+ var createTreeNode = React.useCallback(function () {
5831
+ if (!list) return /*#__PURE__*/React.createElement(React.Fragment, null);
5832
+ return ctn(list);
5833
+
5834
+ function ctn(l) {
5835
+ var p = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0';
5836
+ if (!l || !l.length) return [/*#__PURE__*/React.createElement(React.Fragment, null)];
5837
+ var ls = l.filter(function (e) {
5838
+ return e.pid === p;
5839
+ });
5840
+ debugger;
5841
+ return l.filter(function (e) {
5842
+ return e.pid === p;
5843
+ }).map(function (e) {
5844
+ return /*#__PURE__*/React.createElement(TreeNode, {
5845
+ title: e.label,
5846
+ key: e.id
5847
+ }, ctn(l, e.id));
5848
+ });
5849
+ }
5850
+ }, [list]);
5851
+ /** 点击了节点 */
5852
+
5853
+ var onSelect = React.useCallback(function (e) {
5854
+ var id = e[0]; // 是否叶子节点
5855
+
5856
+ if ((list === null || list === void 0 ? void 0 : list.filter(function (e) {
5857
+ return e.pid === id;
5858
+ }).length) !== 0) {
5859
+ return;
5860
+ }
5861
+
5862
+ var info = list === null || list === void 0 ? void 0 : list.filter(function (e) {
5863
+ return e.id === id;
5864
+ })[0];
5865
+ !readOnlyTaxRate && actions.setFieldState('taxRate', /*#__PURE__*/function () {
5866
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(s) {
5867
+ return regeneratorRuntime.wrap(function _callee6$(_context6) {
5868
+ while (1) {
5869
+ switch (_context6.prev = _context6.next) {
5870
+ case 0:
5871
+ if (info.taxRate || info.taxRate === 0) {
5872
+ s.value = info.taxRate;
5873
+ }
5874
+
5875
+ case 1:
5876
+ case "end":
5877
+ return _context6.stop();
5878
+ }
5879
+ }
5880
+ }, _callee6);
5881
+ }));
5882
+
5883
+ return function (_x6) {
5884
+ return _ref6.apply(this, arguments);
5885
+ };
5886
+ }());
5887
+ actions.setFieldState('taxClassificationCode', /*#__PURE__*/function () {
5888
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(s) {
5889
+ return regeneratorRuntime.wrap(function _callee7$(_context7) {
5890
+ while (1) {
5891
+ switch (_context7.prev = _context7.next) {
5892
+ case 0:
5893
+ if (info.id) {
5894
+ s.value = info.id;
5895
+ }
5896
+
5897
+ case 1:
5898
+ case "end":
5899
+ return _context7.stop();
5900
+ }
5901
+ }
5902
+ }, _callee7);
5903
+ }));
5904
+
5905
+ return function (_x7) {
5906
+ return _ref7.apply(this, arguments);
5907
+ };
5908
+ }());
5909
+ actions.setFieldState('shorthand', /*#__PURE__*/function () {
5910
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(s) {
5911
+ return regeneratorRuntime.wrap(function _callee8$(_context8) {
5912
+ while (1) {
5913
+ switch (_context8.prev = _context8.next) {
5914
+ case 0:
5915
+ if (info.shorthand) {
5916
+ s.value = info.shorthand;
5917
+ }
5918
+
5919
+ case 1:
5920
+ case "end":
5921
+ return _context8.stop();
5922
+ }
5923
+ }
5924
+ }, _callee8);
5925
+ }));
5926
+
5927
+ return function (_x8) {
5928
+ return _ref8.apply(this, arguments);
5929
+ };
5930
+ }());
5931
+ setVisible(false);
5932
+ }, [list, actions, readOnlyTaxRate]);
5933
+ React.useEffect(function () {
5934
+ _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
5935
+ return regeneratorRuntime.wrap(function _callee9$(_context9) {
5936
+ while (1) {
5937
+ switch (_context9.prev = _context9.next) {
5938
+ case 0:
5939
+ _context9.t0 = setList;
5940
+ _context9.next = 3;
5941
+ return controller.state.goodsListState.endowCode.getTaxCategoryCodeTree(filter === null || filter === void 0 ? void 0 : filter.taxCategoryCode, filter === null || filter === void 0 ? void 0 : filter.val);
5942
+
5943
+ case 3:
5944
+ _context9.t1 = _context9.sent;
5945
+
5946
+ if (_context9.t1) {
5947
+ _context9.next = 6;
5948
+ break;
5949
+ }
5950
+
5951
+ _context9.t1 = [];
5952
+
5953
+ case 6:
5954
+ _context9.t2 = _context9.t1;
5955
+ (0, _context9.t0)(_context9.t2);
5956
+
5957
+ case 8:
5958
+ case "end":
5959
+ return _context9.stop();
5960
+ }
5961
+ }
5962
+ }, _callee9);
5963
+ }))();
5964
+ }, [filter]);
5965
+ React.useEffect(function () {
5966
+ if (visible) {
5967
+ setList([]);
5968
+ }
5969
+ }, [visible]);
5970
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Input, {
5971
+ readOnly: true,
5972
+ value: props.value,
5973
+ addonAfter: /*#__PURE__*/React.createElement(Button, {
5974
+ size: "small",
5975
+ type: "link",
5976
+ onClick: function onClick() {
5977
+ setVisible(true);
5978
+ }
5979
+ }, "\u70B9\u51FB\u9009\u62E9")
5980
+ }), /*#__PURE__*/React.createElement(Drawer, {
5981
+ title: "\u7A0E\u6536\u5206\u7C7B\u7F16\u7801",
5982
+ visible: visible,
5983
+ width: 500,
5984
+ onClose: function onClose() {
5985
+ setVisible(false);
5986
+ }
5987
+ }, /*#__PURE__*/React.createElement(Form, {
5988
+ key: "".concat(visible)
5989
+ }, /*#__PURE__*/React.createElement(Form.Item, {
5990
+ label: "\u4EA7\u54C1\u6216\u670D\u52A1\u7B80\u79F0"
5991
+ }, /*#__PURE__*/React.createElement(Input, {
5992
+ onChange: function onChange(e) {
5993
+ setFilter(_objectSpread2(_objectSpread2({}, filter), {}, {
5994
+ val: e.target.value
5995
+ }));
5996
+ }
5997
+ })), /*#__PURE__*/React.createElement(Form.Item, {
5998
+ label: "\u7A0E\u6536\u5206\u7C7B\u7F16\u7801"
5999
+ }, /*#__PURE__*/React.createElement(Input, {
6000
+ onChange: function onChange(e) {
6001
+ setFilter(_objectSpread2(_objectSpread2({}, filter), {}, {
6002
+ taxCategoryCode: e.target.value
6003
+ }));
6004
+ }
6005
+ }))), list && list.length > 0 ? /*#__PURE__*/React.createElement(Tree, {
6006
+ defaultExpandAll: true,
6007
+ selectedKeys: [],
6008
+ onSelect: onSelect
6009
+ }, createTreeNode()) : /*#__PURE__*/React.createElement("span", {
6010
+ style: {
6011
+ color: '#00000073'
6012
+ }
6013
+ }, "\u672A\u627E\u5230\u5339\u914D\u7684\u6570\u636E")));
5791
6014
  }, [controller, actions]); // 是否享受优惠政策
5792
6015
 
5793
- var _React$useState7 = React.useState(0),
5794
- _React$useState8 = _slicedToArray(_React$useState7, 2),
5795
- favouredPolicyMark = _React$useState8[0],
5796
- setFavouredPolicyMark = _React$useState8[1]; // 确定
6016
+ var _React$useState13 = React.useState(0),
6017
+ _React$useState14 = _slicedToArray(_React$useState13, 2),
6018
+ favouredPolicyMark = _React$useState14[0],
6019
+ setFavouredPolicyMark = _React$useState14[1]; // 确定
5797
6020
 
5798
6021
 
5799
6022
  var onSubmit = React.useCallback(function (values) {
5800
6023
  controller.pipeline( /*#__PURE__*/function () {
5801
- var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(s) {
6024
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(s) {
5802
6025
  var endowCodeGood;
5803
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
6026
+ return regeneratorRuntime.wrap(function _callee10$(_context10) {
5804
6027
  while (1) {
5805
- switch (_context6.prev = _context6.next) {
6028
+ switch (_context10.prev = _context10.next) {
5806
6029
  case 0:
5807
6030
  endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(function (e) {
5808
6031
  return s.goodsListState.goodsMap.get(e);
@@ -5838,11 +6061,11 @@ var DrawerBody$3 = function DrawerBody(props) {
5838
6061
  if (!endowCodeGood.some(function (e) {
5839
6062
  return bytesLnegth((e === null || e === void 0 ? void 0 : e.itemName) || '') > 92;
5840
6063
  })) {
5841
- _context6.next = 5;
6064
+ _context10.next = 5;
5842
6065
  break;
5843
6066
  }
5844
6067
 
5845
- _context6.next = 5;
6068
+ _context10.next = 5;
5846
6069
  return function () {
5847
6070
  return new Promise(function (resolve) {
5848
6071
  confirm({
@@ -5871,14 +6094,14 @@ var DrawerBody$3 = function DrawerBody(props) {
5871
6094
 
5872
6095
  case 7:
5873
6096
  case "end":
5874
- return _context6.stop();
6097
+ return _context10.stop();
5875
6098
  }
5876
6099
  }
5877
- }, _callee6);
6100
+ }, _callee10);
5878
6101
  }));
5879
6102
 
5880
- return function (_x6) {
5881
- return _ref6.apply(this, arguments);
6103
+ return function (_x9) {
6104
+ return _ref10.apply(this, arguments);
5882
6105
  };
5883
6106
  }())();
5884
6107
  }, [controller]);
@@ -5887,23 +6110,23 @@ var DrawerBody$3 = function DrawerBody(props) {
5887
6110
  FormEffectHooks.onFieldValueChange$('taxRate').subscribe(function (e) {
5888
6111
  setTaxRate(e.value);
5889
6112
  actions.setFieldState('taxFreeType', /*#__PURE__*/function () {
5890
- var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(s) {
5891
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
6113
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(s) {
6114
+ return regeneratorRuntime.wrap(function _callee11$(_context11) {
5892
6115
  while (1) {
5893
- switch (_context7.prev = _context7.next) {
6116
+ switch (_context11.prev = _context11.next) {
5894
6117
  case 0:
5895
6118
  if (e.value !== 0) s.value = undefined;
5896
6119
 
5897
6120
  case 1:
5898
6121
  case "end":
5899
- return _context7.stop();
6122
+ return _context11.stop();
5900
6123
  }
5901
6124
  }
5902
- }, _callee7);
6125
+ }, _callee11);
5903
6126
  }));
5904
6127
 
5905
- return function (_x7) {
5906
- return _ref7.apply(this, arguments);
6128
+ return function (_x10) {
6129
+ return _ref11.apply(this, arguments);
5907
6130
  };
5908
6131
  }());
5909
6132
  }); // 是否享受优惠政策
@@ -5911,23 +6134,23 @@ var DrawerBody$3 = function DrawerBody(props) {
5911
6134
  FormEffectHooks.onFieldValueChange$('favouredPolicyMark').subscribe(function (e) {
5912
6135
  setFavouredPolicyMark(e.value);
5913
6136
  actions.setFieldState('favouredPolicyName', /*#__PURE__*/function () {
5914
- var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(s) {
5915
- return regeneratorRuntime.wrap(function _callee8$(_context8) {
6137
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(s) {
6138
+ return regeneratorRuntime.wrap(function _callee12$(_context12) {
5916
6139
  while (1) {
5917
- switch (_context8.prev = _context8.next) {
6140
+ switch (_context12.prev = _context12.next) {
5918
6141
  case 0:
5919
6142
  if (e.value === 0) s.value = undefined;
5920
6143
 
5921
6144
  case 1:
5922
6145
  case "end":
5923
- return _context8.stop();
6146
+ return _context12.stop();
5924
6147
  }
5925
6148
  }
5926
- }, _callee8);
6149
+ }, _callee12);
5927
6150
  }));
5928
6151
 
5929
- return function (_x8) {
5930
- return _ref8.apply(this, arguments);
6152
+ return function (_x11) {
6153
+ return _ref12.apply(this, arguments);
5931
6154
  };
5932
6155
  }());
5933
6156
  });
@@ -5939,7 +6162,7 @@ var DrawerBody$3 = function DrawerBody(props) {
5939
6162
  return /*#__PURE__*/React.createElement(SchemaForm, {
5940
6163
  actions: actions,
5941
6164
  components: _objectSpread2(_objectSpread2({}, components), {}, {
5942
- showSearch: ShowSearch
6165
+ showSearch: ShowSearch2
5943
6166
  }),
5944
6167
  effects: effects
5945
6168
  }, /*#__PURE__*/React.createElement(FormButtonGroup, null, /*#__PURE__*/React.createElement(SchemaMarkupField, {
@@ -6016,23 +6239,23 @@ var DrawerBody$3 = function DrawerBody(props) {
6016
6239
  }, "\u786E\u5B9A"), /*#__PURE__*/React.createElement(Button, {
6017
6240
  onClick: function onClick() {
6018
6241
  controller.pipeline( /*#__PURE__*/function () {
6019
- var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(s) {
6020
- return regeneratorRuntime.wrap(function _callee9$(_context9) {
6242
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(s) {
6243
+ return regeneratorRuntime.wrap(function _callee13$(_context13) {
6021
6244
  while (1) {
6022
- switch (_context9.prev = _context9.next) {
6245
+ switch (_context13.prev = _context13.next) {
6023
6246
  case 0:
6024
- return _context9.abrupt("return", s.goodsListState.endowCode.endowcodeGoodIndex = []);
6247
+ return _context13.abrupt("return", s.goodsListState.endowCode.endowcodeGoodIndex = []);
6025
6248
 
6026
6249
  case 1:
6027
6250
  case "end":
6028
- return _context9.stop();
6251
+ return _context13.stop();
6029
6252
  }
6030
6253
  }
6031
- }, _callee9);
6254
+ }, _callee13);
6032
6255
  }));
6033
6256
 
6034
- return function (_x9) {
6035
- return _ref9.apply(this, arguments);
6257
+ return function (_x12) {
6258
+ return _ref13.apply(this, arguments);
6036
6259
  };
6037
6260
  }())();
6038
6261
  }