kts-component-invoice-operate 3.2.264 → 3.2.266

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 (45) hide show
  1. package/dist/DifferenceInputModal/demo.d.ts +4 -0
  2. package/dist/DifferenceInputModal/index.d.ts +73 -0
  3. package/dist/Invoice/Invoice-digtal/_test/differenceInput/index.d.ts +4 -0
  4. package/dist/Invoice/InvoiceController/InvoiceControllerState/DifferenceInputState/index.d.ts +11 -0
  5. package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +2 -0
  6. package/dist/Invoice/InvoiceController/InvoiceControllerState/index.d.ts +3 -0
  7. package/dist/Invoice/InvoiceController/hooks/index.d.ts +3 -0
  8. package/dist/Invoice/_test/differenceInput/index.d.ts +4 -0
  9. package/dist/Invoice/tools/calculate/index.d.ts +1 -1
  10. package/dist/Invoice/ui/digtal/DifferenceInput/index.d.ts +3 -0
  11. package/dist/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/ItemNameInput/index.d.ts +1 -0
  12. package/dist/index.d.ts +3 -0
  13. package/dist/index.esm.js +1481 -319
  14. package/dist/index.js +1478 -315
  15. package/package.json +1 -1
  16. package/src/DifferenceInputModal/demo.tsx +22 -0
  17. package/src/DifferenceInputModal/index.less +102 -0
  18. package/src/DifferenceInputModal/index.md +5 -0
  19. package/src/DifferenceInputModal/index.tsx +520 -0
  20. package/src/Invoice/Invoice-digtal/_test/differenceInput/index.tsx +31 -0
  21. package/src/Invoice/Invoice-digtal/index.md +12 -9
  22. package/src/Invoice/InvoiceController/InvoiceControllerForm/index.ts +9 -2
  23. package/src/Invoice/InvoiceController/InvoiceControllerState/DifferenceInputState/index.ts +16 -0
  24. package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +3 -0
  25. package/src/Invoice/InvoiceController/InvoiceControllerState/index.ts +4 -0
  26. package/src/Invoice/InvoiceController/fns/saveEditGood.ts +1 -0
  27. package/src/Invoice/InvoiceController/hooks/index.ts +63 -0
  28. package/src/Invoice/_test/differenceInput/index.tsx +25 -0
  29. package/src/Invoice/index.md +3 -0
  30. package/src/Invoice/index.tsx +21 -6
  31. package/src/Invoice/tools/calculate/index.ts +2 -3
  32. package/src/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.ts +2 -1
  33. package/src/Invoice/ui/default/GoodsList/hook/useColumns/index.tsx +19 -6
  34. package/src/Invoice/ui/default/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +8 -2
  35. package/src/Invoice/ui/default/GoodsList/hook/useWindowClick/index.tsx +4 -1
  36. package/src/Invoice/ui/default/GoodsList/index.tsx +1 -1
  37. package/src/Invoice/ui/default/GoodsList/ui/AddRowButton/index.tsx +4 -0
  38. package/src/Invoice/ui/digtal/DifferenceInput/index.tsx +69 -0
  39. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/autoFillFn/index.ts +2 -2
  40. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/index.tsx +34 -21
  41. package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +15 -4
  42. package/src/Invoice/ui/digtal/GoodsList/hook/useWindowClick/index.tsx +4 -1
  43. package/src/Invoice/ui/digtal/GoodsList/ui/AddRowButton/index.tsx +7 -7
  44. package/src/TaxClassificationCodeModal/index.tsx +2 -0
  45. package/src/index.ts +3 -0
package/dist/index.esm.js CHANGED
@@ -4,11 +4,11 @@ import GreyReactBox, { decorator } from 'grey-react-box';
4
4
  import { chain as chain$1, bignumber, format as format$1, create, all, equal } from 'mathjs';
5
5
  import { message, Form, Input, Icon as Icon$2, Tag as Tag$1, Select, Button, Tooltip, Switch as Switch$1, Typography, Menu, Dropdown, AutoComplete as AutoComplete$2, Spin, Checkbox, Drawer, Descriptions, Empty, Divider, Popover as Popover$1, Table as Table$1, Tree, Modal as Modal$1, Row as Row$2, Col as Col$2 } from 'kts-components-antd-x3';
6
6
  import { v4 } from 'uuid';
7
- import { message as message$1, TableManual, Switch, AutoComplete as AutoComplete$1, Popover, Button as Button$1, Dropdown as Dropdown$1, Select as Select$1, Row, Col, Checkbox as Checkbox$1, Tooltip as Tooltip$1, Input as Input$1, Spin as Spin$1, Menu as Menu$1, Form as Form$1, Drawer as Drawer$1, Space, Radio, InputNumber, Popconfirm, Modal, Cascader as Cascader$1, DatePicker as DatePicker$1, Tree as Tree$1, Card, FormReadOnly } from 'kts-xui';
7
+ import { message as message$1, TableManual, Switch, AutoComplete as AutoComplete$1, Popover, Button as Button$1, Dropdown as Dropdown$1, Select as Select$1, Row, Col, Checkbox as Checkbox$1, Tooltip as Tooltip$1, Input as Input$1, Spin as Spin$1, Menu as Menu$1, Form as Form$1, Drawer as Drawer$1, Space, Radio, InputNumber, Popconfirm, Modal, Cascader as Cascader$1, DatePicker as DatePicker$1, Tree as Tree$1, Card as Card$1, FormReadOnly } from 'kts-xui';
8
8
  import classnames from 'classnames';
9
9
  import { Table } from 'kts-components-antd-x4-v4';
10
10
  import { render } from 'react-dom';
11
- import { DatePicker, Row as Row$1, Col as Col$1, Input as Input$2, Cascader, Select as Select$2, Button as Button$2, Upload, Typography as Typography$1, Drawer as Drawer$2, Space as Space$1, message as message$2, Alert, Table as Table$2, Form as Form$2, Modal as Modal$2, Radio as Radio$1 } from 'kts-components-antd-x4';
11
+ import { DatePicker, Row as Row$1, Col as Col$1, Input as Input$2, Cascader, Select as Select$2, Button as Button$2, Upload, Typography as Typography$1, Drawer as Drawer$2, Space as Space$1, message as message$2, Alert, Table as Table$2, Form as Form$2, Modal as Modal$2, Radio as Radio$1, InputNumber as InputNumber$1, Card } from 'kts-components-antd-x4';
12
12
  import { Input as Input$3, NumberPicker } from '@formily/antd-components';
13
13
  import { createAsyncFormActions, FormEffectHooks, SchemaForm, FormButtonGroup, SchemaMarkupField } from '@formily/antd';
14
14
 
@@ -853,7 +853,14 @@ var InvoiceControllerForm = /*#__PURE__*/function (_GreyReactBox) {
853
853
  _errors.set('goodsList', _context.t0.errors);
854
854
 
855
855
  case 27:
856
- _values.set('goodsList', this.state.goodsListState.goodsList.slice()); //货物运输列表
856
+ _values.set('goodsList', this.state.goodsListState.goodsList.slice().map(function (e) {
857
+ var _this3$state, _this3$state$differen, _this3$state$differen2, _this3$state2, _this3$state2$differe, _this3$state2$differe2;
858
+
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,
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
862
+ });
863
+ })); //货物运输列表
857
864
 
858
865
 
859
866
  if (!this.state.freightListState.form) {
@@ -1237,6 +1244,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
1237
1244
  this.isValidateGood = true;
1238
1245
  this.isValidateMeiTan = true;
1239
1246
  this.meiTanGoodIndex = [];
1247
+ this.isSaveRowOutside = true;
1240
1248
 
1241
1249
  this.verifyMeiTanFn = /*#__PURE__*/function () {
1242
1250
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(record) {
@@ -1642,6 +1650,15 @@ var PassengerListState = /*#__PURE__*/_createClass(function PassengerListState()
1642
1650
  }];
1643
1651
  });
1644
1652
 
1653
+ var DifferenceInputState = /*#__PURE__*/_createClass(function DifferenceInputState() {
1654
+ _classCallCheck(this, DifferenceInputState);
1655
+
1656
+ this.enabled = false;
1657
+ this.open = false;
1658
+ this.data = void 0;
1659
+ this.amountIncludeTax = void 0;
1660
+ });
1661
+
1645
1662
  var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControllerState() {
1646
1663
  _classCallCheck(this, InvoiceControllerState);
1647
1664
 
@@ -1661,6 +1678,7 @@ var InvoiceControllerState = /*#__PURE__*/_createClass(function InvoiceControlle
1661
1678
  this.freightListState = new FreightListState();
1662
1679
  this.payListState = new PayListState();
1663
1680
  this.passengerListState = new PassengerListState();
1681
+ this.differenceInputState = new DifferenceInputState();
1664
1682
  this.addGoodsCheck = void 0;
1665
1683
  });
1666
1684
 
@@ -2278,7 +2296,7 @@ function countAmountIncludeTax(quantity, priceIncludeTax, calculatingDigits) {
2278
2296
  return parseFloat(chain$1(bignumber(priceIncludeTax)).multiply(bignumber(quantity)).done().toNumber().toFixed(2)); // return parseFloat(evaluate(`${priceIncludeTax} * ${quantity}`).toFixed(2));
2279
2297
  }
2280
2298
  /**
2281
- * 不含税金额 = 含税金额-税额
2299
+ * 不含税金额 = 含税金额 - 税额
2282
2300
  * @param amountIncludeTax 含税金额
2283
2301
  * @param taxAmount 税额
2284
2302
  * @returns 不含税金额
@@ -2299,10 +2317,9 @@ function countAmountExcludeTax(amountIncludeTax, taxAmount) {
2299
2317
 
2300
2318
  function countTaxAmount(amountIncludeTax, deduction, taxRate) {
2301
2319
  if (!amountIncludeTax && amountIncludeTax !== 0) return undefined;
2302
- if (!deduction && deduction !== 0) return undefined;
2303
2320
  if (!taxRate && taxRate !== 0) return undefined;
2304
2321
  var taxRateBu = chain$1(bignumber(taxRate)).divide(bignumber(100)).done();
2305
- 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));
2306
2323
  }
2307
2324
  /**
2308
2325
  * 单价 = 金额/数量
@@ -9962,6 +9979,7 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
9962
9979
  /** 税率 */
9963
9980
 
9964
9981
  var onChangeTaxRate = lazyFn(function (controller, form, record) {
9982
+ console.log('计算税率===>');
9965
9983
  form.validateFields( /*#__PURE__*/function () {
9966
9984
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(err, values) {
9967
9985
  var taxRate;
@@ -10105,7 +10123,7 @@ var updateUnitPriceExcludingTax = /*#__PURE__*/function () {
10105
10123
  /** 税额 */
10106
10124
 
10107
10125
  /** 扣除额 */
10108
- deduction = controller.state.goodsListState.deduction;
10126
+ deduction = controller.state.goodsListState.deduction || 0;
10109
10127
  editGood = controller.state.goodsListState.editGood; // 计算税额
10110
10128
 
10111
10129
  if (!promptErr(err.lineAmountIncludeTax) && !promptErr(err.taxRate)) {
@@ -11063,6 +11081,143 @@ var InvoiceController = /*#__PURE__*/function (_InvoiceControllerFor) {
11063
11081
  return _createClass(InvoiceController);
11064
11082
  }(InvoiceControllerForm);
11065
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 taxRate = (form === null || form === void 0 ? void 0 : form.getFieldValue('taxRate')) || 0; //税率
11103
+
11104
+ var taxAmount = countTaxAmount(lineAmountIncludeTax, 0, taxRate) || 0; //税额
11105
+
11106
+ var lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
11107
+
11108
+ form === null || form === void 0 ? void 0 : form.setFieldsValue({
11109
+ taxAmount: taxAmount,
11110
+ lineAmountExcludeTax: lineAmountExcludeTax
11111
+ });
11112
+ invoiceController.run( /*#__PURE__*/function () {
11113
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
11114
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11115
+ while (1) {
11116
+ switch (_context.prev = _context.next) {
11117
+ case 0:
11118
+ s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, editGood), {}, {
11119
+ taxAmount: taxAmount,
11120
+ lineAmountExcludeTax: lineAmountExcludeTax
11121
+ });
11122
+
11123
+ case 1:
11124
+ case "end":
11125
+ return _context.stop();
11126
+ }
11127
+ }
11128
+ }, _callee);
11129
+ }));
11130
+
11131
+ return function (_x) {
11132
+ return _ref.apply(this, arguments);
11133
+ };
11134
+ }());
11135
+ } else {
11136
+ // 不含税
11137
+ var _lineAmountIncludeTax = editGood.lineAmountIncludeTax || 0;
11138
+
11139
+ var _taxRate = (form === null || form === void 0 ? void 0 : form.getFieldValue('taxRate')) || 0; //税率
11140
+
11141
+
11142
+ var _taxAmount = countTaxAmount(_lineAmountIncludeTax, 0, _taxRate) || 0; //税额
11143
+
11144
+
11145
+ var _lineAmountExcludeTax = countAmountExcludeTax(_lineAmountIncludeTax, _taxAmount) || 0; // 不含税金额
11146
+
11147
+
11148
+ form === null || form === void 0 ? void 0 : form.setFieldsValue({
11149
+ taxAmount: _taxAmount,
11150
+ lineAmountExcludeTax: _lineAmountExcludeTax
11151
+ });
11152
+ invoiceController.run( /*#__PURE__*/function () {
11153
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
11154
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11155
+ while (1) {
11156
+ switch (_context2.prev = _context2.next) {
11157
+ case 0:
11158
+ s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, editGood), {}, {
11159
+ taxAmount: _taxAmount,
11160
+ lineAmountExcludeTax: _lineAmountExcludeTax
11161
+ });
11162
+
11163
+ case 1:
11164
+ case "end":
11165
+ return _context2.stop();
11166
+ }
11167
+ }
11168
+ }, _callee2);
11169
+ }));
11170
+
11171
+ return function (_x2) {
11172
+ return _ref2.apply(this, arguments);
11173
+ };
11174
+ }());
11175
+ }
11176
+ } else {
11177
+ invoiceController.run( /*#__PURE__*/function () {
11178
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
11179
+ var good, lineAmountIncludeTax, taxRate, taxAmount, lineAmountExcludeTax;
11180
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
11181
+ while (1) {
11182
+ switch (_context3.prev = _context3.next) {
11183
+ case 0:
11184
+ good = s.goodsListState.goodsList[0];
11185
+
11186
+ if (good) {
11187
+ _context3.next = 3;
11188
+ break;
11189
+ }
11190
+
11191
+ return _context3.abrupt("return");
11192
+
11193
+ case 3:
11194
+ lineAmountIncludeTax = good.lineAmountIncludeTax || 0;
11195
+ taxRate = good.taxRate || 0;
11196
+ taxAmount = countTaxAmount(lineAmountIncludeTax, 0, taxRate) || 0; //税额
11197
+
11198
+ lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount) || 0; // 不含税金额
11199
+
11200
+ s.goodsListState.goodsList[0] = _objectSpread2(_objectSpread2({}, good), {}, {
11201
+ taxAmount: taxAmount,
11202
+ lineAmountExcludeTax: lineAmountExcludeTax
11203
+ });
11204
+
11205
+ case 8:
11206
+ case "end":
11207
+ return _context3.stop();
11208
+ }
11209
+ }
11210
+ }, _callee3);
11211
+ }));
11212
+
11213
+ return function (_x3) {
11214
+ return _ref3.apply(this, arguments);
11215
+ };
11216
+ }());
11217
+ }
11218
+ }, [differenceInputEnabled]);
11219
+ };
11220
+
11066
11221
  /** 更新 商品序号 */
