kts-component-invoice-operate 3.2.125 → 3.2.127

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
@@ -19343,57 +19343,95 @@ function ItemNameInput$1(props) {
19343
19343
  return _ref.apply(this, arguments);
19344
19344
  };
19345
19345
  }(), [autoComplete.onItemNameBlur, selectLine, props.editGood]);
19346
- var onChangeAutoComplete = React.useCallback(function (itemName) {
19347
- var record = options.filter(function (e) {
19348
- return e.itemName === itemName;
19349
- })[0];
19350
- if (!record) return;
19351
- controller.importGoodsDrawer(record);
19352
- }, [options, controller]);
19353
- var onSearch = React.useCallback( /*#__PURE__*/function () {
19354
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(searchText) {
19355
- var list;
19346
+ var onChangeAutoComplete = React.useCallback( /*#__PURE__*/function () {
19347
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_, i) {
19348
+ var record;
19356
19349
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
19357
19350
  while (1) {
19358
19351
  switch (_context2.prev = _context2.next) {
19359
19352
  case 0:
19360
- _context2.prev = 0;
19353
+ record = options.filter(function (e) {
19354
+ return e.$index === i.value;
19355
+ })[0];
19361
19356
 
19362
- if (!autoComplete.onItemNameSearch) {
19363
- _context2.next = 9;
19357
+ if (record) {
19358
+ _context2.next = 3;
19364
19359
  break;
19365
19360
  }
19366
19361
 
19367
- _context2.t0 = _toConsumableArray;
19362
+ return _context2.abrupt("return");
19363
+
19364
+ case 3:
19368
19365
  _context2.next = 5;
19366
+ return controller.setEditGood({
19367
+ itemName: record.itemName
19368
+ });
19369
+
19370
+ case 5:
19371
+ _context2.next = 7;
19372
+ return controller.importGoodsDrawer(_objectSpread2(_objectSpread2({}, record), {}, {
19373
+ $index: undefined
19374
+ }));
19375
+
19376
+ case 7:
19377
+ case "end":
19378
+ return _context2.stop();
19379
+ }
19380
+ }
19381
+ }, _callee2);
19382
+ }));
19383
+
19384
+ return function (_x2, _x3) {
19385
+ return _ref2.apply(this, arguments);
19386
+ };
19387
+ }(), [options, controller]);
19388
+ var onSearch = React.useCallback( /*#__PURE__*/function () {
19389
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(searchText) {
19390
+ var list;
19391
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
19392
+ while (1) {
19393
+ switch (_context3.prev = _context3.next) {
19394
+ case 0:
19395
+ _context3.prev = 0;
19396
+
19397
+ if (!(autoComplete.onItemNameSearch && searchText)) {
19398
+ _context3.next = 9;
19399
+ break;
19400
+ }
19401
+
19402
+ _context3.t0 = _toConsumableArray;
19403
+ _context3.next = 5;
19369
19404
  return autoComplete.onItemNameSearch(searchText);
19370
19405
 
19371
19406
  case 5:
19372
- _context2.t1 = _context2.sent;
19373
- list = (0, _context2.t0)(_context2.t1);
19374
- console.log('===> list', list);
19407
+ _context3.t1 = _context3.sent;
19408
+ list = (0, _context3.t0)(_context3.t1).map(function (e) {
19409
+ return _objectSpread2(_objectSpread2({}, e), {}, {
19410
+ $index: v4()
19411
+ });
19412
+ });
19375
19413
  setOptions(list);
19376
19414
 
19377
19415
  case 9:
19378
- _context2.next = 15;
19416
+ _context3.next = 15;
19379
19417
  break;
19380
19418
 
19381
19419
  case 11:
19382
- _context2.prev = 11;
19383
- _context2.t2 = _context2["catch"](0);
19420
+ _context3.prev = 11;
19421
+ _context3.t2 = _context3["catch"](0);
19384
19422
  setOptions([]);
19385
- throw _context2.t2;
19423
+ throw _context3.t2;
19386
19424
 
19387
19425
  case 15:
19388
19426
  case "end":
19389
- return _context2.stop();
19427
+ return _context3.stop();
19390
19428
  }
19391
19429
  }
19392
- }, _callee2, null, [[0, 11]]);
19430
+ }, _callee3, null, [[0, 11]]);
19393
19431
  }));
19394
19432
 
19395
- return function (_x2) {
19396
- return _ref2.apply(this, arguments);
19433
+ return function (_x4) {
19434
+ return _ref3.apply(this, arguments);
19397
19435
  };
19398
19436
  }(), [autoComplete.onItemNameSearch]);
