kts-component-invoice-operate 3.2.265 → 3.2.267

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.
Files changed (29) hide show
  1. package/dist/DifferenceInputModal/index.d.ts +8 -2
  2. package/dist/Invoice/InvoiceController/InvoiceControllerState/DifferenceInputState/index.d.ts +2 -0
  3. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +2 -0
  4. package/dist/Invoice/InvoiceController/hooks/index.d.ts +3 -0
  5. package/dist/Invoice/tools/calculate/index.d.ts +1 -1
  6. package/dist/index.esm.js +695 -288
  7. package/dist/index.js +695 -288
  8. package/package.json +1 -1
  9. package/src/DifferenceInputModal/index.tsx +87 -17
  10. package/src/Invoice/Invoice-digtal/index.md +9 -9
  11. package/src/Invoice/InvoiceController/InvoiceControllerForm/index.ts +2 -1
  12. package/src/Invoice/InvoiceController/InvoiceControllerState/DifferenceInputState/index.ts +3 -0
  13. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +3 -0
  14. package/src/Invoice/InvoiceController/fns/saveEditGood.ts +1 -0
  15. package/src/Invoice/InvoiceController/hooks/index.ts +76 -0
  16. package/src/Invoice/index.tsx +3 -0
  17. package/src/Invoice/tools/calculate/index.ts +2 -3
  18. package/src/Invoice/ui/default/EndowCodeDrawer/index.tsx +4 -2
  19. package/src/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.ts +2 -1
  20. package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +19 -6
  21. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +5 -4
  22. package/src/Invoice/ui/default/GoodsList/hook/useWindowClick/index.tsx +4 -1
  23. package/src/Invoice/ui/default/GoodsList/index.tsx +1 -1
  24. package/src/Invoice/ui/default/GoodsList/ui/AddRowButton/index.tsx +1 -1
  25. package/src/Invoice/ui/digtal/DifferenceInput/index.tsx +33 -3
  26. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/autoFillFn/index.ts +2 -2
  27. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +34 -21
  28. package/src/Invoice/ui/digtal/GoodsList/hook/useWindowClick/index.tsx +4 -1
  29. package/src/Invoice/ui/digtal/GoodsList/ui/AddRowButton/index.tsx +1 -1
package/dist/index.esm.js CHANGED
@@ -854,10 +854,11 @@ var InvoiceControllerForm = /*#__PURE__*/function (_GreyReactBox) {
854
854
 
855
855
  case 27:
856
856
  _values.set('goodsList', this.state.goodsListState.goodsList.slice().map(function (e) {
857
- var _this3$state, _this3$state$differen, _this3$state$differen2;
857
+ var _this3$state, _this3$state$differen, _this3$state$differen2, _this3$state2, _this3$state2$differe, _this3$state2$differe2;
858
858
 
859
859
  return _objectSpread2(_objectSpread2({}, e), {}, {
860
- deductAmount: ((_this3$state = _this3.state) === null || _this3$state === void 0 ? void 0 : (_this3$state$differen = _this3$state.differenceInputState) === null || _this3$state$differen === void 0 ? void 0 : (_this3$state$differen2 = _this3$state$differen.data) === null || _this3$state$differen2 === void 0 ? void 0 : _this3$state$differen2.deductTotal) || 0
860
+ deductAmount: ((_this3$state = _this3.state) === null || _this3$state === void 0 ? void 0 : (_this3$state$differen = _this3$state.differenceInputState) === null || _this3$state$differen === void 0 ? void 0 : (_this3$state$differen2 = _this3$state$differen.data) === null || _this3$state$differen2 === void 0 ? void 0 : _this3$state$differen2.deductTotal) || 0,
861
+ amountIncludeTax: ((_this3$state2 = _this3.state) === null || _this3$state2 === void 0 ? void 0 : (_this3$state2$differe = _this3$state2.differenceInputState) === null || _this3$state2$differe === void 0 ? void 0 : (_this3$state2$differe2 = _this3$state2$differe.data) === null || _this3$state2$differe2 === void 0 ? void 0 : _this3$state2$differe2.amountIncludeTax) || 0
861
862
  });
862
863
  })); //货物运输列表
863
864
 
@@ -1243,6 +1244,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
1243
1244
  this.isValidateGood = true;
1244
1245
  this.isValidateMeiTan = true;
1245
1246
  this.meiTanGoodIndex = [];
1247
+ this.isSaveRowOutside = true;
1246
1248
 
1247
1249
  this.verifyMeiTanFn = /*#__PURE__*/function () {
1248
1250
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(record) {
@@ -1654,6 +1656,7 @@ var DifferenceInputState = /*#__PURE__*/_createClass(function DifferenceInputSta
1654
1656
  this.enabled = false;
1655
1657
  this.open = false;
1656
1658
  this.data = void 0;
1659
+ this.amountIncludeTax = void 0;
1657
1660
  });
1658
1661
 
1659
1662
  var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControllerState() {
@@ -2293,7 +2296,7 @@ function countAmountIncludeTax(quantity, priceIncludeTax, calculatingDigits) {
2293
2296
  return parseFloat(chain$1(bignumber(priceIncludeTax)).multiply(bignumber(quantity)).done().toNumber().toFixed(2)); // return parseFloat(evaluate(`${priceIncludeTax} * ${quantity}`).toFixed(2));
2294
2297
  }
2295
2298
  /**
2296
- * 不含税金额 = 含税金额-税额
2299
+ * 不含税金额 = 含税金额 - 税额
2297
2300
  * @param amountIncludeTax 含税金额
2298
2301
  * @param taxAmount 税额
2299
2302
  * @returns 不含税金额
@@ -2314,10 +2317,9 @@ function countAmountExcludeTax(amountIncludeTax, taxAmount) {
2314
2317
 
2315
2318
  function countTaxAmount(amountIncludeTax, deduction, taxRate) {
2316
2319
  if (!amountIncludeTax && amountIncludeTax !== 0) return undefined;
2317
- if (!deduction && deduction !== 0) return undefined;
2318
2320
  if (!taxRate && taxRate !== 0) return undefined;
2319
2321
  var taxRateBu = chain$1(bignumber(taxRate)).divide(bignumber(100)).done();
2320
- return parseFloat(chain$1(bignumber(amountIncludeTax)).subtract(bignumber(deduction)).divide(chain$1(bignumber(1)).add(taxRateBu).done()).multiply(taxRateBu).done().toNumber().toFixed(2));
2322
+ return parseFloat(chain$1(bignumber(amountIncludeTax)).subtract(bignumber(deduction || 0)).divide(chain$1(bignumber(1)).add(taxRateBu).done()).multiply(taxRateBu).done().toNumber().toFixed(2));
2321
2323
  }
2322
2324
  /**
2323
2325
  * 单价 = 金额/数量
@@ -9977,6 +9979,7 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
9977
9979
  /** 税率 */
9978
9980
 
9979
9981
  var onChangeTaxRate = lazyFn(function (controller, form, record) {
9982
+ console.log('计算税率===>');
9980
9983
  form.validateFields( /*#__PURE__*/function () {
9981
9984
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(err, values) {
9982
9985
  var taxRate;
@@ -10120,7 +10123,7 @@ var updateUnitPriceExcludingTax = /*#__PURE__*/function () {
10120
10123
  /** 税额 */
10121
10124
 
10122
10125
  /** 扣除额 */
10123
- deduction = controller.state.goodsListState.deduction;
10126
+ deduction = controller.state.goodsListState.deduction || 0;
10124
10127
  editGood = controller.state.goodsListState.editGood; // 计算税额
10125
10128
 
10126
10129
  if (!promptErr(err.lineAmountIncludeTax) && !promptErr(err.taxRate)) {
@@ -11078,6 +11081,162 @@ var InvoiceController = /*#__PURE__*/function (_InvoiceControllerFor) {
11078
11081
  return _createClass(InvoiceController);
11079
11082
  }(InvoiceControllerForm);
11080
11083
 
11084
+ /** 切换是否启用差额开票重新计算税额 */
11085
+
11086
+ var useRecalculateTax = function useRecalculateTax(invoiceController) {
11087
+ var differenceInputEnabled = invoiceController.useMemo(function (s) {
11088
+ return s.differenceInputState.enabled;
11089
+ }, []);
11090
+ React.useEffect(function () {
11091
+ console.log('切换是否启用差额开票重新计算税额 - 重新计算税额===>');
11092
+
11093
+ if (invoiceController.state.goodsListState.editGood) {
11094
+ var editGood = invoiceController.state.goodsListState.editGood;
11095
+ var form = invoiceController.state.goodsListState.form;
11096
+ var isTaxIncluded = invoiceController.state.goodsListState.isTaxIncluded;
11097
+
11098
+ if (isTaxIncluded) {
11099
+ // 含税
11100
+ var lineAmountIncludeTax = (form === null || form === void 0 ? void 0 : form.getFieldValue('lineAmountIncludeTax')) || 0; //含税金额
11101
+
11102
+ var deduction = invoiceController.state.goodsListState.deduction || 0;
11103
+ var taxRate = (form === null || form === void 0 ? void 0 : form.getFieldValue('taxRate')) || 0; //税率
11104
+
11105
+ var taxAmount = countTaxAmount(lineAmountIncludeTax, deduction, taxRate) || 0; //税额
11106
+
11107
+ var lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
11108
+
11109
+ var quantity = (form === null || form === void 0 ? void 0 : form.getFieldValue('quantity')) || 0;
11110
+ var priceExcludeTax = quantity > 0 ? countPrice(lineAmountExcludeTax, quantity) : undefined; // 不含税单价
11111
+
11112
+ form === null || form === void 0 ? void 0 : form.setFieldsValue({
11113
+ taxAmount: taxAmount,
11114
+ lineAmountExcludeTax: lineAmountExcludeTax
11115
+ });
11116
+ invoiceController.run( /*#__PURE__*/function () {
11117
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
11118
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11119
+ while (1) {
11120
+ switch (_context.prev = _context.next) {
11121
+ case 0:
11122
+ s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, editGood), {}, {
11123
+ taxAmount: taxAmount,
11124
+ lineAmountExcludeTax: lineAmountExcludeTax,
11125
+ priceExcludeTax: priceExcludeTax || undefined
11126
+ });
11127
+
11128
+ case 1:
11129
+ case "end":
11130
+ return _context.stop();
11131
+ }
11132
+ }
11133
+ }, _callee);
11134
+ }));
11135
+
11136
+ return function (_x) {
11137
+ return _ref.apply(this, arguments);
11138
+ };
11139
+ }());
11140
+ } else {
11141
+ // 不含税
11142
+ var _lineAmountIncludeTax = editGood.lineAmountIncludeTax || 0;
11143
+
11144
+ var _deduction = invoiceController.state.goodsListState.deduction || 0;
11145
+
11146
+ var _taxRate = (form === null || form === void 0 ? void 0 : form.getFieldValue('taxRate')) || 0; //税率
11147
+
11148
+
11149
+ var _taxAmount = countTaxAmount(_lineAmountIncludeTax, _deduction, _taxRate) || 0; //税额
11150
+
11151
+
11152
+ var _lineAmountExcludeTax = countAmountExcludeTax(_lineAmountIncludeTax, _taxAmount) || 0; // 不含税金额
11153
+
11154
+
11155
+ var _quantity = (form === null || form === void 0 ? void 0 : form.getFieldValue('quantity')) || 0;
11156
+
11157
+ var _priceExcludeTax = _quantity > 0 ? countPrice(_lineAmountExcludeTax, _quantity) : undefined; // 不含税单价
11158
+
11159
+
11160
+ form === null || form === void 0 ? void 0 : form.setFieldsValue({
11161
+ taxAmount: _taxAmount,
11162
+ lineAmountExcludeTax: _lineAmountExcludeTax
11163
+ });
11164
+ invoiceController.run( /*#__PURE__*/function () {
11165
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
11166
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11167
+ while (1) {
11168
+ switch (_context2.prev = _context2.next) {
11169
+ case 0:
11170
+ s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, editGood), {}, {
11171
+ taxAmount: _taxAmount,
11172
+ lineAmountExcludeTax: _lineAmountExcludeTax,
11173
+ priceExcludeTax: _priceExcludeTax || undefined
11174
+ });
11175
+
11176
+ case 1:
11177
+ case "end":
11178
+ return _context2.stop();
11179
+ }
11180
+ }
11181
+ }, _callee2);
11182
+ }));
11183
+
11184
+ return function (_x2) {
11185
+ return _ref2.apply(this, arguments);
11186
+ };
11187
+ }());
11188
+ }
11189
+ } else {
11190
+ invoiceController.run( /*#__PURE__*/function () {
11191
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
11192
+ var good, lineAmountIncludeTax, deduction, taxRate, taxAmount, lineAmountExcludeTax, quantity, priceExcludeTax;
11193
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
11194
+ while (1) {
11195
+ switch (_context3.prev = _context3.next) {
11196
+ case 0:
11197
+ good = s.goodsListState.goodsList[0];
11198
+
11199
+ if (good) {
11200
+ _context3.next = 3;
11201
+ break;
11202
+ }
11203
+
11204
+ return _context3.abrupt("return");
11205
+
11206
+ case 3:
11207
+ lineAmountIncludeTax = good.lineAmountIncludeTax || 0;
11208
+ deduction = invoiceController.state.goodsListState.deduction || 0;
11209
+ taxRate = good.taxRate || 0;
11210
+ taxAmount = countTaxAmount(lineAmountIncludeTax, deduction, taxRate) || 0; //税额
11211
+
11212
+ lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
11213
+
11214
+ quantity = good.quantity || 0;
11215
+ priceExcludeTax = quantity > 0 ? countPrice(lineAmountExcludeTax, quantity) : undefined; // 不含税单价
11216
+
11217
+ s.goodsListState.goodsList[0] = _objectSpread2(_objectSpread2({}, good), {}, {
11218
+ taxAmount: taxAmount,
11219
+ lineAmountExcludeTax: lineAmountExcludeTax,
11220
+ priceExcludeTax: priceExcludeTax || undefined
11221
+ });
11222
+ s.goodsListState.goodsList = _toConsumableArray(s.goodsListState.goodsList);
11223
+
11224
+ case 12:
11225
+ case "end":
11226
+ return _context3.stop();
11227
+ }
11228
+ }
11229
+ }, _callee3);
11230
+ }));
11231
+
11232
+ return function (_x3) {
11233
+ return _ref3.apply(this, arguments);
11234
+ };
11235
+ }());
11236
+ }
11237
+ }, [differenceInputEnabled]);
11238
+ };
11239
+
11081
11240
  /** 更新 商品序号 */