11067
11222
 
11068
11223
  function useToGenerateId(controller) {
@@ -11675,6 +11830,11 @@ var AddRowButton = (function (props) {
11675
11830
  var goodMax = controller.useMemo(function (s) {
11676
11831
  return s.goodsListState.goodMax;
11677
11832
  }, []);
11833
+ /** 是否是差额开票模式 */
11834
+
11835
+ var isDifferenceInput = controller.useMemo(function (s) {
11836
+ return s.differenceInputState.enabled;
11837
+ }, []);
11678
11838
  /** 按钮是否禁用 */
11679
11839
 
11680
11840
  var disabled = React.useMemo(function () {
@@ -11731,7 +11891,8 @@ var AddRowButton = (function (props) {
11731
11891
  })), [controller, rootElement]);
11732
11892
  if (isAddRow === false) return /*#__PURE__*/React.createElement(React.Fragment, null);
11733
11893
  if (model === 'prefab') return /*#__PURE__*/React.createElement(React.Fragment, null);
11734
- if (model === 'readOnly') return /*#__PURE__*/React.createElement(React.Fragment, null);
11894
+ if (model === 'readOnly') return /*#__PURE__*/React.createElement(React.Fragment, null); // if (isDifferenceInput && goodsNum >= 1) return <></>;
11895
+
11735
11896
  return /*#__PURE__*/React.createElement(Button, {
11736
11897
  onClick: onClick,
11737
11898
  disabled: disabled
@@ -12607,7 +12768,7 @@ function ItemNameInput(props) {
12607
12768
  }, []);
12608
12769
  var autoComplete = controller.useMemo(function (s) {
12609
12770
  return s.autoComplete;
12610
- }, []);
12771
+ }, []); // const enabled = controller.useMemo((s) => s.differenceInputState.enabled, []);
12611
12772
 
12612
12773
  var _React$useState = React.useState([]),
12613
12774
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -12630,30 +12791,30 @@ function ItemNameInput(props) {
12630
12791
  props.onChange && props.onChange(event);
12631
12792
  }, []);
12632
12793
  var onBlur = React.useCallback( /*#__PURE__*/function () {
12633
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(searchText) {
12794
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(searchText) {
12634
12795
  var _searchText$target, taxCategoryData, params;
12635
12796
 
12636
- return _regeneratorRuntime().wrap(function _callee$(_context) {
12797
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
12637
12798
  while (1) {
12638
- switch (_context.prev = _context.next) {
12799
+ switch (_context2.prev = _context2.next) {
12639
12800
  case 0:
12640
- _context.prev = 0;
12801
+ _context2.prev = 0;
12641
12802
 
12642
12803
  if (!autoComplete.onItemNameBlur) {
12643
- _context.next = 8;
12804
+ _context2.next = 8;
12644
12805
  break;
12645
12806
  }
12646
12807
 
12647
12808
  if (!(!(selectLine === null || selectLine === void 0 ? void 0 : selectLine.shorthand) && !!(searchText === null || searchText === void 0 ? void 0 : (_searchText$target = searchText.target) === null || _searchText$target === void 0 ? void 0 : _searchText$target.value))) {
12648
- _context.next = 7;
12809
+ _context2.next = 7;
12649
12810
  break;
12650
12811
  }
12651
12812
 
12652
- _context.next = 5;
12813
+ _context2.next = 5;
12653
12814
  return autoComplete.onItemNameBlur(searchText);
12654
12815
 
12655
12816
  case 5:
12656
- taxCategoryData = _context.sent;
12817
+ taxCategoryData = _context2.sent;
12657
12818
 
12658
12819
  if (taxCategoryData && taxCategoryData[0]) {
12659
12820
  params = {
@@ -12667,20 +12828,45 @@ function ItemNameInput(props) {
12667
12828
  setSelectLine(null);
12668
12829
 
12669
12830
  case 8:
12670
- _context.next = 13;
12831
+ console.log('onBlur ===>', controller.state.differenceInputState.enabled); // 失去焦点时,打开差额开票弹窗
12832
+
12833
+ if (controller.state.differenceInputState.enabled) {
12834
+ controller.run( /*#__PURE__*/function () {
12835
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
12836
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
12837
+ while (1) {
12838
+ switch (_context.prev = _context.next) {
12839
+ case 0:
12840
+ s.differenceInputState.open = true;
12841
+
12842
+ case 1:
12843
+ case "end":
12844
+ return _context.stop();
12845
+ }
12846
+ }
12847
+ }, _callee);
12848
+ }));
12849
+
12850
+ return function (_x2) {
12851
+ return _ref2.apply(this, arguments);
12852
+ };
12853
+ }());
12854
+ }
12855
+
12856
+ _context2.next = 15;
12671
12857
  break;
12672
12858
 
12673
- case 10:
12674
- _context.prev = 10;
12675
- _context.t0 = _context["catch"](0);
12676
- throw _context.t0;
12859
+ case 12:
12860
+ _context2.prev = 12;
12861
+ _context2.t0 = _context2["catch"](0);
12862
+ throw _context2.t0;
12677
12863
 
12678
- case 13:
12864
+ case 15:
12679
12865
  case "end":
12680
- return _context.stop();
12866
+ return _context2.stop();
12681
12867
  }
12682
12868
  }
12683
- }, _callee, null, [[0, 10]]);
12869
+ }, _callee2, null, [[0, 12]]);
12684
12870
  }));
12685
12871
 
12686
12872
  return function (_x) {
@@ -12688,101 +12874,101 @@ function ItemNameInput(props) {
12688
12874
  };
12689
12875
  }(), [autoComplete.onItemNameBlur, selectLine, props.editGood]);
12690
12876
  var onSearch = React.useCallback( /*#__PURE__*/function () {
12691
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(searchText) {
12877
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(searchText) {
12692
12878
  var list;
12693
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
12879
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
12694
12880
  while (1) {
12695
- switch (_context2.prev = _context2.next) {
12881
+ switch (_context3.prev = _context3.next) {
12696
12882
  case 0:
12697
- _context2.prev = 0;
12883
+ _context3.prev = 0;
12698
12884
 
12699
12885
  if (!(autoComplete.onItemNameSearch && searchText)) {
12700
- _context2.next = 10;
12886
+ _context3.next = 10;
12701
12887
  break;
12702
12888
  }
12703
12889
 
12704
- _context2.t0 = _toConsumableArray;
12705
- _context2.next = 5;
12890
+ _context3.t0 = _toConsumableArray;
12891
+ _context3.next = 5;
12706
12892
  return autoComplete.onItemNameSearch(searchText);
12707
12893
 
12708
12894
  case 5:
12709
- _context2.t1 = _context2.sent;
12710
- list = (0, _context2.t0)(_context2.t1).map(function (e) {
12895
+ _context3.t1 = _context3.sent;
12896
+ list = (0, _context3.t0)(_context3.t1).map(function (e) {
12711
12897
  return _objectSpread2(_objectSpread2({}, e), {}, {
12712
12898
  $index: v4()
12713
12899
  });
12714
12900
  });
12715
12901
  setOptions(list);
12716
- _context2.next = 11;
12902
+ _context3.next = 11;
12717
12903
  break;
12718
12904
 
12719
12905
  case 10:
12720
12906
  setOptions([]);
12721
12907
 
12722
12908
  case 11:
12723
- _context2.next = 17;
12909
+ _context3.next = 17;
12724
12910
  break;
12725
12911
 
12726
12912
  case 13:
12727
- _context2.prev = 13;
12728
- _context2.t2 = _context2["catch"](0);
12913
+ _context3.prev = 13;
12914
+ _context3.t2 = _context3["catch"](0);
12729
12915
  setOptions([]);
12730
- throw _context2.t2;
12916
+ throw _context3.t2;
12731
12917
 
12732
12918
  case 17:
12733
12919
  case "end":
12734
- return _context2.stop();
12920
+ return _context3.stop();
12735
12921
  }
12736
12922
  }
12737
- }, _callee2, null, [[0, 13]]);
12923
+ }, _callee3, null, [[0, 13]]);
12738
12924
  }));
12739
12925
 
12740
- return function (_x2) {
12741
- return _ref2.apply(this, arguments);
12926
+ return function (_x3) {
12927
+ return _ref3.apply(this, arguments);
12742
12928
  };
12743
12929
  }(), [autoComplete.onItemNameSearch]);
12744
12930
  var onChangeAutoComplete = React.useCallback( /*#__PURE__*/function () {
12745
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_, i) {
12931
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_, i) {
12746
12932
  var record;
12747
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
12933
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
12748
12934
  while (1) {
12749
- switch (_context3.prev = _context3.next) {
12935
+ switch (_context4.prev = _context4.next) {
12750
12936
  case 0:
12751
12937
  record = options.filter(function (e) {
12752
12938
  return e.$index === i.value;
12753
12939
  })[0];
12754
12940
 
12755
12941
  if (record) {
12756
- _context3.next = 3;
12942
+ _context4.next = 3;
12757
12943
  break;
12758
12944
  }
12759
12945
 
12760
- return _context3.abrupt("return");
12946
+ return _context4.abrupt("return");
12761
12947
 
12762
12948
  case 3:
12763
12949
  setValue(record.itemName);
12764
12950
  setSelectLine(record);
12765
- _context3.next = 7;
12951
+ _context4.next = 7;
12766
12952
  return controller.setEditGood({
12767
12953
  itemName: record.itemName
12768
12954
  });
12769
12955
 
12770
12956
  case 7:
12771
- _context3.next = 9;
12957
+ _context4.next = 9;
12772
12958
  return controller.importGoodsDrawer(_objectSpread2(_objectSpread2({}, record), {}, {
12773
12959
  $index: undefined
12774
12960
  }));
12775
12961
 
12776
12962
  case 9:
12777
12963
  case "end":
12778
- return _context3.stop();
12964
+ return _context4.stop();
12779
12965
  }
12780
12966
  }
12781
- }, _callee3);
12967
+ }, _callee4);
12782
12968
  }));
12783
12969
 
12784
- return function (_x3, _x4) {
12785
- return _ref3.apply(this, arguments);
12970
+ return function (_x4, _x5) {
12971
+ return _ref4.apply(this, arguments);
12786
12972
  };
12787
12973
  }(), [options, controller]);
12788
12974
  React.useEffect(function () {
@@ -14893,6 +15079,11 @@ var useColumns = (function (form) {
14893
15079
  var deduction = controller.useMemo(function (e) {
14894
15080
  return e.goodsListState.deduction;
14895
15081
  }, []);
15082
+ /** 差额开票是否启用 */
15083
+
15084
+ var differenceInputStateEnabled = controller.useMemo(function (e) {
15085
+ return e.differenceInputState.enabled;
15086
+ }, []);
14896
15087
  /** 计算中启动字段 */
14897
15088
 
14898
15089
  var changeField = controller.useMemo(function (e) {
@@ -15391,6 +15582,7 @@ var useColumns = (function (form) {
15391
15582
  textAlign: 'right'
15392
15583
  },
15393
15584
  maxLength: 25,
15585
+ disabled: differenceInputStateEnabled,
15394
15586
  loading: isCipher(changeField, 'priceIncludeTax'),
15395
15587
  onChange: function onChange() {
15396
15588
  setChangeField('priceIncludeTax');
@@ -15466,6 +15658,7 @@ var useColumns = (function (form) {
15466
15658
  textAlign: 'right'
15467
15659
  },
15468
15660
  maxLength: 25,
15661
+ disabled: differenceInputStateEnabled,
15469
15662
  loading: isCipher(changeField, 'priceExcludeTax'),
15470
15663
  onChange: function onChange() {
15471
15664
  setChangeField('priceExcludeTax');
@@ -15555,17 +15748,40 @@ var useColumns = (function (form) {
15555
15748
  textAlign: 'right'
15556
15749
  },
15557
15750
  loading: isCipher(changeField, 'lineAmountIncludeTax'),
15751
+ readOnly: differenceInputStateEnabled,
15558
15752
  onChange: function onChange() {
15559
15753
  setChangeField('lineAmountIncludeTax');
15560
15754
  onChangeLineAmountIncludeTax(controller, form, record);
15561
- }
15755
+ },
15756
+ onClick: differenceInputStateEnabled ? function () {
15757
+ controller.run( /*#__PURE__*/function () {
15758
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(s) {
15759
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
15760
+ while (1) {
15761
+ switch (_context13.prev = _context13.next) {
15762
+ case 0:
15763
+ s.differenceInputState.open = true;
15764
+
15765
+ case 1:
15766
+ case "end":
15767
+ return _context13.stop();
15768
+ }
15769
+ }
15770
+ }, _callee13);
15771
+ }));
15772
+
15773
+ return function (_x21) {
15774
+ return _ref3.apply(this, arguments);
15775
+ };
15776
+ }());
15777
+ } : undefined
15562
15778
  })));
15563
15779
  } else {
15564
15780
  return /*#__PURE__*/React.createElement("span", {
15565
15781
  style: {
15566
15782
  padding: '0 10px'
15567
15783
  }
15568
- }, formatSearch(parseFloat(value).toFixed(2), searchValue));
15784
+ }, formatSearch((isNaN(parseFloat(value)) ? 0 : parseFloat(value)).toFixed(2), searchValue));
15569
15785
  }
15570
15786
  }
