kts-component-invoice-operate 1.0.107 → 1.1.0
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/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/EndowCode.d.ts +14 -1
- package/dist/index.esm.js +241 -37
- package/dist/index.js +240 -36
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/EndowCode.tsx +13 -2
- package/src/Invoice/_test/endowCode/index.tsx +15 -15
- package/src/Invoice/ui/EndowCodeDrawer/index.tsx +106 -3
|
@@ -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,210 @@ 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
|
+
return l.filter(function (e) {
|
|
5838
|
+
return e.pid === p;
|
|
5839
|
+
}).map(function (e) {
|
|
5840
|
+
return /*#__PURE__*/React.createElement(TreeNode, {
|
|
5841
|
+
title: e.label,
|
|
5842
|
+
key: e.id
|
|
5843
|
+
}, ctn(l, e.id));
|
|
5844
|
+
});
|
|
5845
|
+
}
|
|
5846
|
+
}, [list]);
|
|
5847
|
+
/** 点击了节点 */
|
|
5848
|
+
|
|
5849
|
+
var onSelect = React.useCallback(function (e) {
|
|
5850
|
+
var id = e[0]; // 是否叶子节点
|
|
5851
|
+
|
|
5852
|
+
if ((list === null || list === void 0 ? void 0 : list.filter(function (e) {
|
|
5853
|
+
return e.pid === id;
|
|
5854
|
+
}).length) !== 0) {
|
|
5855
|
+
return;
|
|
5856
|
+
}
|
|
5857
|
+
|
|
5858
|
+
var info = list === null || list === void 0 ? void 0 : list.filter(function (e) {
|
|
5859
|
+
return e.id === id;
|
|
5860
|
+
})[0];
|
|
5861
|
+
!readOnlyTaxRate && actions.setFieldState('taxRate', /*#__PURE__*/function () {
|
|
5862
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(s) {
|
|
5863
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
5864
|
+
while (1) {
|
|
5865
|
+
switch (_context6.prev = _context6.next) {
|
|
5866
|
+
case 0:
|
|
5867
|
+
if (info.taxRate || info.taxRate === 0) {
|
|
5868
|
+
s.value = info.taxRate;
|
|
5869
|
+
}
|
|
5870
|
+
|
|
5871
|
+
case 1:
|
|
5872
|
+
case "end":
|
|
5873
|
+
return _context6.stop();
|
|
5874
|
+
}
|
|
5875
|
+
}
|
|
5876
|
+
}, _callee6);
|
|
5877
|
+
}));
|
|
5878
|
+
|
|
5879
|
+
return function (_x6) {
|
|
5880
|
+
return _ref6.apply(this, arguments);
|
|
5881
|
+
};
|
|
5882
|
+
}());
|
|
5883
|
+
actions.setFieldState('taxClassificationCode', /*#__PURE__*/function () {
|
|
5884
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(s) {
|
|
5885
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
5886
|
+
while (1) {
|
|
5887
|
+
switch (_context7.prev = _context7.next) {
|
|
5888
|
+
case 0:
|
|
5889
|
+
if (info.id) {
|
|
5890
|
+
s.value = info.id;
|
|
5891
|
+
}
|
|
5892
|
+
|
|
5893
|
+
case 1:
|
|
5894
|
+
case "end":
|
|
5895
|
+
return _context7.stop();
|
|
5896
|
+
}
|
|
5897
|
+
}
|
|
5898
|
+
}, _callee7);
|
|
5899
|
+
}));
|
|
5900
|
+
|
|
5901
|
+
return function (_x7) {
|
|
5902
|
+
return _ref7.apply(this, arguments);
|
|
5903
|
+
};
|
|
5904
|
+
}());
|
|
5905
|
+
actions.setFieldState('shorthand', /*#__PURE__*/function () {
|
|
5906
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(s) {
|
|
5907
|
+
return regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
5908
|
+
while (1) {
|
|
5909
|
+
switch (_context8.prev = _context8.next) {
|
|
5910
|
+
case 0:
|
|
5911
|
+
if (info.shorthand) {
|
|
5912
|
+
s.value = info.shorthand;
|
|
5913
|
+
}
|
|
5914
|
+
|
|
5915
|
+
case 1:
|
|
5916
|
+
case "end":
|
|
5917
|
+
return _context8.stop();
|
|
5918
|
+
}
|
|
5919
|
+
}
|
|
5920
|
+
}, _callee8);
|
|
5921
|
+
}));
|
|
5922
|
+
|
|
5923
|
+
return function (_x8) {
|
|
5924
|
+
return _ref8.apply(this, arguments);
|
|
5925
|
+
};
|
|
5926
|
+
}());
|
|
5927
|
+
setVisible(false);
|
|
5928
|
+
}, [list, actions, readOnlyTaxRate]);
|
|
5929
|
+
React.useEffect(function () {
|
|
5930
|
+
_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
|
|
5931
|
+
return regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
5932
|
+
while (1) {
|
|
5933
|
+
switch (_context9.prev = _context9.next) {
|
|
5934
|
+
case 0:
|
|
5935
|
+
_context9.t0 = setList;
|
|
5936
|
+
_context9.next = 3;
|
|
5937
|
+
return controller.state.goodsListState.endowCode.getTaxCategoryCodeTree(filter === null || filter === void 0 ? void 0 : filter.taxCategoryCode, filter === null || filter === void 0 ? void 0 : filter.val);
|
|
5938
|
+
|
|
5939
|
+
case 3:
|
|
5940
|
+
_context9.t1 = _context9.sent;
|
|
5941
|
+
|
|
5942
|
+
if (_context9.t1) {
|
|
5943
|
+
_context9.next = 6;
|
|
5944
|
+
break;
|
|
5945
|
+
}
|
|
5946
|
+
|
|
5947
|
+
_context9.t1 = [];
|
|
5948
|
+
|
|
5949
|
+
case 6:
|
|
5950
|
+
_context9.t2 = _context9.t1;
|
|
5951
|
+
(0, _context9.t0)(_context9.t2);
|
|
5952
|
+
|
|
5953
|
+
case 8:
|
|
5954
|
+
case "end":
|
|
5955
|
+
return _context9.stop();
|
|
5956
|
+
}
|
|
5957
|
+
}
|
|
5958
|
+
}, _callee9);
|
|
5959
|
+
}))();
|
|
5960
|
+
}, [filter]);
|
|
5961
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Input, {
|
|
5962
|
+
readOnly: true,
|
|
5963
|
+
value: props.value,
|
|
5964
|
+
onClick: function onClick() {
|
|
5965
|
+
setVisible(true);
|
|
5966
|
+
}
|
|
5967
|
+
}), /*#__PURE__*/React.createElement(Drawer, {
|
|
5968
|
+
title: "\u7A0E\u6536\u5206\u7C7B\u7F16\u7801",
|
|
5969
|
+
visible: visible,
|
|
5970
|
+
width: 500,
|
|
5971
|
+
onClose: function onClose() {
|
|
5972
|
+
setVisible(false);
|
|
5973
|
+
}
|
|
5974
|
+
}, /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(Form.Item, {
|
|
5975
|
+
label: "\u4EA7\u54C1\u6216\u670D\u52A1\u7B80\u79F0"
|
|
5976
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
5977
|
+
onChange: function onChange(e) {
|
|
5978
|
+
setFilter(_objectSpread2(_objectSpread2({}, filter), {}, {
|
|
5979
|
+
val: e.target.value
|
|
5980
|
+
}));
|
|
5981
|
+
}
|
|
5982
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
5983
|
+
label: "\u7A0E\u6536\u5206\u7C7B\u7F16\u7801"
|
|
5984
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
5985
|
+
onChange: function onChange(e) {
|
|
5986
|
+
setFilter(_objectSpread2(_objectSpread2({}, filter), {}, {
|
|
5987
|
+
taxCategoryCode: e.target.value
|
|
5988
|
+
}));
|
|
5989
|
+
}
|
|
5990
|
+
}))), list && list.length > 0 && /*#__PURE__*/React.createElement(Tree, {
|
|
5991
|
+
defaultExpandAll: true,
|
|
5992
|
+
selectedKeys: [],
|
|
5993
|
+
onSelect: onSelect
|
|
5994
|
+
}, createTreeNode())));
|
|
5791
5995
|
}, [controller, actions]); // 是否享受优惠政策
|
|
5792
5996
|
|
|
5793
|
-
var _React$
|
|
5794
|
-
_React$
|
|
5795
|
-
favouredPolicyMark = _React$
|
|
5796
|
-
setFavouredPolicyMark = _React$
|
|
5997
|
+
var _React$useState13 = React.useState(0),
|
|
5998
|
+
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
|
5999
|
+
favouredPolicyMark = _React$useState14[0],
|
|
6000
|
+
setFavouredPolicyMark = _React$useState14[1]; // 确定
|
|
5797
6001
|
|
|
5798
6002
|
|
|
5799
6003
|
var onSubmit = React.useCallback(function (values) {
|
|
5800
6004
|
controller.pipeline( /*#__PURE__*/function () {
|
|
5801
|
-
var
|
|
6005
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(s) {
|
|
5802
6006
|
var endowCodeGood;
|
|
5803
|
-
return regeneratorRuntime.wrap(function
|
|
6007
|
+
return regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
5804
6008
|
while (1) {
|
|
5805
|
-
switch (
|
|
6009
|
+
switch (_context10.prev = _context10.next) {
|
|
5806
6010
|
case 0:
|
|
5807
6011
|
endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(function (e) {
|
|
5808
6012
|
return s.goodsListState.goodsMap.get(e);
|
|
@@ -5838,11 +6042,11 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
5838
6042
|
if (!endowCodeGood.some(function (e) {
|
|
5839
6043
|
return bytesLnegth((e === null || e === void 0 ? void 0 : e.itemName) || '') > 92;
|
|
5840
6044
|
})) {
|
|
5841
|
-
|
|
6045
|
+
_context10.next = 5;
|
|
5842
6046
|
break;
|
|
5843
6047
|
}
|
|
5844
6048
|
|
|
5845
|
-
|
|
6049
|
+
_context10.next = 5;
|
|
5846
6050
|
return function () {
|
|
5847
6051
|
return new Promise(function (resolve) {
|
|
5848
6052
|
confirm({
|
|
@@ -5871,14 +6075,14 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
5871
6075
|
|
|
5872
6076
|
case 7:
|
|
5873
6077
|
case "end":
|
|
5874
|
-
return
|
|
6078
|
+
return _context10.stop();
|
|
5875
6079
|
}
|
|
5876
6080
|
}
|
|
5877
|
-
},
|
|
6081
|
+
}, _callee10);
|
|
5878
6082
|
}));
|
|
5879
6083
|
|
|
5880
|
-
return function (
|
|
5881
|
-
return
|
|
6084
|
+
return function (_x9) {
|
|
6085
|
+
return _ref10.apply(this, arguments);
|
|
5882
6086
|
};
|
|
5883
6087
|
}())();
|
|
5884
6088
|
}, [controller]);
|
|
@@ -5887,23 +6091,23 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
5887
6091
|
FormEffectHooks.onFieldValueChange$('taxRate').subscribe(function (e) {
|
|
5888
6092
|
setTaxRate(e.value);
|
|
5889
6093
|
actions.setFieldState('taxFreeType', /*#__PURE__*/function () {
|
|
5890
|
-
var
|
|
5891
|
-
return regeneratorRuntime.wrap(function
|
|
6094
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(s) {
|
|
6095
|
+
return regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
5892
6096
|
while (1) {
|
|
5893
|
-
switch (
|
|
6097
|
+
switch (_context11.prev = _context11.next) {
|
|
5894
6098
|
case 0:
|
|
5895
6099
|
if (e.value !== 0) s.value = undefined;
|
|
5896
6100
|
|
|
5897
6101
|
case 1:
|
|
5898
6102
|
case "end":
|
|
5899
|
-
return
|
|
6103
|
+
return _context11.stop();
|
|
5900
6104
|
}
|
|
5901
6105
|
}
|
|
5902
|
-
},
|
|
6106
|
+
}, _callee11);
|
|
5903
6107
|
}));
|
|
5904
6108
|
|
|
5905
|
-
return function (
|
|
5906
|
-
return
|
|
6109
|
+
return function (_x10) {
|
|
6110
|
+
return _ref11.apply(this, arguments);
|
|
5907
6111
|
};
|
|
5908
6112
|
}());
|
|
5909
6113
|
}); // 是否享受优惠政策
|
|
@@ -5911,23 +6115,23 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
5911
6115
|
FormEffectHooks.onFieldValueChange$('favouredPolicyMark').subscribe(function (e) {
|
|
5912
6116
|
setFavouredPolicyMark(e.value);
|
|
5913
6117
|
actions.setFieldState('favouredPolicyName', /*#__PURE__*/function () {
|
|
5914
|
-
var
|
|
5915
|
-
return regeneratorRuntime.wrap(function
|
|
6118
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(s) {
|
|
6119
|
+
return regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
5916
6120
|
while (1) {
|
|
5917
|
-
switch (
|
|
6121
|
+
switch (_context12.prev = _context12.next) {
|
|
5918
6122
|
case 0:
|
|
5919
6123
|
if (e.value === 0) s.value = undefined;
|
|
5920
6124
|
|
|
5921
6125
|
case 1:
|
|
5922
6126
|
case "end":
|
|
5923
|
-
return
|
|
6127
|
+
return _context12.stop();
|
|
5924
6128
|
}
|
|
5925
6129
|
}
|
|
5926
|
-
},
|
|
6130
|
+
}, _callee12);
|
|
5927
6131
|
}));
|
|
5928
6132
|
|
|
5929
|
-
return function (
|
|
5930
|
-
return
|
|
6133
|
+
return function (_x11) {
|
|
6134
|
+
return _ref12.apply(this, arguments);
|
|
5931
6135
|
};
|
|
5932
6136
|
}());
|
|
5933
6137
|
});
|
|
@@ -5939,7 +6143,7 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
5939
6143
|
return /*#__PURE__*/React.createElement(SchemaForm, {
|
|
5940
6144
|
actions: actions,
|
|
5941
6145
|
components: _objectSpread2(_objectSpread2({}, components), {}, {
|
|
5942
|
-
showSearch:
|
|
6146
|
+
showSearch: ShowSearch2
|
|
5943
6147
|
}),
|
|
5944
6148
|
effects: effects
|
|
5945
6149
|
}, /*#__PURE__*/React.createElement(FormButtonGroup, null, /*#__PURE__*/React.createElement(SchemaMarkupField, {
|
|
@@ -6016,23 +6220,23 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
6016
6220
|
}, "\u786E\u5B9A"), /*#__PURE__*/React.createElement(Button, {
|
|
6017
6221
|
onClick: function onClick() {
|
|
6018
6222
|
controller.pipeline( /*#__PURE__*/function () {
|
|
6019
|
-
var
|
|
6020
|
-
return regeneratorRuntime.wrap(function
|
|
6223
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(s) {
|
|
6224
|
+
return regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
6021
6225
|
while (1) {
|
|
6022
|
-
switch (
|
|
6226
|
+
switch (_context13.prev = _context13.next) {
|
|
6023
6227
|
case 0:
|
|
6024
|
-
return
|
|
6228
|
+
return _context13.abrupt("return", s.goodsListState.endowCode.endowcodeGoodIndex = []);
|
|
6025
6229
|
|
|
6026
6230
|
case 1:
|
|
6027
6231
|
case "end":
|
|
6028
|
-
return
|
|
6232
|
+
return _context13.stop();
|
|
6029
6233
|
}
|
|
6030
6234
|
}
|
|
6031
|
-
},
|
|
6235
|
+
}, _callee13);
|
|
6032
6236
|
}));
|
|
6033
6237
|
|
|
6034
|
-
return function (
|
|
6035
|
-
return
|
|
6238
|
+
return function (_x12) {
|
|
6239
|
+
return _ref13.apply(this, arguments);
|
|
6036
6240
|
};
|
|
6037
6241
|
}())();
|
|
6038
6242
|
}
|
package/dist/index.js
CHANGED
|
@@ -596,6 +596,20 @@ var EndowCode = function EndowCode() {
|
|
|
596
596
|
}
|
|
597
597
|
}, _callee);
|
|
598
598
|
}));
|
|
599
|
+
this.getTaxCategoryCodeTree = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
600
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
601
|
+
while (1) {
|
|
602
|
+
switch (_context2.prev = _context2.next) {
|
|
603
|
+
case 0:
|
|
604
|
+
return _context2.abrupt("return", []);
|
|
605
|
+
|
|
606
|
+
case 1:
|
|
607
|
+
case "end":
|
|
608
|
+
return _context2.stop();
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}, _callee2);
|
|
612
|
+
}));
|
|
599
613
|
this.getReadOnlyTaxRate = void 0;
|
|
600
614
|
this.getDefaultValue = void 0;
|
|
601
615
|
this.readOnlyTaxRateMap = {
|
|
@@ -5539,6 +5553,7 @@ function cutStr(str, L) {
|
|
|
5539
5553
|
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";
|
|
5540
5554
|
styleInject(css_248z$a);
|
|
5541
5555
|
|
|
5556
|
+
var TreeNode = ktsComponentsAntdX3.Tree.TreeNode;
|
|
5542
5557
|
var confirm = ktsComponentsAntdX3.Modal.confirm;
|
|
5543
5558
|
var EndowCodeDrawer = (function () {
|
|
5544
5559
|
var controller = default_1.useInvoiceController();
|
|
@@ -5798,21 +5813,210 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
5798
5813
|
value: e.value
|
|
5799
5814
|
}, e.label);
|
|
5800
5815
|
}));
|
|
5816
|
+
}, [controller, actions]);
|
|
5817
|
+
/** 税收分类编码 选择组件2 */
|
|
5818
|
+
|
|
5819
|
+
var ShowSearch2 = React__default['default'].useCallback(function (props) {
|
|
5820
|
+
// 是否显示
|
|
5821
|
+
var _React$useState7 = React__default['default'].useState(false),
|
|
5822
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
5823
|
+
visible = _React$useState8[0],
|
|
5824
|
+
setVisible = _React$useState8[1]; // 税收分类编码树
|
|
5825
|
+
|
|
5826
|
+
|
|
5827
|
+
var _React$useState9 = React__default['default'].useState(),
|
|
5828
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
5829
|
+
list = _React$useState10[0],
|
|
5830
|
+
setList = _React$useState10[1]; // 搜索条件
|
|
5831
|
+
|
|
5832
|
+
|
|
5833
|
+
var _React$useState11 = React__default['default'].useState(),
|
|
5834
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
5835
|
+
filter = _React$useState12[0],
|
|
5836
|
+
setFilter = _React$useState12[1];
|
|
5837
|
+
/** 创建 树节点 */
|
|
5838
|
+
|
|
5839
|
+
|
|
5840
|
+
var createTreeNode = React__default['default'].useCallback(function () {
|
|
5841
|
+
if (!list) return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
|
|
5842
|
+
return ctn(list);
|
|
5843
|
+
|
|
5844
|
+
function ctn(l) {
|
|
5845
|
+
var p = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0';
|
|
5846
|
+
if (!l || !l.length) return [/*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null)];
|
|
5847
|
+
return l.filter(function (e) {
|
|
5848
|
+
return e.pid === p;
|
|
5849
|
+
}).map(function (e) {
|
|
5850
|
+
return /*#__PURE__*/React__default['default'].createElement(TreeNode, {
|
|
5851
|
+
title: e.label,
|
|
5852
|
+
key: e.id
|
|
5853
|
+
}, ctn(l, e.id));
|
|
5854
|
+
});
|
|
5855
|
+
}
|
|
5856
|
+
}, [list]);
|
|
5857
|
+
/** 点击了节点 */
|
|
5858
|
+
|
|
5859
|
+
var onSelect = React__default['default'].useCallback(function (e) {
|
|
5860
|
+
var id = e[0]; // 是否叶子节点
|
|
5861
|
+
|
|
5862
|
+
if ((list === null || list === void 0 ? void 0 : list.filter(function (e) {
|
|
5863
|
+
return e.pid === id;
|
|
5864
|
+
}).length) !== 0) {
|
|
5865
|
+
return;
|
|
5866
|
+
}
|
|
5867
|
+
|
|
5868
|
+
var info = list === null || list === void 0 ? void 0 : list.filter(function (e) {
|
|
5869
|
+
return e.id === id;
|
|
5870
|
+
})[0];
|
|
5871
|
+
!readOnlyTaxRate && actions.setFieldState('taxRate', /*#__PURE__*/function () {
|
|
5872
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(s) {
|
|
5873
|
+
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
5874
|
+
while (1) {
|
|
5875
|
+
switch (_context6.prev = _context6.next) {
|
|
5876
|
+
case 0:
|
|
5877
|
+
if (info.taxRate || info.taxRate === 0) {
|
|
5878
|
+
s.value = info.taxRate;
|
|
5879
|
+
}
|
|
5880
|
+
|
|
5881
|
+
case 1:
|
|
5882
|
+
case "end":
|
|
5883
|
+
return _context6.stop();
|
|
5884
|
+
}
|
|
5885
|
+
}
|
|
5886
|
+
}, _callee6);
|
|
5887
|
+
}));
|
|
5888
|
+
|
|
5889
|
+
return function (_x6) {
|
|
5890
|
+
return _ref6.apply(this, arguments);
|
|
5891
|
+
};
|
|
5892
|
+
}());
|
|
5893
|
+
actions.setFieldState('taxClassificationCode', /*#__PURE__*/function () {
|
|
5894
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(s) {
|
|
5895
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
5896
|
+
while (1) {
|
|
5897
|
+
switch (_context7.prev = _context7.next) {
|
|
5898
|
+
case 0:
|
|
5899
|
+
if (info.id) {
|
|
5900
|
+
s.value = info.id;
|
|
5901
|
+
}
|
|
5902
|
+
|
|
5903
|
+
case 1:
|
|
5904
|
+
case "end":
|
|
5905
|
+
return _context7.stop();
|
|
5906
|
+
}
|
|
5907
|
+
}
|
|
5908
|
+
}, _callee7);
|
|
5909
|
+
}));
|
|
5910
|
+
|
|
5911
|
+
return function (_x7) {
|
|
5912
|
+
return _ref7.apply(this, arguments);
|
|
5913
|
+
};
|
|
5914
|
+
}());
|
|
5915
|
+
actions.setFieldState('shorthand', /*#__PURE__*/function () {
|
|
5916
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(s) {
|
|
5917
|
+
return regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
5918
|
+
while (1) {
|
|
5919
|
+
switch (_context8.prev = _context8.next) {
|
|
5920
|
+
case 0:
|
|
5921
|
+
if (info.shorthand) {
|
|
5922
|
+
s.value = info.shorthand;
|
|
5923
|
+
}
|
|
5924
|
+
|
|
5925
|
+
case 1:
|
|
5926
|
+
case "end":
|
|
5927
|
+
return _context8.stop();
|
|
5928
|
+
}
|
|
5929
|
+
}
|
|
5930
|
+
}, _callee8);
|
|
5931
|
+
}));
|
|
5932
|
+
|
|
5933
|
+
return function (_x8) {
|
|
5934
|
+
return _ref8.apply(this, arguments);
|
|
5935
|
+
};
|
|
5936
|
+
}());
|
|
5937
|
+
setVisible(false);
|
|
5938
|
+
}, [list, actions, readOnlyTaxRate]);
|
|
5939
|
+
React__default['default'].useEffect(function () {
|
|
5940
|
+
_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
|
|
5941
|
+
return regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
5942
|
+
while (1) {
|
|
5943
|
+
switch (_context9.prev = _context9.next) {
|
|
5944
|
+
case 0:
|
|
5945
|
+
_context9.t0 = setList;
|
|
5946
|
+
_context9.next = 3;
|
|
5947
|
+
return controller.state.goodsListState.endowCode.getTaxCategoryCodeTree(filter === null || filter === void 0 ? void 0 : filter.taxCategoryCode, filter === null || filter === void 0 ? void 0 : filter.val);
|
|
5948
|
+
|
|
5949
|
+
case 3:
|
|
5950
|
+
_context9.t1 = _context9.sent;
|
|
5951
|
+
|
|
5952
|
+
if (_context9.t1) {
|
|
5953
|
+
_context9.next = 6;
|
|
5954
|
+
break;
|
|
5955
|
+
}
|
|
5956
|
+
|
|
5957
|
+
_context9.t1 = [];
|
|
5958
|
+
|
|
5959
|
+
case 6:
|
|
5960
|
+
_context9.t2 = _context9.t1;
|
|
5961
|
+
(0, _context9.t0)(_context9.t2);
|
|
5962
|
+
|
|
5963
|
+
case 8:
|
|
5964
|
+
case "end":
|
|
5965
|
+
return _context9.stop();
|
|
5966
|
+
}
|
|
5967
|
+
}
|
|
5968
|
+
}, _callee9);
|
|
5969
|
+
}))();
|
|
5970
|
+
}, [filter]);
|
|
5971
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Input, {
|
|
5972
|
+
readOnly: true,
|
|
5973
|
+
value: props.value,
|
|
5974
|
+
onClick: function onClick() {
|
|
5975
|
+
setVisible(true);
|
|
5976
|
+
}
|
|
5977
|
+
}), /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Drawer, {
|
|
5978
|
+
title: "\u7A0E\u6536\u5206\u7C7B\u7F16\u7801",
|
|
5979
|
+
visible: visible,
|
|
5980
|
+
width: 500,
|
|
5981
|
+
onClose: function onClose() {
|
|
5982
|
+
setVisible(false);
|
|
5983
|
+
}
|
|
5984
|
+
}, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form, null, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, {
|
|
5985
|
+
label: "\u4EA7\u54C1\u6216\u670D\u52A1\u7B80\u79F0"
|
|
5986
|
+
}, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Input, {
|
|
5987
|
+
onChange: function onChange(e) {
|
|
5988
|
+
setFilter(_objectSpread2(_objectSpread2({}, filter), {}, {
|
|
5989
|
+
val: e.target.value
|
|
5990
|
+
}));
|
|
5991
|
+
}
|
|
5992
|
+
})), /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, {
|
|
5993
|
+
label: "\u7A0E\u6536\u5206\u7C7B\u7F16\u7801"
|
|
5994
|
+
}, /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Input, {
|
|
5995
|
+
onChange: function onChange(e) {
|
|
5996
|
+
setFilter(_objectSpread2(_objectSpread2({}, filter), {}, {
|
|
5997
|
+
taxCategoryCode: e.target.value
|
|
5998
|
+
}));
|
|
5999
|
+
}
|
|
6000
|
+
}))), list && list.length > 0 && /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Tree, {
|
|
6001
|
+
defaultExpandAll: true,
|
|
6002
|
+
selectedKeys: [],
|
|
6003
|
+
onSelect: onSelect
|
|
6004
|
+
}, createTreeNode())));
|
|
5801
6005
|
}, [controller, actions]); // 是否享受优惠政策
|
|
5802
6006
|
|
|
5803
|
-
var _React$
|
|
5804
|
-
_React$
|
|
5805
|
-
favouredPolicyMark = _React$
|
|
5806
|
-
setFavouredPolicyMark = _React$
|
|
6007
|
+
var _React$useState13 = React__default['default'].useState(0),
|
|
6008
|
+
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
|
6009
|
+
favouredPolicyMark = _React$useState14[0],
|
|
6010
|
+
setFavouredPolicyMark = _React$useState14[1]; // 确定
|
|
5807
6011
|
|
|
5808
6012
|
|
|
5809
6013
|
var onSubmit = React__default['default'].useCallback(function (values) {
|
|
5810
6014
|
controller.pipeline( /*#__PURE__*/function () {
|
|
5811
|
-
var
|
|
6015
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(s) {
|
|
5812
6016
|
var endowCodeGood;
|
|
5813
|
-
return regeneratorRuntime.wrap(function
|
|
6017
|
+
return regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
5814
6018
|
while (1) {
|
|
5815
|
-
switch (
|
|
6019
|
+
switch (_context10.prev = _context10.next) {
|
|
5816
6020
|
case 0:
|
|
5817
6021
|
endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(function (e) {
|
|
5818
6022
|
return s.goodsListState.goodsMap.get(e);
|
|
@@ -5848,11 +6052,11 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
5848
6052
|
if (!endowCodeGood.some(function (e) {
|
|
5849
6053
|
return bytesLnegth((e === null || e === void 0 ? void 0 : e.itemName) || '') > 92;
|
|
5850
6054
|
})) {
|
|
5851
|
-
|
|
6055
|
+
_context10.next = 5;
|
|
5852
6056
|
break;
|
|
5853
6057
|
}
|
|
5854
6058
|
|
|
5855
|
-
|
|
6059
|
+
_context10.next = 5;
|
|
5856
6060
|
return function () {
|
|
5857
6061
|
return new Promise(function (resolve) {
|
|
5858
6062
|
confirm({
|
|
@@ -5881,14 +6085,14 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
5881
6085
|
|
|
5882
6086
|
case 7:
|
|
5883
6087
|
case "end":
|
|
5884
|
-
return
|
|
6088
|
+
return _context10.stop();
|
|
5885
6089
|
}
|
|
5886
6090
|
}
|
|
5887
|
-
},
|
|
6091
|
+
}, _callee10);
|
|
5888
6092
|
}));
|
|
5889
6093
|
|
|
5890
|
-
return function (
|
|
5891
|
-
return
|
|
6094
|
+
return function (_x9) {
|
|
6095
|
+
return _ref10.apply(this, arguments);
|
|
5892
6096
|
};
|
|
5893
6097
|
}())();
|
|
5894
6098
|
}, [controller]);
|
|
@@ -5897,23 +6101,23 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
5897
6101
|
antd.FormEffectHooks.onFieldValueChange$('taxRate').subscribe(function (e) {
|
|
5898
6102
|
setTaxRate(e.value);
|
|
5899
6103
|
actions.setFieldState('taxFreeType', /*#__PURE__*/function () {
|
|
5900
|
-
var
|
|
5901
|
-
return regeneratorRuntime.wrap(function
|
|
6104
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(s) {
|
|
6105
|
+
return regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
5902
6106
|
while (1) {
|
|
5903
|
-
switch (
|
|
6107
|
+
switch (_context11.prev = _context11.next) {
|
|
5904
6108
|
case 0:
|
|
5905
6109
|
if (e.value !== 0) s.value = undefined;
|
|
5906
6110
|
|
|
5907
6111
|
case 1:
|
|
5908
6112
|
case "end":
|
|
5909
|
-
return
|
|
6113
|
+
return _context11.stop();
|
|
5910
6114
|
}
|
|
5911
6115
|
}
|
|
5912
|
-
},
|
|
6116
|
+
}, _callee11);
|
|
5913
6117
|
}));
|
|
5914
6118
|
|
|
5915
|
-
return function (
|
|
5916
|
-
return
|
|
6119
|
+
return function (_x10) {
|
|
6120
|
+
return _ref11.apply(this, arguments);
|
|
5917
6121
|
};
|
|
5918
6122
|
}());
|
|
5919
6123
|
}); // 是否享受优惠政策
|
|
@@ -5921,23 +6125,23 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
5921
6125
|
antd.FormEffectHooks.onFieldValueChange$('favouredPolicyMark').subscribe(function (e) {
|
|
5922
6126
|
setFavouredPolicyMark(e.value);
|
|
5923
6127
|
actions.setFieldState('favouredPolicyName', /*#__PURE__*/function () {
|
|
5924
|
-
var
|
|
5925
|
-
return regeneratorRuntime.wrap(function
|
|
6128
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(s) {
|
|
6129
|
+
return regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
5926
6130
|
while (1) {
|
|
5927
|
-
switch (
|
|
6131
|
+
switch (_context12.prev = _context12.next) {
|
|
5928
6132
|
case 0:
|
|
5929
6133
|
if (e.value === 0) s.value = undefined;
|
|
5930
6134
|
|
|
5931
6135
|
case 1:
|
|
5932
6136
|
case "end":
|
|
5933
|
-
return
|
|
6137
|
+
return _context12.stop();
|
|
5934
6138
|
}
|
|
5935
6139
|
}
|
|
5936
|
-
},
|
|
6140
|
+
}, _callee12);
|
|
5937
6141
|
}));
|
|
5938
6142
|
|
|
5939
|
-
return function (
|
|
5940
|
-
return
|
|
6143
|
+
return function (_x11) {
|
|
6144
|
+
return _ref12.apply(this, arguments);
|
|
5941
6145
|
};
|
|
5942
6146
|
}());
|
|
5943
6147
|
});
|
|
@@ -5949,7 +6153,7 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
5949
6153
|
return /*#__PURE__*/React__default['default'].createElement(antd.SchemaForm, {
|
|
5950
6154
|
actions: actions,
|
|
5951
6155
|
components: _objectSpread2(_objectSpread2({}, components), {}, {
|
|
5952
|
-
showSearch:
|
|
6156
|
+
showSearch: ShowSearch2
|
|
5953
6157
|
}),
|
|
5954
6158
|
effects: effects
|
|
5955
6159
|
}, /*#__PURE__*/React__default['default'].createElement(antd.FormButtonGroup, null, /*#__PURE__*/React__default['default'].createElement(antd.SchemaMarkupField, {
|
|
@@ -6026,23 +6230,23 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
6026
6230
|
}, "\u786E\u5B9A"), /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Button, {
|
|
6027
6231
|
onClick: function onClick() {
|
|
6028
6232
|
controller.pipeline( /*#__PURE__*/function () {
|
|
6029
|
-
var
|
|
6030
|
-
return regeneratorRuntime.wrap(function
|
|
6233
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(s) {
|
|
6234
|
+
return regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
6031
6235
|
while (1) {
|
|
6032
|
-
switch (
|
|
6236
|
+
switch (_context13.prev = _context13.next) {
|
|
6033
6237
|
case 0:
|
|
6034
|
-
return
|
|
6238
|
+
return _context13.abrupt("return", s.goodsListState.endowCode.endowcodeGoodIndex = []);
|
|
6035
6239
|
|
|
6036
6240
|
case 1:
|
|
6037
6241
|
case "end":
|
|
6038
|
-
return
|
|
6242
|
+
return _context13.stop();
|
|
6039
6243
|
}
|
|
6040
6244
|
}
|
|
6041
|
-
},
|
|
6245
|
+
}, _callee13);
|
|
6042
6246
|
}));
|
|
6043
6247
|
|
|
6044
|
-
return function (
|
|
6045
|
-
return
|
|
6248
|
+
return function (_x12) {
|
|
6249
|
+
return _ref13.apply(this, arguments);
|
|
6046
6250
|
};
|
|
6047
6251
|
}())();
|
|
6048
6252
|
}
|
package/package.json
CHANGED
|
@@ -7,9 +7,20 @@ export default class EndowCode {
|
|
|
7
7
|
/** 准备赋码的货物索引列表 */
|
|
8
8
|
endowcodeGoodIndex: number[] = [];
|
|
9
9
|
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* 获取 税收分类编码列表 (弃用)
|
|
12
|
+
* @deprecated 请使用 getTaxCategoryCodeTree 替换
|
|
13
|
+
* */
|
|
11
14
|
getTaxCategoryCodeList: (value: string) => Promise<{ value: string, label: string }[]> = async () => [];
|
|
12
15
|
|
|
16
|
+
/**
|
|
17
|
+
* 获取 税收分类编码树
|
|
18
|
+
* @param taxCategoryCode 税收分类编码
|
|
19
|
+
* @param val val
|
|
20
|
+
* @returns 税收分类编码树
|
|
21
|
+
*/
|
|
22
|
+
getTaxCategoryCodeTree: (taxCategoryCode?: string, val?: string) => Promise<{ id: string, pid: string }[]> = async () => [];
|
|
23
|
+
|
|
13
24
|
/** 税率 是否可以编辑 */
|
|
14
25
|
getReadOnlyTaxRate?: (value?: GoodsListState) => boolean;
|
|
15
26
|
|
|
@@ -18,7 +29,7 @@ export default class EndowCode {
|
|
|
18
29
|
* @param value 商品信息
|
|
19
30
|
* @param length 商品数量
|
|
20
31
|
* */
|
|
21
|
-
getDefaultValue?: (value: IGood, length:number) => Promise<IGood>;
|
|
32
|
+
getDefaultValue?: (value: IGood, length: number) => Promise<IGood>;
|
|
22
33
|
|
|
23
34
|
/** 税率 是否可以编辑 校验函数 */
|
|
24
35
|
readonly readOnlyTaxRateMap: { [key: string]: (value?: GoodsListState) => boolean } = {
|
|
@@ -56,7 +56,7 @@ export default () => {
|
|
|
56
56
|
// 税收分类编码列表
|
|
57
57
|
class MyController1 extends Invoice.InvoiceController {
|
|
58
58
|
|
|
59
|
-
constructor(){
|
|
59
|
+
constructor() {
|
|
60
60
|
super()
|
|
61
61
|
this.state.model = 'default'
|
|
62
62
|
}
|
|
@@ -64,21 +64,21 @@ class MyController1 extends Invoice.InvoiceController {
|
|
|
64
64
|
getTaxCategoryCodeList = this.pipeline(async (s) => {
|
|
65
65
|
console.log('===> 准备赋码的货物索引列表', s.goodsListState.endowCode.endowcodeGoodIndex);
|
|
66
66
|
|
|
67
|
-
s.goodsListState.endowCode.
|
|
67
|
+
s.goodsListState.endowCode.getTaxCategoryCodeTree = async (value) => {
|
|
68
68
|
console.log('===>搜索条件', value);
|
|
69
69
|
return [
|
|
70
|
-
{ label: '3040201990000000000/aaa/bbb',
|
|
71
|
-
{ label: '3040201990000000001/aaa/bbb',
|
|
72
|
-
{ label: '3040201990000000002/aaa/bbb',
|
|
73
|
-
{ label: '3040201990000000003/aaa/bbb',
|
|
74
|
-
{ label: '3040201990000000004/aaa/bbb',
|
|
75
|
-
{ label: '3040201990000000005/aaa/bbb',
|
|
76
|
-
{ label: '3040201990000000006/aaa/bbb',
|
|
77
|
-
{ label: '3040201990000000007/aaa/bbb',
|
|
78
|
-
{ label: '3040201990000000008/aaa/bbb',
|
|
79
|
-
{ label: '3040201990000000009/aaa/bbb',
|
|
80
|
-
{ label: '3040201990000000010/aaa/bbb',
|
|
81
|
-
{ label: '3040201990000000011/aaa/bbb',
|
|
70
|
+
{ label: '3040201990000000000/aaa/bbb', id: '3040201990000000000', pid: '0', taxRate: 3, shorthand: 'aaa' },
|
|
71
|
+
{ label: '3040201990000000001/aaa/bbb', id: '3040201990000000001', pid: '3040201990000000000', taxRate: 3, shorthand: 'aaa' },
|
|
72
|
+
{ label: '3040201990000000002/aaa/bbb', id: '3040201990000000002', pid: '3040201990000000000', taxRate: 3, shorthand: 'aaa' },
|
|
73
|
+
{ label: '3040201990000000003/aaa/bbb', id: '3040201990000000003', pid: '3040201990000000000', taxRate: 3, shorthand: 'aaa' },
|
|
74
|
+
{ label: '3040201990000000004/aaa/bbb', id: '3040201990000000004', pid: '3040201990000000000', taxRate: 3, shorthand: 'aaa' },
|
|
75
|
+
{ label: '3040201990000000005/aaa/bbb', id: '3040201990000000005', pid: '3040201990000000000', taxRate: 3, shorthand: 'aaa' },
|
|
76
|
+
{ label: '3040201990000000006/aaa/bbb', id: '3040201990000000006', pid: '3040201990000000000', taxRate: 3, shorthand: 'aaa' },
|
|
77
|
+
{ label: '3040201990000000007/aaa/bbb', id: '3040201990000000007', pid: '3040201990000000000', taxRate: 3, shorthand: 'aaa' },
|
|
78
|
+
{ label: '3040201990000000008/aaa/bbb', id: '3040201990000000008', pid: '3040201990000000000', taxRate: 3, shorthand: 'aaa' },
|
|
79
|
+
{ label: '3040201990000000009/aaa/bbb', id: '3040201990000000009', pid: '3040201990000000000', taxRate: 3, shorthand: 'aaa' },
|
|
80
|
+
{ label: '3040201990000000010/aaa/bbb', id: '3040201990000000010', pid: '3040201990000000000', taxRate: 3, shorthand: 'aaa' },
|
|
81
|
+
{ label: '3040201990000000011/aaa/bbb', id: '3040201990000000011', pid: '3040201990000000000', taxRate: 3, shorthand: 'aaa' },
|
|
82
82
|
]
|
|
83
83
|
};
|
|
84
84
|
});
|
|
@@ -87,7 +87,7 @@ class MyController1 extends Invoice.InvoiceController {
|
|
|
87
87
|
|
|
88
88
|
class MyController2 extends Invoice.InvoiceController {
|
|
89
89
|
|
|
90
|
-
constructor(){
|
|
90
|
+
constructor() {
|
|
91
91
|
super()
|
|
92
92
|
this.state.model = 'prefab'
|
|
93
93
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Invoice from '../../';
|
|
3
|
-
import { Button, Drawer, Select, Modal } from 'kts-components-antd-x3';
|
|
3
|
+
import { Button, Drawer, Select, Modal, Input as InputAntd, Form, Tree } from 'kts-components-antd-x3';
|
|
4
4
|
import { chain, bignumber } from 'mathjs';
|
|
5
5
|
import { Input, NumberPicker } from '@formily/antd-components';
|
|
6
6
|
import { format15 } from '../GoodsList/hook/useColumns/autoFillFn';
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from '@formily/antd';
|
|
17
17
|
import './index.less';
|
|
18
18
|
|
|
19
|
+
const { TreeNode } = Tree;
|
|
19
20
|
const { confirm } = Modal;
|
|
20
21
|
|
|
21
22
|
export default () => {
|
|
@@ -151,6 +152,109 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
151
152
|
)
|
|
152
153
|
}, [controller, actions])
|
|
153
154
|
|
|
155
|
+
/** 税收分类编码 选择组件2 */
|
|
156
|
+
const ShowSearch2 = React.useCallback(props => {
|
|
157
|
+
|
|
158
|
+
// 是否显示
|
|
159
|
+
const [visible, setVisible] = React.useState(false);
|
|
160
|
+
|
|
161
|
+
// 税收分类编码树
|
|
162
|
+
const [list, setList] = React.useState<any[]>();
|
|
163
|
+
|
|
164
|
+
// 搜索条件
|
|
165
|
+
const [filter, setFilter] = React.useState<{
|
|
166
|
+
/** 税收分类编码 */
|
|
167
|
+
taxCategoryCode?: string,
|
|
168
|
+
|
|
169
|
+
/** 货物和劳务名称/简称 */
|
|
170
|
+
val?: string
|
|
171
|
+
}>();
|
|
172
|
+
|
|
173
|
+
/** 创建 树节点 */
|
|
174
|
+
const createTreeNode = React.useCallback(() => {
|
|
175
|
+
if (!list) return <></>;
|
|
176
|
+
return ctn(list);
|
|
177
|
+
|
|
178
|
+
function ctn(l: any[], p = '0') {
|
|
179
|
+
if (!l || !l.length) return [<></>];
|
|
180
|
+
return l.filter(e => e.pid === p).map(e => {
|
|
181
|
+
return (
|
|
182
|
+
<TreeNode title={e.label} key={e.id}>
|
|
183
|
+
{ctn(l, e.id)}
|
|
184
|
+
</TreeNode>
|
|
185
|
+
)
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
}, [list])
|
|
189
|
+
|
|
190
|
+
/** 点击了节点 */
|
|
191
|
+
const onSelect = React.useCallback((e: string[]) => {
|
|
192
|
+
const id = e[0];
|
|
193
|
+
|
|
194
|
+
// 是否叶子节点
|
|
195
|
+
if (list?.filter(e => e.pid === id).length !== 0) { return; }
|
|
196
|
+
|
|
197
|
+
const info = list?.filter(e => e.id === id)[0];
|
|
198
|
+
|
|
199
|
+
!readOnlyTaxRate && actions.setFieldState('taxRate', async s => {
|
|
200
|
+
if (info.taxRate || info.taxRate === 0) {
|
|
201
|
+
s.value = info.taxRate
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
actions.setFieldState('taxClassificationCode', async s => {
|
|
206
|
+
if (info.id) {
|
|
207
|
+
s.value = info.id
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
actions.setFieldState('shorthand', async (s) => {
|
|
212
|
+
if (info.shorthand) {
|
|
213
|
+
s.value = info.shorthand
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
setVisible(false);
|
|
218
|
+
}, [list, actions, readOnlyTaxRate])
|
|
219
|
+
|
|
220
|
+
React.useEffect(() => {
|
|
221
|
+
(async () => {
|
|
222
|
+
setList(await controller.state.goodsListState.endowCode.getTaxCategoryCodeTree(filter?.taxCategoryCode, filter?.val) || []);
|
|
223
|
+
})()
|
|
224
|
+
}, [filter])
|
|
225
|
+
|
|
226
|
+
return (
|
|
227
|
+
<>
|
|
228
|
+
<InputAntd readOnly value={props.value} onClick={() => { setVisible(true) }} />
|
|
229
|
+
<Drawer
|
|
230
|
+
title="税收分类编码"
|
|
231
|
+
visible={visible}
|
|
232
|
+
width={500}
|
|
233
|
+
onClose={() => { setVisible(false) }}
|
|
234
|
+
>
|
|
235
|
+
<Form>
|
|
236
|
+
<Form.Item label="产品或服务简称" >
|
|
237
|
+
<InputAntd onChange={e => { setFilter({ ...filter, val: e.target.value }) }} />
|
|
238
|
+
</Form.Item>
|
|
239
|
+
<Form.Item label="税收分类编码">
|
|
240
|
+
<InputAntd onChange={e => { setFilter({ ...filter, taxCategoryCode: e.target.value }) }} />
|
|
241
|
+
</Form.Item>
|
|
242
|
+
</Form>
|
|
243
|
+
{
|
|
244
|
+
list && list.length>0 &&
|
|
245
|
+
<Tree
|
|
246
|
+
defaultExpandAll
|
|
247
|
+
selectedKeys={[]}
|
|
248
|
+
onSelect={onSelect}
|
|
249
|
+
>
|
|
250
|
+
{createTreeNode()}
|
|
251
|
+
</Tree>
|
|
252
|
+
}
|
|
253
|
+
</Drawer>
|
|
254
|
+
</>
|
|
255
|
+
)
|
|
256
|
+
}, [controller, actions])
|
|
257
|
+
|
|
154
258
|
// 是否享受优惠政策
|
|
155
259
|
const [favouredPolicyMark, setFavouredPolicyMark] = React.useState<number>(0);
|
|
156
260
|
|
|
@@ -243,7 +347,7 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
243
347
|
}, [controller]);
|
|
244
348
|
|
|
245
349
|
return (
|
|
246
|
-
<SchemaForm actions={actions} components={{ ...components, showSearch:
|
|
350
|
+
<SchemaForm actions={actions} components={{ ...components, showSearch: ShowSearch2 }} effects={effects}>
|
|
247
351
|
<FormButtonGroup>
|
|
248
352
|
<Field
|
|
249
353
|
name="taxClassificationCode"
|
|
@@ -275,7 +379,6 @@ const DrawerBody = (props: { defaultValue: IGood }) => {
|
|
|
275
379
|
title="免税类型"
|
|
276
380
|
default={defaultValue?.taxFreeType}
|
|
277
381
|
enum={taxFreeTypeList}
|
|
278
|
-
|
|
279
382
|
x-rules={[{ message: '请选择免税类型', required: true }]}
|
|
280
383
|
/>
|
|
281
384
|
}
|