kts-component-invoice-operate 3.2.121 → 3.2.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.d.ts +2 -0
- package/dist/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.d.ts +2 -0
- package/dist/Invoice/ui/digtal/GoodsList/hook/useColumns/autoFillFn/index.d.ts +2 -0
- package/dist/index.esm.js +1111 -787
- package/dist/index.js +1110 -786
- package/package.json +1 -1
- package/src/Invoice/Invoice-digtal/_test/importGoods/index.tsx +12 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/index.ts +4 -0
- package/src/Invoice/ui/default/EndowCodeDrawer/index.tsx +9 -10
- package/src/Invoice/ui/default/GoodsList/hook/useColumns/autoFillFn/index.ts +99 -0
- package/src/Invoice/ui/default/GoodsList/ui/TaxIncludedSwitch/index.tsx +2 -1
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/autoFillFn/index.ts +105 -1
- package/src/Invoice/ui/digtal/GoodsList/hook/useColumns/ui/ItemNameInput/index.tsx +0 -2
- package/src/Invoice/ui/digtal/GoodsList/ui/TaxIncludedSwitch/index.tsx +3 -2
- package/src/Invoice/ui/digtal/Sign/index.tsx +1 -1
package/dist/index.js
CHANGED
|
@@ -1099,6 +1099,7 @@ var GoodsListState = /*#__PURE__*/_createClass(function GoodsListState() {
|
|
|
1099
1099
|
this.deduction = 0;
|
|
1100
1100
|
this.goodMax = void 0;
|
|
1101
1101
|
this.isSwitchTax = void 0;
|
|
1102
|
+
this.isRecalculateWhenSwitchTax = false;
|
|
1102
1103
|
this.isAddDiscount = void 0;
|
|
1103
1104
|
this.isAddRow = true;
|
|
1104
1105
|
this.isRemRow = true;
|
|
@@ -9341,6 +9342,177 @@ var onChangeItemCode = /*#__PURE__*/function () {
|
|
|
9341
9342
|
return _ref18.apply(this, arguments);
|
|
9342
9343
|
};
|
|
9343
9344
|
}();
|
|
9345
|
+
/** 修改了含税开关 重新计算 */
|
|
9346
|
+
|
|
9347
|
+
var onChangeSwitchTax = /*#__PURE__*/function () {
|
|
9348
|
+
var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(controller, isTaxIncluded) {
|
|
9349
|
+
var calculatingDigits;
|
|
9350
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
9351
|
+
while (1) {
|
|
9352
|
+
switch (_context22.prev = _context22.next) {
|
|
9353
|
+
case 0:
|
|
9354
|
+
if (controller.state.goodsListState.isRecalculateWhenSwitchTax) {
|
|
9355
|
+
_context22.next = 3;
|
|
9356
|
+
break;
|
|
9357
|
+
}
|
|
9358
|
+
|
|
9359
|
+
controller.pipeline( /*#__PURE__*/function () {
|
|
9360
|
+
var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(s) {
|
|
9361
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
9362
|
+
while (1) {
|
|
9363
|
+
switch (_context20.prev = _context20.next) {
|
|
9364
|
+
case 0:
|
|
9365
|
+
s.goodsListState = _objectSpread2(_objectSpread2({}, s.goodsListState), {}, {
|
|
9366
|
+
isTaxIncluded: isTaxIncluded
|
|
9367
|
+
});
|
|
9368
|
+
|
|
9369
|
+
case 1:
|
|
9370
|
+
case "end":
|
|
9371
|
+
return _context20.stop();
|
|
9372
|
+
}
|
|
9373
|
+
}
|
|
9374
|
+
}, _callee20);
|
|
9375
|
+
}));
|
|
9376
|
+
|
|
9377
|
+
return function (_x40) {
|
|
9378
|
+
return _ref21.apply(this, arguments);
|
|
9379
|
+
};
|
|
9380
|
+
}())();
|
|
9381
|
+
return _context22.abrupt("return");
|
|
9382
|
+
|
|
9383
|
+
case 3:
|
|
9384
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
9385
|
+
_context22.next = 6;
|
|
9386
|
+
return controller.saveEditGood();
|
|
9387
|
+
|
|
9388
|
+
case 6:
|
|
9389
|
+
_context22.next = 8;
|
|
9390
|
+
return controller.wait();
|
|
9391
|
+
|
|
9392
|
+
case 8:
|
|
9393
|
+
_context22.next = 10;
|
|
9394
|
+
return controller.run( /*#__PURE__*/function () {
|
|
9395
|
+
var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(s) {
|
|
9396
|
+
var _s$goodsListState, needRefresh, newGoodsList;
|
|
9397
|
+
|
|
9398
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
9399
|
+
while (1) {
|
|
9400
|
+
switch (_context21.prev = _context21.next) {
|
|
9401
|
+
case 0:
|
|
9402
|
+
if (!s.goodsListState.editGood) {
|
|
9403
|
+
_context21.next = 3;
|
|
9404
|
+
break;
|
|
9405
|
+
}
|
|
9406
|
+
|
|
9407
|
+
ktsComponentsAntdX3.message.error({
|
|
9408
|
+
content: '你正在编辑一个货物',
|
|
9409
|
+
key: '你正在编辑一个货物'
|
|
9410
|
+
});
|
|
9411
|
+
return _context21.abrupt("return");
|
|
9412
|
+
|
|
9413
|
+
case 3:
|
|
9414
|
+
s.goodsListState.isTaxIncluded = isTaxIncluded;
|
|
9415
|
+
|
|
9416
|
+
try {
|
|
9417
|
+
needRefresh = false;
|
|
9418
|
+
|
|
9419
|
+
if (((_s$goodsListState = s.goodsListState) === null || _s$goodsListState === void 0 ? void 0 : _s$goodsListState.goodsList) && s.goodsListState.goodsList.length) {
|
|
9420
|
+
newGoodsList = s.goodsListState.goodsList.map(function (good) {
|
|
9421
|
+
var sourceQuantity = good.quantity,
|
|
9422
|
+
sourcePriceExcludeTax = good.priceExcludeTax,
|
|
9423
|
+
sourcePriceIncludeTax = good.priceIncludeTax,
|
|
9424
|
+
sourceLineAmountExcludeTax = good.lineAmountExcludeTax,
|
|
9425
|
+
sourceLineAmountIncludeTax = good.lineAmountIncludeTax,
|
|
9426
|
+
taxRate = good.taxRate;
|
|
9427
|
+
|
|
9428
|
+
if (isTaxIncluded) {
|
|
9429
|
+
if (!sourceQuantity && sourceQuantity !== 0) return good;
|
|
9430
|
+
if (!sourcePriceIncludeTax && sourcePriceIncludeTax !== 0) return good;
|
|
9431
|
+
if (!taxRate && taxRate !== 0) return good;
|
|
9432
|
+
|
|
9433
|
+
if (sourcePriceExcludeTax && sourceLineAmountExcludeTax && mathjs.equal(countPrice(sourceLineAmountExcludeTax, sourceQuantity) || 0, sourcePriceExcludeTax)) {
|
|
9434
|
+
return good;
|
|
9435
|
+
} else {
|
|
9436
|
+
needRefresh = true;
|
|
9437
|
+
}
|
|
9438
|
+
|
|
9439
|
+
var quantity = format15(sourceQuantity, calculatingDigits);
|
|
9440
|
+
var priceIncludeTax = format15(sourcePriceIncludeTax, calculatingDigits);
|
|
9441
|
+
var lineAmountIncludeTax = format2(evaluate("".concat(priceIncludeTax, " * ").concat(quantity)));
|
|
9442
|
+
var taxAmount = countTaxAmount(lineAmountIncludeTax, controller.state.goodsListState.deduction, taxRate);
|
|
9443
|
+
var lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount);
|
|
9444
|
+
var priceExcludeTax = countPrice(lineAmountExcludeTax, quantity, controller.state.calculatingDigits);
|
|
9445
|
+
return _objectSpread2(_objectSpread2({}, good), {}, {
|
|
9446
|
+
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
9447
|
+
lineAmountIncludeTax: lineAmountIncludeTax,
|
|
9448
|
+
taxAmount: taxAmount,
|
|
9449
|
+
priceExcludeTax: priceExcludeTax
|
|
9450
|
+
});
|
|
9451
|
+
} else {
|
|
9452
|
+
if (!sourceQuantity && sourceQuantity !== 0) return good;
|
|
9453
|
+
if (!sourcePriceExcludeTax && sourcePriceExcludeTax !== 0) return good;
|
|
9454
|
+
if (!taxRate && taxRate !== 0) return good;
|
|
9455
|
+
|
|
9456
|
+
if (sourcePriceIncludeTax && sourceLineAmountIncludeTax && mathjs.equal(countPrice(sourceLineAmountIncludeTax, sourceQuantity) || 0, sourcePriceIncludeTax)) {
|
|
9457
|
+
return good;
|
|
9458
|
+
} else {
|
|
9459
|
+
needRefresh = true;
|
|
9460
|
+
}
|
|
9461
|
+
|
|
9462
|
+
var _quantity5 = format15(sourceQuantity, calculatingDigits);
|
|
9463
|
+
|
|
9464
|
+
var _priceExcludeTax3 = format15(sourcePriceExcludeTax, calculatingDigits);
|
|
9465
|
+
|
|
9466
|
+
var _lineAmountExcludeTax3 = format2(evaluate("".concat(_priceExcludeTax3, " * ").concat(_quantity5)));
|
|
9467
|
+
|
|
9468
|
+
var _lineAmountIncludeTax3 = format2(evaluate("".concat(_lineAmountExcludeTax3, " * (1+(").concat(taxRate, "/100))")));
|
|
9469
|
+
|
|
9470
|
+
var _priceIncludeTax3 = format15(evaluate("".concat(_lineAmountIncludeTax3, " / ").concat(_quantity5)), calculatingDigits);
|
|
9471
|
+
|
|
9472
|
+
var _taxAmount = evaluate("".concat(_lineAmountIncludeTax3, " - ").concat(_lineAmountExcludeTax3));
|
|
9473
|
+
|
|
9474
|
+
return _objectSpread2(_objectSpread2({}, good), {}, {
|
|
9475
|
+
lineAmountExcludeTax: _lineAmountExcludeTax3,
|
|
9476
|
+
lineAmountIncludeTax: _lineAmountIncludeTax3,
|
|
9477
|
+
taxAmount: _taxAmount,
|
|
9478
|
+
priceIncludeTax: _priceIncludeTax3
|
|
9479
|
+
});
|
|
9480
|
+
}
|
|
9481
|
+
});
|
|
9482
|
+
|
|
9483
|
+
if (needRefresh) {
|
|
9484
|
+
s.goodsListState.goodsList = newGoodsList;
|
|
9485
|
+
}
|
|
9486
|
+
}
|
|
9487
|
+
} catch (e) {
|
|
9488
|
+
console.error('切换税率重新计算出错', e, s.goodsListState);
|
|
9489
|
+
}
|
|
9490
|
+
|
|
9491
|
+
case 5:
|
|
9492
|
+
case "end":
|
|
9493
|
+
return _context21.stop();
|
|
9494
|
+
}
|
|
9495
|
+
}
|
|
9496
|
+
}, _callee21);
|
|
9497
|
+
}));
|
|
9498
|
+
|
|
9499
|
+
return function (_x41) {
|
|
9500
|
+
return _ref22.apply(this, arguments);
|
|
9501
|
+
};
|
|
9502
|
+
}());
|
|
9503
|
+
|
|
9504
|
+
case 10:
|
|
9505
|
+
case "end":
|
|
9506
|
+
return _context22.stop();
|
|
9507
|
+
}
|
|
9508
|
+
}
|
|
9509
|
+
}, _callee22);
|
|
9510
|
+
}));
|
|
9511
|
+
|
|
9512
|
+
return function onChangeSwitchTax(_x38, _x39) {
|
|
9513
|
+
return _ref20.apply(this, arguments);
|
|
9514
|
+
};
|
|
9515
|
+
}();
|
|
9344
9516
|
|
|
9345
9517
|
/**
|
|
9346
9518
|
* 删除一个货物
|
|
@@ -10250,28 +10422,7 @@ var TaxIncludedSwitch = (function () {
|
|
|
10250
10422
|
return e.goodsListState.isSwitchTax;
|
|
10251
10423
|
}, []);
|
|
10252
10424
|
var onChange = React__default['default'].useCallback(function (e) {
|
|
10253
|
-
controller
|
|
10254
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
10255
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10256
|
-
while (1) {
|
|
10257
|
-
switch (_context.prev = _context.next) {
|
|
10258
|
-
case 0:
|
|
10259
|
-
s.goodsListState = _objectSpread2(_objectSpread2({}, s.goodsListState), {}, {
|
|
10260
|
-
isTaxIncluded: e
|
|
10261
|
-
});
|
|
10262
|
-
|
|
10263
|
-
case 1:
|
|
10264
|
-
case "end":
|
|
10265
|
-
return _context.stop();
|
|
10266
|
-
}
|
|
10267
|
-
}
|
|
10268
|
-
}, _callee);
|
|
10269
|
-
}));
|
|
10270
|
-
|
|
10271
|
-
return function (_x) {
|
|
10272
|
-
return _ref.apply(this, arguments);
|
|
10273
|
-
};
|
|
10274
|
-
}())();
|
|
10425
|
+
onChangeSwitchTax(controller, e);
|
|
10275
10426
|
}, []);
|
|
10276
10427
|
return /*#__PURE__*/React__default['default'].createElement("span", null, /*#__PURE__*/React__default['default'].createElement("label", {
|
|
10277
10428
|
style: {
|
|
@@ -17168,7 +17319,7 @@ var SignDigtal = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(funct
|
|
|
17168
17319
|
}
|
|
17169
17320
|
}) : /*#__PURE__*/React__default['default'].createElement(MyDiv$1, {
|
|
17170
17321
|
style: {
|
|
17171
|
-
whiteSpace: 'pre'
|
|
17322
|
+
whiteSpace: 'pre-wrap'
|
|
17172
17323
|
}
|
|
17173
17324
|
})))), /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Form, {
|
|
17174
17325
|
layout: 'inline',
|
|
@@ -17666,734 +17817,329 @@ function _rollBottom$1() {
|
|
|
17666
17817
|
return _rollBottom$1.apply(this, arguments);
|
|
17667
17818
|
}
|
|
17668
17819
|
|
|
17669
|
-
|
|
17670
|
-
var controller = Invoice.useInvoiceController();
|
|
17671
|
-
/** 是否含税 */
|
|
17672
|
-
|
|
17673
|
-
var isTaxIncluded = controller.useMemo(function (e) {
|
|
17674
|
-
return e.goodsListState.isTaxIncluded;
|
|
17675
|
-
}, []);
|
|
17676
|
-
/** 是否可以切换(含税/不含税)状态 */
|
|
17677
|
-
|
|
17678
|
-
var isSwitchTax = controller.useMemo(function (e) {
|
|
17679
|
-
return e.goodsListState.isSwitchTax;
|
|
17680
|
-
}, []);
|
|
17681
|
-
var onChange = React__default['default'].useCallback(function (e) {
|
|
17682
|
-
controller.pipeline( /*#__PURE__*/function () {
|
|
17683
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
17684
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
17685
|
-
while (1) {
|
|
17686
|
-
switch (_context.prev = _context.next) {
|
|
17687
|
-
case 0:
|
|
17688
|
-
s.goodsListState = _objectSpread2(_objectSpread2({}, s.goodsListState), {}, {
|
|
17689
|
-
isTaxIncluded: e
|
|
17690
|
-
});
|
|
17691
|
-
|
|
17692
|
-
case 1:
|
|
17693
|
-
case "end":
|
|
17694
|
-
return _context.stop();
|
|
17695
|
-
}
|
|
17696
|
-
}
|
|
17697
|
-
}, _callee);
|
|
17698
|
-
}));
|
|
17820
|
+
/** 延迟函数 */
|
|
17699
17821
|
|
|
17700
|
-
|
|
17701
|
-
|
|
17702
|
-
|
|
17703
|
-
|
|
17704
|
-
|
|
17705
|
-
|
|
17706
|
-
style: {
|
|
17707
|
-
marginRight: 2
|
|
17822
|
+
var lazyFn$2 = function lazyFn(fn) {
|
|
17823
|
+
var delayed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
17824
|
+
var timer;
|
|
17825
|
+
return function () {
|
|
17826
|
+
for (var _len = arguments.length, par = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
17827
|
+
par[_key] = arguments[_key];
|
|
17708
17828
|
}
|
|
17709
|
-
}, "\u542B\u7A0E"), /*#__PURE__*/React__default['default'].createElement(ktsXui.Switch, {
|
|
17710
|
-
disabled: isSwitchTax === false,
|
|
17711
|
-
checked: isTaxIncluded,
|
|
17712
|
-
defaultChecked: true,
|
|
17713
|
-
onChange: onChange
|
|
17714
|
-
}));
|
|
17715
|
-
});
|
|
17716
|
-
|
|
17717
|
-
var _path$6;
|
|
17718
17829
|
|
|
17719
|
-
|
|
17830
|
+
clearTimeout(timer);
|
|
17831
|
+
timer = setTimeout(function () {
|
|
17832
|
+
timer = undefined;
|
|
17833
|
+
fn.apply(null, par);
|
|
17834
|
+
}, delayed);
|
|
17835
|
+
};
|
|
17836
|
+
};
|
|
17720
17837
|
|
|
17721
|
-
|
|
17722
|
-
|
|
17723
|
-
className: "magnifier_svg__icon",
|
|
17724
|
-
viewBox: "0 0 1024 1024",
|
|
17725
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
17726
|
-
width: 200,
|
|
17727
|
-
height: 200
|
|
17728
|
-
}, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
|
|
17729
|
-
d: "M985.781 918.594L820.773 765.526c27.373-32.973 49.655-69.577 66.437-109.258 22.933-54.219 34.56-111.795 34.56-171.13 0-59.333-11.627-116.91-34.56-171.13-22.143-52.354-53.838-99.365-94.2-139.729s-87.377-72.056-139.73-94.199c-54.219-22.933-111.795-34.561-171.13-34.561S365.24 57.148 311.022 80.08c-52.354 22.143-99.365 53.837-139.73 94.2s-72.057 87.375-94.2 139.73c-22.932 54.218-34.56 111.795-34.56 171.13 0 59.334 11.628 116.91 34.56 171.129 22.144 52.354 53.838 99.365 94.2 139.729s87.376 72.057 139.73 94.2c54.219 22.933 111.795 34.56 171.13 34.56s116.91-11.627 171.13-34.56c45.352-19.181 86.686-45.543 123.171-78.487l165.803 153.804a31.886 31.886 0 0021.756 8.54c8.593 0 17.163-3.442 23.467-10.238 12.019-12.956 11.26-33.205-1.698-45.223zm-503.63-57.836c-207.117 0-375.62-168.502-375.62-375.62 0-207.117 168.503-375.62 375.62-375.62s375.62 168.503 375.62 375.62c0 207.118-168.503 375.62-375.62 375.62z"
|
|
17730
|
-
})));
|
|
17731
|
-
}
|
|
17838
|
+
var promptErrV$1 = {};
|
|
17839
|
+
/** 提示错误 */
|
|
17732
17840
|
|
|
17733
|
-
var
|
|
17734
|
-
|
|
17841
|
+
var promptErr$1 = function promptErr(err) {
|
|
17842
|
+
if (!err) return false;
|
|
17843
|
+
if (err.errors[0].message === 'lineAmountIncludeTax need to revalidate') return true;
|
|
17844
|
+
if (err.errors[0].message === 'lineAmountExcludeTax need to revalidate') return true;
|
|
17845
|
+
if (err.errors[0].message === 'priceIncludeTax need to revalidate') return true;
|
|
17846
|
+
if (err.errors[0].message === 'priceExcludeTax need to revalidate') return true;
|
|
17735
17847
|
|
|
17736
|
-
|
|
17737
|
-
|
|
17848
|
+
if (new Date().getTime() - promptErrV$1.t > 2000 || err.errors[0].message !== promptErrV$1.m) {
|
|
17849
|
+
promptErrV$1.t = new Date().getTime();
|
|
17850
|
+
promptErrV$1.m = err.errors[0].message;
|
|
17851
|
+
ktsComponentsAntdX3.message.error({
|
|
17852
|
+
content: err.errors[0].message,
|
|
17853
|
+
duration: 2
|
|
17854
|
+
});
|
|
17855
|
+
}
|
|
17738
17856
|
|
|
17739
|
-
|
|
17740
|
-
|
|
17741
|
-
|
|
17742
|
-
setValue = _React$useState2[1];
|
|
17857
|
+
return true;
|
|
17858
|
+
};
|
|
17859
|
+
/** 清除计算中启动字段 */
|
|
17743
17860
|
|
|
17744
|
-
var readOnly = controller.useMemo(function (s) {
|
|
17745
|
-
return !!s.goodsListState.editGood;
|
|
17746
|
-
}, []);
|
|
17747
|
-
/** 是否含税 */
|
|
17748
17861
|
|
|
17749
|
-
|
|
17750
|
-
|
|
17751
|
-
|
|
17752
|
-
var onClick = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
17753
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
17862
|
+
var clearCalculatingField$1 = /*#__PURE__*/function () {
|
|
17863
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(controller) {
|
|
17864
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
17754
17865
|
while (1) {
|
|
17755
|
-
switch (
|
|
17866
|
+
switch (_context2.prev = _context2.next) {
|
|
17756
17867
|
case 0:
|
|
17757
|
-
|
|
17758
|
-
|
|
17759
|
-
|
|
17760
|
-
|
|
17761
|
-
|
|
17762
|
-
|
|
17868
|
+
return _context2.abrupt("return", controller.run( /*#__PURE__*/function () {
|
|
17869
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
17870
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
17871
|
+
while (1) {
|
|
17872
|
+
switch (_context.prev = _context.next) {
|
|
17873
|
+
case 0:
|
|
17874
|
+
return _context.abrupt("return", s.calculatingField = '');
|
|
17763
17875
|
|
|
17764
|
-
|
|
17765
|
-
|
|
17766
|
-
|
|
17767
|
-
|
|
17768
|
-
|
|
17876
|
+
case 1:
|
|
17877
|
+
case "end":
|
|
17878
|
+
return _context.stop();
|
|
17879
|
+
}
|
|
17880
|
+
}
|
|
17881
|
+
}, _callee);
|
|
17882
|
+
}));
|
|
17769
17883
|
|
|
17770
|
-
|
|
17771
|
-
|
|
17772
|
-
|
|
17773
|
-
});
|
|
17774
|
-
return _context.abrupt("return");
|
|
17884
|
+
return function (_x2) {
|
|
17885
|
+
return _ref2.apply(this, arguments);
|
|
17886
|
+
};
|
|
17887
|
+
}()));
|
|
17775
17888
|
|
|
17776
|
-
case
|
|
17889
|
+
case 1:
|
|
17777
17890
|
case "end":
|
|
17778
|
-
return
|
|
17891
|
+
return _context2.stop();
|
|
17779
17892
|
}
|
|
17780
17893
|
}
|
|
17781
|
-
},
|
|
17782
|
-
}))
|
|
17783
|
-
React__default['default'].useEffect(function () {
|
|
17784
|
-
controller.run( /*#__PURE__*/function () {
|
|
17785
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
|
|
17786
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
17787
|
-
while (1) {
|
|
17788
|
-
switch (_context2.prev = _context2.next) {
|
|
17789
|
-
case 0:
|
|
17790
|
-
s.goodsListState.searchValue = value.trim();
|
|
17791
|
-
|
|
17792
|
-
case 1:
|
|
17793
|
-
case "end":
|
|
17794
|
-
return _context2.stop();
|
|
17795
|
-
}
|
|
17796
|
-
}
|
|
17797
|
-
}, _callee2);
|
|
17798
|
-
}));
|
|
17894
|
+
}, _callee2);
|
|
17895
|
+
}));
|
|
17799
17896
|
|
|
17800
|
-
|
|
17801
|
-
|
|
17802
|
-
|
|
17803
|
-
|
|
17804
|
-
|
|
17805
|
-
return /*#__PURE__*/React__default['default'].createElement(ktsXui.Input, {
|
|
17806
|
-
readOnly: readOnly,
|
|
17807
|
-
value: value,
|
|
17808
|
-
className: "kts-invoice-operate-goods-list-search",
|
|
17809
|
-
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9879\u76EE\u540D\u79F0\u3001\u89C4\u683C\u578B\u53F7\u3001\u91D1\u989D(".concat(isTaxIncluded ? '含税' : '不含税', ")\u641C\u7D22"),
|
|
17810
|
-
prefix: /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Icon, {
|
|
17811
|
-
component: SvgMagnifier$1,
|
|
17812
|
-
style: {
|
|
17813
|
-
color: "#b8b8b8"
|
|
17814
|
-
}
|
|
17815
|
-
}),
|
|
17816
|
-
onChange: function onChange(e) {
|
|
17817
|
-
setValue(e.target.value);
|
|
17818
|
-
},
|
|
17819
|
-
onClick: onClick
|
|
17820
|
-
});
|
|
17821
|
-
}
|
|
17822
|
-
|
|
17823
|
-
var css_248z$l = ".kts-invoice-operate-goods-list-itemName-drag-container-u {\n position: relative;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container-u::after {\n content: \" \";\n width: 100%;\n height: 2px;\n background: #0074ff;\n position: absolute;\n left: 0;\n top: 0;\n z-index: 9999;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container-d {\n position: relative;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container-d::after {\n content: \" \";\n width: 100%;\n height: 2px;\n background: #0074ff;\n position: absolute;\n left: 0;\n bottom: 0;\n z-index: 9999;\n}\n";
|
|
17824
|
-
styleInject(css_248z$l);
|
|
17825
|
-
|
|
17826
|
-
function TableRow$1(props) {
|
|
17827
|
-
var rowKey = props['data-row-key'];
|
|
17828
|
-
var controller = Invoice.useInvoiceController();
|
|
17829
|
-
var goodsMap = controller.useMemo(function (s) {
|
|
17830
|
-
return s.goodsListState.goodsMap;
|
|
17831
|
-
}, []);
|
|
17832
|
-
/** 当前拖动中的货品索引 */
|
|
17833
|
-
|
|
17834
|
-
var site = controller.useMemo(function (s) {
|
|
17835
|
-
return s.goodsListState.drag.site;
|
|
17836
|
-
}, []);
|
|
17837
|
-
var current = controller.useMemo(function (s) {
|
|
17838
|
-
return s.goodsListState.drag.current;
|
|
17839
|
-
}, []);
|
|
17840
|
-
var container = controller.useMemo(function (s) {
|
|
17841
|
-
return s.goodsListState.drag.container;
|
|
17842
|
-
}, []);
|
|
17843
|
-
var discount = React__default['default'].useMemo(function () {
|
|
17844
|
-
var i = goodsMap.get(rowKey);
|
|
17845
|
-
if (!i) return undefined;
|
|
17897
|
+
return function clearCalculatingField(_x) {
|
|
17898
|
+
return _ref.apply(this, arguments);
|
|
17899
|
+
};
|
|
17900
|
+
}();
|
|
17901
|
+
/** 数量改变了 */
|
|
17846
17902
|
|
|
17847
|
-
|
|
17848
|
-
|
|
17849
|
-
|
|
17850
|
-
|
|
17851
|
-
} else {
|
|
17852
|
-
return undefined;
|
|
17853
|
-
}
|
|
17854
|
-
}, [rowKey, goodsMap]);
|
|
17855
|
-
return rowKey === current && current ? /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
17856
|
-
style: {
|
|
17857
|
-
height: 50,
|
|
17858
|
-
position: 'relative'
|
|
17859
|
-
}
|
|
17860
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
17861
|
-
style: {
|
|
17862
|
-
height: 0.5,
|
|
17863
|
-
width: '100%',
|
|
17864
|
-
background: '#E6E6E6',
|
|
17865
|
-
position: 'absolute',
|
|
17866
|
-
bottom: 0
|
|
17867
|
-
}
|
|
17868
|
-
})) :
|
|
17869
|
-
/*#__PURE__*/
|
|
17870
|
-
// <tr {...props} className={classnames(props.className, discount, (rowKey === container && current) ? 'kts-invoice-operate-goods-list-itemName-drag-container' : '')} />
|
|
17871
|
-
React__default['default'].createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
17872
|
-
className: classNames__default['default'](props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container-' + site : undefined)
|
|
17873
|
-
}));
|
|
17874
|
-
}
|
|
17903
|
+
var onChangeQuantity$1 = lazyFn$2(function (controller, form, record) {
|
|
17904
|
+
form.validateFields( /*#__PURE__*/function () {
|
|
17905
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(err, values) {
|
|
17906
|
+
var calculatingDigits, quantity, priceIncludeTax, lineAmountIncludeTax, _lineAmountIncludeTax, _priceIncludeTax, priceExcludeTax, lineAmountExcludeTax, _lineAmountExcludeTax, _priceExcludeTax;
|
|
17875
17907
|
|
|
17876
|
-
|
|
17908
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
17909
|
+
while (1) {
|
|
17910
|
+
switch (_context3.prev = _context3.next) {
|
|
17911
|
+
case 0:
|
|
17912
|
+
err = err || {};
|
|
17877
17913
|
|
|
17878
|
-
|
|
17914
|
+
if (!(!values.quantity && values.quantity !== 0)) {
|
|
17915
|
+
_context3.next = 7;
|
|
17916
|
+
break;
|
|
17917
|
+
}
|
|
17879
17918
|
|
|
17880
|
-
|
|
17881
|
-
|
|
17882
|
-
|
|
17883
|
-
|
|
17884
|
-
height: 15
|
|
17885
|
-
}, props), _g$2 || (_g$2 = /*#__PURE__*/React.createElement("g", {
|
|
17886
|
-
clipPath: "url(#plus_svg__clip0_715_360)"
|
|
17887
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
17888
|
-
d: "M8 14.531A7.031 7.031 0 118 .468a7.031 7.031 0 010 14.063zm0-.937A6.094 6.094 0 108 1.406a6.094 6.094 0 000 12.188z"
|
|
17889
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
17890
|
-
d: "M4.25 7.969a.469.469 0 010-.938h7.5a.47.47 0 010 .938h-7.5z"
|
|
17891
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
17892
|
-
d: "M7.531 3.75a.469.469 0 01.938 0v7.5a.47.47 0 01-.938 0v-7.5z"
|
|
17893
|
-
}))), _defs$4 || (_defs$4 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
17894
|
-
id: "plus_svg__clip0_715_360"
|
|
17895
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
17896
|
-
transform: "translate(.5)",
|
|
17897
|
-
d: "M0 0h15v15H0z"
|
|
17898
|
-
})))));
|
|
17899
|
-
}
|
|
17919
|
+
_context3.next = 4;
|
|
17920
|
+
return controller.setEditGood({
|
|
17921
|
+
quantity: undefined
|
|
17922
|
+
});
|
|
17900
17923
|
|
|
17901
|
-
|
|
17902
|
-
|
|
17903
|
-
|
|
17904
|
-
children = props.children;
|
|
17905
|
-
var required = React__default['default'].useMemo(function () {
|
|
17906
|
-
return (rules === null || rules === void 0 ? void 0 : rules.some(function (e) {
|
|
17907
|
-
return !!e.required;
|
|
17908
|
-
})) || props.required;
|
|
17909
|
-
}, [rules, props.required]);
|
|
17910
|
-
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, required ? /*#__PURE__*/React__default['default'].createElement(Text$5, {
|
|
17911
|
-
type: "danger"
|
|
17912
|
-
}, "*") : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null), children);
|
|
17913
|
-
});
|
|
17924
|
+
case 4:
|
|
17925
|
+
_context3.next = 6;
|
|
17926
|
+
return clearCalculatingField$1(controller);
|
|
17914
17927
|
|
|
17915
|
-
|
|
17916
|
-
|
|
17928
|
+
case 6:
|
|
17929
|
+
return _context3.abrupt("return");
|
|
17917
17930
|
|
|
17918
|
-
|
|
17919
|
-
|
|
17920
|
-
|
|
17921
|
-
|
|
17922
|
-
|
|
17931
|
+
case 7:
|
|
17932
|
+
if (!err.quantity) {
|
|
17933
|
+
_context3.next = 11;
|
|
17934
|
+
break;
|
|
17935
|
+
}
|
|
17923
17936
|
|
|
17924
|
-
|
|
17925
|
-
|
|
17926
|
-
options = _React$useState2[0],
|
|
17927
|
-
setOptions = _React$useState2[1];
|
|
17937
|
+
_context3.next = 10;
|
|
17938
|
+
return clearCalculatingField$1(controller);
|
|
17928
17939
|
|
|
17929
|
-
|
|
17930
|
-
|
|
17931
|
-
selectLine = _React$useState4[0],
|
|
17932
|
-
setSelectLine = _React$useState4[1];
|
|
17940
|
+
case 10:
|
|
17941
|
+
return _context3.abrupt("return");
|
|
17933
17942
|
|
|
17934
|
-
|
|
17935
|
-
|
|
17943
|
+
case 11:
|
|
17944
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
17945
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
17946
|
+
_context3.next = 16;
|
|
17947
|
+
return controller.setEditGood({
|
|
17948
|
+
quantity: quantity
|
|
17949
|
+
});
|
|
17936
17950
|
|
|
17937
|
-
|
|
17938
|
-
|
|
17939
|
-
|
|
17940
|
-
|
|
17941
|
-
var taxCategoryData, params;
|
|
17942
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
17943
|
-
while (1) {
|
|
17944
|
-
switch (_context.prev = _context.next) {
|
|
17945
|
-
case 0:
|
|
17946
|
-
_context.prev = 0;
|
|
17951
|
+
case 16:
|
|
17952
|
+
form.setFieldsValue({
|
|
17953
|
+
quantity: quantity
|
|
17954
|
+
}); // 是否含税
|
|
17947
17955
|
|
|
17948
|
-
if (!
|
|
17949
|
-
|
|
17956
|
+
if (!controller.state.goodsListState.isTaxIncluded) {
|
|
17957
|
+
_context3.next = 36;
|
|
17950
17958
|
break;
|
|
17951
17959
|
}
|
|
17952
17960
|
|
|
17953
|
-
if (
|
|
17954
|
-
|
|
17961
|
+
if (!(!err.priceIncludeTax && values.priceIncludeTax)) {
|
|
17962
|
+
_context3.next = 26;
|
|
17955
17963
|
break;
|
|
17956
17964
|
}
|
|
17957
17965
|
|
|
17958
|
-
|
|
17959
|
-
|
|
17966
|
+
// 可以找到 单价(含税)
|
|
17967
|
+
priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
17968
|
+
lineAmountIncludeTax = format2(evaluate("".concat(priceIncludeTax, " * ").concat(quantity)));
|
|
17969
|
+
form.setFieldsValue({
|
|
17970
|
+
lineAmountIncludeTax: lineAmountIncludeTax
|
|
17971
|
+
});
|
|
17972
|
+
_context3.next = 24;
|
|
17973
|
+
return controller.setEditGood({
|
|
17974
|
+
lineAmountIncludeTax: lineAmountIncludeTax
|
|
17975
|
+
});
|
|
17960
17976
|
|
|
17961
|
-
case
|
|
17962
|
-
|
|
17977
|
+
case 24:
|
|
17978
|
+
_context3.next = 32;
|
|
17979
|
+
break;
|
|
17963
17980
|
|
|
17964
|
-
|
|
17965
|
-
|
|
17966
|
-
|
|
17967
|
-
|
|
17968
|
-
};
|
|
17969
|
-
controller.itemNameBlur(params);
|
|
17981
|
+
case 26:
|
|
17982
|
+
if (!(!err.lineAmountIncludeTax && values.lineAmountIncludeTax)) {
|
|
17983
|
+
_context3.next = 32;
|
|
17984
|
+
break;
|
|
17970
17985
|
}
|
|
17971
17986
|
|
|
17972
|
-
|
|
17973
|
-
|
|
17987
|
+
// 可以找到 金额(含税)
|
|
17988
|
+
_lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
17989
|
+
_priceIncludeTax = format15(evaluate("".concat(_lineAmountIncludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
17990
|
+
form.setFieldsValue({
|
|
17991
|
+
priceIncludeTax: _priceIncludeTax
|
|
17992
|
+
});
|
|
17993
|
+
_context3.next = 32;
|
|
17994
|
+
return controller.setEditGood({
|
|
17995
|
+
priceIncludeTax: _priceIncludeTax
|
|
17996
|
+
});
|
|
17974
17997
|
|
|
17975
|
-
case
|
|
17976
|
-
|
|
17977
|
-
|
|
17998
|
+
case 32:
|
|
17999
|
+
_context3.next = 34;
|
|
18000
|
+
return updateUnitPriceExcludingTax$1(controller, form, record);
|
|
17978
18001
|
|
|
17979
|
-
case
|
|
17980
|
-
|
|
17981
|
-
|
|
17982
|
-
throw _context.t0;
|
|
18002
|
+
case 34:
|
|
18003
|
+
_context3.next = 52;
|
|
18004
|
+
break;
|
|
17983
18005
|
|
|
17984
|
-
case
|
|
17985
|
-
|
|
17986
|
-
|
|
17987
|
-
|
|
17988
|
-
|
|
17989
|
-
}, _callee, null, [[0, 10]]);
|
|
17990
|
-
}));
|
|
18006
|
+
case 36:
|
|
18007
|
+
if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
|
|
18008
|
+
_context3.next = 44;
|
|
18009
|
+
break;
|
|
18010
|
+
}
|
|
17991
18011
|
|
|
17992
|
-
|
|
17993
|
-
|
|
17994
|
-
|
|
17995
|
-
|
|
17996
|
-
|
|
17997
|
-
|
|
17998
|
-
|
|
17999
|
-
|
|
18000
|
-
|
|
18001
|
-
|
|
18002
|
-
|
|
18003
|
-
var onSearch = React__default['default'].useCallback( /*#__PURE__*/function () {
|
|
18004
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(searchText) {
|
|
18005
|
-
var list;
|
|
18006
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
18007
|
-
while (1) {
|
|
18008
|
-
switch (_context2.prev = _context2.next) {
|
|
18009
|
-
case 0:
|
|
18010
|
-
_context2.prev = 0;
|
|
18012
|
+
// 可以找到 单价(不含税)
|
|
18013
|
+
priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
|
|
18014
|
+
lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
|
|
18015
|
+
form.setFieldsValue({
|
|
18016
|
+
lineAmountExcludeTax: lineAmountExcludeTax
|
|
18017
|
+
});
|
|
18018
|
+
_context3.next = 42;
|
|
18019
|
+
return controller.setEditGood({
|
|
18020
|
+
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
18021
|
+
quantity: quantity
|
|
18022
|
+
});
|
|
18011
18023
|
|
|
18012
|
-
|
|
18013
|
-
|
|
18024
|
+
case 42:
|
|
18025
|
+
_context3.next = 50;
|
|
18026
|
+
break;
|
|
18027
|
+
|
|
18028
|
+
case 44:
|
|
18029
|
+
if (!(!err.lineAmountExcludeTax && values.lineAmountExcludeTax)) {
|
|
18030
|
+
_context3.next = 50;
|
|
18014
18031
|
break;
|
|
18015
18032
|
}
|
|
18016
18033
|
|
|
18017
|
-
|
|
18018
|
-
|
|
18019
|
-
|
|
18020
|
-
|
|
18021
|
-
|
|
18022
|
-
|
|
18023
|
-
|
|
18024
|
-
|
|
18025
|
-
|
|
18034
|
+
// 可以找到 金额(不含税)
|
|
18035
|
+
_lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
18036
|
+
_priceExcludeTax = format15(evaluate("".concat(_lineAmountExcludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
18037
|
+
form.setFieldsValue({
|
|
18038
|
+
priceExcludeTax: _priceExcludeTax
|
|
18039
|
+
});
|
|
18040
|
+
_context3.next = 50;
|
|
18041
|
+
return controller.setEditGood({
|
|
18042
|
+
priceExcludeTax: _priceExcludeTax,
|
|
18043
|
+
quantity: quantity
|
|
18044
|
+
});
|
|
18026
18045
|
|
|
18027
|
-
case
|
|
18028
|
-
|
|
18029
|
-
|
|
18046
|
+
case 50:
|
|
18047
|
+
_context3.next = 52;
|
|
18048
|
+
return updateUnitPriceTax$1(controller, form, record);
|
|
18030
18049
|
|
|
18031
|
-
case
|
|
18032
|
-
|
|
18033
|
-
|
|
18034
|
-
setOptions([]);
|
|
18035
|
-
throw _context2.t2;
|
|
18050
|
+
case 52:
|
|
18051
|
+
_context3.next = 54;
|
|
18052
|
+
return clearCalculatingField$1(controller);
|
|
18036
18053
|
|
|
18037
|
-
case
|
|
18054
|
+
case 54:
|
|
18038
18055
|
case "end":
|
|
18039
|
-
return
|
|
18056
|
+
return _context3.stop();
|
|
18040
18057
|
}
|
|
18041
18058
|
}
|
|
18042
|
-
},
|
|
18059
|
+
}, _callee3);
|
|
18043
18060
|
}));
|
|
18044
18061
|
|
|
18045
|
-
return function (
|
|
18046
|
-
return
|
|
18062
|
+
return function (_x3, _x4) {
|
|
18063
|
+
return _ref3.apply(this, arguments);
|
|
18047
18064
|
};
|
|
18048
|
-
}()
|
|
18049
|
-
|
|
18050
|
-
|
|
18051
|
-
className: 'kts-invoice-operate-goods-list-itemName-input'
|
|
18052
|
-
}, props.shorthand && /*#__PURE__*/React__default['default'].createElement("span", {
|
|
18053
|
-
style: {
|
|
18054
|
-
alignSelf: 'center',
|
|
18055
|
-
fontSize: 12
|
|
18056
|
-
}
|
|
18057
|
-
}, "*", props.shorthand, "*"), /*#__PURE__*/React__default['default'].createElement(ktsXui.AutoComplete, {
|
|
18058
|
-
onSearch: onSearch,
|
|
18059
|
-
value: props.value,
|
|
18060
|
-
options: options.map(function (e) {
|
|
18061
|
-
return {
|
|
18062
|
-
value: e.itemName
|
|
18063
|
-
};
|
|
18064
|
-
}),
|
|
18065
|
-
onSelect: onChangeAutoComplete
|
|
18066
|
-
}, /*#__PURE__*/React__default['default'].createElement(ktsXui.Input, {
|
|
18067
|
-
style: {
|
|
18068
|
-
height: '100%'
|
|
18069
|
-
},
|
|
18070
|
-
onChange: onChange,
|
|
18071
|
-
suffix: props.suffix,
|
|
18072
|
-
onBlur: onBlur
|
|
18073
|
-
})));
|
|
18074
|
-
}
|
|
18075
|
-
|
|
18076
|
-
/** 延迟函数 */
|
|
18077
|
-
|
|
18078
|
-
var lazyFn$2 = function lazyFn(fn) {
|
|
18079
|
-
var delayed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
18080
|
-
var timer;
|
|
18081
|
-
return function () {
|
|
18082
|
-
for (var _len = arguments.length, par = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18083
|
-
par[_key] = arguments[_key];
|
|
18084
|
-
}
|
|
18085
|
-
|
|
18086
|
-
clearTimeout(timer);
|
|
18087
|
-
timer = setTimeout(function () {
|
|
18088
|
-
timer = undefined;
|
|
18089
|
-
fn.apply(null, par);
|
|
18090
|
-
}, delayed);
|
|
18091
|
-
};
|
|
18092
|
-
};
|
|
18093
|
-
|
|
18094
|
-
var promptErrV$1 = {};
|
|
18095
|
-
/** 提示错误 */
|
|
18096
|
-
|
|
18097
|
-
var promptErr$1 = function promptErr(err) {
|
|
18098
|
-
if (!err) return false;
|
|
18099
|
-
if (err.errors[0].message === 'lineAmountIncludeTax need to revalidate') return true;
|
|
18100
|
-
if (err.errors[0].message === 'lineAmountExcludeTax need to revalidate') return true;
|
|
18101
|
-
if (err.errors[0].message === 'priceIncludeTax need to revalidate') return true;
|
|
18102
|
-
if (err.errors[0].message === 'priceExcludeTax need to revalidate') return true;
|
|
18103
|
-
|
|
18104
|
-
if (new Date().getTime() - promptErrV$1.t > 2000 || err.errors[0].message !== promptErrV$1.m) {
|
|
18105
|
-
promptErrV$1.t = new Date().getTime();
|
|
18106
|
-
promptErrV$1.m = err.errors[0].message;
|
|
18107
|
-
ktsComponentsAntdX3.message.error({
|
|
18108
|
-
content: err.errors[0].message,
|
|
18109
|
-
duration: 2
|
|
18110
|
-
});
|
|
18111
|
-
}
|
|
18112
|
-
|
|
18113
|
-
return true;
|
|
18114
|
-
};
|
|
18115
|
-
/** 清除计算中启动字段 */
|
|
18116
|
-
|
|
18117
|
-
|
|
18118
|
-
var clearCalculatingField$1 = /*#__PURE__*/function () {
|
|
18119
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(controller) {
|
|
18120
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
18121
|
-
while (1) {
|
|
18122
|
-
switch (_context2.prev = _context2.next) {
|
|
18123
|
-
case 0:
|
|
18124
|
-
return _context2.abrupt("return", controller.run( /*#__PURE__*/function () {
|
|
18125
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(s) {
|
|
18126
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
18127
|
-
while (1) {
|
|
18128
|
-
switch (_context.prev = _context.next) {
|
|
18129
|
-
case 0:
|
|
18130
|
-
return _context.abrupt("return", s.calculatingField = '');
|
|
18131
|
-
|
|
18132
|
-
case 1:
|
|
18133
|
-
case "end":
|
|
18134
|
-
return _context.stop();
|
|
18135
|
-
}
|
|
18136
|
-
}
|
|
18137
|
-
}, _callee);
|
|
18138
|
-
}));
|
|
18139
|
-
|
|
18140
|
-
return function (_x2) {
|
|
18141
|
-
return _ref2.apply(this, arguments);
|
|
18142
|
-
};
|
|
18143
|
-
}()));
|
|
18144
|
-
|
|
18145
|
-
case 1:
|
|
18146
|
-
case "end":
|
|
18147
|
-
return _context2.stop();
|
|
18148
|
-
}
|
|
18149
|
-
}
|
|
18150
|
-
}, _callee2);
|
|
18151
|
-
}));
|
|
18152
|
-
|
|
18153
|
-
return function clearCalculatingField(_x) {
|
|
18154
|
-
return _ref.apply(this, arguments);
|
|
18155
|
-
};
|
|
18156
|
-
}();
|
|
18157
|
-
/** 数量改变了 */
|
|
18065
|
+
}());
|
|
18066
|
+
}, 1000);
|
|
18067
|
+
/** 单价(含税) */
|
|
18158
18068
|
|
|
18159
|
-
var
|
|
18069
|
+
var onChangePriceIncludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
18160
18070
|
form.validateFields( /*#__PURE__*/function () {
|
|
18161
|
-
var
|
|
18162
|
-
var calculatingDigits,
|
|
18071
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err, values) {
|
|
18072
|
+
var calculatingDigits, priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax2, _quantity;
|
|
18163
18073
|
|
|
18164
|
-
return _regeneratorRuntime().wrap(function
|
|
18074
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
18165
18075
|
while (1) {
|
|
18166
|
-
switch (
|
|
18076
|
+
switch (_context4.prev = _context4.next) {
|
|
18167
18077
|
case 0:
|
|
18168
18078
|
err = err || {};
|
|
18169
18079
|
|
|
18170
|
-
if (!(!values.
|
|
18171
|
-
|
|
18080
|
+
if (!(!values.priceIncludeTax && values.priceIncludeTax !== 0)) {
|
|
18081
|
+
_context4.next = 7;
|
|
18172
18082
|
break;
|
|
18173
18083
|
}
|
|
18174
18084
|
|
|
18175
|
-
|
|
18085
|
+
_context4.next = 4;
|
|
18176
18086
|
return controller.setEditGood({
|
|
18177
|
-
|
|
18087
|
+
priceIncludeTax: undefined,
|
|
18088
|
+
priceExcludeTax: undefined
|
|
18178
18089
|
});
|
|
18179
18090
|
|
|
18180
18091
|
case 4:
|
|
18181
|
-
|
|
18092
|
+
_context4.next = 6;
|
|
18182
18093
|
return clearCalculatingField$1(controller);
|
|
18183
18094
|
|
|
18184
18095
|
case 6:
|
|
18185
|
-
return
|
|
18096
|
+
return _context4.abrupt("return");
|
|
18186
18097
|
|
|
18187
18098
|
case 7:
|
|
18188
|
-
if (!err.
|
|
18189
|
-
|
|
18099
|
+
if (!err.priceIncludeTax) {
|
|
18100
|
+
_context4.next = 11;
|
|
18190
18101
|
break;
|
|
18191
18102
|
}
|
|
18192
18103
|
|
|
18193
|
-
|
|
18104
|
+
_context4.next = 10;
|
|
18194
18105
|
return clearCalculatingField$1(controller);
|
|
18195
18106
|
|
|
18196
18107
|
case 10:
|
|
18197
|
-
return
|
|
18108
|
+
return _context4.abrupt("return");
|
|
18198
18109
|
|
|
18199
18110
|
case 11:
|
|
18200
18111
|
calculatingDigits = controller.state.calculatingDigits;
|
|
18201
|
-
|
|
18202
|
-
|
|
18112
|
+
priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
18113
|
+
_context4.next = 15;
|
|
18203
18114
|
return controller.setEditGood({
|
|
18204
|
-
|
|
18115
|
+
priceIncludeTax: priceIncludeTax
|
|
18205
18116
|
});
|
|
18206
18117
|
|
|
18207
|
-
case
|
|
18118
|
+
case 15:
|
|
18208
18119
|
form.setFieldsValue({
|
|
18209
|
-
|
|
18210
|
-
}); //
|
|
18211
|
-
|
|
18212
|
-
if (!controller.state.goodsListState.isTaxIncluded) {
|
|
18213
|
-
_context3.next = 36;
|
|
18214
|
-
break;
|
|
18215
|
-
}
|
|
18120
|
+
priceIncludeTax: priceIncludeTax
|
|
18121
|
+
}); // 是否有数量
|
|
18216
18122
|
|
|
18217
|
-
if (!(!err.
|
|
18218
|
-
|
|
18123
|
+
if (!(!err.quantity && values.quantity)) {
|
|
18124
|
+
_context4.next = 24;
|
|
18219
18125
|
break;
|
|
18220
18126
|
}
|
|
18221
18127
|
|
|
18222
|
-
|
|
18223
|
-
|
|
18224
|
-
lineAmountIncludeTax = format2(evaluate("".concat(priceIncludeTax, " * ").concat(quantity)));
|
|
18128
|
+
quantity = format15(values.quantity, calculatingDigits);
|
|
18129
|
+
lineAmountIncludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceIncludeTax)));
|
|
18225
18130
|
form.setFieldsValue({
|
|
18226
18131
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
18227
18132
|
});
|
|
18228
|
-
|
|
18133
|
+
_context4.next = 22;
|
|
18229
18134
|
return controller.setEditGood({
|
|
18230
18135
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
18231
18136
|
});
|
|
18232
18137
|
|
|
18233
|
-
case
|
|
18234
|
-
|
|
18138
|
+
case 22:
|
|
18139
|
+
_context4.next = 30;
|
|
18235
18140
|
break;
|
|
18236
18141
|
|
|
18237
|
-
case
|
|
18238
|
-
if (!(!err.lineAmountIncludeTax && values.lineAmountIncludeTax)) {
|
|
18239
|
-
_context3.next = 32;
|
|
18240
|
-
break;
|
|
18241
|
-
}
|
|
18242
|
-
|
|
18243
|
-
// 可以找到 金额(含税)
|
|
18244
|
-
_lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
|
|
18245
|
-
_priceIncludeTax = format15(evaluate("".concat(_lineAmountIncludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
18246
|
-
form.setFieldsValue({
|
|
18247
|
-
priceIncludeTax: _priceIncludeTax
|
|
18248
|
-
});
|
|
18249
|
-
_context3.next = 32;
|
|
18250
|
-
return controller.setEditGood({
|
|
18251
|
-
priceIncludeTax: _priceIncludeTax
|
|
18252
|
-
});
|
|
18253
|
-
|
|
18254
|
-
case 32:
|
|
18255
|
-
_context3.next = 34;
|
|
18256
|
-
return updateUnitPriceExcludingTax$1(controller, form, record);
|
|
18257
|
-
|
|
18258
|
-
case 34:
|
|
18259
|
-
_context3.next = 52;
|
|
18260
|
-
break;
|
|
18261
|
-
|
|
18262
|
-
case 36:
|
|
18263
|
-
if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
|
|
18264
|
-
_context3.next = 44;
|
|
18265
|
-
break;
|
|
18266
|
-
}
|
|
18267
|
-
|
|
18268
|
-
priceExcludeTax = format15(values.priceExcludeTax, calculatingDigits);
|
|
18269
|
-
lineAmountExcludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceExcludeTax)));
|
|
18270
|
-
form.setFieldsValue({
|
|
18271
|
-
lineAmountExcludeTax: lineAmountExcludeTax
|
|
18272
|
-
});
|
|
18273
|
-
_context3.next = 42;
|
|
18274
|
-
return controller.setEditGood({
|
|
18275
|
-
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
18276
|
-
quantity: quantity
|
|
18277
|
-
});
|
|
18278
|
-
|
|
18279
|
-
case 42:
|
|
18280
|
-
_context3.next = 50;
|
|
18281
|
-
break;
|
|
18282
|
-
|
|
18283
|
-
case 44:
|
|
18284
|
-
if (!(!err.lineAmountExcludeTax && values.lineAmountExcludeTax)) {
|
|
18285
|
-
_context3.next = 50;
|
|
18286
|
-
break;
|
|
18287
|
-
}
|
|
18288
|
-
|
|
18289
|
-
_lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
18290
|
-
_priceExcludeTax = format15(evaluate("".concat(_lineAmountExcludeTax, " / ").concat(quantity)), calculatingDigits);
|
|
18291
|
-
form.setFieldsValue({
|
|
18292
|
-
priceExcludeTax: _priceExcludeTax
|
|
18293
|
-
});
|
|
18294
|
-
_context3.next = 50;
|
|
18295
|
-
return controller.setEditGood({
|
|
18296
|
-
priceExcludeTax: _priceExcludeTax,
|
|
18297
|
-
quantity: quantity
|
|
18298
|
-
});
|
|
18299
|
-
|
|
18300
|
-
case 50:
|
|
18301
|
-
_context3.next = 52;
|
|
18302
|
-
return updateUnitPriceTax$1(controller, form, record);
|
|
18303
|
-
|
|
18304
|
-
case 52:
|
|
18305
|
-
_context3.next = 54;
|
|
18306
|
-
return clearCalculatingField$1(controller);
|
|
18307
|
-
|
|
18308
|
-
case 54:
|
|
18309
|
-
case "end":
|
|
18310
|
-
return _context3.stop();
|
|
18311
|
-
}
|
|
18312
|
-
}
|
|
18313
|
-
}, _callee3);
|
|
18314
|
-
}));
|
|
18315
|
-
|
|
18316
|
-
return function (_x3, _x4) {
|
|
18317
|
-
return _ref3.apply(this, arguments);
|
|
18318
|
-
};
|
|
18319
|
-
}());
|
|
18320
|
-
}, 1000);
|
|
18321
|
-
/** 单价(含税) */
|
|
18322
|
-
|
|
18323
|
-
var onChangePriceIncludeTax$1 = lazyFn$2(function (controller, form, record) {
|
|
18324
|
-
form.validateFields( /*#__PURE__*/function () {
|
|
18325
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err, values) {
|
|
18326
|
-
var calculatingDigits, priceIncludeTax, quantity, lineAmountIncludeTax, _lineAmountIncludeTax2, _quantity;
|
|
18327
|
-
|
|
18328
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
18329
|
-
while (1) {
|
|
18330
|
-
switch (_context4.prev = _context4.next) {
|
|
18331
|
-
case 0:
|
|
18332
|
-
err = err || {};
|
|
18333
|
-
|
|
18334
|
-
if (!(!values.priceIncludeTax && values.priceIncludeTax !== 0)) {
|
|
18335
|
-
_context4.next = 7;
|
|
18336
|
-
break;
|
|
18337
|
-
}
|
|
18338
|
-
|
|
18339
|
-
_context4.next = 4;
|
|
18340
|
-
return controller.setEditGood({
|
|
18341
|
-
priceIncludeTax: undefined,
|
|
18342
|
-
priceExcludeTax: undefined
|
|
18343
|
-
});
|
|
18344
|
-
|
|
18345
|
-
case 4:
|
|
18346
|
-
_context4.next = 6;
|
|
18347
|
-
return clearCalculatingField$1(controller);
|
|
18348
|
-
|
|
18349
|
-
case 6:
|
|
18350
|
-
return _context4.abrupt("return");
|
|
18351
|
-
|
|
18352
|
-
case 7:
|
|
18353
|
-
if (!err.priceIncludeTax) {
|
|
18354
|
-
_context4.next = 11;
|
|
18355
|
-
break;
|
|
18356
|
-
}
|
|
18357
|
-
|
|
18358
|
-
_context4.next = 10;
|
|
18359
|
-
return clearCalculatingField$1(controller);
|
|
18360
|
-
|
|
18361
|
-
case 10:
|
|
18362
|
-
return _context4.abrupt("return");
|
|
18363
|
-
|
|
18364
|
-
case 11:
|
|
18365
|
-
calculatingDigits = controller.state.calculatingDigits;
|
|
18366
|
-
priceIncludeTax = format15(values.priceIncludeTax, calculatingDigits);
|
|
18367
|
-
_context4.next = 15;
|
|
18368
|
-
return controller.setEditGood({
|
|
18369
|
-
priceIncludeTax: priceIncludeTax
|
|
18370
|
-
});
|
|
18371
|
-
|
|
18372
|
-
case 15:
|
|
18373
|
-
form.setFieldsValue({
|
|
18374
|
-
priceIncludeTax: priceIncludeTax
|
|
18375
|
-
}); // 是否有数量
|
|
18376
|
-
|
|
18377
|
-
if (!(!err.quantity && values.quantity)) {
|
|
18378
|
-
_context4.next = 24;
|
|
18379
|
-
break;
|
|
18380
|
-
}
|
|
18381
|
-
|
|
18382
|
-
quantity = format15(values.quantity, calculatingDigits);
|
|
18383
|
-
lineAmountIncludeTax = format2(evaluate("".concat(quantity, " * ").concat(priceIncludeTax)));
|
|
18384
|
-
form.setFieldsValue({
|
|
18385
|
-
lineAmountIncludeTax: lineAmountIncludeTax
|
|
18386
|
-
});
|
|
18387
|
-
_context4.next = 22;
|
|
18388
|
-
return controller.setEditGood({
|
|
18389
|
-
lineAmountIncludeTax: lineAmountIncludeTax
|
|
18390
|
-
});
|
|
18391
|
-
|
|
18392
|
-
case 22:
|
|
18393
|
-
_context4.next = 30;
|
|
18394
|
-
break;
|
|
18395
|
-
|
|
18396
|
-
case 24:
|
|
18142
|
+
case 24:
|
|
18397
18143
|
if (!(!err.lineAmountIncludeTax && values.lineAmountIncludeTax)) {
|
|
18398
18144
|
_context4.next = 30;
|
|
18399
18145
|
break;
|
|
@@ -18840,6 +18586,7 @@ var updateUnitPriceExcludingTax$1 = /*#__PURE__*/function () {
|
|
|
18840
18586
|
while (1) {
|
|
18841
18587
|
switch (_context9.prev = _context9.next) {
|
|
18842
18588
|
case 0:
|
|
18589
|
+
console.log('含税 => 更新(不含税');
|
|
18843
18590
|
err = err || {};
|
|
18844
18591
|
/** 税额 */
|
|
18845
18592
|
|
|
@@ -18853,12 +18600,12 @@ var updateUnitPriceExcludingTax$1 = /*#__PURE__*/function () {
|
|
|
18853
18600
|
form.setFieldsValue({
|
|
18854
18601
|
taxAmount: taxAmount
|
|
18855
18602
|
});
|
|
18856
|
-
_context9.next =
|
|
18603
|
+
_context9.next = 7;
|
|
18857
18604
|
return controller.setEditGood({
|
|
18858
18605
|
taxAmount: taxAmount
|
|
18859
18606
|
});
|
|
18860
18607
|
|
|
18861
|
-
case
|
|
18608
|
+
case 7:
|
|
18862
18609
|
// 计算 金额(不含税)
|
|
18863
18610
|
if ((taxAmount || taxAmount === 0) && !promptErr$1(err.lineAmountIncludeTax)) {
|
|
18864
18611
|
lineAmountExcludeTax = countAmountExcludeTax(values.lineAmountIncludeTax, taxAmount);
|
|
@@ -18867,12 +18614,12 @@ var updateUnitPriceExcludingTax$1 = /*#__PURE__*/function () {
|
|
|
18867
18614
|
form.setFieldsValue({
|
|
18868
18615
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
18869
18616
|
});
|
|
18870
|
-
_context9.next =
|
|
18617
|
+
_context9.next = 11;
|
|
18871
18618
|
return controller.setEditGood({
|
|
18872
18619
|
lineAmountExcludeTax: lineAmountExcludeTax
|
|
18873
18620
|
});
|
|
18874
18621
|
|
|
18875
|
-
case
|
|
18622
|
+
case 11:
|
|
18876
18623
|
// 单价(不含税)
|
|
18877
18624
|
if (lineAmountExcludeTax && !promptErr$1(err.quantity)) {
|
|
18878
18625
|
priceExcludeTax = countPrice(lineAmountExcludeTax, values.quantity, controller.state.calculatingDigits);
|
|
@@ -18881,12 +18628,12 @@ var updateUnitPriceExcludingTax$1 = /*#__PURE__*/function () {
|
|
|
18881
18628
|
form.setFieldsValue({
|
|
18882
18629
|
priceExcludeTax: priceExcludeTax
|
|
18883
18630
|
});
|
|
18884
|
-
_context9.next =
|
|
18631
|
+
_context9.next = 15;
|
|
18885
18632
|
return controller.setEditGood({
|
|
18886
18633
|
priceExcludeTax: priceExcludeTax
|
|
18887
18634
|
});
|
|
18888
18635
|
|
|
18889
|
-
case
|
|
18636
|
+
case 15:
|
|
18890
18637
|
case "end":
|
|
18891
18638
|
return _context9.stop();
|
|
18892
18639
|
}
|
|
@@ -18929,10 +18676,11 @@ var updateUnitPriceTax$1 = /*#__PURE__*/function () {
|
|
|
18929
18676
|
while (1) {
|
|
18930
18677
|
switch (_context11.prev = _context11.next) {
|
|
18931
18678
|
case 0:
|
|
18679
|
+
console.log('不含税 => 更新(含税)');
|
|
18932
18680
|
err = err || {};
|
|
18933
18681
|
|
|
18934
18682
|
if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !promptErr$1(err.lineAmountExcludeTax) && (values.lineAmountExcludeTax || values.lineAmountExcludeTax === 0))) {
|
|
18935
|
-
_context11.next =
|
|
18683
|
+
_context11.next = 18;
|
|
18936
18684
|
break;
|
|
18937
18685
|
}
|
|
18938
18686
|
|
|
@@ -18940,175 +18688,748 @@ var updateUnitPriceTax$1 = /*#__PURE__*/function () {
|
|
|
18940
18688
|
|
|
18941
18689
|
lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
|
|
18942
18690
|
lineAmountIncludeTax = format2(evaluate("".concat(lineAmountExcludeTax, " * (1+(").concat(values.taxRate, "/100))")));
|
|
18943
|
-
_context11.next =
|
|
18691
|
+
_context11.next = 8;
|
|
18944
18692
|
return controller.setEditGood({
|
|
18945
18693
|
lineAmountIncludeTax: lineAmountIncludeTax
|
|
18946
18694
|
});
|
|
18947
18695
|
|
|
18948
|
-
case
|
|
18696
|
+
case 8:
|
|
18949
18697
|
if (!(!err.quantity && values.quantity)) {
|
|
18950
|
-
_context11.next =
|
|
18698
|
+
_context11.next = 12;
|
|
18951
18699
|
break;
|
|
18952
18700
|
}
|
|
18953
18701
|
|
|
18954
18702
|
priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)), calculatingDigits);
|
|
18955
|
-
_context11.next =
|
|
18703
|
+
_context11.next = 12;
|
|
18956
18704
|
return controller.setEditGood({
|
|
18957
18705
|
priceIncludeTax: priceIncludeTax
|
|
18958
18706
|
});
|
|
18959
18707
|
|
|
18960
|
-
case
|
|
18708
|
+
case 12:
|
|
18961
18709
|
// 税额 = 金额(含税)-金额(不含税)
|
|
18962
18710
|
taxAmount = evaluate("".concat(lineAmountIncludeTax, " - ").concat(lineAmountExcludeTax));
|
|
18963
18711
|
form.setFieldsValue({
|
|
18964
18712
|
taxAmount: taxAmount
|
|
18965
18713
|
});
|
|
18966
|
-
_context11.next =
|
|
18714
|
+
_context11.next = 16;
|
|
18967
18715
|
return controller.setEditGood({
|
|
18968
18716
|
taxAmount: taxAmount
|
|
18969
18717
|
});
|
|
18970
18718
|
|
|
18971
|
-
case
|
|
18972
|
-
_context11.next =
|
|
18719
|
+
case 16:
|
|
18720
|
+
_context11.next = 21;
|
|
18721
|
+
break;
|
|
18722
|
+
|
|
18723
|
+
case 18:
|
|
18724
|
+
form.setFieldsValue({
|
|
18725
|
+
taxAmount: undefined
|
|
18726
|
+
});
|
|
18727
|
+
_context11.next = 21;
|
|
18728
|
+
return controller.setEditGood({
|
|
18729
|
+
taxAmount: undefined
|
|
18730
|
+
});
|
|
18731
|
+
|
|
18732
|
+
case 21:
|
|
18733
|
+
// 单价(含税) = 单价(不含税) * (1+税率)
|
|
18734
|
+
// if (
|
|
18735
|
+
// !err.taxRat &&
|
|
18736
|
+
// (values.taxRate || values.taxRate === 0) &&
|
|
18737
|
+
// !promptErr(err.priceExcludeTax) &&
|
|
18738
|
+
// (values.priceExcludeTax || values.priceExcludeTax === 0)
|
|
18739
|
+
// ) {
|
|
18740
|
+
// const priceExcludeTax = format15(values.priceExcludeTax);
|
|
18741
|
+
// const priceIncludeTax = format15(evaluate(`${priceExcludeTax} * (1+(${values.taxRate}/100))`));
|
|
18742
|
+
// await controller.setEditGood({ priceIncludeTax });
|
|
18743
|
+
// }
|
|
18744
|
+
resolve(undefined);
|
|
18745
|
+
|
|
18746
|
+
case 22:
|
|
18747
|
+
case "end":
|
|
18748
|
+
return _context11.stop();
|
|
18749
|
+
}
|
|
18750
|
+
}
|
|
18751
|
+
}, _callee11);
|
|
18752
|
+
}));
|
|
18753
|
+
|
|
18754
|
+
return function (_x23, _x24) {
|
|
18755
|
+
return _ref12.apply(this, arguments);
|
|
18756
|
+
};
|
|
18757
|
+
}());
|
|
18758
|
+
}));
|
|
18759
|
+
|
|
18760
|
+
case 1:
|
|
18761
|
+
case "end":
|
|
18762
|
+
return _context12.stop();
|
|
18763
|
+
}
|
|
18764
|
+
}
|
|
18765
|
+
}, _callee12);
|
|
18766
|
+
}));
|
|
18767
|
+
|
|
18768
|
+
return function updateUnitPriceTax(_x20, _x21, _x22) {
|
|
18769
|
+
return _ref11.apply(this, arguments);
|
|
18770
|
+
};
|
|
18771
|
+
}();
|
|
18772
|
+
/** 修改了 项目名称 */
|
|
18773
|
+
|
|
18774
|
+
var onChangeItemName$1 = /*#__PURE__*/function () {
|
|
18775
|
+
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(controller, form, record) {
|
|
18776
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
18777
|
+
while (1) {
|
|
18778
|
+
switch (_context17.prev = _context17.next) {
|
|
18779
|
+
case 0:
|
|
18780
|
+
controller.run( /*#__PURE__*/function () {
|
|
18781
|
+
var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(s) {
|
|
18782
|
+
var value;
|
|
18783
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
18784
|
+
while (1) {
|
|
18785
|
+
switch (_context16.prev = _context16.next) {
|
|
18786
|
+
case 0:
|
|
18787
|
+
value = form.getFieldsValue().itemName;
|
|
18788
|
+
|
|
18789
|
+
if (!s.goodsListState.isMyShow) {
|
|
18790
|
+
_context16.next = 10;
|
|
18973
18791
|
break;
|
|
18792
|
+
}
|
|
18793
|
+
|
|
18794
|
+
_context16.next = 4;
|
|
18795
|
+
return controller.setEditGood({
|
|
18796
|
+
itemNameSelf: value
|
|
18797
|
+
});
|
|
18798
|
+
|
|
18799
|
+
case 4:
|
|
18800
|
+
_context16.t0 = record.itemName;
|
|
18801
|
+
|
|
18802
|
+
if (!_context16.t0) {
|
|
18803
|
+
_context16.next = 8;
|
|
18804
|
+
break;
|
|
18805
|
+
}
|
|
18806
|
+
|
|
18807
|
+
_context16.next = 8;
|
|
18808
|
+
return controller.setEditGood({
|
|
18809
|
+
itemName: record.itemName
|
|
18810
|
+
});
|
|
18811
|
+
|
|
18812
|
+
case 8:
|
|
18813
|
+
_context16.next = 16;
|
|
18814
|
+
break;
|
|
18815
|
+
|
|
18816
|
+
case 10:
|
|
18817
|
+
_context16.next = 12;
|
|
18818
|
+
return controller.setEditGood({
|
|
18819
|
+
itemName: value
|
|
18820
|
+
});
|
|
18821
|
+
|
|
18822
|
+
case 12:
|
|
18823
|
+
_context16.t1 = record.itemNameSelf;
|
|
18824
|
+
|
|
18825
|
+
if (!_context16.t1) {
|
|
18826
|
+
_context16.next = 16;
|
|
18827
|
+
break;
|
|
18828
|
+
}
|
|
18829
|
+
|
|
18830
|
+
_context16.next = 16;
|
|
18831
|
+
return controller.setEditGood({
|
|
18832
|
+
itemNameSelf: record.itemNameSelf
|
|
18833
|
+
});
|
|
18834
|
+
|
|
18835
|
+
case 16:
|
|
18836
|
+
case "end":
|
|
18837
|
+
return _context16.stop();
|
|
18838
|
+
}
|
|
18839
|
+
}
|
|
18840
|
+
}, _callee16);
|
|
18841
|
+
}));
|
|
18842
|
+
|
|
18843
|
+
return function (_x33) {
|
|
18844
|
+
return _ref17.apply(this, arguments);
|
|
18845
|
+
};
|
|
18846
|
+
}());
|
|
18847
|
+
|
|
18848
|
+
case 1:
|
|
18849
|
+
case "end":
|
|
18850
|
+
return _context17.stop();
|
|
18851
|
+
}
|
|
18852
|
+
}
|
|
18853
|
+
}, _callee17);
|
|
18854
|
+
}));
|
|
18855
|
+
|
|
18856
|
+
return function onChangeItemName(_x30, _x31, _x32) {
|
|
18857
|
+
return _ref16.apply(this, arguments);
|
|
18858
|
+
};
|
|
18859
|
+
}();
|
|
18860
|
+
/** 修改了含税开关 重新计算 */
|
|
18861
|
+
|
|
18862
|
+
var onChangeSwitchTax$1 = /*#__PURE__*/function () {
|
|
18863
|
+
var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(controller, isTaxIncluded) {
|
|
18864
|
+
var calculatingDigits;
|
|
18865
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
18866
|
+
while (1) {
|
|
18867
|
+
switch (_context20.prev = _context20.next) {
|
|
18868
|
+
case 0:
|
|
18869
|
+
if (controller.state.goodsListState.isRecalculateWhenSwitchTax) {
|
|
18870
|
+
_context20.next = 3;
|
|
18871
|
+
break;
|
|
18872
|
+
}
|
|
18873
|
+
|
|
18874
|
+
controller.pipeline( /*#__PURE__*/function () {
|
|
18875
|
+
var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(s) {
|
|
18876
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
18877
|
+
while (1) {
|
|
18878
|
+
switch (_context18.prev = _context18.next) {
|
|
18879
|
+
case 0:
|
|
18880
|
+
s.goodsListState = _objectSpread2(_objectSpread2({}, s.goodsListState), {}, {
|
|
18881
|
+
isTaxIncluded: isTaxIncluded
|
|
18882
|
+
});
|
|
18883
|
+
|
|
18884
|
+
case 1:
|
|
18885
|
+
case "end":
|
|
18886
|
+
return _context18.stop();
|
|
18887
|
+
}
|
|
18888
|
+
}
|
|
18889
|
+
}, _callee18);
|
|
18890
|
+
}));
|
|
18891
|
+
|
|
18892
|
+
return function (_x36) {
|
|
18893
|
+
return _ref19.apply(this, arguments);
|
|
18894
|
+
};
|
|
18895
|
+
}())();
|
|
18896
|
+
return _context20.abrupt("return");
|
|
18897
|
+
|
|
18898
|
+
case 3:
|
|
18899
|
+
calculatingDigits = controller.state.calculatingDigits;
|
|
18900
|
+
_context20.next = 6;
|
|
18901
|
+
return controller.saveEditGood();
|
|
18902
|
+
|
|
18903
|
+
case 6:
|
|
18904
|
+
_context20.next = 8;
|
|
18905
|
+
return controller.wait();
|
|
18906
|
+
|
|
18907
|
+
case 8:
|
|
18908
|
+
_context20.next = 10;
|
|
18909
|
+
return controller.run( /*#__PURE__*/function () {
|
|
18910
|
+
var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(s) {
|
|
18911
|
+
var _s$goodsListState, needRefresh, newGoodsList;
|
|
18912
|
+
|
|
18913
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
18914
|
+
while (1) {
|
|
18915
|
+
switch (_context19.prev = _context19.next) {
|
|
18916
|
+
case 0:
|
|
18917
|
+
if (!s.goodsListState.editGood) {
|
|
18918
|
+
_context19.next = 3;
|
|
18919
|
+
break;
|
|
18920
|
+
}
|
|
18921
|
+
|
|
18922
|
+
ktsComponentsAntdX3.message.error({
|
|
18923
|
+
content: '你正在编辑一个货物',
|
|
18924
|
+
key: '你正在编辑一个货物'
|
|
18925
|
+
});
|
|
18926
|
+
return _context19.abrupt("return");
|
|
18927
|
+
|
|
18928
|
+
case 3:
|
|
18929
|
+
s.goodsListState.isTaxIncluded = isTaxIncluded;
|
|
18930
|
+
|
|
18931
|
+
try {
|
|
18932
|
+
needRefresh = false;
|
|
18933
|
+
|
|
18934
|
+
if (((_s$goodsListState = s.goodsListState) === null || _s$goodsListState === void 0 ? void 0 : _s$goodsListState.goodsList) && s.goodsListState.goodsList.length) {
|
|
18935
|
+
newGoodsList = s.goodsListState.goodsList.map(function (good) {
|
|
18936
|
+
var sourceQuantity = good.quantity,
|
|
18937
|
+
sourcePriceExcludeTax = good.priceExcludeTax,
|
|
18938
|
+
sourcePriceIncludeTax = good.priceIncludeTax,
|
|
18939
|
+
sourceLineAmountExcludeTax = good.lineAmountExcludeTax,
|
|
18940
|
+
sourceLineAmountIncludeTax = good.lineAmountIncludeTax,
|
|
18941
|
+
taxRate = good.taxRate;
|
|
18942
|
+
|
|
18943
|
+
if (isTaxIncluded) {
|
|
18944
|
+
if (!sourceQuantity && sourceQuantity !== 0) return good;
|
|
18945
|
+
if (!sourcePriceIncludeTax && sourcePriceIncludeTax !== 0) return good;
|
|
18946
|
+
if (!taxRate && taxRate !== 0) return good;
|
|
18947
|
+
|
|
18948
|
+
if (sourcePriceExcludeTax && sourceLineAmountExcludeTax && mathjs.equal(countPrice(sourceLineAmountExcludeTax, sourceQuantity) || 0, sourcePriceExcludeTax)) {
|
|
18949
|
+
return good;
|
|
18950
|
+
} else {
|
|
18951
|
+
needRefresh = true;
|
|
18952
|
+
}
|
|
18953
|
+
|
|
18954
|
+
var quantity = format15(sourceQuantity, calculatingDigits);
|
|
18955
|
+
var priceIncludeTax = format15(sourcePriceIncludeTax, calculatingDigits);
|
|
18956
|
+
var lineAmountIncludeTax = format2(evaluate("".concat(priceIncludeTax, " * ").concat(quantity)));
|
|
18957
|
+
var taxAmount = countTaxAmount(lineAmountIncludeTax, controller.state.goodsListState.deduction, taxRate);
|
|
18958
|
+
var lineAmountExcludeTax = countAmountExcludeTax(lineAmountIncludeTax, taxAmount);
|
|
18959
|
+
var priceExcludeTax = countPrice(lineAmountExcludeTax, quantity, controller.state.calculatingDigits);
|
|
18960
|
+
return _objectSpread2(_objectSpread2({}, good), {}, {
|
|
18961
|
+
lineAmountExcludeTax: lineAmountExcludeTax,
|
|
18962
|
+
lineAmountIncludeTax: lineAmountIncludeTax,
|
|
18963
|
+
taxAmount: taxAmount,
|
|
18964
|
+
priceExcludeTax: priceExcludeTax
|
|
18965
|
+
});
|
|
18966
|
+
} else {
|
|
18967
|
+
if (!sourceQuantity && sourceQuantity !== 0) return good;
|
|
18968
|
+
if (!sourcePriceExcludeTax && sourcePriceExcludeTax !== 0) return good;
|
|
18969
|
+
if (!taxRate && taxRate !== 0) return good;
|
|
18970
|
+
|
|
18971
|
+
if (sourcePriceIncludeTax && sourceLineAmountIncludeTax && mathjs.equal(countPrice(sourceLineAmountIncludeTax, sourceQuantity) || 0, sourcePriceIncludeTax)) {
|
|
18972
|
+
return good;
|
|
18973
|
+
} else {
|
|
18974
|
+
needRefresh = true;
|
|
18975
|
+
}
|
|
18976
|
+
|
|
18977
|
+
var _quantity5 = format15(sourceQuantity, calculatingDigits);
|
|
18978
|
+
|
|
18979
|
+
var _priceExcludeTax3 = format15(sourcePriceExcludeTax, calculatingDigits);
|
|
18980
|
+
|
|
18981
|
+
var _lineAmountExcludeTax3 = format2(evaluate("".concat(_priceExcludeTax3, " * ").concat(_quantity5)));
|
|
18982
|
+
|
|
18983
|
+
var _lineAmountIncludeTax3 = format2(evaluate("".concat(_lineAmountExcludeTax3, " * (1+(").concat(taxRate, "/100))")));
|
|
18984
|
+
|
|
18985
|
+
var _priceIncludeTax3 = format15(evaluate("".concat(_lineAmountIncludeTax3, " / ").concat(_quantity5)), calculatingDigits);
|
|
18986
|
+
|
|
18987
|
+
var _taxAmount = evaluate("".concat(_lineAmountIncludeTax3, " - ").concat(_lineAmountExcludeTax3));
|
|
18988
|
+
|
|
18989
|
+
return _objectSpread2(_objectSpread2({}, good), {}, {
|
|
18990
|
+
lineAmountExcludeTax: _lineAmountExcludeTax3,
|
|
18991
|
+
lineAmountIncludeTax: _lineAmountIncludeTax3,
|
|
18992
|
+
taxAmount: _taxAmount,
|
|
18993
|
+
priceIncludeTax: _priceIncludeTax3
|
|
18994
|
+
});
|
|
18995
|
+
}
|
|
18996
|
+
});
|
|
18997
|
+
|
|
18998
|
+
if (needRefresh) {
|
|
18999
|
+
s.goodsListState.goodsList = newGoodsList;
|
|
19000
|
+
}
|
|
19001
|
+
}
|
|
19002
|
+
} catch (e) {
|
|
19003
|
+
console.error('切换税率重新计算出错', e, s.goodsListState);
|
|
19004
|
+
}
|
|
19005
|
+
|
|
19006
|
+
case 5:
|
|
19007
|
+
case "end":
|
|
19008
|
+
return _context19.stop();
|
|
19009
|
+
}
|
|
19010
|
+
}
|
|
19011
|
+
}, _callee19);
|
|
19012
|
+
}));
|
|
19013
|
+
|
|
19014
|
+
return function (_x37) {
|
|
19015
|
+
return _ref20.apply(this, arguments);
|
|
19016
|
+
};
|
|
19017
|
+
}());
|
|
19018
|
+
|
|
19019
|
+
case 10:
|
|
19020
|
+
case "end":
|
|
19021
|
+
return _context20.stop();
|
|
19022
|
+
}
|
|
19023
|
+
}
|
|
19024
|
+
}, _callee20);
|
|
19025
|
+
}));
|
|
19026
|
+
|
|
19027
|
+
return function onChangeSwitchTax(_x34, _x35) {
|
|
19028
|
+
return _ref18.apply(this, arguments);
|
|
19029
|
+
};
|
|
19030
|
+
}();
|
|
19031
|
+
|
|
19032
|
+
var TaxIncludedSwitch$1 = (function () {
|
|
19033
|
+
var controller = Invoice.useInvoiceController();
|
|
19034
|
+
/** 是否含税 */
|
|
19035
|
+
|
|
19036
|
+
var isTaxIncluded = controller.useMemo(function (e) {
|
|
19037
|
+
return e.goodsListState.isTaxIncluded;
|
|
19038
|
+
}, []);
|
|
19039
|
+
/** 是否可以切换(含税/不含税)状态 */
|
|
19040
|
+
|
|
19041
|
+
var isSwitchTax = controller.useMemo(function (e) {
|
|
19042
|
+
return e.goodsListState.isSwitchTax;
|
|
19043
|
+
}, []);
|
|
19044
|
+
var onChange = React__default['default'].useCallback( /*#__PURE__*/function () {
|
|
19045
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
|
|
19046
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
19047
|
+
while (1) {
|
|
19048
|
+
switch (_context.prev = _context.next) {
|
|
19049
|
+
case 0:
|
|
19050
|
+
onChangeSwitchTax$1(controller, e);
|
|
19051
|
+
|
|
19052
|
+
case 1:
|
|
19053
|
+
case "end":
|
|
19054
|
+
return _context.stop();
|
|
19055
|
+
}
|
|
19056
|
+
}
|
|
19057
|
+
}, _callee);
|
|
19058
|
+
}));
|
|
19059
|
+
|
|
19060
|
+
return function (_x) {
|
|
19061
|
+
return _ref.apply(this, arguments);
|
|
19062
|
+
};
|
|
19063
|
+
}(), []);
|
|
19064
|
+
return /*#__PURE__*/React__default['default'].createElement("span", null, /*#__PURE__*/React__default['default'].createElement("label", {
|
|
19065
|
+
style: {
|
|
19066
|
+
marginRight: 2
|
|
19067
|
+
}
|
|
19068
|
+
}, "\u542B\u7A0E"), /*#__PURE__*/React__default['default'].createElement(ktsXui.Switch, {
|
|
19069
|
+
disabled: isSwitchTax === false,
|
|
19070
|
+
checked: isTaxIncluded,
|
|
19071
|
+
defaultChecked: true,
|
|
19072
|
+
onChange: onChange
|
|
19073
|
+
}));
|
|
19074
|
+
});
|
|
19075
|
+
|
|
19076
|
+
var _path$6;
|
|
19077
|
+
|
|
19078
|
+
function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
|
|
19079
|
+
|
|
19080
|
+
function SvgMagnifier$1(props) {
|
|
19081
|
+
return /*#__PURE__*/React.createElement("svg", _extends$8({
|
|
19082
|
+
className: "magnifier_svg__icon",
|
|
19083
|
+
viewBox: "0 0 1024 1024",
|
|
19084
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19085
|
+
width: 200,
|
|
19086
|
+
height: 200
|
|
19087
|
+
}, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
|
|
19088
|
+
d: "M985.781 918.594L820.773 765.526c27.373-32.973 49.655-69.577 66.437-109.258 22.933-54.219 34.56-111.795 34.56-171.13 0-59.333-11.627-116.91-34.56-171.13-22.143-52.354-53.838-99.365-94.2-139.729s-87.377-72.056-139.73-94.199c-54.219-22.933-111.795-34.561-171.13-34.561S365.24 57.148 311.022 80.08c-52.354 22.143-99.365 53.837-139.73 94.2s-72.057 87.375-94.2 139.73c-22.932 54.218-34.56 111.795-34.56 171.13 0 59.334 11.628 116.91 34.56 171.129 22.144 52.354 53.838 99.365 94.2 139.729s87.376 72.057 139.73 94.2c54.219 22.933 111.795 34.56 171.13 34.56s116.91-11.627 171.13-34.56c45.352-19.181 86.686-45.543 123.171-78.487l165.803 153.804a31.886 31.886 0 0021.756 8.54c8.593 0 17.163-3.442 23.467-10.238 12.019-12.956 11.26-33.205-1.698-45.223zm-503.63-57.836c-207.117 0-375.62-168.502-375.62-375.62 0-207.117 168.503-375.62 375.62-375.62s375.62 168.503 375.62 375.62c0 207.118-168.503 375.62-375.62 375.62z"
|
|
19089
|
+
})));
|
|
19090
|
+
}
|
|
19091
|
+
|
|
19092
|
+
var css_248z$k = ".kts-invoice-operate-goods-list-able .kts-invoice-operate-goods-list-search {\n width: 350px;\n border-radius: 999px;\n}\n.kts-invoice-operate-goods-list-able .kts-invoice-operate-goods-list-search input {\n border-radius: 999px;\n border-color: #b8b8b8;\n font-size: 12px;\n}\n";
|
|
19093
|
+
styleInject(css_248z$k);
|
|
19094
|
+
|
|
19095
|
+
function Search$1() {
|
|
19096
|
+
var controller = Invoice.useInvoiceController();
|
|
19097
|
+
|
|
19098
|
+
var _React$useState = React__default['default'].useState(''),
|
|
19099
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
19100
|
+
value = _React$useState2[0],
|
|
19101
|
+
setValue = _React$useState2[1];
|
|
19102
|
+
|
|
19103
|
+
var readOnly = controller.useMemo(function (s) {
|
|
19104
|
+
return !!s.goodsListState.editGood;
|
|
19105
|
+
}, []);
|
|
19106
|
+
/** 是否含税 */
|
|
19107
|
+
|
|
19108
|
+
var isTaxIncluded = controller.useMemo(function (s) {
|
|
19109
|
+
return s.goodsListState.isTaxIncluded;
|
|
19110
|
+
}, []);
|
|
19111
|
+
var onClick = React__default['default'].useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
19112
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
19113
|
+
while (1) {
|
|
19114
|
+
switch (_context.prev = _context.next) {
|
|
19115
|
+
case 0:
|
|
19116
|
+
_context.next = 2;
|
|
19117
|
+
return controller.saveEditGood();
|
|
19118
|
+
|
|
19119
|
+
case 2:
|
|
19120
|
+
_context.next = 4;
|
|
19121
|
+
return controller.wait();
|
|
19122
|
+
|
|
19123
|
+
case 4:
|
|
19124
|
+
if (!controller.state.goodsListState.editGood) {
|
|
19125
|
+
_context.next = 7;
|
|
19126
|
+
break;
|
|
19127
|
+
}
|
|
19128
|
+
|
|
19129
|
+
ktsXui.message.error({
|
|
19130
|
+
content: '你正在编辑一个货物',
|
|
19131
|
+
key: '你正在编辑一个货物'
|
|
19132
|
+
});
|
|
19133
|
+
return _context.abrupt("return");
|
|
19134
|
+
|
|
19135
|
+
case 7:
|
|
19136
|
+
case "end":
|
|
19137
|
+
return _context.stop();
|
|
19138
|
+
}
|
|
19139
|
+
}
|
|
19140
|
+
}, _callee);
|
|
19141
|
+
})), []);
|
|
19142
|
+
React__default['default'].useEffect(function () {
|
|
19143
|
+
controller.run( /*#__PURE__*/function () {
|
|
19144
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(s) {
|
|
19145
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
19146
|
+
while (1) {
|
|
19147
|
+
switch (_context2.prev = _context2.next) {
|
|
19148
|
+
case 0:
|
|
19149
|
+
s.goodsListState.searchValue = value.trim();
|
|
19150
|
+
|
|
19151
|
+
case 1:
|
|
19152
|
+
case "end":
|
|
19153
|
+
return _context2.stop();
|
|
19154
|
+
}
|
|
19155
|
+
}
|
|
19156
|
+
}, _callee2);
|
|
19157
|
+
}));
|
|
19158
|
+
|
|
19159
|
+
return function (_x) {
|
|
19160
|
+
return _ref2.apply(this, arguments);
|
|
19161
|
+
};
|
|
19162
|
+
}());
|
|
19163
|
+
}, [value, controller]);
|
|
19164
|
+
return /*#__PURE__*/React__default['default'].createElement(ktsXui.Input, {
|
|
19165
|
+
readOnly: readOnly,
|
|
19166
|
+
value: value,
|
|
19167
|
+
className: "kts-invoice-operate-goods-list-search",
|
|
19168
|
+
placeholder: "\u8BF7\u60A8\u8F93\u5165\u9879\u76EE\u540D\u79F0\u3001\u89C4\u683C\u578B\u53F7\u3001\u91D1\u989D(".concat(isTaxIncluded ? '含税' : '不含税', ")\u641C\u7D22"),
|
|
19169
|
+
prefix: /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Icon, {
|
|
19170
|
+
component: SvgMagnifier$1,
|
|
19171
|
+
style: {
|
|
19172
|
+
color: "#b8b8b8"
|
|
19173
|
+
}
|
|
19174
|
+
}),
|
|
19175
|
+
onChange: function onChange(e) {
|
|
19176
|
+
setValue(e.target.value);
|
|
19177
|
+
},
|
|
19178
|
+
onClick: onClick
|
|
19179
|
+
});
|
|
19180
|
+
}
|
|
19181
|
+
|
|
19182
|
+
var css_248z$l = ".kts-invoice-operate-goods-list-itemName-drag-container-u {\n position: relative;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container-u::after {\n content: \" \";\n width: 100%;\n height: 2px;\n background: #0074ff;\n position: absolute;\n left: 0;\n top: 0;\n z-index: 9999;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container-d {\n position: relative;\n}\n.kts-invoice-operate-goods-list-itemName-drag-container-d::after {\n content: \" \";\n width: 100%;\n height: 2px;\n background: #0074ff;\n position: absolute;\n left: 0;\n bottom: 0;\n z-index: 9999;\n}\n";
|
|
19183
|
+
styleInject(css_248z$l);
|
|
19184
|
+
|
|
19185
|
+
function TableRow$1(props) {
|
|
19186
|
+
var rowKey = props['data-row-key'];
|
|
19187
|
+
var controller = Invoice.useInvoiceController();
|
|
19188
|
+
var goodsMap = controller.useMemo(function (s) {
|
|
19189
|
+
return s.goodsListState.goodsMap;
|
|
19190
|
+
}, []);
|
|
19191
|
+
/** 当前拖动中的货品索引 */
|
|
19192
|
+
|
|
19193
|
+
var site = controller.useMemo(function (s) {
|
|
19194
|
+
return s.goodsListState.drag.site;
|
|
19195
|
+
}, []);
|
|
19196
|
+
var current = controller.useMemo(function (s) {
|
|
19197
|
+
return s.goodsListState.drag.current;
|
|
19198
|
+
}, []);
|
|
19199
|
+
var container = controller.useMemo(function (s) {
|
|
19200
|
+
return s.goodsListState.drag.container;
|
|
19201
|
+
}, []);
|
|
19202
|
+
var discount = React__default['default'].useMemo(function () {
|
|
19203
|
+
var i = goodsMap.get(rowKey);
|
|
19204
|
+
if (!i) return undefined;
|
|
19205
|
+
|
|
19206
|
+
if (i.lineAttribute === LineAttributeType$1.折扣行) {
|
|
19207
|
+
return 'kts-invoice-operate-goods-be-discount';
|
|
19208
|
+
} else if (i.lineAttribute === LineAttributeType$1.被折扣行) {
|
|
19209
|
+
return 'kts-invoice-operate-goods-discount';
|
|
19210
|
+
} else {
|
|
19211
|
+
return undefined;
|
|
19212
|
+
}
|
|
19213
|
+
}, [rowKey, goodsMap]);
|
|
19214
|
+
return rowKey === current && current ? /*#__PURE__*/React__default['default'].createElement("tr", {
|
|
19215
|
+
style: {
|
|
19216
|
+
height: 50,
|
|
19217
|
+
position: 'relative'
|
|
19218
|
+
}
|
|
19219
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19220
|
+
style: {
|
|
19221
|
+
height: 0.5,
|
|
19222
|
+
width: '100%',
|
|
19223
|
+
background: '#E6E6E6',
|
|
19224
|
+
position: 'absolute',
|
|
19225
|
+
bottom: 0
|
|
19226
|
+
}
|
|
19227
|
+
})) :
|
|
19228
|
+
/*#__PURE__*/
|
|
19229
|
+
// <tr {...props} className={classnames(props.className, discount, (rowKey === container && current) ? 'kts-invoice-operate-goods-list-itemName-drag-container' : '')} />
|
|
19230
|
+
React__default['default'].createElement("tr", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
19231
|
+
className: classNames__default['default'](props.className, discount, rowKey === container && current ? 'kts-invoice-operate-goods-list-itemName-drag-container-' + site : undefined)
|
|
19232
|
+
}));
|
|
19233
|
+
}
|
|
19234
|
+
|
|
19235
|
+
var _g$2, _defs$4;
|
|
19236
|
+
|
|
19237
|
+
function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
|
|
19238
|
+
|
|
19239
|
+
function SvgPlus$1(props) {
|
|
19240
|
+
return /*#__PURE__*/React.createElement("svg", _extends$9({
|
|
19241
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19242
|
+
width: 16,
|
|
19243
|
+
height: 15
|
|
19244
|
+
}, props), _g$2 || (_g$2 = /*#__PURE__*/React.createElement("g", {
|
|
19245
|
+
clipPath: "url(#plus_svg__clip0_715_360)"
|
|
19246
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
19247
|
+
d: "M8 14.531A7.031 7.031 0 118 .468a7.031 7.031 0 010 14.063zm0-.937A6.094 6.094 0 108 1.406a6.094 6.094 0 000 12.188z"
|
|
19248
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
19249
|
+
d: "M4.25 7.969a.469.469 0 010-.938h7.5a.47.47 0 010 .938h-7.5z"
|
|
19250
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
19251
|
+
d: "M7.531 3.75a.469.469 0 01.938 0v7.5a.47.47 0 01-.938 0v-7.5z"
|
|
19252
|
+
}))), _defs$4 || (_defs$4 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
19253
|
+
id: "plus_svg__clip0_715_360"
|
|
19254
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
19255
|
+
transform: "translate(.5)",
|
|
19256
|
+
d: "M0 0h15v15H0z"
|
|
19257
|
+
})))));
|
|
19258
|
+
}
|
|
19259
|
+
|
|
19260
|
+
var Text$5 = ktsComponentsAntdX3.Typography.Text;
|
|
19261
|
+
var TitleText$1 = (function (props) {
|
|
19262
|
+
var rules = props.rules,
|
|
19263
|
+
children = props.children;
|
|
19264
|
+
var required = React__default['default'].useMemo(function () {
|
|
19265
|
+
return (rules === null || rules === void 0 ? void 0 : rules.some(function (e) {
|
|
19266
|
+
return !!e.required;
|
|
19267
|
+
})) || props.required;
|
|
19268
|
+
}, [rules, props.required]);
|
|
19269
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, required ? /*#__PURE__*/React__default['default'].createElement(Text$5, {
|
|
19270
|
+
type: "danger"
|
|
19271
|
+
}, "*") : /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null), children);
|
|
19272
|
+
});
|
|
19273
|
+
|
|
19274
|
+
var css_248z$m = ".kts-invoice-operate-goods-list-itemName-input {\n display: flex;\n flex: 1;\n padding-left: 0;\n height: 31px;\n}\n";
|
|
19275
|
+
styleInject(css_248z$m);
|
|
18974
19276
|
|
|
18975
|
-
|
|
18976
|
-
|
|
18977
|
-
|
|
18978
|
-
|
|
18979
|
-
|
|
18980
|
-
return controller.setEditGood({
|
|
18981
|
-
taxAmount: undefined
|
|
18982
|
-
});
|
|
19277
|
+
function ItemNameInput$1(props) {
|
|
19278
|
+
var controller = Invoice.useInvoiceController();
|
|
19279
|
+
var autoComplete = controller.useMemo(function (s) {
|
|
19280
|
+
return s.autoComplete;
|
|
19281
|
+
}, []);
|
|
18983
19282
|
|
|
18984
|
-
|
|
18985
|
-
|
|
18986
|
-
|
|
18987
|
-
|
|
18988
|
-
// (values.taxRate || values.taxRate === 0) &&
|
|
18989
|
-
// !promptErr(err.priceExcludeTax) &&
|
|
18990
|
-
// (values.priceExcludeTax || values.priceExcludeTax === 0)
|
|
18991
|
-
// ) {
|
|
18992
|
-
// const priceExcludeTax = format15(values.priceExcludeTax);
|
|
18993
|
-
// const priceIncludeTax = format15(evaluate(`${priceExcludeTax} * (1+(${values.taxRate}/100))`));
|
|
18994
|
-
// await controller.setEditGood({ priceIncludeTax });
|
|
18995
|
-
// }
|
|
18996
|
-
resolve(undefined);
|
|
19283
|
+
var _React$useState = React__default['default'].useState([]),
|
|
19284
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
19285
|
+
options = _React$useState2[0],
|
|
19286
|
+
setOptions = _React$useState2[1];
|
|
18997
19287
|
|
|
18998
|
-
|
|
18999
|
-
|
|
19000
|
-
|
|
19001
|
-
|
|
19002
|
-
}
|
|
19003
|
-
}, _callee11);
|
|
19004
|
-
}));
|
|
19288
|
+
var _React$useState3 = React__default['default'].useState(null),
|
|
19289
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
19290
|
+
selectLine = _React$useState4[0],
|
|
19291
|
+
setSelectLine = _React$useState4[1];
|
|
19005
19292
|
|
|
19006
|
-
|
|
19007
|
-
|
|
19008
|
-
};
|
|
19009
|
-
}());
|
|
19010
|
-
}));
|
|
19293
|
+
var onChange = React__default['default'].useCallback(function (e) {
|
|
19294
|
+
var event = _objectSpread2({}, e);
|
|
19011
19295
|
|
|
19012
|
-
|
|
19013
|
-
|
|
19014
|
-
|
|
19015
|
-
|
|
19016
|
-
|
|
19017
|
-
|
|
19018
|
-
|
|
19296
|
+
props.onChange && props.onChange(event);
|
|
19297
|
+
}, []);
|
|
19298
|
+
var onBlur = React__default['default'].useCallback( /*#__PURE__*/function () {
|
|
19299
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(searchText) {
|
|
19300
|
+
var taxCategoryData, params;
|
|
19301
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
19302
|
+
while (1) {
|
|
19303
|
+
switch (_context.prev = _context.next) {
|
|
19304
|
+
case 0:
|
|
19305
|
+
_context.prev = 0;
|
|
19019
19306
|
|
|
19020
|
-
|
|
19021
|
-
|
|
19022
|
-
|
|
19023
|
-
}
|
|
19024
|
-
/** 修改了 项目名称 */
|
|
19307
|
+
if (!autoComplete.onItemNameBlur) {
|
|
19308
|
+
_context.next = 8;
|
|
19309
|
+
break;
|
|
19310
|
+
}
|
|
19025
19311
|
|
|
19026
|
-
|
|
19027
|
-
|
|
19028
|
-
|
|
19029
|
-
|
|
19030
|
-
switch (_context17.prev = _context17.next) {
|
|
19031
|
-
case 0:
|
|
19032
|
-
controller.run( /*#__PURE__*/function () {
|
|
19033
|
-
var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(s) {
|
|
19034
|
-
var value;
|
|
19035
|
-
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
19036
|
-
while (1) {
|
|
19037
|
-
switch (_context16.prev = _context16.next) {
|
|
19038
|
-
case 0:
|
|
19039
|
-
value = form.getFieldsValue().itemName;
|
|
19312
|
+
if (selectLine === null || selectLine === void 0 ? void 0 : selectLine.shorthand) {
|
|
19313
|
+
_context.next = 7;
|
|
19314
|
+
break;
|
|
19315
|
+
}
|
|
19040
19316
|
|
|
19041
|
-
|
|
19042
|
-
|
|
19043
|
-
break;
|
|
19044
|
-
}
|
|
19317
|
+
_context.next = 5;
|
|
19318
|
+
return autoComplete.onItemNameBlur(searchText);
|
|
19045
19319
|
|
|
19046
|
-
|
|
19047
|
-
|
|
19048
|
-
itemNameSelf: value
|
|
19049
|
-
});
|
|
19320
|
+
case 5:
|
|
19321
|
+
taxCategoryData = _context.sent;
|
|
19050
19322
|
|
|
19051
|
-
|
|
19052
|
-
|
|
19323
|
+
if (taxCategoryData && taxCategoryData[0]) {
|
|
19324
|
+
params = {
|
|
19325
|
+
taxClassificationCode: taxCategoryData[0].taxCategoryCode,
|
|
19326
|
+
shorthand: taxCategoryData[0].shorthand
|
|
19327
|
+
};
|
|
19328
|
+
controller.itemNameBlur(params);
|
|
19329
|
+
}
|
|
19053
19330
|
|
|
19054
|
-
|
|
19055
|
-
|
|
19056
|
-
break;
|
|
19057
|
-
}
|
|
19331
|
+
case 7:
|
|
19332
|
+
setSelectLine(null);
|
|
19058
19333
|
|
|
19059
|
-
|
|
19060
|
-
|
|
19061
|
-
|
|
19062
|
-
});
|
|
19334
|
+
case 8:
|
|
19335
|
+
_context.next = 13;
|
|
19336
|
+
break;
|
|
19063
19337
|
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
19338
|
+
case 10:
|
|
19339
|
+
_context.prev = 10;
|
|
19340
|
+
_context.t0 = _context["catch"](0);
|
|
19341
|
+
throw _context.t0;
|
|
19067
19342
|
|
|
19068
|
-
|
|
19069
|
-
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19343
|
+
case 13:
|
|
19344
|
+
case "end":
|
|
19345
|
+
return _context.stop();
|
|
19346
|
+
}
|
|
19347
|
+
}
|
|
19348
|
+
}, _callee, null, [[0, 10]]);
|
|
19349
|
+
}));
|
|
19073
19350
|
|
|
19074
|
-
|
|
19075
|
-
|
|
19351
|
+
return function (_x) {
|
|
19352
|
+
return _ref.apply(this, arguments);
|
|
19353
|
+
};
|
|
19354
|
+
}(), [autoComplete.onItemNameBlur, selectLine, props.editGood]);
|
|
19355
|
+
var onChangeAutoComplete = React__default['default'].useCallback(function (itemName) {
|
|
19356
|
+
var record = options.filter(function (e) {
|
|
19357
|
+
return e.itemName === itemName;
|
|
19358
|
+
})[0];
|
|
19359
|
+
if (!record) return;
|
|
19360
|
+
controller.importGoodsDrawer(record);
|
|
19361
|
+
}, [options, controller]);
|
|
19362
|
+
var onSearch = React__default['default'].useCallback( /*#__PURE__*/function () {
|
|
19363
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(searchText) {
|
|
19364
|
+
var list;
|
|
19365
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
19366
|
+
while (1) {
|
|
19367
|
+
switch (_context2.prev = _context2.next) {
|
|
19368
|
+
case 0:
|
|
19369
|
+
_context2.prev = 0;
|
|
19076
19370
|
|
|
19077
|
-
|
|
19078
|
-
|
|
19079
|
-
|
|
19080
|
-
|
|
19371
|
+
if (!autoComplete.onItemNameSearch) {
|
|
19372
|
+
_context2.next = 9;
|
|
19373
|
+
break;
|
|
19374
|
+
}
|
|
19081
19375
|
|
|
19082
|
-
|
|
19083
|
-
|
|
19084
|
-
|
|
19085
|
-
});
|
|
19376
|
+
_context2.t0 = _toConsumableArray;
|
|
19377
|
+
_context2.next = 5;
|
|
19378
|
+
return autoComplete.onItemNameSearch(searchText);
|
|
19086
19379
|
|
|
19087
|
-
|
|
19088
|
-
|
|
19089
|
-
|
|
19090
|
-
|
|
19091
|
-
|
|
19092
|
-
}, _callee16);
|
|
19093
|
-
}));
|
|
19380
|
+
case 5:
|
|
19381
|
+
_context2.t1 = _context2.sent;
|
|
19382
|
+
list = (0, _context2.t0)(_context2.t1);
|
|
19383
|
+
console.log('===> list', list);
|
|
19384
|
+
setOptions(list);
|
|
19094
19385
|
|
|
19095
|
-
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
}());
|
|
19386
|
+
case 9:
|
|
19387
|
+
_context2.next = 15;
|
|
19388
|
+
break;
|
|
19099
19389
|
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
|
|
19390
|
+
case 11:
|
|
19391
|
+
_context2.prev = 11;
|
|
19392
|
+
_context2.t2 = _context2["catch"](0);
|
|
19393
|
+
setOptions([]);
|
|
19394
|
+
throw _context2.t2;
|
|
19395
|
+
|
|
19396
|
+
case 15:
|
|
19397
|
+
case "end":
|
|
19398
|
+
return _context2.stop();
|
|
19399
|
+
}
|
|
19103
19400
|
}
|
|
19104
|
-
}
|
|
19105
|
-
}
|
|
19106
|
-
}));
|
|
19401
|
+
}, _callee2, null, [[0, 11]]);
|
|
19402
|
+
}));
|
|
19107
19403
|
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
|
|
19111
|
-
}();
|
|
19404
|
+
return function (_x2) {
|
|
19405
|
+
return _ref2.apply(this, arguments);
|
|
19406
|
+
};
|
|
19407
|
+
}(), [autoComplete.onItemNameSearch]);
|
|
19408
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
19409
|
+
className: 'kts-invoice-operate-goods-list-itemName-input'
|
|
19410
|
+
}, props.shorthand && /*#__PURE__*/React__default['default'].createElement("span", {
|
|
19411
|
+
style: {
|
|
19412
|
+
alignSelf: 'center',
|
|
19413
|
+
fontSize: 12
|
|
19414
|
+
}
|
|
19415
|
+
}, "*", props.shorthand, "*"), /*#__PURE__*/React__default['default'].createElement(ktsXui.AutoComplete, {
|
|
19416
|
+
onSearch: onSearch,
|
|
19417
|
+
value: props.value,
|
|
19418
|
+
options: options.map(function (e) {
|
|
19419
|
+
return {
|
|
19420
|
+
value: e.itemName
|
|
19421
|
+
};
|
|
19422
|
+
}),
|
|
19423
|
+
onSelect: onChangeAutoComplete
|
|
19424
|
+
}, /*#__PURE__*/React__default['default'].createElement(ktsXui.Input, {
|
|
19425
|
+
style: {
|
|
19426
|
+
height: '100%'
|
|
19427
|
+
},
|
|
19428
|
+
onChange: onChange,
|
|
19429
|
+
suffix: props.suffix,
|
|
19430
|
+
onBlur: onBlur
|
|
19431
|
+
})));
|
|
19432
|
+
}
|
|
19112
19433
|
|
|
19113
19434
|
var _path$7;
|
|
19114
19435
|
|
|
@@ -23320,14 +23641,17 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
23320
23641
|
good.taxRate = values.taxRate;
|
|
23321
23642
|
good.taxFreeType = values.taxFreeType;
|
|
23322
23643
|
good.favouredPolicyMark = values.favouredPolicyMark;
|
|
23323
|
-
good.favouredPolicyName = values.favouredPolicyName;
|
|
23324
|
-
var taxRate = mathjs.chain(mathjs.bignumber(values.taxRate)).dotDivide(mathjs.bignumber(100)).add(mathjs.bignumber(1)).done(); // 是否含税
|
|
23644
|
+
good.favouredPolicyName = values.favouredPolicyName; // 无论是否含税,都保持价税合计不变
|
|
23325
23645
|
|
|
23326
|
-
var lineAmountExcludeTax = mathjs.chain(mathjs.bignumber(good.lineAmountIncludeTax)).dotDivide(taxRate).done();
|
|
23327
|
-
var priceExcludeTax = good.priceIncludeTax ? mathjs.chain(mathjs.bignumber(good.priceIncludeTax)).dotDivide(taxRate).done() : undefined;
|
|
23328
|
-
good.lineAmountExcludeTax = lineAmountExcludeTax.toNumber().toFixed(2);
|
|
23329
|
-
good.priceExcludeTax = (priceExcludeTax ? format15(priceExcludeTax.toNumber(), s.calculatingDigits) : undefined) || undefined;
|
|
23330
23646
|
good.taxAmount = countTaxAmount(good.lineAmountIncludeTax || 0, s.goodsListState.deduction, values.taxRate);
|
|
23647
|
+
|
|
23648
|
+
if (good.taxAmount || good.taxAmount === 0) {
|
|
23649
|
+
good.lineAmountExcludeTax = countAmountExcludeTax(good.lineAmountIncludeTax || 0, good.taxAmount);
|
|
23650
|
+
}
|
|
23651
|
+
|
|
23652
|
+
if (good.lineAmountExcludeTax && good.quantity) {
|
|
23653
|
+
good.priceExcludeTax = countPrice(good.lineAmountExcludeTax, good.quantity, controller.state.calculatingDigits);
|
|
23654
|
+
}
|
|
23331
23655
|
});
|
|
23332
23656
|
s.goodsListState.goodsList = s.goodsListState.goodsList.slice();
|
|
23333
23657
|
s.goodsListState.endowCode.endowcodeGoodIndex = [];
|