19399
19437
  return /*#__PURE__*/React.createElement("div", {
@@ -19408,7 +19446,8 @@ function ItemNameInput$1(props) {
19408
19446
  value: props.value,
19409
19447
  options: options.map(function (e) {
19410
19448
  return {
19411
- value: e.itemName
19449
+ value: e.$index,
19450
+ label: e.itemName
19412
19451
  };
19413
19452
  }),
19414
19453
  onSelect: onChangeAutoComplete
package/dist/index.js CHANGED
@@ -19353,57 +19353,95 @@ function ItemNameInput$1(props) {
19353
19353
  return _ref.apply(this, arguments);
19354
19354
  };
19355
19355
  }(), [autoComplete.onItemNameBlur, selectLine, props.editGood]);
19356
- var onChangeAutoComplete = React__default['default'].useCallback(function (itemName) {
19357
- var record = options.filter(function (e) {
19358
- return e.itemName === itemName;
19359
- })[0];
19360
- if (!record) return;
19361
- controller.importGoodsDrawer(record);
19362
- }, [options, controller]);
19363
- var onSearch = React__default['default'].useCallback( /*#__PURE__*/function () {
19364
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(searchText) {
19365
- var list;
19356
+ var onChangeAutoComplete = React__default['default'].useCallback( /*#__PURE__*/function () {
19357
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_, i) {
19358
+ var record;
19366
19359
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
19367
19360
  while (1) {
19368
19361
  switch (_context2.prev = _context2.next) {
19369
19362
  case 0:
19370
- _context2.prev = 0;
19363
+ record = options.filter(function (e) {
19364
+ return e.$index === i.value;
19365
+ })[0];
19371
19366
 
19372
- if (!autoComplete.onItemNameSearch) {
19373
- _context2.next = 9;
19367
+ if (record) {
19368
+ _context2.next = 3;
19374
19369
  break;
19375
19370
  }
19376
19371
 
19377
- _context2.t0 = _toConsumableArray;
19372
+ return _context2.abrupt("return");
19373
+
19374
+ case 3:
19378
19375
  _context2.next = 5;
19376
+ return controller.setEditGood({
19377
+ itemName: record.itemName
19378
+ });
19379
+
19380
+ case 5:
19381
+ _context2.next = 7;
19382
+ return controller.importGoodsDrawer(_objectSpread2(_objectSpread2({}, record), {}, {
19383
+ $index: undefined
19384
+ }));
19385
+
19386
+ case 7:
19387
+ case "end":
19388
+ return _context2.stop();
19389
+ }
19390
+ }
19391
+ }, _callee2);
19392
+ }));
19393
+
19394
+ return function (_x2, _x3) {
19395
+ return _ref2.apply(this, arguments);
19396
+ };
19397
+ }(), [options, controller]);
19398
+ var onSearch = React__default['default'].useCallback( /*#__PURE__*/function () {
19399
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(searchText) {
19400
+ var list;
19401
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
19402
+ while (1) {
19403
+ switch (_context3.prev = _context3.next) {
19404
+ case 0:
19405
+ _context3.prev = 0;
19406
+
19407
+ if (!(autoComplete.onItemNameSearch && searchText)) {
19408
+ _context3.next = 9;
19409
+ break;
19410
+ }
19411
+
19412
+ _context3.t0 = _toConsumableArray;
19413
+ _context3.next = 5;
19379
19414
  return autoComplete.onItemNameSearch(searchText);
19380
19415
 
19381
19416
  case 5:
19382
- _context2.t1 = _context2.sent;
19383
- list = (0, _context2.t0)(_context2.t1);
19384
- console.log('===> list', list);
19417
+ _context3.t1 = _context3.sent;
19418
+ list = (0, _context3.t0)(_context3.t1).map(function (e) {
19419
+ return _objectSpread2(_objectSpread2({}, e), {}, {
19420
+ $index: uuid.v4()
19421
+ });
19422
+ });
19385
19423
  setOptions(list);
19386
19424
 
19387
19425
  case 9:
19388
- _context2.next = 15;
19426
+ _context3.next = 15;
19389
19427
  break;
19390
19428
 
19391
19429
  case 11:
19392
- _context2.prev = 11;
19393
- _context2.t2 = _context2["catch"](0);
19430
+ _context3.prev = 11;
19431
+ _context3.t2 = _context3["catch"](0);
19394
19432
  setOptions([]);
19395
- throw _context2.t2;
19433
+ throw _context3.t2;
19396
19434
 
19397
19435
  case 15:
19398
19436
  case "end":
19399
- return _context2.stop();
19437
+ return _context3.stop();
19400
19438
  }
19401
19439
  }
19402
- }, _callee2, null, [[0, 11]]);
19440
+ }, _callee3, null, [[0, 11]]);
19403
19441
  }));
