kts-component-invoice-operate 3.0.16 → 3.0.17

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.
@@ -18,7 +18,7 @@ export declare const onChangeLineAmountIncludeTax: (...par: any[]) => void;
18
18
  /** 金额(不含税) */
19
19
  export declare const onChangeLineAmountExcludeTax: (...par: any[]) => void;
20
20
  /** 税率 */
21
- export declare const onChangeTaxRate: (controller: InvoiceController, form: WrappedFormUtils, record: IGood) => void;
21
+ export declare const onChangeTaxRate: (...par: any[]) => void;
22
22
  /** 小规模纳税人 1% 和 3% 自动赋码免税 */
23
23
  export declare function dutyFree(controller: InvoiceController, taxRate: number, form: WrappedFormUtils<any>, record: IGood): number | undefined;
24
24
  /** 含税 => 更新(不含税) */
package/dist/index.esm.js CHANGED
@@ -8957,26 +8957,26 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
8957
8957
  }, 1000);
8958
8958
  /** 税率 */
8959
8959
 
8960
- var onChangeTaxRate = function onChangeTaxRate(controller, form, record) {
8960
+ var onChangeTaxRate = lazyFn(function (controller, form, record) {
8961
8961
  form.validateFields( /*#__PURE__*/function () {
8962
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(err, values) {
8962
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(err, values) {
8963
8963
  var taxRate;
8964
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
8964
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
8965
8965
  while (1) {
8966
- switch (_context11.prev = _context11.next) {
8966
+ switch (_context12.prev = _context12.next) {
8967
8967
  case 0:
8968
8968
  err = err || {};
8969
8969
 
8970
8970
  if (!(promptErr(err.taxRate) || !values.taxRate && values.taxRate !== 0)) {
8971
- _context11.next = 3;
8971
+ _context12.next = 3;
8972
8972
  break;
8973
8973
  }
8974
8974
 
8975
- return _context11.abrupt("return");
8975
+ return _context12.abrupt("return");
8976
8976
 
8977
8977
  case 3:
8978
8978
  taxRate = parseFloat(values.taxRate);
8979
- _context11.next = 6;
8979
+ _context12.next = 6;
8980
8980
  return controller.setEditGood({
8981
8981
  taxRate: taxRate
8982
8982
  });
@@ -9000,21 +9000,43 @@ var onChangeTaxRate = function onChangeTaxRate(controller, form, record) {
9000
9000
  updateUnitPriceExcludingTax(controller, form);
9001
9001
  } else {
9002
9002
  updateUnitPriceTax(controller, form);
9003
- }
9003
+ } // 清楚 计算中启动字段
9004
+
9005
+
9006
+ controller.run( /*#__PURE__*/function () {
9007
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(s) {
9008
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
9009
+ while (1) {
9010
+ switch (_context11.prev = _context11.next) {
9011
+ case 0:
9012
+ return _context11.abrupt("return", s.calculating = '');
9013
+
9014
+ case 1:
9015
+ case "end":
9016
+ return _context11.stop();
9017
+ }
9018
+ }
9019
+ }, _callee11);
9020
+ }));
9021
+
9022
+ return function (_x18) {
9023
+ return _ref12.apply(this, arguments);
9024
+ };
9025
+ }());
9004
9026
 
9005
- case 8:
9027
+ case 9:
9006
9028
  case "end":
9007
- return _context11.stop();
9029
+ return _context12.stop();
9008
9030
  }
9009
9031
  }
9010
- }, _callee11);
9032
+ }, _callee12);
9011
9033
  }));
9012
9034
 
9013
9035
  return function (_x16, _x17) {
9014
9036
  return _ref11.apply(this, arguments);
9015
9037
  };
9016
9038
  }());
9017
- };
9039
+ }, 1000);
9018
9040
  /** 小规模纳税人 1% 和 3% 自动赋码免税 */
9019
9041
 
9020
9042
  function dutyFree(controller, taxRate, form, record) {
@@ -9050,11 +9072,11 @@ function dutyFree(controller, taxRate, form, record) {
9050
9072
 
9051
9073
  var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controller, form, record) {
9052
9074
  form.validateFields( /*#__PURE__*/function () {
9053
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(err, values) {
9075
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(err, values) {
9054
9076
  var taxAmount, lineAmountExcludeTax, priceExcludeTax, deduction;
9055
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
9077
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
9056
9078
  while (1) {
9057
- switch (_context12.prev = _context12.next) {
9079
+ switch (_context13.prev = _context13.next) {
9058
9080
  case 0:
9059
9081
  err = err || {};
9060
9082
  /** 税额 */
@@ -9066,7 +9088,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9066
9088
  taxAmount = countTaxAmount(values.lineAmountIncludeTax, deduction, values.taxRate);
9067
9089
  }
9068
9090
 
9069
- _context12.next = 5;
9091
+ _context13.next = 5;
9070
9092
  return controller.setEditGood({
9071
9093
  taxAmount: taxAmount
9072
9094
  });
@@ -9080,7 +9102,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9080
9102
  form.setFieldsValue({
9081
9103
  lineAmountExcludeTax: lineAmountExcludeTax
9082
9104
  });
9083
- _context12.next = 9;
9105
+ _context13.next = 9;
9084
9106
  return controller.setEditGood({
9085
9107
  lineAmountExcludeTax: lineAmountExcludeTax
9086
9108
  });
@@ -9094,21 +9116,21 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9094
9116
  form.setFieldsValue({
9095
9117
  priceExcludeTax: priceExcludeTax
9096
9118
  });
9097
- _context12.next = 13;
9119
+ _context13.next = 13;
9098
9120
  return controller.setEditGood({
9099
9121
  priceExcludeTax: priceExcludeTax
9100
9122
  });
9101
9123
 
9102
9124
  case 13:
9103
9125
  case "end":
9104
- return _context12.stop();
9126
+ return _context13.stop();
9105
9127
  }
9106
9128
  }
9107
- }, _callee12);
9129
+ }, _callee13);
9108
9130
  }));