15571
15787
  }, {
@@ -15577,7 +15793,7 @@ var useColumns = (function (form) {
15577
15793
  align: 'right',
15578
15794
  width: 119,
15579
15795
  render: function render(value, record) {
15580
- if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab') {
15796
+ if ((editGood === null || editGood === void 0 ? void 0 : editGood.$index) === record.$index && model !== 'prefab' && !differenceInputStateEnabled) {
15581
15797
  return /*#__PURE__*/React.createElement(Form.Item, null, getFieldDecorator('lineAmountExcludeTax', {
15582
15798
  initialValue: editGood.lineAmountExcludeTax,
15583
15799
  getValueFromEvent: onNumberValueChange,
@@ -15589,10 +15805,10 @@ var useColumns = (function (form) {
15589
15805
  message: '金额必须为数字'
15590
15806
  }, {
15591
15807
  validator: function () {
15592
- var _validator7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_, value, callback) {
15593
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
15808
+ var _validator7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(_, value, callback) {
15809
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
15594
15810
  while (1) {
15595
- switch (_context13.prev = _context13.next) {
15811
+ switch (_context14.prev = _context14.next) {
15596
15812
  case 0:
15597
15813
  if ("".concat(value).split('.')[0].length > priceIntegerDigit) {
15598
15814
  callback("\u91D1\u989D\u6574\u6570\u90E8\u5206\u4E0D\u80FD\u5927\u4E8E".concat(priceIntegerDigit, "\u4F4D\uFF0C\u5C0F\u6570\u70B9\u540E\u6700\u591A2\u4F4D"));
@@ -15600,13 +15816,13 @@ var useColumns = (function (form) {
15600
15816
 
15601
15817
  case 1:
15602
15818
  case "end":
15603
- return _context13.stop();
15819
+ return _context14.stop();
15604
15820
  }
15605
15821
  }
15606
- }, _callee13);
15822
+ }, _callee14);
15607
15823
  }));
15608
15824
 
15609
- function validator(_x21, _x22, _x23) {
15825
+ function validator(_x22, _x23, _x24) {
15610
15826
  return _validator7.apply(this, arguments);
15611
15827
  }
15612
15828
 
@@ -15617,7 +15833,30 @@ var useColumns = (function (form) {
15617
15833
  style: {
15618
15834
  textAlign: 'right'
15619
15835
  },
15836
+ readOnly: differenceInputStateEnabled,
15620
15837
  loading: isCipher(changeField, 'lineAmountExcludeTax'),
15838
+ onClick: differenceInputStateEnabled ? function () {
15839
+ controller.run( /*#__PURE__*/function () {
15840
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
15841
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
15842
+ while (1) {
15843
+ switch (_context15.prev = _context15.next) {
15844
+ case 0:
15845
+ s.differenceInputState.open = true;
15846
+
15847
+ case 1:
15848
+ case "end":
15849
+ return _context15.stop();
15850
+ }
15851
+ }
15852
+ }, _callee15);
15853
+ }));
15854
+
15855
+ return function (_x25) {
15856
+ return _ref4.apply(this, arguments);
15857
+ };
15858
+ }());
15859
+ } : undefined,
15621
15860
  onChange: function onChange() {
15622
15861
  setChangeField('lineAmountExcludeTax');
15623
15862
  onChangeLineAmountExcludeTax(controller, form, record);
@@ -15628,7 +15867,7 @@ var useColumns = (function (form) {
15628
15867
  style: {
15629
15868
  padding: '0 10px'
15630
15869
  }
15631
- }, value === '' ? '' : formatSearch(parseFloat(value).toFixed(2), searchValue));
15870
+ }, value === '' ? '' : formatSearch((isNaN(parseFloat(value)) ? 0 : parseFloat(value)).toFixed(2), searchValue));
15632
15871
  }
15633
15872
  }
15634
15873
  }, {
@@ -15706,11 +15945,12 @@ var useColumns = (function (form) {
15706
15945
  // const lineAmountExcludeTax = lineAmountIncludeTax-value;
15707
15946
 
15708
15947
  var lineAmountExcludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountExcludeTax) || 0;
15948
+ var deduction = controller.state.goodsListState.deduction || 0;
15709
15949
  var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
15710
15950
 
15711
15951
  if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
15712
15952
  // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
15713
- 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) {
15953
+ 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) {
15714
15954
 
15715
15955
  if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.06) {
15716
15956
  callback();
@@ -15839,7 +16079,7 @@ var useColumns = (function (form) {
15839
16079
  ellipsis: true
15840
16080
  });
15841
16081
  });
15842
- }, [isTaxIncluded, editGood, goodsList, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, columnshide, isStart]);
16082
+ }, [isTaxIncluded, editGood, goodsList, controller, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, columnshide, isStart, differenceInputStateEnabled]);
15843
16083
  return controller.setColumnsConfig ? controller.setColumnsConfig(columns) : columns;
15844
16084
  });
15845
16085
  /** 字段 */
@@ -16172,61 +16412,6 @@ var useOnRow = (function () {
16172
16412
  };
16173
16413
  });
16174
16414
 
16175
- /**
16176
- * 扣除额 相关业务
16177
- */
16178
-
16179
- function useDeduction(controller) {
16180
- var deduction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
16181
- // 更新 扣除额
16182
- React.useEffect(function () {
16183
- controller.pipeline( /*#__PURE__*/function () {
16184
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
16185
- return _regeneratorRuntime().wrap(function _callee$(_context) {
16186
- while (1) {
16187
- switch (_context.prev = _context.next) {
16188
- case 0:
16189
- return _context.abrupt("return", s.goodsListState.deduction = deduction);
16190
-
16191
- case 1:
16192
- case "end":
16193
- return _context.stop();
16194
- }
16195
- }
16196
- }, _callee);
16197
- }));
16198
-
16199
- return function (_x) {
16200
- return _ref.apply(this, arguments);
16201
- };
16202
- }())();
16203
- }, [controller, deduction]); // 重新计算
16204
-
16205
- React.useEffect(function () {
16206
- controller.pipeline( /*#__PURE__*/function () {
16207
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
16208
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
16209
- while (1) {
16210
- switch (_context2.prev = _context2.next) {
16211
- case 0:
16212
- s.goodsListState.editGood = undefined;
16213
- s.goodsListState.goodsList = [];
16214
-
16215
- case 2:
16216
- case "end":
16217
- return _context2.stop();
16218
- }
16219
- }
16220
- }, _callee2);
16221
- }));
16222
-
16223
- return function (_x2) {
16224
- return _ref2.apply(this, arguments);
16225
- };
16226
- }())();
16227
- }, [controller, deduction]);
16228
- }
16229
-
16230
16415
  /**
16231
16416
  * 点击组件外部 保存正在编辑的货物
16232
16417
  */
@@ -16238,6 +16423,9 @@ function useWindowClick(controller) {
16238
16423
  /** 点击组件外部 保存正在编辑的货物 */
16239
16424
  React.useEffect(function () {
16240
16425
  var click = function click() {
16426
+ var _controller$state$goo;
16427
+
16428
+ if (!((_controller$state$goo = controller.state.goodsListState) === null || _controller$state$goo === void 0 ? void 0 : _controller$state$goo.isSaveRowOutside)) return;
16241
16429
  setTimeout(controller.saveEditGood);
16242
16430
  };
16243
16431
 
@@ -17809,9 +17997,9 @@ var Main = decorator(Form.create())(function (props) {
17809
17997
  }, [dataSource, searchValue, controller, isTaxIncluded]);
17810
17998
  /** 表格行事件 */
17811
17999
 
17812
- var _onRow = useOnRow();
18000
+ var _onRow = useOnRow(); // useDeduction(controller, props.deduction);
18001
+
17813
18002
 
17814
- useDeduction(controller, props.deduction);
17815
18003
  useWindowClick(controller);
17816
18004
  /** 批量赋码 */
17817
18005
 
@@ -23083,6 +23271,11 @@ var AddRowButton$1 = (function () {
23083
23271
  var goodsNum = controller.useMemo(function (s) {
23084
23272
  return s.goodsListState.goodsList.length;
23085
23273
  }, []);
23274
+ /** 是否是差额开票模式 */
23275
+
23276
+ var isDifferenceInput = controller.useMemo(function (s) {
23277
+ return s.differenceInputState.enabled;
23278
+ }, []);
23086
23279
  /** 搜索条件 */
23087
23280
 
23088
23281
  var searchValue = controller.useMemo(function (s) {
@@ -23124,7 +23317,8 @@ var AddRowButton$1 = (function () {
23124
23317
  })), [controller, rootElement]);
23125
23318
  if (isAddRow === false) return /*#__PURE__*/React.createElement(React.Fragment, null);
23126
23319
  if (model === 'prefab') return /*#__PURE__*/React.createElement(React.Fragment, null);
23127
- if (model === 'readOnly') return /*#__PURE__*/React.createElement(React.Fragment, null);
23320
+ if (model === 'readOnly') return /*#__PURE__*/React.createElement(React.Fragment, null); // if (isDifferenceInput && goodsNum >= 1) return <></>;
23321
+
23128
23322
  return /*#__PURE__*/React.createElement(Button$1, {
23129
23323
  size: 'small',
23130
23324
  type: 'primary',
@@ -23199,11 +23393,6 @@ function _addGood$1() {
23199
23393
  break;
23200
23394
  }
23201
23395
 
23202
- // message.error({
23203
- // content: '你正在编辑一个货物',
23204
- // key: '你正在编辑一个货物',
23205
- // });
23206
- // return;
23207
23396
  isValidateGood = controller.state.goodsListState.isValidateGood;
23208
23397
 
23209
23398
  if (!isValidateGood) {
@@ -23455,7 +23644,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
23455
23644
  break;
23456
23645
  }
23457
23646
 
23458
- if (!(!err.priceIncludeTax && values.priceIncludeTax)) {
23647
+ if (!(!err.priceIncludeTax && values.priceIncludeTax && !controller.state.differenceInputState.enabled)) {
23459
23648
  _context3.next = 26;
23460
23649
  break;
23461
23650
  }
@@ -23501,7 +23690,7 @@ var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
23501
23690
  break;
23502
23691
 
23503
23692
  case 36:
23504
- if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
23693
+ if (!(!err.priceExcludeTax && values.priceExcludeTax && !controller.state.differenceInputState.enabled)) {
23505
23694
  _context3.next = 44;
23506
23695
  break;
23507
23696
  }
@@ -24910,8 +25099,13 @@ var TitleText$1 = (function (props) {
24910
25099
  var css_248z$n = ".kts-invoice-operate-goods-list-itemName-input {\n display: flex;\n flex: 1;\n padding-left: 0;\n height: 31px;\n}\n";
24911
25100
  styleInject(css_248z$n);
24912
25101
 
25102
+ /** 商品名称输入框 */
25103
+
24913
25104
  function ItemNameInput$1(props) {
24914
25105
  var controller = Invoice.useInvoiceController();
25106
+ var enabled = controller.useMemo(function (s) {
25107
+ return s.differenceInputState.enabled;
25108
+ }, []);
24915
25109
  var rootElement = controller.useMemo(function (s) {
24916
25110
  return s.rootElement;
24917
25111
  }, []);
@@ -24935,30 +25129,30 @@ function ItemNameInput$1(props) {
24935
25129
  props.onChange && props.onChange(event);
24936
25130
  }, []);
24937
25131
  var onBlur = React.useCallback( /*#__PURE__*/function () {
24938
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(searchText) {
25132
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(searchText) {
24939
25133
  var _searchText$target, taxCategoryData, params;
24940
25134
 
24941
- return _regeneratorRuntime().wrap(function _callee$(_context) {
25135
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
24942
25136
  while (1) {
24943
- switch (_context.prev = _context.next) {
25137
+ switch (_context2.prev = _context2.next) {
24944
25138
  case 0:
24945
- _context.prev = 0;
25139
+ _context2.prev = 0;
24946
25140
 
24947
25141
  if (!autoComplete.onItemNameBlur) {
24948
- _context.next = 8;
25142
+ _context2.next = 8;
24949
25143
  break;
24950
25144
  }
24951
25145
 
24952
25146
  if (!(!(selectLine === null || selectLine === void 0 ? void 0 : selectLine.shorthand) && !!(searchText === null || searchText === void 0 ? void 0 : (_searchText$target = searchText.target) === null || _searchText$target === void 0 ? void 0 : _searchText$target.value))) {
24953
- _context.next = 7;
25147
+ _context2.next = 7;
24954
25148
  break;
24955
25149
  }
24956
25150
 
24957
- _context.next = 5;
25151
+ _context2.next = 5;
24958
25152
  return autoComplete.onItemNameBlur(searchText);
24959
25153
 
24960
25154
  case 5:
24961
- taxCategoryData = _context.sent;
25155
+ taxCategoryData = _context2.sent;
24962
25156
 
24963
25157
  if (taxCategoryData && taxCategoryData[0]) {
24964
25158
  params = {
@@ -24972,120 +25166,144 @@ function ItemNameInput$1(props) {
24972
25166
  setSelectLine(null);
24973
25167
 
24974
25168
  case 8:
24975
- _context.next = 13;
25169
+ // 失去焦点时,打开差额开票弹窗
25170
+ if (enabled) {
25171
+ controller.run( /*#__PURE__*/function () {
25172
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
25173
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
25174
+ while (1) {
25175
+ switch (_context.prev = _context.next) {
25176
+ case 0:
25177
+ s.differenceInputState.open = true;
25178
+
25179
+ case 1:
25180
+ case "end":
25181
+ return _context.stop();
25182
+ }
25183
+ }
25184
+ }, _callee);
25185
+ }));
25186
+
25187
+ return function (_x2) {
25188
+ return _ref2.apply(this, arguments);
25189
+ };
25190
+ }());
25191
+ }
25192
+
25193
+ _context2.next = 14;
24976
25194
  break;
24977
25195
 
24978
- case 10:
24979
- _context.prev = 10;
24980
- _context.t0 = _context["catch"](0);
24981
- throw _context.t0;
25196
+ case 11:
25197
+ _context2.prev = 11;
25198
+ _context2.t0 = _context2["catch"](0);
25199
+ throw _context2.t0;
24982
25200
 
24983
- case 13:
25201
+ case 14:
24984
25202
  case "end":
24985
- return _context.stop();
25203
+ return _context2.stop();
24986
25204
  }
24987
25205
  }
24988
- }, _callee, null, [[0, 10]]);
25206
+ }, _callee2, null, [[0, 11]]);
24989
25207
  }));
24990
25208
 
24991
25209
  return function (_x) {
24992
25210
  return _ref.apply(this, arguments);
24993
25211
  };
24994
- }(), [autoComplete.onItemNameBlur, selectLine, props.editGood]);
25212
+ }(), [autoComplete.onItemNameBlur, selectLine, props.editGood, enabled]);
24995
25213
  var onChangeAutoComplete = React.useCallback( /*#__PURE__*/function () {
24996
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_, i) {
25214
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_, i) {
24997
25215
  var record;
24998
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
25216
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
24999
25217
  while (1) {
25000
- switch (_context2.prev = _context2.next) {
25218
+ switch (_context3.prev = _context3.next) {
25001
25219
  case 0:
25002
25220
  record = options.filter(function (e) {
25003
25221
  return e.$index === i.value;
25004
25222
  })[0];
25005
25223
 
25006
25224
  if (record) {
25007
- _context2.next = 3;
25225
+ _context3.next = 3;
25008
25226
  break;
25009
25227
  }
25010
25228
 
25011
- return _context2.abrupt("return");
25229
+ return _context3.abrupt("return");
25012
25230
 
25013
25231
  case 3:
25014
- _context2.next = 5;
25232
+ _context3.next = 5;
25015
25233
  return controller.setEditGood({
25016
25234
  itemName: record.itemName
25017
25235
  });
25018
25236
 
25019
25237
  case 5:
25020
- _context2.next = 7;
25238
+ _context3.next = 7;
25021
25239
  return controller.importGoodsDrawer(_objectSpread2(_objectSpread2({}, record), {}, {
25022
25240
  $index: undefined
25023
25241
  }));
25024
25242
 
25025
25243
  case 7:
25026
25244
  case "end":
25027
- return _context2.stop();
25245
+ return _context3.stop();
25028
25246
  }
25029
25247
  }
25030
- }, _callee2);
25248
+ }, _callee3);
25031
25249
  }));
