kts-component-invoice-operate 3.2.181-5 → 3.2.181-7

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
@@ -8491,12 +8491,70 @@ var clearCalculatingField = /*#__PURE__*/function () {
8491
8491
  };
8492
8492
  }();
8493
8493
  /** 数量改变了 */
8494
+ // export const onChangeQuantity = lazyFn(
8495
+ // (controller: InvoiceController, form: WrappedFormUtils, record: IGood) => {
8496
+ // form.validateFields(async (err, values) => {
8497
+ // err = err || {};
8498
+ // if (!values.quantity && values.quantity !== 0) {
8499
+ // await controller.setEditGood({ quantity: undefined });
8500
+ // await clearCalculatingField(controller);
8501
+ // return;
8502
+ // }
8503
+ // if (err.quantity) {
8504
+ // await clearCalculatingField(controller);
8505
+ // return
8506
+ // };
8507
+ // const calculatingDigits = controller.state.calculatingDigits;
8508
+ // const quantity = format15(values.quantity, calculatingDigits);
8509
+ // await controller.setEditGood({ quantity });
8510
+ // form.setFieldsValue({ quantity });
8511
+ // // 是否含税
8512
+ // if (controller.state.goodsListState.isTaxIncluded) {
8513
+ // // 含税
8514
+ // if (!err.priceIncludeTax && values.priceIncludeTax) {
8515
+ // // 可以找到 单价(含税)
8516
+ // const priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
8517
+ // const lineAmountIncludeTax = format2(evaluate(`${priceIncludeTax} * ${quantity}`));
8518
+ // form.setFieldsValue({ lineAmountIncludeTax });
8519
+ // await controller.setEditGood({ lineAmountIncludeTax });
8520
+ // } else if (!err.lineAmountIncludeTax && values.lineAmountIncludeTax) {
8521
+ // // 可以找到 金额(含税)
8522
+ // const lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
8523
+ // const priceIncludeTax = format15(
8524
+ // evaluate(`${lineAmountIncludeTax} / ${quantity}`),
8525
+ // calculatingDigits);
8526
+ // form.setFieldsValue({ priceIncludeTax });
8527
+ // await controller.setEditGood({ priceIncludeTax });
8528
+ // }
8529
+ // // 更新不含税
8530
+ // await updateUnitPriceExcludingTax(controller, form, record);
8531
+ // } else {
8532
+ // // 不含税
8533
+ // if (!err.priceExcludeTax && values.priceExcludeTax) {
8534
+ // const priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
8535
+ // const lineAmountExcludeTax = format2(evaluate(`${quantity} * ${priceExcludeTax}`));
8536
+ // form.setFieldsValue({ lineAmountExcludeTax });
8537
+ // await controller.setEditGood({ lineAmountExcludeTax, quantity });
8538
+ // } else if (!err.lineAmountExcludeTax && values.lineAmountExcludeTax) {
8539
+ // const lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
8540
+ // const priceExcludeTax = format15(evaluate(`${lineAmountExcludeTax} / ${quantity}`), calculatingDigits);
8541
+ // form.setFieldsValue({ priceExcludeTax });
8542
+ // await controller.setEditGood({ priceExcludeTax, quantity });
8543
+ // }
8544
+ // // 更新含税
8545
+ // await updateUnitPriceTax(controller, form, record);
8546
+ // }
8547
+ // // 清楚 计算中启动字段
8548
+ // await clearCalculatingField(controller);
8549
+ // });
8550
+ // },
8551
+ // 1000,
8552
+ // );
8494
8553
 
