kts-component-invoice-operate 3.2.103 → 3.2.105
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/ui/digtal/GoodsList/hook/useColumns/ui/ItemNameInput/index.d.ts +1 -0
- package/dist/index.esm.js +281 -158
- package/dist/index.js +281 -158
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/fns/mergeDetails.ts +76 -43
- package/src/Invoice/_test/endowCode/index.tsx +118 -118
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +2 -1
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +25 -1
package/dist/index.esm.js
CHANGED
|
@@ -1813,111 +1813,170 @@ function mergeDetails(_x, _x2) {
|
|
|
1813
1813
|
/** 计算单价(含税) */
|
|
1814
1814
|
|
|
1815
1815
|
function _mergeDetails() {
|
|
1816
|
-
_mergeDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1817
|
-
var goodsList,
|
|
1818
|
-
|
|
1816
|
+
_mergeDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(state, selectedGoodIndex) {
|
|
1817
|
+
var goodsList, grouping, merge, _merge;
|
|
1818
|
+
|
|
1819
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1819
1820
|
while (1) {
|
|
1820
|
-
switch (
|
|
1821
|
+
switch (_context2.prev = _context2.next) {
|
|
1821
1822
|
case 0:
|
|
1822
|
-
|
|
1823
|
+
_merge = function _merge3() {
|
|
1824
|
+
_merge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(goodsList) {
|
|
1825
|
+
var selectedGoodIndex, sum, p;
|
|
1826
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1827
|
+
while (1) {
|
|
1828
|
+
switch (_context.prev = _context.next) {
|
|
1829
|
+
case 0:
|
|
1830
|
+
if (!(goodsList.length < 2)) {
|
|
1831
|
+
_context.next = 2;
|
|
1832
|
+
break;
|
|
1833
|
+
}
|
|
1823
1834
|
|
|
1824
|
-
|
|
1825
|
-
_context.next = 3;
|
|
1826
|
-
break;
|
|
1827
|
-
}
|
|
1835
|
+
return _context.abrupt("return");
|
|
1828
1836
|
|
|
1829
|
-
|
|
1837
|
+
case 2:
|
|
1838
|
+
selectedGoodIndex = goodsList.map(function (e) {
|
|
1839
|
+
return e.$index;
|
|
1840
|
+
});
|
|
1841
|
+
_context.prev = 3;
|
|
1842
|
+
// 创建合并后的商品对象
|
|
1843
|
+
sum = {
|
|
1844
|
+
$index: idGenerator(),
|
|
1845
|
+
lineAttribute: goodsList[0].lineAttribute
|
|
1846
|
+
}; // 存在税率不一样的明细,不能合并
|
|
1830
1847
|
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
// const goodsList = state.goodsListState.goodsList.filter(e => state.goodsListState.selectedGoodIndex.indexOf(e.$index) >= 0)
|
|
1834
|
-
goodsList = state.goodsListState.goodsList.filter(function (e) {
|
|
1835
|
-
return selectedGoodIndex.indexOf(e.$index) >= 0;
|
|
1836
|
-
});
|
|
1848
|
+
_context.next = 7;
|
|
1849
|
+
return checkTaxTate(goodsList);
|
|
1837
1850
|
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
}
|
|
1851
|
+
case 7:
|
|
1852
|
+
_context.next = 9;
|
|
1853
|
+
return fillingInformationGood(goodsList, sum);
|
|
1842
1854
|
|
|
1843
|
-
|
|
1855
|
+
case 9:
|
|
1856
|
+
sum = _context.sent;
|
|
1857
|
+
_context.next = 12;
|
|
1858
|
+
return mergeQuantity(goodsList);
|
|
1844
1859
|
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
$index: idGenerator(),
|
|
1850
|
-
lineAttribute: LineAttributeType$1.正常
|
|
1851
|
-
}; // 存在税率不一样的明细,不能合并
|
|
1860
|
+
case 12:
|
|
1861
|
+
sum.quantity = _context.sent;
|
|
1862
|
+
_context.next = 15;
|
|
1863
|
+
return mergeLineAmountExcludeTax(goodsList);
|
|
1852
1864
|
|
|
1853
|
-
|
|
1854
|
-
|
|
1865
|
+
case 15:
|
|
1866
|
+
sum.lineAmountExcludeTax = _context.sent;
|
|
1867
|
+
_context.next = 18;
|
|
1868
|
+
return mergeLineAmountIncludeTax(goodsList);
|
|
1855
1869
|
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1870
|
+
case 18:
|
|
1871
|
+
sum.lineAmountIncludeTax = _context.sent;
|
|
1872
|
+
_context.next = 21;
|
|
1873
|
+
return calculatePriceExcludeTax(sum, state.calculatingDigits);
|
|
1874
|
+
|
|
1875
|
+
case 21:
|
|
1876
|
+
sum.priceExcludeTax = _context.sent;
|
|
1877
|
+
_context.next = 24;
|
|
1878
|
+
return calculatePriceIncludeTax(sum, state.calculatingDigits);
|
|
1879
|
+
|
|
1880
|
+
case 24:
|
|
1881
|
+
sum.priceIncludeTax = _context.sent;
|
|
1882
|
+
// 计算税额
|
|
1883
|
+
sum.taxAmount = chain$1(bignumber(sum.lineAmountIncludeTax)).subtract(bignumber(sum.lineAmountExcludeTax)).done().toNumber(); // 校验数据 是否数量和金额是否同号
|
|
1884
|
+
|
|
1885
|
+
_context.next = 28;
|
|
1886
|
+
return checkSameNumber(sum);
|
|
1887
|
+
|
|
1888
|
+
case 28:
|
|
1889
|
+
p = state.goodsListState.goodsList.indexOf(goodsList[0]);
|
|
1890
|
+
state.goodsListState.goodsList = state.goodsListState.goodsList.filter(function (e) {
|
|
1891
|
+
return selectedGoodIndex.indexOf(e.$index) < 0;
|
|
1892
|
+
});
|
|
1893
|
+
state.goodsListState.goodsList.splice(p, 0, sum);
|
|
1894
|
+
state.goodsListState.goodsList = state.goodsListState.goodsList.filter(function (e) {
|
|
1895
|
+
return e.lineAmountExcludeTax !== 0;
|
|
1896
|
+
});
|
|
1897
|
+
state.goodsListState.goodsMap = new Map();
|
|
1898
|
+
state.goodsListState.goodsList.forEach(function (e) {
|
|
1899
|
+
state.goodsListState.goodsMap.set(e.$index, e);
|
|
1900
|
+
});
|
|
1901
|
+
state.goodsListState.selectedGoodIndex = [];
|
|
1902
|
+
_context.next = 40;
|
|
1903
|
+
break;
|
|
1859
1904
|
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1905
|
+
case 37:
|
|
1906
|
+
_context.prev = 37;
|
|
1907
|
+
_context.t0 = _context["catch"](3);
|
|
1908
|
+
showError(_context.t0);
|
|
1864
1909
|
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1910
|
+
case 40:
|
|
1911
|
+
case "end":
|
|
1912
|
+
return _context.stop();
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
}, _callee, null, [[3, 37]]);
|
|
1916
|
+
}));
|
|
1917
|
+
return _merge.apply(this, arguments);
|
|
1918
|
+
};
|
|
1869
1919
|
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
return mergeLineAmountIncludeTax(goodsList);
|
|
1920
|
+
merge = function _merge2(_x14) {
|
|
1921
|
+
return _merge.apply(this, arguments);
|
|
1922
|
+
};
|
|
1874
1923
|
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1924
|
+
grouping = function _grouping(goodsList) {
|
|
1925
|
+
var grouped = {};
|
|
1926
|
+
goodsList.forEach(function (good) {
|
|
1927
|
+
var key = function () {
|
|
1928
|
+
switch (good.lineAttribute) {
|
|
1929
|
+
case LineAttributeType$1.折让行:
|
|
1930
|
+
return LineAttributeType$1.折让行;
|
|
1879
1931
|
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
_context.next = 27;
|
|
1883
|
-
return calculatePriceIncludeTax(sum, state.calculatingDigits);
|
|
1932
|
+
case LineAttributeType$1.赠品行:
|
|
1933
|
+
return LineAttributeType$1.赠品行;
|
|
1884
1934
|
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1935
|
+
default:
|
|
1936
|
+
return LineAttributeType$1.正常;
|
|
1937
|
+
}
|
|
1938
|
+
}();
|
|
1889
1939
|
|
|
1890
|
-
|
|
1891
|
-
|
|
1940
|
+
if (!grouped[key]) {
|
|
1941
|
+
grouped[key] = [];
|
|
1942
|
+
}
|
|
1892
1943
|
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1944
|
+
grouped[key].push(_objectSpread2(_objectSpread2({}, good), {}, {
|
|
1945
|
+
lineAttribute: key
|
|
1946
|
+
}));
|
|
1947
|
+
});
|
|
1948
|
+
return Object.values(grouped);
|
|
1949
|
+
};
|
|
1950
|
+
|
|
1951
|
+
if (!(state.goodsListState.editGood || !selectedGoodIndex || selectedGoodIndex.length < 2)) {
|
|
1952
|
+
_context2.next = 5;
|
|
1953
|
+
break;
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
return _context2.abrupt("return");
|
|
1957
|
+
|
|
1958
|
+
case 5:
|
|
1959
|
+
goodsList = state.goodsListState.goodsList.filter(function (e) {
|
|
1960
|
+
return selectedGoodIndex.indexOf(e.$index) >= 0;
|
|
1905
1961
|
});
|
|
1906
|
-
state.goodsListState.selectedGoodIndex = [];
|
|
1907
|
-
_context.next = 43;
|
|
1908
|
-
break;
|
|
1909
1962
|
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1963
|
+
if (!(goodsList.length < 2)) {
|
|
1964
|
+
_context2.next = 8;
|
|
1965
|
+
break;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
return _context2.abrupt("return");
|
|
1914
1969
|
|
|
1915
|
-
case
|
|
1970
|
+
case 8:
|
|
1971
|
+
grouping(goodsList).forEach(merge);
|
|
1972
|
+
/** 分组 */
|
|
1973
|
+
|
|
1974
|
+
case 9:
|
|
1916
1975
|
case "end":
|
|
1917
|
-
return
|
|
1976
|
+
return _context2.stop();
|
|
1918
1977
|
}
|
|
1919
1978
|
}
|
|
1920
|
-
},
|
|
1979
|
+
}, _callee2);
|
|
1921
1980
|
}));
|
|
1922
1981
|
return _mergeDetails.apply(this, arguments);
|
|
1923
1982
|
}
|
|
@@ -1929,29 +1988,29 @@ function calculatePriceIncludeTax(_x3, _x4) {
|
|
|
1929
1988
|
|
|
1930
1989
|
|
|
1931
1990
|
function _calculatePriceIncludeTax() {
|
|
1932
|
-
_calculatePriceIncludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1991
|
+
_calculatePriceIncludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sum, calculatingDigits) {
|
|
1933
1992
|
var value;
|
|
1934
|
-
return _regeneratorRuntime().wrap(function
|
|
1993
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1935
1994
|
while (1) {
|
|
1936
|
-
switch (
|
|
1995
|
+
switch (_context3.prev = _context3.next) {
|
|
1937
1996
|
case 0:
|
|
1938
1997
|
if (sum.quantity) {
|
|
1939
|
-
|
|
1998
|
+
_context3.next = 2;
|
|
1940
1999
|
break;
|
|
1941
2000
|
}
|
|
1942
2001
|
|
|
1943
|
-
return
|
|
2002
|
+
return _context3.abrupt("return", undefined);
|
|
1944
2003
|
|
|
1945
2004
|
case 2:
|
|
1946
2005
|
value = chain$1(bignumber(sum.lineAmountIncludeTax)).divide(bignumber(sum.quantity)).done().toNumber();
|
|
1947
|
-
return
|
|
2006
|
+
return _context3.abrupt("return", format15(value, calculatingDigits) || undefined);
|
|
1948
2007
|
|
|
1949
2008
|
case 4:
|
|
1950
2009
|
case "end":
|
|
1951
|
-
return
|
|
2010
|
+
return _context3.stop();
|
|
1952
2011
|
}
|
|
1953
2012
|
}
|
|
1954
|
-
},
|
|
2013
|
+
}, _callee3);
|
|
1955
2014
|
}));
|
|
1956
2015
|
return _calculatePriceIncludeTax.apply(this, arguments);
|
|
1957
2016
|
}
|
|
@@ -1963,29 +2022,29 @@ function calculatePriceExcludeTax(_x5, _x6) {
|
|
|
1963
2022
|
|
|
1964
2023
|
|
|
1965
2024
|
function _calculatePriceExcludeTax() {
|
|
1966
|
-
_calculatePriceExcludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2025
|
+
_calculatePriceExcludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(sum, calculatingDigits) {
|
|
1967
2026
|
var value;
|
|
1968
|
-
return _regeneratorRuntime().wrap(function
|
|
2027
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1969
2028
|
while (1) {
|
|
1970
|
-
switch (
|
|
2029
|
+
switch (_context4.prev = _context4.next) {
|
|
1971
2030
|
case 0:
|
|
1972
2031
|
if (sum.quantity) {
|
|
1973
|
-
|
|
2032
|
+
_context4.next = 2;
|
|
1974
2033
|
break;
|
|
1975
2034
|
}
|
|
1976
2035
|
|
|
1977
|
-
return
|
|
2036
|
+
return _context4.abrupt("return", undefined);
|
|
1978
2037
|
|
|
1979
2038
|
case 2:
|
|
1980
2039
|
value = format15(chain$1(bignumber(sum.lineAmountExcludeTax)).divide(bignumber(sum.quantity)).done().toNumber());
|
|
1981
|
-
return
|
|
2040
|
+
return _context4.abrupt("return", format15(value, calculatingDigits) || undefined);
|
|
1982
2041
|
|
|
1983
2042
|
case 5:
|
|
1984
2043
|
case "end":
|
|
1985
|
-
return
|
|
2044
|
+
return _context4.stop();
|
|
1986
2045
|
}
|
|
1987
2046
|
}
|
|
1988
|
-
},
|
|
2047
|
+
}, _callee4);
|
|
1989
2048
|
}));
|
|
1990
2049
|
return _calculatePriceExcludeTax.apply(this, arguments);
|
|
1991
2050
|
}
|
|
@@ -1997,24 +2056,24 @@ function mergeLineAmountIncludeTax(_x7) {
|
|
|
1997
2056
|
|
|
1998
2057
|
|
|
1999
2058
|
function _mergeLineAmountIncludeTax() {
|
|
2000
|
-
_mergeLineAmountIncludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2059
|
+
_mergeLineAmountIncludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(goodsList) {
|
|
2001
2060
|
var sum;
|
|
2002
|
-
return _regeneratorRuntime().wrap(function
|
|
2061
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
2003
2062
|
while (1) {
|
|
2004
|
-
switch (
|
|
2063
|
+
switch (_context5.prev = _context5.next) {
|
|
2005
2064
|
case 0:
|
|
2006
2065
|
sum = chain$1(bignumber(0));
|
|
2007
2066
|
goodsList.forEach(function (e) {
|
|
2008
2067
|
sum = sum.add(bignumber(e.lineAmountIncludeTax || 0));
|
|
2009
2068
|
});
|
|
2010
|
-
return
|
|
2069
|
+
return _context5.abrupt("return", sum.done().toNumber());
|
|
2011
2070
|
|
|
2012
2071
|
case 3:
|
|
2013
2072
|
case "end":
|
|
2014
|
-
return
|
|
2073
|
+
return _context5.stop();
|
|
2015
2074
|
}
|
|
2016
2075
|
}
|
|
2017
|
-
},
|
|
2076
|
+
}, _callee5);
|
|
2018
2077
|
}));
|
|
2019
2078
|
return _mergeLineAmountIncludeTax.apply(this, arguments);
|
|
2020
2079
|
}
|
|
@@ -2026,24 +2085,24 @@ function mergeLineAmountExcludeTax(_x8) {
|
|
|
2026
2085
|
|
|
2027
2086
|
|
|
2028
2087
|
function _mergeLineAmountExcludeTax() {
|
|
2029
|
-
_mergeLineAmountExcludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2088
|
+
_mergeLineAmountExcludeTax = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(goodsList) {
|
|
2030
2089
|
var sum;
|
|
2031
|
-
return _regeneratorRuntime().wrap(function
|
|
2090
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
2032
2091
|
while (1) {
|
|
2033
|
-
switch (
|
|
2092
|
+
switch (_context6.prev = _context6.next) {
|
|
2034
2093
|
case 0:
|
|
2035
2094
|
sum = chain$1(bignumber(0));
|
|
2036
2095
|
goodsList.forEach(function (e) {
|
|
2037
2096
|
sum = sum.add(bignumber(e.lineAmountExcludeTax || 0));
|
|
2038
2097
|
});
|
|
2039
|
-
return
|
|
2098
|
+
return _context6.abrupt("return", sum.done().toNumber());
|
|
2040
2099
|
|
|
2041
2100
|
case 3:
|
|
2042
2101
|
case "end":
|
|
2043
|
-
return
|
|
2102
|
+
return _context6.stop();
|
|
2044
2103
|
}
|
|
2045
2104
|
}
|
|
2046
|
-
},
|
|
2105
|
+
}, _callee6);
|
|
2047
2106
|
}));
|
|
2048
2107
|
return _mergeLineAmountExcludeTax.apply(this, arguments);
|
|
2049
2108
|
}
|
|
@@ -2055,24 +2114,24 @@ function mergeQuantity(_x9) {
|
|
|
2055
2114
|
|
|
2056
2115
|
|
|
2057
2116
|
function _mergeQuantity() {
|
|
2058
|
-
_mergeQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2117
|
+
_mergeQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(goodsList) {
|
|
2059
2118
|
var sum;
|
|
2060
|
-
return _regeneratorRuntime().wrap(function
|
|
2119
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
2061
2120
|
while (1) {
|
|
2062
|
-
switch (
|
|
2121
|
+
switch (_context7.prev = _context7.next) {
|
|
2063
2122
|
case 0:
|
|
2064
2123
|
sum = chain$1(bignumber(0));
|
|
2065
2124
|
goodsList.forEach(function (e) {
|
|
2066
2125
|
sum = sum.add(bignumber(e.quantity || 0));
|
|
2067
2126
|
});
|
|
2068
|
-
return
|
|
2127
|
+
return _context7.abrupt("return", sum.done().toNumber() || undefined);
|
|
2069
2128
|
|
|
2070
2129
|
case 3:
|
|
2071
2130
|
case "end":
|
|
2072
|
-
return
|
|
2131
|
+
return _context7.stop();
|
|
2073
2132
|
}
|
|
2074
2133
|
}
|
|
2075
|
-
},
|
|
2134
|
+
}, _callee7);
|
|
2076
2135
|
}));
|
|
2077
2136
|
return _mergeQuantity.apply(this, arguments);
|
|
2078
2137
|
}
|
|
@@ -2084,26 +2143,26 @@ function fillingInformationGood(_x10, _x11) {
|
|
|
2084
2143
|
|
|
2085
2144
|
|
|
2086
2145
|
function _fillingInformationGood() {
|
|
2087
|
-
_fillingInformationGood = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2146
|
+
_fillingInformationGood = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(goodsList, sum) {
|
|
2088
2147
|
var goods;
|
|
2089
|
-
return _regeneratorRuntime().wrap(function
|
|
2148
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
2090
2149
|
while (1) {
|
|
2091
|
-
switch (
|
|
2150
|
+
switch (_context8.prev = _context8.next) {
|
|
2092
2151
|
case 0:
|
|
2093
2152
|
sum = _objectSpread2({}, sum);
|
|
2094
2153
|
goods = goodsList[findMaxIndex(goodsList.map(function (e) {
|
|
2095
2154
|
return e.lineAmountIncludeTax || 0;
|
|
2096
2155
|
}))];
|
|
2097
|
-
return
|
|
2098
|
-
lineAttribute:
|
|
2156
|
+
return _context8.abrupt("return", _objectSpread2(_objectSpread2({}, goods), {}, {
|
|
2157
|
+
lineAttribute: sum.lineAttribute
|
|
2099
2158
|
}));
|
|
2100
2159
|
|
|
2101
2160
|
case 3:
|
|
2102
2161
|
case "end":
|
|
2103
|
-
return
|
|
2162
|
+
return _context8.stop();
|
|
2104
2163
|
}
|
|
2105
2164
|
}
|
|
2106
|
-
},
|
|
2165
|
+
}, _callee8);
|
|
2107
2166
|
}));
|
|
2108
2167
|
return _fillingInformationGood.apply(this, arguments);
|
|
2109
2168
|
}
|
|
@@ -2115,23 +2174,23 @@ function checkTaxTate(_x12) {
|
|
|
2115
2174
|
|
|
2116
2175
|
|
|
2117
2176
|
function _checkTaxTate() {
|
|
2118
|
-
_checkTaxTate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2177
|
+
_checkTaxTate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(goodsList) {
|
|
2119
2178
|
var tax, i;
|
|
2120
|
-
return _regeneratorRuntime().wrap(function
|
|
2179
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
2121
2180
|
while (1) {
|
|
2122
|
-
switch (
|
|
2181
|
+
switch (_context9.prev = _context9.next) {
|
|
2123
2182
|
case 0:
|
|
2124
2183
|
tax = goodsList[0].taxRate;
|
|
2125
2184
|
i = 1;
|
|
2126
2185
|
|
|
2127
2186
|
case 2:
|
|
2128
2187
|
if (!(i < goodsList.length)) {
|
|
2129
|
-
|
|
2188
|
+
_context9.next = 8;
|
|
2130
2189
|
break;
|
|
2131
2190
|
}
|
|
2132
2191
|
|
|
2133
2192
|
if (!(tax !== goodsList[i].taxRate)) {
|
|
2134
|
-
|
|
2193
|
+
_context9.next = 5;
|
|
2135
2194
|
break;
|
|
2136
2195
|
}
|
|
2137
2196
|
|
|
@@ -2139,15 +2198,15 @@ function _checkTaxTate() {
|
|
|
2139
2198
|
|
|
2140
2199
|
case 5:
|
|
2141
2200
|
i++;
|
|
2142
|
-
|
|
2201
|
+
_context9.next = 2;
|
|
2143
2202
|
break;
|
|
2144
2203
|
|
|
2145
2204
|
case 8:
|
|
2146
2205
|
case "end":
|
|
2147
|
-
return
|
|
2206
|
+
return _context9.stop();
|
|
2148
2207
|
}
|
|
2149
2208
|
}
|
|
2150
|
-
},
|
|
2209
|
+
}, _callee9);
|
|
2151
2210
|
}));
|
|
2152
2211
|
return _checkTaxTate.apply(this, arguments);
|
|
2153
2212
|
}
|
|
@@ -2159,23 +2218,23 @@ function checkSameNumber(_x13) {
|
|
|
2159
2218
|
|
|
2160
2219
|
|
|
2161
2220
|
function _checkSameNumber() {
|
|
2162
|
-
_checkSameNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2221
|
+
_checkSameNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(good) {
|
|
2163
2222
|
var content, _content;
|
|
2164
2223
|
|
|
2165
|
-
return _regeneratorRuntime().wrap(function
|
|
2224
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
2166
2225
|
while (1) {
|
|
2167
|
-
switch (
|
|
2226
|
+
switch (_context10.prev = _context10.next) {
|
|
2168
2227
|
case 0:
|
|
2169
2228
|
if (good.quantity) {
|
|
2170
|
-
|
|
2229
|
+
_context10.next = 2;
|
|
2171
2230
|
break;
|
|
2172
2231
|
}
|
|
2173
2232
|
|
|
2174
|
-
return
|
|
2233
|
+
return _context10.abrupt("return");
|
|
2175
2234
|
|
|
2176
2235
|
case 2:
|
|
2177
2236
|
if (!(!good.lineAmountExcludeTax && good.lineAmountExcludeTax !== 0)) {
|
|
2178
|
-
|
|
2237
|
+
_context10.next = 6;
|
|
2179
2238
|
break;
|
|
2180
2239
|
}
|
|
2181
2240
|
|
|
@@ -2188,11 +2247,11 @@ function _checkSameNumber() {
|
|
|
2188
2247
|
|
|
2189
2248
|
case 6:
|
|
2190
2249
|
if (!(good.quantity >= 0 && good.lineAmountExcludeTax >= 0 || good.lineAmountExcludeTax === 0 || good.quantity < 0 && good.lineAmountExcludeTax < 0)) {
|
|
2191
|
-
|
|
2250
|
+
_context10.next = 10;
|
|
2192
2251
|
break;
|
|
2193
2252
|
}
|
|
2194
2253
|
|
|
2195
|
-
return
|
|
2254
|
+
return _context10.abrupt("return");
|
|
2196
2255
|
|
|
2197
2256
|
case 10:
|
|
2198
2257
|
_content = '合并失败,合并后“数量”和“金额”必须同时为正数或同时为负数。';
|
|
@@ -2204,10 +2263,10 @@ function _checkSameNumber() {
|
|
|
2204
2263
|
|
|
2205
2264
|
case 13:
|
|
2206
2265
|
case "end":
|
|
2207
|
-
return
|
|
2266
|
+
return _context10.stop();
|
|
2208
2267
|
}
|
|
2209
2268
|
}
|
|
2210
|
-
},
|
|
2269
|
+
}, _callee10);
|
|
2211
2270
|
}));
|
|
2212
2271
|
return _checkSameNumber.apply(this, arguments);
|
|
2213
2272
|
}
|
|
@@ -17718,11 +17777,73 @@ function ItemNameInput$1(props) {
|
|
|
17718
17777
|
options = _React$useState2[0],
|
|
17719
17778
|
setOptions = _React$useState2[1];
|
|
17720
17779
|
|
|
17780
|
+
var _React$useState3 = React.useState(null),
|
|
17781
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
17782
|
+
selectLine = _React$useState4[0],
|
|
17783
|
+
setSelectLine = _React$useState4[1];
|
|
17784
|
+
|
|
17721
17785
|
var onChange = React.useCallback(function (e) {
|
|
17722
17786
|
var event = _objectSpread2({}, e);
|
|
17723
17787
|
|
|
17724
17788
|
props.onChange && props.onChange(event);
|
|
17725
17789
|
}, []);
|
|
17790
|
+
var onBlur = React.useCallback( /*#__PURE__*/function () {
|
|
17791
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(searchText) {
|
|
17792
|
+
var taxCategoryData, params;
|
|
17793
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
17794
|
+
while (1) {
|
|
17795
|
+
switch (_context.prev = _context.next) {
|
|
17796
|
+
case 0:
|
|
17797
|
+
_context.prev = 0;
|
|
17798
|
+
|
|
17799
|
+
if (!autoComplete.onItemNameBlur) {
|
|
17800
|
+
_context.next = 8;
|
|
17801
|
+
break;
|
|
17802
|
+
}
|
|
17803
|
+
|
|
17804
|
+
if (selectLine === null || selectLine === void 0 ? void 0 : selectLine.shorthand) {
|
|
17805
|
+
_context.next = 7;
|
|
17806
|
+
break;
|
|
17807
|
+
}
|
|
17808
|
+
|
|
17809
|
+
_context.next = 5;
|
|
17810
|
+
return autoComplete.onItemNameBlur(searchText);
|
|
17811
|
+
|
|
17812
|
+
case 5:
|
|
17813
|
+
taxCategoryData = _context.sent;
|
|
17814
|
+
|
|
17815
|
+
if (taxCategoryData && taxCategoryData[0]) {
|
|
17816
|
+
params = _objectSpread2(_objectSpread2({}, props.editGood), {}, {
|
|
17817
|
+
taxClassificationCode: taxCategoryData[0].taxCategoryCode,
|
|
17818
|
+
shorthand: taxCategoryData[0].shorthand
|
|
17819
|
+
});
|
|
17820
|
+
controller.importGoodsDrawer(params);
|
|
17821
|
+
}
|
|
17822
|
+
|
|
17823
|
+
case 7:
|
|
17824
|
+
setSelectLine(null);
|
|
17825
|
+
|
|
17826
|
+
case 8:
|
|
17827
|
+
_context.next = 13;
|
|
17828
|
+
break;
|
|
17829
|
+
|
|
17830
|
+
case 10:
|
|
17831
|
+
_context.prev = 10;
|
|
17832
|
+
_context.t0 = _context["catch"](0);
|
|
17833
|
+
throw _context.t0;
|
|
17834
|
+
|
|
17835
|
+
case 13:
|
|
17836
|
+
case "end":
|
|
17837
|
+
return _context.stop();
|
|
17838
|
+
}
|
|
17839
|
+
}
|
|
17840
|
+
}, _callee, null, [[0, 10]]);
|
|
17841
|
+
}));
|
|
17842
|
+
|
|
17843
|
+
return function (_x) {
|
|
17844
|
+
return _ref.apply(this, arguments);
|
|
17845
|
+
};
|
|
17846
|
+
}(), [autoComplete.onItemNameBlur, selectLine, props.editGood]);
|
|
17726
17847
|
var onChangeAutoComplete = React.useCallback(function (itemName) {
|
|
17727
17848
|
var record = options.filter(function (e) {
|
|
17728
17849
|
return e.itemName === itemName;
|
|
@@ -17731,49 +17852,49 @@ function ItemNameInput$1(props) {
|
|
|
17731
17852
|
controller.importGoodsDrawer(record);
|
|
17732
17853
|
}, [options, controller]);
|
|
17733
17854
|
var onSearch = React.useCallback( /*#__PURE__*/function () {
|
|
17734
|
-
var
|
|
17855
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(searchText) {
|
|
17735
17856
|
var list;
|
|
17736
|
-
return _regeneratorRuntime().wrap(function
|
|
17857
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
17737
17858
|
while (1) {
|
|
17738
|
-
switch (
|
|
17859
|
+
switch (_context2.prev = _context2.next) {
|
|
17739
17860
|
case 0:
|
|
17740
|
-
|
|
17861
|
+
_context2.prev = 0;
|
|
17741
17862
|
|
|
17742
17863
|
if (!autoComplete.onItemNameSearch) {
|
|
17743
|
-
|
|
17864
|
+
_context2.next = 9;
|
|
17744
17865
|
break;
|
|
17745
17866
|
}
|
|
17746
17867
|
|
|
17747
|
-
|
|
17748
|
-
|
|
17868
|
+
_context2.t0 = _toConsumableArray;
|
|
17869
|
+
_context2.next = 5;
|
|
17749
17870
|
return autoComplete.onItemNameSearch(searchText);
|
|
17750
17871
|
|
|
17751
17872
|
case 5:
|
|
17752
|
-
|
|
17753
|
-
list = (0,
|
|
17873
|
+
_context2.t1 = _context2.sent;
|
|
17874
|
+
list = (0, _context2.t0)(_context2.t1);
|
|
17754
17875
|
console.log('===> list', list);
|
|
17755
17876
|
setOptions(list);
|
|
17756
17877
|
|
|
17757
17878
|
case 9:
|
|
17758
|
-
|
|
17879
|
+
_context2.next = 15;
|
|
17759
17880
|
break;
|
|
17760
17881
|
|
|
17761
17882
|
case 11:
|
|
17762
|
-
|
|
17763
|
-
|
|
17883
|
+
_context2.prev = 11;
|
|
17884
|
+
_context2.t2 = _context2["catch"](0);
|
|
17764
17885
|
setOptions([]);
|
|
17765
|
-
throw
|
|
17886
|
+
throw _context2.t2;
|
|
17766
17887
|
|
|
17767
17888
|
case 15:
|
|
17768
17889
|
case "end":
|
|
17769
|
-
return
|
|
17890
|
+
return _context2.stop();
|
|
17770
17891
|
}
|
|
17771
17892
|
}
|
|
17772
|
-
},
|
|
17893
|
+
}, _callee2, null, [[0, 11]]);
|
|
17773
17894
|
}));
|
|
17774
17895
|
|
|
17775
|
-
return function (
|
|
17776
|
-
return
|
|
17896
|
+
return function (_x2) {
|
|
17897
|
+
return _ref2.apply(this, arguments);
|
|
17777
17898
|
};
|
|
17778
17899
|
}(), [autoComplete.onItemNameSearch]);
|
|
17779
17900
|
console.log('===> options', options);
|
|
@@ -17798,7 +17919,8 @@ function ItemNameInput$1(props) {
|
|
|
17798
17919
|
height: '100%'
|
|
17799
17920
|
},
|
|
17800
17921
|
onChange: onChange,
|
|
17801
|
-
suffix: props.suffix
|
|
17922
|
+
suffix: props.suffix,
|
|
17923
|
+
onBlur: onBlur
|
|
17802
17924
|
})));
|
|
17803
17925
|
}
|
|
17804
17926
|
|
|
@@ -19389,6 +19511,7 @@ var useColumns$1 = (function (form) {
|
|
|
19389
19511
|
}()
|
|
19390
19512
|
}])
|
|
19391
19513
|
})(React.createElement(ItemNameInput$1, {
|
|
19514
|
+
editGood: editGood,
|
|
19392
19515
|
shorthand: editGood.shorthand,
|
|
19393
19516
|
suffix: React.createElement(Tooltip$1, {
|
|
19394
19517
|
title: "\u70B9\u51FB\u4ECE\u5546\u54C1\u7BA1\u7406\u4E2D\u6DFB\u52A0\u5546\u54C1\u4FE1\u606F"
|