9109
9131
 
9110
- return function (_x18, _x19) {
9111
- return _ref12.apply(this, arguments);
9132
+ return function (_x19, _x20) {
9133
+ return _ref13.apply(this, arguments);
9112
9134
  };
9113
9135
  }());
9114
9136
  };
@@ -9116,35 +9138,35 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9116
9138
 
9117
9139
  var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
9118
9140
  form.validateFields( /*#__PURE__*/function () {
9119
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(err, values) {
9141
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(err, values) {
9120
9142
  var lineAmountExcludeTax, lineAmountIncludeTax, priceIncludeTax, taxAmount;
9121
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
9143
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
9122
9144
  while (1) {
9123
- switch (_context13.prev = _context13.next) {
9145
+ switch (_context14.prev = _context14.next) {
9124
9146
  case 0:
9125
9147
  err = err || {};
9126
9148
 
9127
9149
  if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !promptErr(err.lineAmountExcludeTax) && (values.lineAmountExcludeTax || values.lineAmountExcludeTax === 0))) {
9128
- _context13.next = 16;
9150
+ _context14.next = 16;
9129
9151
  break;
9130
9152
  }
9131
9153
 
9132
9154
  // 金额(含税)= 金额(不含税)* (1+ 税率)
9133
9155
  lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
9134
9156
  lineAmountIncludeTax = format2(evaluate("".concat(lineAmountExcludeTax, " * (1+(").concat(values.taxRate, "/100))")));
9135
- _context13.next = 6;
9157
+ _context14.next = 6;
9136
9158
  return controller.setEditGood({
9137
9159
  lineAmountIncludeTax: lineAmountIncludeTax
9138
9160
  });
9139
9161
 
9140
9162
  case 6:
9141
9163
  if (!(!err.quantity && values.quantity)) {
9142
- _context13.next = 10;
9164
+ _context14.next = 10;
9143
9165
  break;
9144
9166
  }
9145
9167
 
9146
9168
  priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)));
9147
- _context13.next = 10;
9169
+ _context14.next = 10;
9148
9170
  return controller.setEditGood({
9149
9171
  priceIncludeTax: priceIncludeTax
9150
9172
  });
@@ -9155,221 +9177,221 @@ var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
9155
9177
  form.setFieldsValue({
9156
9178
  taxAmount: taxAmount
9157
9179
  });
9158
- _context13.next = 14;
9180
+ _context14.next = 14;
9159
9181
  return controller.setEditGood({
9160
9182
  taxAmount: taxAmount
9161
9183
  });
9162
9184
 
9163
9185
  case 14:
9164
- _context13.next = 19;
9186
+ _context14.next = 19;
9165
9187
  break;
9166
9188
 
9167
9189
  case 16:
9168
9190
  form.setFieldsValue({
9169
9191
  taxAmount: undefined
9170
9192
  });
9171
- _context13.next = 19;
9193
+ _context14.next = 19;
9172
9194
  return controller.setEditGood({
9173
9195
  taxAmount: undefined
9174
9196
  });
9175
9197
 
9176
9198
  case 19:
9177
9199
  case "end":
9178
- return _context13.stop();
9200
+ return _context14.stop();
9179
9201
  }
9180
9202
  }
9181
- }, _callee13);
9203
+ }, _callee14);
9182
9204
  }));
9183
9205
 
9184
- return function (_x20, _x21) {
9185
- return _ref13.apply(this, arguments);
9206
+ return function (_x21, _x22) {
9207
+ return _ref14.apply(this, arguments);
9186
9208
  };
9187
9209
  }());
9188
9210
  };
9189
9211
  /** 单调赋码 */
9190
9212
 