11082
11241
 
11083
11242
  function useToGenerateId(controller) {
@@ -11751,8 +11910,8 @@ var AddRowButton = (function (props) {
11751
11910
  })), [controller, rootElement]);
11752
11911
  if (isAddRow === false) return /*#__PURE__*/React.createElement(React.Fragment, null);
11753
11912
  if (model === 'prefab') return /*#__PURE__*/React.createElement(React.Fragment, null);
11754
- if (model === 'readOnly') return /*#__PURE__*/React.createElement(React.Fragment, null);
11755
- if (isDifferenceInput && goodsNum >= 1) return /*#__PURE__*/React.createElement(React.Fragment, null);
11913
+ if (model === 'readOnly') return /*#__PURE__*/React.createElement(React.Fragment, null); // if (isDifferenceInput && goodsNum >= 1) return <></>;
11914
+
11756
11915
  return /*#__PURE__*/React.createElement(Button, {
11757
11916
  onClick: onClick,
11758
11917
  disabled: disabled
@@ -12628,10 +12787,7 @@ function ItemNameInput(props) {
12628
12787
  }, []);
12629
12788
  var autoComplete = controller.useMemo(function (s) {
12630
12789
  return s.autoComplete;
12631
- }, []);
12632
- var enabled = controller.useMemo(function (s) {
12633
- return s.differenceInputState.enabled;
12634
- }, []);
12790
+ }, []); // const enabled = controller.useMemo((s) => s.differenceInputState.enabled, []);
12635
12791
 
12636
12792
  var _React$useState = React.useState([]),
12637
12793
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -12691,8 +12847,9 @@ function ItemNameInput(props) {
12691
12847
  setSelectLine(null);
12692
12848
 
12693
12849
  case 8:
12694
- // 失去焦点时,打开差额开票弹窗
12695
- if (enabled) {
12850
+ console.log('onBlur ===>', controller.state.differenceInputState.enabled); // 失去焦点时,打开差额开票弹窗
12851
+
12852
+ if (controller.state.differenceInputState.enabled) {
12696
12853
  controller.run( /*#__PURE__*/function () {
12697
12854
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
12698
12855
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -12715,26 +12872,26 @@ function ItemNameInput(props) {
12715
12872
  }());
12716
12873
  }
12717
12874
 
12718
- _context2.next = 14;
12875
+ _context2.next = 15;
12719
12876
  break;
12720
12877
 
12721
- case 11:
12722
- _context2.prev = 11;
12878
+ case 12:
12879
+ _context2.prev = 12;
12723
12880
  _context2.t0 = _context2["catch"](0);
12724
12881
  throw _context2.t0;
12725
12882
 
12726
- case 14:
12883
+ case 15:
12727
12884
  case "end":
12728
12885
  return _context2.stop();
12729
12886
  }
12730
12887
  }
12731
- }, _callee2, null, [[0, 11]]);
12888
+ }, _callee2, null, [[0, 12]]);
12732
12889
  }));
12733
12890
 
12734
12891
  return function (_x) {
12735
12892
  return _ref.apply(this, arguments);
12736
12893
  };
