kts-component-invoice-operate 3.2.219 → 3.2.220

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.
@@ -54,4 +54,5 @@ export default class InvoiceControllerState {
54
54
  * 货物运输列表
55
55
  */
56
56
  freightListState: FreightListState;
57
+ addGoodsCheck?: any;
57
58
  }
package/dist/index.esm.js CHANGED
@@ -1267,6 +1267,7 @@ var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControlle
1267
1267
  this.autoComplete = new AutoComplete();
1268
1268
  this.taxClassificationProps = void 0;
1269
1269
  this.freightListState = new FreightListState();
1270
+ this.addGoodsCheck = void 0;
1270
1271
  });
1271
1272
 
1272
1273
  /**
@@ -10685,36 +10686,54 @@ var AddRowButton = (function (props) {
10685
10686
  var disabled = React.useMemo(function () {
10686
10687
  return typeof goodMax === 'number' ? goodsNum >= goodMax : !!searchValue;
10687
10688
  }, [goodMax, goodsNum, searchValue]);
10688
- var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
10689
- return _regeneratorRuntime().wrap(function _callee$(_context) {
10689
+ var onClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
10690
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10690
10691
  while (1) {
10691
- switch (_context.prev = _context.next) {
10692
+ switch (_context2.prev = _context2.next) {
10692
10693
  case 0:
10693
- _context.t0 = props.addGoodsCheck;
10694
+ _context2.next = 2;
10695
+ return controller.run( /*#__PURE__*/function () {
10696
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
10697
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
10698
+ while (1) {
10699
+ switch (_context.prev = _context.next) {
10700
+ case 0:
10701
+ if (!s.addGoodsCheck) {
10702
+ _context.next = 3;
10703
+ break;
10704
+ }
10694
10705
 
10695
- if (!_context.t0) {
10696
- _context.next = 4;
10697
- break;
10698
- }
10706
+ _context.next = 3;
10707
+ return s.addGoodsCheck();
10699
10708
 
10700
- _context.next = 4;
10701
- return props.addGoodsCheck();
10709
+ case 3:
10710
+ case "end":
10711
+ return _context.stop();
10712
+ }
10713
+ }
10714
+ }, _callee);
10715
+ }));
10702
10716
 
10703
- case 4:
10717
+ return function (_x) {
10718
+ return _ref2.apply(this, arguments);
10719
+ };
10720
+ }());
10721
+
10722
+ case 2:
10704
10723
  console.log('continue');
10705
- _context.next = 7;
10724
+ _context2.next = 5;
10706
10725
  return addGood$1(controller);
10707
10726
 
10708
- case 7:
10709
- _context.next = 9;
10727
+ case 5:
10728
+ _context2.next = 7;
10710
10729
  return rollBottom(controller, rootElement);
10711
10730
 
10712
- case 9:
10731
+ case 7:
10713
10732
  case "end":
10714
- return _context.stop();
10733
+ return _context2.stop();
10715
10734
  }
10716
10735
  }
10717
- }, _callee);
10736
+ }, _callee2);
10718
10737
  })), [controller, rootElement]);
10719
10738
  if (isAddRow === false) return /*#__PURE__*/React.createElement(React.Fragment, null);
10720
10739
  if (model === 'prefab') return /*#__PURE__*/React.createElement(React.Fragment, null);
@@ -10726,35 +10745,35 @@ var AddRowButton = (function (props) {
10726
10745
  });
10727
10746
  /** 添加一个空货物 */
10728
10747
 