25032
25250
 
25033
- return function (_x2, _x3) {
25034
- return _ref2.apply(this, arguments);
25251
+ return function (_x3, _x4) {
25252
+ return _ref3.apply(this, arguments);
25035
25253
  };
25036
25254
  }(), [options, controller]);
25037
25255
  var onSearch = React.useCallback( /*#__PURE__*/function () {
25038
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(searchText) {
25256
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(searchText) {
25039
25257
  var list;
25040
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
25258
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
25041
25259
  while (1) {
25042
- switch (_context3.prev = _context3.next) {
25260
+ switch (_context4.prev = _context4.next) {
25043
25261
  case 0:
25044
- _context3.prev = 0;
25262
+ _context4.prev = 0;
25045
25263
 
25046
25264
  if (!(autoComplete.onItemNameSearch && searchText)) {
25047
- _context3.next = 10;
25265
+ _context4.next = 10;
25048
25266
  break;
25049
25267
  }
25050
25268
 
25051
- _context3.t0 = _toConsumableArray;
25052
- _context3.next = 5;
25269
+ _context4.t0 = _toConsumableArray;
25270
+ _context4.next = 5;
25053
25271
  return autoComplete.onItemNameSearch(searchText);
25054
25272
 
25055
25273
  case 5:
25056
- _context3.t1 = _context3.sent;
25057
- list = (0, _context3.t0)(_context3.t1).map(function (e) {
25274
+ _context4.t1 = _context4.sent;
25275
+ list = (0, _context4.t0)(_context4.t1).map(function (e) {
25058
25276
  return _objectSpread2(_objectSpread2({}, e), {}, {
25059
25277
  $index: v4()
25060
25278
  });
25061
25279
  });
25062
25280
  setOptions(list);
25063
- _context3.next = 11;
25281
+ _context4.next = 11;
25064
25282
  break;
25065
25283
 
25066
25284
  case 10:
25067
25285
  setOptions([]);
25068
25286
 
25069
25287
  case 11:
25070
- _context3.next = 17;
25288
+ _context4.next = 17;
25071
25289
  break;
25072
25290
 
25073
25291
  case 13:
25074
- _context3.prev = 13;
25075
- _context3.t2 = _context3["catch"](0);
25292
+ _context4.prev = 13;
25293
+ _context4.t2 = _context4["catch"](0);
25076
25294
  setOptions([]);
25077
- throw _context3.t2;
25295
+ throw _context4.t2;
25078
25296
 
25079
25297
  case 17:
25080
25298
  case "end":
25081
- return _context3.stop();
25299
+ return _context4.stop();
25082
25300
  }
25083
25301
  }
25084
- }, _callee3, null, [[0, 13]]);
25302
+ }, _callee4, null, [[0, 13]]);
25085
25303
  }));
25086
25304
 
25087
- return function (_x4) {
25088
- return _ref3.apply(this, arguments);
25305
+ return function (_x5) {
25306
+ return _ref4.apply(this, arguments);
25089
25307
  };
25090
25308
  }(), [autoComplete.onItemNameSearch]);
25091
25309
  return /*#__PURE__*/React.createElement("div", {
@@ -25556,6 +25774,11 @@ var useColumns$1 = (function (form) {
25556
25774
  var deduction = controller.useMemo(function (e) {
25557
25775
  return e.goodsListState.deduction;
25558
25776
  }, []);
25777
+ /** 差额开票是否启用 */
25778
+
25779
+ var differenceInputStateEnabled = controller.useMemo(function (e) {
25780
+ return e.differenceInputState.enabled;
25781
+ }, []);
25559
25782
  /** 计算中启动字段 */
25560
25783
 
25561
25784
  var changeField = controller.useMemo(function (e) {
@@ -25651,58 +25874,24 @@ var useColumns$1 = (function (form) {
25651
25874
  }, getFieldDecorator('itemName', {
25652
25875
  initialValue: isMyShow ? record.itemNameSelf : record.itemName,
25653
25876
  rules: [].concat(_toConsumableArray(getReplenishRules('itemName')), [{
25654
- validator: function () {
25655
- var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_, __, callback) {
25656
- var value;
25657
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
25658
- while (1) {
25659
- switch (_context2.prev = _context2.next) {
25660
- case 0:
25661
- if (!isValidateGood) {
25662
- _context2.next = 11;
25663
- break;
25664
- }
25665
-
25666
- _context2.next = 3;
25667
- return controller.wait();
25668
-
25669
- case 3:
25670
- value = controller.state.goodsListState.editGood;
25671
-
25672
- if (!(!(value === null || value === void 0 ? void 0 : value.itemName) && !(value === null || value === void 0 ? void 0 : value.itemNameSelf))) {
25673
- _context2.next = 8;
25674
- break;
25675
- }
25676
-
25677
- callback('项目名称不能为空');
25678
- _context2.next = 9;
25679
- break;
25680
-
25681
- case 8:
25682
- return _context2.abrupt("return");
25683
-
25684
- case 9:
25685
- _context2.next = 12;
25686
- break;
25687
-
25688
- case 11:
25689
- callback();
25690
-
25691
- case 12:
25692
- case "end":
25693
- return _context2.stop();
25694
- }
25695
- }
25696
- }, _callee2);
25697
- }));
25698
-
25699
- function validator(_x2, _x3, _x4) {
25700
- return _validator.apply(this, arguments);
25701
- }
25702
-
25703
- return validator;
25704
- }()
25705
- }])
25877
+ required: isValidateGood,
25878
+ message: '项目名称不能为空'
25879
+ } // {
25880
+ // validator: async (_, __, callback) => {
25881
+ // if (isValidateGood) {
25882
+ // await controller.wait();
25883
+ // const value = controller.state.goodsListState.editGood;
25884
+ // if (!value?.itemName && !value?.itemNameSelf) {
25885
+ // callback('项目名称不能为空');
25886
+ // } else {
25887
+ // return;
25888
+ // }
25889
+ // } else {
25890
+ // callback();
25891
+ // }
25892
+ // }
25893
+ // }
25894
+ ])
25706
25895
  })( /*#__PURE__*/React.createElement(ItemNameInput$1, {
25707
25896
  editGood: editGood,
25708
25897
  shorthand: editGood.shorthand,
@@ -25718,22 +25907,22 @@ var useColumns$1 = (function (form) {
25718
25907
  },
25719
25908
  icon: /*#__PURE__*/React.createElement(SvgPlus$2, null),
25720
25909
  onClick: controller.pipeline( /*#__PURE__*/function () {
25721
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
25722
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
25910
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
25911
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
25723
25912
  while (1) {
25724
- switch (_context3.prev = _context3.next) {
25913
+ switch (_context2.prev = _context2.next) {
25725
25914
  case 0:
25726
25915
  s.goodsListState.importGoods.isVisibleDrawer = true;
25727
25916
 
25728
25917
  case 1:
25729
25918
  case "end":
25730
- return _context3.stop();
25919
+ return _context2.stop();
25731
25920
  }
25732
25921
  }
25733
- }, _callee3);
25922
+ }, _callee2);
25734
25923
  }));
25735
25924
 
25736
- return function (_x5) {
25925
+ return function (_x2) {
25737
25926
  return _ref2.apply(this, arguments);
25738
25927
  };
25739
25928
  }())
@@ -25771,13 +25960,13 @@ var useColumns$1 = (function (form) {
25771
25960
  rules: getReplenishRules('itemModelName')
25772
25961
  })( /*#__PURE__*/React.createElement(MyInput$3, {
25773
25962
  onChange: function () {
25774
- var _onChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
25963
+ var _onChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
25775
25964
  var key, value;
25776
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
25965
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
25777
25966
  while (1) {
25778
- switch (_context4.prev = _context4.next) {
25967
+ switch (_context3.prev = _context3.next) {
25779
25968
  case 0:
25780
- _context4.next = 2;
25969
+ _context3.next = 2;
25781
25970
  return controller.wait();
25782
25971
 
25783
25972
  case 2:
@@ -25788,10 +25977,10 @@ var useColumns$1 = (function (form) {
25788
25977
 
25789
25978
  case 6:
25790
25979
  case "end":
25791
- return _context4.stop();
25980
+ return _context3.stop();
25792
25981
  }
25793
25982
  }
25794
- }, _callee4);
25983
+ }, _callee3);
25795
25984
  }));
25796
25985
 
25797
25986
  function onChange() {
@@ -25829,12 +26018,12 @@ var useColumns$1 = (function (form) {
25829
26018
  return rootElement || document.body;
25830
26019
  },
25831
26020
  onChange: function () {
25832
- var _onChange2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
25833
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
26021
+ var _onChange2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
26022
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
25834
26023
  while (1) {
25835
- switch (_context5.prev = _context5.next) {
26024
+ switch (_context4.prev = _context4.next) {
25836
26025
  case 0:
25837
- _context5.next = 2;
26026
+ _context4.next = 2;
25838
26027
  return controller.wait();
25839
26028
 
25840
26029
  case 2:
@@ -25844,10 +26033,10 @@ var useColumns$1 = (function (form) {
25844
26033
 
25845
26034
  case 3:
25846
26035
  case "end":
25847
- return _context5.stop();
26036
+ return _context4.stop();
25848
26037
  }
25849
26038
  }
25850
- }, _callee5);
26039
+ }, _callee4);
25851
26040
  }));
25852
26041
 
25853
26042
  function onChange() {
@@ -25883,18 +26072,18 @@ var useColumns$1 = (function (form) {
25883
26072
  message: '数量必须为数字'
25884
26073
  }, {
25885
26074
  validator: function () {
25886
- var _validator2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_, value, callback) {
26075
+ var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_, value, callback) {
25887
26076
  var isvalue, isPrice;
25888
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
26077
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
25889
26078
  while (1) {
25890
- switch (_context6.prev = _context6.next) {
26079
+ switch (_context5.prev = _context5.next) {
25891
26080
  case 0:
25892
26081
  if (!isValidateGood) {
25893
- _context6.next = 10;
26082
+ _context5.next = 10;
25894
26083
  break;
25895
26084
  }
25896
26085
 
25897
- _context6.next = 3;
26086
+ _context5.next = 3;
25898
26087
  return controller.wait();
25899
26088
 
25900
26089
  case 3:
@@ -25902,15 +26091,15 @@ var useColumns$1 = (function (form) {
25902
26091
  isPrice = !!getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') || getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') === 0;
25903
26092
 
25904
26093
  if (!(isvalue || isPrice === isvalue)) {
25905
- _context6.next = 7;
26094
+ _context5.next = 7;
25906
26095
  break;
25907
26096
  }
25908
26097
 
25909
- return _context6.abrupt("return");
26098
+ return _context5.abrupt("return");
25910
26099
 
25911
26100
  case 7:
25912
26101
  callback('请输入数量');
25913
- _context6.next = 11;
26102
+ _context5.next = 11;
25914
26103
  break;
25915
26104
 
25916
26105
  case 10:
@@ -25918,14 +26107,14 @@ var useColumns$1 = (function (form) {
25918
26107
 
25919
26108
  case 11:
25920
26109
  case "end":
25921
- return _context6.stop();
26110
+ return _context5.stop();
25922
26111
  }
25923
26112
  }
25924
- }, _callee6);
26113
+ }, _callee5);
25925
26114
  }));
25926
26115
 
25927
- function validator(_x6, _x7, _x8) {
25928
- return _validator2.apply(this, arguments);
26116
+ function validator(_x3, _x4, _x5) {
26117
+ return _validator.apply(this, arguments);
25929
26118
  }
25930
26119
 
25931
26120
  return validator;
@@ -25938,21 +26127,21 @@ var useColumns$1 = (function (form) {
25938
26127
  maxLength: 25,
25939
26128
  loading: isCipher$1(changeField, "quantity"),
25940
26129
  onChange: function () {
25941
- var _onChange3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
25942
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
26130
+ var _onChange3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
26131
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
25943
26132
  while (1) {
25944
- switch (_context7.prev = _context7.next) {
26133
+ switch (_context6.prev = _context6.next) {
25945
26134
  case 0:
25946
26135
  setChangeField('quantity');
25947
- _context7.next = 3;
26136
+ _context6.next = 3;
25948
26137
  return onChangeQuantity$1(controller, form, record);
25949
26138
 
25950
26139
  case 3:
25951
26140
  case "end":
25952
- return _context7.stop();
26141
+ return _context6.stop();
25953
26142
  }
25954
26143
  }
25955
- }, _callee7);
26144
+ }, _callee6);
25956
26145
  }));
25957
26146
 
25958
26147
  function onChange() {
@@ -25988,13 +26177,13 @@ var useColumns$1 = (function (form) {
25988
26177
  message: '单价必须为数字'
25989
26178
  }, {
25990
26179
  validator: function () {
25991
- var _validator3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_, value, callback) {
26180
+ var _validator2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_, value, callback) {
25992
26181
  var isQuantity, isvalue;
25993
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
26182
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
25994
26183
  while (1) {
25995
- switch (_context8.prev = _context8.next) {
26184
+ switch (_context7.prev = _context7.next) {
25996
26185
  case 0:
25997
- _context8.next = 2;
26186
+ _context7.next = 2;
25998
26187
  return controller.wait();
25999
26188
 
26000
26189
  case 2:
@@ -26002,25 +26191,25 @@ var useColumns$1 = (function (form) {
26002
26191
  isvalue = !!value || value === 0;
26003
26192
 
26004
26193
  if (!(isvalue || isQuantity === isvalue)) {
26005
- _context8.next = 6;
26194
+ _context7.next = 6;
26006
26195
  break;
26007
26196
  }
26008
26197
 
26009
- return _context8.abrupt("return");
26198
+ return _context7.abrupt("return");
26010
26199
 
26011
26200
  case 6:
26012
26201
  callback('请输入单价');
26013
26202
 
26014
26203
  case 7:
26015
26204
  case "end":
26016
- return _context8.stop();
26205
+ return _context7.stop();
26017
26206
  }
26018
26207
  }
26019
- }, _callee8);
26208
+ }, _callee7);
26020
26209
  }));
26021
26210
 