12737
- }(), [autoComplete.onItemNameBlur, selectLine, props.editGood, enabled]);
12894
+ }(), [autoComplete.onItemNameBlur, selectLine, props.editGood]);
12738
12895
  var onSearch = React.useCallback( /*#__PURE__*/function () {
12739
12896
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(searchText) {
12740
12897
  var list;
@@ -14941,6 +15098,11 @@ var useColumns = (function (form) {
14941
15098
  var deduction = controller.useMemo(function (e) {
14942
15099
  return e.goodsListState.deduction;
14943
15100
  }, []);
15101
+ /** 差额开票是否启用 */
15102
+
15103
+ var differenceInputStateEnabled = controller.useMemo(function (e) {
15104
+ return e.differenceInputState.enabled;
15105
+ }, []);
14944
15106
  /** 计算中启动字段 */
14945
15107
 
14946
15108
  var changeField = controller.useMemo(function (e) {
@@ -15439,6 +15601,7 @@ var useColumns = (function (form) {
15439
15601
  textAlign: 'right'
15440
15602
  },
15441
15603
  maxLength: 25,
15604
+ disabled: differenceInputStateEnabled,
15442
15605
  loading: isCipher(changeField, 'priceIncludeTax'),
15443
15606
  onChange: function onChange() {
15444
15607
  setChangeField('priceIncludeTax');
@@ -15514,6 +15677,7 @@ var useColumns = (function (form) {
15514
15677
  textAlign: 'right'
15515
15678
  },
15516
15679
  maxLength: 25,
15680
+ disabled: differenceInputStateEnabled,
15517
15681
  loading: isCipher(changeField, 'priceExcludeTax'),
15518
15682
  onChange: function onChange() {
15519
15683
  setChangeField('priceExcludeTax');
@@ -15603,17 +15767,40 @@ var useColumns = (function (form) {
15603
15767
  textAlign: 'right'
15604
15768
  },
15605
15769
  loading: isCipher(changeField, 'lineAmountIncludeTax'),
15770
+ readOnly: differenceInputStateEnabled,
15606
15771
  onChange: function onChange() {
15607
15772
  setChangeField('lineAmountIncludeTax');
15608
15773
  onChangeLineAmountIncludeTax(controller, form, record);
15609
- }
15774
+ },
15775
+ onClick: differenceInputStateEnabled ? function () {
15776
+ controller.run( /*#__PURE__*/function () {
15777
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(s) {
15778
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
15779
+ while (1) {
15780
+ switch (_context13.prev = _context13.next) {
15781
+ case 0:
15782
+ s.differenceInputState.open = true;
15783
+
15784
+ case 1:
15785
+ case "end":
15786
+ return _context13.stop();
15787
+ }
15788
+ }
15789
+ }, _callee13);
15790
+ }));
15791
+
15792
+ return function (_x21) {
15793
+ return _ref3.apply(this, arguments);
15794
+ };
15795
+ }());
15796
+ } : undefined
15610
15797
  })));
15611
15798
  } else {
15612
15799
  return /*#__PURE__*/React.createElement("span", {
15613
15800
  style: {
15614
15801
  padding: '0 10px'
15615
15802
  }
15616
- }, formatSearch(parseFloat(value).toFixed(2), searchValue));
15803
+ }, formatSearch((isNaN(parseFloat(value)) ? 0 : parseFloat(value)).toFixed(2), searchValue));
15617
15804
  }
15618
15805
  }
15619
15806
  }, {
@@ -15625,7 +15812,7 @@ var useColumns = (function (form) {
15625
15812
  align: 'right',
15626
15813
  width: 119,
15627
15814
  render: function render(value, record) {
15628
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
15815
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab' && !differenceInputStateEnabled) {
15629
15816
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('lineAmountExcludeTax', {
15630
15817
  initialValue: editGood.lineAmountExcludeTax,
15631
15818
  getValueFromEvent: onNumberValueChange,
@@ -15637,10 +15824,10 @@ var useColumns = (function (form) {
15637
15824
  message: '金额必须为数字'
15638
15825
  }, {
15639
15826
  validator: function () {
15640
- var _validator7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_, value, callback) {
15641
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
15827
+ var _validator7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(_, value, callback) {
15828
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
15642
15829
  while (1) {
15643
- switch (_context13.prev = _context13.next) {
15830
+ switch (_context14.prev = _context14.next) {
15644
15831
  case 0:
15645
15832
  if ("".concat(value).split('.')[0].length > priceIntegerDigit) {
15646
15833
  callback("\u91D1\u989D\u6574\u6570\u90E8\u5206\u4E0D\u80FD\u5927\u4E8E".concat(priceIntegerDigit, "\u4F4D\uFF0C\u5C0F\u6570\u70B9\u540E\u6700\u591A2\u4F4D"));
@@ -15648,13 +15835,13 @@ var useColumns = (function (form) {
15648
15835
 
15649
15836
  case 1:
15650
15837
  case "end":
15651
- return _context13.stop();
15838
+ return _context14.stop();
15652
15839
  }
15653
15840
  }
15654
- }, _callee13);
15841
+ }, _callee14);
15655
15842
  }));
15656
15843
 
15657
- function validator(_x21, _x22, _x23) {
15844
+ function validator(_x22, _x23, _x24) {
15658
15845
  return _validator7.apply(this, arguments);
15659
15846
  }
15660
15847
 
@@ -15665,7 +15852,30 @@ var useColumns = (function (form) {
15665
15852
  style: {
15666
15853
  textAlign: 'right'
15667
15854
  },
15855
+ readOnly: differenceInputStateEnabled,
15668
15856
  loading: isCipher(changeField, 'lineAmountExcludeTax'),
15857
+ onClick: differenceInputStateEnabled ? function () {
15858
+ controller.run( /*#__PURE__*/function () {
15859
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
15860
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
15861
+ while (1) {
15862
+ switch (_context15.prev = _context15.next) {
15863
+ case 0:
15864
+ s.differenceInputState.open = true;
15865
+
15866
+ case 1:
15867
+ case "end":
15868
+ return _context15.stop();
15869
+ }
15870
+ }
15871
+ }, _callee15);
15872
+ }));
15873
+
15874
+ return function (_x25) {
15875
+ return _ref4.apply(this, arguments);
15876
+ };
15877
+ }());
15878
+ } : undefined,
15669
15879
  onChange: function onChange() {
15670
15880
  setChangeField('lineAmountExcludeTax');
15671
15881
  onChangeLineAmountExcludeTax(controller, form, record);
@@ -15676,7 +15886,7 @@ var useColumns = (function (form) {
15676
15886
  style: {
15677
15887
  padding: '0 10px'
15678
15888
  }
15679
- }, value === '' ? '' : formatSearch(parseFloat(value).toFixed(2), searchValue));
15889
+ }, value === '' ? '' : formatSearch((isNaN(parseFloat(value)) ? 0 : parseFloat(value)).toFixed(2), searchValue));
15680
15890
  }
15681
15891
  }
15682
15892
  }, {
@@ -15754,11 +15964,12 @@ var useColumns = (function (form) {
15754
15964
  // const lineAmountExcludeTax = lineAmountIncludeTax-value;
15755
15965
 
15756
15966
  var lineAmountExcludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountExcludeTax) || 0;
15967
+ var deduction = controller.state.goodsListState.deduction || 0;
15757
15968
  var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
15758
15969
 
15759
15970
  if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
15760
15971
  // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
15761
- var total = chain$1(bignumber(lineAmountExcludeTax)).multiply(bignumber(taxRate || 0)).divide(bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
15972
+ var total = chain$1(bignumber(lineAmountExcludeTax)).subtract(bignumber(deduction)).multiply(bignumber(taxRate || 0)).divide(bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
15762
15973
 
15763
15974
  if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.06) {
15764
15975
  callback();
@@ -15887,7 +16098,7 @@ var useColumns = (function (form) {
15887
16098
  ellipsis: true
15888
16099
  });
15889
16100
  });
15890
- }, [isTaxIncluded, editGood, goodsList, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, columnshide, isStart]);
16101
+ }, [isTaxIncluded, editGood, goodsList, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, columnshide, isStart, differenceInputStateEnabled]);
15891
16102
  return controller.setColumnsConfig ? controller.setColumnsConfig(columns) : columns;
15892
16103
  });
15893
16104
  /** 字段 */
@@ -16220,61 +16431,6 @@ var useOnRow = (function () {
16220
16431
  };
16221
16432
  });
16222
16433
 
16223
- /**
16224
- * 扣除额 相关业务
16225
- */
16226
-
16227
- function useDeduction(controller) {
16228
- var deduction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
16229
- // 更新 扣除额
16230
- React.useEffect(function () {
16231
- controller.pipeline( /*#__PURE__*/function () {
16232
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
16233
- return _regeneratorRuntime().wrap(function _callee$(_context) {
16234
- while (1) {
16235
- switch (_context.prev = _context.next) {
16236
- case 0:
16237
- return _context.abrupt("return", s.goodsListState.deduction = deduction);
16238
-
16239
- case 1:
16240
- case "end":
16241
- return _context.stop();
16242
- }
16243
- }
16244
- }, _callee);
16245
- }));
16246
-
16247
- return function (_x) {
16248
- return _ref.apply(this, arguments);
16249
- };
16250
- }())();
16251
- }, [controller, deduction]); // 重新计算
16252
-
16253
- React.useEffect(function () {
16254
- controller.pipeline( /*#__PURE__*/function () {
16255
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
16256
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
16257
- while (1) {
16258
- switch (_context2.prev = _context2.next) {
16259
- case 0:
16260
- s.goodsListState.editGood = undefined;
16261
- s.goodsListState.goodsList = [];
16262
-
16263
- case 2:
16264
- case "end":
16265
- return _context2.stop();
16266
- }
16267
- }
16268
- }, _callee2);
16269
- }));
16270
-
16271
- return function (_x2) {
16272
- return _ref2.apply(this, arguments);
16273
- };
16274
- }())();
16275
- }, [controller, deduction]);
16276
- }
16277
-
16278
16434
  /**
16279
16435
  * 点击组件外部 保存正在编辑的货物
16280
16436
  */