9191
9213
  var endowCode = /*#__PURE__*/function () {
9192
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(controller, goods) {
9193
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
9214
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(controller, goods) {
9215
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
9194
9216
  while (1) {
9195
- switch (_context16.prev = _context16.next) {
9217
+ switch (_context17.prev = _context17.next) {
9196
9218
  case 0:
9197
- _context16.next = 2;
9219
+ _context17.next = 2;
9198
9220
  return controller.wait();
9199
9221
 
9200
9222
  case 2:
9201
- _context16.next = 4;
9223
+ _context17.next = 4;
9202
9224
  return controller.saveEditGood();
9203
9225
 
9204
9226
  case 4:
9205
- _context16.next = 6;
9227
+ _context17.next = 6;
9206
9228
  return controller.pipeline( /*#__PURE__*/function () {
9207
- var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
9229
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(s) {
9208
9230
  var err, key, g, i;
9209
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
9231
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
9210
9232
  while (1) {
9211
- switch (_context15.prev = _context15.next) {
9233
+ switch (_context16.prev = _context16.next) {
9212
9234
  case 0:
9213
9235
  if (!s.goodsListState.form) {
9214
- _context15.next = 11;
9236
+ _context16.next = 11;
9215
9237
  break;
9216
9238
  }
9217
9239
 
9218
9240
  err = s.goodsListState.form.getFieldsError();
9219
- _context15.t0 = _regeneratorRuntime().keys(err);
9241
+ _context16.t0 = _regeneratorRuntime().keys(err);
9220
9242
 
9221
9243
  case 3:
9222
- if ((_context15.t1 = _context15.t0()).done) {
9223
- _context15.next = 11;
9244
+ if ((_context16.t1 = _context16.t0()).done) {
9245
+ _context16.next = 11;
9224
9246
  break;
9225
9247
  }
9226
9248
 
9227
- key = _context15.t1.value;
9249
+ key = _context16.t1.value;
9228
9250
 
9229
9251
  if (err[key]) {
9230
- _context15.next = 7;
9252
+ _context16.next = 7;
9231
9253
  break;
9232
9254
  }
9233
9255
 
9234
- return _context15.abrupt("continue", 3);
9256
+ return _context16.abrupt("continue", 3);
9235
9257
 
9236
9258
  case 7:
9237
9259
  message.error(err[key][0]);
9238
- return _context15.abrupt("return");
9260
+ return _context16.abrupt("return");
9239
9261
 
9240
9262
  case 11:
9241
9263
  g = s.goodsListState.goodsMap.get(goods.$index);
9242
9264
  i = s.goodsListState.goodsList.indexOf(g);
9243
- _context15.t2 = goods.lineAttribute;
9244
- _context15.next = _context15.t2 === LineAttributeType$1.正常 ? 16 : _context15.t2 === LineAttributeType$1.折扣行 ? 18 : _context15.t2 === LineAttributeType$1.被折扣行 ? 20 : 22;
9265
+ _context16.t2 = goods.lineAttribute;
9266
+ _context16.next = _context16.t2 === LineAttributeType$1.正常 ? 16 : _context16.t2 === LineAttributeType$1.折扣行 ? 18 : _context16.t2 === LineAttributeType$1.被折扣行 ? 20 : 22;
9245
9267
  break;
9246
9268
 
9247
9269
  case 16:
9248
9270
  s.goodsListState.endowCode.endowcodeGoodIndex = [goods.$index];
9249
- return _context15.abrupt("break", 22);
9271
+ return _context16.abrupt("break", 22);
9250
9272
 
9251
9273
  case 18:
9252
9274
  s.goodsListState.endowCode.endowcodeGoodIndex = [goods.$index, s.goodsListState.goodsList[i - 1].$index];
9253
- return _context15.abrupt("break", 22);
9275
+ return _context16.abrupt("break", 22);
9254
9276
 
9255
9277
  case 20:
9256
9278
  s.goodsListState.endowCode.endowcodeGoodIndex = [goods.$index, s.goodsListState.goodsList[i + 1].$index];
9257
- return _context15.abrupt("break", 22);
9279
+ return _context16.abrupt("break", 22);
9258
9280
 
9259
9281
  case 22:
9260
9282
  case "end":
9261
- return _context15.stop();
9283
+ return _context16.stop();
9262
9284
  }
9263
9285
  }
9264
- }, _callee15);
9286
+ }, _callee16);
9265
9287
  }));
9266
9288
 
9267
- return function (_x26) {
9268
- return _ref16.apply(this, arguments);
9289
+ return function (_x27) {
9290
+ return _ref17.apply(this, arguments);
9269
9291
  };
9270
9292
  }())();
9271
9293
 
9272
9294
  case 6:
9273
9295
  case "end":
9274
- return _context16.stop();
9296
+ return _context17.stop();
9275
9297
  }
9276
9298
  }
9277
- }, _callee16);
9299
+ }, _callee17);
9278
9300
  }));
9279
9301
 
9280
- return function endowCode(_x24, _x25) {
9281
- return _ref15.apply(this, arguments);
9302
+ return function endowCode(_x25, _x26) {
9303
+ return _ref16.apply(this, arguments);
9282
9304
  };
9283
9305
  }();
9284
9306
  /** 修改了 货物名称 */
9285
9307
 