26022
- function validator(_x9, _x10, _x11) {
26023
- return _validator3.apply(this, arguments);
26211
+ function validator(_x6, _x7, _x8) {
26212
+ return _validator2.apply(this, arguments);
26024
26213
  }
26025
26214
 
26026
26215
  return validator;
@@ -26031,6 +26220,7 @@ var useColumns$1 = (function (form) {
26031
26220
  textAlign: 'right'
26032
26221
  },
26033
26222
  maxLength: 25,
26223
+ disabled: differenceInputStateEnabled,
26034
26224
  loading: isCipher$1(changeField, 'priceIncludeTax'),
26035
26225
  onChange: function onChange() {
26036
26226
  setChangeField('priceIncludeTax');
@@ -26063,13 +26253,13 @@ var useColumns$1 = (function (form) {
26063
26253
  message: '单价必须为数字'
26064
26254
  }, {
26065
26255
  validator: function () {
26066
- var _validator4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_, value, callback) {
26256
+ var _validator3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_, value, callback) {
26067
26257
  var isQuantity, isvalue;
26068
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
26258
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
26069
26259
  while (1) {
26070
- switch (_context9.prev = _context9.next) {
26260
+ switch (_context8.prev = _context8.next) {
26071
26261
  case 0:
26072
- _context9.next = 2;
26262
+ _context8.next = 2;
26073
26263
  return controller.wait();
26074
26264
 
26075
26265
  case 2:
@@ -26077,25 +26267,25 @@ var useColumns$1 = (function (form) {
26077
26267
  isvalue = !!value || value === 0;
26078
26268
 
26079
26269
  if (!(isvalue || isQuantity === isvalue)) {
26080
- _context9.next = 6;
26270
+ _context8.next = 6;
26081
26271
  break;
26082
26272
  }
26083
26273
 
26084
- return _context9.abrupt("return");
26274
+ return _context8.abrupt("return");
26085
26275
 
26086
26276
  case 6:
26087
26277
  callback('请输入单价');
26088
26278
 
26089
26279
  case 7:
26090
26280
  case "end":
26091
- return _context9.stop();
26281
+ return _context8.stop();
26092
26282
  }
26093
26283
  }
26094
- }, _callee9);
26284
+ }, _callee8);
26095
26285
  }));
26096
26286
 
26097
- function validator(_x12, _x13, _x14) {
26098
- return _validator4.apply(this, arguments);
26287
+ function validator(_x9, _x10, _x11) {
26288
+ return _validator3.apply(this, arguments);
26099
26289
  }
26100
26290
 
26101
26291
  return validator;
@@ -26106,6 +26296,7 @@ var useColumns$1 = (function (form) {
26106
26296
  textAlign: 'right'
26107
26297
  },
26108
26298
  maxLength: 25,
26299
+ disabled: differenceInputStateEnabled,
26109
26300
  loading: isCipher$1(changeField, 'priceExcludeTax'),
26110
26301
  onChange: function onChange() {
26111
26302
  setChangeField('priceExcludeTax');
@@ -26141,10 +26332,10 @@ var useColumns$1 = (function (form) {
26141
26332
  message: '金额错误,请重新输入'
26142
26333
  }, {
26143
26334
  validator: function () {
26144
- var _validator5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_, value, callback) {
26145
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
26335
+ var _validator4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_, value, callback) {
26336
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
26146
26337
  while (1) {
26147
- switch (_context10.prev = _context10.next) {
26338
+ switch (_context9.prev = _context9.next) {
26148
26339
  case 0:
26149
26340
  if ("".concat(value).split('.')[0].length > priceIntegerDigit) {
26150
26341
  callback("\u91D1\u989D\u6574\u6570\u90E8\u5206\u4E0D\u80FD\u5927\u4E8E".concat(priceIntegerDigit, "\u4F4D\uFF0C\u5C0F\u6570\u70B9\u540E\u6700\u591A2\u4F4D"));
@@ -26152,24 +26343,24 @@ var useColumns$1 = (function (form) {
26152
26343
 
26153
26344
  case 1:
26154
26345
  case "end":
26155
- return _context10.stop();
26346
+ return _context9.stop();
26156
26347
  }
26157
26348
  }
26158
- }, _callee10);
26349
+ }, _callee9);
26159
26350
  }));
26160
26351
 
26161
- function validator(_x15, _x16, _x17) {
26162
- return _validator5.apply(this, arguments);
26352
+ function validator(_x12, _x13, _x14) {
26353
+ return _validator4.apply(this, arguments);
26163
26354
  }
26164
26355
 
26165
26356
  return validator;
26166
26357
  }()
26167
26358
  }, {
26168
26359
  validator: function () {
26169
- var _validator6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_, value, callback) {
26170
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
26360
+ var _validator5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_, value, callback) {
26361
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
26171
26362
  while (1) {
26172
- switch (_context11.prev = _context11.next) {
26363
+ switch (_context10.prev = _context10.next) {
26173
26364
  case 0:
26174
26365
  if (deduction && parseFloat(value) <= deduction) {
26175
26366
  callback('扣除额不能大于等于价税合计');
@@ -26177,14 +26368,14 @@ var useColumns$1 = (function (form) {
26177
26368
 
26178
26369
  case 1:
26179
26370
  case "end":
26180
- return _context11.stop();
26371
+ return _context10.stop();
26181
26372
  }
26182
26373
  }
26183
- }, _callee11);
26374
+ }, _callee10);
26184
26375
  }));
26185
26376
 
26186
- function validator(_x18, _x19, _x20) {
26187
- return _validator6.apply(this, arguments);
26377
+ function validator(_x15, _x16, _x17) {
26378
+ return _validator5.apply(this, arguments);
26188
26379
  }
26189
26380
 
26190
26381
  return validator;
@@ -26195,10 +26386,33 @@ var useColumns$1 = (function (form) {
26195
26386
  textAlign: 'right'
26196
26387
  },
26197
26388
  loading: isCipher$1(changeField, 'lineAmountIncludeTax'),
26389
+ readOnly: differenceInputStateEnabled,
26198
26390
  onChange: function onChange() {
26199
26391
  setChangeField('lineAmountIncludeTax');
26200
26392
  onChangeLineAmountIncludeTax$1(controller, form, record);
26201
- }
26393
+ },
26394
+ onClick: differenceInputStateEnabled ? function () {
26395
+ controller.run( /*#__PURE__*/function () {
26396
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(s) {
26397
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
26398
+ while (1) {
26399
+ switch (_context11.prev = _context11.next) {
26400
+ case 0:
26401
+ s.differenceInputState.open = true;
26402
+
26403
+ case 1:
26404
+ case "end":
26405
+ return _context11.stop();
26406
+ }
26407
+ }
26408
+ }, _callee11);
26409
+ }));
26410
+
26411
+ return function (_x18) {
26412
+ return _ref3.apply(this, arguments);
26413
+ };
26414
+ }());
26415
+ } : undefined
26202
26416
  })));
26203
26417
  } else {
26204
26418
  return /*#__PURE__*/React.createElement("span", {
@@ -26229,7 +26443,7 @@ var useColumns$1 = (function (form) {
26229
26443
  message: '金额错误,请重新输入'
26230
26444
  }, {
26231
26445
  validator: function () {
26232
- var _validator7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_, value, callback) {
26446
+ var _validator6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_, value, callback) {
26233
26447
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
26234
26448
  while (1) {
26235
26449
  switch (_context12.prev = _context12.next) {
@@ -26246,8 +26460,8 @@ var useColumns$1 = (function (form) {
26246
26460
  }, _callee12);
26247
26461
  }));
26248
26462
 
26249
- function validator(_x21, _x22, _x23) {
26250
- return _validator7.apply(this, arguments);
26463
+ function validator(_x19, _x20, _x21) {
26464
+ return _validator6.apply(this, arguments);
26251
26465
  }
26252
26466
 
26253
26467
  return validator;
@@ -26258,10 +26472,33 @@ var useColumns$1 = (function (form) {
26258
26472
  textAlign: 'right'
26259
26473
  },
26260
26474
  loading: isCipher$1(changeField, 'lineAmountExcludeTax'),
26475
+ readOnly: differenceInputStateEnabled,
26261
26476
  onChange: function onChange() {
26262
26477
  setChangeField('lineAmountExcludeTax');
26263
26478
  onChangeLineAmountExcludeTax$1(controller, form, record);
26264
- }
26479
+ },
26480
+ onClick: differenceInputStateEnabled ? function () {
26481
+ controller.run( /*#__PURE__*/function () {
26482
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(s) {
26483
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
26484
+ while (1) {
26485
+ switch (_context13.prev = _context13.next) {
26486
+ case 0:
26487
+ s.differenceInputState.open = true;
26488
+
26489
+ case 1:
26490
+ case "end":
26491
+ return _context13.stop();
26492
+ }
26493
+ }
26494
+ }, _callee13);
26495
+ }));
26496
+
26497
+ return function (_x22) {
26498
+ return _ref4.apply(this, arguments);
26499
+ };
26500
+ }());
26501
+ } : undefined
26265
26502
  })));
26266
26503
  } else {
26267
26504
  return /*#__PURE__*/React.createElement("span", {
@@ -26343,12 +26580,12 @@ var useColumns$1 = (function (form) {
26343
26580
  var lineAmountIncludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountIncludeTax) || 0; //不含税金额
26344
26581
  // const lineAmountExcludeTax = lineAmountIncludeTax-value;
26345
26582
 
26583
+ var deduction = controller.state.goodsListState.deduction || 0;
26346
26584
  var lineAmountExcludeTax = (editGood === null || editGood === void 0 ? void 0 : editGood.lineAmountExcludeTax) || 0;
26347
26585
  var taxRate = editGood === null || editGood === void 0 ? void 0 : editGood.taxRate;
26348
26586
 
26349
26587
  if (lineAmountExcludeTax && (taxRate || taxRate === 0) && lineAmountIncludeTax) {
26350
- // const total = bignumber(lineAmountExcludeTax * taxRate / 100);
26351
- 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) {
26588
+ var total = chain$1(bignumber(lineAmountExcludeTax)).subtract(bignumber(deduction || 0)).multiply(bignumber(taxRate || 0)).divide(bignumber(100));
26352
26589
 
26353
26590
  if (Math.abs(total.subtract(bignumber(value || 0)).done().toNumber()) <= 0.06) {
26354
26591
  callback();
@@ -26410,7 +26647,7 @@ var useColumns$1 = (function (form) {
26410
26647
  ellipsis: true
26411
26648
  });
26412
26649
  });
26413
- }, [isTaxIncluded, editGood, controller, taxRateList, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, isStart, calculateType]); // React.useEffect(() => {
26650
+ }, [isTaxIncluded, editGood, controller, taxRateList, changeField, deduction, isMyShow, searchValue, model, columnsReplenish, isStart, calculateType, differenceInputStateEnabled]); // React.useEffect(() => {
26414
26651
  // clearTimeout(t)
26415
26652
  // const t = setTimeout(() => { setChangeField('') }, 1000);
26416
26653
  // return () => { clearTimeout(t) }
@@ -26739,6 +26976,9 @@ function useWindowClick$1(controller) {
26739
26976
  /** 点击组件外部 保存正在编辑的货物 */
26740
26977
  React.useEffect(function () {
26741
26978
  var click = function click() {
26979
+ var _controller$state$goo;
26980
+
26981
+ if (!((_controller$state$goo = controller.state.goodsListState) === null || _controller$state$goo === void 0 ? void 0 : _controller$state$goo.isSaveRowOutside)) return;
26742
26982
  setTimeout(controller.saveEditGood);
26743
26983
  };
26744
26984
 
@@ -36731,6 +36971,918 @@ var Main$6 = decorator(Form.create())(function (props) {
36731
36971
  }))));
36732
36972
  });
36733
36973
 