@@ -16286,6 +16442,9 @@ function useWindowClick(controller) {
16286
16442
  /** 点击组件外部 保存正在编辑的货物 */
16287
16443
  React.useEffect(function () {
16288
16444
  var click = function click() {
16445
+ var _controller$state$goo;
16446
+
16447
+ if (!((_controller$state$goo = controller.state.goodsListState) === null || _controller$state$goo === void 0 ? void 0 : _controller$state$goo.isSaveRowOutside)) return;
16289
16448
  setTimeout(controller.saveEditGood);
16290
16449
  };
16291
16450
 
@@ -17857,9 +18016,9 @@ var Main = decorator(Form.create())(function (props) {
17857
18016
  }, [dataSource, searchValue, controller, isTaxIncluded]);
17858
18017
  /** 表格行事件 */
17859
18018
 
17860
- var _onRow = useOnRow();
18019
+ var _onRow = useOnRow(); // useDeduction(controller, props.deduction);
18020
+
17861
18021
 
17862
- useDeduction(controller, props.deduction);
17863
18022
  useWindowClick(controller);
17864
18023
  /** 批量赋码 */
17865
18024
 
@@ -23177,8 +23336,8 @@ var AddRowButton$1 = (function () {
23177
23336
  })), [controller, rootElement]);
23178
23337
  if (isAddRow === false) return /*#__PURE__*/React.createElement(React.Fragment, null);
23179
23338
  if (model === 'prefab') return /*#__PURE__*/React.createElement(React.Fragment, null);
23180
- if (model === 'readOnly') return /*#__PURE__*/React.createElement(React.Fragment, null);
23181
- if (isDifferenceInput && goodsNum >= 1) return /*#__PURE__*/React.createElement(React.Fragment, null);
23339
+ if (model === 'readOnly') return /*#__PURE__*/React.createElement(React.Fragment, null); // if (isDifferenceInput && goodsNum >= 1) return <></>;
23340
+
23182
23341
  return /*#__PURE__*/React.createElement(Button$1, {
23183
23342
  size: 'small',
23184
23343
  type: 'primary',
@@ -23504,7 +23663,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
23504
23663
  break;
23505
23664
  }
23506
23665
 
23507
- if (!(!err.priceIncludeTax && values.priceIncludeTax)) {
23666
+ if (!(!err.priceIncludeTax && values.priceIncludeTax && !controller.state.differenceInputState.enabled)) {
23508
23667
  _context3.next = 26;
23509
23668
  break;
23510
23669
  }
@@ -23550,7 +23709,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
23550
23709
  break;
23551
23710
 
23552
23711
  case 36:
23553
- if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
23712
+ if (!(!err.priceExcludeTax && values.priceExcludeTax && !controller.state.differenceInputState.enabled)) {
23554
23713
  _context3.next = 44;
23555
23714
  break;
23556
23715
  }
@@ -25634,6 +25793,11 @@ var useColumns$1 = (function (form) {
25634
25793
  var deduction = controller.useMemo(function (e) {
25635
25794
  return e.goodsListState.deduction;
25636
25795
  }, []);
25796
+ /** 差额开票是否启用 */
25797
+
25798
+ var differenceInputStateEnabled = controller.useMemo(function (e) {
25799
+ return e.differenceInputState.enabled;
25800
+ }, []);
25637
25801
  /** 计算中启动字段 */
25638
25802
 
25639
25803
  var changeField = controller.useMemo(function (e) {
@@ -25729,58 +25893,24 @@ var useColumns$1 = (function (form) {
25729
25893
  }, getFieldDecorator('itemName', {
25730
25894
  initialValue: isMyShow ? record.itemNameSelf : record.itemName,
25731
25895
  rules: [].concat(_toConsumableArray(getReplenishRules('itemName')), [{
25732
- validator: function () {
25733
- var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_, __, callback) {
25734
- var value;
25735
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
25736
- while (1) {
25737
- switch (_context2.prev = _context2.next) {
25738
- case 0:
25739
- if (!isValidateGood) {
25740
- _context2.next = 11;
25741
- break;
25742
- }
25743
-
25744
- _context2.next = 3;
25745
- return controller.wait();
25746
-
25747
- case 3:
25748
- value = controller.state.goodsListState.editGood;
25749
-
25750
- if (!(!(value === null || value === void 0 ? void 0 : value.itemName) && !(value === null || value === void 0 ? void 0 : value.itemNameSelf))) {
25751
- _context2.next = 8;
25752
- break;
25753
- }
25754
-
25755
- callback('项目名称不能为空');
25756
- _context2.next = 9;
25757
- break;
25758
-
25759
- case 8:
25760
- return _context2.abrupt("return");
25761
-
25762
- case 9:
25763
- _context2.next = 12;
25764
- break;
25765
-
25766
- case 11:
25767
- callback();
25768
-
25769
- case 12:
25770
- case "end":
25771
- return _context2.stop();
25772
- }
25773
- }
25774
- }, _callee2);
25775
- }));
25776
-
25777
- function validator(_x2, _x3, _x4) {
25778
- return _validator.apply(this, arguments);
25779
- }
25780
-
25781
- return validator;
25782
- }()
25783
- }])
25896
+ required: isValidateGood,
25897
+ message: '项目名称不能为空'
25898
+ } // {
25899
+ // validator: async (_, __, callback) => {
25900
+ // if (isValidateGood) {
25901
+ // await controller.wait();
25902
+ // const value = controller.state.goodsListState.editGood;
25903
+ // if (!value?.itemName && !value?.itemNameSelf) {
25904
+ // callback('项目名称不能为空');
25905
+ // } else {
25906
+ // return;
25907
+ // }
25908
+ // } else {
25909
+ // callback();
25910
+ // }
25911
+ // }
25912
+ // }
25913
+ ])
25784
25914
  })( /*#__PURE__*/React.createElement(ItemNameInput$1, {
25785
25915
  editGood: editGood,
25786
25916
  shorthand: editGood.shorthand,
@@ -25796,22 +25926,22 @@ var useColumns$1 = (function (form) {
25796
25926
  },
25797
25927
  icon: /*#__PURE__*/React.createElement(SvgPlus$2, null),
25798
25928
  onClick: controller.pipeline( /*#__PURE__*/function () {
25799
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
25800
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
25929
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
25930
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
25801
25931
  while (1) {
25802
- switch (_context3.prev = _context3.next) {
25932
+ switch (_context2.prev = _context2.next) {
25803
25933
  case 0:
25804
25934
  s.goodsListState.importGoods.isVisibleDrawer = true;
25805
25935
 
25806
25936
  case 1:
25807
25937
  case "end":
25808
- return _context3.stop();
25938
+ return _context2.stop();
25809
25939
  }
25810
25940
  }
25811
- }, _callee3);
25941
+ }, _callee2);
25812
25942
  }));
25813
25943
 
25814
- return function (_x5) {
25944
+ return function (_x2) {
25815
25945
  return _ref2.apply(this, arguments);
25816
25946
  };
25817
25947
  }())
@@ -25849,13 +25979,13 @@ var useColumns$1 = (function (form) {
25849
25979
  rules: getReplenishRules('itemModelName')
25850
25980
  })( /*#__PURE__*/React.createElement(MyInput$3, {
25851
25981
  onChange: function () {
25852
- var _onChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
25982
+ var _onChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
25853
25983
  var key, value;
25854
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
25984
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
25855
25985
  while (1) {
25856
- switch (_context4.prev = _context4.next) {
25986
+ switch (_context3.prev = _context3.next) {
25857
25987
  case 0:
25858
- _context4.next = 2;
25988
+ _context3.next = 2;
25859
25989
  return controller.wait();
25860
25990
 
25861
25991
  case 2:
@@ -25866,10 +25996,10 @@ var useColumns$1 = (function (form) {
25866
25996
 
25867
25997
  case 6:
25868
25998
  case "end":
25869
- return _context4.stop();
25999
+ return _context3.stop();
25870
26000
  }
25871
26001
  }
25872
- }, _callee4);
26002
+ }, _callee3);
25873
26003
  }));
25874
26004
 
25875
26005
  function onChange() {
@@ -25907,12 +26037,12 @@ var useColumns$1 = (function (form) {
25907
26037
  return rootElement || document.body;
25908
26038
  },
25909
26039
  onChange: function () {
25910
- var _onChange2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
25911
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
26040
+ var _onChange2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
26041
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
25912
26042
  while (1) {
25913
- switch (_context5.prev = _context5.next) {
26043
+ switch (_context4.prev = _context4.next) {
25914
26044
  case 0:
25915
- _context5.next = 2;
26045
+ _context4.next = 2;
25916
26046
  return controller.wait();
25917
26047
 
25918
26048
  case 2:
@@ -25922,10 +26052,10 @@ var useColumns$1 = (function (form) {
25922
26052
 
25923
26053
  case 3:
25924
26054
  case "end":
25925
- return _context5.stop();
26055
+ return _context4.stop();
25926
26056
  }
25927
26057
  }
25928
- }, _callee5);
26058
+ }, _callee4);
25929
26059
  }));
25930
26060
 
25931
26061
  function onChange() {
@@ -25961,18 +26091,18 @@ var useColumns$1 = (function (form) {
25961
26091
  message: '数量必须为数字'
25962
26092
  }, {
25963
26093
  validator: function () {
25964
- var _validator2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_, value, callback) {
26094
+ var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_, value, callback) {
25965
26095
  var isvalue, isPrice;
25966
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
26096
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
25967
26097
  while (1) {
25968
- switch (_context6.prev = _context6.next) {
26098
+ switch (_context5.prev = _context5.next) {
25969
26099
  case 0:
25970
26100
  if (!isValidateGood) {
25971
- _context6.next = 10;
26101
+ _context5.next = 10;
25972
26102
  break;
25973
26103
  }
25974
26104
 
25975
- _context6.next = 3;
26105
+ _context5.next = 3;
25976
26106
  return controller.wait();
25977
26107
 
25978
26108
  case 3:
@@ -25980,15 +26110,15 @@ var useColumns$1 = (function (form) {
25980
26110
  isPrice = !!getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') || getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') === 0;
25981
26111
 
25982
26112
  if (!(isvalue || isPrice === isvalue)) {
25983
- _context6.next = 7;
26113
+ _context5.next = 7;
25984
26114
  break;
25985
26115
  }
25986
26116
 
25987
- return _context6.abrupt("return");
26117
+ return _context5.abrupt("return");
25988
26118
 
25989
26119
  case 7:
25990
26120
  callback('请输入数量');
25991
- _context6.next = 11;
26121
+ _context5.next = 11;
25992
26122
  break;
25993
26123
 
25994
26124
  case 10:
@@ -25996,14 +26126,14 @@ var useColumns$1 = (function (form) {
25996
26126
 
25997
26127
  case 11:
25998
26128
  case "end":
25999
- return _context6.stop();
26129
+ return _context5.stop();
26000
26130
  }
26001
26131
  }
26002
- }, _callee6);
26132
+ }, _callee5);
26003
26133
  }));
26004
26134
 
26005
- function validator(_x6, _x7, _x8) {
26006
- return _validator2.apply(this, arguments);
26135
+ function validator(_x3, _x4, _x5) {
26136
+ return _validator.apply(this, arguments);
26007
26137
  }
26008
26138
 
26009
26139
  return validator;
@@ -26016,21 +26146,21 @@ var useColumns$1 = (function (form) {
26016
26146
  maxLength: 25,
26017
26147
  loading: isCipher$1(changeField, "quantity"),
26018
26148
  onChange: function () {
26019
- var _onChange3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
26020
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
26149
+ var _onChange3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
26150
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
26021
26151
  while (1) {
26022
- switch (_context7.prev = _context7.next) {
26152
+ switch (_context6.prev = _context6.next) {
26023
26153
  case 0:
26024
26154
  setChangeField('quantity');
26025
- _context7.next = 3;
26155
+ _context6.next = 3;
26026
26156
  return onChangeQuantity$1(controller, form, record);
26027
26157
 
26028
26158
  case 3:
26029
26159
  case "end":
26030
- return _context7.stop();
26160
+ return _context6.stop();
26031
26161
  }
26032
26162
  }
26033
- }, _callee7);
26163
+ }, _callee6);
26034
26164
  }));
