kts-component-invoice-operate 1.0.68 → 1.0.73

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/index.esm.js CHANGED
@@ -2763,26 +2763,34 @@ var onChangeLineAmountIncludeTax = lazyFn$1(function (controller, form, record)
2763
2763
  err = err || {};
2764
2764
 
2765
2765
  if (!(err.lineAmountIncludeTax || !values.lineAmountIncludeTax)) {
2766
- _context4.next = 3;
2766
+ _context4.next = 6;
2767
2767
  break;
2768
2768
  }
2769
2769
 
2770
+ _context4.next = 4;
2771
+ return controller.setEditGood({
2772
+ lineAmountIncludeTax: undefined,
2773
+ lineAmountExcludeTax: undefined
2774
+ });
2775
+
2776
+ case 4:
2777
+ updateUnitPriceExcludingTax(controller, form);
2770
2778
  return _context4.abrupt("return");
2771
2779
 
2772
- case 3:
2780
+ case 6:
2773
2781
  lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
2774
- _context4.next = 6;
2782
+ _context4.next = 9;
2775
2783
  return controller.setEditGood({
2776
2784
  lineAmountIncludeTax: lineAmountIncludeTax
2777
2785
  });
2778
2786
 
2779
- case 6:
2787
+ case 9:
2780
2788
  form.setFieldsValue({
2781
2789
  lineAmountIncludeTax: lineAmountIncludeTax
2782
2790
  }); // 是否有数量
2783
2791
 
2784
2792
  if (!(!err.quantity && values.quantity)) {
2785
- _context4.next = 15;
2793
+ _context4.next = 18;
2786
2794
  break;
2787
2795
  }
2788
2796
 
@@ -2791,18 +2799,18 @@ var onChangeLineAmountIncludeTax = lazyFn$1(function (controller, form, record)
2791
2799
  form.setFieldsValue({
2792
2800
  priceIncludeTax: priceIncludeTax
2793
2801
  });
2794
- _context4.next = 13;
2802
+ _context4.next = 16;
2795
2803
  return controller.setEditGood({
2796
2804
  priceIncludeTax: priceIncludeTax
2797
2805
  });
2798
2806
 
2799
- case 13:
2800
- _context4.next = 21;
2807
+ case 16:
2808
+ _context4.next = 24;
2801
2809
  break;
2802
2810
 
2803
- case 15:
2811
+ case 18:
2804
2812
  if (!(!err.priceIncludeTax && (values.priceIncludeTax || values.priceIncludeTax === 0))) {
2805
- _context4.next = 21;
2813
+ _context4.next = 24;
2806
2814
  break;
2807
2815
  }
2808
2816
 
@@ -2811,16 +2819,16 @@ var onChangeLineAmountIncludeTax = lazyFn$1(function (controller, form, record)
2811
2819
  form.setFieldsValue({
2812
2820
  quantity: _quantity3
2813
2821
  });
2814
- _context4.next = 21;
2822
+ _context4.next = 24;
2815
2823
  return controller.setEditGood({
2816
2824
  quantity: _quantity3
2817
2825
  });
2818
2826
 
2819
- case 21:
2827
+ case 24:
2820
2828
  // 更新不含税
2821
2829
  updateUnitPriceExcludingTax(controller, form);
2822
2830
 
2823
- case 22:
2831
+ case 25:
2824
2832
  case "end":
2825
2833
  return _context4.stop();
2826
2834
  }
@@ -2847,26 +2855,32 @@ var onChangeLineAmountExcludeTax = lazyFn$1(function (controller, form, record)
2847
2855
  err = err || {};
2848
2856
 
2849
2857
  if (!(err.lineAmountExcludeTax || !values.lineAmountExcludeTax)) {
2850
- _context5.next = 3;
2858
+ _context5.next = 5;
2851
2859
  break;
2852
2860
  }
2853
2861
 
2854
- return _context5.abrupt("return");
2862
+ // 更新含税
2863
+ updateUnitPriceTax(controller, form);
2864
+ _context5.next = 5;
2865
+ return controller.setEditGood({
2866
+ lineAmountIncludeTax: undefined,
2867
+ lineAmountExcludeTax: undefined
2868
+ });
2855
2869
 
2856
- case 3:
2870
+ case 5:
2857
2871
  lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
2858
- _context5.next = 6;
2872
+ _context5.next = 8;
2859
2873
  return controller.setEditGood({
2860
2874
  lineAmountExcludeTax: lineAmountExcludeTax
2861
2875
  });
2862
2876
 
2863
- case 6:
2877
+ case 8:
2864
2878
  form.setFieldsValue({
2865
2879
  lineAmountExcludeTax: lineAmountExcludeTax
2866
2880
  }); // 是否有数量
2867
2881
 
2868
2882
  if (!(!err.quantity && values.quantity)) {
2869
- _context5.next = 15;
2883
+ _context5.next = 17;
2870
2884
  break;
2871
2885
  }
2872
2886
 
@@ -2875,18 +2889,18 @@ var onChangeLineAmountExcludeTax = lazyFn$1(function (controller, form, record)
2875
2889
  form.setFieldsValue({
2876
2890
  priceExcludeTax: priceExcludeTax
2877
2891
  });
2878
- _context5.next = 13;
2892
+ _context5.next = 15;
2879
2893
  return controller.setEditGood({
2880
2894
  priceExcludeTax: priceExcludeTax
2881
2895
  });
2882
2896
 
2883
- case 13:
2884
- _context5.next = 21;
2897
+ case 15:
2898
+ _context5.next = 23;
2885
2899
  break;
2886
2900
 
2887
- case 15:
2901
+ case 17:
2888
2902
  if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
2889
- _context5.next = 21;
2903
+ _context5.next = 23;
2890
2904
  break;
2891
2905
  }
2892
2906
 
@@ -2895,16 +2909,16 @@ var onChangeLineAmountExcludeTax = lazyFn$1(function (controller, form, record)
2895
2909
  form.setFieldsValue({
2896
2910
  quantity: _quantity4
2897
2911
  });
2898
- _context5.next = 21;
2912
+ _context5.next = 23;
2899
2913
  return controller.setEditGood({
2900
2914
  quantity: _quantity4
2901
2915
  });
2902
2916
 
2903
- case 21:
2917
+ case 23:
2904
2918
  // 更新含税
2905
2919
  updateUnitPriceTax(controller, form);
2906
2920
 
2907
- case 22:
2921
+ case 24:
2908
2922
  case "end":
2909
2923
  return _context5.stop();
2910
2924
  }
@@ -2977,7 +2991,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
2977
2991
  err = err || {};
2978
2992
 
2979
2993
  if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !err.lineAmountIncludeTax && (values.lineAmountIncludeTax || values.lineAmountIncludeTax === 0))) {
2980
- _context7.next = 10;
2994
+ _context7.next = 12;
2981
2995
  break;
2982
2996
  }
2983
2997
 
@@ -3001,19 +3015,32 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
3001
3015
  });
