kts-component-invoice-operate 1.0.86 → 1.0.90

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.
@@ -1,5 +1,5 @@
1
1
  /** 格式化 保留2位小数 */
2
- export declare const format2: (value: number | string) => 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 21:
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
 
@@ -2418,16 +2437,21 @@ var lazyFn$1 = function lazyFn(fn) {
2418
2437
  }, delayed);
2419
2438
  };
2420
2439
  };
2421
- /** 提示错误 */
2422
2440
 
2441
+ var promptErrV = {};
2442
+ /** 提示错误 */
2423
2443
 
2424
2444
  var promptErr = function promptErr(err) {
2425
2445
  if (!err) return false;
2446
+ if (err.errors[0].message === 'lineAmountIncludeTax need to revalidate') return true;
2447
+ if (err.errors[0].message === 'priceIncludeTax need to revalidate') return true;
2426
2448
 
2427
- if (err.errors[0].message !== 'lineAmountIncludeTax need to revalidate') {
2449
+ if (new Date().getTime() - promptErrV.t > 2000 || err.errors[0].message !== promptErrV.m) {
2450
+ promptErrV.t = new Date().getTime();
2451
+ promptErrV.m = err.errors[0].message;
2428
2452
  message.error({
2429
- key: err.errors[0].message,
2430
- content: err.errors[0].message
2453
+ content: err.errors[0].message,
2454
+ duration: 2
2431
2455
  });
2432
2456
  }
2433
2457
 
@@ -3765,8 +3789,8 @@ var useColumns = (function (form) {
3765
3789
  while (1) {
3766
3790
  switch (_context5.prev = _context5.next) {
3767
3791
  case 0:
3768
- if ("".concat(value).split('.')[0].length > 10) {
3769
- callback('金额整数部分不能大于10位');
3792
+ if ("".concat(value).split('.')[0].length > 9) {
3793
+ callback('金额整数部分不能大于9位,小数点后最多2位');
3770
3794
  }
3771
3795
 
3772
3796
  case 1:
@@ -3827,8 +3851,8 @@ var useColumns = (function (form) {
3827
3851
  while (1) {
3828
3852
  switch (_context6.prev = _context6.next) {
3829
3853
  case 0:
3830
- if ("".concat(value).split('.')[0].length > 10) {
3831
- callback('金额整数部分不能大于10位');
3854
+ if ("".concat(value).split('.')[0].length > 9) {
3855
+ callback('金额整数部分不能大于9位,小数点后最多2位');
3832
3856
  }
3833
3857
 
3834
3858
  case 1:
@@ -5601,7 +5625,9 @@ var DrawerBody$3 = function DrawerBody(props) {
5601
5625
  name: "taxRate",
5602
5626
  type: "string",
5603
5627
  title: "\u7A0E\u7387",
5604
- readOnly: readOnlyTaxRate,
5628
+ "x-component-props": {
5629
+ disabled: readOnlyTaxRate
5630
+ },
5605
5631
  default: (_defaultValue$taxRate = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.taxRate) !== null && _defaultValue$taxRate !== void 0 ? _defaultValue$taxRate : 0,
5606
5632
  enum: taxRateList,
5607
5633
  "x-rules": [{
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 21:
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
 
@@ -2428,16 +2447,21 @@ var lazyFn$1 = function lazyFn(fn) {
2428
2447
  }, delayed);
2429
2448
  };
2430
2449
  };
2431
- /** 提示错误 */
2432
2450
 
2451
+ var promptErrV = {};
2452
+ /** 提示错误 */
2433
2453
 
2434
2454
  var promptErr = function promptErr(err) {
2435
2455
  if (!err) return false;
2456
+ if (err.errors[0].message === 'lineAmountIncludeTax need to revalidate') return true;
2457
+ if (err.errors[0].message === 'priceIncludeTax need to revalidate') return true;
2436
2458
 
2437
- if (err.errors[0].message !== 'lineAmountIncludeTax need to revalidate') {
2459
+ if (new Date().getTime() - promptErrV.t > 2000 || err.errors[0].message !== promptErrV.m) {
2460
+ promptErrV.t = new Date().getTime();
2461
+ promptErrV.m = err.errors[0].message;
2438
2462
  ktsComponentsAntdX3.message.error({
2439
- key: err.errors[0].message,
2440
- content: err.errors[0].message
2463
+ content: err.errors[0].message,
2464
+ duration: 2
2441
2465
  });
2442
2466
  }
2443
2467
 
@@ -3775,8 +3799,8 @@ var useColumns = (function (form) {
3775
3799
  while (1) {
3776
3800
  switch (_context5.prev = _context5.next) {
3777
3801
  case 0:
3778
- if ("".concat(value).split('.')[0].length > 10) {
3779
- callback('金额整数部分不能大于10位');
3802
+ if ("".concat(value).split('.')[0].length > 9) {
3803
+ callback('金额整数部分不能大于9位,小数点后最多2位');
3780
3804
  }
3781
3805
 
3782
3806
  case 1:
@@ -3837,8 +3861,8 @@ var useColumns = (function (form) {
3837
3861
  while (1) {
3838
3862
  switch (_context6.prev = _context6.next) {
3839
3863
  case 0:
3840
- if ("".concat(value).split('.')[0].length > 10) {
3841
- callback('金额整数部分不能大于10位');
3864
+ if ("".concat(value).split('.')[0].length > 9) {
3865
+ callback('金额整数部分不能大于9位,小数点后最多2位');
3842
3866
  }
3843
3867
 
3844
3868
  case 1:
@@ -5611,7 +5635,9 @@ var DrawerBody$3 = function DrawerBody(props) {
5611
5635
  name: "taxRate",
5612
5636
  type: "string",
5613
5637
  title: "\u7A0E\u7387",
5614
- readOnly: readOnlyTaxRate,
5638
+ "x-component-props": {
5639
+ disabled: readOnlyTaxRate
5640
+ },
5615
5641
  default: (_defaultValue$taxRate = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.taxRate) !== null && _defaultValue$taxRate !== void 0 ? _defaultValue$taxRate : 0,
5616
5642
  enum: taxRateList,
5617
5643
  "x-rules": [{