26035
26165
 
26036
26166
  function onChange() {
@@ -26066,13 +26196,13 @@ var useColumns$1 = (function (form) {
26066
26196
  message: '单价必须为数字'
26067
26197
  }, {
26068
26198
  validator: function () {
26069
- var _validator3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_, value, callback) {
26199
+ var _validator2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_, value, callback) {
26070
26200
  var isQuantity, isvalue;
26071
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
26201
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
26072
26202
  while (1) {
26073
- switch (_context8.prev = _context8.next) {
26203
+ switch (_context7.prev = _context7.next) {
26074
26204
  case 0:
26075
- _context8.next = 2;
26205
+ _context7.next = 2;
26076
26206
  return controller.wait();
26077
26207
 
26078
26208
  case 2:
@@ -26080,25 +26210,25 @@ var useColumns$1 = (function (form) {
26080
26210
  isvalue = !!value || value === 0;
26081
26211
 
26082
26212
  if (!(isvalue || isQuantity === isvalue)) {
26083
- _context8.next = 6;
26213
+ _context7.next = 6;
26084
26214
  break;
26085
26215
  }
26086
26216
 
26087
- return _context8.abrupt("return");
26217
+ return _context7.abrupt("return");
26088
26218
 
26089
26219
  case 6:
26090
26220
  callback('请输入单价');
26091
26221
 
26092
26222
  case 7:
26093
26223
  case "end":
26094
- return _context8.stop();
26224
+ return _context7.stop();
26095
26225
  }
26096
26226
  }
26097
- }, _callee8);
26227
+ }, _callee7);
26098
26228
  }));
26099
26229
 
26100
- function validator(_x9, _x10, _x11) {
26101
- return _validator3.apply(this, arguments);
26230
+ function validator(_x6, _x7, _x8) {
26231
+ return _validator2.apply(this, arguments);
26102
26232
  }
26103
26233
 
26104
26234
  return validator;
@@ -26109,6 +26239,7 @@ var useColumns$1 = (function (form) {
26109
26239
  textAlign: 'right'
26110
26240
  },
26111
26241
  maxLength: 25,
26242
+ disabled: differenceInputStateEnabled,
26112
26243
  loading: isCipher$1(changeField, 'priceIncludeTax'),
26113
26244
  onChange: function onChange() {
26114
26245
  setChangeField('priceIncludeTax');
@@ -26141,13 +26272,13 @@ var useColumns$1 = (function (form) {
26141
26272
  message: '单价必须为数字'
26142
26273
  }, {
26143
26274
  validator: function () {
26144
- var _validator4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_, value, callback) {
26275
+ var _validator3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_, value, callback) {
26145
26276
  var isQuantity, isvalue;
26146
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
26277
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
26147
26278
  while (1) {
26148
- switch (_context9.prev = _context9.next) {
26279
+ switch (_context8.prev = _context8.next) {
26149
26280
  case 0:
26150
- _context9.next = 2;
26281
+ _context8.next = 2;
26151
26282
  return controller.wait();
26152
26283
 
26153
26284
  case 2:
@@ -26155,25 +26286,25 @@ var useColumns$1 = (function (form) {
26155
26286
  isvalue = !!value || value === 0;
26156
26287
 
26157
26288
  if (!(isvalue || isQuantity === isvalue)) {
26158
- _context9.next = 6;
26289
+ _context8.next = 6;
26159
26290
  break;
26160
26291
  }
26161
26292
 
26162
- return _context9.abrupt("return");
26293
+ return _context8.abrupt("return");
26163
26294
 
26164
26295
  case 6:
26165
26296
  callback('请输入单价');
26166
26297
 
26167
26298
  case 7:
26168
26299
  case "end":
26169
- return _context9.stop();
26300
+ return _context8.stop();
26170
26301
  }
26171
26302
  }
26172
- }, _callee9);
26303
+ }, _callee8);
26173
26304
  }));
26174
26305
 
26175
- function validator(_x12, _x13, _x14) {
26176
- return _validator4.apply(this, arguments);
26306
+ function validator(_x9, _x10, _x11) {
26307
+ return _validator3.apply(this, arguments);
26177
26308
  }
26178
26309
 
26179
26310
  return validator;
@@ -26184,6 +26315,7 @@ var useColumns$1 = (function (form) {
26184
26315
  textAlign: 'right'
26185
26316
  },
26186
26317
  maxLength: 25,
26318
+ disabled: differenceInputStateEnabled,
26187
26319
  loading: isCipher$1(changeField, 'priceExcludeTax'),
26188
26320
  onChange: function onChange() {
26189
26321
  setChangeField('priceExcludeTax');
@@ -26219,10 +26351,10 @@ var useColumns$1 = (function (form) {
26219
26351
  message: '金额错误,请重新输入'
26220
26352
  }, {
26221
26353
  validator: function () {
26222
- var _validator5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_, value, callback) {
26223
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
26354
+ var _validator4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_, value, callback) {
26355
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
26224
26356
  while (1) {
26225
- switch (_context10.prev = _context10.next) {
26357
+ switch (_context9.prev = _context9.next) {
26226
26358
  case 0:
26227
26359
  if ("".concat(value).split('.')[0].length > priceIntegerDigit) {
26228
26360
  callback("\u91D1\u989D\u6574\u6570\u90E8\u5206\u4E0D\u80FD\u5927\u4E8E".concat(priceIntegerDigit, "\u4F4D\uFF0C\u5C0F\u6570\u70B9\u540E\u6700\u591A2\u4F4D"));
@@ -26230,24 +26362,24 @@ var useColumns$1 = (function (form) {
26230
26362
 
26231
26363
  case 1:
26232
26364
  case "end":
26233
- return _context10.stop();
26365
+ return _context9.stop();
26234
26366
  }
26235
26367
  }
26236
- }, _callee10);
26368
+ }, _callee9);
26237
26369
  }));
26238
26370
 
26239
- function validator(_x15, _x16, _x17) {
26240
- return _validator5.apply(this, arguments);
26371
+ function validator(_x12, _x13, _x14) {
26372
+ return _validator4.apply(this, arguments);
26241
26373
  }
26242
26374
 
26243
26375
  return validator;
26244
26376
  }()
26245
26377
  }, {
26246
26378
  validator: function () {
26247
- var _validator6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_, value, callback) {
26248
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
26379
+ var _validator5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_, value, callback) {
26380
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
26249
26381
  while (1) {
26250
- switch (_context11.prev = _context11.next) {
26382
+ switch (_context10.prev = _context10.next) {
26251
26383
  case 0:
26252
26384
  if (deduction && parseFloat(value) <= deduction) {
26253
26385
  callback('扣除额不能大于等于价税合计');
@@ -26255,14 +26387,14 @@ var useColumns$1 = (function (form) {
26255
26387
 
26256
26388
  case 1:
26257
26389
  case "end":
26258
- return _context11.stop();
26390
+ return _context10.stop();
26259
26391
  }
26260
26392
  }
26261
- }, _callee11);
26393
+ }, _callee10);
26262
26394
  }));
26263
26395
 
26264
- function validator(_x18, _x19, _x20) {
26265
- return _validator6.apply(this, arguments);
26396
+ function validator(_x15, _x16, _x17) {
26397
+ return _validator5.apply(this, arguments);
26266
26398
  }
26267
26399
 
26268
26400
  return validator;
@@ -26273,10 +26405,33 @@ var useColumns$1 = (function (form) {
26273
26405
  textAlign: 'right'
26274
26406
  },
26275
26407
  loading: isCipher$1(changeField, 'lineAmountIncludeTax'),
26408
+ readOnly: differenceInputStateEnabled,
26276
26409
  onChange: function onChange() {
26277
26410
  setChangeField('lineAmountIncludeTax');
26278
26411
  onChangeLineAmountIncludeTax$1(controller, form, record);
26279
- }
26412
+ },
26413
+ onClick: differenceInputStateEnabled ? function () {
26414
+ controller.run( /*#__PURE__*/function () {
26415
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(s) {
26416
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
26417
+ while (1) {
26418
+ switch (_context11.prev = _context11.next) {
26419
+ case 0:
26420
+ s.differenceInputState.open = true;
26421
+
26422
+ case 1:
26423
+ case "end":
26424
+ return _context11.stop();
26425
+ }
26426
+ }
26427
+ }, _callee11);
26428
+ }));
26429
+
26430
+ return function (_x18) {
26431
+ return _ref3.apply(this, arguments);
26432
+ };
26433
+ }());
26434
+ } : undefined
26280
26435
  })));