8495
8554
  var onChangeQuantity = lazyFn(function (controller, form, record) {
8496
8555
  form.validateFields( /*#__PURE__*/function () {
8497
8556
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(err, values) {
8498
- var calculatingDigits, quantity, priceIncludeTax, lineAmountIncludeTax, _lineAmountIncludeTax, _priceIncludeTax, priceExcludeTax, lineAmountExcludeTax, _lineAmountExcludeTax, _priceExcludeTax;
8499
-
8557
+ var calculatingDigits, quantity, lineAmountIncludeTax, priceIncludeTax, lineAmountExcludeTax, priceExcludeTax;
8500
8558
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
8501
8559
  while (1) {
8502
8560
  switch (_context3.prev = _context3.next) {
@@ -8535,113 +8593,69 @@ var onChangeQuantity = lazyFn(function (controller, form, record) {
8535
8593
  case 11:
8536
8594
  calculatingDigits = controller.state.calculatingDigits;
8537
8595
  quantity = format15(values.quantity, calculatingDigits);
8538
- _context3.next = 16;
8596
+ _context3.next = 15;
8539
8597
  return controller.setEditGood({
8540
8598
  quantity: quantity
8541
8599
  });
8542
8600
 
8543
- case 16:
8601
+ case 15:
8544
8602
  form.setFieldsValue({
8545
8603
  quantity: quantity
8546
8604
  }); // 是否含税
8547
8605
 
8548
8606
  if (!controller.state.goodsListState.isTaxIncluded) {
8549
- _context3.next = 36;
8550
- break;
8551
- }
8552
-
8553
- if (!(!err.priceIncludeTax && values.priceIncludeTax)) {
8554
- _context3.next = 26;
8607
+ _context3.next = 27;
8555
8608
  break;
8556
8609
  }
8557
8610
 
8558
- // 可以找到 单价(含税)
8559
- priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
8560
- lineAmountIncludeTax = format2(evaluate("".concat(priceIncludeTax, " * ").concat(quantity)));
8561
- form.setFieldsValue({
8562
- lineAmountIncludeTax: lineAmountIncludeTax
8563
- });
8564
- _context3.next = 24;
8565
- return controller.setEditGood({
8566
- lineAmountIncludeTax: lineAmountIncludeTax
8567
- });
8568
-
8569
- case 24:
8570
- _context3.next = 32;
8571
- break;
8572
-
8573
- case 26:
8574
8611
  if (!(!err.lineAmountIncludeTax && values.lineAmountIncludeTax)) {
8575
- _context3.next = 32;
8612
+ _context3.next = 23;
8576
8613
  break;
8577
8614
  }
8578
8615
 
8579
- // 可以找到 金额(含税)
8580
- _lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
8581
- _priceIncludeTax = format15(evaluate("".concat(_lineAmountIncludeTax, " / ").concat(quantity)), calculatingDigits);
8616
+ lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
8617
+ priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(quantity)), calculatingDigits);
8582
8618
  form.setFieldsValue({
8583
- priceIncludeTax: _priceIncludeTax
8619
+ priceIncludeTax: priceIncludeTax
8584
8620
  });
8585
- _context3.next = 32;
8621
+ _context3.next = 23;
8586
8622
  return controller.setEditGood({
8587
- priceIncludeTax: _priceIncludeTax
8623
+ priceIncludeTax: priceIncludeTax
8588
8624
  });
8589
8625
 
8590
- case 32:
8591
- _context3.next = 34;
8626
+ case 23:
8627
+ _context3.next = 25;
8592
8628
  return updateUnitPriceExcludingTax(controller, form, record);
8593
8629
 
8594
- case 34:
8595
- _context3.next = 52;
8596
- break;
8597
-
8598
- case 36:
8599
- if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
8600
- _context3.next = 44;
8601
- break;
8602
- }
8603
-
8604
- priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
8605
- lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
8606
- form.setFieldsValue({
8607
- lineAmountExcludeTax: lineAmountExcludeTax
8608
- });
8609
- _context3.next = 42;
8610
- return controller.setEditGood({
8611
- lineAmountExcludeTax: lineAmountExcludeTax,
8612
- quantity: quantity
8613
- });
8614
-
8615
- case 42:
8616
- _context3.next = 50;
8630
+ case 25:
8631
+ _context3.next = 35;
8617
8632
  break;
8618
8633
 
8619
- case 44:
8634
+ case 27:
8620
8635
  if (!(!err.lineAmountExcludeTax && values.lineAmountExcludeTax)) {
8621
- _context3.next = 50;
8636
+ _context3.next = 33;
8622
8637
  break;
8623
8638
  }
8624
8639
 
8625
- _lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
8626
- _priceExcludeTax = format15(evaluate("".concat(_lineAmountExcludeTax, " / ").concat(quantity)), calculatingDigits);
8640
+ lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
8641
+ priceExcludeTax = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(quantity)), calculatingDigits);
8627
8642
  form.setFieldsValue({
8628
- priceExcludeTax: _priceExcludeTax
8643
+ priceExcludeTax: priceExcludeTax
8629
8644
  });
8630
- _context3.next = 50;
8645
+ _context3.next = 33;
8631
8646
  return controller.setEditGood({
8632
- priceExcludeTax: _priceExcludeTax,
8633
- quantity: quantity
8647
+ priceExcludeTax: priceExcludeTax
8634
8648
  });
8635
8649
 
8636
- case 50:
8637
- _context3.next = 52;
8650
+ case 33:
8651
+ _context3.next = 35;
8638
8652
  return updateUnitPriceTax(controller, form, record);
8639
8653
 
8640
- case 52:
8641
- _context3.next = 54;
8654
+ case 35:
8655
+ _context3.next = 37;
8642
8656
  return clearCalculatingField(controller);
8643
8657
 
8644
- case 54:
8658
+ case 37:
8645
8659
  case "end":
8646
8660
  return _context3.stop();
8647
8661
  }
@@ -8659,7 +8673,7 @@ var onChangeQuantity = lazyFn(function (controller, form, record) {
8659
8673
  var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
8660
8674
  form.validateFields( /*#__PURE__*/function () {
8661
8675
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err, values) {
8662
- var calculatingDigits, priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax2, _quantity;
8676
+ var calculatingDigits, priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax, _quantity;
8663
8677
 
8664
8678
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
8665
8679
  while (1) {
@@ -8735,8 +8749,8 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
8735
8749
  break;
8736
8750
  }
8737
8751
 
8738
- _lineAmountIncludeTax2 = format2(values.lineAmountIncludeTax);
8739
- _quantity = format15(evaluate("".concat(_lineAmountIncludeTax2, " / ").concat(priceIncludeTax)), calculatingDigits);
8752
+ _lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
8753
+ _quantity = format15(evaluate("".concat(_lineAmountIncludeTax, " / ").concat(priceIncludeTax)), calculatingDigits);
8740
8754
  form.setFieldsValue({
8741
8755
  quantity: _quantity
8742
8756
  });
@@ -8771,7 +8785,7 @@ var onChangePriceIncludeTax = lazyFn(function (controller, form, record) {
8771
8785
  var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
8772
8786
  form.validateFields( /*#__PURE__*/function () {
8773
8787
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(err, values) {
8774
- var calculatingDigits, priceExcludeTax, quantity, lineAmountExcludeTax, _lineAmountExcludeTax2, _quantity2;
8788
+ var calculatingDigits, priceExcludeTax, quantity, lineAmountExcludeTax, _lineAmountExcludeTax, _quantity2;
8775
8789
 
8776
8790
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
8777
8791
  while (1) {
@@ -8847,8 +8861,8 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
8847
8861
  break;
8848
8862
  }
8849
8863
 
8850
- _lineAmountExcludeTax2 = format2(values.lineAmountExcludeTax);
8851
- _quantity2 = format15(evaluate("".concat(_lineAmountExcludeTax2, " / ").concat(priceExcludeTax)), calculatingDigits);
8864
+ _lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
8865
+ _quantity2 = format15(evaluate("".concat(_lineAmountExcludeTax, " / ").concat(priceExcludeTax)), calculatingDigits);
8852
8866
  form.setFieldsValue({
8853
8867
  quantity: _quantity2
8854
8868
  });
@@ -8883,7 +8897,7 @@ var onChangePriceExcludeTax = lazyFn(function (controller, form, record) {
8883
8897
  var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
8884
8898
  form.validateFields( /*#__PURE__*/function () {
8885
8899
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(err, values) {
8886
- var calculatingDigits, lineAmountIncludeTax, quantity, priceIncludeTax, _priceIncludeTax2, _quantity3;
8900
+ var calculatingDigits, lineAmountIncludeTax, quantity, priceIncludeTax, _priceIncludeTax, _quantity3;
8887
8901
 
8888
8902
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
8889
8903
  while (1) {
@@ -8951,8 +8965,8 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
8951
8965
  break;
8952
8966
  }
8953
8967
 
8954
- _priceIncludeTax2 = format15(values.priceIncludeTax, calculatingDigits);
8955
- _quantity3 = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(_priceIncludeTax2)), calculatingDigits);
8968
+ _priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
8969
+ _quantity3 = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(_priceIncludeTax)), calculatingDigits);
8956
8970
  form.setFieldsValue({
8957
8971
  quantity: _quantity3
8958
8972
  });
@@ -8987,7 +9001,7 @@ var onChangeLineAmountIncludeTax = lazyFn(function (controller, form, record) {
8987
9001
  var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
8988
9002
  form.validateFields( /*#__PURE__*/function () {
8989
9003
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(err, values) {
8990
- var calculatingDigits, lineAmountExcludeTax, quantity, priceExcludeTax, _priceExcludeTax2, _quantity4;
9004
+ var calculatingDigits, lineAmountExcludeTax, quantity, priceExcludeTax, _priceExcludeTax, _quantity4;
8991
9005
 
8992
9006
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
8993
9007
  while (1) {
@@ -9055,8 +9069,8 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
9055
9069
  break;
9056
9070
  }
9057
9071
 
9058
- _priceExcludeTax2 = format15(values.priceExcludeTax, calculatingDigits);
9059
- _quantity4 = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(_priceExcludeTax2)), calculatingDigits);
9072
+ _priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
9073
+ _quantity4 = format15(evaluate("".concat(lineAmountExcludeTax, " / ").concat(_priceExcludeTax)), calculatingDigits);
9060
9074
  form.setFieldsValue({
9061
9075
  quantity: _quantity4
9062
9076
  });
@@ -9802,21 +9816,21 @@ var onChangeSwitchTax = /*#__PURE__*/function () {
9802
9816
 
9803
9817
  var _quantity5 = format15(sourceQuantity, calculatingDigits);
9804
9818
 
9805
- var _priceExcludeTax3 = format15(sourcePriceExcludeTax, calculatingDigits);
9819
+ var _priceExcludeTax2 = format15(sourcePriceExcludeTax, calculatingDigits);
9806
9820
 
9807
- var _lineAmountExcludeTax3 = format2(evaluate("".concat(_priceExcludeTax3, " * ").concat(_quantity5)));
9821
+ var _lineAmountExcludeTax2 = format2(evaluate("".concat(_priceExcludeTax2, " * ").concat(_quantity5)));
9808
9822
 
9809
- var _lineAmountIncludeTax3 = format2(evaluate("".concat(_lineAmountExcludeTax3, " * (1+(").concat(taxRate, "/100))")));
9823
+ var _lineAmountIncludeTax2 = format2(evaluate("".concat(_lineAmountExcludeTax2, " * (1+(").concat(taxRate, "/100))")));
9810
9824
 
9811
- var _priceIncludeTax3 = format15(evaluate("".concat(_lineAmountIncludeTax3, " / ").concat(_quantity5)), calculatingDigits);
9825
+ var _priceIncludeTax2 = format15(evaluate("".concat(_lineAmountIncludeTax2, " / ").concat(_quantity5)), calculatingDigits);
9812
9826
 
9813
- var _taxAmount = evaluate("".concat(_lineAmountIncludeTax3, " - ").concat(_lineAmountExcludeTax3));
9827
+ var _taxAmount = evaluate("".concat(_lineAmountIncludeTax2, " - ").concat(_lineAmountExcludeTax2));
9814
9828
 
9815
9829
  return _objectSpread2(_objectSpread2({}, good), {}, {
9816
- lineAmountExcludeTax: _lineAmountExcludeTax3,
9817
- lineAmountIncludeTax: _lineAmountIncludeTax3,
9830
+ lineAmountExcludeTax: _lineAmountExcludeTax2,
9831
+ lineAmountIncludeTax: _lineAmountIncludeTax2,
9818
9832
  taxAmount: _taxAmount,
9819
- priceIncludeTax: _priceIncludeTax3
9833
+ priceIncludeTax: _priceIncludeTax2
9820
9834
  });
9821
9835
  }
9822
9836
  });
@@ -14001,13 +14015,14 @@ var useColumns = (function (form) {
14001
14015
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('priceIncludeTax', {
14002
14016
  initialValue: nonScientificNotation(editGood.priceIncludeTax),
14003
14017
  getValueFromEvent: onNumberValueChange,
14004
- rules: [].concat(_toConsumableArray(getReplenishRules('priceIncludeTax')), [{
14018
+ rules: [].concat(_toConsumableArray(getReplenishRules('priceIncludeTax')), [// { pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/, message: '单价必须为数字' },
14019
+ {
14005
14020
  pattern: /^[+-]?(0|([1-9]\d*))(\.\d+)?$/,
14006
- message: '单价必须为数字'
14021
+ message: '金额必须为数字'
14007
14022
  }, {
14008
14023
  validator: function () {
14009
14024
  var _validator3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_, value, callback) {
14010
- var isQuantity, isvalue;
14025
+ var quantity, isQuantityValid, isValueValid;
14011
14026
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
14012
14027
  while (1) {
14013
14028
  switch (_context9.prev = _context9.next) {
@@ -14016,20 +14031,38 @@ var useColumns = (function (form) {
14016
14031
  return controller.wait();
14017
14032
 
14018
14033
  case 2:
14019
- isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
14020
- isvalue = !!value || value === 0;
14021
-
14022
- if (!(isvalue || isQuantity === isvalue)) {
14023
- _context9.next = 6;
14034
+ // const isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
14035
+ // const isvalue = !!value || value === 0;
14036
+ // if (isvalue || isQuantity === isvalue) return;
14037
+ // callback('请输入单价');
14038
+ quantity = getFieldValue('quantity');
14039
+ isQuantityValid = quantity !== undefined && quantity !== null && quantity !== '';
14040
+ isValueValid = value !== undefined && value !== null && value !== '';
14041
+
14042
+ if (!(isValueValid && isQuantityValid)) {
14043
+ _context9.next = 7;
14024
14044
  break;
14025
14045
  }
14026
14046
 
14027
14047
  return _context9.abrupt("return");
14028
14048
 
14029
- case 6:
14030
- callback('请输入单价');
14031
-
14032
14049
  case 7:
14050
+ if (isValueValid) {
14051
+ _context9.next = 9;
14052
+ break;
14053
+ }
14054
+
14055
+ return _context9.abrupt("return", callback('金额不能为空'));
14056
+
14057
+ case 9:
14058
+ if (isQuantityValid) {
14059
+ _context9.next = 11;
14060
+ break;
14061
+ }
14062
+
14063
+ return _context9.abrupt("return", callback('数量不能为空'));
14064
+
14065
+ case 11:
14033
14066
  case "end":
14034
14067
  return _context9.stop();
14035
14068
  }
@@ -14082,29 +14115,44 @@ var useColumns = (function (form) {
14082
14115
  }, {
14083
14116
  validator: function () {
14084
14117
  var _validator4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_, value, callback) {
14085
- var isQuantity, isvalue;
14118
+ var quantity, isQuantityValid, isValueValid;
14086
14119
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
14087
14120
  while (1) {
14088
14121
  switch (_context10.prev = _context10.next) {
14089
14122
  case 0:
14090
- _context10.next = 2;
14091
- return controller.wait();
14092
-
14093
- case 2:
14094
- isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
14095
- isvalue = !!value || value === 0;
14096
-
14097
- if (!(isvalue || isQuantity === isvalue)) {
14098
- _context10.next = 6;
14123
+ // await controller.wait();
14124
+ // const isQuantity = !!getFieldValue('quantity') || getFieldValue('quantity') === 0;
14125
+ // const isvalue = !!value || value === 0;
14126
+ // if (isvalue || isQuantity === isvalue) return;
14127
+ // callback('请输入单价');
14128
+ quantity = getFieldValue('quantity');
14129
+ isQuantityValid = quantity !== undefined && quantity !== null && quantity !== '';
14130
+ isValueValid = value !== undefined && value !== null && value !== '';
14131
+
14132
+ if (!(isValueValid && isQuantityValid)) {
14133
+ _context10.next = 5;
14099
14134
  break;
14100
14135
  }
14101
14136
 
14102
14137
  return _context10.abrupt("return");
14103
14138
 
14104
- case 6:
14105
- callback('请输入单价');
14139
+ case 5:
14140
+ if (isValueValid) {
14141
+ _context10.next = 7;
14142
+ break;
14143
+ }
14144
+
14145
+ return _context10.abrupt("return", callback('金额不能为空'));
14106
14146
 
14107
14147
  case 7:
14148
+ if (isQuantityValid) {
14149
+ _context10.next = 9;
14150
+ break;
14151
+ }
14152
+
14153
+ return _context10.abrupt("return", callback('数量不能为空'));
14154
+
14155
+ case 9:
14108
14156
  case "end":
14109
14157
  return _context10.stop();
14110
14158
  }
@@ -15794,13 +15842,19 @@ function AddDiscountRowDrawer(props) {
15794
15842
  /** 表单变化 */
15795
15843
 
15796
15844
  var onChangeForm = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
15845
+ var values;
15797
15846
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
15798
15847
  while (1) {
15799
15848
  switch (_context6.prev = _context6.next) {
15800
15849
  case 0:
15801
- setFormValues(form.getFieldsValue());
15850
+ _context6.next = 2;
15851
+ return form.getFieldsValue();
15802
15852
 
15803
- case 1:
15853
+ case 2:
15854
+ values = _context6.sent;
15855
+ setFormValues(values);
15856
+
15857
+ case 4:
15804
15858
  case "end":
15805
15859
  return _context6.stop();
15806
15860
  }
@@ -15908,18 +15962,18 @@ function AddDiscountRowDrawer(props) {
15908
15962
  })), [discountGood, form, totalAmount, onClose, controller]); // 打开抽屉时 重置form
15909
15963
 
15910
15964
  React.useEffect(function () {
15911
- // if (open) {
15912
- // form.resetFields();
15913
- // setFormValues(form.getFieldsValue())
15914
- // }
15915
15965
  if (open) {
15916
15966
  form.resetFields();
15917
15967
  form.setFieldsValue({
15968
+ discolineType: '1',
15969
+ discolineValue: undefined
15970
+ }); // 强制设置初始值
15971
+
15972
+ setFormValues({
15918
15973
  discolineType: '1'
15919
15974
  });
15920
- setFormValues(form.getFieldsValue());
15921
15975
  }
15922
- }, [open, form]); // 切换 折扣方式 清空折扣值
15976
+ }, [open]); // 切换 折扣方式 清空折扣值
15923
15977
 
15924
15978
  React.useEffect(function () {
15925
15979
  form.setFieldsValue(_objectSpread2(_objectSpread2({}, formValues), {}, {
@@ -23816,13 +23870,19 @@ function AddDiscountRowDrawer$1(props) {
23816
23870
  /** 表单变化 */
23817
23871
 
23818
23872
  var onChangeForm = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
23873
+ var values;
23819
23874
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
23820
23875
  while (1) {
23821
23876
  switch (_context4.prev = _context4.next) {
23822
23877
  case 0:
23823
- setFormValues(form.getFieldsValue());
23878
+ _context4.next = 2;
23879
+ return form.getFieldsValue();
23824
23880
 
23825
- case 1:
23881
+ case 2:
23882
+ values = _context4.sent;
23883
+ setFormValues(values);
23884
+
23885
+ case 4:
23826
23886
  case "end":
23827
23887
  return _context4.stop();
23828
23888
  }
@@ -23932,7 +23992,14 @@ function AddDiscountRowDrawer$1(props) {
23932
23992
  React.useEffect(function () {
23933
23993
  if (open) {
23934
23994
  form.resetFields();
23935
- setFormValues(form.getFieldsValue());
23995
+ form.setFieldsValue({
23996
+ discolineType: '1',
23997
+ discolineValue: undefined
23998
+ }); // 强制设置初始值
23999
+
24000
+ setFormValues({
24001
+ discolineType: '1'
24002
+ }); // 强制设置formValues的初始状态
23936
24003
  }
23937
24004
  }, [open]); // 切换 折扣方式 清空折扣值
23938
24005
 
@@ -23962,7 +24029,10 @@ function AddDiscountRowDrawer$1(props) {
23962
24029
  }, /*#__PURE__*/React.createElement(Form$1, {
23963
24030
  form: form,
23964
24031
  layout: 'vertical',
23965
- onChange: onChangeForm
24032
+ onChange: onChangeForm,
24033
+ initialValues: {
24034
+ discolineType: '1'
24035
+ }
23966
24036
  }, /*#__PURE__*/React.createElement(Form$1.Item, {
23967
24037
  label: "\u5546\u54C1\u91D1\u989D\uFF08\u542B\u7A0E\uFF09"
23968
24038
  }, totalAmount.toFixed(2), "\uFF08\u5171 ", discountGood.length, " \u884C\uFF09"), /*#__PURE__*/React.createElement(Form$1.Item, {
@@ -26868,6 +26938,8 @@ var DrawerBody$1 = function DrawerBody() {
26868
26938
  onClick: function onClick() {
26869
26939
  controller.run( /*#__PURE__*/function () {
26870
26940
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
26941
+ var _s$goodsListState$edi, _s$goodsListState$edi2, _s$goodsListState$edi3, _s$goodsListState$edi4, _s$goodsListState$edi5, _s$goodsListState$edi6, _s$goodsListState$edi7, _s$goodsListState$edi8, _s$goodsListState$edi9, _s$goodsListState$edi10, _s$goodsListState$edi11, _s$goodsListState$edi12, _s$goodsListState$edi13, _s$goodsListState$edi14;
26942
+
26871
26943
  var between, editGood;
26872
26944
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
26873
26945
  while (1) {
@@ -26904,17 +26976,31 @@ var DrawerBody$1 = function DrawerBody() {
26904
26976
  // 导入时清空之前输入的值,使用导入的单价和税率(参考税局系统)
26905
26977
  record.quantity = undefined;
26906
26978
  record.lineAmountExcludeTax = undefined;
26907
- record.lineAmountIncludeTax = undefined; // 中间数据
26979
+ record.lineAmountIncludeTax = undefined;
26980
+ console.log('s.goodsListState.editGood:', s.goodsListState.editGood); // 光电定制化功能:无论是否有值都替换 itemCode, itemName, shorthand, taxCategoryCode, taxClassificationCode;
26981
+ // 如果其他输入框有值就不替换,没值就替换:itemModelName, lineAmountExcludeTax, lineAmountIncludeTax,lineAttribute,priceExcludeTax,
26982
+ // priceIncludeTax,quantity, serialNo, taxAmount, taxRate, unit
26983
+ // 中间数据
26908
26984
 
26909
26985
  between = _objectSpread2({}, record);
26986
+ console.log(':between:', between);
26910
26987
  between.itemName = getItemName(record, s.goodsListState.editGood);
26911
26988
  between.itemCode = getItemCode(record, s.goodsListState.editGood);
26912
26989
  between.itemNameOther = getItemNameOther(record, s.goodsListState.editGood); // 设置编辑货物
26913
26990
 
26914
- editGood = s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, s.goodsListState.editGood), {}, {
26915
- itemModelName: undefined,
26916
- itemModelNameSelf: undefined
26917
- }, between);
26991
+ editGood = s.goodsListState.editGood = _objectSpread2(_objectSpread2(_objectSpread2({}, s.goodsListState.editGood), between), {}, {
26992
+ itemModelName: (_s$goodsListState$edi = (_s$goodsListState$edi2 = s.goodsListState.editGood) === null || _s$goodsListState$edi2 === void 0 ? void 0 : _s$goodsListState$edi2.itemModelName) !== null && _s$goodsListState$edi !== void 0 ? _s$goodsListState$edi : between.itemModelName,
26993
+ lineAmountExcludeTax: (_s$goodsListState$edi3 = (_s$goodsListState$edi4 = s.goodsListState.editGood) === null || _s$goodsListState$edi4 === void 0 ? void 0 : _s$goodsListState$edi4.lineAmountExcludeTax) !== null && _s$goodsListState$edi3 !== void 0 ? _s$goodsListState$edi3 : between.lineAmountExcludeTax,
26994
+ lineAmountIncludeTax: (_s$goodsListState$edi5 = (_s$goodsListState$edi6 = s.goodsListState.editGood) === null || _s$goodsListState$edi6 === void 0 ? void 0 : _s$goodsListState$edi6.lineAmountIncludeTax) !== null && _s$goodsListState$edi5 !== void 0 ? _s$goodsListState$edi5 : between.lineAmountIncludeTax,
26995
+ // lineAttribute:s.goodsListState.editGood?.lineAttribute,
26996
+ priceExcludeTax: (_s$goodsListState$edi7 = (_s$goodsListState$edi8 = s.goodsListState.editGood) === null || _s$goodsListState$edi8 === void 0 ? void 0 : _s$goodsListState$edi8.priceExcludeTax) !== null && _s$goodsListState$edi7 !== void 0 ? _s$goodsListState$edi7 : between.priceExcludeTax,
26997
+ priceIncludeTax: (_s$goodsListState$edi9 = (_s$goodsListState$edi10 = s.goodsListState.editGood) === null || _s$goodsListState$edi10 === void 0 ? void 0 : _s$goodsListState$edi10.priceIncludeTax) !== null && _s$goodsListState$edi9 !== void 0 ? _s$goodsListState$edi9 : between.priceIncludeTax,
26998
+ quantity: (_s$goodsListState$edi11 = (_s$goodsListState$edi12 = s.goodsListState.editGood) === null || _s$goodsListState$edi12 === void 0 ? void 0 : _s$goodsListState$edi12.quantity) !== null && _s$goodsListState$edi11 !== void 0 ? _s$goodsListState$edi11 : between.quantity,
26999
+ // serialNo:s.goodsListState.editGood?.itemModelName ?? between.itemModelName,
27000
+ // taxAmount:s.goodsListState.editGood?.itemModelName ?? between.itemModelName,
27001
+ // taxRate:s.goodsListState.editGood?.itemModelName ?? between.itemModelName,
27002
+ unit: (_s$goodsListState$edi13 = (_s$goodsListState$edi14 = s.goodsListState.editGood) === null || _s$goodsListState$edi14 === void 0 ? void 0 : _s$goodsListState$edi14.unit) !== null && _s$goodsListState$edi13 !== void 0 ? _s$goodsListState$edi13 : between.unit
27003
+ });
26918
27004
 
26919
27005
  if (editGood.taxRate) {
26920
27006
  editGood.taxRate = dutyFree(controller, editGood.taxRate, s.goodsListState.form, editGood);
@@ -26942,27 +27028,27 @@ var DrawerBody$1 = function DrawerBody() {
26942
27028
  // s.goodsListState.form.setFieldsValue({
26943
27029
  // ...editGood,
26944
27030
  // });
26945
- // }
27031
+ // }
26946
27032
 
26947
27033
  s.goodsListState.importGoods.isVisibleDrawer = false;
26948
27034
 
26949
27035
  if (!s.goodsListState.isTaxIncluded) {
26950
- _context2.next = 26;
27036
+ _context2.next = 28;
26951
27037
  break;
26952
27038
  }
26953
27039
 
26954
- _context2.next = 24;
27040
+ _context2.next = 26;
26955
27041
  return updateUnitPriceExcludingTax(controller, s.goodsListState.form, record);
26956
27042
 
26957
- case 24:
26958
- _context2.next = 28;
27043
+ case 26:
27044
+ _context2.next = 30;
26959
27045
  break;
26960
27046
 
26961
- case 26:
26962
- _context2.next = 28;
27047
+ case 28:
27048
+ _context2.next = 30;
26963
27049
  return updateUnitPriceTax(controller, s.goodsListState.form, record);
26964
27050
 
26965
- case 28:
27051
+ case 30:
26966
27052
  case "end":
26967
27053
  return _context2.stop();
26968
27054
  }