3002
3016
 
3003
3017
  case 10:
3018
+ _context7.next = 15;
3019
+ break;
3020
+
3021
+ case 12:
3022
+ form.setFieldsValue({
3023
+ taxAmount: null
3024
+ });
3025
+ _context7.next = 15;
3026
+ return controller.setEditGood({
3027
+ taxAmount: null
3028
+ });
3029
+
3030
+ case 15:
3004
3031
  if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !err.priceIncludeTax && (values.priceIncludeTax || values.priceIncludeTax === 0))) {
3005
- _context7.next = 15;
3032
+ _context7.next = 20;
3006
3033
  break;
3007
3034
  }
3008
3035
 
3009
3036
  priceIncludeTax = format15(values.priceIncludeTax);
3010
3037
  priceExcludeTax = format15(evaluate("".concat(priceIncludeTax, " / (1+(").concat(values.taxRate, "/100))")));
3011
- _context7.next = 15;
3038
+ _context7.next = 20;
3012
3039
  return controller.setEditGood({
3013
3040
  priceExcludeTax: priceExcludeTax
3014
3041
  });
3015
3042
 
3016
- case 15:
3043
+ case 20:
3017
3044
  case "end":
3018
3045
  return _context7.stop();
3019
3046
  }
@@ -3039,7 +3066,7 @@ var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
3039
3066
  err = err || {};
3040
3067
 
3041
3068
  if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !err.lineAmountExcludeTax && (values.lineAmountExcludeTax || values.lineAmountExcludeTax === 0))) {
3042
- _context8.next = 10;
3069
+ _context8.next = 12;
3043
3070
  break;
3044
3071
  }
3045
3072
 
@@ -3063,19 +3090,32 @@ var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
3063
3090
  });
3064
3091
 
3065
3092
  case 10:
3093
+ _context8.next = 15;
3094
+ break;
3095
+
3096
+ case 12:
3097
+ form.setFieldsValue({
3098
+ taxAmount: undefined
3099
+ });
3100
+ _context8.next = 15;
3101
+ return controller.setEditGood({
3102
+ taxAmount: undefined
3103
+ });
3104
+
3105
+ case 15:
3066
3106
  if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !err.priceExcludeTax && (values.priceExcludeTax || values.priceExcludeTax === 0))) {
3067
- _context8.next = 15;
3107
+ _context8.next = 20;
3068
3108
  break;
3069
3109
  }
3070
3110
 
3071
3111
  priceExcludeTax = format15(values.priceExcludeTax);
3072
3112
  priceIncludeTax = format15(evaluate("".concat(priceExcludeTax, " * (1+(").concat(values.taxRate, "/100))")));
3073
- _context8.next = 15;
3113
+ _context8.next = 20;
3074
3114
  return controller.setEditGood({
3075
3115
  priceIncludeTax: priceIncludeTax
3076
3116
  });
3077
3117
 
3078
- case 15:
3118
+ case 20:
3079
3119
  case "end":
3080
3120
  return _context8.stop();
3081
3121
  }
@@ -4908,6 +4948,19 @@ var ImportGoodsDrawer = (function () {
4908
4948
  };
4909
4949
  }())();
4910
4950
  }, [controller]);
