kts-component-invoice-operate 3.2.28 → 3.2.29

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
@@ -10499,57 +10499,89 @@ function ItemNameInput(props) {
10499
10499
  return _ref.apply(this, arguments);
10500
10500
  };
10501
10501
  }(), [autoComplete.onItemNameSearch]);
10502
- var onChangeAutoComplete = React.useCallback(function (itemName) {
10503
- // const good = options.filter(e=>e.itemName === itemName)[0];
10504
- // good && controller.state.goodsListState.form?.setFieldsValue(removeNullUndefined(good));
10505
- var record = options.filter(function (e) {
10506
- return e.itemName === itemName;
10507
- })[0];
10508
- if (!record) return;
10509
- controller.importGoodsDrawer(record); // controller.run(async s => {
10510
- // Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
10511
- // // 没用 被编辑的货物 form 就退出
10512
- // if (!s.goodsListState.editGood || !s.goodsListState.form) return;
10513
- // // 导入时清空之前输入的值,使用导入的单价和税率(参考税局系统)
10514
- // record.quantity = undefined;
10515
- // record.lineAmountExcludeTax = undefined;
10516
- // record.lineAmountIncludeTax = undefined;
10517
- // // 中间数据
10518
- // const between = { ...record };
10519
- // between.itemName = record.itemName;
10520
- // between.itemNameOther = record.itemName;
10521
- // // 设置编辑货物
10522
- // const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
10523
- // if (editGood.taxRate) {
10524
- // editGood.taxRate = dutyFree(controller, editGood.taxRate, s.goodsListState.form, editGood)
10525
- // }
10526
- // if (`${editGood.priceIncludeTax}` === '0') {
10527
- // editGood.priceIncludeTax = undefined;
10528
- // editGood.priceExcludeTax = undefined;
10529
- // } else {
10530
- // editGood.priceExcludeTax = getPriceExcludeTax(editGood, record, s.calculatingDigits) as number;
10531
- // }
10532
- // if (editGood.quantity && editGood.priceIncludeTax) {
10533
- // editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax, s.calculatingDigits);
10534
- // }
10535
- // // 导入FORM里
10536
- // if (s.goodsListState.isMyShow) {
10537
- // s.goodsListState.form.setFieldsValue({
10538
- // ...editGood,
10539
- // itemName: editGood.itemNameSelf,
10540
- // itemModelName: editGood.itemModelNameSelf,
10541
- // });
10542
- // } else {
10543
- // s.goodsListState.form.setFieldsValue({
10544
- // ...editGood,
10545
- // });
10546
- // }
10547
- // s.goodsListState.importGoods.isVisibleDrawer = false;
10548
- // s.goodsListState.isTaxIncluded
10549
- // ? await updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
10550
- // : await updateUnitPriceTax(controller, s.goodsListState.form, record)
10551
- // })
10552
- }, [options, controller]);
10502
+ var onChangeAutoComplete = React.useCallback( /*#__PURE__*/function () {
10503
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(itemName) {
10504
+ var record;
10505
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10506
+ while (1) {
10507
+ switch (_context2.prev = _context2.next) {
10508
+ case 0:
10509
+ // const good = options.filter(e=>e.itemName === itemName)[0];
10510
+ // good && controller.state.goodsListState.form?.setFieldsValue(removeNullUndefined(good));
10511
+ record = options.filter(function (e) {
10512
+ return e.itemName === itemName;
10513
+ })[0];
10514
+
10515
+ if (record) {
10516
+ _context2.next = 3;
10517
+ break;
10518
+ }
10519
+
10520
+ return _context2.abrupt("return");
10521
+
10522
+ case 3:
10523
+ _context2.next = 5;
10524
+ return controller.setEditGood({
10525
+ itemName: record.itemName
10526
+ });
10527
+
10528
+ case 5:
10529
+ controller.importGoodsDrawer(record); // controller.run(async s => {
10530
+ // Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
10531
+ // // 没用 被编辑的货物 和 form 就退出
10532
+ // if (!s.goodsListState.editGood || !s.goodsListState.form) return;
10533
+ // // 导入时清空之前输入的值,使用导入的单价和税率(参考税局系统)
10534
+ // record.quantity = undefined;
10535
+ // record.lineAmountExcludeTax = undefined;
10536
+ // record.lineAmountIncludeTax = undefined;
10537
+ // // 中间数据
10538
+ // const between = { ...record };
10539
+ // between.itemName = record.itemName;
10540
+ // between.itemNameOther = record.itemName;
10541
+ // // 设置编辑货物
10542
+ // const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
10543
+ // if (editGood.taxRate) {
10544
+ // editGood.taxRate = dutyFree(controller, editGood.taxRate, s.goodsListState.form, editGood)
10545
+ // }
10546
+ // if (`${editGood.priceIncludeTax}` === '0') {
10547
+ // editGood.priceIncludeTax = undefined;
10548
+ // editGood.priceExcludeTax = undefined;
10549
+ // } else {
10550
+ // editGood.priceExcludeTax = getPriceExcludeTax(editGood, record, s.calculatingDigits) as number;
10551
+ // }
10552
+ // if (editGood.quantity && editGood.priceIncludeTax) {
10553
+ // editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax, s.calculatingDigits);
10554
+ // }
10555
+ // // 导入FORM里
10556
+ // if (s.goodsListState.isMyShow) {
10557
+ // s.goodsListState.form.setFieldsValue({
10558
+ // ...editGood,
10559
+ // itemName: editGood.itemNameSelf,
10560
+ // itemModelName: editGood.itemModelNameSelf,
10561
+ // });
10562
+ // } else {
10563
+ // s.goodsListState.form.setFieldsValue({
10564
+ // ...editGood,
10565
+ // });
10566
+ // }
10567
+ // s.goodsListState.importGoods.isVisibleDrawer = false;
10568
+ // s.goodsListState.isTaxIncluded
10569
+ // ? await updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
10570
+ // : await updateUnitPriceTax(controller, s.goodsListState.form, record)
10571
+ // })
10572
+
10573
+ case 6:
10574
+ case "end":
10575
+ return _context2.stop();
10576
+ }
10577
+ }
10578
+ }, _callee2);
10579
+ }));
10580
+
10581
+ return function (_x2) {
10582
+ return _ref2.apply(this, arguments);
10583
+ };
10584
+ }(), [options, controller]);
10553
10585
  return React.createElement("div", {
10554
10586
  className: 'kts-invoice-operate-goods-list-itemName-input'
10555
10587
  }, props.shorthand && React.createElement("span", {
@@ -10652,12 +10684,42 @@ function ItemCodeInput(props) {
10652
10684
  return _ref.apply(this, arguments);
10653
10685
  };
10654
10686
  }(), [autoComplete.onItemCodeSearch]);
10655
- var onChangeAutoComplete = React.useCallback(function (itemName) {
10656
- var record = options.filter(function (e) {
10657
- return e.itemCode === itemName;
10658
- })[0];
10659
- if (!record) return;
10660
- }, [options, controller]);
10687
+ var onChangeAutoComplete = React.useCallback( /*#__PURE__*/function () {
10688
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(itemName) {
10689
+ var record;
10690
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10691
+ while (1) {
10692
+ switch (_context2.prev = _context2.next) {
10693
+ case 0:
10694
+ record = options.filter(function (e) {
10695
+ return e.itemCode === itemName;
10696
+ })[0];
10697
+
10698
+ if (record) {
10699
+ _context2.next = 3;
10700
+ break;
10701
+ }
10702
+
10703
+ return _context2.abrupt("return");
10704
+
10705
+ case 3:
10706
+ _context2.next = 5;
10707
+ return controller.setEditGood({
10708
+ itemCode: record.itemCode
10709
+ });
10710
+
10711
+ case 5:
10712
+ case "end":
10713
+ return _context2.stop();
10714
+ }
10715
+ }
10716
+ }, _callee2);
10717
+ }));
10718
+
10719
+ return function (_x2) {
10720
+ return _ref2.apply(this, arguments);
10721
+ };
10722
+ }(), [options, controller]);
10661
10723
  return React.createElement("div", {
10662
10724
  className: 'kts-invoice-operate-goods-list-itemCode-input'
10663
10725
  }, props.shorthand && React.createElement("span", {
package/dist/index.js CHANGED
@@ -10509,57 +10509,89 @@ function ItemNameInput(props) {
10509
10509
  return _ref.apply(this, arguments);
10510
10510
  };
10511
10511
  }(), [autoComplete.onItemNameSearch]);
10512
- var onChangeAutoComplete = React__default['default'].useCallback(function (itemName) {
10513
- // const good = options.filter(e=>e.itemName === itemName)[0];
10514
- // good && controller.state.goodsListState.form?.setFieldsValue(removeNullUndefined(good));
10515
- var record = options.filter(function (e) {
10516
- return e.itemName === itemName;
10517
- })[0];
10518
- if (!record) return;
10519
- controller.importGoodsDrawer(record); // controller.run(async s => {
10520
- // Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
10521
- // // 没用 被编辑的货物 form 就退出
10522
- // if (!s.goodsListState.editGood || !s.goodsListState.form) return;
10523
- // // 导入时清空之前输入的值,使用导入的单价和税率(参考税局系统)
10524
- // record.quantity = undefined;
10525
- // record.lineAmountExcludeTax = undefined;
10526
- // record.lineAmountIncludeTax = undefined;
10527
- // // 中间数据
10528
- // const between = { ...record };
10529
- // between.itemName = record.itemName;
10530
- // between.itemNameOther = record.itemName;
10531
- // // 设置编辑货物
10532
- // const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
10533
- // if (editGood.taxRate) {
10534
- // editGood.taxRate = dutyFree(controller, editGood.taxRate, s.goodsListState.form, editGood)
10535
- // }
10536
- // if (`${editGood.priceIncludeTax}` === '0') {
10537
- // editGood.priceIncludeTax = undefined;
10538
- // editGood.priceExcludeTax = undefined;
10539
- // } else {
10540
- // editGood.priceExcludeTax = getPriceExcludeTax(editGood, record, s.calculatingDigits) as number;
10541
- // }
10542
- // if (editGood.quantity && editGood.priceIncludeTax) {
10543
- // editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax, s.calculatingDigits);
10544
- // }
10545
- // // 导入FORM里
10546
- // if (s.goodsListState.isMyShow) {
10547
- // s.goodsListState.form.setFieldsValue({
10548
- // ...editGood,
10549
- // itemName: editGood.itemNameSelf,
10550
- // itemModelName: editGood.itemModelNameSelf,
10551
- // });
10552
- // } else {
10553
- // s.goodsListState.form.setFieldsValue({
10554
- // ...editGood,
10555
- // });
10556
- // }
10557
- // s.goodsListState.importGoods.isVisibleDrawer = false;
10558
- // s.goodsListState.isTaxIncluded
10559
- // ? await updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
10560
- // : await updateUnitPriceTax(controller, s.goodsListState.form, record)
10561
- // })
10562
- }, [options, controller]);
10512
+ var onChangeAutoComplete = React__default['default'].useCallback( /*#__PURE__*/function () {
10513
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(itemName) {
10514
+ var record;
10515
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10516
+ while (1) {
10517
+ switch (_context2.prev = _context2.next) {
10518
+ case 0:
10519
+ // const good = options.filter(e=>e.itemName === itemName)[0];
10520
+ // good && controller.state.goodsListState.form?.setFieldsValue(removeNullUndefined(good));
10521
+ record = options.filter(function (e) {
10522
+ return e.itemName === itemName;
10523
+ })[0];
10524
+
10525
+ if (record) {
10526
+ _context2.next = 3;
10527
+ break;
10528
+ }
10529
+
10530
+ return _context2.abrupt("return");
10531
+
10532
+ case 3:
10533
+ _context2.next = 5;
10534
+ return controller.setEditGood({
10535
+ itemName: record.itemName
10536
+ });
10537
+
10538
+ case 5:
10539
+ controller.importGoodsDrawer(record); // controller.run(async s => {
10540
+ // Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
10541
+ // // 没用 被编辑的货物 和 form 就退出
10542
+ // if (!s.goodsListState.editGood || !s.goodsListState.form) return;
10543
+ // // 导入时清空之前输入的值,使用导入的单价和税率(参考税局系统)
10544
+ // record.quantity = undefined;
10545
+ // record.lineAmountExcludeTax = undefined;
10546
+ // record.lineAmountIncludeTax = undefined;
10547
+ // // 中间数据
10548
+ // const between = { ...record };
10549
+ // between.itemName = record.itemName;
10550
+ // between.itemNameOther = record.itemName;
10551
+ // // 设置编辑货物
10552
+ // const editGood: IGood = s.goodsListState.editGood = { ...s.goodsListState.editGood, ...between };
10553
+ // if (editGood.taxRate) {
10554
+ // editGood.taxRate = dutyFree(controller, editGood.taxRate, s.goodsListState.form, editGood)
10555
+ // }
10556
+ // if (`${editGood.priceIncludeTax}` === '0') {
10557
+ // editGood.priceIncludeTax = undefined;
10558
+ // editGood.priceExcludeTax = undefined;
10559
+ // } else {
10560
+ // editGood.priceExcludeTax = getPriceExcludeTax(editGood, record, s.calculatingDigits) as number;
10561
+ // }
10562
+ // if (editGood.quantity && editGood.priceIncludeTax) {
10563
+ // editGood.lineAmountIncludeTax = countAmountIncludeTax(editGood.quantity, editGood.priceIncludeTax, s.calculatingDigits);
10564
+ // }
10565
+ // // 导入FORM里
10566
+ // if (s.goodsListState.isMyShow) {
10567
+ // s.goodsListState.form.setFieldsValue({
10568
+ // ...editGood,
10569
+ // itemName: editGood.itemNameSelf,
10570
+ // itemModelName: editGood.itemModelNameSelf,
10571
+ // });
10572
+ // } else {
10573
+ // s.goodsListState.form.setFieldsValue({
10574
+ // ...editGood,
10575
+ // });
10576
+ // }
10577
+ // s.goodsListState.importGoods.isVisibleDrawer = false;
10578
+ // s.goodsListState.isTaxIncluded
10579
+ // ? await updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
10580
+ // : await updateUnitPriceTax(controller, s.goodsListState.form, record)
10581
+ // })
10582
+
10583
+ case 6:
10584
+ case "end":
10585
+ return _context2.stop();
10586
+ }
10587
+ }
10588
+ }, _callee2);
10589
+ }));
10590
+
10591
+ return function (_x2) {
10592
+ return _ref2.apply(this, arguments);
10593
+ };
10594
+ }(), [options, controller]);
10563
10595
  return React__default['default'].createElement("div", {
10564
10596
  className: 'kts-invoice-operate-goods-list-itemName-input'
10565
10597
  }, props.shorthand && React__default['default'].createElement("span", {
@@ -10662,12 +10694,42 @@ function ItemCodeInput(props) {
10662
10694
  return _ref.apply(this, arguments);
10663
10695
  };
10664
10696
  }(), [autoComplete.onItemCodeSearch]);
10665
- var onChangeAutoComplete = React__default['default'].useCallback(function (itemName) {
10666
- var record = options.filter(function (e) {
10667
- return e.itemCode === itemName;
10668
- })[0];
10669
- if (!record) return;
10670
- }, [options, controller]);
10697
+ var onChangeAutoComplete = React__default['default'].useCallback( /*#__PURE__*/function () {
10698
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(itemName) {
10699
+ var record;
10700
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10701
+ while (1) {
10702
+ switch (_context2.prev = _context2.next) {
10703
+ case 0:
10704
+ record = options.filter(function (e) {
10705
+ return e.itemCode === itemName;
10706
+ })[0];
10707
+
10708
+ if (record) {
10709
+ _context2.next = 3;
10710
+ break;
10711
+ }
10712
+
10713
+ return _context2.abrupt("return");
10714
+
10715
+ case 3:
10716
+ _context2.next = 5;
10717
+ return controller.setEditGood({
10718
+ itemCode: record.itemCode
10719
+ });
10720
+
10721
+ case 5:
10722
+ case "end":
10723
+ return _context2.stop();
10724
+ }
10725
+ }
10726
+ }, _callee2);
10727
+ }));
10728
+
10729
+ return function (_x2) {
10730
+ return _ref2.apply(this, arguments);
10731
+ };
10732
+ }(), [options, controller]);
10671
10733
  return React__default['default'].createElement("div", {
10672
10734
  className: 'kts-invoice-operate-goods-list-itemCode-input'
10673
10735
  }, props.shorthand && React__default['default'].createElement("span", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.28",
3
+ "version": "3.2.29",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -29,9 +29,10 @@ export default function ItemCodeInput(props: { onChange?: (e: ChangeEvent<HTMLIn
29
29
  }
30
30
  }, [autoComplete.onItemCodeSearch])
31
31
 
32
- const onChangeAutoComplete = React.useCallback(itemName => {
32
+ const onChangeAutoComplete = React.useCallback(async itemName => {
33
33
  const record = options.filter(e => e.itemCode === itemName)[0] as any;
34
34
  if (!record) return;
35
+ await controller.setEditGood({ itemCode: record.itemCode });
35
36
  }, [options, controller])
36
37
 
37
38
  return (
@@ -32,12 +32,15 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
32
32
  }
33
33
  }, [autoComplete.onItemNameSearch])
34
34
 
35
- const onChangeAutoComplete = React.useCallback(itemName => {
35
+ const onChangeAutoComplete = React.useCallback(async itemName => {
36
36
  // const good = options.filter(e=>e.itemName === itemName)[0];
37
37
  // good && controller.state.goodsListState.form?.setFieldsValue(removeNullUndefined(good));
38
38
 
39
39
  const record = options.filter(e => e.itemName === itemName)[0] as any;
40
40
  if (!record) return;
41
+
42
+ await controller.setEditGood({ itemName: record.itemName });
43
+
41
44
  controller.importGoodsDrawer(record);
42
45
  // controller.run(async s => {
43
46
  // Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
@@ -122,4 +125,4 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
122
125
 
123
126
  // // 单价(含税)/(1+税率) = 单价(不含税)
124
127
  // return format15(evaluate(`${record.priceIncludeTax} / (1+${s.taxRate}/100)`), calculatingDigits);
125
- // };
128
+ // };