10729
- function addGood$1(_x) {
10748
+ function addGood$1(_x2) {
10730
10749
  return _addGood.apply(this, arguments);
10731
10750
  }
10732
10751
  /** 货物列表,滚动到底部 */
10733
10752
 
10734
10753
 
10735
10754
  function _addGood() {
10736
- _addGood = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(controller) {
10737
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
10755
+ _addGood = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(controller) {
10756
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
10738
10757
  while (1) {
10739
- switch (_context3.prev = _context3.next) {
10758
+ switch (_context4.prev = _context4.next) {
10740
10759
  case 0:
10741
- _context3.next = 2;
10760
+ _context4.next = 2;
10742
10761
  return controller.saveEditGood();
10743
10762
 
10744
10763
  case 2:
10745
- _context3.next = 4;
10764
+ _context4.next = 4;
10746
10765
  return controller.wait();
10747
10766
 
10748
10767
  case 4:
10749
- _context3.next = 6;
10768
+ _context4.next = 6;
10750
10769
  return controller.run( /*#__PURE__*/function () {
10751
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
10752
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10770
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
10771
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
10753
10772
  while (1) {
10754
- switch (_context2.prev = _context2.next) {
10773
+ switch (_context3.prev = _context3.next) {
10755
10774
  case 0:
10756
10775
  if (!s.goodsListState.editGood) {
10757
- _context2.next = 3;
10776
+ _context3.next = 3;
10758
10777
  break;
10759
10778
  }
10760
10779
 
@@ -10762,74 +10781,74 @@ function _addGood() {
10762
10781
  content: '你正在编辑一个货物',
10763
10782
  key: '你正在编辑一个货物'
10764
10783
  });
10765
- return _context2.abrupt("return");
10784
+ return _context3.abrupt("return");
10766
10785
 
10767
10786
  case 3:
10768
- _context2.next = 5;
10787
+ _context3.next = 5;
10769
10788
  return controller.addGood({
10770
10789
  taxRate: s.goodsListState.defaultRate,
10771
10790
  lineAttribute: LineAttributeType$1.正常
10772
10791
  });
10773
10792
 
10774
10793
  case 5:
10775
- s.goodsListState.editGood = _context2.sent;
10794
+ s.goodsListState.editGood = _context3.sent;
10776
10795
 
10777
10796
  case 6:
10778
10797
  case "end":
10779
- return _context2.stop();
10798
+ return _context3.stop();
10780
10799
  }
10781
10800
  }
10782
- }, _callee2);
10801
+ }, _callee3);
10783
10802
  }));
10784
10803
 
10785
- return function (_x4) {
10786
- return _ref2.apply(this, arguments);
10804
+ return function (_x5) {
10805
+ return _ref3.apply(this, arguments);
10787
10806
  };
10788
10807
  }());
10789
10808
 
10790
10809
  case 6:
10791
10810
  case "end":
10792
- return _context3.stop();
10811
+ return _context4.stop();
10793
10812
  }
10794
10813
  }
10795
- }, _callee3);
10814
+ }, _callee4);
10796
10815
  }));
10797
10816
  return _addGood.apply(this, arguments);
10798
10817
  }
10799
10818
 
10800
- function rollBottom(_x2, _x3) {
10819
+ function rollBottom(_x3, _x4) {
10801
10820
  return _rollBottom.apply(this, arguments);
10802
10821
  }
10803
10822
 
10804
10823
  function _rollBottom() {
10805
- _rollBottom = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(controller, rootElement) {
10824
+ _rollBottom = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(controller, rootElement) {
10806
10825
  var cont;
10807
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
10826
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
10808
10827
  while (1) {
10809
- switch (_context4.prev = _context4.next) {
10828
+ switch (_context5.prev = _context5.next) {
10810
10829
  case 0:
10811
- _context4.next = 2;
10830
+ _context5.next = 2;
10812
10831
  return controller.wait();
10813
10832
 
10814
10833
  case 2:
10815
10834
  cont = rootElement === null || rootElement === void 0 ? void 0 : rootElement.querySelector('.ktsAntX-table-body');
10816
10835
 
10817
10836
  if (cont) {
10818
- _context4.next = 5;
10837
+ _context5.next = 5;
10819
10838
  break;
10820
10839
  }
10821
10840
 
10822
- return _context4.abrupt("return");
10841
+ return _context5.abrupt("return");
10823
10842
 
10824
10843
  case 5:
10825
10844
  cont.scrollTop = cont.scrollHeight;
10826
10845
 
10827
10846
  case 6:
10828
10847
  case "end":
10829
- return _context4.stop();
10848
+ return _context5.stop();
10830
10849
  }
10831
10850
  }
10832
- }, _callee4);
10851
+ }, _callee5);
10833
10852
  }));
10834
10853
  return _rollBottom.apply(this, arguments);
10835
10854
  }
package/dist/index.js CHANGED
@@ -1277,6 +1277,7 @@ var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControlle
1277
1277
  this.autoComplete = new AutoComplete();
1278
1278
  this.taxClassificationProps = void 0;
1279
1279
  this.freightListState = new FreightListState();
1280
+ this.addGoodsCheck = void 0;
1280
1281
  });
1281
1282
 