19404
19442
 
19405
- return function (_x2) {
19406
- return _ref2.apply(this, arguments);
19443
+ return function (_x4) {
19444
+ return _ref3.apply(this, arguments);
19407
19445
  };
19408
19446
  }(), [autoComplete.onItemNameSearch]);
19409
19447
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -19418,7 +19456,8 @@ function ItemNameInput$1(props) {
19418
19456
  value: props.value,
19419
19457
  options: options.map(function (e) {
19420
19458
  return {
19421
- value: e.itemName
19459
+ value: e.$index,
19460
+ label: e.itemName
19422
19461
  };
19423
19462
  }),
19424
19463
  onSelect: onChangeAutoComplete
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kts-component-invoice-operate",
3
- "version": "3.2.125",
3
+ "version": "3.2.127",
4
4
  "scripts": {
5
5
  "dev": "dumi dev",
6
6
  "start": "dumi dev",
@@ -74,10 +74,37 @@ class MyInvoiceController extends InvoiceController {
74
74
  };
75
75
 
76
76
  this.state.autoComplete.onItemNameSearch = async (value: any) => {
77
- console.log(value, 'onItemNameSearch - Search');
78
-
77
+ console.log('===> onItemNameSearch')
79
78
  const data = [
80
79
  {
80
+ "taxCategoryCode": "1090111090000000000",
81
+ "productName": "uuuuuu",
82
+ "name": null,
83
+ "productCode": "0003",
84
+ "shorthand": "小型起重设备",
85
+ "id": "10881474649024102400167947617243",
86
+ "specification": 1,
87
+ "categoryId": "10688389540499947520167487266471",
88
+ "categoryName": "水果",
89
+ "internalNumber": 1,
90
+ "taxCategoryName": "轻小型起重设备配套件",
91
+ "referenceAmount": 1,
92
+ "priceAmount": 200.00000000000000000000,
93
+ "taxId": null,
94
+ "taxRate": 1,
95
+ "unitId": null,
96
+ "unitName": null,
97
+ "taxExemptionType": null,
98
+ "enjoyPreferentialPolicies": 0,
99
+ "preferentialPoliciesType": null,
100
+ "productStatus": 1,
101
+ "specialGoodsMark": "",
102
+ "lineAmountIncludeTax":1,
103
+ "lineAmountExcludeTax":2,
104
+ "taxAmount":2,
105
+ "createTime": "2023-03-22 17:09:32",
106
+ "updateTime": "2023-03-22 17:09:32"
107
+ },{
81
108
  "taxCategoryCode": "1090111090000000000",
82
109
  "productName": "苹果",
83
110
  "name": null,
@@ -102,12 +129,287 @@ class MyInvoiceController extends InvoiceController {
102
129
  "specialGoodsMark": "",
103
130
  "createTime": "2023-03-22 17:09:32",
104
131
  "updateTime": "2023-03-22 17:09:32"
132
+ },{
133
+ "taxCategoryCode": "1090111090000000000",
134
+ "productName": "苹果",
135
+ "name": null,
136
+ "productCode": "0003",
137
+ "shorthand": "小型起重设备",
138
+ "id": "10881474649024102400167947617243",
139
+ "specification": null,
140
+ "categoryId": "10688389540499947520167487266471",
141
+ "categoryName": "水果",
142
+ "internalNumber": null,
143
+ "taxCategoryName": "轻小型起重设备配套件",
144
+ "referenceAmount": null,
145
+ "priceAmount": 200.00000000000000000000,
146
+ "taxId": null,
147
+ "taxRate": null,
148
+ "unitId": null,
149
+ "unitName": null,
150
+ "taxExemptionType": null,
151
+ "enjoyPreferentialPolicies": 0,
152
+ "preferentialPoliciesType": null,
153
+ "productStatus": 1,
154
+ "specialGoodsMark": "",
155
+ "createTime": "2023-03-22 17:09:32",
156
+ "updateTime": "2023-03-22 17:09:32"
157
+ },{
158
+ "taxCategoryCode": "1090111090000000000",
159
+ "productName": "zzzzz",
160
+ "name": null,
161
+ "productCode": "0003",
162
+ "shorthand": "小型起重设备",
163
+ "id": "10881474649024102400167947617243",
164
+ "specification": null,
165
+ "categoryId": "10688389540499947520167487266471",
166
+ "categoryName": "水果",
167
+ "internalNumber": null,
168
+ "taxCategoryName": "轻小型起重设备配套件",
169
+ "referenceAmount": null,
170
+ "priceAmount": 200.00000000000000000000,
171
+ "taxId": null,
172
+ "taxRate": null,
173
+ "unitId": null,
174
+ "unitName": null,
175
+ "taxExemptionType": null,
176
+ "enjoyPreferentialPolicies": 0,
177
+ "preferentialPoliciesType": null,
178
+ "productStatus": 1,
179
+ "specialGoodsMark": "",
180
+ "createTime": "2023-03-22 17:09:32",
181
+ "updateTime": "2023-03-22 17:09:32"
182
+ },{
183
+ "taxCategoryCode": "1090111090000000000",
184
+ "productName": "cccccc",
185
+ "name": null,
186
+ "productCode": "0003",
187
+ "shorthand": "小型起重设备",
188
+ "id": "10881474649024102400167947617243",
189
+ "specification": null,
190
+ "categoryId": "10688389540499947520167487266471",
191
+ "categoryName": "水果",
192
+ "internalNumber": null,
193
+ "taxCategoryName": "轻小型起重设备配套件",
194
+ "referenceAmount": null,
195
+ "priceAmount": 200.00000000000000000000,
196
+ "taxId": null,
197
+ "taxRate": null,
198
+ "unitId": null,
199
+ "unitName": null,
200
+ "taxExemptionType": null,
201
+ "enjoyPreferentialPolicies": 0,
202
+ "preferentialPoliciesType": null,
203
+ "productStatus": 1,
204
+ "specialGoodsMark": "",
205
+ "createTime": "2023-03-22 17:09:32",
206
+ "updateTime": "2023-03-22 17:09:32"
207
+ },{
208
+ "taxCategoryCode": "1090111090000000000",
209
+ "productName": "qqqqqq",
210
+ "name": null,
211
+ "productCode": "0003",
212
+ "shorthand": "小型起重设备",
213
+ "id": "10881474649024102400167947617243",
214
+ "specification": null,
215
+ "categoryId": "10688389540499947520167487266471",
216
+ "categoryName": "水果",
217
+ "internalNumber": null,
218
+ "taxCategoryName": "轻小型起重设备配套件",
219
+ "referenceAmount": null,
220
+ "priceAmount": 200.00000000000000000000,
221
+ "taxId": null,
222
+ "taxRate": null,
223
+ "unitId": null,
224
+ "unitName": null,
225
+ "taxExemptionType": null,
226
+ "enjoyPreferentialPolicies": 0,
227
+ "preferentialPoliciesType": null,
228
+ "productStatus": 1,
229
+ "specialGoodsMark": "",
230
+ "createTime": "2023-03-22 17:09:32",
231
+ "updateTime": "2023-03-22 17:09:32"
232
+ },{
233
+ "taxCategoryCode": "1090111090000000000",
234
+ "productName": "wwwww",
235
+ "name": null,
236
+ "productCode": "0003",
237
+ "shorthand": "小型起重设备",
238
+ "id": "10881474649024102400167947617243",
239
+ "specification": null,
240
+ "categoryId": "10688389540499947520167487266471",
241
+ "categoryName": "水果",
242
+ "internalNumber": null,
243
+ "taxCategoryName": "轻小型起重设备配套件",
244
+ "referenceAmount": null,
245
+ "priceAmount": 200.00000000000000000000,
246
+ "taxId": null,
247
+ "taxRate": null,
248
+ "unitId": null,
249
+ "unitName": null,
250
+ "taxExemptionType": null,
251
+ "enjoyPreferentialPolicies": 0,
252
+ "preferentialPoliciesType": null,
253
+ "productStatus": 1,
254
+ "specialGoodsMark": "",
255
+ "createTime": "2023-03-22 17:09:32",
256
+ "updateTime": "2023-03-22 17:09:32"
257
+ },{
258
+ "taxCategoryCode": "1090111090000000000",
259
+ "productName": "eeeee",
260
+ "name": null,
261
+ "productCode": "0003",
262
+ "shorthand": "小型起重设备",
263
+ "id": "10881474649024102400167947617243",
264
+ "specification": null,
265
+ "categoryId": "10688389540499947520167487266471",
266
+ "categoryName": "水果",
267
+ "internalNumber": null,
268
+ "taxCategoryName": "轻小型起重设备配套件",
269
+ "referenceAmount": null,
270
+ "priceAmount": 200.00000000000000000000,
271
+ "taxId": null,
272
+ "taxRate": null,
273
+ "unitId": null,
274
+ "unitName": null,
275
+ "taxExemptionType": null,
276
+ "enjoyPreferentialPolicies": 0,
277
+ "preferentialPoliciesType": null,
278
+ "productStatus": 1,
279
+ "specialGoodsMark": "",
280
+ "createTime": "2023-03-22 17:09:32",
281
+ "updateTime": "2023-03-22 17:09:32"
282
+ },{
283
+ "taxCategoryCode": "1090111090000000000",
284
+ "productName": "rrrrrr",
285
+ "name": null,
286
+ "productCode": "0003",
287
+ "shorthand": "小型起重设备",
288
+ "id": "10881474649024102400167947617243",
289
+ "specification": null,
290
+ "categoryId": "10688389540499947520167487266471",
291
+ "categoryName": "水果",
292
+ "internalNumber": null,
293
+ "taxCategoryName": "轻小型起重设备配套件",
294
+ "referenceAmount": null,
295
+ "priceAmount": 200.00000000000000000000,
296
+ "taxId": null,
297
+ "taxRate": null,
298
+ "unitId": null,
299
+ "unitName": null,
300
+ "taxExemptionType": null,
301
+ "enjoyPreferentialPolicies": 0,
302
+ "preferentialPoliciesType": null,
303
+ "productStatus": 1,
304
+ "specialGoodsMark": "",
305
+ "createTime": "2023-03-22 17:09:32",
306
+ "updateTime": "2023-03-22 17:09:32"
307
+ },{
308
+ "taxCategoryCode": "1090111090000000000",
309
+ "productName": "tttttt",
310
+ "name": null,
311
+ "productCode": "0003",
312
+ "shorthand": "小型起重设备",
313
+ "id": "10881474649024102400167947617243",
314
+ "specification": null,
315
+ "categoryId": "10688389540499947520167487266471",
316
+ "categoryName": "水果",
317
+ "internalNumber": null,
318
+ "taxCategoryName": "轻小型起重设备配套件",
319
+ "referenceAmount": null,
320
+ "priceAmount": 200.00000000000000000000,
321
+ "taxId": null,
322
+ "taxRate": null,
323
+ "unitId": null,
324
+ "unitName": null,
325
+ "taxExemptionType": null,
326
+ "enjoyPreferentialPolicies": 0,
327
+ "preferentialPoliciesType": null,
328
+ "productStatus": 1,
329
+ "specialGoodsMark": "",
330
+ "createTime": "2023-03-22 17:09:32",
331
+ "updateTime": "2023-03-22 17:09:32"
332
+ },{
333
+ "taxCategoryCode": "1090111090000000000",
334
+ "productName": "yyyy",
335
+ "name": null,
336
+ "productCode": "0003",
337
+ "shorthand": "小型起重设备",
338
+ "id": "10881474649024102400167947617243",
339
+ "specification": null,
340
+ "categoryId": "10688389540499947520167487266471",
341
+ "categoryName": "水果",
342
+ "internalNumber": null,
343
+ "taxCategoryName": "轻小型起重设备配套件",
344
+ "referenceAmount": null,
345
+ "priceAmount": 200.00000000000000000000,
346
+ "taxId": null,
347
+ "taxRate": null,
348
+ "unitId": null,
349
+ "unitName": null,
350
+ "taxExemptionType": null,
351
+ "enjoyPreferentialPolicies": 0,
352
+ "preferentialPoliciesType": null,
353
+ "productStatus": 1,
354
+ "specialGoodsMark": "",
355
+ "createTime": "2023-03-22 17:09:32",
356
+ "updateTime": "2023-03-22 17:09:32"
357
+ },{
358
+ "taxCategoryCode": "1090111090000000000",
359
+ "productName": "uuuuu",
360
+ "name": null,
361
+ "productCode": "0003",
362
+ "shorthand": "小型起重设备",
363
+ "id": "10881474649024102400167947617243",
364
+ "specification": null,
365
+ "categoryId": "10688389540499947520167487266471",
366
+ "categoryName": "水果",
367
+ "internalNumber": null,
368
+ "taxCategoryName": "轻小型起重设备配套件",
369
+ "referenceAmount": null,
370
+ "priceAmount": 200.00000000000000000000,
371
+ "taxId": null,
372
+ "taxRate": null,
373
+ "unitId": null,
374
+ "unitName": null,
375
+ "taxExemptionType": null,
376
+ "enjoyPreferentialPolicies": 0,
377
+ "preferentialPoliciesType": null,
378
+ "productStatus": 1,
379
+ "specialGoodsMark": "",
380
+ "createTime": "2023-03-22 17:09:32",
381
+ "updateTime": "2023-03-22 17:09:32"
382
+ },{
383
+ "taxCategoryCode": "1090111090000000000",
384
+ "productName": "iiiiii",
385
+ "name": null,
386
+ "productCode": "0003",
387
+ "shorthand": "小型起重设备",
388
+ "id": "10881474649024102400167947617243",
389
+ "specification": null,
390
+ "categoryId": "10688389540499947520167487266471",
391
+ "categoryName": "水果",
392
+ "internalNumber": null,
393
+ "taxCategoryName": "轻小型起重设备配套件",
394
+ "referenceAmount": null,
395
+ "priceAmount": 200.00000000000000000000,
396
+ "taxId": null,
397
+ "taxRate": null,
398
+ "unitId": null,
399
+ "unitName": null,
400
+ "taxExemptionType": null,
401
+ "enjoyPreferentialPolicies": 0,
402
+ "preferentialPoliciesType": null,
403
+ "productStatus": 1,
404
+ "specialGoodsMark": "",
405
+ "createTime": "2023-03-22 17:09:32",
406
+ "updateTime": "2023-03-22 17:09:32"
105
407
  }
106
408
  ];
107
409
 
108
410
  return data.map((item: any) =>{
109
411
  return {
110
- ...data,
412
+ ...item,
111
413
  itemName:item.productName,
112
414
  taxClassificationCode:item.taxCategoryCode,
113
415
  itemModelName:item.specification,
@@ -1,6 +1,7 @@
1
1
 
2
2
  import { AutoComplete, Input } from 'kts-xui';
3
3
  import React, { ChangeEvent } from 'react';
4
+ import { v4 as uuid } from 'uuid';
4
5
  import { IGood, Invoice } from '../../../../../../../..';
5
6
  import './index.less';
6
7
 
@@ -45,17 +46,18 @@ export default function ItemNameInput(props: {
45
46
  }
46
47
  }, [autoComplete.onItemNameBlur, selectLine, props.editGood])
47
48
 
48
- const onChangeAutoComplete = React.useCallback(itemName => {
49
- const record = options.filter(e => e.itemName === itemName)[0] as any;
49
+ const onChangeAutoComplete = React.useCallback(async (_, i) => {
50
+ const record = options.filter(e => e.$index === i.value)[0] as any;
50
51
  if (!record) return;
51
- controller.importGoodsDrawer(record);
52
+
53
+ await controller.setEditGood({ itemName: record.itemName });
54
+ await controller.importGoodsDrawer({ ...record, $index: undefined });
52
55
  }, [options, controller])
53
56
 
54
57
  const onSearch = React.useCallback(async (searchText: string) => {
55
58
  try {
56
- if (autoComplete.onItemNameSearch) {
57
- const list = [...await autoComplete.onItemNameSearch(searchText)];
58
- console.log('===> list', list);
59
+ if (autoComplete.onItemNameSearch && searchText) {
60
+ const list = [...await autoComplete.onItemNameSearch(searchText)].map(e => ({ ...e, $index: uuid() }));;
59
61
  setOptions(list);
60
62
  }
61
63
  } catch (error) {
@@ -67,7 +69,12 @@ export default function ItemNameInput(props: {
67
69
  return (
68
70
  <div className='kts-invoice-operate-goods-list-itemName-input'>
69
71
  {props.shorthand && <span style={{ alignSelf: 'center', fontSize: 12 }} >*{props.shorthand}*</span>}
70
- <AutoComplete onSearch={onSearch} value={props.value} options={options.map(e => ({ value: e.itemName }))} onSelect={onChangeAutoComplete} >
72
+ <AutoComplete
73
+ onSearch={onSearch}
74
+ value={props.value}
75
+ options={options.map(e => ({ value: e.$index, label: e.itemName }))}
76
+ onSelect={onChangeAutoComplete}
77
+ >
71
78
  <Input style={{ height: '100%' }} onChange={onChange} suffix={props.suffix} onBlur={onBlur} />
72
79
  </AutoComplete>
73
80
  </div>