@kmkf-fe-packages/basic-components 1.8.0-beta.2 → 1.8.0-beta.3

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
@@ -8842,15 +8842,21 @@ var Sku = /*#__PURE__*/forwardRef(function (props, ref) {
8842
8842
  _useState8 = _slicedToArray(_useState7, 2),
8843
8843
  numIids = _useState8[0],
8844
8844
  setNumIids = _useState8[1];
8845
+ var _useState9 = useState(-1),
8846
+ _useState10 = _slicedToArray(_useState9, 2),
8847
+ numIndex = _useState10[0],
8848
+ setNumIndex = _useState10[1];
8845
8849
  useImperativeHandle(ref, function () {
8846
8850
  return {
8847
8851
  open: function open(_ref) {
8848
8852
  var numIids = _ref.numIids,
8849
- options = _ref.options;
8853
+ options = _ref.options,
8854
+ index = _ref.index;
8850
8855
  setVisible(true);
8851
8856
  setSku('');
8852
8857
  setNumIids(numIids);
8853
8858
  setOptions(options);
8859
+ setNumIndex(typeof index === 'number' ? index : -1);
8854
8860
  },
8855
8861
  close: function close() {
8856
8862
  setVisible(false);
@@ -8859,7 +8865,7 @@ var Sku = /*#__PURE__*/forwardRef(function (props, ref) {
8859
8865
  });
8860
8866
  var handleSure = /*#__PURE__*/function () {
8861
8867
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8862
- var type, SKU, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _yield$request, _yield$request$data, data;
8868
+ var type, SKU, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _yield$request, _yield$request$data, data;
8863
8869
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8864
8870
  while (1) switch (_context.prev = _context.next) {
8865
8871
  case 0:
@@ -8869,6 +8875,7 @@ var Sku = /*#__PURE__*/forwardRef(function (props, ref) {
8869
8875
  break;
8870
8876
  }
8871
8877
  props.handleOk({
8878
+ numIndex: -1,
8872
8879
  enableItemId: '',
8873
8880
  enableSupplierName: '',
8874
8881
  propertiesName: ''
@@ -8884,20 +8891,24 @@ var Sku = /*#__PURE__*/forwardRef(function (props, ref) {
8884
8891
  break;
8885
8892
  }
8886
8893
  props.handleOk({
8894
+ numIndex: numIndex,
8895
+ code: ((_ref3 = SKU || {
8896
+ code: ''
8897
+ }) === null || _ref3 === void 0 ? void 0 : _ref3.code) || '',
8887
8898
  enableItemId: '',
8888
8899
  enableSupplierName: '',
8889
- propertiesName: ((_ref3 = SKU || {
8900
+ propertiesName: ((_ref4 = SKU || {
8890
8901
  label: ''
8891
- }) === null || _ref3 === void 0 ? void 0 : _ref3.label) || '',
8892
- picUrl: (_ref4 = SKU || {
8902
+ }) === null || _ref4 === void 0 ? void 0 : _ref4.label) || '',
8903
+ picUrl: (_ref5 = SKU || {
8893
8904
  picUrl: ''
8894
- }) === null || _ref4 === void 0 ? void 0 : _ref4.picUrl,
8895
- outerSkuId: (_ref5 = SKU || {
8905
+ }) === null || _ref5 === void 0 ? void 0 : _ref5.picUrl,
8906
+ outerSkuId: (_ref6 = SKU || {
8896
8907
  outerSkuId: ''
8897
- }) === null || _ref5 === void 0 ? void 0 : _ref5.outerSkuId,
8898
- skuId: ((_ref6 = SKU || {
8908
+ }) === null || _ref6 === void 0 ? void 0 : _ref6.outerSkuId,
8909
+ skuId: ((_ref7 = SKU || {
8899
8910
  skuId: ''
8900
- }) === null || _ref6 === void 0 ? void 0 : _ref6.skuId) || ''
8911
+ }) === null || _ref7 === void 0 ? void 0 : _ref7.skuId) || ''
8901
8912
  });
8902
8913
  _context.next = 16;
8903
8914
  break;
@@ -8916,17 +8927,21 @@ var Sku = /*#__PURE__*/forwardRef(function (props, ref) {
8916
8927
  _yield$request$data = _yield$request.data;
8917
8928
  data = _yield$request$data === void 0 ? [] : _yield$request$data;
8918
8929
  props.handleOk({
8930
+ numIndex: numIndex,
8931
+ code: ((_ref8 = SKU || {
8932
+ code: ''
8933
+ }) === null || _ref8 === void 0 ? void 0 : _ref8.code) || '',
8919
8934
  enableItemId: data.length > 0 ? data[0]['supplierItemOuterId'] : '',
8920
8935
  enableSupplierName: data.length > 0 ? data[0]['supplierName'] : '',
8921
- propertiesName: ((_ref7 = SKU || {
8936
+ propertiesName: ((_ref9 = SKU || {
8922
8937
  label: ''
8923
- }) === null || _ref7 === void 0 ? void 0 : _ref7.label) || '',
8924
- picUrl: (_ref8 = SKU || {
8938
+ }) === null || _ref9 === void 0 ? void 0 : _ref9.label) || '',
8939
+ picUrl: (_ref10 = SKU || {
8925
8940
  picUrl: ''
8926
- }) === null || _ref8 === void 0 ? void 0 : _ref8.picUrl,
8927
- skuId: ((_ref9 = SKU || {
8941
+ }) === null || _ref10 === void 0 ? void 0 : _ref10.picUrl,
8942
+ skuId: ((_ref11 = SKU || {
8928
8943
  skuId: ''
8929
- }) === null || _ref9 === void 0 ? void 0 : _ref9.skuId) || ''
8944
+ }) === null || _ref11 === void 0 ? void 0 : _ref11.skuId) || ''
8930
8945
  });
8931
8946
  case 16:
8932
8947
  setVisible(false);
@@ -9023,8 +9038,10 @@ var Goods = function Goods(props) {
9023
9038
  while (1) switch (_context.prev = _context.next) {
9024
9039
  case 0:
9025
9040
  shopId = _ref.shopId, numIids = _ref.numIids;
9026
- return _context.abrupt("return", extendRequest('/qy/gdfw/workOrder/queryItemSkus', {
9041
+ return _context.abrupt("return", request$1({
9042
+ url: '/qy/gdfw/workOrder/queryItemSkus',
9027
9043
  method: 'post',
9044
+ handleError: message.error,
9028
9045
  data: {
9029
9046
  shopId: shopId,
9030
9047
  numIids: numIids
@@ -9056,23 +9073,29 @@ var Goods = function Goods(props) {
9056
9073
  };
9057
9074
  //选择sku
9058
9075
  var handleSelectSku = function handleSelectSku(_ref3) {
9059
- var enableItemId = _ref3.enableItemId,
9076
+ var numIndex = _ref3.numIndex,
9077
+ code = _ref3.code,
9078
+ enableItemId = _ref3.enableItemId,
9060
9079
  enableSupplierName = _ref3.enableSupplierName,
9061
9080
  propertiesName = _ref3.propertiesName,
9062
9081
  picUrl = _ref3.picUrl,
9063
9082
  outerSkuId = _ref3.outerSkuId;
9083
+ if (numIndex < 0) return;
9064
9084
  var newList = JSON.parse(JSON.stringify(imgList));
9065
9085
  if (type === 4) {
9066
- newList[newList.length - 1].itemId = enableItemId;
9067
- newList[newList.length - 1].supplierName = enableSupplierName;
9086
+ newList[numIndex].itemId = enableItemId;
9087
+ newList[numIndex].supplierName = enableSupplierName;
9068
9088
  } else {
9069
- newList[newList.length - 1].propertiesName = propertiesName;
9089
+ newList[numIndex].propertiesName = propertiesName;
9070
9090
  }
9071
9091
  if (type === 1 && outerSkuId) {
9072
- newList[newList.length - 1].outerId = outerSkuId;
9092
+ newList[numIndex].outerId = outerSkuId;
9093
+ }
9094
+ if (type === 1 && code) {
9095
+ newList[numIndex].outerId = code;
9073
9096
  }
9074
9097
  //替换成sku的图片
9075
- picUrl && (newList[newList.length - 1].picUrl = picUrl);
9098
+ picUrl && (newList[numIndex].picUrl = picUrl);
9076
9099
  var newValue = {
9077
9100
  shopId: shopId,
9078
9101
  imgList: newList
@@ -9082,7 +9105,8 @@ var Goods = function Goods(props) {
9082
9105
  //选择回调
9083
9106
  var onSubmit = /*#__PURE__*/function () {
9084
9107
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(list) {
9085
- var newList, newImgList, newValue, _yield$querySkus, data, _skuRef$current, options;
9108
+ var _list$;
9109
+ var newList, newImgList, newValue;
9086
9110
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9087
9111
  while (1) switch (_context2.prev = _context2.next) {
9088
9112
  case 0:
@@ -9121,22 +9145,45 @@ var Goods = function Goods(props) {
9121
9145
  setUploadImageCount(newImgList.length);
9122
9146
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, newValue));
9123
9147
  setVisible(false);
9124
- //供应上编码组件 || 商品组件且可以选择sku
9125
- if (!(type === 4 && (enableItemId || enableSupplierName) || type !== 4 && changeSku && list.length > 0)) {
9126
- _context2.next = 12;
9148
+ checkSkus(list === null || list === void 0 ? void 0 : (_list$ = list[0]) === null || _list$ === void 0 ? void 0 : _list$.numIid, newImgList.length - 1);
9149
+ case 7:
9150
+ case "end":
9151
+ return _context2.stop();
9152
+ }
9153
+ }, _callee2);
9154
+ }));
9155
+ return function onSubmit(_x2) {
9156
+ return _ref4.apply(this, arguments);
9157
+ };
9158
+ }();
9159
+ var checkSkus = /*#__PURE__*/function () {
9160
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(numIid, index) {
9161
+ var res, data, _skuRef$current, options;
9162
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
9163
+ while (1) switch (_context3.prev = _context3.next) {
9164
+ case 0:
9165
+ if (numIid) {
9166
+ _context3.next = 2;
9127
9167
  break;
9128
9168
  }
9129
- _context2.next = 9;
9169
+ return _context3.abrupt("return");
9170
+ case 2:
9171
+ if (!(type === 4 && (enableItemId || enableSupplierName) || type !== 4 && changeSku)) {
9172
+ _context3.next = 8;
9173
+ break;
9174
+ }
9175
+ _context3.next = 5;
9130
9176
  return querySkus({
9131
9177
  shopId: shopId,
9132
- numIids: list[0].numIid
9133
- });
9134
- case 9:
9135
- _yield$querySkus = _context2.sent;
9136
- data = _yield$querySkus.data;
9178
+ numIids: numIid
9179
+ }).catch(console.debug);
9180
+ case 5:
9181
+ res = _context3.sent;
9182
+ data = (res === null || res === void 0 ? void 0 : res.success) && (res === null || res === void 0 ? void 0 : res.data);
9137
9183
  if (data && data.length > 0 && data[0]['skus'] && data[0]['skus']['length'] > 0) {
9138
9184
  options = data[0]['skus'].map(function (item) {
9139
9185
  return {
9186
+ code: item.code,
9140
9187
  label: isTaobaoPlat ? item.propertiesName.split(';').map(function (i) {
9141
9188
  return i.split(':').slice(2);
9142
9189
  }).join(';') : item.propertiesName,
@@ -9146,19 +9193,20 @@ var Goods = function Goods(props) {
9146
9193
  };
9147
9194
  });
9148
9195
  (_skuRef$current = skuRef.current) === null || _skuRef$current === void 0 ? void 0 : _skuRef$current.open({
9196
+ index: index,
9149
9197
  shopId: shopId,
9150
- numIids: list[0].numIid,
9198
+ numIids: numIid,
9151
9199
  options: options
9152
9200
  });
9153
9201
  }
9154
- case 12:
9202
+ case 8:
9155
9203
  case "end":
9156
- return _context2.stop();
9204
+ return _context3.stop();
9157
9205
  }
9158
- }, _callee2);
9206
+ }, _callee3);
9159
9207
  }));
9160
- return function onSubmit(_x2) {
9161
- return _ref4.apply(this, arguments);
9208
+ return function checkSkus(_x3, _x4) {
9209
+ return _ref5.apply(this, arguments);
9162
9210
  };
9163
9211
  }();
9164
9212
  //修改参数
@@ -9185,7 +9233,8 @@ var Goods = function Goods(props) {
9185
9233
  className: "goodsBox ".concat(goodsBoxClassName)
9186
9234
  }, imgList === null || imgList === void 0 ? void 0 : imgList.map(function (img, index) {
9187
9235
  return /*#__PURE__*/React.createElement("div", {
9188
- className: "goodBox-Img"
9236
+ className: "goodBox-Img",
9237
+ key: "".concat(img.numIid, "_").concat(index)
9189
9238
  }, /*#__PURE__*/React.createElement("div", {
9190
9239
  className: "goods-imgBox",
9191
9240
  key: img.picUrl + '-goods'
@@ -9254,7 +9303,16 @@ var Goods = function Goods(props) {
9254
9303
  disabled: disabled,
9255
9304
  value: img.supplierName,
9256
9305
  onChange: handleChangeValue('supplierName', index)
9257
- })) : null));
9306
+ })) : null, type !== 4 && changeSku ? /*#__PURE__*/React.createElement(Button, {
9307
+ style: {
9308
+ marginTop: '4px'
9309
+ },
9310
+ size: "small",
9311
+ onClick: function onClick() {
9312
+ return checkSkus(img === null || img === void 0 ? void 0 : img.numIid, index);
9313
+ },
9314
+ type: "primary"
9315
+ }, "\u8C03\u6574sku") : null));
9258
9316
  }), imgList.length < maxLength && !disabled ? /*#__PURE__*/React.createElement("div", {
9259
9317
  className: "goods-imgBox",
9260
9318
  onClick: function onClick() {
@@ -9354,8 +9412,10 @@ var GoodItem = function GoodItem(props) {
9354
9412
  while (1) switch (_context.prev = _context.next) {
9355
9413
  case 0:
9356
9414
  shopId = _ref.shopId, numIids = _ref.numIids;
9357
- return _context.abrupt("return", extendRequest('/qy/gdfw/workOrder/queryItemSkus', {
9415
+ return _context.abrupt("return", request$1({
9416
+ url: '/qy/gdfw/workOrder/queryItemSkus',
9358
9417
  method: 'post',
9418
+ handleError: message.error,
9359
9419
  data: {
9360
9420
  shopId: shopId,
9361
9421
  numIids: numIids
@@ -9384,25 +9444,31 @@ var GoodItem = function GoodItem(props) {
9384
9444
  };
9385
9445
  //选择sku
9386
9446
  var handleSelectSku = function handleSelectSku(_ref3) {
9387
- var enableItemId = _ref3.enableItemId,
9447
+ var numIndex = _ref3.numIndex,
9448
+ code = _ref3.code,
9449
+ enableItemId = _ref3.enableItemId,
9388
9450
  enableSupplierName = _ref3.enableSupplierName,
9389
9451
  propertiesName = _ref3.propertiesName,
9390
9452
  picUrl = _ref3.picUrl,
9391
9453
  outerSkuId = _ref3.outerSkuId,
9392
9454
  skuId = _ref3.skuId;
9455
+ if (numIndex < 0) return;
9393
9456
  var newList = JSON.parse(JSON.stringify(imgList));
9394
9457
  if (type === 4) {
9395
- newList[newList.length - 1].itemId = enableItemId;
9396
- newList[newList.length - 1].supplierName = enableSupplierName;
9458
+ newList[numIndex].itemId = enableItemId;
9459
+ newList[numIndex].supplierName = enableSupplierName;
9397
9460
  } else {
9398
- newList[newList.length - 1].propertiesName = propertiesName;
9461
+ newList[numIndex].propertiesName = propertiesName;
9399
9462
  }
9400
9463
  if (type === 1) {
9401
- if (outerSkuId) newList[newList.length - 1].outerSkuId = outerSkuId;
9402
- if (skuId) newList[newList.length - 1].skuId = skuId;
9464
+ if (outerSkuId) newList[numIndex].outerSkuId = outerSkuId;
9465
+ if (skuId) newList[numIndex].skuId = skuId;
9466
+ }
9467
+ if (type === 1 && code) {
9468
+ newList[numIndex].outerId = code;
9403
9469
  }
9404
9470
  //替换成sku的图片
9405
- picUrl && (newList[newList.length - 1].picUrl = picUrl);
9471
+ picUrl && (newList[numIndex].picUrl = picUrl);
9406
9472
  onChange === null || onChange === void 0 ? void 0 : onChange({
9407
9473
  shopId: shopId,
9408
9474
  imgList: newList
@@ -9411,7 +9477,8 @@ var GoodItem = function GoodItem(props) {
9411
9477
  //选择回调
9412
9478
  var onSubmit = /*#__PURE__*/function () {
9413
9479
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(list) {
9414
- var newList, newImgList, _yield$querySkus, data, _skuRef$current, options;
9480
+ var _list$;
9481
+ var newList, newImgList;
9415
9482
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9416
9483
  while (1) switch (_context2.prev = _context2.next) {
9417
9484
  case 0:
@@ -9451,22 +9518,45 @@ var GoodItem = function GoodItem(props) {
9451
9518
  imgList: newImgList
9452
9519
  });
9453
9520
  setVisible(false);
9454
- //供应上编码组件 || 商品组件且可以选择sku
9455
- if (!(type === 4 && (enableItemId || enableSupplierName) || type !== 4 && changeSku && list.length > 0)) {
9456
- _context2.next = 10;
9521
+ checkSkus(list === null || list === void 0 ? void 0 : (_list$ = list[0]) === null || _list$ === void 0 ? void 0 : _list$.numIid, newImgList.length - 1);
9522
+ case 5:
9523
+ case "end":
9524
+ return _context2.stop();
9525
+ }
9526
+ }, _callee2);
9527
+ }));
9528
+ return function onSubmit(_x2) {
9529
+ return _ref4.apply(this, arguments);
9530
+ };
9531
+ }();
9532
+ var checkSkus = /*#__PURE__*/function () {
9533
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(numIid, index) {
9534
+ var res, data, _skuRef$current, options;
9535
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
9536
+ while (1) switch (_context3.prev = _context3.next) {
9537
+ case 0:
9538
+ if (numIid) {
9539
+ _context3.next = 2;
9457
9540
  break;
9458
9541
  }
9459
- _context2.next = 7;
9542
+ return _context3.abrupt("return");
9543
+ case 2:
9544
+ if (!(type === 4 && (enableItemId || enableSupplierName) || type !== 4 && changeSku)) {
9545
+ _context3.next = 8;
9546
+ break;
9547
+ }
9548
+ _context3.next = 5;
9460
9549
  return querySkus({
9461
9550
  shopId: shopId,
9462
- numIids: list[0].numIid
9463
- });
9464
- case 7:
9465
- _yield$querySkus = _context2.sent;
9466
- data = _yield$querySkus.data;
9551
+ numIids: numIid
9552
+ }).catch(console.debug);
9553
+ case 5:
9554
+ res = _context3.sent;
9555
+ data = (res === null || res === void 0 ? void 0 : res.success) && (res === null || res === void 0 ? void 0 : res.data);
9467
9556
  if (data && data.length > 0 && data[0]['skus'] && data[0]['skus']['length'] > 0) {
9468
9557
  options = data[0]['skus'].map(function (item) {
9469
9558
  return {
9559
+ code: item.code,
9470
9560
  label: isTaobaoPlat ? item.propertiesName.split(';').map(function (i) {
9471
9561
  return i.split(':').slice(2);
9472
9562
  }).join(';') : item.propertiesName,
@@ -9477,19 +9567,20 @@ var GoodItem = function GoodItem(props) {
9477
9567
  };
9478
9568
  });
9479
9569
  (_skuRef$current = skuRef.current) === null || _skuRef$current === void 0 ? void 0 : _skuRef$current.open({
9570
+ index: index,
9480
9571
  shopId: shopId,
9481
- numIids: list[0].numIid,
9572
+ numIids: numIid,
9482
9573
  options: options
9483
9574
  });
9484
9575
  }
9485
- case 10:
9576
+ case 8:
9486
9577
  case "end":
9487
- return _context2.stop();
9578
+ return _context3.stop();
9488
9579
  }
9489
- }, _callee2);
9580
+ }, _callee3);
9490
9581
  }));
9491
- return function onSubmit(_x2) {
9492
- return _ref4.apply(this, arguments);
9582
+ return function checkSkus(_x3, _x4) {
9583
+ return _ref5.apply(this, arguments);
9493
9584
  };
9494
9585
  }();
9495
9586
  var headerList = showHeader || {
@@ -9574,7 +9665,16 @@ var GoodItem = function GoodItem(props) {
9574
9665
  src: img.picUrl || defaultImg,
9575
9666
  className: "img",
9576
9667
  alt: ""
9577
- }))), /*#__PURE__*/React.createElement("div", {
9668
+ })), type !== 4 && changeSku ? /*#__PURE__*/React.createElement(Button, {
9669
+ style: {
9670
+ marginTop: '4px'
9671
+ },
9672
+ size: "small",
9673
+ onClick: function onClick() {
9674
+ return checkSkus(img === null || img === void 0 ? void 0 : img.numIid, index);
9675
+ },
9676
+ type: "primary"
9677
+ }, "\u8C03\u6574sku") : null), /*#__PURE__*/React.createElement("div", {
9578
9678
  className: "good-attrs",
9579
9679
  key: "".concat(img.picUrl, "-").concat(index, "-context")
9580
9680
  }, goodItemAttrs.map(function (item) {
@@ -9589,7 +9689,16 @@ var GoodItem = function GoodItem(props) {
9589
9689
  disabled: item.disabled || disabled,
9590
9690
  onChange: handleChangeValue(item.key, index)
9591
9691
  }));
9592
- })));
9692
+ }), !hasPic && type !== 4 && changeSku ? /*#__PURE__*/React.createElement(Button, {
9693
+ style: {
9694
+ marginTop: '4px'
9695
+ },
9696
+ size: "small",
9697
+ onClick: function onClick() {
9698
+ return checkSkus(img === null || img === void 0 ? void 0 : img.numIid, index);
9699
+ },
9700
+ type: "primary"
9701
+ }, "\u8C03\u6574sku") : null));
9593
9702
  }), imgList.length < maxLength && !disabled ? /*#__PURE__*/React.createElement("div", {
9594
9703
  className: "goods-imgBox",
9595
9704
  onClick: function onClick() {
package/dist/index.js CHANGED
@@ -8854,15 +8854,21 @@ var Sku = /*#__PURE__*/React.forwardRef(function (props, ref) {
8854
8854
  _useState8 = _slicedToArray(_useState7, 2),
8855
8855
  numIids = _useState8[0],
8856
8856
  setNumIids = _useState8[1];
8857
+ var _useState9 = React.useState(-1),
8858
+ _useState10 = _slicedToArray(_useState9, 2),
8859
+ numIndex = _useState10[0],
8860
+ setNumIndex = _useState10[1];
8857
8861
  React.useImperativeHandle(ref, function () {
8858
8862
  return {
8859
8863
  open: function open(_ref) {
8860
8864
  var numIids = _ref.numIids,
8861
- options = _ref.options;
8865
+ options = _ref.options,
8866
+ index = _ref.index;
8862
8867
  setVisible(true);
8863
8868
  setSku('');
8864
8869
  setNumIids(numIids);
8865
8870
  setOptions(options);
8871
+ setNumIndex(typeof index === 'number' ? index : -1);
8866
8872
  },
8867
8873
  close: function close() {
8868
8874
  setVisible(false);
@@ -8871,7 +8877,7 @@ var Sku = /*#__PURE__*/React.forwardRef(function (props, ref) {
8871
8877
  });
8872
8878
  var handleSure = /*#__PURE__*/function () {
8873
8879
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8874
- var type, SKU, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _yield$request, _yield$request$data, data;
8880
+ var type, SKU, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _yield$request, _yield$request$data, data;
8875
8881
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8876
8882
  while (1) switch (_context.prev = _context.next) {
8877
8883
  case 0:
@@ -8881,6 +8887,7 @@ var Sku = /*#__PURE__*/React.forwardRef(function (props, ref) {
8881
8887
  break;
8882
8888
  }
8883
8889
  props.handleOk({
8890
+ numIndex: -1,
8884
8891
  enableItemId: '',
8885
8892
  enableSupplierName: '',
8886
8893
  propertiesName: ''
@@ -8896,20 +8903,24 @@ var Sku = /*#__PURE__*/React.forwardRef(function (props, ref) {
8896
8903
  break;
8897
8904
  }
8898
8905
  props.handleOk({
8906
+ numIndex: numIndex,
8907
+ code: ((_ref3 = SKU || {
8908
+ code: ''
8909
+ }) === null || _ref3 === void 0 ? void 0 : _ref3.code) || '',
8899
8910
  enableItemId: '',
8900
8911
  enableSupplierName: '',
8901
- propertiesName: ((_ref3 = SKU || {
8912
+ propertiesName: ((_ref4 = SKU || {
8902
8913
  label: ''
8903
- }) === null || _ref3 === void 0 ? void 0 : _ref3.label) || '',
8904
- picUrl: (_ref4 = SKU || {
8914
+ }) === null || _ref4 === void 0 ? void 0 : _ref4.label) || '',
8915
+ picUrl: (_ref5 = SKU || {
8905
8916
  picUrl: ''
8906
- }) === null || _ref4 === void 0 ? void 0 : _ref4.picUrl,
8907
- outerSkuId: (_ref5 = SKU || {
8917
+ }) === null || _ref5 === void 0 ? void 0 : _ref5.picUrl,
8918
+ outerSkuId: (_ref6 = SKU || {
8908
8919
  outerSkuId: ''
8909
- }) === null || _ref5 === void 0 ? void 0 : _ref5.outerSkuId,
8910
- skuId: ((_ref6 = SKU || {
8920
+ }) === null || _ref6 === void 0 ? void 0 : _ref6.outerSkuId,
8921
+ skuId: ((_ref7 = SKU || {
8911
8922
  skuId: ''
8912
- }) === null || _ref6 === void 0 ? void 0 : _ref6.skuId) || ''
8923
+ }) === null || _ref7 === void 0 ? void 0 : _ref7.skuId) || ''
8913
8924
  });
8914
8925
  _context.next = 16;
8915
8926
  break;
@@ -8928,17 +8939,21 @@ var Sku = /*#__PURE__*/React.forwardRef(function (props, ref) {
8928
8939
  _yield$request$data = _yield$request.data;
8929
8940
  data = _yield$request$data === void 0 ? [] : _yield$request$data;
8930
8941
  props.handleOk({
8942
+ numIndex: numIndex,
8943
+ code: ((_ref8 = SKU || {
8944
+ code: ''
8945
+ }) === null || _ref8 === void 0 ? void 0 : _ref8.code) || '',
8931
8946
  enableItemId: data.length > 0 ? data[0]['supplierItemOuterId'] : '',
8932
8947
  enableSupplierName: data.length > 0 ? data[0]['supplierName'] : '',
8933
- propertiesName: ((_ref7 = SKU || {
8948
+ propertiesName: ((_ref9 = SKU || {
8934
8949
  label: ''
8935
- }) === null || _ref7 === void 0 ? void 0 : _ref7.label) || '',
8936
- picUrl: (_ref8 = SKU || {
8950
+ }) === null || _ref9 === void 0 ? void 0 : _ref9.label) || '',
8951
+ picUrl: (_ref10 = SKU || {
8937
8952
  picUrl: ''
8938
- }) === null || _ref8 === void 0 ? void 0 : _ref8.picUrl,
8939
- skuId: ((_ref9 = SKU || {
8953
+ }) === null || _ref10 === void 0 ? void 0 : _ref10.picUrl,
8954
+ skuId: ((_ref11 = SKU || {
8940
8955
  skuId: ''
8941
- }) === null || _ref9 === void 0 ? void 0 : _ref9.skuId) || ''
8956
+ }) === null || _ref11 === void 0 ? void 0 : _ref11.skuId) || ''
8942
8957
  });
8943
8958
  case 16:
8944
8959
  setVisible(false);
@@ -9035,8 +9050,10 @@ var Goods = function Goods(props) {
9035
9050
  while (1) switch (_context.prev = _context.next) {
9036
9051
  case 0:
9037
9052
  shopId = _ref.shopId, numIids = _ref.numIids;
9038
- return _context.abrupt("return", extendRequest('/qy/gdfw/workOrder/queryItemSkus', {
9053
+ return _context.abrupt("return", kmkfUtils.request({
9054
+ url: '/qy/gdfw/workOrder/queryItemSkus',
9039
9055
  method: 'post',
9056
+ handleError: antd.message.error,
9040
9057
  data: {
9041
9058
  shopId: shopId,
9042
9059
  numIids: numIids
@@ -9068,23 +9085,29 @@ var Goods = function Goods(props) {
9068
9085
  };
9069
9086
  //选择sku
9070
9087
  var handleSelectSku = function handleSelectSku(_ref3) {
9071
- var enableItemId = _ref3.enableItemId,
9088
+ var numIndex = _ref3.numIndex,
9089
+ code = _ref3.code,
9090
+ enableItemId = _ref3.enableItemId,
9072
9091
  enableSupplierName = _ref3.enableSupplierName,
9073
9092
  propertiesName = _ref3.propertiesName,
9074
9093
  picUrl = _ref3.picUrl,
9075
9094
  outerSkuId = _ref3.outerSkuId;
9095
+ if (numIndex < 0) return;
9076
9096
  var newList = JSON.parse(JSON.stringify(imgList));
9077
9097
  if (type === 4) {
9078
- newList[newList.length - 1].itemId = enableItemId;
9079
- newList[newList.length - 1].supplierName = enableSupplierName;
9098
+ newList[numIndex].itemId = enableItemId;
9099
+ newList[numIndex].supplierName = enableSupplierName;
9080
9100
  } else {
9081
- newList[newList.length - 1].propertiesName = propertiesName;
9101
+ newList[numIndex].propertiesName = propertiesName;
9082
9102
  }
9083
9103
  if (type === 1 && outerSkuId) {
9084
- newList[newList.length - 1].outerId = outerSkuId;
9104
+ newList[numIndex].outerId = outerSkuId;
9105
+ }
9106
+ if (type === 1 && code) {
9107
+ newList[numIndex].outerId = code;
9085
9108
  }
9086
9109
  //替换成sku的图片
9087
- picUrl && (newList[newList.length - 1].picUrl = picUrl);
9110
+ picUrl && (newList[numIndex].picUrl = picUrl);
9088
9111
  var newValue = {
9089
9112
  shopId: shopId,
9090
9113
  imgList: newList
@@ -9094,7 +9117,8 @@ var Goods = function Goods(props) {
9094
9117
  //选择回调
9095
9118
  var onSubmit = /*#__PURE__*/function () {
9096
9119
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(list) {
9097
- var newList, newImgList, newValue, _yield$querySkus, data, _skuRef$current, options;
9120
+ var _list$;
9121
+ var newList, newImgList, newValue;
9098
9122
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9099
9123
  while (1) switch (_context2.prev = _context2.next) {
9100
9124
  case 0:
@@ -9133,22 +9157,45 @@ var Goods = function Goods(props) {
9133
9157
  setUploadImageCount(newImgList.length);
9134
9158
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, newValue));
9135
9159
  setVisible(false);
9136
- //供应上编码组件 || 商品组件且可以选择sku
9137
- if (!(type === 4 && (enableItemId || enableSupplierName) || type !== 4 && changeSku && list.length > 0)) {
9138
- _context2.next = 12;
9160
+ checkSkus(list === null || list === void 0 ? void 0 : (_list$ = list[0]) === null || _list$ === void 0 ? void 0 : _list$.numIid, newImgList.length - 1);
9161
+ case 7:
9162
+ case "end":
9163
+ return _context2.stop();
9164
+ }
9165
+ }, _callee2);
9166
+ }));
9167
+ return function onSubmit(_x2) {
9168
+ return _ref4.apply(this, arguments);
9169
+ };
9170
+ }();
9171
+ var checkSkus = /*#__PURE__*/function () {
9172
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(numIid, index) {
9173
+ var res, data, _skuRef$current, options;
9174
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
9175
+ while (1) switch (_context3.prev = _context3.next) {
9176
+ case 0:
9177
+ if (numIid) {
9178
+ _context3.next = 2;
9139
9179
  break;
9140
9180
  }
9141
- _context2.next = 9;
9181
+ return _context3.abrupt("return");
9182
+ case 2:
9183
+ if (!(type === 4 && (enableItemId || enableSupplierName) || type !== 4 && changeSku)) {
9184
+ _context3.next = 8;
9185
+ break;
9186
+ }
9187
+ _context3.next = 5;
9142
9188
  return querySkus({
9143
9189
  shopId: shopId,
9144
- numIids: list[0].numIid
9145
- });
9146
- case 9:
9147
- _yield$querySkus = _context2.sent;
9148
- data = _yield$querySkus.data;
9190
+ numIids: numIid
9191
+ }).catch(console.debug);
9192
+ case 5:
9193
+ res = _context3.sent;
9194
+ data = (res === null || res === void 0 ? void 0 : res.success) && (res === null || res === void 0 ? void 0 : res.data);
9149
9195
  if (data && data.length > 0 && data[0]['skus'] && data[0]['skus']['length'] > 0) {
9150
9196
  options = data[0]['skus'].map(function (item) {
9151
9197
  return {
9198
+ code: item.code,
9152
9199
  label: isTaobaoPlat ? item.propertiesName.split(';').map(function (i) {
9153
9200
  return i.split(':').slice(2);
9154
9201
  }).join(';') : item.propertiesName,
@@ -9158,19 +9205,20 @@ var Goods = function Goods(props) {
9158
9205
  };
9159
9206
  });
9160
9207
  (_skuRef$current = skuRef.current) === null || _skuRef$current === void 0 ? void 0 : _skuRef$current.open({
9208
+ index: index,
9161
9209
  shopId: shopId,
9162
- numIids: list[0].numIid,
9210
+ numIids: numIid,
9163
9211
  options: options
9164
9212
  });
9165
9213
  }
9166
- case 12:
9214
+ case 8:
9167
9215
  case "end":
9168
- return _context2.stop();
9216
+ return _context3.stop();
9169
9217
  }
9170
- }, _callee2);
9218
+ }, _callee3);
9171
9219
  }));
9172
- return function onSubmit(_x2) {
9173
- return _ref4.apply(this, arguments);
9220
+ return function checkSkus(_x3, _x4) {
9221
+ return _ref5.apply(this, arguments);
9174
9222
  };
9175
9223
  }();
9176
9224
  //修改参数
@@ -9197,7 +9245,8 @@ var Goods = function Goods(props) {
9197
9245
  className: "goodsBox ".concat(goodsBoxClassName)
9198
9246
  }, imgList === null || imgList === void 0 ? void 0 : imgList.map(function (img, index) {
9199
9247
  return /*#__PURE__*/React__default['default'].createElement("div", {
9200
- className: "goodBox-Img"
9248
+ className: "goodBox-Img",
9249
+ key: "".concat(img.numIid, "_").concat(index)
9201
9250
  }, /*#__PURE__*/React__default['default'].createElement("div", {
9202
9251
  className: "goods-imgBox",
9203
9252
  key: img.picUrl + '-goods'
@@ -9266,7 +9315,16 @@ var Goods = function Goods(props) {
9266
9315
  disabled: disabled,
9267
9316
  value: img.supplierName,
9268
9317
  onChange: handleChangeValue('supplierName', index)
9269
- })) : null));
9318
+ })) : null, type !== 4 && changeSku ? /*#__PURE__*/React__default['default'].createElement(antd.Button, {
9319
+ style: {
9320
+ marginTop: '4px'
9321
+ },
9322
+ size: "small",
9323
+ onClick: function onClick() {
9324
+ return checkSkus(img === null || img === void 0 ? void 0 : img.numIid, index);
9325
+ },
9326
+ type: "primary"
9327
+ }, "\u8C03\u6574sku") : null));
9270
9328
  }), imgList.length < maxLength && !disabled ? /*#__PURE__*/React__default['default'].createElement("div", {
9271
9329
  className: "goods-imgBox",
9272
9330
  onClick: function onClick() {
@@ -9366,8 +9424,10 @@ var GoodItem = function GoodItem(props) {
9366
9424
  while (1) switch (_context.prev = _context.next) {
9367
9425
  case 0:
9368
9426
  shopId = _ref.shopId, numIids = _ref.numIids;
9369
- return _context.abrupt("return", extendRequest('/qy/gdfw/workOrder/queryItemSkus', {
9427
+ return _context.abrupt("return", kmkfUtils.request({
9428
+ url: '/qy/gdfw/workOrder/queryItemSkus',
9370
9429
  method: 'post',
9430
+ handleError: antd.message.error,
9371
9431
  data: {
9372
9432
  shopId: shopId,
9373
9433
  numIids: numIids
@@ -9396,25 +9456,31 @@ var GoodItem = function GoodItem(props) {
9396
9456
  };
9397
9457
  //选择sku
9398
9458
  var handleSelectSku = function handleSelectSku(_ref3) {
9399
- var enableItemId = _ref3.enableItemId,
9459
+ var numIndex = _ref3.numIndex,
9460
+ code = _ref3.code,
9461
+ enableItemId = _ref3.enableItemId,
9400
9462
  enableSupplierName = _ref3.enableSupplierName,
9401
9463
  propertiesName = _ref3.propertiesName,
9402
9464
  picUrl = _ref3.picUrl,
9403
9465
  outerSkuId = _ref3.outerSkuId,
9404
9466
  skuId = _ref3.skuId;
9467
+ if (numIndex < 0) return;
9405
9468
  var newList = JSON.parse(JSON.stringify(imgList));
9406
9469
  if (type === 4) {
9407
- newList[newList.length - 1].itemId = enableItemId;
9408
- newList[newList.length - 1].supplierName = enableSupplierName;
9470
+ newList[numIndex].itemId = enableItemId;
9471
+ newList[numIndex].supplierName = enableSupplierName;
9409
9472
  } else {
9410
- newList[newList.length - 1].propertiesName = propertiesName;
9473
+ newList[numIndex].propertiesName = propertiesName;
9411
9474
  }
9412
9475
  if (type === 1) {
9413
- if (outerSkuId) newList[newList.length - 1].outerSkuId = outerSkuId;
9414
- if (skuId) newList[newList.length - 1].skuId = skuId;
9476
+ if (outerSkuId) newList[numIndex].outerSkuId = outerSkuId;
9477
+ if (skuId) newList[numIndex].skuId = skuId;
9478
+ }
9479
+ if (type === 1 && code) {
9480
+ newList[numIndex].outerId = code;
9415
9481
  }
9416
9482
  //替换成sku的图片
9417
- picUrl && (newList[newList.length - 1].picUrl = picUrl);
9483
+ picUrl && (newList[numIndex].picUrl = picUrl);
9418
9484
  onChange === null || onChange === void 0 ? void 0 : onChange({
9419
9485
  shopId: shopId,
9420
9486
  imgList: newList
@@ -9423,7 +9489,8 @@ var GoodItem = function GoodItem(props) {
9423
9489
  //选择回调
9424
9490
  var onSubmit = /*#__PURE__*/function () {
9425
9491
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(list) {
9426
- var newList, newImgList, _yield$querySkus, data, _skuRef$current, options;
9492
+ var _list$;
9493
+ var newList, newImgList;
9427
9494
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9428
9495
  while (1) switch (_context2.prev = _context2.next) {
9429
9496
  case 0:
@@ -9463,22 +9530,45 @@ var GoodItem = function GoodItem(props) {
9463
9530
  imgList: newImgList
9464
9531
  });
9465
9532
  setVisible(false);
9466
- //供应上编码组件 || 商品组件且可以选择sku
9467
- if (!(type === 4 && (enableItemId || enableSupplierName) || type !== 4 && changeSku && list.length > 0)) {
9468
- _context2.next = 10;
9533
+ checkSkus(list === null || list === void 0 ? void 0 : (_list$ = list[0]) === null || _list$ === void 0 ? void 0 : _list$.numIid, newImgList.length - 1);
9534
+ case 5:
9535
+ case "end":
9536
+ return _context2.stop();
9537
+ }
9538
+ }, _callee2);
9539
+ }));
9540
+ return function onSubmit(_x2) {
9541
+ return _ref4.apply(this, arguments);
9542
+ };
9543
+ }();
9544
+ var checkSkus = /*#__PURE__*/function () {
9545
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(numIid, index) {
9546
+ var res, data, _skuRef$current, options;
9547
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
9548
+ while (1) switch (_context3.prev = _context3.next) {
9549
+ case 0:
9550
+ if (numIid) {
9551
+ _context3.next = 2;
9469
9552
  break;
9470
9553
  }
9471
- _context2.next = 7;
9554
+ return _context3.abrupt("return");
9555
+ case 2:
9556
+ if (!(type === 4 && (enableItemId || enableSupplierName) || type !== 4 && changeSku)) {
9557
+ _context3.next = 8;
9558
+ break;
9559
+ }
9560
+ _context3.next = 5;
9472
9561
  return querySkus({
9473
9562
  shopId: shopId,
9474
- numIids: list[0].numIid
9475
- });
9476
- case 7:
9477
- _yield$querySkus = _context2.sent;
9478
- data = _yield$querySkus.data;
9563
+ numIids: numIid
9564
+ }).catch(console.debug);
9565
+ case 5:
9566
+ res = _context3.sent;
9567
+ data = (res === null || res === void 0 ? void 0 : res.success) && (res === null || res === void 0 ? void 0 : res.data);
9479
9568
  if (data && data.length > 0 && data[0]['skus'] && data[0]['skus']['length'] > 0) {
9480
9569
  options = data[0]['skus'].map(function (item) {
9481
9570
  return {
9571
+ code: item.code,
9482
9572
  label: isTaobaoPlat ? item.propertiesName.split(';').map(function (i) {
9483
9573
  return i.split(':').slice(2);
9484
9574
  }).join(';') : item.propertiesName,
@@ -9489,19 +9579,20 @@ var GoodItem = function GoodItem(props) {
9489
9579
  };
9490
9580
  });
9491
9581
  (_skuRef$current = skuRef.current) === null || _skuRef$current === void 0 ? void 0 : _skuRef$current.open({
9582
+ index: index,
9492
9583
  shopId: shopId,
9493
- numIids: list[0].numIid,
9584
+ numIids: numIid,
9494
9585
  options: options
9495
9586
  });
9496
9587
  }
9497
- case 10:
9588
+ case 8:
9498
9589
  case "end":
9499
- return _context2.stop();
9590
+ return _context3.stop();
9500
9591
  }
9501
- }, _callee2);
9592
+ }, _callee3);
9502
9593
  }));
9503
- return function onSubmit(_x2) {
9504
- return _ref4.apply(this, arguments);
9594
+ return function checkSkus(_x3, _x4) {
9595
+ return _ref5.apply(this, arguments);
9505
9596
  };
9506
9597
  }();
9507
9598
  var headerList = showHeader || {
@@ -9586,7 +9677,16 @@ var GoodItem = function GoodItem(props) {
9586
9677
  src: img.picUrl || defaultImg,
9587
9678
  className: "img",
9588
9679
  alt: ""
9589
- }))), /*#__PURE__*/React__default['default'].createElement("div", {
9680
+ })), type !== 4 && changeSku ? /*#__PURE__*/React__default['default'].createElement(antd.Button, {
9681
+ style: {
9682
+ marginTop: '4px'
9683
+ },
9684
+ size: "small",
9685
+ onClick: function onClick() {
9686
+ return checkSkus(img === null || img === void 0 ? void 0 : img.numIid, index);
9687
+ },
9688
+ type: "primary"
9689
+ }, "\u8C03\u6574sku") : null), /*#__PURE__*/React__default['default'].createElement("div", {
9590
9690
  className: "good-attrs",
9591
9691
  key: "".concat(img.picUrl, "-").concat(index, "-context")
9592
9692
  }, goodItemAttrs.map(function (item) {
@@ -9601,7 +9701,16 @@ var GoodItem = function GoodItem(props) {
9601
9701
  disabled: item.disabled || disabled,
9602
9702
  onChange: handleChangeValue(item.key, index)
9603
9703
  }));
9604
- })));
9704
+ }), !hasPic && type !== 4 && changeSku ? /*#__PURE__*/React__default['default'].createElement(antd.Button, {
9705
+ style: {
9706
+ marginTop: '4px'
9707
+ },
9708
+ size: "small",
9709
+ onClick: function onClick() {
9710
+ return checkSkus(img === null || img === void 0 ? void 0 : img.numIid, index);
9711
+ },
9712
+ type: "primary"
9713
+ }, "\u8C03\u6574sku") : null));
9605
9714
  }), imgList.length < maxLength && !disabled ? /*#__PURE__*/React__default['default'].createElement("div", {
9606
9715
  className: "goods-imgBox",
9607
9716
  onClick: function onClick() {
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  declare type SkuProps = {
3
3
  handleOk: (sku: {
4
+ numIndex: number;
5
+ code?: string;
4
6
  enableItemId: string;
5
7
  enableSupplierName: string;
6
8
  propertiesName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "1.8.0-beta.2",
3
+ "version": "1.8.0-beta.3",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "ad9af1207ecf285f157e3d74d916255ee368ea9c"
68
+ "gitHead": "9b8a08d2903221ffe9aacb2c18953dc165e30851"
69
69
  }