36974
+ var css_248z$F = ".kts-difference-modal {\n color: rgba(0, 0, 0, 0.85);\n font-size: 14px;\n}\n.kts-difference-modal-item {\n flex: 1 1 240px;\n min-width: 200px;\n margin-right: 16px;\n}\n.kts-difference-modal-item:last-child {\n margin-right: 0;\n}\n.kts-difference-modal-item .ktsAntX-form-item-label > label {\n color: rgba(0, 0, 0, 0.85);\n}\n.kts-difference-modal-mode {\n display: flex;\n align-items: center;\n margin: 4px 0 12px;\n}\n.kts-difference-modal-mode-label {\n margin-right: 12px;\n}\n.kts-difference-modal-mode-tip {\n margin-left: 12px;\n color: rgba(0, 0, 0, 0.45);\n}\n.kts-difference-modal-form .ktsAntX-form-item {\n margin-bottom: 12px;\n}\n.kts-difference-modal-row {\n display: flex;\n flex-wrap: wrap;\n}\n.kts-difference-modal-cell {\n flex: 1 1 180px;\n min-width: 160px;\n margin-right: 16px;\n}\n.kts-difference-modal-cell:last-child {\n margin-right: 0;\n}\n.kts-difference-modal-cell-remark {\n flex: 2 1 260px;\n}\n.kts-difference-modal-total {\n display: flex;\n justify-content: flex-end;\n margin: 4px 0 8px;\n}\n.kts-difference-modal-total-item {\n margin-left: 24px;\n}\n.kts-difference-modal-total-item b {\n font-weight: 600;\n}\n.kts-difference-modal-table {\n /* kts-xui 全局表格样式(padding: 6px 20px; height: 50px; font-size: 12px)特异性更高,这里提高特异性覆盖。\n 内边距收窄到 10px,避免列宽较窄时表头文字折行(纳税人识别号等)。 */\n}\n.kts-difference-modal-table .ktsAntX-table.ktsAntX-table-small > .ktsAntX-table-container > .ktsAntX-table-content > table > .ktsAntX-table-thead > tr > th {\n padding: 0 10px;\n height: 40px;\n background: #fafafa;\n color: rgba(0, 0, 0, 0.85);\n font-size: 14px;\n font-weight: 500;\n}\n.kts-difference-modal-table .ktsAntX-table.ktsAntX-table-small > .ktsAntX-table-container > .ktsAntX-table-content > table > .ktsAntX-table-tbody > tr > td {\n padding: 0 10px;\n height: 32px;\n}\n/** 底部按钮区:与 body 内容对齐(body 左右各 20px 内边距) */\n.kts-difference-modal-footer {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n margin: 0 20px;\n}\n.kts-difference-modal-footer button {\n margin-left: 0;\n}\n";
36975
+ styleInject(css_248z$F);
36976
+
36977
+ var _voucherTypeRules;
36978
+ /** 数据来源枚举 */
36979
+
36980
+ var DataSrcEnum;
36981
+
36982
+ (function (DataSrcEnum) {
36983
+ /** 手工录入 */
36984
+ DataSrcEnum[DataSrcEnum["MANUAL"] = 1] = "MANUAL";
36985
+ /** 勾选录入 */
36986
+
36987
+ DataSrcEnum[DataSrcEnum["CHECK"] = 2] = "CHECK";
36988
+ /** 模板录入 */
36989
+
36990
+ DataSrcEnum[DataSrcEnum["TEMPLATE"] = 3] = "TEMPLATE";
36991
+ })(DataSrcEnum || (DataSrcEnum = {}));
36992
+
36993
+ var dataSrcOptions = [{
36994
+ value: DataSrcEnum.MANUAL,
36995
+ label: '手工录入'
36996
+ }, {
36997
+ value: DataSrcEnum.CHECK,
36998
+ label: '勾选录入'
36999
+ }, {
37000
+ value: DataSrcEnum.TEMPLATE,
37001
+ label: '模板录入'
37002
+ }];
37003
+ /** 静态的表格列定义(表头按参考图,待确认) */
37004
+
37005
+ var columns = [{
37006
+ title: '序号',
37007
+ dataIndex: 'sortNumber',
37008
+ key: 'sortNumber',
37009
+ width: 55,
37010
+ fixed: 'left',
37011
+ render: function render(text, record, index) {
37012
+ return index + 1;
37013
+ }
37014
+ }, {
37015
+ title: '合计金额',
37016
+ dataIndex: 'voucherTotalAmt',
37017
+ key: 'voucherTotalAmt',
37018
+ width: 90,
37019
+ align: 'right',
37020
+ render: function render(text) {
37021
+ return text ? text.toFixed(2) : '0.00';
37022
+ }
37023
+ }, {
37024
+ title: '扣除金额',
37025
+ dataIndex: 'currentDeductAmt',
37026
+ key: 'currentDeductAmt',
37027
+ width: 90,
37028
+ align: 'right',
37029
+ render: function render(text) {
37030
+ return text ? text.toFixed(2) : '0.00';
37031
+ }
37032
+ }, {
37033
+ title: '凭证类型',
37034
+ dataIndex: 'voucherType',
37035
+ key: 'voucherType',
37036
+ width: 110,
37037
+ render: function render(text) {
37038
+ var _voucherTypeOptions$f;
37039
+
37040
+ return (_voucherTypeOptions$f = voucherTypeOptions.find(function (item) {
37041
+ return item.value === text;
37042
+ })) === null || _voucherTypeOptions$f === void 0 ? void 0 : _voucherTypeOptions$f.label;
37043
+ }
37044
+ }, // { title: '数电票号码', dataIndex: 'xxx', key: 'xxx', width: 110 },
37045
+ {
37046
+ title: '凭证代码',
37047
+ dataIndex: 'deductVoucherCode',
37048
+ key: 'deductVoucherCode',
37049
+ width: 80
37050
+ }, // { title: '发票号码', dataIndex: 'invoiceNumber', key: 'invoiceNumber', width: 80 },
37051
+ {
37052
+ title: '凭证号码',
37053
+ dataIndex: 'deductVoucherNo',
37054
+ key: 'deductVoucherNo',
37055
+ width: 80
37056
+ }, {
37057
+ title: '开具日期',
37058
+ dataIndex: 'issueDate',
37059
+ key: 'issueDate',
37060
+ width: 120,
37061
+ render: function render(text) {
37062
+ return text ? hooks(text).format('YYYY-MM-DD') : '';
37063
+ }
37064
+ }, {
37065
+ title: '备注',
37066
+ dataIndex: 'remark',
37067
+ key: 'remark',
37068
+ width: 80
37069
+ }, {
37070
+ title: '来源',
37071
+ dataIndex: 'dataSrc',
37072
+ key: 'dataSrc',
37073
+ width: 80,
37074
+ render: function render(text) {
37075
+ var _dataSrcOptions$find;
37076
+
37077
+ return (_dataSrcOptions$find = dataSrcOptions.find(function (item) {
37078
+ return item.value === text;
37079
+ })) === null || _dataSrcOptions$find === void 0 ? void 0 : _dataSrcOptions$find.label;
37080
+ }
37081
+ }];
37082
+ /** 凭证类型候枚举 */
37083
+
37084
+ var VoucherType;
37085
+
37086
+ (function (VoucherType) {
37087
+ /** 专用发票 */
37088
+ VoucherType["SPECIAL_INVOICE"] = "10";
37089
+ /** 普通发票 */
37090
+
37091
+ VoucherType["COMMON_INVOICE"] = "11";
37092
+ /** 海关进口增值税专用缴款书 */
37093
+
37094
+ VoucherType["CUSTOMS_IMPORT_VAT_PAYMENT_BOOK"] = "12";
37095
+ /** 航空运输电子客票行程单 */
37096
+
37097
+ VoucherType["AIR_TRANSPORT_ELECTRONIC_TICKET"] = "13";
37098
+ /** 铁路电子客票 */
37099
+
37100
+ VoucherType["RAILWAY_ELECTRONIC_TICKET"] = "14";
37101
+ /** 税收完税证明(契税) */
37102
+
37103
+ VoucherType["TAX_PAYMENT_CERTIFICATE"] = "15";
37104
+ /** 中央非税收入统一票据(土地出让金) */
37105
+
37106
+ VoucherType["CENTRAL_NON_TAX_REVENUE_UNIFIED_RECEIPT"] = "16";
37107
+ /** 财政票据 */
37108
+
37109
+ VoucherType["FINANCIAL_BILL"] = "05";
37110
+ /** 法院裁决书 */
37111
+
37112
+ VoucherType["COURT_DECISION"] = "06";
37113
+ /** 其他扣除凭证 */
37114
+
37115
+ VoucherType["OTHER_DEDUCTION_VOUCHER"] = "09";
37116
+ })(VoucherType || (VoucherType = {}));
37117
+ /** 最多只允许输入两位小数的校验器 */
37118
+
37119
+
37120
+ var maxTwoDecimalsValidator = function maxTwoDecimalsValidator(_rule, value) {
37121
+ if (value === undefined || value === null || value === '') {
37122
+ return Promise.resolve();
37123
+ }
37124
+
37125
+ var decimalPart = String(value).split('.')[1];
37126
+
37127
+ if (decimalPart && decimalPart.length > 2) {
37128
+ return Promise.reject(new Error('最多只能输入2位小数'));
37129
+ }
37130
+
37131
+ return Promise.resolve();
37132
+ };
37133
+ /** 凭证明细表单实例(用于跨字段校验:本次扣除金额 <= 凭证合计金额) */
37134
+
37135
+ var formInstance;
37136
+ /**
37137
+ * 本次扣除金额不能大于凭证合计金额的校验器
37138
+ */
37139
+
37140
+ var deductAmtNotExceedVoucherTotalValidator = function deductAmtNotExceedVoucherTotalValidator(_rule, value) {
37141
+ var _formInstance;
37142
+
37143
+ if (value === undefined || value === null || value === '') {
37144
+ return Promise.resolve();
37145
+ }
37146
+
37147
+ var voucherTotalAmt = (_formInstance = formInstance) === null || _formInstance === void 0 ? void 0 : _formInstance.getFieldValue('voucherTotalAmt');
37148
+
37149
+ if (voucherTotalAmt === undefined || voucherTotalAmt === null || voucherTotalAmt === '') {
37150
+ return Promise.resolve();
37151
+ }
37152
+
37153
+ if (Number(value) > Number(voucherTotalAmt)) {
37154
+ return Promise.reject(new Error('本次扣除金额不能大于凭证合计金额'));
37155
+ }
37156
+
37157
+ return Promise.resolve();
37158
+ };
37159
+ /** 凭证类型候选项 */
37160
+
37161
+ var voucherTypeOptions = [{
37162
+ value: VoucherType.SPECIAL_INVOICE,
37163
+ label: '专用发票'
37164
+ }, {
37165
+ value: VoucherType.COMMON_INVOICE,
37166
+ label: '普通发票'
37167
+ }, {
37168
+ value: VoucherType.CUSTOMS_IMPORT_VAT_PAYMENT_BOOK,
37169
+ label: '海关进口增值税专用缴款书'
37170
+ }, {
37171
+ value: VoucherType.AIR_TRANSPORT_ELECTRONIC_TICKET,
37172
+ label: '航空运输电子客票行程单'
37173
+ }, {
37174
+ value: VoucherType.RAILWAY_ELECTRONIC_TICKET,
37175
+ label: '铁路电子客票'
37176
+ }, {
37177
+ value: VoucherType.TAX_PAYMENT_CERTIFICATE,
37178
+ label: '税收完税证明(契税)'
37179
+ }, {
37180
+ value: VoucherType.CENTRAL_NON_TAX_REVENUE_UNIFIED_RECEIPT,
37181
+ label: '中央非税收入统一票据(土地出让金)'
37182
+ }, {
37183
+ value: VoucherType.FINANCIAL_BILL,
37184
+ label: '财政票据'
37185
+ }, {
37186
+ value: VoucherType.COURT_DECISION,
37187
+ label: '法院裁决书'
37188
+ }, {
37189
+ value: VoucherType.OTHER_DEDUCTION_VOUCHER,
37190
+ label: '其他扣除凭证'
37191
+ }];
37192
+ /** 凭证类型候 - 规则字典 */
37193
+
37194
+ var voucherTypeRules = (_voucherTypeRules = {}, _defineProperty(_voucherTypeRules, VoucherType.SPECIAL_INVOICE, {
37195
+ 'deductVoucherNo': [{
37196
+ required: true
37197
+ }],
37198
+ 'issueDate': [{
37199
+ required: true
37200
+ }],
37201
+ 'voucherTotalAmt': [{
37202
+ required: true
37203
+ }],
37204
+ 'currentDeductAmt': [{
37205
+ required: true
37206
+ }]
37207
+ }), _defineProperty(_voucherTypeRules, VoucherType.COMMON_INVOICE, {
37208
+ 'deductVoucherNo': [{
37209
+ required: true
37210
+ }],
37211
+ 'issueDate': [{
37212
+ required: true
37213
+ }],
37214
+ 'voucherTotalAmt': [{
37215
+ required: true
37216
+ }],
37217
+ 'currentDeductAmt': [{
37218
+ required: true
37219
+ }]
37220
+ }), _defineProperty(_voucherTypeRules, VoucherType.CUSTOMS_IMPORT_VAT_PAYMENT_BOOK, {
37221
+ 'deductVoucherNo': [{
37222
+ required: true
37223
+ }],
37224
+ 'issueDate': [{
37225
+ required: true
37226
+ }],
37227
+ 'voucherTotalAmt': [{
37228
+ required: true
37229
+ }],
37230
+ 'currentDeductAmt': [{
37231
+ required: true
37232
+ }]
37233
+ }), _defineProperty(_voucherTypeRules, VoucherType.AIR_TRANSPORT_ELECTRONIC_TICKET, {
37234
+ 'deductVoucherNo': [{
37235
+ required: true
37236
+ }],
37237
+ 'issueDate': [{
37238
+ required: true
37239
+ }],
37240
+ 'voucherTotalAmt': [{
37241
+ required: true
37242
+ }],
37243
+ 'currentDeductAmt': [{
37244
+ required: true
37245
+ }]
37246
+ }), _defineProperty(_voucherTypeRules, VoucherType.RAILWAY_ELECTRONIC_TICKET, {
37247
+ 'deductVoucherNo': [{
37248
+ required: true
37249
+ }],
37250
+ 'issueDate': [{
37251
+ required: true
37252
+ }],
37253
+ 'voucherTotalAmt': [{
37254
+ required: true
37255
+ }],
37256
+ 'currentDeductAmt': [{
37257
+ required: true
37258
+ }]
37259
+ }), _defineProperty(_voucherTypeRules, VoucherType.TAX_PAYMENT_CERTIFICATE, {
37260
+ 'deductVoucherNo': [{
37261
+ required: true
37262
+ }],
37263
+ 'voucherTotalAmt': [{
37264
+ required: true
37265
+ }],
37266
+ 'currentDeductAmt': [{
37267
+ required: true
37268
+ }]
37269
+ }), _defineProperty(_voucherTypeRules, VoucherType.CENTRAL_NON_TAX_REVENUE_UNIFIED_RECEIPT, {
37270
+ 'deductVoucherCode': [{
37271
+ required: true
37272
+ }],
37273
+ 'deductVoucherNo': [{
37274
+ required: true
37275
+ }],
37276
+ 'voucherTotalAmt': [{
37277
+ required: true
37278
+ }],
37279
+ 'currentDeductAmt': [{
37280
+ required: true
37281
+ }]
37282
+ }), _defineProperty(_voucherTypeRules, VoucherType.FINANCIAL_BILL, {
37283
+ 'deductVoucherNo': [{
37284
+ required: true
37285
+ }],
37286
+ 'voucherTotalAmt': [{
37287
+ required: true
37288
+ }],
37289
+ 'currentDeductAmt': [{
37290
+ required: true
37291
+ }]
37292
+ }), _defineProperty(_voucherTypeRules, VoucherType.COURT_DECISION, {
37293
+ 'deductVoucherNo': [{
37294
+ required: true
37295
+ }],
37296
+ 'voucherTotalAmt': [{
37297
+ required: true
37298
+ }],
37299
+ 'currentDeductAmt': [{
37300
+ required: true
37301
+ }]
37302
+ }), _defineProperty(_voucherTypeRules, VoucherType.OTHER_DEDUCTION_VOUCHER, {
37303
+ 'voucherTotalAmt': [{
37304
+ required: true
37305
+ }],
37306
+ 'currentDeductAmt': [{
37307
+ required: true
37308
+ }],
37309
+ 'remark': [{
37310
+ required: true
37311
+ }]
37312
+ }), _voucherTypeRules);
37313
+ /** 静态的申报项目名称候选项 */
37314
+
37315
+ var projectOptions = [{
37316
+ value: 'KC0209',
37317
+ label: '小规模纳税人销售其取得(不含自建)的不动产(不含个人销售购买的住房)'
37318
+ }, {
37319
+ value: 'KC0210',
37320
+ label: '一般纳税人销售其取得(不含自建)的2016年4月30日前取得的不动产'
37321
+ }, {
37322
+ value: 'KC0211',
37323
+ label: '房地产开发企业销售房地产项目'
37324
+ }, {
37325
+ value: 'KC0212',
37326
+ label: '银行业金融机构、金融资产管理公司中的增值税一般纳税人处置抵债不动产'
37327
+ }];
37328
+ /**
37329
+ * 差额录入弹窗(静态)
37330
+ */
37331
+
37332
+ function DifferenceInputModal(props) {
37333
+ var _voucherTypeRules$vou, _voucherTypeRules$vou2, _voucherTypeRules$vou3, _voucherTypeRules$vou4, _voucherTypeRules$vou5, _voucherTypeRules$vou6;
37334
+
37335
+ var _props$open = props.open,
37336
+ open = _props$open === void 0 ? true : _props$open,
37337
+ onCancel = props.onCancel,
37338
+ onOk = props.onOk;
37339
+
37340
+ var _Form$useForm = Form$2.useForm(),
37341
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
37342
+ form = _Form$useForm2[0];
37343
+
37344
+ var _Form$useForm3 = Form$2.useForm(),
37345
+ _Form$useForm4 = _slicedToArray(_Form$useForm3, 1),
37346
+ topForm = _Form$useForm4[0];
37347
+ /** 记录表单实例,供跨字段校验使用 */
37348
+
37349
+
37350
+ React.useEffect(function () {
37351
+ formInstance = form;
37352
+ return function () {
37353
+ formInstance = undefined;
37354
+ };
37355
+ }, [form]);
37356
+
37357
+ var _React$useState = React.useState([]),
37358
+ _React$useState2 = _slicedToArray(_React$useState, 2),
37359
+ dataSource = _React$useState2[0],
37360
+ setDataSource = _React$useState2[1];
37361
+
37362
+ var voucherType = Form$2.useWatch('voucherType', form) || form.getFieldValue('voucherType');
37363
+ var projectCode = Form$2.useWatch('projectCode', topForm) || topForm.getFieldValue('projectCode');
37364
+ /** 凭证合计金额(用于联动校验本次扣除金额) */
37365
+
37366
+ var voucherTotalAmt = Form$2.useWatch('voucherTotalAmt', form);
37367
+ /** 凭证合计金额变化时,重新校验本次扣除金额 */
37368
+
37369
+ React.useEffect(function () {
37370
+ if (!form.isFieldTouched('currentDeductAmt')) return;
37371
+ form.validateFields(['currentDeductAmt']).catch(function () {});
37372
+ }, [form, voucherTotalAmt]);
37373
+ /** 扣除额 (明细汇总) */
37374
+
37375
+ var deductTotal = React.useMemo(function () {
37376
+ return dataSource.reduce(function (acc, curr) {
37377
+ return acc + (curr.currentDeductAmt || 0);
37378
+ }, 0);
37379
+ }, [dataSource]);
37380
+ /** 合计金额(明细汇总) */
37381
+
37382
+ var voucherTotal = React.useMemo(function () {
37383
+ return dataSource.reduce(function (acc, curr) {
37384
+ return acc + (curr.voucherTotalAmt || 0);
37385
+ }, 0);
37386
+ }, [dataSource]);
37387
+ var total = props.total || {
37388
+ voucherTotal: voucherTotal,
37389
+ deductTotal: deductTotal
37390
+ };
37391
+ var onFinish = React.useCallback(function (values) {
37392
+ setDataSource([].concat(_toConsumableArray(dataSource), [_objectSpread2(_objectSpread2({}, values), {}, {
37393
+ $index: v4(),
37394
+ dataSrc: DataSrcEnum.MANUAL
37395
+ })]));
37396
+ form.resetFields();
37397
+ }, [dataSource, form]);
37398
+ var onOkClick = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
37399
+ var values;
37400
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
37401
+ while (1) {
37402
+ switch (_context.prev = _context.next) {
37403
+ case 0:
37404
+ _context.next = 2;
37405
+ return topForm.validateFields();
37406
+
37407
+ case 2:
37408
+ values = _context.sent;
37409
+ onOk === null || onOk === void 0 ? void 0 : onOk(_objectSpread2(_objectSpread2({}, values), {}, {
37410
+ deductTotal: deductTotal,
37411
+ rows: dataSource
37412
+ }));
37413
+
37414
+ case 4:
37415
+ case "end":
37416
+ return _context.stop();
37417
+ }
37418
+ }
37419
+ }, _callee);
37420
+ })), [dataSource, onOk]);
37421
+ React.useEffect(function () {
37422
+ console.log('DifferenceInputModal props.value ===>', props.value);
37423
+
37424
+ if (open) {
37425
+ var _props$value, _props$value2, _props$value3;
37426
+
37427
+ form.resetFields();
37428
+ topForm.resetFields();
37429
+ topForm.setFieldsValue({
37430
+ amountIncludeTax: (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.amountIncludeTax,
37431
+ projectCode: (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.projectCode
37432
+ });
37433
+ setDataSource(((_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.rows) || []);
37434
+ }
37435
+ }, [open, props.value]);
37436
+ return /*#__PURE__*/React.createElement(Modal$2, {
37437
+ title: "\u5DEE\u989D\u5F55\u5165",
37438
+ destroyOnClose: true,
37439
+ width: 1000,
37440
+ open: open,
37441
+ onCancel: onCancel,
37442
+ footer: /*#__PURE__*/React.createElement(Space$1, {
37443
+ align: "end",
37444
+ className: "kts-difference-modal-footer"
37445
+ }, /*#__PURE__*/React.createElement(Button$1, {
37446
+ onClick: onCancel
37447
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button$1, {
37448
+ type: "primary",
37449
+ onClick: onOkClick
37450
+ }, "\u786E\u5B9A"))
37451
+ }, /*#__PURE__*/React.createElement("div", {
37452
+ className: "kts-difference-modal"
37453
+ }, /*#__PURE__*/React.createElement("div", {
37454
+ className: "kts-difference-modal-top"
37455
+ }, /*#__PURE__*/React.createElement(Form$2, {
37456
+ form: topForm,
37457
+ layout: 'horizontal',
37458
+ className: "kts-difference-modal-top-form",
37459
+ labelCol: {
37460
+ flex: '100px'
37461
+ }
37462
+ }, /*#__PURE__*/React.createElement(Row$1, null, /*#__PURE__*/React.createElement(Col$1, {
37463
+ span: 12
37464
+ }, /*#__PURE__*/React.createElement(Form$2.Item, {
37465
+ name: 'amountIncludeTax',
37466
+ label: "\u542B\u7A0E\u9500\u552E\u989D",
37467
+ className: "kts-difference-modal-item",
37468
+ rules: [{
37469
+ required: true,
37470
+ message: '请输入含税销售额'
37471
+ }, {
37472
+ validator: maxTwoDecimalsValidator
37473
+ }]
37474
+ }, /*#__PURE__*/React.createElement(InputNumber$1, {
37475
+ style: {
37476
+ width: '100%'
37477
+ },
37478
+ placeholder: "\u8BF7\u8F93\u5165\u542B\u7A0E\u9500\u552E\u989D"
37479
+ }))), /*#__PURE__*/React.createElement(Col$1, {
37480
+ span: 12
37481
+ }, /*#__PURE__*/React.createElement(Form$2.Item, {
37482
+ label: "\u6263\u9664\u989D",
37483
+ className: "kts-difference-modal-item"
37484
+ }, /*#__PURE__*/React.createElement(InputNumber$1, {
37485
+ style: {
37486
+ width: '100%'
37487
+ },
37488
+ disabled: true,
37489
+ placeholder: "\u8BF7\u8F93\u5165\u6263\u9664\u989D",
37490
+ value: deductTotal || 0
37491
+ }))), /*#__PURE__*/React.createElement(Col$1, {
37492
+ span: 24
37493
+ }, /*#__PURE__*/React.createElement(Form$2.Item, {
37494
+ name: 'projectCode',
37495
+ label: "\u7533\u62A5\u9879\u76EE\u540D\u79F0",
37496
+ className: "kts-difference-modal-item",
37497
+ rules: [{
37498
+ required: true,
37499
+ message: '请选择申报项目名称'
37500
+ }]
37501
+ }, /*#__PURE__*/React.createElement(Select$2, {
37502
+ options: projectOptions,
37503
+ placeholder: "\u8BF7\u9009\u62E9\u7533\u62A5\u9879\u76EE\u540D\u79F0"
37504
+ }))), /*#__PURE__*/React.createElement(Col$1, {
37505
+ span: 24
37506
+ }, /*#__PURE__*/React.createElement(Form$2.Item, {
37507
+ label: "\u5F55\u5165\u65B9\u5F0F",
37508
+ className: "kts-difference-modal-item"
37509
+ }, /*#__PURE__*/React.createElement(Radio$1.Group, {
37510
+ value: 'manual',
37511
+ optionType: 'button',
37512
+ options: [{
37513
+ label: '手工录入',
37514
+ value: 'manual'
37515
+ }, {
37516
+ label: '勾选录入',
37517
+ value: '1',
37518
+ disabled: true
37519
+ }, {
37520
+ label: '模板录入',
37521
+ value: '2',
37522
+ disabled: true
37523
+ }]
37524
+ })))))), /*#__PURE__*/React.createElement(Card, {
37525
+ className: "kts-difference-modal-form",
37526
+ bodyStyle: {
37527
+ padding: '20px 20px 10px 0'
37528
+ }
37529
+ }, /*#__PURE__*/React.createElement(Form$2, {
37530
+ form: form,
37531
+ layout: "horizontal",
37532
+ labelCol: {
37533
+ flex: '110px'
37534
+ },
37535
+ onFinish: onFinish
37536
+ }, /*#__PURE__*/React.createElement(Row$1, {
37537
+ className: "kts-difference-modal-row"
37538
+ }, /*#__PURE__*/React.createElement(Col$1, {
37539
+ span: 24 / 3
37540
+ }, /*#__PURE__*/React.createElement(Form$2.Item, {
37541
+ name: 'voucherType',
37542
+ label: "\u51ED\u8BC1\u7C7B\u578B",
37543
+ className: "kts-difference-modal-cell",
37544
+ rules: [{
37545
+ required: true,
37546
+ message: '请选择凭证类型'
37547
+ }]
37548
+ }, /*#__PURE__*/React.createElement(Select$2, {
37549
+ options: voucherTypeOptions,
37550
+ placeholder: "\u8BF7\u9009\u62E9\u51ED\u8BC1\u7C7B\u578B"
37551
+ }))), /*#__PURE__*/React.createElement(Col$1, {
37552
+ span: 24 / 3
37553
+ }, /*#__PURE__*/React.createElement(Form$2.Item, {
37554
+ name: 'issueDate',
37555
+ label: "\u5F00\u5177\u65F6\u95F4",
37556
+ className: "kts-difference-modal-cell",
37557
+ rules: (_voucherTypeRules$vou = voucherTypeRules[voucherType]) === null || _voucherTypeRules$vou === void 0 ? void 0 : _voucherTypeRules$vou['issueDate']
37558
+ }, /*#__PURE__*/React.createElement(DatePicker, {
37559
+ style: {
37560
+ width: '100%'
37561
+ },
37562
+ placeholder: "\u8BF7\u8F93\u5165\u5F00\u5177\u65F6\u95F4"
37563
+ }))), /*#__PURE__*/React.createElement(Col$1, {
37564
+ span: 24 / 3
37565
+ }, /*#__PURE__*/React.createElement(Form$2.Item, {
37566
+ name: 'deductVoucherNo',
37567
+ label: "\u51ED\u8BC1\u53F7\u7801",
37568
+ className: "kts-difference-modal-cell",
37569
+ rules: (_voucherTypeRules$vou2 = voucherTypeRules[voucherType]) === null || _voucherTypeRules$vou2 === void 0 ? void 0 : _voucherTypeRules$vou2['deductVoucherNo']
37570
+ }, /*#__PURE__*/React.createElement(Input$2, {
37571
+ placeholder: "\u8BF7\u8F93\u5165\u51ED\u8BC1\u53F7\u7801"
37572
+ }))), /*#__PURE__*/React.createElement(Col$1, {
37573
+ span: 24 / 3
37574
+ }, /*#__PURE__*/React.createElement(Form$2.Item, {
37575
+ name: 'deductVoucherCode',
37576
+ label: "\u51ED\u8BC1\u4EE3\u7801",
37577
+ className: "kts-difference-modal-cell",
37578
+ rules: (_voucherTypeRules$vou3 = voucherTypeRules[voucherType]) === null || _voucherTypeRules$vou3 === void 0 ? void 0 : _voucherTypeRules$vou3['deductVoucherCode']
37579
+ }, /*#__PURE__*/React.createElement(Input$2, {
37580
+ placeholder: "\u8BF7\u8F93\u5165\u51ED\u8BC1\u4EE3\u7801"
37581
+ }))), /*#__PURE__*/React.createElement(Col$1, {
37582
+ span: 24 / 3
37583
+ }, /*#__PURE__*/React.createElement(Form$2.Item, {
37584
+ name: 'voucherTotalAmt',
37585
+ label: "\u51ED\u8BC1\u5408\u8BA1\u91D1\u989D",
37586
+ className: "kts-difference-modal-cell",
37587
+ rules: [].concat(_toConsumableArray(((_voucherTypeRules$vou4 = voucherTypeRules[voucherType]) === null || _voucherTypeRules$vou4 === void 0 ? void 0 : _voucherTypeRules$vou4['voucherTotalAmt']) || []), [{
37588
+ validator: maxTwoDecimalsValidator
37589
+ }])
37590
+ }, /*#__PURE__*/React.createElement(InputNumber$1, {
37591
+ style: {
37592
+ width: '100%'
37593
+ },
37594
+ placeholder: "\u8BF7\u8F93\u5165\u51ED\u8BC1\u5408\u8BA1\u91D1\u989D"
37595
+ }))), /*#__PURE__*/React.createElement(Col$1, {
37596
+ span: 24 / 3
37597
+ }, /*#__PURE__*/React.createElement(Form$2.Item, {
37598
+ name: 'currentDeductAmt',
37599
+ label: "\u672C\u6B21\u6263\u9664\u91D1\u989D",
37600
+ className: "kts-difference-modal-cell",
37601
+ rules: [].concat(_toConsumableArray(((_voucherTypeRules$vou5 = voucherTypeRules[voucherType]) === null || _voucherTypeRules$vou5 === void 0 ? void 0 : _voucherTypeRules$vou5['currentDeductAmt']) || []), [{
37602
+ validator: maxTwoDecimalsValidator
37603
+ }, {
37604
+ validator: deductAmtNotExceedVoucherTotalValidator
37605
+ }])
37606
+ }, /*#__PURE__*/React.createElement(InputNumber$1, {
37607
+ style: {
37608
+ width: '100%'
37609
+ },
37610
+ placeholder: "\u8BF7\u8F93\u5165\u672C\u6B21\u6263\u9664\u91D1\u989D"
37611
+ }))), /*#__PURE__*/React.createElement(Col$1, {
37612
+ span: 24 / 3
37613
+ }, /*#__PURE__*/React.createElement(Form$2.Item, {
37614
+ name: 'remark',
37615
+ label: "\u5907\u6CE8",
37616
+ className: "kts-difference-modal-cell",
37617
+ rules: (_voucherTypeRules$vou6 = voucherTypeRules[voucherType]) === null || _voucherTypeRules$vou6 === void 0 ? void 0 : _voucherTypeRules$vou6['remark']
37618
+ }, /*#__PURE__*/React.createElement(Input$2, {
37619
+ placeholder: "\u8BF7\u8F93\u5165\u5907\u6CE8"
37620
+ }))), /*#__PURE__*/React.createElement(Col$1, {
37621
+ span: 24
37622
+ }, /*#__PURE__*/React.createElement("div", {
37623
+ style: {
37624
+ display: 'flex',
37625
+ justifyContent: 'center',
37626
+ gap: 10
37627
+ }
37628
+ }, /*#__PURE__*/React.createElement(Button$1, {
37629
+ type: 'primary',
37630
+ size: 'small',
37631
+ onClick: function onClick() {
37632
+ return form.resetFields();
37633
+ }
37634
+ }, "\u6E05\u9664"), /*#__PURE__*/React.createElement(Button$1, {
37635
+ type: 'primary',
37636
+ size: 'small',
37637
+ onClick: function onClick() {
37638
+ return form.submit();
37639
+ }
37640
+ }, "\u6DFB\u52A0\u5E76\u7EE7\u7EED")))))), /*#__PURE__*/React.createElement("div", {
37641
+ className: "kts-difference-modal-total",
37642
+ style: {
37643
+ marginTop: 30
37644
+ }
37645
+ }, /*#__PURE__*/React.createElement("span", {
37646
+ className: "kts-difference-modal-total-item"
37647
+ }, "\u51ED\u8BC1\u5408\u8BA1\u91D1\u989D\u603B\u8BA1\uFF1A", /*#__PURE__*/React.createElement("b", null, total.voucherTotal.toFixed(2)), " \u5143"), /*#__PURE__*/React.createElement("span", {
37648
+ className: "kts-difference-modal-total-item"
37649
+ }, "\u672C\u6B21\u6263\u9664\u91D1\u989D\u603B\u8BA1\uFF1A", /*#__PURE__*/React.createElement("b", null, total.deductTotal.toFixed(2)), " \u5143")), /*#__PURE__*/React.createElement(Table$2, {
37650
+ className: "kts-difference-modal-table",
37651
+ bordered: true,
37652
+ size: "small",
37653
+ rowKey: "voucherNo",
37654
+ columns: [].concat(columns, [{
37655
+ title: '操作',
37656
+ dataIndex: 'action',
37657
+ key: 'action',
37658
+ width: 80,
37659
+ fixed: 'right',
37660
+ render: function render(text, record) {
37661
+ return /*#__PURE__*/React.createElement(Button$1, {
37662
+ type: 'link',
37663
+ size: 'small',
37664
+ onClick: function onClick() {
37665
+ return setDataSource(dataSource.filter(function (item) {
37666
+ return item.$index !== record.$index;
37667
+ }));
37668
+ }
37669
+ }, "\u5220\u9664");
37670
+ }
37671
+ }]),
37672
+ dataSource: dataSource,
37673
+ scroll: {
37674
+ x: 1000
37675
+ },
37676
+ pagination: {
37677
+ pageSize: 10,
37678
+ total: dataSource.length,
37679
+ showSizeChanger: false,
37680
+ showQuickJumper: false,
37681
+ showTotal: function showTotal(total) {
37682
+ return "\u5171 ".concat(total, " \u6761");
37683
+ }
37684
+ }
37685
+ })));
37686
+ }
37687
+
37688
+ var DifferenceInput = (function () {
37689
+ var controller = Invoice.useInvoiceController();
37690
+ var open = controller.useMemo(function (s) {
37691
+ return s.differenceInputState.open && s.differenceInputState.enabled && !s.goodsListState.importGoods.isVisibleDrawer;
37692
+ }, []);
37693
+ var data = controller.useMemo(function (s) {
37694
+ return s.differenceInputState.data;
37695
+ }, []);
37696
+ /** 计算中启动字段 */
37697
+
37698
+ var setChangeField = React.useCallback(function (value) {
37699
+ return controller.run( /*#__PURE__*/function () {
37700
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
37701
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
37702
+ while (1) {
37703
+ switch (_context.prev = _context.next) {
37704
+ case 0:
37705
+ s.calculatingField = value;
37706
+
37707
+ case 1:
37708
+ case "end":
37709
+ return _context.stop();
37710
+ }
37711
+ }
37712
+ }, _callee);
37713
+ }));
37714
+
37715
+ return function (_x) {
37716
+ return _ref.apply(this, arguments);
37717
+ };
37718
+ }());
37719
+ }, []);
37720
+ var value = React.useMemo(function () {
37721
+ var _controller$state$goo;
37722
+
37723
+ return {
37724
+ rows: (data === null || data === void 0 ? void 0 : data.rows) || [],
37725
+ projectCode: (data === null || data === void 0 ? void 0 : data.projectCode) || '',
37726
+ deductTotal: (data === null || data === void 0 ? void 0 : data.deductTotal) || 0,
37727
+ amountIncludeTax: ((_controller$state$goo = controller.state.goodsListState.form) === null || _controller$state$goo === void 0 ? void 0 : _controller$state$goo.getFieldValue('lineAmountIncludeTax')) || 0
37728
+ };
37729
+ }, [data, open]);
37730
+ React.useEffect(function () {
37731
+ controller.state.goodsListState.isSaveRowOutside = !open;
37732
+
37733
+ if (open) {
37734
+ controller.run( /*#__PURE__*/function () {
37735
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
37736
+ var _s$goodsListState$for;
37737
+
37738
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
37739
+ while (1) {
37740
+ switch (_context2.prev = _context2.next) {
37741
+ case 0:
37742
+ if (s.differenceInputState.data) {
37743
+ _context2.next = 2;
37744
+ break;
37745
+ }
37746
+
37747
+ return _context2.abrupt("return");
37748
+
37749
+ case 2:
37750
+ s.differenceInputState.data.amountIncludeTax = (_s$goodsListState$for = s.goodsListState.form) === null || _s$goodsListState$for === void 0 ? void 0 : _s$goodsListState$for.getFieldValue('lineAmountIncludeTax');
37751
+
37752
+ case 3:
37753
+ case "end":
37754
+ return _context2.stop();
37755
+ }
37756
+ }
37757
+ }, _callee2);
37758
+ }));
37759
+
37760
+ return function (_x2) {
37761
+ return _ref2.apply(this, arguments);
37762
+ };
37763
+ }());
37764
+ }
37765
+ }, [open]);
37766
+ console.log('DifferenceInput data ===>', data);
37767
+ return /*#__PURE__*/React.createElement(DifferenceInputModal, {
37768
+ value: value,
37769
+ open: open,
37770
+ onCancel: function onCancel() {
37771
+ controller.run( /*#__PURE__*/function () {
37772
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
37773
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
37774
+ while (1) {
37775
+ switch (_context3.prev = _context3.next) {
37776
+ case 0:
37777
+ s.differenceInputState.open = false;
37778
+
37779
+ case 1:
37780
+ case "end":
37781
+ return _context3.stop();
37782
+ }
37783
+ }
37784
+ }, _callee3);
37785
+ }));
37786
+
37787
+ return function (_x3) {
37788
+ return _ref3.apply(this, arguments);
37789
+ };
37790
+ }());
37791
+ },
37792
+ onOk: function () {
37793
+ var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(data) {
37794
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
37795
+ while (1) {
37796
+ switch (_context6.prev = _context6.next) {
37797
+ case 0:
37798
+ _context6.next = 2;
37799
+ return controller.run( /*#__PURE__*/function () {
37800
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(s) {
37801
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
37802
+ while (1) {
37803
+ switch (_context4.prev = _context4.next) {
37804
+ case 0:
37805
+ s.goodsListState.isTaxIncluded = true;
37806
+
37807
+ case 1:
37808
+ case "end":
37809
+ return _context4.stop();
37810
+ }
37811
+ }
37812
+ }, _callee4);
37813
+ }));
37814
+
37815
+ return function (_x5) {
37816
+ return _ref4.apply(this, arguments);
37817
+ };
37818
+ }());
37819
+
37820
+ case 2:
37821
+ _context6.next = 4;
37822
+ return controller.wait();
37823
+
37824
+ case 4:
37825
+ _context6.next = 6;
37826
+ return controller.run( /*#__PURE__*/function () {
37827
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(s) {
37828
+ var amountIncludeTax, form, record, _s$goodsListState$for2;
37829
+
37830
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
37831
+ while (1) {
37832
+ switch (_context5.prev = _context5.next) {
37833
+ case 0:
37834
+ s.differenceInputState.data = data;
37835
+ s.goodsListState.deduction = data.deductTotal;
37836
+ s.differenceInputState.open = false;
37837
+ s.differenceInputState.amountIncludeTax = data.amountIncludeTax;
37838
+ amountIncludeTax = data.amountIncludeTax || 0; // const deductTotal = data.deductTotal || 0;
37839
+
37840
+ form = s.goodsListState.form;
37841
+ record = s.goodsListState.editGood;
37842
+
37843
+ if (!(s.goodsListState.goodsList && s.goodsListState.goodsList.length > 0)) {
37844
+ _context5.next = 13;
37845
+ break;
37846
+ }
37847
+
37848
+ s.goodsListState.editGood = record;
37849
+ (_s$goodsListState$for2 = s.goodsListState.form) === null || _s$goodsListState$for2 === void 0 ? void 0 : _s$goodsListState$for2.setFieldsValue({
37850
+ lineAmountIncludeTax: amountIncludeTax
37851
+ });
37852
+ setChangeField('lineAmountIncludeTax');
37853
+ _context5.next = 13;
37854
+ return onChangeLineAmountIncludeTax(controller, form, record);
37855
+
37856
+ case 13:
37857
+ case "end":
37858
+ return _context5.stop();
37859
+ }
37860
+ }
37861
+ }, _callee5);
37862
+ }));
37863
+
37864
+ return function (_x6) {
37865
+ return _ref5.apply(this, arguments);
37866
+ };
37867
+ }());
37868
+
37869
+ case 6:
37870
+ case "end":
37871
+ return _context6.stop();
37872
+ }
37873
+ }
37874
+ }, _callee6);
37875
+ }));
37876
+
37877
+ function onOk(_x4) {
37878
+ return _onOk.apply(this, arguments);
37879
+ }
37880
+
37881
+ return onOk;
37882
+ }()
37883
+ });
37884
+ });
37885
+
36734
37886
  // const config = {