4951
+ React.useEffect(function () {
4952
+ setTimeout(function () {
4953
+ console.log(window.document.querySelector('.ktsAnt3x-drawer'));
4954
+
4955
+ if (visible) {
4956
+ var _window$document$quer;
4957
+
4958
+ (_window$document$quer = window.document.querySelector('.ktsAnt3x-drawer')) === null || _window$document$quer === void 0 ? void 0 : _window$document$quer.addEventListener('click', function (e) {// debugger
4959
+ // e.stopPropagation();
4960
+ }, true);
4961
+ }
4962
+ });
4963
+ }, [visible]);
4911
4964
  return /*#__PURE__*/React.createElement(Drawer, {
4912
4965
  title: "\u5546\u54C1\u5217\u8868",
4913
4966
  placement: "right",
@@ -4915,7 +4968,10 @@ var ImportGoodsDrawer = (function () {
4915
4968
  destroyOnClose: true,
4916
4969
  width: 983,
4917
4970
  onClose: onClose,
4918
- visible: visible
4971
+ visible: visible,
4972
+ getContainer: function getContainer() {
4973
+ return window.document.querySelector('.kts-invoice-operate-goods-list-able');
4974
+ }
4919
4975
  }, topExpand && /*#__PURE__*/React.createElement("div", {
4920
4976
  style: {
4921
4977
  marginBottom: 10
@@ -4934,6 +4990,11 @@ var DrawerBody$2 = function DrawerBody() {
4934
4990
  var pagination = controller.useMemo(function (s) {
4935
4991
  return s.goodsListState.importGoods.pagination;
4936
4992
  }, []);
4993
+
4994
+ var _React$useState = React.useState(controller.state.goodsListState.editGood),
4995
+ _React$useState2 = _slicedToArray(_React$useState, 1),
4996
+ editGood = _React$useState2[0];
4997
+
4937
4998
  React.useEffect(function () {
4938
4999
  controller.getGoodsList && controller.getGoodsList({
4939
5000
  pagination: {
@@ -4961,44 +5022,70 @@ var DrawerBody$2 = function DrawerBody() {
4961
5022
  while (1) {
4962
5023
  switch (_context2.prev = _context2.next) {
4963
5024
  case 0:
4964
- debugger;
5025
+ if (!s.goodsListState.editGood) {
5026
+ _context2.next = 2;
5027
+ break;
5028
+ }
5029
+
5030
+ return _context2.abrupt("return");
5031
+
5032
+ case 2:
5033
+ s.goodsListState.editGood = editGood;
5034
+
5035
+ case 3:
5036
+ case "end":
5037
+ return _context2.stop();
5038
+ }
5039
+ }
5040
+ }, _callee2);
5041
+ }));
5042
+
5043
+ return function (_x2) {
5044
+ return _ref2.apply(this, arguments);
5045
+ };
5046
+ }(), /*#__PURE__*/function () {
5047
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(s) {
5048
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
5049
+ while (1) {
5050
+ switch (_context3.prev = _context3.next) {
5051
+ case 0:
4965
5052
  Object.keys(record).filter(function (e) {
4966
5053
  return !record[e] && record[e] !== 0;
4967
5054
  }).forEach(function (e) {
4968
5055
  delete record[e];
4969
5056
  });
4970
- _context2.next = 4;
5057
+ _context3.next = 3;
4971
5058
  return s.goodsListState.importGoods.verifyFn(record);
4972
5059
 
4973
- case 4:
4974
- _context2.t0 = _context2.sent;
5060
+ case 3:
5061
+ _context3.t0 = _context3.sent;
4975
5062
 
4976
- if (!(_context2.t0 === false)) {
4977
- _context2.next = 7;
5063
+ if (!(_context3.t0 === false)) {
5064
+ _context3.next = 6;
4978
5065
  break;
4979
5066
  }
4980
5067
 
4981
- return _context2.abrupt("return");
5068
+ return _context3.abrupt("return");
4982
5069
 
4983
- case 7:
5070
+ case 6:
4984
5071
  if (!(!s.goodsListState.editGood || !s.goodsListState.form)) {
4985
- _context2.next = 9;
5072
+ _context3.next = 8;
4986
5073
  break;
4987
5074
  }
4988
5075
 
4989
- return _context2.abrupt("return");
5076
+ return _context3.abrupt("return");
4990
5077
 
4991
- case 9:
5078
+ case 8:
4992
5079
  s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, s.goodsListState.editGood), record);
4993
5080
 
4994
5081
  if (s.goodsListState.editGood) {
4995
- _context2.next = 12;
5082
+ _context3.next = 11;
4996
5083
  break;
4997
5084
  }
4998
5085
 
4999
- return _context2.abrupt("return");
5086
+ return _context3.abrupt("return");
5000
5087
 
5001
- case 12:
5088
+ case 11:
5002
5089
  if ("".concat(s.goodsListState.editGood.priceIncludeTax) === '0') {
5003
5090
  s.goodsListState.editGood.priceIncludeTax = undefined;
5004
5091
  s.goodsListState.editGood.priceExcludeTax = undefined;
@@ -5012,16 +5099,16 @@ var DrawerBody$2 = function DrawerBody() {
5012
5099
  s.goodsListState.importGoods.isVisibleDrawer = false;
5013
5100
  s.goodsListState.isTaxIncluded ? updateUnitPriceExcludingTax(controller, s.goodsListState.form) : updateUnitPriceTax(controller, s.goodsListState.form);
5014
5101
 
5015
- case 18:
5102
+ case 17:
5016
5103
  case "end":
5017
- return _context2.stop();
5104
+ return _context3.stop();
5018
5105
  }
5019
5106
  }
5020
- }, _callee2);
5107
+ }, _callee3);
5021
5108
  }));
5022
5109
 
5023
- return function (_x2) {
5024
- return _ref2.apply(this, arguments);
5110
+ return function (_x3) {
5111
+ return _ref3.apply(this, arguments);
5025
5112
  };
5026
5113
  }())();
5027
5114
  }
package/dist/index.js CHANGED
@@ -2772,26 +2772,34 @@ var onChangeLineAmountIncludeTax = lazyFn$1(function (controller, form, record)
2772
2772
  err = err || {};
2773
2773
 
2774
2774
  if (!(err.lineAmountIncludeTax || !values.lineAmountIncludeTax)) {
2775
- _context4.next = 3;
2775
+ _context4.next = 6;
2776
2776
  break;
2777
2777
  }
2778
2778
 
2779
+ _context4.next = 4;
2780
+ return controller.setEditGood({
2781
+ lineAmountIncludeTax: undefined,
2782
+ lineAmountExcludeTax: undefined
2783
+ });
2784
+
2785
+ case 4:
2786
+ updateUnitPriceExcludingTax(controller, form);
2779
2787
  return _context4.abrupt("return");
2780
2788
 
2781
- case 3:
2789
+ case 6:
2782
2790
  lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
2783
- _context4.next = 6;
2791
+ _context4.next = 9;
2784
2792
  return controller.setEditGood({
2785
2793
  lineAmountIncludeTax: lineAmountIncludeTax
2786
2794
  });
2787
2795
 
2788
- case 6:
2796
+ case 9:
2789
2797
  form.setFieldsValue({
2790
2798
  lineAmountIncludeTax: lineAmountIncludeTax
2791
2799
  }); // 是否有数量
2792
2800
 
2793
2801
  if (!(!err.quantity && values.quantity)) {
2794
- _context4.next = 15;
2802
+ _context4.next = 18;
2795
2803
  break;
2796
2804
  }
2797
2805
 
@@ -2800,18 +2808,18 @@ var onChangeLineAmountIncludeTax = lazyFn$1(function (controller, form, record)
2800
2808
  form.setFieldsValue({
2801
2809
  priceIncludeTax: priceIncludeTax
2802
2810
  });
2803
- _context4.next = 13;
2811
+ _context4.next = 16;
2804
2812
  return controller.setEditGood({
2805
2813
  priceIncludeTax: priceIncludeTax
2806
2814
  });
2807
2815
 
2808
- case 13:
2809
- _context4.next = 21;
2816
+ case 16:
2817
+ _context4.next = 24;
2810
2818
  break;
2811
2819
 
2812
- case 15:
2820
+ case 18:
2813
2821
  if (!(!err.priceIncludeTax && (values.priceIncludeTax || values.priceIncludeTax === 0))) {
2814
- _context4.next = 21;
2822
+ _context4.next = 24;
2815
2823
  break;
2816
2824
  }
2817
2825
 
@@ -2820,16 +2828,16 @@ var onChangeLineAmountIncludeTax = lazyFn$1(function (controller, form, record)
2820
2828
  form.setFieldsValue({
2821
2829
  quantity: _quantity3
2822
2830
  });
2823
- _context4.next = 21;
2831
+ _context4.next = 24;
2824
2832
  return controller.setEditGood({
2825
2833
  quantity: _quantity3
2826
2834
  });
2827
2835
 
2828
- case 21:
2836
+ case 24:
2829
2837
  // 更新不含税
2830
2838
  updateUnitPriceExcludingTax(controller, form);
2831
2839
 
2832
- case 22:
2840
+ case 25:
2833
2841
  case "end":
2834
2842
  return _context4.stop();
2835
2843
  }
@@ -2856,26 +2864,32 @@ var onChangeLineAmountExcludeTax = lazyFn$1(function (controller, form, record)
2856
2864
  err = err || {};
2857
2865
 
2858
2866
  if (!(err.lineAmountExcludeTax || !values.lineAmountExcludeTax)) {
2859
- _context5.next = 3;
2867
+ _context5.next = 5;
2860
2868
  break;
2861
2869
  }
2862
2870
 
2863
- return _context5.abrupt("return");
2871
+ // 更新含税
2872
+ updateUnitPriceTax(controller, form);
2873
+ _context5.next = 5;
2874
+ return controller.setEditGood({
2875
+ lineAmountIncludeTax: undefined,
2876
+ lineAmountExcludeTax: undefined
2877
+ });
2864
2878
 
2865
- case 3:
2879
+ case 5:
2866
2880
  lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
2867
- _context5.next = 6;
2881
+ _context5.next = 8;
2868
2882
  return controller.setEditGood({
2869
2883
  lineAmountExcludeTax: lineAmountExcludeTax
2870
2884
  });
2871
2885
 
2872
- case 6:
2886
+ case 8:
2873
2887
  form.setFieldsValue({
2874
2888
  lineAmountExcludeTax: lineAmountExcludeTax
2875
2889
  }); // 是否有数量
2876
2890
 
2877
2891
  if (!(!err.quantity && values.quantity)) {
2878
- _context5.next = 15;
2892
+ _context5.next = 17;
2879
2893
  break;
2880
2894
  }
2881
2895
 
@@ -2884,18 +2898,18 @@ var onChangeLineAmountExcludeTax = lazyFn$1(function (controller, form, record)
2884
2898
  form.setFieldsValue({
2885
2899
  priceExcludeTax: priceExcludeTax
2886
2900
  });
2887
- _context5.next = 13;
2901
+ _context5.next = 15;
2888
2902
  return controller.setEditGood({
2889
2903
  priceExcludeTax: priceExcludeTax
2890
2904
  });
2891
2905
 
2892
- case 13:
2893
- _context5.next = 21;
2906
+ case 15:
2907
+ _context5.next = 23;
2894
2908
  break;
2895
2909
 
2896
- case 15:
2910
+ case 17:
2897
2911
  if (!(!err.priceExcludeTax && values.priceExcludeTax)) {
2898
- _context5.next = 21;
2912
+ _context5.next = 23;
2899
2913
  break;
2900
2914
  }
2901
2915
 
@@ -2904,16 +2918,16 @@ var onChangeLineAmountExcludeTax = lazyFn$1(function (controller, form, record)
2904
2918
  form.setFieldsValue({
2905
2919
  quantity: _quantity4
2906
2920
  });
2907
- _context5.next = 21;
2921
+ _context5.next = 23;
2908
2922
  return controller.setEditGood({
2909
2923
  quantity: _quantity4
2910
2924
  });
2911
2925
 
2912
- case 21:
2926
+ case 23:
2913
2927
  // 更新含税
2914
2928
  updateUnitPriceTax(controller, form);
2915
2929
 
2916
- case 22:
2930
+ case 24:
2917
2931
  case "end":
2918
2932
  return _context5.stop();
2919
2933
  }
@@ -2986,7 +3000,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
2986
3000
  err = err || {};
2987
3001
 
2988
3002
  if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !err.lineAmountIncludeTax && (values.lineAmountIncludeTax || values.lineAmountIncludeTax === 0))) {
2989
- _context7.next = 10;
3003
+ _context7.next = 12;
2990
3004
  break;
2991
3005
  }
2992
3006
 
@@ -3010,19 +3024,32 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
3010
3024
  });
3011
3025
 
3012
3026
  case 10:
3027
+ _context7.next = 15;
3028
+ break;
3029
+
3030
+ case 12:
3031
+ form.setFieldsValue({
3032
+ taxAmount: null
3033
+ });
3034
+ _context7.next = 15;
3035
+ return controller.setEditGood({
3036
+ taxAmount: null
3037
+ });
3038
+
3039
+ case 15:
3013
3040
  if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !err.priceIncludeTax && (values.priceIncludeTax || values.priceIncludeTax === 0))) {
3014
- _context7.next = 15;
3041
+ _context7.next = 20;
3015
3042
  break;
3016
3043
  }