9286
9308
  var onChangeItemName = /*#__PURE__*/function () {
9287
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(controller, form, record) {
9288
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
9309
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(controller, form, record) {
9310
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
9289
9311
  while (1) {
9290
- switch (_context18.prev = _context18.next) {
9312
+ switch (_context19.prev = _context19.next) {
9291
9313
  case 0:
9292
9314
  controller.run( /*#__PURE__*/function () {
9293
- var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(s) {
9315
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(s) {
9294
9316
  var _getSN$shorthand, _getSN;
9295
9317
 
9296
9318
  var value, shorthand;
9297
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
9319
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
9298
9320
  while (1) {
9299
- switch (_context17.prev = _context17.next) {
9321
+ switch (_context18.prev = _context18.next) {
9300
9322
  case 0:
9301
9323
  value = form.getFieldsValue().itemName;
9302
9324
  shorthand = (_getSN$shorthand = (_getSN = getSN(value)) === null || _getSN === void 0 ? void 0 : _getSN.shorthand) !== null && _getSN$shorthand !== void 0 ? _getSN$shorthand : '';
9303
9325
 
9304
9326
  if (!s.goodsListState.isMyShow) {
9305
- _context17.next = 11;
9327
+ _context18.next = 11;
9306
9328
  break;
9307
9329
  }
9308
9330
 
9309
- _context17.next = 5;
9331
+ _context18.next = 5;
9310
9332
  return controller.setEditGood({
9311
9333
  itemNameSelf: value
9312
9334
  });
9313
9335
 
9314
9336
  case 5:
9315
- _context17.t0 = record.itemName;
9337
+ _context18.t0 = record.itemName;
9316
9338
 
9317
- if (!_context17.t0) {
9318
- _context17.next = 9;
9339
+ if (!_context18.t0) {
9340
+ _context18.next = 9;
9319
9341
  break;
9320
9342
  }
9321
9343
 
9322
- _context17.next = 9;
9344
+ _context18.next = 9;
9323
9345
  return controller.setEditGood({
9324
9346
  itemName: setShorthand(record.itemName, shorthand)
9325
9347
  });
9326
9348
 
9327
9349
  case 9:
9328
- _context17.next = 17;
9350
+ _context18.next = 17;
9329
9351
  break;
9330
9352
 
9331
9353
  case 11:
9332
- _context17.next = 13;
9354
+ _context18.next = 13;
9333
9355
  return controller.setEditGood({
9334
9356
  itemName: value
9335
9357
  });
9336
9358
 
9337
9359
  case 13:
9338
- _context17.t1 = record.itemNameSelf;
9360
+ _context18.t1 = record.itemNameSelf;
9339
9361
 
9340
- if (!_context17.t1) {
9341
- _context17.next = 17;
9362
+ if (!_context18.t1) {
9363
+ _context18.next = 17;
9342
9364
  break;
9343
9365
  }
9344
9366
 
9345
- _context17.next = 17;
9367
+ _context18.next = 17;
9346
9368
  return controller.setEditGood({
9347
9369
  itemNameSelf: setShorthand(record.itemNameSelf, shorthand)
9348
9370
  });
9349
9371
 
9350
9372
  case 17:
9351
9373
  case "end":
9352
- return _context17.stop();
9374
+ return _context18.stop();
9353
9375
  }
9354
9376
  }
9355
- }, _callee17);
9377
+ }, _callee18);
9356
9378
  }));
9357
9379
 
9358
- return function (_x30) {
9359
- return _ref18.apply(this, arguments);
9380
+ return function (_x31) {
9381
+ return _ref19.apply(this, arguments);
9360
9382
  };
9361
9383
  }());
9362
9384
 
9363
9385
  case 1:
9364
9386
  case "end":
9365
- return _context18.stop();
9387
+ return _context19.stop();
9366
9388
  }
9367
9389
  }
9368
- }, _callee18);
9390
+ }, _callee19);
9369
9391
  }));
9370
9392
 
9371
- return function onChangeItemName(_x27, _x28, _x29) {
9372
- return _ref17.apply(this, arguments);
9393
+ return function onChangeItemName(_x28, _x29, _x30) {
9394
+ return _ref18.apply(this, arguments);
9373
9395
  };
9374
9396
  }();
9375
9397
 
@@ -10279,7 +10301,8 @@ var useColumns = (function (form) {
10279
10301
  width: '100%'
10280
10302
  },
10281
10303
  onChange: function onChange() {
10282
- onChangeTaxRate(controller, form);
10304
+ setChangeField('taxRate');
10305
+ onChangeTaxRate(controller, form, record);
10283
10306
  }
10284
10307
  }, taxRateList.map(function (e, i) {
10285
10308
  return React.createElement(Select.Option, {
package/dist/index.js CHANGED
@@ -8967,26 +8967,26 @@ var onChangeLineAmountExcludeTax = lazyFn(function (controller, form, record) {
8967
8967
  }, 1000);
8968
8968
  /** 税率 */
8969
8969
 
8970
- var onChangeTaxRate = function onChangeTaxRate(controller, form, record) {
8970
+ var onChangeTaxRate = lazyFn(function (controller, form, record) {
8971
8971
  form.validateFields( /*#__PURE__*/function () {
8972
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(err, values) {
8972
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(err, values) {
8973
8973
  var taxRate;
8974
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
8974
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
8975
8975
  while (1) {
8976
- switch (_context11.prev = _context11.next) {
8976
+ switch (_context12.prev = _context12.next) {
8977
8977
  case 0:
8978
8978
  err = err || {};
8979
8979
 
8980
8980
  if (!(promptErr(err.taxRate) || !values.taxRate && values.taxRate !== 0)) {
8981
- _context11.next = 3;
8981
+ _context12.next = 3;
8982
8982
  break;
8983
8983
  }
8984
8984
 
8985
- return _context11.abrupt("return");
8985
+ return _context12.abrupt("return");
8986
8986
 
8987
8987
  case 3:
8988
8988
  taxRate = parseFloat(values.taxRate);
8989
- _context11.next = 6;
8989
+ _context12.next = 6;
8990
8990
  return controller.setEditGood({
8991
8991
  taxRate: taxRate
8992
8992
  });
@@ -9010,21 +9010,43 @@ var onChangeTaxRate = function onChangeTaxRate(controller, form, record) {
9010
9010
  updateUnitPriceExcludingTax(controller, form);
9011
9011
  } else {
9012
9012
  updateUnitPriceTax(controller, form);
9013
- }
9013
+ } // 清楚 计算中启动字段
9014
+
9015
+
9016
+ controller.run( /*#__PURE__*/function () {
9017
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(s) {
9018
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
9019
+ while (1) {
9020
+ switch (_context11.prev = _context11.next) {
9021
+ case 0:
9022
+ return _context11.abrupt("return", s.calculating = '');
9023
+
9024
+ case 1:
9025
+ case "end":
9026
+ return _context11.stop();
9027
+ }
9028
+ }
9029
+ }, _callee11);
9030
+ }));
9031
+
9032
+ return function (_x18) {
9033
+ return _ref12.apply(this, arguments);
9034
+ };
9035
+ }());
9014
9036
 
9015
- case 8:
9037
+ case 9:
9016
9038
  case "end":
9017
- return _context11.stop();
9039
+ return _context12.stop();
9018
9040
  }
9019
9041
  }
9020
- }, _callee11);
9042
+ }, _callee12);
9021
9043
  }));
