kts-component-invoice-operate 3.2.76 → 3.2.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js
CHANGED
|
@@ -14577,7 +14577,7 @@ function useMergeDetails() {
|
|
|
14577
14577
|
}, _callee);
|
|
14578
14578
|
})), [controller]);
|
|
14579
14579
|
var onClickAuto = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
14580
|
-
var group, i, _selectedGoodIndex;
|
|
14580
|
+
var goodsList, isTaxIncluded, group, i, _selectedGoodIndex;
|
|
14581
14581
|
|
|
14582
14582
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
14583
14583
|
while (1) {
|
|
@@ -14591,27 +14591,29 @@ function useMergeDetails() {
|
|
|
14591
14591
|
return controller.wait();
|
|
14592
14592
|
|
|
14593
14593
|
case 4:
|
|
14594
|
-
|
|
14594
|
+
goodsList = controller.state.goodsListState.goodsList;
|
|
14595
|
+
isTaxIncluded = controller.state.goodsListState.isTaxIncluded;
|
|
14596
|
+
group = groupBy(goodsList, isTaxIncluded);
|
|
14595
14597
|
i = 0;
|
|
14596
14598
|
|
|
14597
|
-
case
|
|
14599
|
+
case 8:
|
|
14598
14600
|
if (!(i < group.length)) {
|
|
14599
|
-
_context2.next =
|
|
14601
|
+
_context2.next = 15;
|
|
14600
14602
|
break;
|
|
14601
14603
|
}
|
|
14602
14604
|
|
|
14603
14605
|
_selectedGoodIndex = group[i].map(function (e) {
|
|
14604
14606
|
return e.$index;
|
|
14605
14607
|
});
|
|
14606
|
-
_context2.next =
|
|
14608
|
+
_context2.next = 12;
|
|
14607
14609
|
return controller.mergeDetails(_selectedGoodIndex);
|
|
14608
14610
|
|
|
14609
|
-
case
|
|
14611
|
+
case 12:
|
|
14610
14612
|
i++;
|
|
14611
|
-
_context2.next =
|
|
14613
|
+
_context2.next = 8;
|
|
14612
14614
|
break;
|
|
14613
14615
|
|
|
14614
|
-
case
|
|
14616
|
+
case 15:
|
|
14615
14617
|
case "end":
|
|
14616
14618
|
return _context2.stop();
|
|
14617
14619
|
}
|
|
@@ -14645,20 +14647,26 @@ function useMergeDetails() {
|
|
|
14645
14647
|
};
|
|
14646
14648
|
} // 根据"商品编码"" 和 "单价" 分组
|
|
14647
14649
|
|
|
14648
|
-
function groupBy(arr) {
|
|
14649
|
-
var grouped = {};
|
|
14650
|
-
// if (!item.itemCode) continue;
|
|
14651
|
-
// const key = `${item.itemCode}${item.priceIncludeTax}${item.priceExcludeTax}`;
|
|
14652
|
-
// if (!grouped[key]) {
|
|
14653
|
-
// grouped[key] = [];
|
|
14654
|
-
// }
|
|
14655
|
-
// grouped[key].push(item);
|
|
14656
|
-
// }
|
|
14650
|
+
function groupBy(arr, isTaxIncluded) {
|
|
14651
|
+
var grouped = {};
|
|
14657
14652
|
|
|
14658
|
-
|
|
14659
|
-
var item = arr[
|
|
14660
|
-
|
|
14661
|
-
|
|
14653
|
+
var _loop = function _loop(_i) {
|
|
14654
|
+
var item = arr[_i];
|
|
14655
|
+
|
|
14656
|
+
if (!item.itemCode) {
|
|
14657
|
+
i = _i;
|
|
14658
|
+
return "continue";
|
|
14659
|
+
}
|
|
14660
|
+
|
|
14661
|
+
var key = function () {
|
|
14662
|
+
if (isTaxIncluded) {
|
|
14663
|
+
i = _i;
|
|
14664
|
+
return "".concat(item.itemCode).concat(Math.floor((item.priceIncludeTax || 0) * 100) / 100);
|
|
14665
|
+
} else {
|
|
14666
|
+
i = _i;
|
|
14667
|
+
return "".concat(item.itemCode).concat(Math.floor((item.priceExcludeTax || 0) * 100) / 100);
|
|
14668
|
+
}
|
|
14669
|
+
}();
|
|
14662
14670
|
|
|
14663
14671
|
if (!grouped[key]) {
|
|
14664
14672
|
grouped[key] = [];
|
|
@@ -14667,9 +14675,17 @@ function groupBy(arr) {
|
|
|
14667
14675
|
grouped[key].push(item);
|
|
14668
14676
|
|
|
14669
14677
|
if (item.lineAttribute === LineAttributeType$1.被折扣行) {
|
|
14670
|
-
grouped[key].push(arr[
|
|
14671
|
-
|
|
14678
|
+
grouped[key].push(arr[_i + 1]);
|
|
14679
|
+
_i++;
|
|
14672
14680
|
}
|
|
14681
|
+
|
|
14682
|
+
i = _i;
|
|
14683
|
+
};
|
|
14684
|
+
|
|
14685
|
+
for (var i = 0; i < arr.length; i++) {
|
|
14686
|
+
var _ret = _loop(i);
|
|
14687
|
+
|
|
14688
|
+
if (_ret === "continue") continue;
|
|
14673
14689
|
}
|
|
14674
14690
|
|
|
14675
14691
|
return Object.values(grouped);
|
package/dist/index.js
CHANGED
|
@@ -14587,7 +14587,7 @@ function useMergeDetails() {
|
|
|
14587
14587
|
}, _callee);
|
|
14588
14588
|
})), [controller]);
|
|
14589
14589
|
var onClickAuto = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
14590
|
-
var group, i, _selectedGoodIndex;
|
|
14590
|
+
var goodsList, isTaxIncluded, group, i, _selectedGoodIndex;
|
|
14591
14591
|
|
|
14592
14592
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
14593
14593
|
while (1) {
|
|
@@ -14601,27 +14601,29 @@ function useMergeDetails() {
|
|
|
14601
14601
|
return controller.wait();
|
|
14602
14602
|
|
|
14603
14603
|
case 4:
|
|
14604
|
-
|
|
14604
|
+
goodsList = controller.state.goodsListState.goodsList;
|
|
14605
|
+
isTaxIncluded = controller.state.goodsListState.isTaxIncluded;
|
|
14606
|
+
group = groupBy(goodsList, isTaxIncluded);
|
|
14605
14607
|
i = 0;
|
|
14606
14608
|
|
|
14607
|
-
case
|
|
14609
|
+
case 8:
|
|
14608
14610
|
if (!(i < group.length)) {
|
|
14609
|
-
_context2.next =
|
|
14611
|
+
_context2.next = 15;
|
|
14610
14612
|
break;
|
|
14611
14613
|
}
|
|
14612
14614
|
|
|
14613
14615
|
_selectedGoodIndex = group[i].map(function (e) {
|
|
14614
14616
|
return e.$index;
|
|
14615
14617
|
});
|
|
14616
|
-
_context2.next =
|
|
14618
|
+
_context2.next = 12;
|
|
14617
14619
|
return controller.mergeDetails(_selectedGoodIndex);
|
|
14618
14620
|
|
|
14619
|
-
case
|
|
14621
|
+
case 12:
|
|
14620
14622
|
i++;
|
|
14621
|
-
_context2.next =
|
|
14623
|
+
_context2.next = 8;
|
|
14622
14624
|
break;
|
|
14623
14625
|
|
|
14624
|
-
case
|
|
14626
|
+
case 15:
|
|
14625
14627
|
case "end":
|
|
14626
14628
|
return _context2.stop();
|
|
14627
14629
|
}
|
|
@@ -14655,20 +14657,26 @@ function useMergeDetails() {
|
|
|
14655
14657
|
};
|
|
14656
14658
|
} // 根据"商品编码"" 和 "单价" 分组
|
|
14657
14659
|
|
|
14658
|
-
function groupBy(arr) {
|
|
14659
|
-
var grouped = {};
|
|
14660
|
-
// if (!item.itemCode) continue;
|
|
14661
|
-
// const key = `${item.itemCode}${item.priceIncludeTax}${item.priceExcludeTax}`;
|
|
14662
|
-
// if (!grouped[key]) {
|
|
14663
|
-
// grouped[key] = [];
|
|
14664
|
-
// }
|
|
14665
|
-
// grouped[key].push(item);
|
|
14666
|
-
// }
|
|
14660
|
+
function groupBy(arr, isTaxIncluded) {
|
|
14661
|
+
var grouped = {};
|
|
14667
14662
|
|
|
14668
|
-
|
|
14669
|
-
var item = arr[
|
|
14670
|
-
|
|
14671
|
-
|
|
14663
|
+
var _loop = function _loop(_i) {
|
|
14664
|
+
var item = arr[_i];
|
|
14665
|
+
|
|
14666
|
+
if (!item.itemCode) {
|
|
14667
|
+
i = _i;
|
|
14668
|
+
return "continue";
|
|
14669
|
+
}
|
|
14670
|
+
|
|
14671
|
+
var key = function () {
|
|
14672
|
+
if (isTaxIncluded) {
|
|
14673
|
+
i = _i;
|
|
14674
|
+
return "".concat(item.itemCode).concat(Math.floor((item.priceIncludeTax || 0) * 100) / 100);
|
|
14675
|
+
} else {
|
|
14676
|
+
i = _i;
|
|
14677
|
+
return "".concat(item.itemCode).concat(Math.floor((item.priceExcludeTax || 0) * 100) / 100);
|
|
14678
|
+
}
|
|
14679
|
+
}();
|
|
14672
14680
|
|
|
14673
14681
|
if (!grouped[key]) {
|
|
14674
14682
|
grouped[key] = [];
|
|
@@ -14677,9 +14685,17 @@ function groupBy(arr) {
|
|
|
14677
14685
|
grouped[key].push(item);
|
|
14678
14686
|
|
|
14679
14687
|
if (item.lineAttribute === LineAttributeType$1.被折扣行) {
|
|
14680
|
-
grouped[key].push(arr[
|
|
14681
|
-
|
|
14688
|
+
grouped[key].push(arr[_i + 1]);
|
|
14689
|
+
_i++;
|
|
14682
14690
|
}
|
|
14691
|
+
|
|
14692
|
+
i = _i;
|
|
14693
|
+
};
|
|
14694
|
+
|
|
14695
|
+
for (var i = 0; i < arr.length; i++) {
|
|
14696
|
+
var _ret = _loop(i);
|
|
14697
|
+
|
|
14698
|
+
if (_ret === "continue") continue;
|
|
14683
14699
|
}
|
|
14684
14700
|
|
|
14685
14701
|
return Object.values(grouped);
|
package/package.json
CHANGED
|
@@ -23,7 +23,9 @@ export default function useMergeDetails() {
|
|
|
23
23
|
const onClickAuto = React.useCallback(async () => {
|
|
24
24
|
await controller.saveEditGood();
|
|
25
25
|
await controller.wait();
|
|
26
|
-
const
|
|
26
|
+
const goodsList = controller.state.goodsListState.goodsList;
|
|
27
|
+
const isTaxIncluded = controller.state.goodsListState.isTaxIncluded;
|
|
28
|
+
const group = groupBy(goodsList, isTaxIncluded);
|
|
27
29
|
for (let i = 0; i < group.length; i++) {
|
|
28
30
|
const selectedGoodIndex = group[i].map(e => e.$index);
|
|
29
31
|
await controller.mergeDetails(selectedGoodIndex);
|
|
@@ -63,23 +65,24 @@ export default function useMergeDetails() {
|
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
// 根据"商品编码"" 和 "单价" 分组
|
|
66
|
-
function groupBy(arr: IGood[]): IGood[][] {
|
|
68
|
+
function groupBy(arr: IGood[], isTaxIncluded: boolean): IGood[][] {
|
|
67
69
|
const grouped: any = {};
|
|
68
|
-
// for (const item of arr) {
|
|
69
|
-
// if (!item.itemCode) continue;
|
|
70
|
-
// const key = `${item.itemCode}${item.priceIncludeTax}${item.priceExcludeTax}`;
|
|
71
|
-
// if (!grouped[key]) {
|
|
72
|
-
// grouped[key] = [];
|
|
73
|
-
// }
|
|
74
|
-
// grouped[key].push(item);
|
|
75
|
-
// }
|
|
76
70
|
for (let i = 0; i < arr.length; i++) {
|
|
77
71
|
const item = arr[i];
|
|
78
72
|
if (!item.itemCode) continue;
|
|
79
|
-
|
|
73
|
+
|
|
74
|
+
const key = (() => {
|
|
75
|
+
if (isTaxIncluded) {
|
|
76
|
+
return `${item.itemCode}${Math.floor((item.priceIncludeTax || 0) * 100) / 100}`;
|
|
77
|
+
} else {
|
|
78
|
+
return `${item.itemCode}${Math.floor((item.priceExcludeTax || 0) * 100) / 100}`;
|
|
79
|
+
}
|
|
80
|
+
})()
|
|
81
|
+
|
|
80
82
|
if (!grouped[key]) {
|
|
81
83
|
grouped[key] = [];
|
|
82
84
|
}
|
|
85
|
+
|
|
83
86
|
grouped[key].push(item);
|
|
84
87
|
if (item.lineAttribute === LineAttributeType.被折扣行) {
|
|
85
88
|
grouped[key].push(arr[i + 1]); i++;
|