1282
1283
  /**
@@ -10695,36 +10696,54 @@ var AddRowButton = (function (props) {
10695
10696
  var disabled = React__default['default'].useMemo(function () {
10696
10697
  return typeof goodMax === 'number' ? goodsNum >= goodMax : !!searchValue;
10697
10698
  }, [goodMax, goodsNum, searchValue]);
10698
- var onClick = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
10699
- return _regeneratorRuntime().wrap(function _callee$(_context) {
10699
+ var onClick = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
10700
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10700
10701
  while (1) {
10701
- switch (_context.prev = _context.next) {
10702
+ switch (_context2.prev = _context2.next) {
10702
10703
  case 0:
10703
- _context.t0 = props.addGoodsCheck;
10704
+ _context2.next = 2;
10705
+ return controller.run( /*#__PURE__*/function () {
10706
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
10707
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
10708
+ while (1) {
10709
+ switch (_context.prev = _context.next) {
10710
+ case 0:
10711
+ if (!s.addGoodsCheck) {
10712
+ _context.next = 3;
10713
+ break;
10714
+ }
10704
10715
 
10705
- if (!_context.t0) {
10706
- _context.next = 4;
10707
- break;
10708
- }
10716
+ _context.next = 3;
10717
+ return s.addGoodsCheck();
10709
10718
 
10710
- _context.next = 4;
10711
- return props.addGoodsCheck();
10719
+ case 3:
10720
+ case "end":
10721
+ return _context.stop();
10722
+ }
10723
+ }
10724
+ }, _callee);
10725
+ }));
10712
10726
 
10713
- case 4:
10727
+ return function (_x) {
10728
+ return _ref2.apply(this, arguments);
10729
+ };
10730
+ }());
10731
+
10732
+ case 2:
10714
10733
  console.log('continue');
10715
- _context.next = 7;
10734
+ _context2.next = 5;
10716
10735
  return addGood$1(controller);
10717
10736
 
10718
- case 7:
10719
- _context.next = 9;
10737
+ case 5:
10738
+ _context2.next = 7;
10720
10739
  return rollBottom(controller, rootElement);
10721
10740
 
10722
- case 9:
10741
+ case 7:
10723
10742
  case "end":
10724
- return _context.stop();
10743
+ return _context2.stop();
10725
10744
  }
10726
10745
  }
10727
- }, _callee);
10746
+ }, _callee2);
10728
10747
  })), [controller, rootElement]);
10729
10748
  if (isAddRow === false) return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
10730
10749
  if (model === 'prefab') return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
@@ -10736,35 +10755,35 @@ var AddRowButton = (function (props) {
10736
10755
  });
10737
10756
  /** 添加一个空货物 */
10738
10757
 
10739
- function addGood$1(_x) {
10758
+ function addGood$1(_x2) {
10740
10759
  return _addGood.apply(this, arguments);
10741
10760
  }
10742
10761
  /** 货物列表,滚动到底部 */
10743
10762
 
10744
10763
 
10745
10764
  function _addGood() {
10746
- _addGood = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(controller) {
10747
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
10765
+ _addGood = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(controller) {
10766
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
10748
10767
  while (1) {
10749
- switch (_context3.prev = _context3.next) {
10768
+ switch (_context4.prev = _context4.next) {
10750
10769
  case 0:
10751
- _context3.next = 2;
10770
+ _context4.next = 2;
10752
10771
  return controller.saveEditGood();
10753
10772
 
10754
10773
  case 2:
10755
- _context3.next = 4;
10774
+ _context4.next = 4;
10756
10775
  return controller.wait();
10757
10776
 
10758
10777
  case 4:
10759
- _context3.next = 6;
10778
+ _context4.next = 6;
10760
10779
  return controller.run( /*#__PURE__*/function () {
10761
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
10762
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10780
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
10781
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
10763
10782
  while (1) {
10764
- switch (_context2.prev = _context2.next) {
10783
+ switch (_context3.prev = _context3.next) {
10765
10784
  case 0:
10766
10785
  if (!s.goodsListState.editGood) {
10767
- _context2.next = 3;
10786
+ _context3.next = 3;
10768
10787
  break;
10769
10788
  }
10770
10789
 
@@ -10772,74 +10791,74 @@ function _addGood() {
10772
10791
  content: '你正在编辑一个货物',
10773
10792
  key: '你正在编辑一个货物'
10774
10793
  });
10775
- return _context2.abrupt("return");
10794
+ return _context3.abrupt("return");
10776
10795
 
10777
10796
  case 3:
10778
- _context2.next = 5;
10797
+ _context3.next = 5;
10779
10798
  return controller.addGood({
10780
10799
  taxRate: s.goodsListState.defaultRate,
10781
10800
  lineAttribute: LineAttributeType$1.正常
10782
10801
  });
10783
10802
 
10784
10803
  case 5:
10785
- s.goodsListState.editGood = _context2.sent;
10804
+ s.goodsListState.editGood = _context3.sent;
10786
10805
 
10787
10806
  case 6:
10788
10807
  case "end":
10789
- return _context2.stop();
10808
+ return _context3.stop();
10790
10809
  }
10791
10810
  }
10792
- }, _callee2);
10811
+ }, _callee3);
10793
10812
  }));
10794
10813
 
10795
- return function (_x4) {
10796
- return _ref2.apply(this, arguments);
10814
+ return function (_x5) {
10815
+ return _ref3.apply(this, arguments);
10797
10816
  };
10798
10817
  }());
10799
10818
 
10800
10819
  case 6:
10801
10820
  case "end":
10802
- return _context3.stop();
10821
+ return _context4.stop();
10803
10822
  }