36735
37887
  // number: 'BigNumber',
36736
37888
  // precision: 64,
@@ -36840,13 +37992,11 @@ var Main$7 = function Main(props) {
36840
37992
  setKey = _React$useState2[1];
36841
37993
 
36842
37994
  useToGenerateId(controller);
37995
+ useRecalculateTax(controller); // useClearGoodsList(controller);
37996
+
36843
37997
  React.useEffect(function () {
36844
37998
  setKey(key + 1);
36845
- }, [controller]); // React.useEffect(() => {
36846
- // setKey(key + 1)
36847
- // controller.state.stakeholder.enables = ['taxAmount']
36848
- // }, [controller]);
36849
-
37999
+ }, [controller]);
36850
38000
  return /*#__PURE__*/React.createElement(InvoiceContext.Provider, {
36851
38001
  key: key,
36852
38002
  value: controller
@@ -36882,7 +38032,7 @@ var Main$7 = function Main(props) {
36882
38032
  /** 销售方 */
36883
38033
  , props.sign || /*#__PURE__*/React.createElement(Sign, null)
36884
38034
  /** 落款 */
36885
- , props.footExpand), /*#__PURE__*/React.createElement(ImportBuyerDrawer, null), /*#__PURE__*/React.createElement(ImportGoodsDrawer, null), /*#__PURE__*/React.createElement(EndowCodeDrawer, null), /*#__PURE__*/React.createElement(AddComparisonDrawer, null), /*#__PURE__*/React.createElement(MeiTanModal, null), " ");
38035
+ , props.footExpand), /*#__PURE__*/React.createElement(ImportBuyerDrawer, null), /*#__PURE__*/React.createElement(ImportGoodsDrawer, null), /*#__PURE__*/React.createElement(EndowCodeDrawer, null), /*#__PURE__*/React.createElement(AddComparisonDrawer, null), /*#__PURE__*/React.createElement(DifferenceInput, null), /*#__PURE__*/React.createElement(MeiTanModal, null), " ");
36886
38036
  };
