kts-component-invoice-operate 1.0.85 → 1.0.89
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/EndowCode.d.ts +6 -2
- package/dist/Invoice/tools/calculate/index.d.ts +1 -1
- package/dist/index.esm.js +63 -41
- package/dist/index.js +63 -41
- package/docs-dist/umi.js +1 -1
- package/package.json +1 -1
- package/src/Invoice/InvoiceController/InvoiceControllerForm/index.ts +8 -0
- package/src/Invoice/InvoiceController/InvoiceControllerState/GoodsListState/EndowCode.tsx +6 -2
- package/src/Invoice/_test/endowCode/index.tsx +42 -7
- package/src/Invoice/index.tsx +10 -2
- package/src/Invoice/tools/calculate/index.ts +1 -1
- package/src/Invoice/ui/EndowCodeDrawer/index.tsx +9 -8
- package/src/Invoice/ui/GoodsList/hook/useColumns/autoFillFn/index.ts +3 -3
- package/src/Invoice/ui/GoodsList/hook/useColumns/index.tsx +4 -4
- package/src/Invoice/ui/GoodsList/index.tsx +3 -3
|
@@ -10,8 +10,12 @@ export default class EndowCode {
|
|
|
10
10
|
}[]>;
|
|
11
11
|
/** 税率 是否可以编辑 */
|
|
12
12
|
getReadOnlyTaxRate?: (value?: GoodsListState) => boolean;
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* 获取赋码时候的默认值
|
|
15
|
+
* @param value 商品信息
|
|
16
|
+
* @param length 商品数量
|
|
17
|
+
* */
|
|
18
|
+
getDefaultValue?: (value: IGood, length: number) => Promise<IGood>;
|
|
15
19
|
/** 税率 是否可以编辑 校验函数 */
|
|
16
20
|
readonly readOnlyTaxRateMap: {
|
|
17
21
|
[key: string]: (value?: GoodsListState) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** 格式化 保留2位小数 */
|
|
2
|
-
export declare const format2: (value: number | string) =>
|
|
2
|
+
export declare const format2: (value: number | string) => number | "";
|
|
3
3
|
/** 格式化 保留15位数字 */
|
|
4
4
|
export declare const format15: (value: number | string) => number | "";
|
|
5
5
|
export declare function quantityPriceIncludeTax(quantity?: number | string, priceIncludeTax?: number | string): number | undefined;
|
package/dist/index.esm.js
CHANGED
|
@@ -348,7 +348,7 @@ var InvoiceControllerForm = /*#__PURE__*/function (_GreyReactBox) {
|
|
|
348
348
|
var _validateFields2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
349
349
|
var _this3 = this;
|
|
350
350
|
|
|
351
|
-
var _errors, _values, arr, i, key, _yield$_validateField, errors, values;
|
|
351
|
+
var _errors, _values, arr, i, key, _yield$_validateField, errors, values, _this$state$goodsList;
|
|
352
352
|
|
|
353
353
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
354
354
|
while (1) {
|
|
@@ -382,7 +382,26 @@ var InvoiceControllerForm = /*#__PURE__*/function (_GreyReactBox) {
|
|
|
382
382
|
break;
|
|
383
383
|
|
|
384
384
|
case 16:
|
|
385
|
-
|
|
385
|
+
if (!this.state.goodsListState.form) {
|
|
386
|
+
_context.next = 25;
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
_context.prev = 17;
|
|
391
|
+
_context.next = 20;
|
|
392
|
+
return (_this$state$goodsList = this.state.goodsListState.form) === null || _this$state$goodsList === void 0 ? void 0 : _this$state$goodsList.validateFields();
|
|
393
|
+
|
|
394
|
+
case 20:
|
|
395
|
+
_context.next = 25;
|
|
396
|
+
break;
|
|
397
|
+
|
|
398
|
+
case 22:
|
|
399
|
+
_context.prev = 22;
|
|
400
|
+
_context.t0 = _context["catch"](17);
|
|
401
|
+
|
|
402
|
+
_errors.set('goodsList', _context.t0.errors);
|
|
403
|
+
|
|
404
|
+
case 25:
|
|
386
405
|
_values.set('goodsList', this.state.goodsListState.goodsList.slice()); // 金额(含税)
|
|
387
406
|
|
|
388
407
|
|
|
@@ -426,12 +445,12 @@ var InvoiceControllerForm = /*#__PURE__*/function (_GreyReactBox) {
|
|
|
426
445
|
values: _values
|
|
427
446
|
});
|
|
428
447
|
|
|
429
|
-
case
|
|
448
|
+
case 30:
|
|
430
449
|
case "end":
|
|
431
450
|
return _context.stop();
|
|
432
451
|
}
|
|
433
452
|
}
|
|
434
|
-
}, _callee, this);
|
|
453
|
+
}, _callee, this, [[17, 22]]);
|
|
435
454
|
}));
|
|
436
455
|
|
|
437
456
|
function validateFields() {
|
|
@@ -2381,7 +2400,7 @@ var format2 = function format2(value) {
|
|
|
2381
2400
|
if (value === Infinity) return '';
|
|
2382
2401
|
if ("".concat(value) === 'NaN') return '';
|
|
2383
2402
|
if (typeof value === 'string') value = parseFloat(value);
|
|
2384
|
-
return value.toFixed(2);
|
|
2403
|
+
return parseFloat(value.toFixed(2));
|
|
2385
2404
|
};
|
|
2386
2405
|
/** 格式化 保留15位数字 */
|
|
2387
2406
|
|
|
@@ -2423,14 +2442,13 @@ var lazyFn$1 = function lazyFn(fn) {
|
|
|
2423
2442
|
|
|
2424
2443
|
var promptErr = function promptErr(err) {
|
|
2425
2444
|
if (!err) return false;
|
|
2426
|
-
|
|
2427
|
-
if (err.errors[0].message
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
}
|
|
2433
|
-
|
|
2445
|
+
if (err.errors[0].message === 'lineAmountIncludeTax need to revalidate') return true;
|
|
2446
|
+
if (err.errors[0].message === 'priceIncludeTax need to revalidate') return true;
|
|
2447
|
+
message.error({
|
|
2448
|
+
key: err.errors[0].message,
|
|
2449
|
+
content: err.errors[0].message,
|
|
2450
|
+
duration: 2
|
|
2451
|
+
});
|
|
2434
2452
|
return true;
|
|
2435
2453
|
};
|
|
2436
2454
|
/** 数量改变了 */
|
|
@@ -3765,8 +3783,8 @@ var useColumns = (function (form) {
|
|
|
3765
3783
|
while (1) {
|
|
3766
3784
|
switch (_context5.prev = _context5.next) {
|
|
3767
3785
|
case 0:
|
|
3768
|
-
if ("".concat(value).split('.')[0].length >
|
|
3769
|
-
callback('金额整数部分不能大于
|
|
3786
|
+
if ("".concat(value).split('.')[0].length > 9) {
|
|
3787
|
+
callback('金额整数部分不能大于9位');
|
|
3770
3788
|
}
|
|
3771
3789
|
|
|
3772
3790
|
case 1:
|
|
@@ -3827,8 +3845,8 @@ var useColumns = (function (form) {
|
|
|
3827
3845
|
while (1) {
|
|
3828
3846
|
switch (_context6.prev = _context6.next) {
|
|
3829
3847
|
case 0:
|
|
3830
|
-
if ("".concat(value).split('.')[0].length >
|
|
3831
|
-
callback('金额整数部分不能大于
|
|
3848
|
+
if ("".concat(value).split('.')[0].length > 9) {
|
|
3849
|
+
callback('金额整数部分不能大于9位');
|
|
3832
3850
|
}
|
|
3833
3851
|
|
|
3834
3852
|
case 1:
|
|
@@ -4492,7 +4510,7 @@ var Main = decorator(Form.create())(function (props) {
|
|
|
4492
4510
|
},
|
|
4493
4511
|
dataSource: controller.useMemo(function (s) {
|
|
4494
4512
|
return s.goodsListState.goodsList;
|
|
4495
|
-
}, []),
|
|
4513
|
+
}, [controller]),
|
|
4496
4514
|
columns: useColumns(props.form),
|
|
4497
4515
|
rowSelection: useRowSelection(),
|
|
4498
4516
|
onRow: function onRow(record) {
|
|
@@ -5264,41 +5282,33 @@ var EndowCodeDrawer = (function () {
|
|
|
5264
5282
|
return _context2.abrupt("return");
|
|
5265
5283
|
|
|
5266
5284
|
case 4:
|
|
5267
|
-
if (!(endowcodeGoodIndex.length === 1)) {
|
|
5268
|
-
_context2.next = 17;
|
|
5269
|
-
break;
|
|
5270
|
-
}
|
|
5271
|
-
|
|
5272
5285
|
getDefaultValue = s.goodsListState.endowCode.getDefaultValue;
|
|
5273
5286
|
|
|
5274
5287
|
if (!getDefaultValue) {
|
|
5275
|
-
_context2.next =
|
|
5288
|
+
_context2.next = 13;
|
|
5276
5289
|
break;
|
|
5277
5290
|
}
|
|
5278
5291
|
|
|
5279
5292
|
_context2.t0 = setDefaultValue;
|
|
5280
|
-
_context2.next =
|
|
5281
|
-
return getDefaultValue(_objectSpread2({}, good));
|
|
5293
|
+
_context2.next = 9;
|
|
5294
|
+
return getDefaultValue(_objectSpread2({}, good), endowcodeGoodIndex.length);
|
|
5282
5295
|
|
|
5283
|
-
case
|
|
5296
|
+
case 9:
|
|
5284
5297
|
_context2.t1 = _context2.sent;
|
|
5285
5298
|
(0, _context2.t0)(_context2.t1);
|
|
5286
|
-
_context2.next =
|
|
5287
|
-
break;
|
|
5288
|
-
|
|
5289
|
-
case 14:
|
|
5290
|
-
setDefaultValue(good);
|
|
5291
|
-
|
|
5292
|
-
case 15:
|
|
5293
|
-
_context2.next = 18;
|
|
5299
|
+
_context2.next = 14;
|
|
5294
5300
|
break;
|
|
5295
5301
|
|
|
5296
|
-
case
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
}
|
|
5302
|
+
case 13:
|
|
5303
|
+
if (endowcodeGoodIndex.length === 1) {
|
|
5304
|
+
setDefaultValue(good);
|
|
5305
|
+
} else {
|
|
5306
|
+
setDefaultValue({
|
|
5307
|
+
taxRate: good.taxRate
|
|
5308
|
+
});
|
|
5309
|
+
}
|
|
5300
5310
|
|
|
5301
|
-
case
|
|
5311
|
+
case 14:
|
|
5302
5312
|
case "end":
|
|
5303
5313
|
return _context2.stop();
|
|
5304
5314
|
}
|
|
@@ -5609,7 +5619,9 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
5609
5619
|
name: "taxRate",
|
|
5610
5620
|
type: "string",
|
|
5611
5621
|
title: "\u7A0E\u7387",
|
|
5612
|
-
|
|
5622
|
+
"x-component-props": {
|
|
5623
|
+
disabled: readOnlyTaxRate
|
|
5624
|
+
},
|
|
5613
5625
|
default: (_defaultValue$taxRate = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.taxRate) !== null && _defaultValue$taxRate !== void 0 ? _defaultValue$taxRate : 0,
|
|
5614
5626
|
enum: taxRateList,
|
|
5615
5627
|
"x-rules": [{
|
|
@@ -5773,7 +5785,17 @@ var Main$3 = function Main(props) {
|
|
|
5773
5785
|
var controller = React.useMemo(function () {
|
|
5774
5786
|
return props.controller || new InvoiceController();
|
|
5775
5787
|
}, [props.controller]);
|
|
5788
|
+
|
|
5789
|
+
var _React$useState = React.useState(0),
|
|
5790
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5791
|
+
key = _React$useState2[0],
|
|
5792
|
+
setKey = _React$useState2[1];
|
|
5793
|
+
|
|
5794
|
+
React.useEffect(function () {
|
|
5795
|
+
setKey(key + 1);
|
|
5796
|
+
}, [controller]);
|
|
5776
5797
|
return /*#__PURE__*/React.createElement(InvoiceContext.Provider, {
|
|
5798
|
+
key: key,
|
|
5777
5799
|
value: controller
|
|
5778
5800
|
}, /*#__PURE__*/React.createElement("div", {
|
|
5779
5801
|
className: "kts-invoice-operate"
|
package/dist/index.js
CHANGED
|
@@ -358,7 +358,7 @@ var InvoiceControllerForm = /*#__PURE__*/function (_GreyReactBox) {
|
|
|
358
358
|
var _validateFields2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
359
359
|
var _this3 = this;
|
|
360
360
|
|
|
361
|
-
var _errors, _values, arr, i, key, _yield$_validateField, errors, values;
|
|
361
|
+
var _errors, _values, arr, i, key, _yield$_validateField, errors, values, _this$state$goodsList;
|
|
362
362
|
|
|
363
363
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
364
364
|
while (1) {
|
|
@@ -392,7 +392,26 @@ var InvoiceControllerForm = /*#__PURE__*/function (_GreyReactBox) {
|
|
|
392
392
|
break;
|
|
393
393
|
|
|
394
394
|
case 16:
|
|
395
|
-
|
|
395
|
+
if (!this.state.goodsListState.form) {
|
|
396
|
+
_context.next = 25;
|
|
397
|
+
break;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
_context.prev = 17;
|
|
401
|
+
_context.next = 20;
|
|
402
|
+
return (_this$state$goodsList = this.state.goodsListState.form) === null || _this$state$goodsList === void 0 ? void 0 : _this$state$goodsList.validateFields();
|
|
403
|
+
|
|
404
|
+
case 20:
|
|
405
|
+
_context.next = 25;
|
|
406
|
+
break;
|
|
407
|
+
|
|
408
|
+
case 22:
|
|
409
|
+
_context.prev = 22;
|
|
410
|
+
_context.t0 = _context["catch"](17);
|
|
411
|
+
|
|
412
|
+
_errors.set('goodsList', _context.t0.errors);
|
|
413
|
+
|
|
414
|
+
case 25:
|
|
396
415
|
_values.set('goodsList', this.state.goodsListState.goodsList.slice()); // 金额(含税)
|
|
397
416
|
|
|
398
417
|
|
|
@@ -436,12 +455,12 @@ var InvoiceControllerForm = /*#__PURE__*/function (_GreyReactBox) {
|
|
|
436
455
|
values: _values
|
|
437
456
|
});
|
|
438
457
|
|
|
439
|
-
case
|
|
458
|
+
case 30:
|
|
440
459
|
case "end":
|
|
441
460
|
return _context.stop();
|
|
442
461
|
}
|
|
443
462
|
}
|
|
444
|
-
}, _callee, this);
|
|
463
|
+
}, _callee, this, [[17, 22]]);
|
|
445
464
|
}));
|
|
446
465
|
|
|
447
466
|
function validateFields() {
|
|
@@ -2391,7 +2410,7 @@ var format2 = function format2(value) {
|
|
|
2391
2410
|
if (value === Infinity) return '';
|
|
2392
2411
|
if ("".concat(value) === 'NaN') return '';
|
|
2393
2412
|
if (typeof value === 'string') value = parseFloat(value);
|
|
2394
|
-
return value.toFixed(2);
|
|
2413
|
+
return parseFloat(value.toFixed(2));
|
|
2395
2414
|
};
|
|
2396
2415
|
/** 格式化 保留15位数字 */
|
|
2397
2416
|
|
|
@@ -2433,14 +2452,13 @@ var lazyFn$1 = function lazyFn(fn) {
|
|
|
2433
2452
|
|
|
2434
2453
|
var promptErr = function promptErr(err) {
|
|
2435
2454
|
if (!err) return false;
|
|
2436
|
-
|
|
2437
|
-
if (err.errors[0].message
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
}
|
|
2443
|
-
|
|
2455
|
+
if (err.errors[0].message === 'lineAmountIncludeTax need to revalidate') return true;
|
|
2456
|
+
if (err.errors[0].message === 'priceIncludeTax need to revalidate') return true;
|
|
2457
|
+
ktsComponentsAntdX3.message.error({
|
|
2458
|
+
key: err.errors[0].message,
|
|
2459
|
+
content: err.errors[0].message,
|
|
2460
|
+
duration: 2
|
|
2461
|
+
});
|
|
2444
2462
|
return true;
|
|
2445
2463
|
};
|
|
2446
2464
|
/** 数量改变了 */
|
|
@@ -3775,8 +3793,8 @@ var useColumns = (function (form) {
|
|
|
3775
3793
|
while (1) {
|
|
3776
3794
|
switch (_context5.prev = _context5.next) {
|
|
3777
3795
|
case 0:
|
|
3778
|
-
if ("".concat(value).split('.')[0].length >
|
|
3779
|
-
callback('金额整数部分不能大于
|
|
3796
|
+
if ("".concat(value).split('.')[0].length > 9) {
|
|
3797
|
+
callback('金额整数部分不能大于9位');
|
|
3780
3798
|
}
|
|
3781
3799
|
|
|
3782
3800
|
case 1:
|
|
@@ -3837,8 +3855,8 @@ var useColumns = (function (form) {
|
|
|
3837
3855
|
while (1) {
|
|
3838
3856
|
switch (_context6.prev = _context6.next) {
|
|
3839
3857
|
case 0:
|
|
3840
|
-
if ("".concat(value).split('.')[0].length >
|
|
3841
|
-
callback('金额整数部分不能大于
|
|
3858
|
+
if ("".concat(value).split('.')[0].length > 9) {
|
|
3859
|
+
callback('金额整数部分不能大于9位');
|
|
3842
3860
|
}
|
|
3843
3861
|
|
|
3844
3862
|
case 1:
|
|
@@ -4502,7 +4520,7 @@ var Main = GreyReactBox.decorator(ktsComponentsAntdX3.Form.create())(function (p
|
|
|
4502
4520
|
},
|
|
4503
4521
|
dataSource: controller.useMemo(function (s) {
|
|
4504
4522
|
return s.goodsListState.goodsList;
|
|
4505
|
-
}, []),
|
|
4523
|
+
}, [controller]),
|
|
4506
4524
|
columns: useColumns(props.form),
|
|
4507
4525
|
rowSelection: useRowSelection(),
|
|
4508
4526
|
onRow: function onRow(record) {
|
|
@@ -5274,41 +5292,33 @@ var EndowCodeDrawer = (function () {
|
|
|
5274
5292
|
return _context2.abrupt("return");
|
|
5275
5293
|
|
|
5276
5294
|
case 4:
|
|
5277
|
-
if (!(endowcodeGoodIndex.length === 1)) {
|
|
5278
|
-
_context2.next = 17;
|
|
5279
|
-
break;
|
|
5280
|
-
}
|
|
5281
|
-
|
|
5282
5295
|
getDefaultValue = s.goodsListState.endowCode.getDefaultValue;
|
|
5283
5296
|
|
|
5284
5297
|
if (!getDefaultValue) {
|
|
5285
|
-
_context2.next =
|
|
5298
|
+
_context2.next = 13;
|
|
5286
5299
|
break;
|
|
5287
5300
|
}
|
|
5288
5301
|
|
|
5289
5302
|
_context2.t0 = setDefaultValue;
|
|
5290
|
-
_context2.next =
|
|
5291
|
-
return getDefaultValue(_objectSpread2({}, good));
|
|
5303
|
+
_context2.next = 9;
|
|
5304
|
+
return getDefaultValue(_objectSpread2({}, good), endowcodeGoodIndex.length);
|
|
5292
5305
|
|
|
5293
|
-
case
|
|
5306
|
+
case 9:
|
|
5294
5307
|
_context2.t1 = _context2.sent;
|
|
5295
5308
|
(0, _context2.t0)(_context2.t1);
|
|
5296
|
-
_context2.next =
|
|
5297
|
-
break;
|
|
5298
|
-
|
|
5299
|
-
case 14:
|
|
5300
|
-
setDefaultValue(good);
|
|
5301
|
-
|
|
5302
|
-
case 15:
|
|
5303
|
-
_context2.next = 18;
|
|
5309
|
+
_context2.next = 14;
|
|
5304
5310
|
break;
|
|
5305
5311
|
|
|
5306
|
-
case
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
}
|
|
5312
|
+
case 13:
|
|
5313
|
+
if (endowcodeGoodIndex.length === 1) {
|
|
5314
|
+
setDefaultValue(good);
|
|
5315
|
+
} else {
|
|
5316
|
+
setDefaultValue({
|
|
5317
|
+
taxRate: good.taxRate
|
|
5318
|
+
});
|
|
5319
|
+
}
|
|
5310
5320
|
|
|
5311
|
-
case
|
|
5321
|
+
case 14:
|
|
5312
5322
|
case "end":
|
|
5313
5323
|
return _context2.stop();
|
|
5314
5324
|
}
|
|
@@ -5619,7 +5629,9 @@ var DrawerBody$3 = function DrawerBody(props) {
|
|
|
5619
5629
|
name: "taxRate",
|
|
5620
5630
|
type: "string",
|
|
5621
5631
|
title: "\u7A0E\u7387",
|
|
5622
|
-
|
|
5632
|
+
"x-component-props": {
|
|
5633
|
+
disabled: readOnlyTaxRate
|
|
5634
|
+
},
|
|
5623
5635
|
default: (_defaultValue$taxRate = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.taxRate) !== null && _defaultValue$taxRate !== void 0 ? _defaultValue$taxRate : 0,
|
|
5624
5636
|
enum: taxRateList,
|
|
5625
5637
|
"x-rules": [{
|
|
@@ -5783,7 +5795,17 @@ var Main$3 = function Main(props) {
|
|
|
5783
5795
|
var controller = React__default['default'].useMemo(function () {
|
|
5784
5796
|
return props.controller || new InvoiceController();
|
|
5785
5797
|
}, [props.controller]);
|
|
5798
|
+
|
|
5799
|
+
var _React$useState = React__default['default'].useState(0),
|
|
5800
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5801
|
+
key = _React$useState2[0],
|
|
5802
|
+
setKey = _React$useState2[1];
|
|
5803
|
+
|
|
5804
|
+
React__default['default'].useEffect(function () {
|
|
5805
|
+
setKey(key + 1);
|
|
5806
|
+
}, [controller]);
|
|
5786
5807
|
return /*#__PURE__*/React__default['default'].createElement(InvoiceContext.Provider, {
|
|
5808
|
+
key: key,
|
|
5787
5809
|
value: controller
|
|
5788
5810
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
5789
5811
|
className: "kts-invoice-operate"
|