26281
26436
  } else {
26282
26437
  return /*#__PURE__*/React.createElement("span", {
@@ -26307,7 +26462,7 @@ var useColumns$1 = (function (form) {
26307
26462
  message: '金额错误,请重新输入'
26308
26463
  }, {
26309
26464
  validator: function () {
26310
- var _validator7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_, value, callback) {
26465
+ var _validator6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_, value, callback) {
26311
26466
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
26312
26467
  while (1) {
26313
26468
  switch (_context12.prev = _context12.next) {
@@ -26324,8 +26479,8 @@ var useColumns$1 = (function (form) {
26324
26479
  }, _callee12);
26325
26480
  }));
26326
26481
 
26327
- function validator(_x21, _x22, _x23) {
26328
- return _validator7.apply(this, arguments);
26482
+ function validator(_x19, _x20, _x21) {
26483
+ return _validator6.apply(this, arguments);
26329
26484
  }
26330
26485
 
26331
26486
  return validator;
@@ -26336,10 +26491,33 @@ var useColumns$1 = (function (form) {
26336
26491
  textAlign: 'right'
26337
26492
  },
26338
26493
  loading: isCipher$1(changeField, 'lineAmountExcludeTax'),
26494
+ readOnly: differenceInputStateEnabled,
26339
26495
  onChange: function onChange() {
26340
26496
  setChangeField('lineAmountExcludeTax');
26341
26497
  onChangeLineAmountExcludeTax$1(controller, form, record);
26342
- }
26498
+ },
26499
+ onClick: differenceInputStateEnabled ? function () {
26500
+ controller.run( /*#__PURE__*/function () {
26501
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(s) {
26502
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
26503
+ while (1) {
26504
+ switch (_context13.prev = _context13.next) {
26505
+ case 0:
26506
+ s.differenceInputState.open = true;
26507
+
26508
+ case 1:
26509
+ case "end":
26510
+ return _context13.stop();
26511
+ }
26512
+ }
26513
+ }, _callee13);
26514
+ }));
26515
+
26516
+ return function (_x22) {
26517
+ return _ref4.apply(this, arguments);
26518
+ };
26519
+ }());
26520
+ } : undefined
26343
26521
  })));
26344
26522
  } else {
26345
26523
  return /*#__PURE__*/React.createElement("span", {
@@ -26421,12 +26599,12 @@ var useColumns$1 = (function (form) {
26421
26599
  var lineAmountIncludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax) || 0; //不含税金额
26422
26600
  // const lineAmountExcludeTax = lineAmountIncludeTax-value;
26423
26601
 
26602
+ var deduction = controller.state.goodsListState.deduction || 0;
26424
26603
  var lineAmountExcludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountExcludeTax) || 0;
26425
26604
  var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
26426
26605
 
26427
26606
  if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
26428
- // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
26429
- var total = chain$1(bignumber(lineAmountExcludeTax)).multiply(bignumber(taxRate || 0)).divide(bignumber(100)); // if (Number(Math.abs(Number(total) - Number(value)).toFixed(4)) <= 0.01) {
26607
+ var total = chain$1(bignumber(lineAmountExcludeTax)).subtract(bignumber(deduction || 0)).multiply(bignumber(taxRate || 0)).divide(bignumber(100));
26430
26608
 
26431
26609
  if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.06) {
26432
26610
  callback();
@@ -26488,7 +26666,7 @@ var useColumns$1 = (function (form) {
26488
26666
  ellipsis: true
26489
26667
  });
26490
26668
  });
26491
- }, [isTaxIncluded, editGood, controller, taxRateList, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, isStart, calculateType]); // React.useEffect(() => {
26669
+ }, [isTaxIncluded, editGood, controller, taxRateList, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, isStart, calculateType, differenceInputStateEnabled]); // React.useEffect(() => {
26492
26670
  // clearTimeout(t)
26493
26671
  // const t = setTimeout(() => { setChangeField('') }, 1000);
26494
26672
  // return () => { clearTimeout(t) }
