kts-component-invoice-operate 3.2.25 → 3.2.26
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/index.d.ts +2 -0
- package/dist/index.esm.js +75 -30
- package/dist/index.js +75 -30
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +3 -0
- package/src/Invoice/InvoiceController/fns/mergeDetails.ts +17 -8
- package/src/Invoice/_test/endowCode/index.tsx +2 -0
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +33 -6
package/dist/index.esm.js
CHANGED
|
@@ -999,6 +999,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
|
|
|
999
999
|
this.editGood = void 0;
|
|
1000
1000
|
this.form = void 0;
|
|
1001
1001
|
this.columnsReplenish = {};
|
|
1002
|
+
this.columnshide = ['itemCode'];
|
|
1002
1003
|
this.unitList = [];
|
|
1003
1004
|
this.defaultRate = 3;
|
|
1004
1005
|
this.taxRateList = [0, 3, 5, 6, 9, 13];
|
|
@@ -1703,12 +1704,12 @@ function mergeDetails(_x) {
|
|
|
1703
1704
|
|
|
1704
1705
|
function _mergeDetails() {
|
|
1705
1706
|
_mergeDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(state) {
|
|
1706
|
-
var sum;
|
|
1707
|
+
var goodsList, sum, p;
|
|
1707
1708
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1708
1709
|
while (1) {
|
|
1709
1710
|
switch (_context.prev = _context.next) {
|
|
1710
1711
|
case 0:
|
|
1711
|
-
if (!
|
|
1712
|
+
if (!state.goodsListState.editGood) {
|
|
1712
1713
|
_context.next = 2;
|
|
1713
1714
|
break;
|
|
1714
1715
|
}
|
|
@@ -1716,65 +1717,88 @@ function _mergeDetails() {
|
|
|
1716
1717
|
return _context.abrupt("return");
|
|
1717
1718
|
|
|
1718
1719
|
case 2:
|
|
1719
|
-
|
|
1720
|
+
goodsList = state.goodsListState.selectedGoodIndex.map(function (e) {
|
|
1721
|
+
return state.goodsListState.goodsMap.get(e);
|
|
1722
|
+
}).filter(function (e) {
|
|
1723
|
+
return !!e;
|
|
1724
|
+
});
|
|
1725
|
+
|
|
1726
|
+
if (!(goodsList.length < 2)) {
|
|
1727
|
+
_context.next = 5;
|
|
1728
|
+
break;
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
return _context.abrupt("return");
|
|
1732
|
+
|
|
1733
|
+
case 5:
|
|
1734
|
+
_context.prev = 5;
|
|
1720
1735
|
// 创建合并后的商品对象
|
|
1721
1736
|
sum = {
|
|
1722
1737
|
$index: idGenerator(),
|
|
1723
1738
|
lineAttribute: LineAttributeType$1.正常
|
|
1724
1739
|
}; // 存在税率不一样的明细,不能合并
|
|
1725
1740
|
|
|
1726
|
-
_context.next =
|
|
1727
|
-
return checkTaxTate(
|
|
1728
|
-
|
|
1729
|
-
case 6:
|
|
1730
|
-
_context.next = 8;
|
|
1731
|
-
return fillingInformationGood(state.goodsListState.goodsList, sum);
|
|
1741
|
+
_context.next = 9;
|
|
1742
|
+
return checkTaxTate(goodsList);
|
|
1732
1743
|
|
|
1733
|
-
case
|
|
1734
|
-
sum = _context.sent;
|
|
1744
|
+
case 9:
|
|
1735
1745
|
_context.next = 11;
|
|
1736
|
-
return
|
|
1746
|
+
return fillingInformationGood(goodsList, sum);
|
|
1737
1747
|
|
|
1738
1748
|
case 11:
|
|
1739
|
-
sum
|
|
1749
|
+
sum = _context.sent;
|
|
1740
1750
|
_context.next = 14;
|
|
1741
|
-
return
|
|
1751
|
+
return mergeQuantity(goodsList);
|
|
1742
1752
|
|
|
1743
1753
|
case 14:
|
|
1744
|
-
sum.
|
|
1754
|
+
sum.quantity = _context.sent;
|
|
1745
1755
|
_context.next = 17;
|
|
1746
|
-
return
|
|
1756
|
+
return mergeLineAmountExcludeTax(goodsList);
|
|
1747
1757
|
|
|
1748
1758
|
case 17:
|
|
1749
|
-
sum.
|
|
1759
|
+
sum.lineAmountExcludeTax = _context.sent;
|
|
1750
1760
|
_context.next = 20;
|
|
1751
|
-
return
|
|
1761
|
+
return mergeLineAmountIncludeTax(goodsList);
|
|
1752
1762
|
|
|
1753
1763
|
case 20:
|
|
1754
|
-
sum.
|
|
1764
|
+
sum.lineAmountIncludeTax = _context.sent;
|
|
1755
1765
|
_context.next = 23;
|
|
1756
|
-
return
|
|
1766
|
+
return calculatePriceExcludeTax(sum);
|
|
1757
1767
|
|
|
1758
1768
|
case 23:
|
|
1769
|
+
sum.priceExcludeTax = _context.sent;
|
|
1770
|
+
_context.next = 26;
|
|
1771
|
+
return calculatePriceIncludeTax(sum);
|
|
1772
|
+
|
|
1773
|
+
case 26:
|
|
1759
1774
|
sum.priceIncludeTax = _context.sent;
|
|
1760
1775
|
// 计算税额
|
|
1761
1776
|
sum.taxAmount = chain$1(bignumber(sum.lineAmountIncludeTax)).subtract(bignumber(sum.lineAmountExcludeTax)).done().toNumber();
|
|
1762
|
-
state.goodsListState.goodsList
|
|
1763
|
-
state.goodsListState.
|
|
1764
|
-
|
|
1777
|
+
p = state.goodsListState.goodsList.indexOf(goodsList[0]);
|
|
1778
|
+
state.goodsListState.goodsList = state.goodsListState.goodsList.filter(function (e) {
|
|
1779
|
+
return state.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0;
|
|
1780
|
+
});
|
|
1781
|
+
state.goodsListState.goodsList.splice(p, 0, sum);
|
|
1782
|
+
state.goodsListState.goodsMap = new Map();
|
|
1783
|
+
state.goodsListState.goodsList.forEach(function (e) {
|
|
1784
|
+
state.goodsListState.goodsMap.set(e.$index, e);
|
|
1785
|
+
});
|
|
1786
|
+
state.goodsListState.selectedGoodIndex = [];
|
|
1787
|
+
_context.next = 40;
|
|
1765
1788
|
break;
|
|
1766
1789
|
|
|
1767
|
-
case
|
|
1768
|
-
_context.prev =
|
|
1769
|
-
_context.t0 = _context["catch"](
|
|
1790
|
+
case 36:
|
|
1791
|
+
_context.prev = 36;
|
|
1792
|
+
_context.t0 = _context["catch"](5);
|
|
1793
|
+
debugger;
|
|
1770
1794
|
showError(_context.t0);
|
|
1771
1795
|
|
|
1772
|
-
case
|
|
1796
|
+
case 40:
|
|
1773
1797
|
case "end":
|
|
1774
1798
|
return _context.stop();
|
|
1775
1799
|
}
|
|
1776
1800
|
}
|
|
1777
|
-
}, _callee, null, [[
|
|
1801
|
+
}, _callee, null, [[5, 36]]);
|
|
1778
1802
|
}));
|
|
1779
1803
|
return _mergeDetails.apply(this, arguments);
|
|
1780
1804
|
}
|
|
@@ -10519,6 +10543,11 @@ var useColumns = (function (form) {
|
|
|
10519
10543
|
var editGood = controller.useMemo(function (e) {
|
|
10520
10544
|
return e.goodsListState.editGood;
|
|
10521
10545
|
}, []);
|
|
10546
|
+
/** 商品表格隐藏列 */
|
|
10547
|
+
|
|
10548
|
+
var columnshide = controller.useMemo(function (e) {
|
|
10549
|
+
return e.goodsListState.columnshide;
|
|
10550
|
+
}, []);
|
|
10522
10551
|
/** 搜索条件 */
|
|
10523
10552
|
|
|
10524
10553
|
var searchValue = controller.useMemo(function (e) {
|
|
@@ -10710,6 +10739,19 @@ var useColumns = (function (form) {
|
|
|
10710
10739
|
});
|
|
10711
10740
|
}
|
|
10712
10741
|
}
|
|
10742
|
+
}, {
|
|
10743
|
+
title: '商品编码',
|
|
10744
|
+
key: 'itemCode',
|
|
10745
|
+
width: 119,
|
|
10746
|
+
render: function render(_, record) {
|
|
10747
|
+
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
10748
|
+
return React.createElement(Form.Item, null, getFieldDecorator('itemCode', {
|
|
10749
|
+
initialValue: editGood.itemCode
|
|
10750
|
+
})(React.createElement(MyInput, null)));
|
|
10751
|
+
} else {
|
|
10752
|
+
return record.itemCode;
|
|
10753
|
+
}
|
|
10754
|
+
}
|
|
10713
10755
|
}, {
|
|
10714
10756
|
title: React.createElement(TitleText, {
|
|
10715
10757
|
rules: (_columnsReplenish$ite = columnsReplenish['itemModelName']) === null || _columnsReplenish$ite === void 0 ? void 0 : _columnsReplenish$ite.rules
|
|
@@ -11295,7 +11337,10 @@ var useColumns = (function (form) {
|
|
|
11295
11337
|
goods: record
|
|
11296
11338
|
});
|
|
11297
11339
|
}
|
|
11298
|
-
}] //
|
|
11340
|
+
}] // 筛选隐藏
|
|
11341
|
+
.filter(function (e) {
|
|
11342
|
+
return e.key ? columnshide.indexOf(e.key) < 0 : false;
|
|
11343
|
+
}) // 含税不含税
|
|
11299
11344
|
.filter(function (e) {
|
|
11300
11345
|
if (isTaxIncluded) {
|
|
11301
11346
|
return !(e.key === 'priceExcludeTax' || e.key === 'lineAmountExcludeTax');
|
|
@@ -11314,7 +11359,7 @@ var useColumns = (function (form) {
|
|
|
11314
11359
|
ellipsis: true
|
|
11315
11360
|
});
|
|
11316
11361
|
});
|
|
11317
|
-
}, [isTaxIncluded, editGood, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish]); // React.useEffect(() => {
|
|
11362
|
+
}, [isTaxIncluded, editGood, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, columnshide]); // React.useEffect(() => {
|
|
11318
11363
|
// clearTimeout(t)
|
|
11319
11364
|
// const t = setTimeout(() => { setChangeField('') }, 1000);
|
|
11320
11365
|
// return () => { clearTimeout(t) }
|
package/dist/index.js
CHANGED
|
@@ -1009,6 +1009,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
|
|
|
1009
1009
|
this.editGood = void 0;
|
|
1010
1010
|
this.form = void 0;
|
|
1011
1011
|
this.columnsReplenish = {};
|
|
1012
|
+
this.columnshide = ['itemCode'];
|
|
1012
1013
|
this.unitList = [];
|
|
1013
1014
|
this.defaultRate = 3;
|
|
1014
1015
|
this.taxRateList = [0, 3, 5, 6, 9, 13];
|
|
@@ -1713,12 +1714,12 @@ function mergeDetails(_x) {
|
|
|
1713
1714
|
|
|
1714
1715
|
function _mergeDetails() {
|
|
1715
1716
|
_mergeDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(state) {
|
|
1716
|
-
var sum;
|
|
1717
|
+
var goodsList, sum, p;
|
|
1717
1718
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1718
1719
|
while (1) {
|
|
1719
1720
|
switch (_context.prev = _context.next) {
|
|
1720
1721
|
case 0:
|
|
1721
|
-
if (!
|
|
1722
|
+
if (!state.goodsListState.editGood) {
|
|
1722
1723
|
_context.next = 2;
|
|
1723
1724
|
break;
|
|
1724
1725
|
}
|
|
@@ -1726,65 +1727,88 @@ function _mergeDetails() {
|
|
|
1726
1727
|
return _context.abrupt("return");
|
|
1727
1728
|
|
|
1728
1729
|
case 2:
|
|
1729
|
-
|
|
1730
|
+
goodsList = state.goodsListState.selectedGoodIndex.map(function (e) {
|
|
1731
|
+
return state.goodsListState.goodsMap.get(e);
|
|
1732
|
+
}).filter(function (e) {
|
|
1733
|
+
return !!e;
|
|
1734
|
+
});
|
|
1735
|
+
|
|
1736
|
+
if (!(goodsList.length < 2)) {
|
|
1737
|
+
_context.next = 5;
|
|
1738
|
+
break;
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
return _context.abrupt("return");
|
|
1742
|
+
|
|
1743
|
+
case 5:
|
|
1744
|
+
_context.prev = 5;
|
|
1730
1745
|
// 创建合并后的商品对象
|
|
1731
1746
|
sum = {
|
|
1732
1747
|
$index: idGenerator(),
|
|
1733
1748
|
lineAttribute: LineAttributeType$1.正常
|
|
1734
1749
|
}; // 存在税率不一样的明细,不能合并
|
|
1735
1750
|
|
|
1736
|
-
_context.next =
|
|
1737
|
-
return checkTaxTate(
|
|
1738
|
-
|
|
1739
|
-
case 6:
|
|
1740
|
-
_context.next = 8;
|
|
1741
|
-
return fillingInformationGood(state.goodsListState.goodsList, sum);
|
|
1751
|
+
_context.next = 9;
|
|
1752
|
+
return checkTaxTate(goodsList);
|
|
1742
1753
|
|
|
1743
|
-
case
|
|
1744
|
-
sum = _context.sent;
|
|
1754
|
+
case 9:
|
|
1745
1755
|
_context.next = 11;
|
|
1746
|
-
return
|
|
1756
|
+
return fillingInformationGood(goodsList, sum);
|
|
1747
1757
|
|
|
1748
1758
|
case 11:
|
|
1749
|
-
sum
|
|
1759
|
+
sum = _context.sent;
|
|
1750
1760
|
_context.next = 14;
|
|
1751
|
-
return
|
|
1761
|
+
return mergeQuantity(goodsList);
|
|
1752
1762
|
|
|
1753
1763
|
case 14:
|
|
1754
|
-
sum.
|
|
1764
|
+
sum.quantity = _context.sent;
|
|
1755
1765
|
_context.next = 17;
|
|
1756
|
-
return
|
|
1766
|
+
return mergeLineAmountExcludeTax(goodsList);
|
|
1757
1767
|
|
|
1758
1768
|
case 17:
|
|
1759
|
-
sum.
|
|
1769
|
+
sum.lineAmountExcludeTax = _context.sent;
|
|
1760
1770
|
_context.next = 20;
|
|
1761
|
-
return
|
|
1771
|
+
return mergeLineAmountIncludeTax(goodsList);
|
|
1762
1772
|
|
|
1763
1773
|
case 20:
|
|
1764
|
-
sum.
|
|
1774
|
+
sum.lineAmountIncludeTax = _context.sent;
|
|
1765
1775
|
_context.next = 23;
|
|
1766
|
-
return
|
|
1776
|
+
return calculatePriceExcludeTax(sum);
|
|
1767
1777
|
|
|
1768
1778
|
case 23:
|
|
1779
|
+
sum.priceExcludeTax = _context.sent;
|
|
1780
|
+
_context.next = 26;
|
|
1781
|
+
return calculatePriceIncludeTax(sum);
|
|
1782
|
+
|
|
1783
|
+
case 26:
|
|
1769
1784
|
sum.priceIncludeTax = _context.sent;
|
|
1770
1785
|
// 计算税额
|
|
1771
1786
|
sum.taxAmount = mathjs.chain(mathjs.bignumber(sum.lineAmountIncludeTax)).subtract(mathjs.bignumber(sum.lineAmountExcludeTax)).done().toNumber();
|
|
1772
|
-
state.goodsListState.goodsList
|
|
1773
|
-
state.goodsListState.
|
|
1774
|
-
|
|
1787
|
+
p = state.goodsListState.goodsList.indexOf(goodsList[0]);
|
|
1788
|
+
state.goodsListState.goodsList = state.goodsListState.goodsList.filter(function (e) {
|
|
1789
|
+
return state.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0;
|
|
1790
|
+
});
|
|
1791
|
+
state.goodsListState.goodsList.splice(p, 0, sum);
|
|
1792
|
+
state.goodsListState.goodsMap = new Map();
|
|
1793
|
+
state.goodsListState.goodsList.forEach(function (e) {
|
|
1794
|
+
state.goodsListState.goodsMap.set(e.$index, e);
|
|
1795
|
+
});
|
|
1796
|
+
state.goodsListState.selectedGoodIndex = [];
|
|
1797
|
+
_context.next = 40;
|
|
1775
1798
|
break;
|
|
1776
1799
|
|
|
1777
|
-
case
|
|
1778
|
-
_context.prev =
|
|
1779
|
-
_context.t0 = _context["catch"](
|
|
1800
|
+
case 36:
|
|
1801
|
+
_context.prev = 36;
|
|
1802
|
+
_context.t0 = _context["catch"](5);
|
|
1803
|
+
debugger;
|
|
1780
1804
|
showError(_context.t0);
|
|
1781
1805
|
|
|
1782
|
-
case
|
|
1806
|
+
case 40:
|
|
1783
1807
|
case "end":
|
|
1784
1808
|
return _context.stop();
|
|
1785
1809
|
}
|
|
1786
1810
|
}
|
|
1787
|
-
}, _callee, null, [[
|
|
1811
|
+
}, _callee, null, [[5, 36]]);
|
|
1788
1812
|
}));
|
|
1789
1813
|
return _mergeDetails.apply(this, arguments);
|
|
1790
1814
|
}
|
|
@@ -10529,6 +10553,11 @@ var useColumns = (function (form) {
|
|
|
10529
10553
|
var editGood = controller.useMemo(function (e) {
|
|
10530
10554
|
return e.goodsListState.editGood;
|
|
10531
10555
|
}, []);
|
|
10556
|
+
/** 商品表格隐藏列 */
|
|
10557
|
+
|
|
10558
|
+
var columnshide = controller.useMemo(function (e) {
|
|
10559
|
+
return e.goodsListState.columnshide;
|
|
10560
|
+
}, []);
|
|
10532
10561
|
/** 搜索条件 */
|
|
10533
10562
|
|
|
10534
10563
|
var searchValue = controller.useMemo(function (e) {
|
|
@@ -10720,6 +10749,19 @@ var useColumns = (function (form) {
|
|
|
10720
10749
|
});
|
|
10721
10750
|
}
|
|
10722
10751
|
}
|
|
10752
|
+
}, {
|
|
10753
|
+
title: '商品编码',
|
|
10754
|
+
key: 'itemCode',
|
|
10755
|
+
width: 119,
|
|
10756
|
+
render: function render(_, record) {
|
|
10757
|
+
if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index) {
|
|
10758
|
+
return React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('itemCode', {
|
|
10759
|
+
initialValue: editGood.itemCode
|
|
10760
|
+
})(React__default['default'].createElement(MyInput, null)));
|
|
10761
|
+
} else {
|
|
10762
|
+
return record.itemCode;
|
|
10763
|
+
}
|
|
10764
|
+
}
|
|
10723
10765
|
}, {
|
|
10724
10766
|
title: React__default['default'].createElement(TitleText, {
|
|
10725
10767
|
rules: (_columnsReplenish$ite = columnsReplenish['itemModelName']) === null || _columnsReplenish$ite === void 0 ? void 0 : _columnsReplenish$ite.rules
|
|
@@ -11305,7 +11347,10 @@ var useColumns = (function (form) {
|
|
|
11305
11347
|
goods: record
|
|
11306
11348
|
});
|
|
11307
11349
|
}
|
|
11308
|
-
}] //
|
|
11350
|
+
}] // 筛选隐藏
|
|
11351
|
+
.filter(function (e) {
|
|
11352
|
+
return e.key ? columnshide.indexOf(e.key) < 0 : false;
|
|
11353
|
+
}) // 含税不含税
|
|
11309
11354
|
.filter(function (e) {
|
|
11310
11355
|
if (isTaxIncluded) {
|
|
11311
11356
|
return !(e.key === 'priceExcludeTax' || e.key === 'lineAmountExcludeTax');
|
|
@@ -11324,7 +11369,7 @@ var useColumns = (function (form) {
|
|
|
11324
11369
|
ellipsis: true
|
|
11325
11370
|
});
|
|
11326
11371
|
});
|
|
11327
|
-
}, [isTaxIncluded, editGood, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish]); // React.useEffect(() => {
|
|
11372
|
+
}, [isTaxIncluded, editGood, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, columnshide]); // React.useEffect(() => {
|
|
11328
11373
|
// clearTimeout(t)
|
|
11329
11374
|
// const t = setTimeout(() => { setChangeField('') }, 1000);
|
|
11330
11375
|
// return () => { clearTimeout(t) }
|
package/package.json
CHANGED
|
@@ -5,25 +5,29 @@ import idGenerator from '../../tools/idGenerator';
|
|
|
5
5
|
import { IGood, InvoiceControllerState, LineAttributeType } from '..';
|
|
6
6
|
|
|
7
7
|
export default async function mergeDetails(state: InvoiceControllerState) {
|
|
8
|
-
if (state.goodsListState.
|
|
8
|
+
if (state.goodsListState.editGood) return;
|
|
9
|
+
|
|
10
|
+
const goodsList = state.goodsListState.selectedGoodIndex.map(e => state.goodsListState.goodsMap.get(e)).filter(e => !!e) as IGood[];
|
|
11
|
+
if (goodsList.length < 2) return;
|
|
12
|
+
|
|
9
13
|
try {
|
|
10
14
|
// 创建合并后的商品对象
|
|
11
15
|
let sum: IGood = { $index: idGenerator(), lineAttribute: LineAttributeType.正常 }
|
|
12
16
|
|
|
13
17
|
// 存在税率不一样的明细,不能合并
|
|
14
|
-
await checkTaxTate(
|
|
18
|
+
await checkTaxTate(goodsList);
|
|
15
19
|
|
|
16
20
|
// 填充行明细信息
|
|
17
|
-
sum = await fillingInformationGood(
|
|
21
|
+
sum = await fillingInformationGood(goodsList, sum);
|
|
18
22
|
|
|
19
23
|
// 合并数量
|
|
20
|
-
sum.quantity = await mergeQuantity(
|
|
24
|
+
sum.quantity = await mergeQuantity(goodsList);
|
|
21
25
|
|
|
22
26
|
// 合并金额(不含税)
|
|
23
|
-
sum.lineAmountExcludeTax = await mergeLineAmountExcludeTax(
|
|
27
|
+
sum.lineAmountExcludeTax = await mergeLineAmountExcludeTax(goodsList);
|
|
24
28
|
|
|
25
29
|
// 合并金额(含税)
|
|
26
|
-
sum.lineAmountIncludeTax = await mergeLineAmountIncludeTax(
|
|
30
|
+
sum.lineAmountIncludeTax = await mergeLineAmountIncludeTax(goodsList);
|
|
27
31
|
|
|
28
32
|
// 计算单价(不含税)
|
|
29
33
|
sum.priceExcludeTax = await calculatePriceExcludeTax(sum);
|
|
@@ -34,9 +38,14 @@ export default async function mergeDetails(state: InvoiceControllerState) {
|
|
|
34
38
|
// 计算税额
|
|
35
39
|
sum.taxAmount = chain(bignumber(sum.lineAmountIncludeTax)).subtract(bignumber(sum.lineAmountExcludeTax)).done().toNumber()
|
|
36
40
|
|
|
37
|
-
state.goodsListState.goodsList
|
|
38
|
-
state.goodsListState.
|
|
41
|
+
const p = state.goodsListState.goodsList.indexOf(goodsList[0]);
|
|
42
|
+
state.goodsListState.goodsList = state.goodsListState.goodsList.filter(e => state.goodsListState.selectedGoodIndex.indexOf(e.$index) < 0);
|
|
43
|
+
state.goodsListState.goodsList.splice(p, 0, sum);
|
|
44
|
+
state.goodsListState.goodsMap = new Map();
|
|
45
|
+
state.goodsListState.goodsList.forEach(e => { state.goodsListState.goodsMap.set(e.$index, e) });
|
|
46
|
+
state.goodsListState.selectedGoodIndex = [];
|
|
39
47
|
} catch (error: any) {
|
|
48
|
+
debugger;
|
|
40
49
|
showError(error)
|
|
41
50
|
}
|
|
42
51
|
}
|
|
@@ -64,6 +64,7 @@ class MyController1 extends Invoice.InvoiceController {
|
|
|
64
64
|
constructor() {
|
|
65
65
|
super()
|
|
66
66
|
this.state.model = 'default'
|
|
67
|
+
this.state.goodsListState.isMergeDetails = true;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
getTaxCategoryCodeList = this.pipeline(async (s) => {
|
|
@@ -88,6 +89,7 @@ class MyController2 extends Invoice.InvoiceController {
|
|
|
88
89
|
constructor() {
|
|
89
90
|
super()
|
|
90
91
|
this.state.model = 'prefab'
|
|
92
|
+
this.state.goodsListState.isMergeDetails = true;
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
getTaxCategoryCodeList = this.pipeline(async (s) => {
|
|
@@ -35,6 +35,9 @@ export default (form: WrappedFormUtils) => {
|
|
|
35
35
|
/** 正在编辑的货物 */
|
|
36
36
|
const editGood = controller.useMemo((e) => e.goodsListState.editGood, []);
|
|
37
37
|
|
|
38
|
+
/** 商品表格隐藏列 */
|
|
39
|
+
const columnshide = controller.useMemo((e) => e.goodsListState.columnshide, []);
|
|
40
|
+
|
|
38
41
|
/** 搜索条件 */
|
|
39
42
|
const searchValue = controller.useMemo((e) => e.goodsListState.searchValue, []);
|
|
40
43
|
|
|
@@ -58,9 +61,9 @@ export default (form: WrappedFormUtils) => {
|
|
|
58
61
|
|
|
59
62
|
const onNumberValueChange = React.useCallback((e) => {
|
|
60
63
|
const value = e?.target?.value;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
if (value) {
|
|
65
|
+
return value.replace(/[^0-9-\.]/g, '');
|
|
66
|
+
}
|
|
64
67
|
}, [])
|
|
65
68
|
|
|
66
69
|
/** 获取补充校验规则 */
|
|
@@ -130,14 +133,34 @@ export default (form: WrappedFormUtils) => {
|
|
|
130
133
|
} else {
|
|
131
134
|
return (
|
|
132
135
|
<MyItemNameDiv
|
|
133
|
-
valueT={formatSearch(getItemNameWithShorthand({shorthand: record.shorthand, full: record.itemNameSelf || ''}), searchValue)}
|
|
134
|
-
valueF={formatSearch(getItemNameWithShorthand({shorthand: record.shorthand, full: record.itemName || ''}), searchValue)}
|
|
136
|
+
valueT={formatSearch(getItemNameWithShorthand({ shorthand: record.shorthand, full: record.itemNameSelf || '' }), searchValue)}
|
|
137
|
+
valueF={formatSearch(getItemNameWithShorthand({ shorthand: record.shorthand, full: record.itemName || '' }), searchValue)}
|
|
135
138
|
isMyShow={isMyShow}
|
|
136
139
|
/>
|
|
137
140
|
)
|
|
138
141
|
}
|
|
139
142
|
},
|
|
140
143
|
},
|
|
144
|
+
{
|
|
145
|
+
title: '商品编码',
|
|
146
|
+
key: 'itemCode',
|
|
147
|
+
width: 119,
|
|
148
|
+
render: (_: string, record: IGood) => {
|
|
149
|
+
if (editGood?.$index === record.$index) {
|
|
150
|
+
return (
|
|
151
|
+
<Form.Item>
|
|
152
|
+
{getFieldDecorator('itemCode', {
|
|
153
|
+
initialValue: editGood.itemCode,
|
|
154
|
+
})(
|
|
155
|
+
<MyInput />,
|
|
156
|
+
)}
|
|
157
|
+
</Form.Item>
|
|
158
|
+
)
|
|
159
|
+
} else {
|
|
160
|
+
return record.itemCode
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
141
164
|
{
|
|
142
165
|
title: <TitleText rules={columnsReplenish['itemModelName']?.rules} >规格型号</TitleText>,
|
|
143
166
|
key: 'itemModelName',
|
|
@@ -497,6 +520,10 @@ export default (form: WrappedFormUtils) => {
|
|
|
497
520
|
render: (_value: string, record: IGood) => <RowMenu key={record.lineAttribute} goods={record} />,
|
|
498
521
|
},
|
|
499
522
|
]
|
|
523
|
+
// 筛选隐藏
|
|
524
|
+
.filter(e => {
|
|
525
|
+
return e.key ? columnshide.indexOf(e.key) < 0 : false;
|
|
526
|
+
})
|
|
500
527
|
// 含税不含税
|
|
501
528
|
.filter((e) => {
|
|
502
529
|
if (isTaxIncluded) {
|
|
@@ -519,7 +546,7 @@ export default (form: WrappedFormUtils) => {
|
|
|
519
546
|
ellipsis: true,
|
|
520
547
|
};
|
|
521
548
|
}) as any[];
|
|
522
|
-
}, [isTaxIncluded, editGood, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish]);
|
|
549
|
+
}, [isTaxIncluded, editGood, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, columnshide]);
|
|
523
550
|
|
|
524
551
|
// React.useEffect(() => {
|
|
525
552
|
// clearTimeout(t)
|