9022
9044
 
9023
9045
  return function (_x16, _x17) {
9024
9046
  return _ref11.apply(this, arguments);
9025
9047
  };
9026
9048
  }());
9027
- };
9049
+ }, 1000);
9028
9050
  /** 小规模纳税人 1% 和 3% 自动赋码免税 */
9029
9051
 
9030
9052
  function dutyFree(controller, taxRate, form, record) {
@@ -9060,11 +9082,11 @@ function dutyFree(controller, taxRate, form, record) {
9060
9082
 
9061
9083
  var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controller, form, record) {
9062
9084
  form.validateFields( /*#__PURE__*/function () {
9063
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(err, values) {
9085
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(err, values) {
9064
9086
  var taxAmount, lineAmountExcludeTax, priceExcludeTax, deduction;
9065
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
9087
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
9066
9088
  while (1) {
9067
- switch (_context12.prev = _context12.next) {
9089
+ switch (_context13.prev = _context13.next) {
9068
9090
  case 0:
9069
9091
  err = err || {};
9070
9092
  /** 税额 */
@@ -9076,7 +9098,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9076
9098
  taxAmount = countTaxAmount(values.lineAmountIncludeTax, deduction, values.taxRate);
9077
9099
  }
9078
9100
 
9079
- _context12.next = 5;
9101
+ _context13.next = 5;
9080
9102
  return controller.setEditGood({
9081
9103
  taxAmount: taxAmount
9082
9104
  });
@@ -9090,7 +9112,7 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9090
9112
  form.setFieldsValue({
9091
9113
  lineAmountExcludeTax: lineAmountExcludeTax
9092
9114
  });
9093
- _context12.next = 9;
9115
+ _context13.next = 9;
9094
9116
  return controller.setEditGood({
9095
9117
  lineAmountExcludeTax: lineAmountExcludeTax
9096
9118
  });
@@ -9104,21 +9126,21 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9104
9126
  form.setFieldsValue({
9105
9127
  priceExcludeTax: priceExcludeTax
9106
9128
  });
9107
- _context12.next = 13;
9129
+ _context13.next = 13;
9108
9130
  return controller.setEditGood({
9109
9131
  priceExcludeTax: priceExcludeTax
9110
9132
  });
9111
9133
 
9112
9134
  case 13:
9113
9135
  case "end":
9114
- return _context12.stop();
9136
+ return _context13.stop();
9115
9137
  }
9116
9138
  }
9117
- }, _callee12);
9139
+ }, _callee13);
9118
9140
  }));
9119
9141
 
9120
- return function (_x18, _x19) {
9121
- return _ref12.apply(this, arguments);
9142
+ return function (_x19, _x20) {
9143
+ return _ref13.apply(this, arguments);
9122
9144
  };
9123
9145
  }());
9124
9146
  };