3017
3044
 
3018
3045
  priceIncludeTax = format15(values.priceIncludeTax);
3019
3046
  priceExcludeTax = format15(evaluate("".concat(priceIncludeTax, " / (1+(").concat(values.taxRate, "/100))")));
3020
- _context7.next = 15;
3047
+ _context7.next = 20;
3021
3048
  return controller.setEditGood({
3022
3049
  priceExcludeTax: priceExcludeTax
3023
3050
  });
3024
3051
 
3025
- case 15:
3052
+ case 20:
3026
3053
  case "end":
3027
3054
  return _context7.stop();
3028
3055
  }
@@ -3048,7 +3075,7 @@ var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
3048
3075
  err = err || {};
3049
3076
 
3050
3077
  if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !err.lineAmountExcludeTax && (values.lineAmountExcludeTax || values.lineAmountExcludeTax === 0))) {
3051
- _context8.next = 10;
3078
+ _context8.next = 12;
3052
3079
  break;
3053
3080
  }
3054
3081
 
@@ -3072,19 +3099,32 @@ var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
3072
3099
  });
3073
3100
 
3074
3101
  case 10:
3102
+ _context8.next = 15;
3103
+ break;
3104
+
3105
+ case 12:
3106
+ form.setFieldsValue({
3107
+ taxAmount: undefined
3108
+ });
3109
+ _context8.next = 15;
3110
+ return controller.setEditGood({
3111
+ taxAmount: undefined
3112
+ });
3113
+
3114
+ case 15:
3075
3115
  if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !err.priceExcludeTax && (values.priceExcludeTax || values.priceExcludeTax === 0))) {
3076
- _context8.next = 15;
3116
+ _context8.next = 20;
3077
3117
  break;
3078
3118
  }
