kts-component-invoice-operate 3.2.29 → 3.2.30

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.
@@ -8,5 +8,5 @@ export default class AutoComplete {
8
8
  /** 统一社会信用代码/纳税人识别号 */
9
9
  onBuyerTaxIdSearch?: (searchText: string) => Promise<any[]>;
10
10
  /** 商品编码自动补全 */
11
- onItemCodeSearch?: (searchText: string) => Promise<any[]>;
11
+ onItemCodeSearch?: (searchText: string, itemName: any) => Promise<any[]>;
12
12
  }
@@ -3,5 +3,5 @@ import './index.less';
3
3
  export default function ItemCodeInput(props: {
4
4
  onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
5
5
  value?: string;
6
- shorthand?: string;
6
+ record: any;
7
7
  }): JSX.Element;
package/dist/index.esm.js CHANGED
@@ -10591,6 +10591,7 @@ function ItemNameInput(props) {
10591
10591
  }
10592
10592
  }, "*", props.shorthand, "*"), React.createElement(AutoComplete$1, {
10593
10593
  onSearch: onSearch,
10594
+ defaultValue: props.value,
10594
10595
  options: options.map(function (e) {
10595
10596
  return {
10596
10597
  value: e.itemName
@@ -10643,6 +10644,8 @@ function ItemCodeInput(props) {
10643
10644
  }, []);
10644
10645
  var onSearch = React.useCallback( /*#__PURE__*/function () {
10645
10646
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(searchText) {
10647
+ var _props$record;
10648
+
10646
10649
  return _regeneratorRuntime().wrap(function _callee$(_context) {
10647
10650
  while (1) {
10648
10651
  switch (_context.prev = _context.next) {
@@ -10656,7 +10659,7 @@ function ItemCodeInput(props) {
10656
10659
 
10657
10660
  _context.t0 = setOptions;
10658
10661
  _context.next = 5;
10659
- return autoComplete.onItemCodeSearch(searchText);
10662
+ return autoComplete.onItemCodeSearch(searchText, (_props$record = props.record) === null || _props$record === void 0 ? void 0 : _props$record.itemName);
10660
10663
 
10661
10664
  case 5:
10662
10665
  _context.t1 = _context.sent;
@@ -10686,7 +10689,7 @@ function ItemCodeInput(props) {
10686
10689
  }(), [autoComplete.onItemCodeSearch]);
10687
10690
  var onChangeAutoComplete = React.useCallback( /*#__PURE__*/function () {
10688
10691
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(itemName) {
10689
- var record;
10692
+ var record, option;
10690
10693
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10691
10694
  while (1) {
10692
10695
  switch (_context2.prev = _context2.next) {
@@ -10703,12 +10706,20 @@ function ItemCodeInput(props) {
10703
10706
  return _context2.abrupt("return");
10704
10707
 
10705
10708
  case 3:
10706
- _context2.next = 5;
10707
- return controller.setEditGood({
10708
- itemCode: record.itemCode
10709
- });
10709
+ option = {
10710
+ itemCode: record.itemCode,
10711
+ itemName: record.itemName,
10712
+ taxCategoryCode: record.taxCategoryCode,
10713
+ shorthand: record.shorthand,
10714
+ specification: record.specification,
10715
+ unit: record.unit,
10716
+ lineAmountIncludeTax: record.lineAmountIncludeTax,
10717
+ taxRate: record.taxRate
10718
+ };
10719
+ _context2.next = 6;
10720
+ return controller.setEditGood(option);
10710
10721
 
10711
- case 5:
10722
+ case 6:
10712
10723
  case "end":
10713
10724
  return _context2.stop();
10714
10725
  }
@@ -10722,13 +10733,9 @@ function ItemCodeInput(props) {
10722
10733
  }(), [options, controller]);
10723
10734
  return React.createElement("div", {
10724
10735
  className: 'kts-invoice-operate-goods-list-itemCode-input'
10725
- }, props.shorthand && React.createElement("span", {
10726
- style: {
10727
- alignSelf: 'center',
10728
- fontSize: 12
10729
- }
10730
- }, "*", props.shorthand, "*"), React.createElement(AutoComplete$1, {
10736
+ }, React.createElement(AutoComplete$1, {
10731
10737
  onSearch: onSearch,
10738
+ defaultValue: props.value,
10732
10739
  options: options.map(function (e) {
10733
10740
  return {
10734
10741
  value: e.itemCode
@@ -10907,10 +10914,34 @@ var useColumns = (function (form) {
10907
10914
  return React.createElement(Form.Item, null, getFieldDecorator('itemCode', {
10908
10915
  initialValue: editGood.itemCode
10909
10916
  })(React.createElement(ItemCodeInput, {
10910
- shorthand: editGood.shorthand,
10911
- onChange: function onChange() {
10912
- onChangeItemCode(controller, form, record);
10913
- }
10917
+ record: record,
10918
+ onChange: function () {
10919
+ var _onChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
10920
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10921
+ while (1) {
10922
+ switch (_context2.prev = _context2.next) {
10923
+ case 0:
10924
+ _context2.next = 2;
10925
+ return onChangeItemCode(controller, form, record);
10926
+
10927
+ case 2:
10928
+ _context2.next = 4;
10929
+ return onChangeLineAmountIncludeTax(controller, form, record);
10930
+
10931
+ case 4:
10932
+ case "end":
10933
+ return _context2.stop();
10934
+ }
10935
+ }
10936
+ }, _callee2);
10937
+ }));
10938
+
10939
+ function onChange() {
10940
+ return _onChange.apply(this, arguments);
10941
+ }
10942
+
10943
+ return onChange;
10944
+ }()
10914
10945
  })));
10915
10946
  } else {
10916
10947
  return record.itemCode;
@@ -10928,39 +10959,39 @@ var useColumns = (function (form) {
10928
10959
  display: 'flex'
10929
10960
  }
10930
10961
  }, getFieldDecorator('itemName', {
10931
- initialValue: isMyShow ? record.itemNameSelf : record.itemName,
10962
+ initialValue: record.itemName,
10932
10963
  rules: [].concat(_toConsumableArray(getReplenishRules('itemName')), [{
10933
10964
  validator: function () {
10934
- var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_, __, callback) {
10965
+ var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_, __, callback) {
10935
10966
  var value;
10936
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10967
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
10937
10968
  while (1) {
10938
- switch (_context2.prev = _context2.next) {
10969
+ switch (_context3.prev = _context3.next) {
10939
10970
  case 0:
10940
- _context2.next = 2;
10971
+ _context3.next = 2;
10941
10972
  return controller.wait();
10942
10973
 
10943
10974
  case 2:
10944
10975
  value = controller.state.goodsListState.editGood;
10945
10976
 
10946
10977
  if (!(!(value === null || value === void 0 ? void 0 : value.itemName) && !(value === null || value === void 0 ? void 0 : value.itemNameSelf))) {
10947
- _context2.next = 7;
10978
+ _context3.next = 7;
10948
10979
  break;
10949
10980
  }
10950
10981
 
10951
10982
  callback('项目名称不能为空');
10952
- _context2.next = 8;
10983
+ _context3.next = 8;
10953
10984
  break;
10954
10985
 
10955
10986
  case 7:
10956
- return _context2.abrupt("return");
10987
+ return _context3.abrupt("return");
10957
10988
 
10958
10989
  case 8:
10959
10990
  case "end":
10960
- return _context2.stop();
10991
+ return _context3.stop();
10961
10992
  }
10962
10993
  }
10963
- }, _callee2);
10994
+ }, _callee3);
10964
10995
  }));
10965
10996
 
10966
10997
  function validator(_x2, _x3, _x4) {
@@ -10981,19 +11012,19 @@ var useColumns = (function (form) {
10981
11012
  title: "\u70B9\u51FB\u4ECE\u5546\u54C1\u7BA1\u7406\u4E2D\u6DFB\u52A0\u5546\u54C1\u4FE1\u606F"
10982
11013
  }, React.createElement(Button, {
10983
11014
  onClick: controller.pipeline( /*#__PURE__*/function () {
10984
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
10985
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
11015
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(s) {
11016
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
10986
11017
  while (1) {
10987
- switch (_context3.prev = _context3.next) {
11018
+ switch (_context4.prev = _context4.next) {
10988
11019
  case 0:
10989
11020
  s.goodsListState.importGoods.isVisibleDrawer = true;
10990
11021
 
10991
11022
  case 1:
10992
11023
  case "end":
10993
- return _context3.stop();
11024
+ return _context4.stop();
10994
11025
  }
10995
11026
  }
10996
- }, _callee3);
11027
+ }, _callee4);
10997
11028
  }));
10998
11029
 
10999
11030
  return function (_x5) {
@@ -11030,13 +11061,13 @@ var useColumns = (function (form) {
11030
11061
  rules: getReplenishRules('itemModelName')
11031
11062
  })(React.createElement(MyInput, {
11032
11063
  onChange: function () {
11033
- var _onChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
11064
+ var _onChange2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
11034
11065
  var key, value;
11035
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
11066
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
11036
11067
  while (1) {
11037
- switch (_context4.prev = _context4.next) {
11068
+ switch (_context5.prev = _context5.next) {
11038
11069
  case 0:
11039
- _context4.next = 2;
11070
+ _context5.next = 2;
11040
11071
  return controller.wait();
11041
11072
 
11042
11073
  case 2:
@@ -11047,14 +11078,14 @@ var useColumns = (function (form) {
11047
11078
 
11048
11079
  case 6:
11049
11080
  case "end":
11050
- return _context4.stop();
11081
+ return _context5.stop();
11051
11082
  }
11052
11083
  }
11053
- }, _callee4);
11084
+ }, _callee5);
11054
11085
  }));
11055
11086
 
11056
11087
  function onChange() {
11057
- return _onChange.apply(this, arguments);
11088
+ return _onChange2.apply(this, arguments);
11058
11089
  }
11059
11090
 
11060
11091
  return onChange;
@@ -11085,12 +11116,12 @@ var useColumns = (function (form) {
11085
11116
  },
11086
11117
  dataSource: unitList,
11087
11118
  onChange: function () {
11088
- var _onChange2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
11089
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
11119
+ var _onChange3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
11120
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
11090
11121
  while (1) {
11091
- switch (_context5.prev = _context5.next) {
11122
+ switch (_context6.prev = _context6.next) {
11092
11123
  case 0:
11093
- _context5.next = 2;
11124
+ _context6.next = 2;
11094
11125
  return controller.wait();
11095
11126
 
11096
11127
  case 2:
@@ -11103,14 +11134,14 @@ var useColumns = (function (form) {
11103
11134
 
11104
11135
  case 3:
11105
11136
  case "end":
11106
- return _context5.stop();
11137
+ return _context6.stop();
11107
11138
  }
11108
11139
  }
11109
- }, _callee5);
11140
+ }, _callee6);
11110
11141
  }));
11111
11142
 
11112
11143
  function onChange() {
11113
- return _onChange2.apply(this, arguments);
11144
+ return _onChange3.apply(this, arguments);
11114
11145
  }
11115
11146
 
11116
11147
  return onChange;
@@ -11142,13 +11173,13 @@ var useColumns = (function (form) {
11142
11173
  message: '数量必须为数字'
11143
11174
  }, {
11144
11175
  validator: function () {
11145
- var _validator2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_, value, callback) {
11176
+ var _validator2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_, value, callback) {
11146
11177
  var isvalue, isPrice;
11147
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
11178
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
11148
11179
  while (1) {
11149
- switch (_context6.prev = _context6.next) {
11180
+ switch (_context7.prev = _context7.next) {
11150
11181
  case 0:
11151
- _context6.next = 2;
11182
+ _context7.next = 2;
11152
11183
  return controller.wait();
11153
11184
 
11154
11185
  case 2:
@@ -11156,21 +11187,21 @@ var useColumns = (function (form) {
11156
11187
  isPrice = !!getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') || getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') === 0;
11157
11188
 
11158
11189
  if (!(isvalue || isPrice === isvalue)) {
11159
- _context6.next = 6;
11190
+ _context7.next = 6;
11160
11191
  break;
11161
11192
  }
11162
11193
 
11163
- return _context6.abrupt("return");
11194
+ return _context7.abrupt("return");
11164
11195
 
11165
11196
  case 6:
11166
11197
  callback('请输入数量');
11167
11198
 
11168
11199
  case 7:
11169
11200
  case "end":
11170
- return _context6.stop();
11201
+ return _context7.stop();
11171
11202
  }
11172
11203
  }
11173
- }, _callee6);
11204
+ }, _callee7);
11174
11205
  }));
11175
11206
 
11176
11207
  function validator(_x6, _x7, _x8) {
@@ -11187,25 +11218,25 @@ var useColumns = (function (form) {
11187
11218
  maxLength: 16,
11188
11219
  loading: isCipher(changeField, "quantity"),
11189
11220
  onChange: function () {
11190
- var _onChange3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
11191
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
11221
+ var _onChange4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
11222
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
11192
11223
  while (1) {
11193
- switch (_context7.prev = _context7.next) {
11224
+ switch (_context8.prev = _context8.next) {
11194
11225
  case 0:
11195
11226
  setChangeField('quantity');
11196
- _context7.next = 3;
11227
+ _context8.next = 3;
11197
11228
  return onChangeQuantity(controller, form, record);
11198
11229
 
11199
11230
  case 3:
11200
11231
  case "end":
11201
- return _context7.stop();
11232
+ return _context8.stop();
11202
11233
  }
11203
11234
  }
11204
- }, _callee7);
11235
+ }, _callee8);
11205
11236
  }));
11206
11237
 
11207
11238
  function onChange() {
11208
- return _onChange3.apply(this, arguments);
11239
+ return _onChange4.apply(this, arguments);
11209
11240
  }
11210
11241
 
11211
11242
  return onChange;
@@ -11237,13 +11268,13 @@ var useColumns = (function (form) {
11237
11268
  message: '单价必须为数字'
11238
11269
  }, {
11239
11270
  validator: function () {
11240
- var _validator3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_, value, callback) {
11271
+ var _validator3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_, value, callback) {
11241
11272
  var isQuantity, isvalue;
11242
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
11273
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
11243
11274
  while (1) {
11244
- switch (_context8.prev = _context8.next) {
11275
+ switch (_context9.prev = _context9.next) {
11245
11276
  case 0:
11246
- _context8.next = 2;
11277
+ _context9.next = 2;
11247
11278
  return controller.wait();
11248
11279
 
11249
11280
  case 2:
@@ -11251,21 +11282,21 @@ var useColumns = (function (form) {
11251
11282
  isvalue = !!value || value === 0;
11252
11283
 
11253
11284
  if (!(isvalue || isQuantity === isvalue)) {
11254
- _context8.next = 6;
11285
+ _context9.next = 6;
11255
11286
  break;
11256
11287
  }
11257
11288
 
11258
- return _context8.abrupt("return");
11289
+ return _context9.abrupt("return");
11259
11290
 
11260
11291
  case 6:
11261
11292
  callback('请输入单价');
11262
11293
 
11263
11294
  case 7:
11264
11295
  case "end":
11265
- return _context8.stop();
11296
+ return _context9.stop();
11266
11297
  }
11267
11298
  }
11268
- }, _callee8);
11299
+ }, _callee9);
11269
11300
  }));
11270
11301
 
11271
11302
  function validator(_x9, _x10, _x11) {
@@ -11312,13 +11343,13 @@ var useColumns = (function (form) {
11312
11343
  message: '单价必须为数字'
11313
11344
  }, {
11314
11345
  validator: function () {
11315
- var _validator4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_, value, callback) {
11346
+ var _validator4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_, value, callback) {
11316
11347
  var isQuantity, isvalue;
11317
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
11348
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
11318
11349
  while (1) {
11319
- switch (_context9.prev = _context9.next) {
11350
+ switch (_context10.prev = _context10.next) {
11320
11351
  case 0:
11321
- _context9.next = 2;
11352
+ _context10.next = 2;
11322
11353
  return controller.wait();
11323
11354
 
11324
11355
  case 2:
@@ -11326,21 +11357,21 @@ var useColumns = (function (form) {
11326
11357
  isvalue = !!value || value === 0;
11327
11358
 
11328
11359
  if (!(isvalue || isQuantity === isvalue)) {
11329
- _context9.next = 6;
11360
+ _context10.next = 6;
11330
11361
  break;
11331
11362
  }
11332
11363
 
11333
- return _context9.abrupt("return");
11364
+ return _context10.abrupt("return");
11334
11365
 
11335
11366
  case 6:
11336
11367
  callback('请输入单价');
11337
11368
 
11338
11369
  case 7:
11339
11370
  case "end":
11340
- return _context9.stop();
11371
+ return _context10.stop();
11341
11372
  }
11342
11373
  }
11343
- }, _callee9);
11374
+ }, _callee10);
11344
11375
  }));
11345
11376
 
11346
11377
  function validator(_x12, _x13, _x14) {
@@ -11390,10 +11421,10 @@ var useColumns = (function (form) {
11390
11421
  message: '金额必须为数字'
11391
11422
  }, {
11392
11423
  validator: function () {
11393
- var _validator5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_, value, callback) {
11394
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
11424
+ var _validator5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_, value, callback) {
11425
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
11395
11426
  while (1) {
11396
- switch (_context10.prev = _context10.next) {
11427
+ switch (_context11.prev = _context11.next) {
11397
11428
  case 0:
11398
11429
  if ("".concat(value).split('.')[0].length > priceIntegerDigit) {
11399
11430
  callback("\u91D1\u989D\u6574\u6570\u90E8\u5206\u4E0D\u80FD\u5927\u4E8E".concat(priceIntegerDigit, "\u4F4D\uFF0C\u5C0F\u6570\u70B9\u540E\u6700\u591A2\u4F4D"));
@@ -11401,10 +11432,10 @@ var useColumns = (function (form) {
11401
11432
 
11402
11433
  case 1:
11403
11434
  case "end":
11404
- return _context10.stop();
11435
+ return _context11.stop();
11405
11436
  }
11406
11437
  }
11407
- }, _callee10);
11438
+ }, _callee11);
11408
11439
  }));
11409
11440
 
11410
11441
  function validator(_x15, _x16, _x17) {
@@ -11415,10 +11446,10 @@ var useColumns = (function (form) {
11415
11446
  }()
11416
11447
  }, {
11417
11448
  validator: function () {
11418
- var _validator6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_, value, callback) {
11419
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
11449
+ var _validator6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_, value, callback) {
11450
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
11420
11451
  while (1) {
11421
- switch (_context11.prev = _context11.next) {
11452
+ switch (_context12.prev = _context12.next) {
11422
11453
  case 0:
11423
11454
  if (deduction && parseFloat(value) <= deduction) {
11424
11455
  callback('扣除额不能大于等于价税合计');
@@ -11426,10 +11457,10 @@ var useColumns = (function (form) {
11426
11457
 
11427
11458
  case 1:
11428
11459
  case "end":
11429
- return _context11.stop();
11460
+ return _context12.stop();
11430
11461
  }
11431
11462
  }
11432
- }, _callee11);
11463
+ }, _callee12);
11433
11464
  }));
11434
11465
 
11435
11466
  function validator(_x18, _x19, _x20) {
@@ -11478,10 +11509,10 @@ var useColumns = (function (form) {
11478
11509
  message: '金额必须为数字'
11479
11510
  }, {
11480
11511
  validator: function () {
11481
- var _validator7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_, value, callback) {
11482
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
11512
+ var _validator7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_, value, callback) {
11513
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
11483
11514
  while (1) {
11484
- switch (_context12.prev = _context12.next) {
11515
+ switch (_context13.prev = _context13.next) {
11485
11516
  case 0:
11486
11517
  if ("".concat(value).split('.')[0].length > priceIntegerDigit) {
11487
11518
  callback("\u91D1\u989D\u6574\u6570\u90E8\u5206\u4E0D\u80FD\u5927\u4E8E".concat(priceIntegerDigit, "\u4F4D\uFF0C\u5C0F\u6570\u70B9\u540E\u6700\u591A2\u4F4D"));
@@ -11489,10 +11520,10 @@ var useColumns = (function (form) {
11489
11520
 
11490
11521
  case 1:
11491
11522
  case "end":
11492
- return _context12.stop();
11523
+ return _context13.stop();
11493
11524
  }
11494
11525
  }
11495
- }, _callee12);
11526
+ }, _callee13);
11496
11527
  }));
11497
11528
 
11498
11529
  function validator(_x21, _x22, _x23) {
package/dist/index.js CHANGED
@@ -10601,6 +10601,7 @@ function ItemNameInput(props) {
10601
10601
  }
10602
10602
  }, "*", props.shorthand, "*"), React__default['default'].createElement(ktsXui.AutoComplete, {
10603
10603
  onSearch: onSearch,
10604
+ defaultValue: props.value,
10604
10605
  options: options.map(function (e) {
10605
10606
  return {
10606
10607
  value: e.itemName
@@ -10653,6 +10654,8 @@ function ItemCodeInput(props) {
10653
10654
  }, []);
10654
10655
  var onSearch = React__default['default'].useCallback( /*#__PURE__*/function () {
10655
10656
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(searchText) {
10657
+ var _props$record;
10658
+
10656
10659
  return _regeneratorRuntime().wrap(function _callee$(_context) {
10657
10660
  while (1) {
10658
10661
  switch (_context.prev = _context.next) {
@@ -10666,7 +10669,7 @@ function ItemCodeInput(props) {
10666
10669
 
10667
10670
  _context.t0 = setOptions;
10668
10671
  _context.next = 5;
10669
- return autoComplete.onItemCodeSearch(searchText);
10672
+ return autoComplete.onItemCodeSearch(searchText, (_props$record = props.record) === null || _props$record === void 0 ? void 0 : _props$record.itemName);
10670
10673
 
10671
10674
  case 5:
10672
10675
  _context.t1 = _context.sent;
@@ -10696,7 +10699,7 @@ function ItemCodeInput(props) {
10696
10699
  }(), [autoComplete.onItemCodeSearch]);
10697
10700
  var onChangeAutoComplete = React__default['default'].useCallback( /*#__PURE__*/function () {
10698
10701
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(itemName) {
10699
- var record;
10702
+ var record, option;
10700
10703
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10701
10704
  while (1) {
10702
10705
  switch (_context2.prev = _context2.next) {
@@ -10713,12 +10716,20 @@ function ItemCodeInput(props) {
10713
10716
  return _context2.abrupt("return");
10714
10717
 
10715
10718
  case 3:
10716
- _context2.next = 5;
10717
- return controller.setEditGood({
10718
- itemCode: record.itemCode
10719
- });
10719
+ option = {
10720
+ itemCode: record.itemCode,
10721
+ itemName: record.itemName,
10722
+ taxCategoryCode: record.taxCategoryCode,
10723
+ shorthand: record.shorthand,
10724
+ specification: record.specification,
10725
+ unit: record.unit,
10726
+ lineAmountIncludeTax: record.lineAmountIncludeTax,
10727
+ taxRate: record.taxRate
10728
+ };
10729
+ _context2.next = 6;
10730
+ return controller.setEditGood(option);
10720
10731
 
10721
- case 5:
10732
+ case 6:
10722
10733
  case "end":
10723
10734
  return _context2.stop();
10724
10735
  }
@@ -10732,13 +10743,9 @@ function ItemCodeInput(props) {
10732
10743
  }(), [options, controller]);
10733
10744
  return React__default['default'].createElement("div", {
10734
10745
  className: 'kts-invoice-operate-goods-list-itemCode-input'
10735
- }, props.shorthand && React__default['default'].createElement("span", {
10736
- style: {
10737
- alignSelf: 'center',
10738
- fontSize: 12
10739
- }
10740
- }, "*", props.shorthand, "*"), React__default['default'].createElement(ktsXui.AutoComplete, {
10746
+ }, React__default['default'].createElement(ktsXui.AutoComplete, {
10741
10747
  onSearch: onSearch,
10748
+ defaultValue: props.value,
10742
10749
  options: options.map(function (e) {
10743
10750
  return {
10744
10751
  value: e.itemCode
@@ -10917,10 +10924,34 @@ var useColumns = (function (form) {
10917
10924
  return React__default['default'].createElement(ktsComponentsAntdX3.Form.Item, null, getFieldDecorator('itemCode', {
10918
10925
  initialValue: editGood.itemCode
10919
10926
  })(React__default['default'].createElement(ItemCodeInput, {
10920
- shorthand: editGood.shorthand,
10921
- onChange: function onChange() {
10922
- onChangeItemCode(controller, form, record);
10923
- }
10927
+ record: record,
10928
+ onChange: function () {
10929
+ var _onChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
10930
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10931
+ while (1) {
10932
+ switch (_context2.prev = _context2.next) {
10933
+ case 0:
10934
+ _context2.next = 2;
10935
+ return onChangeItemCode(controller, form, record);
10936
+
10937
+ case 2:
10938
+ _context2.next = 4;
10939
+ return onChangeLineAmountIncludeTax(controller, form, record);
10940
+
10941
+ case 4:
10942
+ case "end":
10943
+ return _context2.stop();
10944
+ }
10945
+ }
10946
+ }, _callee2);
10947
+ }));
10948
+
10949
+ function onChange() {
10950
+ return _onChange.apply(this, arguments);
10951
+ }
10952
+
10953
+ return onChange;
10954
+ }()
10924
10955
  })));
10925
10956
  } else {
10926
10957
  return record.itemCode;
@@ -10938,39 +10969,39 @@ var useColumns = (function (form) {
10938
10969
  display: 'flex'
10939
10970
  }
10940
10971
  }, getFieldDecorator('itemName', {
10941
- initialValue: isMyShow ? record.itemNameSelf : record.itemName,
10972
+ initialValue: record.itemName,
10942
10973
  rules: [].concat(_toConsumableArray(getReplenishRules('itemName')), [{
10943
10974
  validator: function () {
10944
- var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_, __, callback) {
10975
+ var _validator = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_, __, callback) {
10945
10976
  var value;
10946
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
10977
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
10947
10978
  while (1) {
10948
- switch (_context2.prev = _context2.next) {
10979
+ switch (_context3.prev = _context3.next) {
10949
10980
  case 0:
10950
- _context2.next = 2;
10981
+ _context3.next = 2;
10951
10982
  return controller.wait();
10952
10983
 
10953
10984
  case 2:
10954
10985
  value = controller.state.goodsListState.editGood;
10955
10986
 
10956
10987
  if (!(!(value === null || value === void 0 ? void 0 : value.itemName) && !(value === null || value === void 0 ? void 0 : value.itemNameSelf))) {
10957
- _context2.next = 7;
10988
+ _context3.next = 7;
10958
10989
  break;
10959
10990
  }
10960
10991
 
10961
10992
  callback('项目名称不能为空');
10962
- _context2.next = 8;
10993
+ _context3.next = 8;
10963
10994
  break;
10964
10995
 
10965
10996
  case 7:
10966
- return _context2.abrupt("return");
10997
+ return _context3.abrupt("return");
10967
10998
 
10968
10999
  case 8:
10969
11000
  case "end":
10970
- return _context2.stop();
11001
+ return _context3.stop();
10971
11002
  }
10972
11003
  }
10973
- }, _callee2);
11004
+ }, _callee3);
10974
11005
  }));
10975
11006
 
10976
11007
  function validator(_x2, _x3, _x4) {
@@ -10991,19 +11022,19 @@ var useColumns = (function (form) {
10991
11022
  title: "\u70B9\u51FB\u4ECE\u5546\u54C1\u7BA1\u7406\u4E2D\u6DFB\u52A0\u5546\u54C1\u4FE1\u606F"
10992
11023
  }, React__default['default'].createElement(ktsComponentsAntdX3.Button, {
10993
11024
  onClick: controller.pipeline( /*#__PURE__*/function () {
10994
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s) {
10995
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
11025
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(s) {
11026
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
10996
11027
  while (1) {
10997
- switch (_context3.prev = _context3.next) {
11028
+ switch (_context4.prev = _context4.next) {
10998
11029
  case 0:
10999
11030
  s.goodsListState.importGoods.isVisibleDrawer = true;
11000
11031
 
11001
11032
  case 1:
11002
11033
  case "end":
11003
- return _context3.stop();
11034
+ return _context4.stop();
11004
11035
  }
11005
11036
  }
11006
- }, _callee3);
11037
+ }, _callee4);
11007
11038
  }));
11008
11039
 
11009
11040
  return function (_x5) {
@@ -11040,13 +11071,13 @@ var useColumns = (function (form) {
11040
11071
  rules: getReplenishRules('itemModelName')
11041
11072
  })(React__default['default'].createElement(MyInput, {
11042
11073
  onChange: function () {
11043
- var _onChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
11074
+ var _onChange2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
11044
11075
  var key, value;
11045
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
11076
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
11046
11077
  while (1) {
11047
- switch (_context4.prev = _context4.next) {
11078
+ switch (_context5.prev = _context5.next) {
11048
11079
  case 0:
11049
- _context4.next = 2;
11080
+ _context5.next = 2;
11050
11081
  return controller.wait();
11051
11082
 
11052
11083
  case 2:
@@ -11057,14 +11088,14 @@ var useColumns = (function (form) {
11057
11088
 
11058
11089
  case 6:
11059
11090
  case "end":
11060
- return _context4.stop();
11091
+ return _context5.stop();
11061
11092
  }
11062
11093
  }
11063
- }, _callee4);
11094
+ }, _callee5);
11064
11095
  }));
11065
11096
 
11066
11097
  function onChange() {
11067
- return _onChange.apply(this, arguments);
11098
+ return _onChange2.apply(this, arguments);
11068
11099
  }
11069
11100
 
11070
11101
  return onChange;
@@ -11095,12 +11126,12 @@ var useColumns = (function (form) {
11095
11126
  },
11096
11127
  dataSource: unitList,
11097
11128
  onChange: function () {
11098
- var _onChange2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
11099
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
11129
+ var _onChange3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
11130
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
11100
11131
  while (1) {
11101
- switch (_context5.prev = _context5.next) {
11132
+ switch (_context6.prev = _context6.next) {
11102
11133
  case 0:
11103
- _context5.next = 2;
11134
+ _context6.next = 2;
11104
11135
  return controller.wait();
11105
11136
 
11106
11137
  case 2:
@@ -11113,14 +11144,14 @@ var useColumns = (function (form) {
11113
11144
 
11114
11145
  case 3:
11115
11146
  case "end":
11116
- return _context5.stop();
11147
+ return _context6.stop();
11117
11148
  }
11118
11149
  }
11119
- }, _callee5);
11150
+ }, _callee6);
11120
11151
  }));
11121
11152
 
11122
11153
  function onChange() {
11123
- return _onChange2.apply(this, arguments);
11154
+ return _onChange3.apply(this, arguments);
11124
11155
  }
11125
11156
 
11126
11157
  return onChange;
@@ -11152,13 +11183,13 @@ var useColumns = (function (form) {
11152
11183
  message: '数量必须为数字'
11153
11184
  }, {
11154
11185
  validator: function () {
11155
- var _validator2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_, value, callback) {
11186
+ var _validator2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_, value, callback) {
11156
11187
  var isvalue, isPrice;
11157
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
11188
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
11158
11189
  while (1) {
11159
- switch (_context6.prev = _context6.next) {
11190
+ switch (_context7.prev = _context7.next) {
11160
11191
  case 0:
11161
- _context6.next = 2;
11192
+ _context7.next = 2;
11162
11193
  return controller.wait();
11163
11194
 
11164
11195
  case 2:
@@ -11166,21 +11197,21 @@ var useColumns = (function (form) {
11166
11197
  isPrice = !!getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') || getFieldValue(isTaxIncluded ? 'priceIncludeTax' : 'priceExcludeTax') === 0;
11167
11198
 
11168
11199
  if (!(isvalue || isPrice === isvalue)) {
11169
- _context6.next = 6;
11200
+ _context7.next = 6;
11170
11201
  break;
11171
11202
  }
11172
11203
 
11173
- return _context6.abrupt("return");
11204
+ return _context7.abrupt("return");
11174
11205
 
11175
11206
  case 6:
11176
11207
  callback('请输入数量');
11177
11208
 
11178
11209
  case 7:
11179
11210
  case "end":
11180
- return _context6.stop();
11211
+ return _context7.stop();
11181
11212
  }
11182
11213
  }
11183
- }, _callee6);
11214
+ }, _callee7);
11184
11215
  }));
11185
11216
 
11186
11217
  function validator(_x6, _x7, _x8) {
@@ -11197,25 +11228,25 @@ var useColumns = (function (form) {
11197
11228
  maxLength: 16,
11198
11229
  loading: isCipher(changeField, "quantity"),
11199
11230
  onChange: function () {
11200
- var _onChange3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
11201
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
11231
+ var _onChange4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
11232
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
11202
11233
  while (1) {
11203
- switch (_context7.prev = _context7.next) {
11234
+ switch (_context8.prev = _context8.next) {
11204
11235
  case 0:
11205
11236
  setChangeField('quantity');
11206
- _context7.next = 3;
11237
+ _context8.next = 3;
11207
11238
  return onChangeQuantity(controller, form, record);
11208
11239
 
11209
11240
  case 3:
11210
11241
  case "end":
11211
- return _context7.stop();
11242
+ return _context8.stop();
11212
11243
  }
11213
11244
  }
11214
- }, _callee7);
11245
+ }, _callee8);
11215
11246
  }));
11216
11247
 
11217
11248
  function onChange() {
11218
- return _onChange3.apply(this, arguments);
11249
+ return _onChange4.apply(this, arguments);
11219
11250
  }
11220
11251
 
11221
11252
  return onChange;
@@ -11247,13 +11278,13 @@ var useColumns = (function (form) {
11247
11278
  message: '单价必须为数字'
11248
11279
  }, {
11249
11280
  validator: function () {
11250
- var _validator3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_, value, callback) {
11281
+ var _validator3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_, value, callback) {
11251
11282
  var isQuantity, isvalue;
11252
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
11283
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
11253
11284
  while (1) {
11254
- switch (_context8.prev = _context8.next) {
11285
+ switch (_context9.prev = _context9.next) {
11255
11286
  case 0:
11256
- _context8.next = 2;
11287
+ _context9.next = 2;
11257
11288
  return controller.wait();
11258
11289
 
11259
11290
  case 2:
@@ -11261,21 +11292,21 @@ var useColumns = (function (form) {
11261
11292
  isvalue = !!value || value === 0;
11262
11293
 
11263
11294
  if (!(isvalue || isQuantity === isvalue)) {
11264
- _context8.next = 6;
11295
+ _context9.next = 6;
11265
11296
  break;
11266
11297
  }
11267
11298
 
11268
- return _context8.abrupt("return");
11299
+ return _context9.abrupt("return");
11269
11300
 
11270
11301
  case 6:
11271
11302
  callback('请输入单价');
11272
11303
 
11273
11304
  case 7:
11274
11305
  case "end":
11275
- return _context8.stop();
11306
+ return _context9.stop();
11276
11307
  }
11277
11308
  }
11278
- }, _callee8);
11309
+ }, _callee9);
11279
11310
  }));
11280
11311
 
11281
11312
  function validator(_x9, _x10, _x11) {
@@ -11322,13 +11353,13 @@ var useColumns = (function (form) {
11322
11353
  message: '单价必须为数字'
11323
11354
  }, {
11324
11355
  validator: function () {
11325
- var _validator4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_, value, callback) {
11356
+ var _validator4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_, value, callback) {
11326
11357
  var isQuantity, isvalue;
11327
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
11358
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
11328
11359
  while (1) {
11329
- switch (_context9.prev = _context9.next) {
11360
+ switch (_context10.prev = _context10.next) {
11330
11361
  case 0:
11331
- _context9.next = 2;
11362
+ _context10.next = 2;
11332
11363
  return controller.wait();
11333
11364
 
11334
11365
  case 2:
@@ -11336,21 +11367,21 @@ var useColumns = (function (form) {
11336
11367
  isvalue = !!value || value === 0;
11337
11368
 
11338
11369
  if (!(isvalue || isQuantity === isvalue)) {
11339
- _context9.next = 6;
11370
+ _context10.next = 6;
11340
11371
  break;
11341
11372
  }
11342
11373
 
11343
- return _context9.abrupt("return");
11374
+ return _context10.abrupt("return");
11344
11375
 
11345
11376
  case 6:
11346
11377
  callback('请输入单价');
11347
11378
 
11348
11379
  case 7:
11349
11380
  case "end":
11350
- return _context9.stop();
11381
+ return _context10.stop();
11351
11382
  }
11352
11383
  }
11353
- }, _callee9);
11384
+ }, _callee10);
11354
11385
  }));
11355
11386
 
11356
11387
  function validator(_x12, _x13, _x14) {
@@ -11400,10 +11431,10 @@ var useColumns = (function (form) {
11400
11431
  message: '金额必须为数字'
11401
11432
  }, {
11402
11433
  validator: function () {
11403
- var _validator5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_, value, callback) {
11404
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
11434
+ var _validator5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_, value, callback) {
11435
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
11405
11436
  while (1) {
11406
- switch (_context10.prev = _context10.next) {
11437
+ switch (_context11.prev = _context11.next) {
11407
11438
  case 0:
11408
11439
  if ("".concat(value).split('.')[0].length > priceIntegerDigit) {
11409
11440
  callback("\u91D1\u989D\u6574\u6570\u90E8\u5206\u4E0D\u80FD\u5927\u4E8E".concat(priceIntegerDigit, "\u4F4D\uFF0C\u5C0F\u6570\u70B9\u540E\u6700\u591A2\u4F4D"));
@@ -11411,10 +11442,10 @@ var useColumns = (function (form) {
11411
11442
 
11412
11443
  case 1:
11413
11444
  case "end":
11414
- return _context10.stop();
11445
+ return _context11.stop();
11415
11446
  }
11416
11447
  }
11417
- }, _callee10);
11448
+ }, _callee11);
11418
11449
  }));
11419
11450
 
11420
11451
  function validator(_x15, _x16, _x17) {
@@ -11425,10 +11456,10 @@ var useColumns = (function (form) {
11425
11456
  }()
11426
11457
  }, {
11427
11458
  validator: function () {
11428
- var _validator6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_, value, callback) {
11429
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
11459
+ var _validator6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_, value, callback) {
11460
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
11430
11461
  while (1) {
11431
- switch (_context11.prev = _context11.next) {
11462
+ switch (_context12.prev = _context12.next) {
11432
11463
  case 0:
11433
11464
  if (deduction && parseFloat(value) <= deduction) {
11434
11465
  callback('扣除额不能大于等于价税合计');
@@ -11436,10 +11467,10 @@ var useColumns = (function (form) {
11436
11467
 
11437
11468
  case 1:
11438
11469
  case "end":
11439
- return _context11.stop();
11470
+ return _context12.stop();
11440
11471
  }
11441
11472
  }
11442
- }, _callee11);
11473
+ }, _callee12);
11443
11474
  }));
11444
11475
 
11445
11476
  function validator(_x18, _x19, _x20) {
@@ -11488,10 +11519,10 @@ var useColumns = (function (form) {
11488
11519
  message: '金额必须为数字'
11489
11520
  }, {
11490
11521
  validator: function () {
11491
- var _validator7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_, value, callback) {
11492
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
11522
+ var _validator7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_, value, callback) {
11523
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
11493
11524
  while (1) {
11494
- switch (_context12.prev = _context12.next) {
11525
+ switch (_context13.prev = _context13.next) {
11495
11526
  case 0:
11496
11527
  if ("".concat(value).split('.')[0].length > priceIntegerDigit) {
11497
11528
  callback("\u91D1\u989D\u6574\u6570\u90E8\u5206\u4E0D\u80FD\u5927\u4E8E".concat(priceIntegerDigit, "\u4F4D\uFF0C\u5C0F\u6570\u70B9\u540E\u6700\u591A2\u4F4D"));
@@ -11499,10 +11530,10 @@ var useColumns = (function (form) {
11499
11530
 
11500
11531
  case 1:
11501
11532
  case "end":
11502
- return _context12.stop();
11533
+ return _context13.stop();
11503
11534
  }
11504
11535
  }
11505
- }, _callee12);
11536
+ }, _callee13);
11506
11537
  }));
11507
11538
 
11508
11539
  function validator(_x21, _x22, _x23) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.29",
3
+ "version": "3.2.30",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -13,5 +13,5 @@ export default class AutoComplete {
13
13
  onBuyerTaxIdSearch?: (searchText: string) => Promise<any[]>;
14
14
 
15
15
  /** 商品编码自动补全 */
16
- onItemCodeSearch?: (searchText: string) => Promise<any[]>;
16
+ onItemCodeSearch?: (searchText: string, itemName: any) => Promise<any[]>;
17
17
  }
@@ -106,9 +106,10 @@ export default (form: WrappedFormUtils) => {
106
106
  initialValue: editGood.itemCode,
107
107
  })(
108
108
  <ItemCodeInput
109
- shorthand={editGood.shorthand}
110
- onChange={() => {
111
- onChangeItemCode(controller, form, record);
109
+ record={record}
110
+ onChange={async () => {
111
+ await onChangeItemCode(controller, form, record);
112
+ await onChangeLineAmountIncludeTax(controller, form, record);
112
113
  }}
113
114
  />
114
115
  )}
@@ -128,7 +129,7 @@ export default (form: WrappedFormUtils) => {
128
129
  <Form.Item>
129
130
  <div style={{ display: 'flex' }} >
130
131
  {getFieldDecorator('itemName', {
131
- initialValue: isMyShow ? record.itemNameSelf : record.itemName,
132
+ initialValue: record.itemName,
132
133
  rules: [
133
134
  ...getReplenishRules('itemName'),
134
135
  {
@@ -5,7 +5,7 @@ import { AutoComplete } from 'kts-xui';
5
5
  import { IGood, Invoice } from '../../../../../../../..';
6
6
  import './index.less';
7
7
 
8
- export default function ItemCodeInput(props: { onChange?: (e: ChangeEvent<HTMLInputElement>) => void, value?: string, shorthand?: string }) {
8
+ export default function ItemCodeInput(props: { onChange?: (e: ChangeEvent<HTMLInputElement>) => void, value?: string, record: any }) {
9
9
 
10
10
  const controller = Invoice.useInvoiceController();
11
11
 
@@ -21,7 +21,7 @@ export default function ItemCodeInput(props: { onChange?: (e: ChangeEvent<HTMLIn
21
21
  const onSearch = React.useCallback(async (searchText: string) => {
22
22
  try {
23
23
  if (autoComplete.onItemCodeSearch) {
24
- setOptions(await autoComplete.onItemCodeSearch(searchText))
24
+ setOptions(await autoComplete.onItemCodeSearch(searchText, props.record?.itemName))
25
25
  }
26
26
  } catch (error) {
27
27
  setOptions([])
@@ -32,13 +32,23 @@ export default function ItemCodeInput(props: { onChange?: (e: ChangeEvent<HTMLIn
32
32
  const onChangeAutoComplete = React.useCallback(async itemName => {
33
33
  const record = options.filter(e => e.itemCode === itemName)[0] as any;
34
34
  if (!record) return;
35
- await controller.setEditGood({ itemCode: record.itemCode });
35
+
36
+ const option = {
37
+ itemCode: record.itemCode,
38
+ itemName: record.itemName,
39
+ taxCategoryCode: record.taxCategoryCode,
40
+ shorthand: record.shorthand,
41
+ specification: record.specification,
42
+ unit: record.unit,
43
+ lineAmountIncludeTax: record.lineAmountIncludeTax,
44
+ taxRate: record.taxRate,
45
+ }
46
+ await controller.setEditGood(option);
36
47
  }, [options, controller])
37
48
 
38
49
  return (
39
50
  <div className='kts-invoice-operate-goods-list-itemCode-input'>
40
- {props.shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{props.shorthand}*</span>}
41
- <AutoComplete onSearch={onSearch} options={options.map(e => ({ value: e.itemCode }))} onChange={onChangeAutoComplete} >
51
+ <AutoComplete onSearch={onSearch} defaultValue={props.value} options={options.map(e => ({ value: e.itemCode }))} onChange={onChangeAutoComplete} >
42
52
  <Input style={{ height: '100%', border: 'none' }} value={props.value} onChange={onChange} />
43
53
  </AutoComplete>
44
54
  </div>
@@ -99,7 +99,7 @@ export default function ItemNameInput(props: { onChange?: (e: ChangeEvent<HTMLIn
99
99
  return (
100
100
  <div className='kts-invoice-operate-goods-list-itemName-input'>
101
101
  {props.shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{props.shorthand}*</span>}
102
- <AutoComplete onSearch={onSearch} options={options.map(e => ({ value: e.itemName }))} onChange={onChangeAutoComplete} >
102
+ <AutoComplete onSearch={onSearch} defaultValue={props.value} options={options.map(e => ({ value: e.itemName }))} onChange={onChangeAutoComplete} >
103
103
  <Input style={{ height: '100%', border: 'none' }} value={props.value} onChange={onChange} />
104
104
  </AutoComplete>
105
105
  </div>