@@ -9126,35 +9148,35 @@ var updateUnitPriceExcludingTax = function updateUnitPriceExcludingTax(controlle
9126
9148
 
9127
9149
  var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
9128
9150
  form.validateFields( /*#__PURE__*/function () {
9129
- var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(err, values) {
9151
+ var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(err, values) {
9130
9152
  var lineAmountExcludeTax, lineAmountIncludeTax, priceIncludeTax, taxAmount;
9131
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
9153
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
9132
9154
  while (1) {
9133
- switch (_context13.prev = _context13.next) {
9155
+ switch (_context14.prev = _context14.next) {
9134
9156
  case 0:
9135
9157
  err = err || {};
9136
9158
 
9137
9159
  if (!(!err.taxRat && (values.taxRate || values.taxRate === 0) && !promptErr(err.lineAmountExcludeTax) && (values.lineAmountExcludeTax || values.lineAmountExcludeTax === 0))) {
9138
- _context13.next = 16;
9160
+ _context14.next = 16;
9139
9161
  break;
9140
9162
  }
9141
9163
 
9142
9164
  // 金额(含税)= 金额(不含税)* (1+ 税率)
9143
9165
  lineAmountExcludeTax = format2(values.lineAmountExcludeTax);
9144
9166
  lineAmountIncludeTax = format2(evaluate("".concat(lineAmountExcludeTax, " * (1+(").concat(values.taxRate, "/100))")));
9145
- _context13.next = 6;
9167
+ _context14.next = 6;
9146
9168
  return controller.setEditGood({
9147
9169
  lineAmountIncludeTax: lineAmountIncludeTax
9148
9170
  });
9149
9171
 
9150
9172
  case 6:
9151
9173
  if (!(!err.quantity && values.quantity)) {
9152
- _context13.next = 10;
9174
+ _context14.next = 10;
9153
9175
  break;
9154
9176
  }
9155
9177
 
9156
9178
  priceIncludeTax = format15(evaluate("".concat(lineAmountIncludeTax, " / ").concat(values.quantity)));
9157
- _context13.next = 10;
9179
+ _context14.next = 10;
9158
9180
  return controller.setEditGood({
9159
9181
  priceIncludeTax: priceIncludeTax
9160
9182
  });
@@ -9165,221 +9187,221 @@ var updateUnitPriceTax = function updateUnitPriceTax(controller, form, record) {
9165
9187
  form.setFieldsValue({
9166
9188
  taxAmount: taxAmount
9167
9189
  });
9168
- _context13.next = 14;
9190
+ _context14.next = 14;
9169
9191
  return controller.setEditGood({
9170
9192
  taxAmount: taxAmount
9171
9193
  });
9172
9194
 
9173
9195
  case 14:
9174
- _context13.next = 19;
9196
+ _context14.next = 19;
9175
9197
  break;
9176
9198
 
9177
9199
  case 16:
9178
9200
  form.setFieldsValue({
9179
9201
  taxAmount: undefined
9180
9202
  });
9181
- _context13.next = 19;
9203
+ _context14.next = 19;
9182
9204
  return controller.setEditGood({
9183
9205
  taxAmount: undefined
9184
9206
  });
9185
9207
 
9186
9208
  case 19:
9187
9209
  case "end":
9188
- return _context13.stop();
9210
+ return _context14.stop();
9189
9211
  }
9190
9212
  }
9191
- }, _callee13);
9213
+ }, _callee14);
9192
9214
  }));
9193
9215
 
9194
- return function (_x20, _x21) {
9195
- return _ref13.apply(this, arguments);
9216
+ return function (_x21, _x22) {
9217
+ return _ref14.apply(this, arguments);
9196
9218
  };
9197
9219
  }());
9198
9220
  };
9199
9221
  /** 单调赋码 */
9200
9222
 
9201
9223
  var endowCode = /*#__PURE__*/function () {
9202
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(controller, goods) {
9203
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
9224
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(controller, goods) {
9225
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
9204
9226
  while (1) {
9205
- switch (_context16.prev = _context16.next) {
9227
+ switch (_context17.prev = _context17.next) {
9206
9228
  case 0:
9207
- _context16.next = 2;
9229
+ _context17.next = 2;
9208
9230
  return controller.wait();
9209
9231
 
9210
9232
  case 2:
9211
- _context16.next = 4;
9233
+ _context17.next = 4;
9212
9234
  return controller.saveEditGood();
9213
9235
 
9214
9236
  case 4:
9215
- _context16.next = 6;
9237
+ _context17.next = 6;
9216
9238
  return controller.pipeline( /*#__PURE__*/function () {
9217
- var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(s) {
9239
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(s) {
9218
9240
  var err, key, g, i;
9219
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
9241
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
9220
9242
  while (1) {
9221
- switch (_context15.prev = _context15.next) {
9243
+ switch (_context16.prev = _context16.next) {
9222
9244
  case 0:
9223
9245
  if (!s.goodsListState.form) {
9224
- _context15.next = 11;
9246
+ _context16.next = 11;
9225
9247
  break;
9226
9248
  }
9227
9249
 
9228
9250
  err = s.goodsListState.form.getFieldsError();
9229
- _context15.t0 = _regeneratorRuntime().keys(err);
9251
+ _context16.t0 = _regeneratorRuntime().keys(err);
9230
9252
 
9231
9253
  case 3:
9232
- if ((_context15.t1 = _context15.t0()).done) {
9233
- _context15.next = 11;
9254
+ if ((_context16.t1 = _context16.t0()).done) {
9255
+ _context16.next = 11;
9234
9256
  break;
9235
9257
  }
9236
9258
 
9237
- key = _context15.t1.value;
9259
+ key = _context16.t1.value;
9238
9260
 
9239
9261
  if (err[key]) {
9240
- _context15.next = 7;
9262
+ _context16.next = 7;
9241
9263
  break;
9242
9264
  }
9243
9265
 
9244
- return _context15.abrupt("continue", 3);
9266
+ return _context16.abrupt("continue", 3);
9245
9267
 
9246
9268
  case 7:
9247
9269
  ktsComponentsAntdX3.message.error(err[key][0]);
9248
- return _context15.abrupt("return");
9270
+ return _context16.abrupt("return");
9249
9271
 
9250
9272
  case 11:
9251
9273
  g = s.goodsListState.goodsMap.get(goods.$index);
9252
9274
  i = s.goodsListState.goodsList.indexOf(g);
9253
- _context15.t2 = goods.lineAttribute;
9254
- _context15.next = _context15.t2 === LineAttributeType$1.正常 ? 16 : _context15.t2 === LineAttributeType$1.折扣行 ? 18 : _context15.t2 === LineAttributeType$1.被折扣行 ? 20 : 22;
9275
+ _context16.t2 = goods.lineAttribute;
9276
+ _context16.next = _context16.t2 === LineAttributeType$1.正常 ? 16 : _context16.t2 === LineAttributeType$1.折扣行 ? 18 : _context16.t2 === LineAttributeType$1.被折扣行 ? 20 : 22;
9255
9277
  break;
9256
9278
 
9257
9279
  case 16:
9258
9280
  s.goodsListState.endowCode.endowcodeGoodIndex = [goods.$index];
9259
- return _context15.abrupt("break", 22);
9281
+ return _context16.abrupt("break", 22);
9260
9282
 
9261
9283
  case 18:
9262
9284
  s.goodsListState.endowCode.endowcodeGoodIndex = [goods.$index, s.goodsListState.goodsList[i - 1].$index];
9263
- return _context15.abrupt("break", 22);
9285
+ return _context16.abrupt("break", 22);
9264
9286
 
9265
9287
  case 20:
9266
9288
  s.goodsListState.endowCode.endowcodeGoodIndex = [goods.$index, s.goodsListState.goodsList[i + 1].$index];
9267
- return _context15.abrupt("break", 22);
9289
+ return _context16.abrupt("break", 22);
9268
9290
 
9269
9291
  case 22:
9270
9292
  case "end":
9271
- return _context15.stop();
9293
+ return _context16.stop();
9272
9294
  }
9273
9295
  }
9274
- }, _callee15);
9296
+ }, _callee16);
9275
9297
  }));
9276
9298
 
9277
- return function (_x26) {
9278
- return _ref16.apply(this, arguments);
9299
+ return function (_x27) {
9300
+ return _ref17.apply(this, arguments);
9279
9301
  };
9280
9302
  }())();
9281
9303
 
9282
9304
  case 6:
9283
9305
  case "end":
9284
- return _context16.stop();
9306
+ return _context17.stop();
9285
9307
  }
9286
9308
  }
9287
- }, _callee16);
9309
+ }, _callee17);
9288
9310
  }));