3079
3119
 
3080
3120
  priceExcludeTax = format15(values.priceExcludeTax);
3081
3121
  priceIncludeTax = format15(evaluate("".concat(priceExcludeTax, " * (1+(").concat(values.taxRate, "/100))")));
3082
- _context8.next = 15;
3122
+ _context8.next = 20;
3083
3123
  return controller.setEditGood({
3084
3124
  priceIncludeTax: priceIncludeTax
3085
3125
  });
3086
3126
 
3087
- case 15:
3127
+ case 20:
3088
3128
  case "end":
3089
3129
  return _context8.stop();
3090
3130
  }
@@ -4917,6 +4957,19 @@ var ImportGoodsDrawer = (function () {
4917
4957
  };
4918
4958
  }())();
4919
4959
  }, [controller]);
4960
+ React__default['default'].useEffect(function () {
4961
+ setTimeout(function () {
4962
+ console.log(window.document.querySelector('.ktsAnt3x-drawer'));
4963
+
4964
+ if (visible) {
4965
+ var _window$document$quer;
4966
+
4967
+ (_window$document$quer = window.document.querySelector('.ktsAnt3x-drawer')) === null || _window$document$quer === void 0 ? void 0 : _window$document$quer.addEventListener('click', function (e) {// debugger
4968
+ // e.stopPropagation();
4969
+ }, true);
4970
+ }
4971
+ });
4972
+ }, [visible]);
4920
4973
  return /*#__PURE__*/React__default['default'].createElement(ktsComponentsAntdX3.Drawer, {
4921
4974
  title: "\u5546\u54C1\u5217\u8868",
4922
4975
  placement: "right",
@@ -4924,7 +4977,10 @@ var ImportGoodsDrawer = (function () {
4924
4977
  destroyOnClose: true,
4925
4978
  width: 983,
4926
4979
  onClose: onClose,
4927
- visible: visible
4980
+ visible: visible,
4981
+ getContainer: function getContainer() {
4982
+ return window.document.querySelector('.kts-invoice-operate-goods-list-able');
4983
+ }
4928
4984
  }, topExpand && /*#__PURE__*/React__default['default'].createElement("div", {
4929
4985
  style: {
4930
4986
  marginBottom: 10
@@ -4943,6 +4999,11 @@ var DrawerBody$2 = function DrawerBody() {
4943
4999
  var pagination = controller.useMemo(function (s) {
4944
5000
  return s.goodsListState.importGoods.pagination;
4945
5001
  }, []);
5002
+
5003
+ var _React$useState = React__default['default'].useState(controller.state.goodsListState.editGood),
5004
+ _React$useState2 = _slicedToArray(_React$useState, 1),
5005
+ editGood = _React$useState2[0];
5006
+
4946
5007
  React__default['default'].useEffect(function () {
4947
5008
  controller.getGoodsList && controller.getGoodsList({
4948
5009
  pagination: {
@@ -4970,44 +5031,70 @@ var DrawerBody$2 = function DrawerBody() {
4970
5031
  while (1) {
4971
5032
  switch (_context2.prev = _context2.next) {
4972
5033
  case 0:
4973
- debugger;
5034
+ if (!s.goodsListState.editGood) {
5035
+ _context2.next = 2;
5036
+ break;
5037
+ }
5038
+
5039
+ return _context2.abrupt("return");
5040
+
5041
+ case 2:
5042
+ s.goodsListState.editGood = editGood;
5043
+
5044
+ case 3:
5045
+ case "end":
5046
+ return _context2.stop();
5047
+ }
5048
+ }
5049
+ }, _callee2);
5050
+ }));
5051
+
5052
+ return function (_x2) {
5053
+ return _ref2.apply(this, arguments);
5054
+ };
5055
+ }(), /*#__PURE__*/function () {
5056
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(s) {
5057
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
5058
+ while (1) {
5059
+ switch (_context3.prev = _context3.next) {
5060
+ case 0:
4974
5061
  Object.keys(record).filter(function (e) {
4975
5062
  return !record[e] && record[e] !== 0;
4976
5063
  }).forEach(function (e) {
4977
5064
  delete record[e];
4978
5065
  });
4979
- _context2.next = 4;
5066
+ _context3.next = 3;
4980
5067
  return s.goodsListState.importGoods.verifyFn(record);
4981
5068
 
4982
- case 4:
4983
- _context2.t0 = _context2.sent;
5069
+ case 3:
5070
+ _context3.t0 = _context3.sent;
4984
5071
 
4985
- if (!(_context2.t0 === false)) {
4986
- _context2.next = 7;
5072
+ if (!(_context3.t0 === false)) {
5073
+ _context3.next = 6;
4987
5074
  break;
4988
5075
  }
4989
5076
 
4990
- return _context2.abrupt("return");
5077
+ return _context3.abrupt("return");
4991
5078
 
4992
- case 7:
5079
+ case 6:
4993
5080
  if (!(!s.goodsListState.editGood || !s.goodsListState.form)) {
4994
- _context2.next = 9;
5081
+ _context3.next = 8;
4995
5082
  break;
4996
5083
  }
4997
5084
 
4998
- return _context2.abrupt("return");
5085
+ return _context3.abrupt("return");
4999
5086
 
5000
- case 9:
5087
+ case 8:
5001
5088
  s.goodsListState.editGood = _objectSpread2(_objectSpread2({}, s.goodsListState.editGood), record);
5002
5089
 
5003
5090
  if (s.goodsListState.editGood) {
5004
- _context2.next = 12;
5091
+ _context3.next = 11;
5005
5092
  break;
5006
5093
  }
5007
5094
 
5008
- return _context2.abrupt("return");
5095
+ return _context3.abrupt("return");
5009
5096
 
5010
- case 12:
5097
+ case 11:
5011
5098
  if ("".concat(s.goodsListState.editGood.priceIncludeTax) === '0') {
5012
5099
  s.goodsListState.editGood.priceIncludeTax = undefined;
5013
5100
  s.goodsListState.editGood.priceExcludeTax = undefined;
@@ -5021,16 +5108,16 @@ var DrawerBody$2 = function DrawerBody() {
5021
5108
  s.goodsListState.importGoods.isVisibleDrawer = false;
5022
5109
  s.goodsListState.isTaxIncluded ? updateUnitPriceExcludingTax(controller, s.goodsListState.form) : updateUnitPriceTax(controller, s.goodsListState.form);
5023
5110
 
5024
- case 18:
5111
+ case 17:
5025
5112
  case "end":
5026
- return _context2.stop();
5113
+ return _context3.stop();
5027
5114
  }
5028
5115
  }
5029
- }, _callee2);
5116
+ }, _callee3);
5030
5117
  }));
5031
5118
 
5032
- return function (_x2) {
5033
- return _ref2.apply(this, arguments);
5119
+ return function (_x3) {
5120
+ return _ref3.apply(this, arguments);
5034
5121
  };
5035
5122
  }())();
5036
5123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "1.0.68",
3
+ "version": "1.0.73",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -139,7 +139,7 @@ const getMok = async (current: number = 1) => {
139
139
  "specification": "苹果一号",
140
140
  "spuCode": "6000000040810519",
141
141
  "status": 1,
142
- "taxCategoryCode": "1100101020200000000",
142
+ // "taxCategoryCode": "1100101020200000000",
143
143
  "taxExemptionType": "",
144
144
  "taxId": 5,
145
145
  "taxRate": 3,
@@ -173,7 +173,12 @@ export const onChangeLineAmountIncludeTax = lazyFn(
173
173
  form.validateFields(async (err, values) => {
174
174
 
175
175
  err = err || {};
176
- if (err.lineAmountIncludeTax || !values.lineAmountIncludeTax) return;
176
+ if (err.lineAmountIncludeTax || !values.lineAmountIncludeTax) {
177
+ // 更新不含税
178
+ await controller.setEditGood({ lineAmountIncludeTax: undefined, lineAmountExcludeTax: undefined });
179
+ updateUnitPriceExcludingTax(controller, form, record);
180
+ return;
181
+ }
177
182
 
178
183
  const lineAmountIncludeTax = format2(values.lineAmountIncludeTax);
179
184
  await controller.setEditGood({ lineAmountIncludeTax });
@@ -191,6 +196,7 @@ export const onChangeLineAmountIncludeTax = lazyFn(
191
196
  form.setFieldsValue({ quantity });
192
197
  await controller.setEditGood({ quantity });
193
198
  }
199
+
194
200
  // 更新不含税
195
201
  updateUnitPriceExcludingTax(controller, form, record);
196
202
  });
@@ -203,7 +209,11 @@ export const onChangeLineAmountExcludeTax = lazyFn(
203
209
  (controller: InvoiceController, form: WrappedFormUtils, record: IGood) => {
204
210
  form.validateFields(async (err, values) => {
205
211
  err = err || {};
206
- if (err.lineAmountExcludeTax || !values.lineAmountExcludeTax) return;
212
+ if (err.lineAmountExcludeTax || !values.lineAmountExcludeTax) {
213
+ // 更新含税
214
+ updateUnitPriceTax(controller, form, record);
215
+ await controller.setEditGood({ lineAmountIncludeTax: undefined, lineAmountExcludeTax: undefined });
216
+ }
207
217
 
208
218
  const lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
209
219
  await controller.setEditGood({ lineAmountExcludeTax });
@@ -273,9 +283,11 @@ export const updateUnitPriceExcludingTax = (controller: InvoiceController, form:
273
283
 
274
284
  // 税额 = 金额(含税)-金额(不含税)
275
285
  const taxAmount = evaluate(`${lineAmountIncludeTax} - ${lineAmountExcludeTax}`);
276
-
277
286
  form.setFieldsValue({ taxAmount });
278
287
  await controller.setEditGood({ taxAmount });
288
+ } else {
289
+ form.setFieldsValue({ taxAmount: null });
290
+ await controller.setEditGood({ taxAmount: null });
279
291
  }
280
292
 
281
293
  // 单价(不含税) = 单价(含税) / (1+税率)
@@ -316,11 +328,12 @@ export const updateUnitPriceTax = (
316
328
  await controller.setEditGood({ lineAmountIncludeTax });
317
329
 
318
330
  // 税额 = 金额(含税)-金额(不含税)
319
- const taxAmount = evaluate(
320
- `${lineAmountIncludeTax} - ${lineAmountExcludeTax}`,
321
- );
331
+ const taxAmount = evaluate(`${lineAmountIncludeTax} - ${lineAmountExcludeTax}`);
322
332
  form.setFieldsValue({ taxAmount });
323
333
  await controller.setEditGood({ taxAmount });
334
+ } else {
335
+ form.setFieldsValue({ taxAmount: undefined });
336
+ await controller.setEditGood({ taxAmount: undefined });
324
337
  }
325
338
 
326
339
  // 单价(含税) = 单价(不含税) * (1+税率)
@@ -48,9 +48,7 @@ const Main = decorator<IGoodsListProps, FormComponentProps & IGoodsListProps>(Fo
48
48
  React.useEffect(() => {
49
49
  controller.pipeline(async (s) => {
50
50
  s.goodsListState.goodsMap = new Map();
51
- goodsList.forEach((e) => {
52
- s.goodsListState.goodsMap.set(e.$index, e);
53
- });
51
+ goodsList.forEach((e) => { s.goodsListState.goodsMap.set(e.$index, e); });
54
52
  })();
55
53
  }, [goodsList, controller]);
56
54
 
@@ -23,6 +23,19 @@ export default () => {
23
23
  controller.pipeline(async s => { s.goodsListState.importGoods.isVisibleDrawer = false })();
24
24
  }, [controller]);
25
25
 
26
+ React.useEffect(() => {
27
+ setTimeout(() => {
28
+ console.log(window.document.querySelector('.ktsAnt3x-drawer'))
29
+ if (visible) {
30
+ window.document.querySelector('.ktsAnt3x-drawer')?.addEventListener('click', e => {
31
+ // debugger
32
+ // e.stopPropagation();
33
+ }, true)
34
+ } else {
35
+ }
36
+ });
37
+ }, [visible])
38
+
26
39
  return (
27
40
  <Drawer
28
41
  title="商品列表"
@@ -32,9 +45,10 @@ export default () => {
32
45
  width={983}
33
46
  onClose={onClose}
34
47
  visible={visible}
48
+ getContainer={() => window.document.querySelector('.kts-invoice-operate-goods-list-able') as any}
35
49
  >
36
50
  {topExpand &&
37
- <div style={{ marginBottom: 10 }} >
51
+ <div style={{ marginBottom: 10 }} >
38
52
  {topExpand}
39
53
  </div>}
40
54
  <DrawerBody />
@@ -51,6 +65,8 @@ const DrawerBody = () => {
51
65
 
52
66
  const pagination = controller.useMemo(s => s.goodsListState.importGoods.pagination, []);
53
67
 
68
+ const [editGood] = React.useState(controller.state.goodsListState.editGood);
69
+
54
70
  React.useEffect(() => {
55
71
  controller.getGoodsList &&
56
72
  controller.getGoodsList({ pagination: { current: 1 } });
@@ -70,11 +86,15 @@ const DrawerBody = () => {
70
86
  return {
71
87
  onClick: () => {
72
88
  controller.pipeline(
73
- async (s) => {
74
- debugger;
89
+ async s => {
90
+ if(s.goodsListState.editGood) return;
91
+ s.goodsListState.editGood = editGood;
92
+ },
93
+ async s => {
75
94
  Object.keys(record).filter(e => !record[e] && record[e] !== 0).forEach(e => { delete record[e] });
76
95
 
77
96
  if (await s.goodsListState.importGoods.verifyFn(record) === false) return;
97
+
78
98
  if (!s.goodsListState.editGood || !s.goodsListState.form) return;
79
99
 
80
100
  s.goodsListState.editGood = { ...s.goodsListState.editGood, ...record };
@@ -86,13 +106,13 @@ const DrawerBody = () => {
86
106
  } else {
87
107
  s.goodsListState.editGood.priceExcludeTax = getPriceExcludeTax(s.goodsListState.editGood, record) as number;
88
108
  }
89
-
109
+
90
110
  s.goodsListState.editGood.lineAmountIncludeTax = quantityPriceIncludeTax(s.goodsListState.editGood.quantity, s.goodsListState.editGood.priceIncludeTax);
91
111
  s.goodsListState.editGood.itemName = getItemName(record);
92
112
 
93
113
  s.goodsListState.form.setFieldsValue(s.goodsListState.editGood as any);
94
114
  s.goodsListState.importGoods.isVisibleDrawer = false;
95
-
115
+
96
116
  s.goodsListState.isTaxIncluded
97
117
  ? updateUnitPriceExcludingTax(controller, s.goodsListState.form, record)
98
118
  : updateUnitPriceTax(controller, s.goodsListState.form, record)