36887
38037
  /** 数电 */
36888
38038
 
@@ -36898,6 +38048,8 @@ var Digtal = function Digtal(props) {
36898
38048
  setKey = _React$useState4[1];
36899
38049
 
36900
38050
  useToGenerateId(controller);
38051
+ useRecalculateTax(controller); // useClearGoodsList(controller);
38052
+
36901
38053
  React.useEffect(function () {
36902
38054
  setKey(key + 1);
36903
38055
  }, [controller]);
@@ -36938,11 +38090,21 @@ var Digtal = function Digtal(props) {
36938
38090
  /** 特殊信息 */
36939
38091
  , props.sign || /*#__PURE__*/React.createElement(SignDigtal, null)
36940
38092
  /** 落款 */
36941
- ), /*#__PURE__*/React.createElement(ImportGoodsDrawer, null), /*#__PURE__*/React.createElement(ImportPassengerDrawer, null), /*#__PURE__*/React.createElement(EndowCodeDrawer, null), /*#__PURE__*/React.createElement(MeiTanModal, null), " ");
36942
- };
38093
+ ), /*#__PURE__*/React.createElement(ImportGoodsDrawer, null), /*#__PURE__*/React.createElement(ImportPassengerDrawer, null), /*#__PURE__*/React.createElement(EndowCodeDrawer, null), /*#__PURE__*/React.createElement(DifferenceInput, null), /*#__PURE__*/React.createElement(MeiTanModal, null), " ");
38094
+ }; // 切换到差额开票清楚商品列表
38095
+ // function useClearGoodsList(controller: InvoiceController) {
38096
+ // const enabled = controller.useMemo((s) => s.differenceInputState.enabled, []);
38097
+ // React.useEffect(() => {
38098
+ // controller.run(async (s) => {
38099
+ // if (enabled) {
38100
+ // s.goodsListState.goodsList = [];
38101
+ // }
38102
+ // })
38103
+ // }, [controller, enabled]);
38104
+ // }
36943
38105
 
36944
- var css_248z$F = ".taxdetailsbox {\n display: flex;\n justify-content: flex-start;\n flex-direction: row;\n}\n.taxdetailsbox .taxrightbox {\n width: 340px;\n position: absolute;\n right: 30px;\n top: 79px;\n bottom: 50px;\n min-height: 300px;\n}\n.taxdetailsbox .taxrightbox .taxdesc {\n height: calc(100vh - 323px);\n min-height: 105px;\n overflow: auto;\n}\n";
36945
- styleInject(css_248z$F);
38106
+ var css_248z$G = ".taxdetailsbox {\n display: flex;\n justify-content: flex-start;\n flex-direction: row;\n}\n.taxdetailsbox .taxrightbox {\n width: 340px;\n position: absolute;\n right: 30px;\n top: 79px;\n bottom: 50px;\n min-height: 300px;\n}\n.taxdetailsbox .taxrightbox .taxdesc {\n height: calc(100vh - 323px);\n min-height: 105px;\n overflow: auto;\n}\n";
38107
+ styleInject(css_248z$G);
36946
38108
 
36947
38109
  function TaxClassificationModal(props) {
36948
38110
  var _props$info6;
@@ -37076,7 +38238,7 @@ function TaxClassificationModal(props) {
37076
38238
  switcherIcon: /*#__PURE__*/React.createElement(Icon$2, {
37077
38239
  type: "down"
37078
38240
  })
37079
- }))), /*#__PURE__*/React.createElement(Card, {
38241
+ }))), /*#__PURE__*/React.createElement(Card$1, {
37080
38242
  className: "taxrightbox"
37081
38243
  }, /*#__PURE__*/React.createElement(Form$1, _objectSpread2(_objectSpread2({
37082
38244
  form: form
@@ -37098,4 +38260,4 @@ function TaxClassificationModal(props) {
37098
38260
  }, /*#__PURE__*/React.createElement(FormReadOnly, null))))));
37099
38261
  }
37100
38262
 
37101
- export { Invoice, InvoiceController, InvoiceTypeModal, TaxClassificationModal };
38263
+ export { DifferenceInputModal, Invoice, InvoiceController, InvoiceTypeModal, TaxClassificationModal };