9289
9311
 
9290
- return function endowCode(_x24, _x25) {
9291
- return _ref15.apply(this, arguments);
9312
+ return function endowCode(_x25, _x26) {
9313
+ return _ref16.apply(this, arguments);
9292
9314
  };
9293
9315
  }();
9294
9316
  /** 修改了 货物名称 */
9295
9317
 
9296
9318
  var onChangeItemName = /*#__PURE__*/function () {
9297
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(controller, form, record) {
9298
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
9319
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(controller, form, record) {
9320
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
9299
9321
  while (1) {
9300
- switch (_context18.prev = _context18.next) {
9322
+ switch (_context19.prev = _context19.next) {
9301
9323
  case 0:
9302
9324
  controller.run( /*#__PURE__*/function () {
9303
- var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(s) {
9325
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(s) {
9304
9326
  var _getSN$shorthand, _getSN;
9305
9327
 
9306
9328
  var value, shorthand;
9307
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
9329
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
9308
9330
  while (1) {
9309
- switch (_context17.prev = _context17.next) {
9331
+ switch (_context18.prev = _context18.next) {
9310
9332
  case 0:
9311
9333
  value = form.getFieldsValue().itemName;
9312
9334
  shorthand = (_getSN$shorthand = (_getSN = getSN(value)) === null || _getSN === void 0 ? void 0 : _getSN.shorthand) !== null && _getSN$shorthand !== void 0 ? _getSN$shorthand : '';
9313
9335
 
9314
9336
  if (!s.goodsListState.isMyShow) {
9315
- _context17.next = 11;
9337
+ _context18.next = 11;
9316
9338
  break;
9317
9339
  }
9318
9340
 
9319
- _context17.next = 5;
9341
+ _context18.next = 5;
9320
9342
  return controller.setEditGood({
9321
9343
  itemNameSelf: value
9322
9344
  });
9323
9345
 
9324
9346
  case 5:
9325
- _context17.t0 = record.itemName;
9347
+ _context18.t0 = record.itemName;
9326
9348
 
9327
- if (!_context17.t0) {
9328
- _context17.next = 9;
9349
+ if (!_context18.t0) {
9350
+ _context18.next = 9;
9329
9351
  break;
9330
9352
  }
9331
9353
 
9332
- _context17.next = 9;
9354
+ _context18.next = 9;
9333
9355
  return controller.setEditGood({
9334
9356
  itemName: setShorthand(record.itemName, shorthand)
9335
9357
  });
9336
9358
 
9337
9359
  case 9:
9338
- _context17.next = 17;
9360
+ _context18.next = 17;
9339
9361
  break;
9340
9362
 
9341
9363
  case 11:
9342
- _context17.next = 13;
9364
+ _context18.next = 13;
9343
9365
  return controller.setEditGood({
9344
9366
  itemName: value
9345
9367
  });
9346
9368
 
9347
9369
  case 13:
9348
- _context17.t1 = record.itemNameSelf;
9370
+ _context18.t1 = record.itemNameSelf;
9349
9371
 
9350
- if (!_context17.t1) {
9351
- _context17.next = 17;
9372
+ if (!_context18.t1) {
9373
+ _context18.next = 17;
9352
9374
  break;
9353
9375
  }
9354
9376
 
9355
- _context17.next = 17;
9377
+ _context18.next = 17;
9356
9378
  return controller.setEditGood({
9357
9379
  itemNameSelf: setShorthand(record.itemNameSelf, shorthand)
9358
9380
  });
9359
9381
 
9360
9382
  case 17:
9361
9383
  case "end":
9362
- return _context17.stop();
9384
+ return _context18.stop();
9363
9385
  }
9364
9386
  }
9365
- }, _callee17);
9387
+ }, _callee18);
9366
9388
  }));
9367
9389
 
9368
- return function (_x30) {
9369
- return _ref18.apply(this, arguments);
9390
+ return function (_x31) {
9391
+ return _ref19.apply(this, arguments);
9370
9392
  };
9371
9393
  }());
9372
9394
 
9373
9395
  case 1:
9374
9396
  case "end":
9375
- return _context18.stop();
9397
+ return _context19.stop();
9376
9398
  }
9377
9399
  }
9378
- }, _callee18);
9400
+ }, _callee19);
9379
9401
  }));