@@ -26817,6 +26995,9 @@ function useWindowClick$1(controller) {
26817
26995
  /** 点击组件外部 保存正在编辑的货物 */
26818
26996
  React.useEffect(function () {
26819
26997
  var click = function click() {
26998
+ var _controller$state$goo;
26999
+
27000
+ if (!((_controller$state$goo = controller.state.goodsListState) === null || _controller$state$goo === void 0 ? void 0 : _controller$state$goo.isSaveRowOutside)) return;
26820
27001
  setTimeout(controller.saveEditGood);
26821
27002
  };
26822
27003
 
@@ -33844,6 +34025,7 @@ var DrawerBody$4 = function DrawerBody(props) {
33844
34025
 
33845
34026
 
33846
34027
  var onSubmit = React.useCallback(function (values) {
34028
+ console.log('天开组件', '点击了赋码确定按钮 ===>', values);
33847
34029
  controller.pipeline( /*#__PURE__*/function () {
33848
34030
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
33849
34031
  var endowCodeGood;
@@ -33851,8 +34033,11 @@ var DrawerBody$4 = function DrawerBody(props) {
33851
34033
  while (1) {
33852
34034
  switch (_context15.prev = _context15.next) {
33853
34035
  case 0:
34036
+ // const endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(e => s.goodsListState.goodsMap.get(e));
33854
34037
  endowCodeGood = s.goodsListState.endowCode.endowcodeGoodIndex.map(function (e) {
33855
- return s.goodsListState.goodsMap.get(e);
34038
+ return s.goodsListState.goodsList.find(function (item) {
34039
+ return item.$index === e;
34040
+ });
33856
34041
  }); // 赋码
33857
34042
 
33858
34043
  endowCodeGood.forEach(function (good) {
@@ -33866,7 +34051,7 @@ var DrawerBody$4 = function DrawerBody(props) {
33866
34051
  good.mtzlDm = undefined; //设置成空
33867
34052
  // 无论是否含税,都保持价税合计不变
33868
34053
 
33869
- good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
34054
+ good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction || 0, values.taxRate);
33870
34055
 
33871
34056
  if (good.taxAmount || good.taxAmount === 0) {
33872
34057
  good.lineAmountExcludeTax = countAmountExcludeTax(good.lineAmountIncludeTax || 0, good.taxAmount);
@@ -36952,9 +37137,50 @@ var VoucherType;
36952
37137
 
36953
37138
  VoucherType["OTHER_DEDUCTION_VOUCHER"] = "09";
36954
37139
  })(VoucherType || (VoucherType = {}));
36955
- /** 凭证类型候选项 */
37140
+ /** 最多只允许输入两位小数的校验器 */
36956
37141
 
36957
37142
 
37143
+ var maxTwoDecimalsValidator = function maxTwoDecimalsValidator(_rule, value) {
37144
+ if (value === undefined || value === null || value === '') {
37145
+ return Promise.resolve();
37146
+ }
37147
+
37148
+ var decimalPart = String(value).split('.')[1];
37149
+
37150
+ if (decimalPart && decimalPart.length > 2) {
37151
+ return Promise.reject(new Error('最多只能输入2位小数'));
37152
+ }
37153
+
37154
+ return Promise.resolve();
37155
+ };
37156
+ /** 凭证明细表单实例(用于跨字段校验:本次扣除金额 <= 凭证合计金额) */
37157
+
37158
+ var formInstance;
37159
+ /**
37160
+ * 本次扣除金额不能大于凭证合计金额的校验器
37161
+ */
37162
+
37163
+ var deductAmtNotExceedVoucherTotalValidator = function deductAmtNotExceedVoucherTotalValidator(_rule, value) {
37164
+ var _formInstance;
37165
+
37166
+ if (value === undefined || value === null || value === '') {
37167
+ return Promise.resolve();
37168
+ }
37169
+
37170
+ var voucherTotalAmt = (_formInstance = formInstance) === null || _formInstance === void 0 ? void 0 : _formInstance.getFieldValue('voucherTotalAmt');
37171
+
37172
+ if (voucherTotalAmt === undefined || voucherTotalAmt === null || voucherTotalAmt === '') {
37173
+ return Promise.resolve();
37174
+ }
37175
+
37176
+ if (Number(value) > Number(voucherTotalAmt)) {
37177
+ return Promise.reject(new Error('本次扣除金额不能大于凭证合计金额'));
37178
+ }
37179
+
37180
+ return Promise.resolve();
37181
+ };
37182
+ /** 凭证类型候选项 */
37183
+
36958
37184
  var voucherTypeOptions = [{
36959
37185
  value: VoucherType.SPECIAL_INVOICE,
36960
37186
  label: '专用发票'
@@ -37138,19 +37364,36 @@ function DifferenceInputModal(props) {
37138
37364
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
37139
37365
  form = _Form$useForm2[0];
37140
37366
 
37367
+ var _Form$useForm3 = Form$2.useForm(),
37368
+ _Form$useForm4 = _slicedToArray(_Form$useForm3, 1),
37369
+ topForm = _Form$useForm4[0];
37370
+ /** 记录表单实例,供跨字段校验使用 */
37371
+
37372
+
37373
+ React.useEffect(function () {
37374
+ formInstance = form;
37375
+ return function () {
37376
+ formInstance = undefined;
37377
+ };
37378
+ }, [form]);
37379
+
37141
37380
  var _React$useState = React.useState([]),
37142
37381
  _React$useState2 = _slicedToArray(_React$useState, 2),
37143
37382
  dataSource = _React$useState2[0],
37144
37383
  setDataSource = _React$useState2[1];
37145
37384
 
37146
37385
  var voucherType = Form$2.useWatch('voucherType', form) || form.getFieldValue('voucherType');
37386
+ var projectCode = Form$2.useWatch('projectCode', topForm) || topForm.getFieldValue('projectCode');
37387
+ /** 凭证合计金额(用于联动校验本次扣除金额) */
37147
37388
 
37148
- var _React$useState3 = React.useState(''),
37149
- _React$useState4 = _slicedToArray(_React$useState3, 2),
37150
- projectCode = _React$useState4[0],
37151
- setProjectCode = _React$useState4[1];
37152
- /** 扣除额 (明细汇总) */
37389
+ var voucherTotalAmt = Form$2.useWatch('voucherTotalAmt', form);
37390
+ /** 凭证合计金额变化时,重新校验本次扣除金额 */
37153
37391
 
37392
+ React.useEffect(function () {
37393
+ if (!form.isFieldTouched('currentDeductAmt')) return;
37394
+ form.validateFields(['currentDeductAmt']).catch(function () {});
37395
+ }, [form, voucherTotalAmt]);
37396
+ /** 扣除额 (明细汇总) */
37154
37397
 
37155
37398
  var deductTotal = React.useMemo(function () {
37156
37399
  return dataSource.reduce(function (acc, curr) {
@@ -37165,8 +37408,8 @@ function DifferenceInputModal(props) {
37165
37408
  }, 0);
37166
37409
  }, [dataSource]);
37167
37410
  var total = props.total || {
37168
- voucherTotal: 0,
37169
- deductTotal: 0
37411
+ voucherTotal: voucherTotal,
37412
+ deductTotal: deductTotal
37170
37413
  };
37171
37414
  var onFinish = React.useCallback(function (values) {
37172
37415
  setDataSource([].concat(_toConsumableArray(dataSource), [_objectSpread2(_objectSpread2({}, values), {}, {
@@ -37175,15 +37418,42 @@ function DifferenceInputModal(props) {
37175
37418
  })]));
37176
37419
  form.resetFields();
37177
37420
  }, [dataSource, form]);
37421
+ var onOkClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
37422
+ var values;
37423
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
37424
+ while (1) {
37425
+ switch (_context.prev = _context.next) {
37426
+ case 0:
37427
+ _context.next = 2;
37428
+ return topForm.validateFields();
37429
+
37430
+ case 2:
37431
+ values = _context.sent;
37432
+ onOk === null || onOk === void 0 ? void 0 : onOk(_objectSpread2(_objectSpread2({}, values), {}, {
37433
+ deductTotal: deductTotal,
37434
+ rows: dataSource
37435
+ }));
37436
+
37437
+ case 4:
37438
+ case "end":
37439
+ return _context.stop();
37440
+ }
37441
+ }
37442
+ }, _callee);
37443
+ })), [dataSource, onOk]);
37178
37444
  React.useEffect(function () {
37179
37445
  console.log('DifferenceInputModal props.value ===>', props.value);
37180
37446
 
37181
37447
  if (open) {
37182
- var _props$value, _props$value2;
37448
+ var _props$value, _props$value2, _props$value3;
37183
37449
 
37184
37450
  form.resetFields();
37185
- setDataSource(((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.rows) || []);
37186
- setProjectCode(((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.projectCode) || '');
37451
+ topForm.resetFields();
37452
+ topForm.setFieldsValue({
37453
+ amountIncludeTax: (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.amountIncludeTax,
37454
+ projectCode: (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.projectCode
37455
+ });
37456
+ setDataSource(((_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.rows) || []);
37187
37457
  }
37188
37458
  }, [open, props.value]);
37189
37459
  return /*#__PURE__*/React.createElement(Modal$2, {
@@ -37199,20 +37469,14 @@ function DifferenceInputModal(props) {
37199
37469
  onClick: onCancel
37200
37470
  }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button$1, {
37201
37471
  type: "primary",
37202
- onClick: function onClick() {
37203
- return onOk === null || onOk === void 0 ? void 0 : onOk({
37204
- voucherTotal: voucherTotal,
37205
- deductTotal: deductTotal,
37206
- rows: dataSource,
37207
- projectCode: projectCode
37208
- });
37209
- }
37472
+ onClick: onOkClick
37210
37473
  }, "\u786E\u5B9A"))
37211
37474
  }, /*#__PURE__*/React.createElement("div", {
37212
37475
  className: "kts-difference-modal"
37213
37476
  }, /*#__PURE__*/React.createElement("div", {
37214
37477
  className: "kts-difference-modal-top"
37215
37478
  }, /*#__PURE__*/React.createElement(Form$2, {
37479
+ form: topForm,
37216
37480
  layout: 'horizontal',
37217
37481
  className: "kts-difference-modal-top-form",
37218
37482
  labelCol: {
@@ -37221,15 +37485,20 @@ function DifferenceInputModal(props) {
37221
37485
  }, /*#__PURE__*/React.createElement(Row$1, null, /*#__PURE__*/React.createElement(Col$1, {
37222
37486
  span: 12
37223
37487
  }, /*#__PURE__*/React.createElement(Form$2.Item, {
37488
+ name: 'amountIncludeTax',
37224
37489
  label: "\u542B\u7A0E\u9500\u552E\u989D",
37225
- className: "kts-difference-modal-item"
37490
+ className: "kts-difference-modal-item",
37491
+ rules: [{
37492
+ required: true,
37493
+ message: '请输入含税销售额'
37494
+ }, {
37495
+ validator: maxTwoDecimalsValidator
37496
+ }]
37226
37497
  }, /*#__PURE__*/React.createElement(InputNumber$1, {
37227
37498
  style: {
37228
37499
  width: '100%'
37229
37500
  },
37230
- disabled: true,
37231
- placeholder: "\u8BF7\u8F93\u5165\u542B\u7A0E\u9500\u552E\u989D",
37232
- value: voucherTotal || 0
37501
+ placeholder: "\u8BF7\u8F93\u5165\u542B\u7A0E\u9500\u552E\u989D"
37233
37502
  }))), /*#__PURE__*/React.createElement(Col$1, {
37234
37503
  span: 12
37235
37504
  }, /*#__PURE__*/React.createElement(Form$2.Item, {
@@ -37245,15 +37514,16 @@ function DifferenceInputModal(props) {
37245
37514
  }))), /*#__PURE__*/React.createElement(Col$1, {
37246
37515
  span: 24
37247
37516
  }, /*#__PURE__*/React.createElement(Form$2.Item, {
37517
+ name: 'projectCode',
37248
37518
  label: "\u7533\u62A5\u9879\u76EE\u540D\u79F0",
37249
- className: "kts-difference-modal-item"
37519
+ className: "kts-difference-modal-item",
37520
+ rules: [{
37521
+ required: true,
37522
+ message: '请选择申报项目名称'
37523
+ }]
37250
37524
  }, /*#__PURE__*/React.createElement(Select$2, {
37251
37525
  options: projectOptions,
37252
- placeholder: "\u8BF7\u9009\u62E9\u7533\u62A5\u9879\u76EE\u540D\u79F0",
37253
- onChange: function onChange(value) {
37254
- setProjectCode(value);
37255
- },
37256
- value: projectCode
37526
+ placeholder: "\u8BF7\u9009\u62E9\u7533\u62A5\u9879\u76EE\u540D\u79F0"
37257
37527
  }))), /*#__PURE__*/React.createElement(Col$1, {
37258
37528
  span: 24
37259
37529
  }, /*#__PURE__*/React.createElement(Form$2.Item, {
@@ -37337,7 +37607,9 @@ function DifferenceInputModal(props) {
37337
37607
  name: 'voucherTotalAmt',
37338
37608
  label: "\u51ED\u8BC1\u5408\u8BA1\u91D1\u989D",
37339
37609
  className: "kts-difference-modal-cell",
37340
- rules: (_voucherTypeRules$vou4 = voucherTypeRules[voucherType]) === null || _voucherTypeRules$vou4 === void 0 ? void 0 : _voucherTypeRules$vou4['voucherTotalAmt']
37610
+ rules: [].concat(_toConsumableArray(((_voucherTypeRules$vou4 = voucherTypeRules[voucherType]) === null || _voucherTypeRules$vou4 === void 0 ? void 0 : _voucherTypeRules$vou4['voucherTotalAmt']) || []), [{
37611
+ validator: maxTwoDecimalsValidator
37612
+ }])
37341
37613
  }, /*#__PURE__*/React.createElement(InputNumber$1, {
37342
37614
  style: {
37343
37615
  width: '100%'
@@ -37349,7 +37621,11 @@ function DifferenceInputModal(props) {
37349
37621
  name: 'currentDeductAmt',
37350
37622
  label: "\u672C\u6B21\u6263\u9664\u91D1\u989D",
37351
37623
  className: "kts-difference-modal-cell",
37352
- rules: (_voucherTypeRules$vou5 = voucherTypeRules[voucherType]) === null || _voucherTypeRules$vou5 === void 0 ? void 0 : _voucherTypeRules$vou5['currentDeductAmt']
37624
+ rules: [].concat(_toConsumableArray(((_voucherTypeRules$vou5 = voucherTypeRules[voucherType]) === null || _voucherTypeRules$vou5 === void 0 ? void 0 : _voucherTypeRules$vou5['currentDeductAmt']) || []), [{
37625
+ validator: maxTwoDecimalsValidator
37626
+ }, {
37627
+ validator: deductAmtNotExceedVoucherTotalValidator
37628
+ }])
37353
37629
  }, /*#__PURE__*/React.createElement(InputNumber$1, {
37354
37630
  style: {
37355
37631
  width: '100%'
@@ -37378,7 +37654,7 @@ function DifferenceInputModal(props) {
37378
37654
  onClick: function onClick() {
37379
37655
  return form.resetFields();
37380
37656
  }
37381
- }, "\u6E05\u695A"), /*#__PURE__*/React.createElement(Button$1, {
37657
+ }, "\u6E05\u9664"), /*#__PURE__*/React.createElement(Button$1, {
37382
37658
  type: 'primary',
37383
37659
  size: 'small',
37384
37660
  onClick: function onClick() {
@@ -37440,64 +37716,193 @@ var DifferenceInput = (function () {
37440
37716
  var data = controller.useMemo(function (s) {
37441
37717
  return s.differenceInputState.data;
37442
37718
  }, []);
37719
+ /** 计算中启动字段 */
37720
+
37721
+ var setChangeField = React.useCallback(function (value) {
37722
+ return controller.run( /*#__PURE__*/function () {
37723
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
37724
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
37725
+ while (1) {
37726
+ switch (_context.prev = _context.next) {
37727
+ case 0:
37728
+ s.calculatingField = value;
37729
+
37730
+ case 1:
37731
+ case "end":
37732
+ return _context.stop();
37733
+ }
37734
+ }
37735
+ }, _callee);
37736
+ }));
37737
+
37738
+ return function (_x) {
37739
+ return _ref.apply(this, arguments);
37740
+ };
37741
+ }());
37742
+ }, []);
37443
37743
  var value = React.useMemo(function () {
37744
+ var _controller$state$goo;
37745
+
37444
37746
  return {
37445
37747
  rows: (data === null || data === void 0 ? void 0 : data.rows) || [],
37446
37748
  projectCode: (data === null || data === void 0 ? void 0 : data.projectCode) || '',
37447
- voucherTotal: (data === null || data === void 0 ? void 0 : data.voucherTotal) || 0,
37448
- deductTotal: (data === null || data === void 0 ? void 0 : data.deductTotal) || 0
37749
+ deductTotal: (data === null || data === void 0 ? void 0 : data.deductTotal) || 0,
37750
+ amountIncludeTax: ((_controller$state$goo = controller.state.goodsListState.form) === null || _controller$state$goo === void 0 ? void 0 : _controller$state$goo.getFieldValue('lineAmountIncludeTax')) || 0
37449
37751
  };
37450
37752
  }, [data, open]);
37451
- console.log('DifferenceInput data ===>', data);
37452
- return /*#__PURE__*/React.createElement(DifferenceInputModal, {
37453
- value: value,
37454
- open: open,
37455
- onCancel: function onCancel() {
37753
+ React.useEffect(function () {
37754
+ controller.state.goodsListState.isSaveRowOutside = !open;
37755
+
37756
+ if (open) {
37456
37757
  controller.run( /*#__PURE__*/function () {
37457
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
37458
- return _regeneratorRuntime().wrap(function _callee$(_context) {
37758
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
37759
+ var _s$goodsListState$for;
37760
+
37761
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
37459
37762
  while (1) {
37460
- switch (_context.prev = _context.next) {
37763
+ switch (_context2.prev = _context2.next) {
37461
37764
  case 0:
37462
- s.differenceInputState.open = false;
37765
+ if (s.differenceInputState.data) {
37766
+ _context2.next = 2;
37767
+ break;
37768
+ }
37463
37769
 
37464
- case 1:
37770
+ return _context2.abrupt("return");
37771
+
37772
+ case 2:
37773
+ s.differenceInputState.data.amountIncludeTax = (_s$goodsListState$for = s.goodsListState.form) === null || _s$goodsListState$for === void 0 ? void 0 : _s$goodsListState$for.getFieldValue('lineAmountIncludeTax');
37774
+
37775
+ case 3:
37465
37776
  case "end":
37466
- return _context.stop();
37777
+ return _context2.stop();
37467
37778
  }
37468
37779
  }
37469
- }, _callee);
37780
+ }, _callee2);
37470
37781
  }));
37471
37782
 
37472
- return function (_x) {
37473
- return _ref.apply(this, arguments);
37783
+ return function (_x2) {
37784
+ return _ref2.apply(this, arguments);
37474
37785
  };
37475
37786
  }());
37476
- },
37477
- onOk: function onOk(data) {
37787
+ }
37788
+ }, [open]);
37789
+ console.log('DifferenceInput data ===>', data);
37790
+ return /*#__PURE__*/React.createElement(DifferenceInputModal, {
37791
+ value: value,
37792
+ open: open,
37793
+ onCancel: function onCancel() {
37478
37794
  controller.run( /*#__PURE__*/function () {
37479
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
37480
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
37795
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
37796
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
37481
37797
  while (1) {
37482
- switch (_context2.prev = _context2.next) {
37798
+ switch (_context3.prev = _context3.next) {
37483
37799
  case 0:
37484
- s.differenceInputState.data = data;
37485
- s.goodsListState.deduction = data.deductTotal;
37486
37800
  s.differenceInputState.open = false;
37487
37801
 
37488
- case 3:
37802
+ case 1:
37489
37803
  case "end":
37490
- return _context2.stop();
37804
+ return _context3.stop();
37491
37805
  }
37492
37806
  }
37493
- }, _callee2);
37807
+ }, _callee3);
37494
37808
  }));
37495
37809
 
37496
- return function (_x2) {
37497
- return _ref2.apply(this, arguments);
37810
+ return function (_x3) {
37811
+ return _ref3.apply(this, arguments);
37498
37812
  };
37499
37813
  }());
37500
- }
37814
+ },
37815
+ onOk: function () {
37816
+ var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(data) {
37817
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
37818
+ while (1) {
37819
+ switch (_context6.prev = _context6.next) {
37820
+ case 0:
37821
+ _context6.next = 2;
37822
+ return controller.run( /*#__PURE__*/function () {
37823
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(s) {
37824
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
37825
+ while (1) {
37826
+ switch (_context4.prev = _context4.next) {
37827
+ case 0:
37828
+ s.goodsListState.isTaxIncluded = true;
37829
+
37830
+ case 1:
37831
+ case "end":
37832
+ return _context4.stop();
37833
+ }
37834
+ }
37835
+ }, _callee4);
37836
+ }));
37837
+
37838
+ return function (_x5) {
37839
+ return _ref4.apply(this, arguments);
37840
+ };
37841
+ }());
37842
+
37843
+ case 2:
37844
+ _context6.next = 4;
37845
+ return controller.wait();
37846
+
37847
+ case 4:
37848
+ _context6.next = 6;
37849
+ return controller.run( /*#__PURE__*/function () {
37850
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(s) {
37851
+ var amountIncludeTax, form, record, _s$goodsListState$for2;
37852
+
37853
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
37854
+ while (1) {
37855
+ switch (_context5.prev = _context5.next) {
37856
+ case 0:
37857
+ s.differenceInputState.data = data;
37858
+ s.goodsListState.deduction = data.deductTotal;
37859
+ s.differenceInputState.open = false;
37860
+ s.differenceInputState.amountIncludeTax = data.amountIncludeTax;
37861
+ amountIncludeTax = data.amountIncludeTax || 0; // const deductTotal = data.deductTotal || 0;
37862
+
37863
+ form = s.goodsListState.form;
37864
+ record = s.goodsListState.editGood;
37865
+
37866
+ if (!(s.goodsListState.goodsList && s.goodsListState.goodsList.length > 0)) {
37867
+ _context5.next = 13;
37868
+ break;
37869
+ }
37870
+
37871
+ s.goodsListState.editGood = record;
37872
+ (_s$goodsListState$for2 = s.goodsListState.form) === null || _s$goodsListState$for2 === void 0 ? void 0 : _s$goodsListState$for2.setFieldsValue({
37873
+ lineAmountIncludeTax: amountIncludeTax
37874
+ });
37875
+ setChangeField('lineAmountIncludeTax');
37876
+ _context5.next = 13;
37877
+ return onChangeLineAmountIncludeTax(controller, form, record);
37878
+
37879
+ case 13:
37880
+ case "end":
37881
+ return _context5.stop();
37882
+ }
37883
+ }
37884
+ }, _callee5);
37885
+ }));
37886
+
37887
+ return function (_x6) {
37888
+ return _ref5.apply(this, arguments);
37889
+ };
37890
+ }());
37891
+
37892
+ case 6:
37893
+ case "end":
37894
+ return _context6.stop();
37895
+ }
37896
+ }
37897
+ }, _callee6);
37898
+ }));
37899
+
37900
+ function onOk(_x4) {
37901
+ return _onOk.apply(this, arguments);
37902
+ }
37903
+
37904
+ return onOk;
37905
+ }()
37501
37906
  });
37502
37907
  });
37503
37908
 
@@ -37609,7 +38014,8 @@ var Main$7 = function Main(props) {
37609
38014
  key = _React$useState2[0],
37610
38015
  setKey = _React$useState2[1];
37611
38016
 
37612
- useToGenerateId(controller); // useClearGoodsList(controller);
38017
+ useToGenerateId(controller);
38018
+ useRecalculateTax(controller); // useClearGoodsList(controller);
37613
38019
 
37614
38020
  React.useEffect(function () {
37615
38021
  setKey(key + 1);
@@ -37664,7 +38070,8 @@ var Digtal = function Digtal(props) {
37664
38070
  key = _React$useState4[0],
37665
38071
  setKey = _React$useState4[1];
37666
38072
 
37667
- useToGenerateId(controller); // useClearGoodsList(controller);
38073
+ useToGenerateId(controller);
38074
+ useRecalculateTax(controller); // useClearGoodsList(controller);
37668
38075
 
37669
38076
  React.useEffect(function () {
37670
38077
  setKey(key + 1);