kts-component-invoice-operate 3.2.154 → 3.2.155

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
@@ -1094,6 +1094,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
1094
1094
  this.goodMax = void 0;
1095
1095
  this.isSwitchTax = void 0;
1096
1096
  this.isRecalculateWhenSwitchTax = false;
1097
+ this.isUpdateGoodsTaxRateList = false;
1097
1098
  this.isAddDiscount = void 0;
1098
1099
  this.isAddRow = true;
1099
1100
  this.isRemRow = true;
@@ -9739,6 +9740,7 @@ var InvoiceController = /*#__PURE__*/function (_InvoiceControllerFor) {
9739
9740
  _this.getGoodsList = void 0;
9740
9741
  _this.getTaxCategoryCodeList = void 0;
9741
9742
  _this.getGoodsSearch = getGoodsSearch;
9743
+ _this.getGoodsTaxRateList = void 0;
9742
9744
  return _this;
9743
9745
  } // ----------------- 发票头 模块相关 -----------------
9744
9746
 
@@ -10164,8 +10166,8 @@ function TableVirtual (props) {
10164
10166
  var cont = self.querySelector('.kts-invoice-operate-goods-table-virtual .ktsAntX-table-body');
10165
10167
  if (!cont) return;
10166
10168
  cont.scrollTop = 0;
10167
- }, [(_props$dataSource = props.dataSource) === null || _props$dataSource === void 0 ? void 0 : _props$dataSource.length]);
10168
- console.log('===> pointer', pointer, dataSource);
10169
+ }, [(_props$dataSource = props.dataSource) === null || _props$dataSource === void 0 ? void 0 : _props$dataSource.length]); // console.log('===> pointer', pointer, dataSource);
10170
+
10169
10171
  return /*#__PURE__*/React.createElement("span", {
10170
10172
  className: "kts-invoice-operate-goods-table-virtual",
10171
10173
  ref: function ref(e) {
@@ -14007,7 +14009,7 @@ var useColumns = (function (form) {
14007
14009
  setChangeField('taxRate');
14008
14010
  onChangeTaxRate(controller, form, record);
14009
14011
  }
14010
- }, taxRateList.map(function (e, i) {
14012
+ }, (record.goodsTaxRateList || taxRateList).map(function (e, i) {
14011
14013
  return /*#__PURE__*/React.createElement(Select.Option, {
14012
14014
  key: i,
14013
14015
  value: e
@@ -14371,7 +14373,7 @@ var useOnRow = (function () {
14371
14373
 
14372
14374
  case 7:
14373
14375
  if (!editGood) {
14374
- _context2.next = 18;
14376
+ _context2.next = 22;
14375
14377
  break;
14376
14378
  }
14377
14379
 
@@ -14391,7 +14393,19 @@ var useOnRow = (function () {
14391
14393
  return controller.wait();
14392
14394
 
14393
14395
  case 14:
14394
- _context2.next = 16;
14396
+ if (!(controller.getGoodsTaxRateList && record.taxClassificationCode && !record.goodsTaxRateList)) {
14397
+ _context2.next = 18;
14398
+ break;
14399
+ }
14400
+
14401
+ _context2.next = 17;
14402
+ return controller.getGoodsTaxRateList(record.taxClassificationCode);
14403
+
14404
+ case 17:
14405
+ record.goodsTaxRateList = _context2.sent;
14406
+
14407
+ case 18:
14408
+ _context2.next = 20;
14395
14409
  return controller.pipeline( /*#__PURE__*/function () {
14396
14410
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
14397
14411
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -14421,15 +14435,27 @@ var useOnRow = (function () {
14421
14435
  };
14422
14436
  }())();
14423
14437
 
14424
- case 16:
14425
- _context2.next = 20;
14438
+ case 20:
14439
+ _context2.next = 28;
14426
14440
  break;
14427
14441
 
14428
- case 18:
14429
- _context2.next = 20;
14442
+ case 22:
14443
+ if (!(controller.getGoodsTaxRateList && record.taxClassificationCode && !record.goodsTaxRateList)) {
14444
+ _context2.next = 26;
14445
+ break;
14446
+ }
14447
+
14448
+ _context2.next = 25;
14449
+ return controller.getGoodsTaxRateList(record.taxClassificationCode);
14450
+
14451
+ case 25:
14452
+ record.goodsTaxRateList = _context2.sent;
14453
+
14454
+ case 26:
14455
+ _context2.next = 28;
14430
14456
  return controller.setEditGood(record);
14431
14457
 
14432
- case 20:
14458
+ case 28:
14433
14459
  case "end":
14434
14460
  return _context2.stop();
14435
14461
  }
@@ -14809,7 +14835,7 @@ var useRowSelection = (function () {
14809
14835
  onSelect: onSelect,
14810
14836
  selectedRowKeys: selectedRowKeys,
14811
14837
  getCheckboxProps: function getCheckboxProps(record) {
14812
- console.log('===> getCheckboxProps', record, record.level);
14838
+ // console.log('===> getCheckboxProps', record, record.level)
14813
14839
  return {
14814
14840
  disabled: record.level > 0,
14815
14841
  style: record.level > 0 ? {
@@ -20225,6 +20251,11 @@ var useColumns$1 = (function (form) {
20225
20251
  var model = controller.useMemo(function (e) {
20226
20252
  return e.model;
20227
20253
  }, []);
20254
+ /** 计算类型 */
20255
+
20256
+ var calculateType = controller.useMemo(function (e) {
20257
+ return e.goodsListState.calculateType;
20258
+ }, []);
20228
20259
  /** 是否显示我方 */
20229
20260
 
20230
20261
  var isMyShow = controller.useMemo(function (e) {
@@ -20351,7 +20382,7 @@ var useColumns$1 = (function (form) {
20351
20382
  }, "\u9879\u76EE\u540D\u79F0"),
20352
20383
  key: 'itemName',
20353
20384
  render: function render(_, record) {
20354
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('itemName')) {
20385
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('itemName') && model !== 'prefab') {
20355
20386
  return /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement("div", {
20356
20387
  style: {
20357
20388
  display: 'flex'
@@ -20461,7 +20492,7 @@ var useColumns$1 = (function (form) {
20461
20492
  key: 'itemModelName',
20462
20493
  width: 119,
20463
20494
  render: function render(_, record) {
20464
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('itemModelName')) {
20495
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('itemModelName') && model !== 'prefab') {
20465
20496
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('itemModelName', {
20466
20497
  initialValue: isMyShow ? editGood.itemModelNameSelf : editGood.itemModelName,
20467
20498
  rules: getReplenishRules('itemModelName')
@@ -20512,7 +20543,7 @@ var useColumns$1 = (function (form) {
20512
20543
  key: 'unit',
20513
20544
  width: 70,
20514
20545
  render: function render(_, record) {
20515
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('unit')) {
20546
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('unit') && model !== 'prefab') {
20516
20547
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('unit', {
20517
20548
  initialValue: editGood.unit,
20518
20549
  rules: getReplenishRules('unit')
@@ -20570,7 +20601,7 @@ var useColumns$1 = (function (form) {
20570
20601
  align: 'right',
20571
20602
  width: 149,
20572
20603
  render: function render(value, record) {
20573
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('quantity')) {
20604
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('quantity') && model !== 'prefab') {
20574
20605
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('quantity', {
20575
20606
  initialValue: nonScientificNotation(editGood.quantity),
20576
20607
  getValueFromEvent: onNumberValueChange,
@@ -20665,7 +20696,7 @@ var useColumns$1 = (function (form) {
20665
20696
  align: 'right',
20666
20697
  width: 149,
20667
20698
  render: function render(value, record) {
20668
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('priceIncludeTax')) {
20699
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('priceIncludeTax') && model !== 'prefab') {
20669
20700
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('priceIncludeTax', {
20670
20701
  initialValue: nonScientificNotation(editGood.priceIncludeTax),
20671
20702
  getValueFromEvent: onNumberValueChange,
@@ -20740,7 +20771,7 @@ var useColumns$1 = (function (form) {
20740
20771
  align: 'right',
20741
20772
  width: 149,
20742
20773
  render: function render(value, record) {
20743
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('priceExcludeTax')) {
20774
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('priceExcludeTax') && model !== 'prefab') {
20744
20775
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('priceExcludeTax', {
20745
20776
  initialValue: nonScientificNotation(editGood.priceExcludeTax),
20746
20777
  getValueFromEvent: onNumberValueChange,
@@ -20815,7 +20846,7 @@ var useColumns$1 = (function (form) {
20815
20846
  width: 119,
20816
20847
  align: 'right',
20817
20848
  render: function render(value, record) {
20818
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('lineAmountIncludeTax')) {
20849
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('lineAmountIncludeTax') && model !== 'prefab') {
20819
20850
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('lineAmountIncludeTax', {
20820
20851
  initialValue: editGood.lineAmountIncludeTax,
20821
20852
  getValueFromEvent: onNumberValueChange,
@@ -20903,7 +20934,7 @@ var useColumns$1 = (function (form) {
20903
20934
  align: 'right',
20904
20935
  width: 119,
20905
20936
  render: function render(value, record) {
20906
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('lineAmountExcludeTax')) {
20937
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('lineAmountExcludeTax') && model !== 'prefab') {
20907
20938
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('lineAmountExcludeTax', {
20908
20939
  initialValue: editGood.lineAmountExcludeTax,
20909
20940
  getValueFromEvent: onNumberValueChange,
@@ -20966,7 +20997,7 @@ var useColumns$1 = (function (form) {
20966
20997
  align: 'right',
20967
20998
  width: 70,
20968
20999
  render: function render(value, record) {
20969
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('taxRate')) {
21000
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && !disableds.includes('taxRate') && !(model === 'prefab' && calculateType === '3')) {
20970
21001
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('taxRate', {
20971
21002
  initialValue: editGood.taxRate,
20972
21003
  rules: [].concat(_toConsumableArray(getReplenishRules('taxRate')), [{
@@ -20990,7 +21021,7 @@ var useColumns$1 = (function (form) {
20990
21021
  setChangeField('taxRate');
20991
21022
  onChangeTaxRate$1(controller, form, record);
20992
21023
  }
20993
- }, taxRateList.map(function (e, i) {
21024
+ }, (record.goodsTaxRateList || taxRateList).map(function (e, i) {
20994
21025
  return /*#__PURE__*/React.createElement(Select$1.Option, {
20995
21026
  key: i,
20996
21027
  value: e
@@ -21058,7 +21089,7 @@ var useColumns$1 = (function (form) {
21058
21089
  ellipsis: true
21059
21090
  });
21060
21091
  });
21061
- }, [isTaxIncluded, editGood, controller, taxRateList, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, isStart]); // React.useEffect(() => {
21092
+ }, [isTaxIncluded, editGood, controller, taxRateList, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, isStart, calculateType]); // React.useEffect(() => {
21062
21093
  // clearTimeout(t)
21063
21094
  // const t = setTimeout(() => { setChangeField('') }, 1000);
21064
21095
  // return () => { clearTimeout(t) }
@@ -21258,7 +21289,7 @@ var useOnRow$1 = (function () {
21258
21289
  while (1) {
21259
21290
  switch (_context2.prev = _context2.next) {
21260
21291
  case 0:
21261
- if (!(model === 'prefab')) {
21292
+ if (!(model === 'readOnly')) {
21262
21293
  _context2.next = 2;
21263
21294
  break;
21264
21295
  }
@@ -21266,46 +21297,50 @@ var useOnRow$1 = (function () {
21266
21297
  return _context2.abrupt("return");
21267
21298
 
21268
21299
  case 2:
21269
- if (!(model === 'readOnly')) {
21270
- _context2.next = 4;
21271
- break;
21272
- }
21273
-
21274
- return _context2.abrupt("return");
21275
-
21276
- case 4:
21277
21300
  editGood = controller.state.goodsListState.editGood;
21278
21301
 
21279
21302
  if (!(record.lineAttribute !== LineAttributeType$1.正常)) {
21280
- _context2.next = 7;
21303
+ _context2.next = 5;
21281
21304
  break;
21282
21305
  }
21283
21306
 
21284
21307
  return _context2.abrupt("return");
21285
21308
 
21286
- case 7:
21309
+ case 5:
21287
21310
  if (!editGood) {
21288
- _context2.next = 18;
21311
+ _context2.next = 20;
21289
21312
  break;
21290
21313
  }
21291
21314
 
21292
21315
  if (!(editGood.$index === record.$index)) {
21293
- _context2.next = 10;
21316
+ _context2.next = 8;
21294
21317
  break;
21295
21318
  }
21296
21319
 
21297
21320
  return _context2.abrupt("return");
21298
21321
 
21322
+ case 8:
21323
+ _context2.next = 10;
21324
+ return controller.saveEditGood();
21325
+
21299
21326
  case 10:
21300
21327
  _context2.next = 12;
21301
- return controller.saveEditGood();
21328
+ return controller.wait();
21302
21329
 
21303
21330
  case 12:
21304
- _context2.next = 14;
21305
- return controller.wait();
21331
+ if (!(controller.getGoodsTaxRateList && record.taxClassificationCode && !record.goodsTaxRateList)) {
21332
+ _context2.next = 16;
21333
+ break;
21334
+ }
21306
21335
 
21307
- case 14:
21308
- _context2.next = 16;
21336
+ _context2.next = 15;
21337
+ return controller.getGoodsTaxRateList(record.taxClassificationCode);
21338
+
21339
+ case 15:
21340
+ record.goodsTaxRateList = _context2.sent;
21341
+
21342
+ case 16:
21343
+ _context2.next = 18;
21309
21344
  return controller.pipeline( /*#__PURE__*/function () {
21310
21345
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
21311
21346
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -21335,15 +21370,27 @@ var useOnRow$1 = (function () {
21335
21370
  };
21336
21371
  }())();
21337
21372
 
21338
- case 16:
21339
- _context2.next = 20;
21373
+ case 18:
21374
+ _context2.next = 26;
21340
21375
  break;
21341
21376
 
21342
- case 18:
21343
- _context2.next = 20;
21377
+ case 20:
21378
+ if (!(controller.getGoodsTaxRateList && record.taxClassificationCode && !record.goodsTaxRateList)) {
21379
+ _context2.next = 24;
21380
+ break;
21381
+ }
21382
+
21383
+ _context2.next = 23;
21384
+ return controller.getGoodsTaxRateList(record.taxClassificationCode);
21385
+
21386
+ case 23:
21387
+ record.goodsTaxRateList = _context2.sent;
21388
+
21389
+ case 24:
21390
+ _context2.next = 26;
21344
21391
  return controller.setEditGood(record);
21345
21392
 
21346
- case 20:
21393
+ case 26:
21347
21394
  case "end":
21348
21395
  return _context2.stop();
21349
21396
  }
@@ -23645,7 +23692,7 @@ var EndowCodeDrawer = (function () {
23645
23692
  if (visible) {
23646
23693
  controller.pipeline( /*#__PURE__*/function () {
23647
23694
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
23648
- var endowcodeGoodIndex, good, getDefaultValue;
23695
+ var endowcodeGoodIndex, good, getDefaultValue, goodsTaxRateList;
23649
23696
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
23650
23697
  while (1) {
23651
23698
  switch (_context2.prev = _context2.next) {
@@ -23679,19 +23726,40 @@ var EndowCodeDrawer = (function () {
23679
23726
  case 9:
23680
23727
  _context2.t1 = _context2.sent;
23681
23728
  (0, _context2.t0)(_context2.t1);
23682
- _context2.next = 14;
23729
+ _context2.next = 23;
23683
23730
  break;
23684
23731
 
23685
23732
  case 13:
23686
- if (endowcodeGoodIndex.length === 1) {
23687
- setDefaultValue(good);
23688
- } else {
23689
- setDefaultValue({
23690
- taxRate: good.taxRate
23691
- });
23733
+ if (!(endowcodeGoodIndex.length === 1)) {
23734
+ _context2.next = 22;
23735
+ break;
23736
+ }
23737
+
23738
+ if (!(controller.state.goodsListState.isUpdateGoodsTaxRateList && controller.getGoodsTaxRateList && good.taxClassificationCode)) {
23739
+ _context2.next = 19;
23740
+ break;
23692
23741
  }
23693
23742
 
23694
- case 14:
23743
+ _context2.next = 17;
23744
+ return controller.getGoodsTaxRateList(good.taxClassificationCode);
23745
+
23746
+ case 17:
23747
+ goodsTaxRateList = _context2.sent;
23748
+ good.goodsTaxRateList = goodsTaxRateList; // if (good.taxRate !== undefined && good.taxRate !== null && !goodsTaxRateList.includes(good.taxRate)) {
23749
+ // good.taxRate = undefined;
23750
+ // }
23751
+
23752
+ case 19:
23753
+ setDefaultValue(good);
23754
+ _context2.next = 23;
23755
+ break;
23756
+
23757
+ case 22:
23758
+ setDefaultValue({
23759
+ taxRate: good.taxRate
23760
+ });
23761
+
23762
+ case 23:
23695
23763
  case "end":
23696
23764
  return _context2.stop();
23697
23765
  }
@@ -23757,12 +23825,7 @@ var DrawerBody$3 = function DrawerBody(props) {
23757
23825
  /** 税率列表 */
23758
23826
 
23759
23827
  var taxRateList = controller.useMemo(function (s) {
23760
- return s.goodsListState.taxRateList.map(function (e) {
23761
- return {
23762
- label: "".concat(e, "%"),
23763
- value: e
23764
- };
23765
- });
23828
+ return s.goodsListState.taxRateList;
23766
23829
  }, []);
23767
23830
  /** 免税类型 列表 */
23768
23831
 
@@ -23783,14 +23846,29 @@ var DrawerBody$3 = function DrawerBody(props) {
23783
23846
  _React$useState4 = _slicedToArray(_React$useState3, 2),
23784
23847
  taxRate = _React$useState4[0],
23785
23848
  setTaxRate = _React$useState4[1];
23786
- /** 税收分类编码 选择组件 */
23849
+ /** 商品可用税率 */
23850
+
23787
23851
 
23852
+ var _React$useState5 = React.useState(defaultValue.goodsTaxRateList),
23853
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
23854
+ goodsTaxRateList = _React$useState6[0],
23855
+ setGoodsTaxRateList = _React$useState6[1];
23856
+
23857
+ var formattedTaxRateList = React.useMemo(function () {
23858
+ return (goodsTaxRateList || taxRateList).map(function (e) {
23859
+ return {
23860
+ label: "".concat(e, "%"),
23861
+ value: e
23862
+ };
23863
+ });
23864
+ }, [goodsTaxRateList, taxRateList]);
23865
+ /** 税收分类编码 选择组件 */
23788
23866
 
23789
23867
  var ShowSearch = React.useCallback(function (props) {
23790
- var _React$useState5 = React.useState([]),
23791
- _React$useState6 = _slicedToArray(_React$useState5, 2),
23792
- dataSource = _React$useState6[0],
23793
- setDataSource = _React$useState6[1];
23868
+ var _React$useState7 = React.useState([]),
23869
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
23870
+ dataSource = _React$useState8[0],
23871
+ setDataSource = _React$useState8[1];
23794
23872
 
23795
23873
  var onSearch = React.useCallback( /*#__PURE__*/function () {
23796
23874
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e) {
@@ -23873,22 +23951,22 @@ var DrawerBody$3 = function DrawerBody(props) {
23873
23951
 
23874
23952
  var ShowSearch2 = React.useCallback(function (props) {
23875
23953
  // 是否显示
23876
- var _React$useState7 = React.useState(false),
23877
- _React$useState8 = _slicedToArray(_React$useState7, 2),
23878
- visible = _React$useState8[0],
23879
- setVisible = _React$useState8[1]; // 税收分类编码树
23880
-
23881
-
23882
- var _React$useState9 = React.useState(),
23954
+ var _React$useState9 = React.useState(false),
23883
23955
  _React$useState10 = _slicedToArray(_React$useState9, 2),
23884
- list = _React$useState10[0],
23885
- setList = _React$useState10[1]; // 搜索条件
23956
+ visible = _React$useState10[0],
23957
+ setVisible = _React$useState10[1]; // 税收分类编码树
23886
23958
 
23887
23959
 
23888
23960
  var _React$useState11 = React.useState(),
23889
23961
  _React$useState12 = _slicedToArray(_React$useState11, 2),
23890
- filter = _React$useState12[0],
23891
- setFilter = _React$useState12[1];
23962
+ list = _React$useState12[0],
23963
+ setList = _React$useState12[1]; // 搜索条件
23964
+
23965
+
23966
+ var _React$useState13 = React.useState(),
23967
+ _React$useState14 = _slicedToArray(_React$useState13, 2),
23968
+ filter = _React$useState14[0],
23969
+ setFilter = _React$useState14[1];
23892
23970
  /** 创建 树节点 */
23893
23971
 
23894
23972
 
@@ -24074,15 +24152,15 @@ var DrawerBody$3 = function DrawerBody(props) {
24074
24152
  /** 税收分类编码 选择组件3 */
24075
24153
 
24076
24154
  var ShowSearch3 = React.useCallback(function (props) {
24077
- var _React$useState13 = React.useState(false),
24078
- _React$useState14 = _slicedToArray(_React$useState13, 2),
24079
- open = _React$useState14[0],
24080
- setOpen = _React$useState14[1];
24081
-
24082
- var _React$useState15 = React.useState([]),
24155
+ var _React$useState15 = React.useState(false),
24083
24156
  _React$useState16 = _slicedToArray(_React$useState15, 2),
24084
- list = _React$useState16[0],
24085
- setList = _React$useState16[1];
24157
+ open = _React$useState16[0],
24158
+ setOpen = _React$useState16[1];
24159
+
24160
+ var _React$useState17 = React.useState([]),
24161
+ _React$useState18 = _slicedToArray(_React$useState17, 2),
24162
+ list = _React$useState18[0],
24163
+ setList = _React$useState18[1];
24086
24164
 
24087
24165
  var onSearch = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
24088
24166
  var _value$target;
@@ -24190,16 +24268,55 @@ var DrawerBody$3 = function DrawerBody(props) {
24190
24268
  }, _callee11);
24191
24269
  })), []);
24192
24270
  var onSelect = React.useCallback(function (key, info) {
24193
- // !readOnlyTaxRate && actions.setFieldState('taxRate', async s => {
24271
+ // 根据税编改变税率列表
24272
+ // 如果只有一个,默认选中,有多个时,置空,用户手选
24273
+ if (controller.state.goodsListState.isUpdateGoodsTaxRateList) {
24274
+ var _info$node$taxRateLis;
24275
+
24276
+ if ((_info$node$taxRateLis = info.node.taxRateList) === null || _info$node$taxRateLis === void 0 ? void 0 : _info$node$taxRateLis.length) {
24277
+ setGoodsTaxRateList(info.node.taxRateList);
24278
+ }
24279
+
24280
+ if (!readOnlyTaxRate) {
24281
+ actions.setFieldState('taxRate', /*#__PURE__*/function () {
24282
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(s) {
24283
+ var _info$node$taxRateLis2;
24284
+
24285
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
24286
+ while (1) {
24287
+ switch (_context12.prev = _context12.next) {
24288
+ case 0:
24289
+ if (info.node.taxRateList && ((_info$node$taxRateLis2 = info.node.taxRateList) === null || _info$node$taxRateLis2 === void 0 ? void 0 : _info$node$taxRateLis2.length) === 1) {
24290
+ s.value = info.node.taxRateList[0];
24291
+ } else {
24292
+ s.value = undefined;
24293
+ }
24294
+
24295
+ case 1:
24296
+ case "end":
24297
+ return _context12.stop();
24298
+ }
24299
+ }
24300
+ }, _callee12);
24301
+ }));
24302
+
24303
+ return function (_x8) {
24304
+ return _ref12.apply(this, arguments);
24305
+ };
24306
+ }());
24307
+ }
24308
+ } // !readOnlyTaxRate && actions.setFieldState('taxRate', async s => {
24194
24309
  // if (info.node.taxRate || info.taxRate === 0) {
24195
24310
  // s.value = info.node.taxRate
24196
24311
  // }
24197
24312
  // });
24313
+
24314
+
24198
24315
  actions.setFieldState('taxClassificationCode', /*#__PURE__*/function () {
24199
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(s) {
24200
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
24316
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(s) {
24317
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
24201
24318
  while (1) {
24202
- switch (_context12.prev = _context12.next) {
24319
+ switch (_context13.prev = _context13.next) {
24203
24320
  case 0:
24204
24321
  if (info.node.taxCategoryCode) {
24205
24322
  s.value = info.node.taxCategoryCode;
@@ -24207,21 +24324,21 @@ var DrawerBody$3 = function DrawerBody(props) {
24207
24324
 
24208
24325
  case 1:
24209
24326
  case "end":
24210
- return _context12.stop();
24327
+ return _context13.stop();
24211
24328
  }
24212
24329
  }
24213
- }, _callee12);
24330
+ }, _callee13);
24214
24331
  }));
24215
24332
 
24216
- return function (_x8) {
24217
- return _ref12.apply(this, arguments);
24333
+ return function (_x9) {
24334
+ return _ref13.apply(this, arguments);
24218
24335
  };
24219
24336
  }());
24220
24337
  actions.setFieldState('shorthand', /*#__PURE__*/function () {
24221
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(s) {
24222
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
24338
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(s) {
24339
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
24223
24340
  while (1) {
24224
- switch (_context13.prev = _context13.next) {
24341
+ switch (_context14.prev = _context14.next) {
24225
24342
  case 0:
24226
24343
  if (info.node.shorthand) {
24227
24344
  s.value = info.node.shorthand;
@@ -24229,14 +24346,14 @@ var DrawerBody$3 = function DrawerBody(props) {
24229
24346
 
24230
24347
  case 1:
24231
24348
  case "end":
24232
- return _context13.stop();
24349
+ return _context14.stop();
24233
24350
  }
24234
24351
  }
24235
- }, _callee13);
24352
+ }, _callee14);
24236
24353
  }));
24237
24354
 
24238
- return function (_x9) {
24239
- return _ref13.apply(this, arguments);
24355
+ return function (_x10) {
24356
+ return _ref14.apply(this, arguments);
24240
24357
  };
24241
24358
  }());
24242
24359
  setOpen(false);
@@ -24287,19 +24404,19 @@ var DrawerBody$3 = function DrawerBody(props) {
24287
24404
  }));
24288
24405
  }, [controller, actions]); // 是否享受优惠政策
24289
24406
 
24290
- var _React$useState17 = React.useState(0),
24291
- _React$useState18 = _slicedToArray(_React$useState17, 2),
24292
- favouredPolicyMark = _React$useState18[0],
24293
- setFavouredPolicyMark = _React$useState18[1]; // 确定
24407
+ var _React$useState19 = React.useState(0),
24408
+ _React$useState20 = _slicedToArray(_React$useState19, 2),
24409
+ favouredPolicyMark = _React$useState20[0],
24410
+ setFavouredPolicyMark = _React$useState20[1]; // 确定
24294
24411
 
24295
24412
 
24296
24413
  var onSubmit = React.useCallback(function (values) {
24297
24414
  controller.pipeline( /*#__PURE__*/function () {
24298
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(s) {
24415
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
24299
24416
  var endowCodeGood;
24300
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
24417
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
24301
24418
  while (1) {
24302
- switch (_context14.prev = _context14.next) {
24419
+ switch (_context15.prev = _context15.next) {
24303
24420
  case 0:
24304
24421
  endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(function (e) {
24305
24422
  return s.goodsListState.goodsMap.get(e);
@@ -24322,46 +24439,49 @@ var DrawerBody$3 = function DrawerBody(props) {
24322
24439
 
24323
24440
  if (good.lineAmountExcludeTax && good.quantity) {
24324
24441
  good.priceExcludeTax = countPrice(good.lineAmountExcludeTax, good.quantity, controller.state.calculatingDigits);
24325
- }
24442
+ } //赋值商品的可用税率
24443
+
24444
+
24445
+ good.goodsTaxRateList = goodsTaxRateList;
24326
24446
  });
24327
24447
  s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
24328
24448
  s.goodsListState.endowCode.endowcodeGoodIndex = [];
24329
24449
 
24330
24450
  case 4:
24331
24451
  case "end":
24332
- return _context14.stop();
24452
+ return _context15.stop();
24333
24453
  }
24334
24454
  }
24335
- }, _callee14);
24455
+ }, _callee15);
24336
24456
  }));
24337
24457
 
24338
- return function (_x10) {
24339
- return _ref14.apply(this, arguments);
24458
+ return function (_x11) {
24459
+ return _ref15.apply(this, arguments);
24340
24460
  };
24341
24461
  }())();
24342
- }, [controller]);
24462
+ }, [controller, goodsTaxRateList]);
24343
24463
  var effects = React.useCallback(function () {
24344
24464
  // 税率变化
24345
24465
  FormEffectHooks.onFieldValueChange$('taxRate').subscribe(function (e) {
24346
24466
  setTaxRate(e.value);
24347
24467
  actions.setFieldState('taxFreeType', /*#__PURE__*/function () {
24348
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
24349
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
24468
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(s) {
24469
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
24350
24470
  while (1) {
24351
- switch (_context15.prev = _context15.next) {
24471
+ switch (_context16.prev = _context16.next) {
24352
24472
  case 0:
24353
24473
  if (e.value !== 0) s.value = undefined;
24354
24474
 
24355
24475
  case 1:
24356
24476
  case "end":
24357
- return _context15.stop();
24477
+ return _context16.stop();
24358
24478
  }
24359
24479
  }
24360
- }, _callee15);
24480
+ }, _callee16);
24361
24481
  }));
24362
24482
 
24363
- return function (_x11) {
24364
- return _ref15.apply(this, arguments);
24483
+ return function (_x12) {
24484
+ return _ref16.apply(this, arguments);
24365
24485
  };
24366
24486
  }());
24367
24487
  }); // 是否享受优惠政策
@@ -24369,23 +24489,23 @@ var DrawerBody$3 = function DrawerBody(props) {
24369
24489
  FormEffectHooks.onFieldValueChange$('favouredPolicyMark').subscribe(function (e) {
24370
24490
  setFavouredPolicyMark(e.value);
24371
24491
  actions.setFieldState('favouredPolicyName', /*#__PURE__*/function () {
24372
- var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(s) {
24373
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
24492
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(s) {
24493
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
24374
24494
  while (1) {
24375
- switch (_context16.prev = _context16.next) {
24495
+ switch (_context17.prev = _context17.next) {
24376
24496
  case 0:
24377
24497
  if (e.value === 0) s.value = undefined;
24378
24498
 
24379
24499
  case 1:
24380
24500
  case "end":
24381
- return _context16.stop();
24501
+ return _context17.stop();
24382
24502
  }
24383
24503
  }
24384
- }, _callee16);
24504
+ }, _callee17);
24385
24505
  }));
24386
24506
 
24387
- return function (_x12) {
24388
- return _ref16.apply(this, arguments);
24507
+ return function (_x13) {
24508
+ return _ref17.apply(this, arguments);
24389
24509
  };
24390
24510
  }());
24391
24511
  });
@@ -24425,7 +24545,7 @@ var DrawerBody$3 = function DrawerBody(props) {
24425
24545
  disabled: readOnlyTaxRate
24426
24546
  },
24427
24547
  default: (_defaultValue$taxRate = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.taxRate) !== null && _defaultValue$taxRate !== void 0 ? _defaultValue$taxRate : 0,
24428
- enum: taxRateList,
24548
+ enum: formattedTaxRateList,
24429
24549
  "x-rules": [{
24430
24550
  message: '请选择税率',
24431
24551
  required: true
@@ -24485,23 +24605,23 @@ var DrawerBody$3 = function DrawerBody(props) {
24485
24605
  }, "\u786E\u5B9A"), /*#__PURE__*/React.createElement(Button, {
24486
24606
  onClick: function onClick() {
24487
24607
  controller.pipeline( /*#__PURE__*/function () {
24488
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(s) {
24489
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
24608
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(s) {
24609
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
24490
24610
  while (1) {
24491
- switch (_context17.prev = _context17.next) {
24611
+ switch (_context18.prev = _context18.next) {
24492
24612
  case 0:
24493
- return _context17.abrupt("return", s.goodsListState.endowCode.endowcodeGoodIndex = []);
24613
+ return _context18.abrupt("return", s.goodsListState.endowCode.endowcodeGoodIndex = []);
24494
24614
 
24495
24615
  case 1:
24496
24616
  case "end":
24497
- return _context17.stop();
24617
+ return _context18.stop();
24498
24618
  }
24499
24619
  }
24500
- }, _callee17);
24620
+ }, _callee18);
24501
24621
  }));
24502
24622
 
24503
- return function (_x13) {
24504
- return _ref17.apply(this, arguments);
24623
+ return function (_x14) {
24624
+ return _ref18.apply(this, arguments);
24505
24625
  };
24506
24626
  }())();
24507
24627
  }