10804
10823
  }
10805
- }, _callee3);
10824
+ }, _callee4);
10806
10825
  }));
10807
10826
  return _addGood.apply(this, arguments);
10808
10827
  }
10809
10828
 
10810
- function rollBottom(_x2, _x3) {
10829
+ function rollBottom(_x3, _x4) {
10811
10830
  return _rollBottom.apply(this, arguments);
10812
10831
  }
10813
10832
 
10814
10833
  function _rollBottom() {
10815
- _rollBottom = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(controller, rootElement) {
10834
+ _rollBottom = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(controller, rootElement) {
10816
10835
  var cont;
10817
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
10836
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
10818
10837
  while (1) {
10819
- switch (_context4.prev = _context4.next) {
10838
+ switch (_context5.prev = _context5.next) {
10820
10839
  case 0:
10821
- _context4.next = 2;
10840
+ _context5.next = 2;
10822
10841
  return controller.wait();
10823
10842
 
10824
10843
  case 2:
10825
10844
  cont = rootElement === null || rootElement === void 0 ? void 0 : rootElement.querySelector('.ktsAntX-table-body');
10826
10845
 
10827
10846
  if (cont) {
10828
- _context4.next = 5;
10847
+ _context5.next = 5;
10829
10848
  break;
10830
10849
  }
10831
10850
 
10832
- return _context4.abrupt("return");
10851
+ return _context5.abrupt("return");
10833
10852
 
10834
10853
  case 5:
10835
10854
  cont.scrollTop = cont.scrollHeight;
10836
10855
 
10837
10856
  case 6:
10838
10857
  case "end":
10839
- return _context4.stop();
10858
+ return _context5.stop();
10840
10859
  }
10841
10860
  }
10842
- }, _callee4);
10861
+ }, _callee5);
10843
10862
  }));
10844
10863
  return _rollBottom.apply(this, arguments);
10845
10864
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.219",
3
+ "version": "3.2.220",
4
4
  "scripts": {
5
5
  "dev": "dumi dev --max-old-space-size=6096",
6
6
  "start": "dumi dev",
@@ -69,4 +69,5 @@ export default class InvoiceControllerState {
69
69
  */
70
70
  freightListState = new FreightListState();
71
71
 
72
+ addGoodsCheck?: any;
72
73
  }
@@ -6,7 +6,13 @@ import 'antd/dist/antd.css';
6
6
  export default () => {
7
7
 
8
8
  const controller = React.useMemo(() => new MyController1(), [])
9
+ React.useEffect(() => {
10
+ controller.run(async s => {
11
+ s.addGoodsCheck=checkGood;
12
+
9
13
 
14
+ })
15
+ }, [])
10
16
  const [deduction, setDeduction] = React.useState<number | undefined>(0);
11
17
 
12
18
  const [goodMax, setgoodMax] = React.useState(0);
@@ -50,7 +56,7 @@ export default () => {
50
56
  goodsList={
51
57
  <Invoice.GoodsList
52
58
 
53
- addGoodsCheck={checkGood}
59
+ // addGoodsCheck={checkGood}
54
60
  // isSwitchTax={false} // 是否可以切换(含税/不含税)状态
55
61
  // isAddDiscount={false} // 不能添加折扣行
56
62
  // goodMax={goodMax} // 控制能可以添加的货物函数
@@ -26,7 +26,11 @@ export default (props: any) => {
26
26
  const disabled = React.useMemo(() => typeof goodMax === 'number' ? goodsNum >= goodMax : !!searchValue, [goodMax, goodsNum, searchValue])
27
27
 
28
28
  const onClick = React.useCallback(async () => {
29
- props.addGoodsCheck &&await props.addGoodsCheck();
29
+ await controller.run(async (s) => {
30
+ if (s.addGoodsCheck) {
31
+ await s.addGoodsCheck();
32
+ }
33
+ });
30
34
  console.log('continue')
31
35
  await addGood(controller);
32
36
  await rollBottom(controller, rootElement);
@@ -45,7 +49,7 @@ export default (props: any) => {
45
49
 
46
50
  /** 添加一个空货物 */
47
51
  async function addGood(controller: InvoiceController) {
48
-
52
+
49
53
  await controller.saveEditGood();
50
54
  await controller.wait();
51
55
  await controller.run(async (s) => {