9380
9402
 
9381
- return function onChangeItemName(_x27, _x28, _x29) {
9382
- return _ref17.apply(this, arguments);
9403
+ return function onChangeItemName(_x28, _x29, _x30) {
9404
+ return _ref18.apply(this, arguments);
9383
9405
  };
9384
9406
  }();
9385
9407
 
@@ -10289,7 +10311,8 @@ var useColumns = (function (form) {
10289
10311
  width: '100%'
10290
10312
  },
10291
10313
  onChange: function onChange() {
10292
- onChangeTaxRate(controller, form);
10314
+ setChangeField('taxRate');
10315
+ onChangeTaxRate(controller, form, record);
10293
10316
  }
10294
10317
  }, taxRateList.map(function (e, i) {
10295
10318
  return React__default['default'].createElement(ktsComponentsAntdX3.Select.Option, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.0.16",
3
+ "version": "3.0.17",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -269,35 +269,41 @@ export const onChangeLineAmountExcludeTax = lazyFn(
269
269
  );
270
270
 
271
271
  /** 税率 */
272
- export const onChangeTaxRate = (controller: InvoiceController, form: WrappedFormUtils, record: IGood) => {
272
+ export const onChangeTaxRate = lazyFn(
273
+ (controller: InvoiceController, form: WrappedFormUtils, record: IGood) => {
273
274
 
274
- form.validateFields(async (err, values) => {
275
- err = err || {};
276
- if (promptErr(err.taxRate) || (!values.taxRate && values.taxRate !== 0)) return;
277
-
278
- let taxRate = parseFloat(values.taxRate);
279
- await controller.setEditGood({ taxRate });
280
-
281
- // 去掉赋码
282
- (() => {
283
- const cache = controller.state.goodsListState.endowCode.cache;
284
- const record = controller.state.goodsListState.editGood;
285
- if (record && cache[record.$index]) {
286
- record.favouredPolicyName = cache[record.$index].favouredPolicyName;
287
- record.favouredPolicyMark = cache[record.$index].favouredPolicyMark;
288
- record.taxFreeType = cache[record.$index].taxFreeType;
289
- cache[record.$index] = undefined;
275
+ form.validateFields(async (err, values) => {
276
+ err = err || {};
277
+ if (promptErr(err.taxRate) || (!values.taxRate && values.taxRate !== 0)) return;
278
+
279
+ let taxRate = parseFloat(values.taxRate);
280
+ await controller.setEditGood({ taxRate });
281
+
282
+ // 去掉赋码
283
+ (() => {
284
+ const cache = controller.state.goodsListState.endowCode.cache;
285
+ const record = controller.state.goodsListState.editGood;
286
+ if (record && cache[record.$index]) {
287
+ record.favouredPolicyName = cache[record.$index].favouredPolicyName;
288
+ record.favouredPolicyMark = cache[record.$index].favouredPolicyMark;
289
+ record.taxFreeType = cache[record.$index].taxFreeType;
290
+ cache[record.$index] = undefined;
291
+ }
292
+ })()
293
+
294
+ // 是否含税
295
+ if (controller.state.goodsListState.isTaxIncluded) {
296
+ updateUnitPriceExcludingTax(controller, form, record);
297
+ } else {
298
+ updateUnitPriceTax(controller, form, record);
290
299
  }
291
- })()
292
300
 
293
- // 是否含税
294
- if (controller.state.goodsListState.isTaxIncluded) {
295
- updateUnitPriceExcludingTax(controller, form, record);
296
- } else {
297
- updateUnitPriceTax(controller, form, record);
298
- }
299
- });
300
- }
301
+ // 清楚 计算中启动字段
302
+ controller.run(async s => s.calculating = '')
303
+ });
304
+ },
305
+ 1000,
306
+ );
301
307
 
302
308
  /** 小规模纳税人 1% 和 3% 自动赋码免税 */
303
309
  export function dutyFree(controller: InvoiceController, taxRate: number, form: WrappedFormUtils<any>, record: IGood) {
@@ -434,6 +434,7 @@ export default (form: WrappedFormUtils) => {
434
434
  showArrow={false}
435
435
  style={{ width: '100%' }}
436
436
  onChange={() => {
437
+ setChangeField('taxRate');
437
438
  onChangeTaxRate(controller, form, record);
438
439
  }}
439
440
  >