@kmkf-fe-packages/basic-components 0.22.1-alpha.0 → 0.23.0-alpha.0

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
@@ -1,9 +1,9 @@
1
1
  import React, { useRef, useState, useEffect, forwardRef, useImperativeHandle, useMemo } from 'react';
2
- import { Cascader, DatePicker, InputNumber, Input, Select, Upload, Image, message, Radio, Space, Spin, Modal, Button, Checkbox, Row, Col, Slider, Rate, Form, Tabs, ConfigProvider, Pagination, Popover, Table } from 'antd';
2
+ import { Cascader, DatePicker, InputNumber, Input, Select, Upload, Image, message, Radio, Space, Spin, Modal, Button, Checkbox, Row, Col, Slider, Rate, Form, Tabs, ConfigProvider, Pagination, Table, Popover } from 'antd';
3
3
  import { EyeOutlined, DeleteOutlined } from '@ant-design/icons';
4
4
  import request, { extend as extend$1 } from 'umi-request';
5
5
  import { CopyToClipboard } from 'react-copy-to-clipboard';
6
- import { AddressData, BsAddressData, request as request$1, ExpressData, LogisticsAddressData, uuid } from '@kmkf-fe-packages/kmkf-utils';
6
+ import { AddressData, BsAddressData, request as request$1, ExpressData, uuid, LogisticsAddressData } from '@kmkf-fe-packages/kmkf-utils';
7
7
  import zhCN from 'antd/lib/locale/zh_CN';
8
8
  import pubsub from 'pubsub-js';
9
9
  import { cloneDeep } from 'lodash';
@@ -357,6 +357,15 @@ function _regeneratorRuntime() {
357
357
  }
358
358
  }, exports;
359
359
  }
360
+ function _typeof(obj) {
361
+ "@babel/helpers - typeof";
362
+
363
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
364
+ return typeof obj;
365
+ } : function (obj) {
366
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
367
+ }, _typeof(obj);
368
+ }
360
369
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
361
370
  try {
362
371
  var info = gen[key](arg);
@@ -7924,7 +7933,9 @@ var GoodsModal = function GoodsModal(props) {
7924
7933
  maxLength = props.maxLength,
7925
7934
  shopList = props.shopList,
7926
7935
  changeSku = props.changeSku,
7927
- width = props.width;
7936
+ width = props.width,
7937
+ _props$numIidType = props.numIidType,
7938
+ numIidType = _props$numIidType === void 0 ? 'string' : _props$numIidType;
7928
7939
  var _useState = useState([]),
7929
7940
  _useState2 = _slicedToArray(_useState, 2),
7930
7941
  selectList = _useState2[0],
@@ -7941,6 +7952,25 @@ var GoodsModal = function GoodsModal(props) {
7941
7952
  _useState8 = _slicedToArray(_useState7, 2),
7942
7953
  loading = _useState8[0],
7943
7954
  setLoading = _useState8[1];
7955
+ var transformIdType = function transformIdType(id) {
7956
+ if (!['string', 'number'].includes(_typeof(id))) return id;
7957
+ return numIidType === 'string' ? id + '' : +id;
7958
+ };
7959
+ var transformType = function transformType(item) {
7960
+ if (!(item === null || item === void 0 ? void 0 : item.numIid)) return item;
7961
+ return _objectSpread2(_objectSpread2({}, item), {}, {
7962
+ numIid: transformIdType(item.numIid)
7963
+ });
7964
+ };
7965
+ var handleSetSelect = function handleSetSelect(list) {
7966
+ return setSelect(list.map(transformType));
7967
+ };
7968
+ var handleSelectIds = function handleSelectIds(list) {
7969
+ return setSelectIds(list.map(transformIdType));
7970
+ };
7971
+ var handleSetGoodList = function handleSetGoodList(list) {
7972
+ return setGoodList(list.map(transformType));
7973
+ };
7944
7974
  var _useState9 = useState({
7945
7975
  apiName: 'queryItems',
7946
7976
  desc: true,
@@ -8034,15 +8064,15 @@ var GoodsModal = function GoodsModal(props) {
8034
8064
  var newSelect = selectList.filter(function (item) {
8035
8065
  return item.numIid !== good.numIid;
8036
8066
  });
8037
- setSelect(_toConsumableArray(newSelect));
8067
+ handleSetSelect(_toConsumableArray(newSelect));
8038
8068
  var ids = newSelect.map(function (item) {
8039
8069
  return item.numIid;
8040
8070
  });
8041
- setSelectIds(ids);
8071
+ handleSelectIds(ids);
8042
8072
  } else {
8043
8073
  if (type === 4 || changeSku) {
8044
- setSelect([good]);
8045
- setSelectIds([good.numIid]);
8074
+ handleSetSelect([good]);
8075
+ handleSelectIds([good.numIid]);
8046
8076
  } else {
8047
8077
  if (selectList.length >= maxLength) {
8048
8078
  message.error("\u6700\u591A\u6DFB\u52A0".concat(maxLength, "\u5F20"));
@@ -8055,14 +8085,14 @@ var GoodsModal = function GoodsModal(props) {
8055
8085
  var newSelectList = selectList.filter(function (item) {
8056
8086
  return item.numIid !== good.numIid;
8057
8087
  });
8058
- setSelect(newSelectList);
8088
+ handleSetSelect(newSelectList);
8059
8089
  var _ids = newSelectList.map(function (item) {
8060
8090
  return item.numIid;
8061
8091
  });
8062
- setSelectIds(_ids);
8092
+ handleSelectIds(_ids);
8063
8093
  } else {
8064
- setSelect([].concat(_toConsumableArray(selectList), [good]));
8065
- setSelectIds([].concat(_toConsumableArray(selectIds), [good.numIid]));
8094
+ handleSetSelect([].concat(_toConsumableArray(selectList), [good]));
8095
+ handleSelectIds([].concat(_toConsumableArray(selectIds), [good.numIid]));
8066
8096
  }
8067
8097
  }
8068
8098
  }
@@ -8154,7 +8184,7 @@ var GoodsModal = function GoodsModal(props) {
8154
8184
  items.forEach(function (item) {
8155
8185
  item.platform = platform;
8156
8186
  });
8157
- setGoodList(_toConsumableArray(items));
8187
+ handleSetGoodList(_toConsumableArray(items));
8158
8188
  setTotal(totalCount);
8159
8189
  _context.next = 26;
8160
8190
  break;
@@ -8182,7 +8212,7 @@ var GoodsModal = function GoodsModal(props) {
8182
8212
  item.title = item.productName;
8183
8213
  item.platform = platform;
8184
8214
  });
8185
- setGoodList(_toConsumableArray(newList));
8215
+ handleSetGoodList(_toConsumableArray(newList));
8186
8216
  setTotal(_total);
8187
8217
  if (platform === 'sph' && nextKey && !nextKeyList.includes(nextKey)) {
8188
8218
  setNextKeyList([].concat(_toConsumableArray(nextKeyList), [nextKey]));
@@ -8268,12 +8298,12 @@ var GoodsModal = function GoodsModal(props) {
8268
8298
  useEffect(function () {
8269
8299
  setPlatformHandle(platform);
8270
8300
  if (imgList.length) {
8271
- setSelect(imgList);
8301
+ handleSetSelect(imgList);
8272
8302
  var ids = imgList === null || imgList === void 0 ? void 0 : imgList.map(function (item) {
8273
8303
  return item.numIid;
8274
8304
  });
8275
8305
  if (!(changeSku || type === 4)) {
8276
- setSelectIds(ids);
8306
+ handleSelectIds(ids);
8277
8307
  }
8278
8308
  }
8279
8309
  }, [platform]);
@@ -8371,9 +8401,9 @@ var GoodsModal = function GoodsModal(props) {
8371
8401
  spinning: loading
8372
8402
  }, /*#__PURE__*/React.createElement("div", {
8373
8403
  className: "goodsMain"
8374
- }, (searchParams.type == 'select' ? selectList : goodList).map(function (good) {
8404
+ }, (searchParams.type == 'select' ? selectList : goodList).map(function (good, index) {
8375
8405
  return /*#__PURE__*/React.createElement("div", {
8376
- key: good.numIid,
8406
+ key: good.numIid + "".concat(index),
8377
8407
  className: "goodItem ".concat(selectIds.includes(good.numIid) ? 'active' : ''),
8378
8408
  onClick: function onClick() {
8379
8409
  changeItem(good);
@@ -8435,7 +8465,7 @@ var Sku = /*#__PURE__*/forwardRef(function (props, ref) {
8435
8465
  });
8436
8466
  var handleSure = /*#__PURE__*/function () {
8437
8467
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8438
- var type, SKU, _ref3, _ref4, _ref5, _ref6, _ref7, _yield$request, _yield$request$data, data;
8468
+ var type, SKU, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _yield$request, _yield$request$data, data;
8439
8469
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8440
8470
  while (1) switch (_context.prev = _context.next) {
8441
8471
  case 0:
@@ -8470,7 +8500,10 @@ var Sku = /*#__PURE__*/forwardRef(function (props, ref) {
8470
8500
  }) === null || _ref4 === void 0 ? void 0 : _ref4.picUrl,
8471
8501
  outerSkuId: (_ref5 = SKU || {
8472
8502
  outerSkuId: ''
8473
- }) === null || _ref5 === void 0 ? void 0 : _ref5.outerSkuId
8503
+ }) === null || _ref5 === void 0 ? void 0 : _ref5.outerSkuId,
8504
+ skuId: ((_ref6 = SKU || {
8505
+ skuId: ''
8506
+ }) === null || _ref6 === void 0 ? void 0 : _ref6.skuId) || ''
8474
8507
  });
8475
8508
  _context.next = 16;
8476
8509
  break;
@@ -8491,12 +8524,15 @@ var Sku = /*#__PURE__*/forwardRef(function (props, ref) {
8491
8524
  props.handleOk({
8492
8525
  enableItemId: data.length > 0 ? data[0]['supplierItemOuterId'] : '',
8493
8526
  enableSupplierName: data.length > 0 ? data[0]['supplierName'] : '',
8494
- propertiesName: ((_ref6 = SKU || {
8527
+ propertiesName: ((_ref7 = SKU || {
8495
8528
  label: ''
8496
- }) === null || _ref6 === void 0 ? void 0 : _ref6.label) || '',
8497
- picUrl: (_ref7 = SKU || {
8529
+ }) === null || _ref7 === void 0 ? void 0 : _ref7.label) || '',
8530
+ picUrl: (_ref8 = SKU || {
8498
8531
  picUrl: ''
8499
- }) === null || _ref7 === void 0 ? void 0 : _ref7.picUrl
8532
+ }) === null || _ref8 === void 0 ? void 0 : _ref8.picUrl,
8533
+ skuId: ((_ref9 = SKU || {
8534
+ skuId: ''
8535
+ }) === null || _ref9 === void 0 ? void 0 : _ref9.skuId) || ''
8500
8536
  });
8501
8537
  case 16:
8502
8538
  setVisible(false);
@@ -8874,8 +8910,328 @@ var ChooseBaby = function ChooseBaby(props) {
8874
8910
  }));
8875
8911
  };
8876
8912
 
8913
+ var GoodItem = function GoodItem(props) {
8914
+ var _props$value = props.value,
8915
+ value = _props$value === void 0 ? {
8916
+ shopId: '',
8917
+ imgList: []
8918
+ } : _props$value,
8919
+ _props$maxLength = props.maxLength,
8920
+ maxLength = _props$maxLength === void 0 ? 20 : _props$maxLength,
8921
+ onChange = props.onChange,
8922
+ _props$type = props.type,
8923
+ type = _props$type === void 0 ? 2 : _props$type,
8924
+ _props$shopList = props.shopList,
8925
+ shopList = _props$shopList === void 0 ? [] : _props$shopList,
8926
+ showHeader = props.showHeader,
8927
+ _props$showChangeBtn = props.showChangeBtn,
8928
+ showChangeBtn = _props$showChangeBtn === void 0 ? true : _props$showChangeBtn,
8929
+ otherOperations = props.otherOperations,
8930
+ canUpdateNumber = props.canUpdateNumber,
8931
+ enableItemId = props.enableItemId,
8932
+ enableSupplierName = props.enableSupplierName,
8933
+ userNick = props.userNick,
8934
+ disabled = props.disabled,
8935
+ changeSku = props.changeSku,
8936
+ width = props.width;
8937
+ var shopId = value.shopId,
8938
+ imgList = value.imgList;
8939
+ var _useState = useState(false),
8940
+ _useState2 = _slicedToArray(_useState, 2),
8941
+ visible = _useState2[0],
8942
+ setVisible = _useState2[1];
8943
+ var skuRef = useRef();
8944
+ //是否是淘宝店铺
8945
+ var isTaobaoPlat = useMemo(function () {
8946
+ console.log('shopId', shopId);
8947
+ return shopList.some(function (item) {
8948
+ return item.shopId === shopId && item.shopSourceStr === 'TAOBAO';
8949
+ });
8950
+ }, [shopId]);
8951
+ // 查询SKU
8952
+ var querySkus = /*#__PURE__*/function () {
8953
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
8954
+ var shopId, numIids;
8955
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8956
+ while (1) switch (_context.prev = _context.next) {
8957
+ case 0:
8958
+ shopId = _ref.shopId, numIids = _ref.numIids;
8959
+ return _context.abrupt("return", extendRequest('/qy/gdfw/workOrder/queryItemSkus', {
8960
+ method: 'post',
8961
+ data: {
8962
+ shopId: shopId,
8963
+ numIids: numIids
8964
+ }
8965
+ }));
8966
+ case 2:
8967
+ case "end":
8968
+ return _context.stop();
8969
+ }
8970
+ }, _callee);
8971
+ }));
8972
+ return function querySkus(_x) {
8973
+ return _ref2.apply(this, arguments);
8974
+ };
8975
+ }();
8976
+ //删除行
8977
+ var handleDelete = function handleDelete(record, index) {
8978
+ var newSelect = imgList.filter(function (_, i) {
8979
+ return index !== i;
8980
+ });
8981
+ onChange === null || onChange === void 0 ? void 0 : onChange({
8982
+ shopId: shopId,
8983
+ imgList: _toConsumableArray(newSelect)
8984
+ });
8985
+ };
8986
+ //选择sku
8987
+ var handleSelectSku = function handleSelectSku(_ref3) {
8988
+ var enableItemId = _ref3.enableItemId,
8989
+ enableSupplierName = _ref3.enableSupplierName,
8990
+ propertiesName = _ref3.propertiesName,
8991
+ picUrl = _ref3.picUrl,
8992
+ outerSkuId = _ref3.outerSkuId,
8993
+ skuId = _ref3.skuId;
8994
+ var newList = JSON.parse(JSON.stringify(imgList));
8995
+ if (type === 4) {
8996
+ newList[newList.length - 1].itemId = enableItemId;
8997
+ newList[newList.length - 1].supplierName = enableSupplierName;
8998
+ } else {
8999
+ newList[newList.length - 1].propertiesName = propertiesName;
9000
+ }
9001
+ if (type === 1) {
9002
+ if (outerSkuId) newList[newList.length - 1].outerSkuId = outerSkuId;
9003
+ if (skuId) newList[newList.length - 1].skuId = skuId;
9004
+ }
9005
+ //替换成sku的图片
9006
+ picUrl && (newList[newList.length - 1].picUrl = picUrl);
9007
+ onChange === null || onChange === void 0 ? void 0 : onChange({
9008
+ shopId: shopId,
9009
+ imgList: newList
9010
+ });
9011
+ };
9012
+ //选择回调
9013
+ var onSubmit = /*#__PURE__*/function () {
9014
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(list) {
9015
+ var newList, newImgList, _yield$querySkus, data, _skuRef$current, options;
9016
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9017
+ while (1) switch (_context2.prev = _context2.next) {
9018
+ case 0:
9019
+ console.log('🚀 ~ file: table.tsx:160 ~ onSubmit ~ list:', list);
9020
+ newList = list.map(function (item) {
9021
+ //过滤属性 只保存需要的字段
9022
+ var params = {
9023
+ uuid: uuid(),
9024
+ platform: item.platform,
9025
+ price: item.price,
9026
+ canDelete: true,
9027
+ title: item.title,
9028
+ outerId: item.outerId,
9029
+ picUrl: item.picUrl,
9030
+ numIid: item.numIid,
9031
+ skuId: item.skuId,
9032
+ outerSkuId: item.outerSkuId
9033
+ };
9034
+ // if (type === 1) {
9035
+ // params.outerId = item.outerId; //编码
9036
+ // }
9037
+ if (changeSku) {
9038
+ params.propertiesName = '';
9039
+ }
9040
+ // if (type === 4) {
9041
+ // if (enableItemId) {
9042
+ // params.itemId = '';
9043
+ // }
9044
+ // if (enableSupplierName) {
9045
+ // params.supplierName = '';
9046
+ // }
9047
+ // }
9048
+ return params;
9049
+ });
9050
+ newImgList = changeSku || type === 4 ? [].concat(_toConsumableArray(imgList), _toConsumableArray(newList)) : _toConsumableArray(newList);
9051
+ onChange === null || onChange === void 0 ? void 0 : onChange({
9052
+ shopId: shopId,
9053
+ imgList: newImgList
9054
+ });
9055
+ setVisible(false);
9056
+ //供应上编码组件 || 商品组件且可以选择sku
9057
+ if (!(type === 4 && (enableItemId || enableSupplierName) || type !== 4 && changeSku && isTaobaoPlat && list.length > 0)) {
9058
+ _context2.next = 11;
9059
+ break;
9060
+ }
9061
+ _context2.next = 8;
9062
+ return querySkus({
9063
+ shopId: shopId,
9064
+ numIids: list[0].numIid
9065
+ });
9066
+ case 8:
9067
+ _yield$querySkus = _context2.sent;
9068
+ data = _yield$querySkus.data;
9069
+ if (data.length > 0 && data[0]['skus'] && data[0]['skus']['length'] > 0) {
9070
+ options = data[0]['skus'].map(function (item) {
9071
+ return {
9072
+ label: item.propertiesName.split(';').map(function (i) {
9073
+ return i.split(':').slice(2);
9074
+ }).join(';'),
9075
+ value: item.skuId,
9076
+ picUrl: item.picUrl,
9077
+ outerSkuId: item === null || item === void 0 ? void 0 : item.outerSkuId,
9078
+ skuId: item.skuId
9079
+ };
9080
+ });
9081
+ (_skuRef$current = skuRef.current) === null || _skuRef$current === void 0 ? void 0 : _skuRef$current.open({
9082
+ shopId: shopId,
9083
+ numIids: list[0].numIid,
9084
+ options: options
9085
+ });
9086
+ }
9087
+ case 11:
9088
+ case "end":
9089
+ return _context2.stop();
9090
+ }
9091
+ }, _callee2);
9092
+ }));
9093
+ return function onSubmit(_x2) {
9094
+ return _ref4.apply(this, arguments);
9095
+ };
9096
+ }();
9097
+ //商品信息
9098
+ var GOODS_INFO_COLUMNS = function GOODS_INFO_COLUMNS() {
9099
+ return [{
9100
+ dataIndex: 'title',
9101
+ title: "\u5546\u54C1\u540D\u79F0",
9102
+ align: 'center',
9103
+ ellipsis: true,
9104
+ width: 250
9105
+ }, {
9106
+ dataIndex: 'outerId',
9107
+ title: "\u5546\u54C1\u7F16\u7801",
9108
+ align: 'center',
9109
+ ellipsis: true,
9110
+ width: 250
9111
+ }, {
9112
+ dataIndex: 'picUrl',
9113
+ title: "\u56FE\u7247",
9114
+ align: 'center',
9115
+ ellipsis: true,
9116
+ width: 100,
9117
+ render: function render(val) {
9118
+ return /*#__PURE__*/React.createElement(Image, {
9119
+ width: 60,
9120
+ src: val
9121
+ });
9122
+ }
9123
+ }, {
9124
+ dataIndex: 'numIid',
9125
+ title: "\u5546\u54C1id",
9126
+ align: 'center',
9127
+ ellipsis: true,
9128
+ width: 250
9129
+ }, {
9130
+ dataIndex: 'skuId',
9131
+ title: "SKU ID",
9132
+ align: 'center',
9133
+ ellipsis: true,
9134
+ width: 250
9135
+ }, {
9136
+ dataIndex: 'outerSkuId',
9137
+ title: "SKU \u7F16\u7801",
9138
+ align: 'center',
9139
+ ellipsis: true,
9140
+ width: 250
9141
+ }, {
9142
+ dataIndex: 'propertiesName',
9143
+ title: "SKU \u4FE1\u606F",
9144
+ align: 'center',
9145
+ ellipsis: true,
9146
+ width: 250
9147
+ }];
9148
+ };
9149
+ var headerList = showHeader || {
9150
+ 1: ['title', 'outerId', 'picUrl', 'numIid', 'skuId', 'outerSkuId', 'propertiesName' // sku 信息
9151
+ ]
9152
+ }[type] || [];
9153
+ var newColumns = useMemo(function () {
9154
+ var columnList = [{
9155
+ dataIndex: '',
9156
+ title: '序号',
9157
+ align: 'center',
9158
+ ellipsis: true,
9159
+ width: 50,
9160
+ render: function render(val, record, index) {
9161
+ return /*#__PURE__*/React.createElement("span", null, index + 1);
9162
+ }
9163
+ }].concat(_toConsumableArray(GOODS_INFO_COLUMNS().filter(function (t) {
9164
+ return headerList.includes(t === null || t === void 0 ? void 0 : t.dataIndex);
9165
+ })));
9166
+ if (!disabled) {
9167
+ columnList.push({
9168
+ dataIndex: '',
9169
+ title: "\u64CD\u4F5C",
9170
+ align: 'center',
9171
+ ellipsis: true,
9172
+ width: 100,
9173
+ render: function render(val, record, index) {
9174
+ return /*#__PURE__*/React.createElement(Button, {
9175
+ type: "link",
9176
+ onClick: function onClick() {
9177
+ return handleDelete(record, index);
9178
+ }
9179
+ }, "\u5220\u9664");
9180
+ }
9181
+ });
9182
+ }
9183
+ return columnList;
9184
+ }, [headerList, value, disabled]);
9185
+ var handleChangeGoods = function handleChangeGoods() {
9186
+ var _props$value2;
9187
+ if (!((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.shopId)) {
9188
+ message.error('请选择店铺');
9189
+ return;
9190
+ }
9191
+ setVisible(true);
9192
+ };
9193
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !disabled && showChangeBtn && /*#__PURE__*/React.createElement("div", {
9194
+ style: {
9195
+ float: 'right'
9196
+ }
9197
+ }, /*#__PURE__*/React.createElement(Button, {
9198
+ type: "link",
9199
+ onClick: handleChangeGoods
9200
+ }, "\u9009\u62E9\u5546\u54C1"), otherOperations), /*#__PURE__*/React.createElement(Table, {
9201
+ columns: newColumns,
9202
+ dataSource: value.imgList,
9203
+ rowKey: 'uuid',
9204
+ size: "small",
9205
+ pagination: false,
9206
+ scroll: {
9207
+ x: '100%'
9208
+ },
9209
+ locale: {
9210
+ emptyText: '暂无数据'
9211
+ }
9212
+ }), visible ? /*#__PURE__*/React.createElement(GoodsModal, {
9213
+ visible: visible,
9214
+ onSubmit: onSubmit,
9215
+ width: width,
9216
+ type: type,
9217
+ imgList: imgList,
9218
+ shopList: shopList,
9219
+ shopId: shopId,
9220
+ maxLength: maxLength,
9221
+ changeSku: changeSku,
9222
+ onCancel: function onCancel() {
9223
+ setVisible(false);
9224
+ }
9225
+ }) : null, /*#__PURE__*/React.createElement(Sku, {
9226
+ handleOk: handleSelectSku,
9227
+ ref: skuRef,
9228
+ userNick: userNick,
9229
+ type: type
9230
+ }));
9231
+ };
9232
+
8877
9233
  var TBGoodSerial = function TBGoodSerial(props) {
8878
- return /*#__PURE__*/React.createElement(Goods, _objectSpread2(_objectSpread2({}, props), {}, {
9234
+ return /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({}, props), {}, {
8879
9235
  type: 1
8880
9236
  }));
8881
9237
  };
@@ -10336,7 +10692,7 @@ var GoodsModal$2 = /*#__PURE__*/forwardRef(GoodsModal$1);
10336
10692
  // skuId: string;
10337
10693
  // styleId: string;
10338
10694
  // }
10339
- var GoodItem = function GoodItem(props) {
10695
+ var GoodItem$1 = function GoodItem(props) {
10340
10696
  var _props$value = props.value,
10341
10697
  value = _props$value === void 0 ? [] : _props$value,
10342
10698
  onChange = props.onChange,
@@ -10711,7 +11067,7 @@ var BsGoods = function BsGoods(props) {
10711
11067
  bsGoods: list
10712
11068
  }));
10713
11069
  };
10714
- return /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
11070
+ return /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
10715
11071
  key: 'bsGoods'
10716
11072
  }, props), {}, {
10717
11073
  disabled: disabled,
@@ -10909,12 +11265,12 @@ var BsExchange = function BsExchange(props) {
10909
11265
  onChange: function onChange(val) {
10910
11266
  return changeTypeHandle(val);
10911
11267
  }
10912
- }), !(value === null || value === void 0 ? void 0 : (_value$bsExchangeType4 = value.bsExchangeType) === null || _value$bsExchangeType4 === void 0 ? void 0 : _value$bsExchangeType4.length) ? /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
11268
+ }), !(value === null || value === void 0 ? void 0 : (_value$bsExchangeType4 = value.bsExchangeType) === null || _value$bsExchangeType4 === void 0 ? void 0 : _value$bsExchangeType4.length) ? /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
10913
11269
  key: 'bsExchangeGoods'
10914
11270
  }, other), {}, {
10915
11271
  disabled: disabled,
10916
11272
  showChangeBtn: false
10917
- })) : null, ['1', '3'].includes(value === null || value === void 0 ? void 0 : (_value$bsExchangeType5 = value.bsExchangeType) === null || _value$bsExchangeType5 === void 0 ? void 0 : _value$bsExchangeType5[0]) ? /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
11273
+ })) : null, ['1', '3'].includes(value === null || value === void 0 ? void 0 : (_value$bsExchangeType5 = value.bsExchangeType) === null || _value$bsExchangeType5 === void 0 ? void 0 : _value$bsExchangeType5[0]) ? /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
10918
11274
  key: 'bsExchangeGoods'
10919
11275
  }, other), {}, {
10920
11276
  disabled: disabled,
@@ -10930,7 +11286,7 @@ var BsExchange = function BsExchange(props) {
10930
11286
  border: '1px dashed',
10931
11287
  marginBottom: '8px'
10932
11288
  }
10933
- }, /*#__PURE__*/React.createElement("div", null, "\u9000\u56DE\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
11289
+ }, /*#__PURE__*/React.createElement("div", null, "\u9000\u56DE\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
10934
11290
  key: 'bsReturnGoods'
10935
11291
  }, other), {}, {
10936
11292
  disabled: disabled,
@@ -10940,7 +11296,7 @@ var BsExchange = function BsExchange(props) {
10940
11296
  onChange: function onChange(val) {
10941
11297
  return changeReturnHandle(val, index, 'bsExchangeReturnGoods');
10942
11298
  }
10943
- })), /*#__PURE__*/React.createElement("div", null, "\u6362\u51FA\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
11299
+ })), /*#__PURE__*/React.createElement("div", null, "\u6362\u51FA\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
10944
11300
  key: 'bsOutGoods'
10945
11301
  }, other), {}, {
10946
11302
  disabled: disabled,
@@ -10952,7 +11308,7 @@ var BsExchange = function BsExchange(props) {
10952
11308
  return changeReturnHandle(val, index, 'bsExchangeSwapOutGoods');
10953
11309
  }
10954
11310
  })));
10955
- })), ['3', '4'].includes(value === null || value === void 0 ? void 0 : (_value$bsExchangeType6 = value.bsExchangeType) === null || _value$bsExchangeType6 === void 0 ? void 0 : _value$bsExchangeType6[0]) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, "\u8D60\u54C1\u4FE1\u606F"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
11311
+ })), ['3', '4'].includes(value === null || value === void 0 ? void 0 : (_value$bsExchangeType6 = value.bsExchangeType) === null || _value$bsExchangeType6 === void 0 ? void 0 : _value$bsExchangeType6[0]) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, "\u8D60\u54C1\u4FE1\u606F"), /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
10956
11312
  headerText: "\u8D60\u54C1",
10957
11313
  key: 'bsGiftGoods',
10958
11314
  disabled: disabled,
@@ -11063,7 +11419,7 @@ var BsReissue = function BsReissue(props) {
11063
11419
  onChange: function onChange(val) {
11064
11420
  return changeTypeHandle(val);
11065
11421
  }
11066
- }), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
11422
+ }), /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
11067
11423
  key: 'reissueGoods'
11068
11424
  }, other), {}, {
11069
11425
  disabled: disabled,
@@ -11160,7 +11516,7 @@ var BsReturnGoods = function BsReturnGoods(props) {
11160
11516
  onChange: function onChange(val) {
11161
11517
  return changeTypeHandle(val);
11162
11518
  }
11163
- }), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
11519
+ }), /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
11164
11520
  key: 'returnGoods'
11165
11521
  }, other), {}, {
11166
11522
  disabled: disabled,
@@ -11337,7 +11693,7 @@ var WlnGoods = function WlnGoods(props) {
11337
11693
  wlnGoods: list
11338
11694
  }));
11339
11695
  };
11340
- return /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
11696
+ return /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
11341
11697
  key: 'wlnGoods'
11342
11698
  }, props), {}, {
11343
11699
  disabled: disabled,
package/dist/index.js CHANGED
@@ -368,6 +368,15 @@ function _regeneratorRuntime() {
368
368
  }
369
369
  }, exports;
370
370
  }
371
+ function _typeof(obj) {
372
+ "@babel/helpers - typeof";
373
+
374
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
375
+ return typeof obj;
376
+ } : function (obj) {
377
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
378
+ }, _typeof(obj);
379
+ }
371
380
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
372
381
  try {
373
382
  var info = gen[key](arg);
@@ -7935,7 +7944,9 @@ var GoodsModal = function GoodsModal(props) {
7935
7944
  maxLength = props.maxLength,
7936
7945
  shopList = props.shopList,
7937
7946
  changeSku = props.changeSku,
7938
- width = props.width;
7947
+ width = props.width,
7948
+ _props$numIidType = props.numIidType,
7949
+ numIidType = _props$numIidType === void 0 ? 'string' : _props$numIidType;
7939
7950
  var _useState = React.useState([]),
7940
7951
  _useState2 = _slicedToArray(_useState, 2),
7941
7952
  selectList = _useState2[0],
@@ -7952,6 +7963,25 @@ var GoodsModal = function GoodsModal(props) {
7952
7963
  _useState8 = _slicedToArray(_useState7, 2),
7953
7964
  loading = _useState8[0],
7954
7965
  setLoading = _useState8[1];
7966
+ var transformIdType = function transformIdType(id) {
7967
+ if (!['string', 'number'].includes(_typeof(id))) return id;
7968
+ return numIidType === 'string' ? id + '' : +id;
7969
+ };
7970
+ var transformType = function transformType(item) {
7971
+ if (!(item === null || item === void 0 ? void 0 : item.numIid)) return item;
7972
+ return _objectSpread2(_objectSpread2({}, item), {}, {
7973
+ numIid: transformIdType(item.numIid)
7974
+ });
7975
+ };
7976
+ var handleSetSelect = function handleSetSelect(list) {
7977
+ return setSelect(list.map(transformType));
7978
+ };
7979
+ var handleSelectIds = function handleSelectIds(list) {
7980
+ return setSelectIds(list.map(transformIdType));
7981
+ };
7982
+ var handleSetGoodList = function handleSetGoodList(list) {
7983
+ return setGoodList(list.map(transformType));
7984
+ };
7955
7985
  var _useState9 = React.useState({
7956
7986
  apiName: 'queryItems',
7957
7987
  desc: true,
@@ -8045,15 +8075,15 @@ var GoodsModal = function GoodsModal(props) {
8045
8075
  var newSelect = selectList.filter(function (item) {
8046
8076
  return item.numIid !== good.numIid;
8047
8077
  });
8048
- setSelect(_toConsumableArray(newSelect));
8078
+ handleSetSelect(_toConsumableArray(newSelect));
8049
8079
  var ids = newSelect.map(function (item) {
8050
8080
  return item.numIid;
8051
8081
  });
8052
- setSelectIds(ids);
8082
+ handleSelectIds(ids);
8053
8083
  } else {
8054
8084
  if (type === 4 || changeSku) {
8055
- setSelect([good]);
8056
- setSelectIds([good.numIid]);
8085
+ handleSetSelect([good]);
8086
+ handleSelectIds([good.numIid]);
8057
8087
  } else {
8058
8088
  if (selectList.length >= maxLength) {
8059
8089
  antd.message.error("\u6700\u591A\u6DFB\u52A0".concat(maxLength, "\u5F20"));
@@ -8066,14 +8096,14 @@ var GoodsModal = function GoodsModal(props) {
8066
8096
  var newSelectList = selectList.filter(function (item) {
8067
8097
  return item.numIid !== good.numIid;
8068
8098
  });
8069
- setSelect(newSelectList);
8099
+ handleSetSelect(newSelectList);
8070
8100
  var _ids = newSelectList.map(function (item) {
8071
8101
  return item.numIid;
8072
8102
  });
8073
- setSelectIds(_ids);
8103
+ handleSelectIds(_ids);
8074
8104
  } else {
8075
- setSelect([].concat(_toConsumableArray(selectList), [good]));
8076
- setSelectIds([].concat(_toConsumableArray(selectIds), [good.numIid]));
8105
+ handleSetSelect([].concat(_toConsumableArray(selectList), [good]));
8106
+ handleSelectIds([].concat(_toConsumableArray(selectIds), [good.numIid]));
8077
8107
  }
8078
8108
  }
8079
8109
  }
@@ -8165,7 +8195,7 @@ var GoodsModal = function GoodsModal(props) {
8165
8195
  items.forEach(function (item) {
8166
8196
  item.platform = platform;
8167
8197
  });
8168
- setGoodList(_toConsumableArray(items));
8198
+ handleSetGoodList(_toConsumableArray(items));
8169
8199
  setTotal(totalCount);
8170
8200
  _context.next = 26;
8171
8201
  break;
@@ -8193,7 +8223,7 @@ var GoodsModal = function GoodsModal(props) {
8193
8223
  item.title = item.productName;
8194
8224
  item.platform = platform;
8195
8225
  });
8196
- setGoodList(_toConsumableArray(newList));
8226
+ handleSetGoodList(_toConsumableArray(newList));
8197
8227
  setTotal(_total);
8198
8228
  if (platform === 'sph' && nextKey && !nextKeyList.includes(nextKey)) {
8199
8229
  setNextKeyList([].concat(_toConsumableArray(nextKeyList), [nextKey]));
@@ -8279,12 +8309,12 @@ var GoodsModal = function GoodsModal(props) {
8279
8309
  React.useEffect(function () {
8280
8310
  setPlatformHandle(platform);
8281
8311
  if (imgList.length) {
8282
- setSelect(imgList);
8312
+ handleSetSelect(imgList);
8283
8313
  var ids = imgList === null || imgList === void 0 ? void 0 : imgList.map(function (item) {
8284
8314
  return item.numIid;
8285
8315
  });
8286
8316
  if (!(changeSku || type === 4)) {
8287
- setSelectIds(ids);
8317
+ handleSelectIds(ids);
8288
8318
  }
8289
8319
  }
8290
8320
  }, [platform]);
@@ -8382,9 +8412,9 @@ var GoodsModal = function GoodsModal(props) {
8382
8412
  spinning: loading
8383
8413
  }, /*#__PURE__*/React__default['default'].createElement("div", {
8384
8414
  className: "goodsMain"
8385
- }, (searchParams.type == 'select' ? selectList : goodList).map(function (good) {
8415
+ }, (searchParams.type == 'select' ? selectList : goodList).map(function (good, index) {
8386
8416
  return /*#__PURE__*/React__default['default'].createElement("div", {
8387
- key: good.numIid,
8417
+ key: good.numIid + "".concat(index),
8388
8418
  className: "goodItem ".concat(selectIds.includes(good.numIid) ? 'active' : ''),
8389
8419
  onClick: function onClick() {
8390
8420
  changeItem(good);
@@ -8446,7 +8476,7 @@ var Sku = /*#__PURE__*/React.forwardRef(function (props, ref) {
8446
8476
  });
8447
8477
  var handleSure = /*#__PURE__*/function () {
8448
8478
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8449
- var type, SKU, _ref3, _ref4, _ref5, _ref6, _ref7, _yield$request, _yield$request$data, data;
8479
+ var type, SKU, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _yield$request, _yield$request$data, data;
8450
8480
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8451
8481
  while (1) switch (_context.prev = _context.next) {
8452
8482
  case 0:
@@ -8481,7 +8511,10 @@ var Sku = /*#__PURE__*/React.forwardRef(function (props, ref) {
8481
8511
  }) === null || _ref4 === void 0 ? void 0 : _ref4.picUrl,
8482
8512
  outerSkuId: (_ref5 = SKU || {
8483
8513
  outerSkuId: ''
8484
- }) === null || _ref5 === void 0 ? void 0 : _ref5.outerSkuId
8514
+ }) === null || _ref5 === void 0 ? void 0 : _ref5.outerSkuId,
8515
+ skuId: ((_ref6 = SKU || {
8516
+ skuId: ''
8517
+ }) === null || _ref6 === void 0 ? void 0 : _ref6.skuId) || ''
8485
8518
  });
8486
8519
  _context.next = 16;
8487
8520
  break;
@@ -8502,12 +8535,15 @@ var Sku = /*#__PURE__*/React.forwardRef(function (props, ref) {
8502
8535
  props.handleOk({
8503
8536
  enableItemId: data.length > 0 ? data[0]['supplierItemOuterId'] : '',
8504
8537
  enableSupplierName: data.length > 0 ? data[0]['supplierName'] : '',
8505
- propertiesName: ((_ref6 = SKU || {
8538
+ propertiesName: ((_ref7 = SKU || {
8506
8539
  label: ''
8507
- }) === null || _ref6 === void 0 ? void 0 : _ref6.label) || '',
8508
- picUrl: (_ref7 = SKU || {
8540
+ }) === null || _ref7 === void 0 ? void 0 : _ref7.label) || '',
8541
+ picUrl: (_ref8 = SKU || {
8509
8542
  picUrl: ''
8510
- }) === null || _ref7 === void 0 ? void 0 : _ref7.picUrl
8543
+ }) === null || _ref8 === void 0 ? void 0 : _ref8.picUrl,
8544
+ skuId: ((_ref9 = SKU || {
8545
+ skuId: ''
8546
+ }) === null || _ref9 === void 0 ? void 0 : _ref9.skuId) || ''
8511
8547
  });
8512
8548
  case 16:
8513
8549
  setVisible(false);
@@ -8885,8 +8921,328 @@ var ChooseBaby = function ChooseBaby(props) {
8885
8921
  }));
8886
8922
  };
8887
8923
 
8924
+ var GoodItem = function GoodItem(props) {
8925
+ var _props$value = props.value,
8926
+ value = _props$value === void 0 ? {
8927
+ shopId: '',
8928
+ imgList: []
8929
+ } : _props$value,
8930
+ _props$maxLength = props.maxLength,
8931
+ maxLength = _props$maxLength === void 0 ? 20 : _props$maxLength,
8932
+ onChange = props.onChange,
8933
+ _props$type = props.type,
8934
+ type = _props$type === void 0 ? 2 : _props$type,
8935
+ _props$shopList = props.shopList,
8936
+ shopList = _props$shopList === void 0 ? [] : _props$shopList,
8937
+ showHeader = props.showHeader,
8938
+ _props$showChangeBtn = props.showChangeBtn,
8939
+ showChangeBtn = _props$showChangeBtn === void 0 ? true : _props$showChangeBtn,
8940
+ otherOperations = props.otherOperations,
8941
+ canUpdateNumber = props.canUpdateNumber,
8942
+ enableItemId = props.enableItemId,
8943
+ enableSupplierName = props.enableSupplierName,
8944
+ userNick = props.userNick,
8945
+ disabled = props.disabled,
8946
+ changeSku = props.changeSku,
8947
+ width = props.width;
8948
+ var shopId = value.shopId,
8949
+ imgList = value.imgList;
8950
+ var _useState = React.useState(false),
8951
+ _useState2 = _slicedToArray(_useState, 2),
8952
+ visible = _useState2[0],
8953
+ setVisible = _useState2[1];
8954
+ var skuRef = React.useRef();
8955
+ //是否是淘宝店铺
8956
+ var isTaobaoPlat = React.useMemo(function () {
8957
+ console.log('shopId', shopId);
8958
+ return shopList.some(function (item) {
8959
+ return item.shopId === shopId && item.shopSourceStr === 'TAOBAO';
8960
+ });
8961
+ }, [shopId]);
8962
+ // 查询SKU
8963
+ var querySkus = /*#__PURE__*/function () {
8964
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
8965
+ var shopId, numIids;
8966
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8967
+ while (1) switch (_context.prev = _context.next) {
8968
+ case 0:
8969
+ shopId = _ref.shopId, numIids = _ref.numIids;
8970
+ return _context.abrupt("return", extendRequest('/qy/gdfw/workOrder/queryItemSkus', {
8971
+ method: 'post',
8972
+ data: {
8973
+ shopId: shopId,
8974
+ numIids: numIids
8975
+ }
8976
+ }));
8977
+ case 2:
8978
+ case "end":
8979
+ return _context.stop();
8980
+ }
8981
+ }, _callee);
8982
+ }));
8983
+ return function querySkus(_x) {
8984
+ return _ref2.apply(this, arguments);
8985
+ };
8986
+ }();
8987
+ //删除行
8988
+ var handleDelete = function handleDelete(record, index) {
8989
+ var newSelect = imgList.filter(function (_, i) {
8990
+ return index !== i;
8991
+ });
8992
+ onChange === null || onChange === void 0 ? void 0 : onChange({
8993
+ shopId: shopId,
8994
+ imgList: _toConsumableArray(newSelect)
8995
+ });
8996
+ };
8997
+ //选择sku
8998
+ var handleSelectSku = function handleSelectSku(_ref3) {
8999
+ var enableItemId = _ref3.enableItemId,
9000
+ enableSupplierName = _ref3.enableSupplierName,
9001
+ propertiesName = _ref3.propertiesName,
9002
+ picUrl = _ref3.picUrl,
9003
+ outerSkuId = _ref3.outerSkuId,
9004
+ skuId = _ref3.skuId;
9005
+ var newList = JSON.parse(JSON.stringify(imgList));
9006
+ if (type === 4) {
9007
+ newList[newList.length - 1].itemId = enableItemId;
9008
+ newList[newList.length - 1].supplierName = enableSupplierName;
9009
+ } else {
9010
+ newList[newList.length - 1].propertiesName = propertiesName;
9011
+ }
9012
+ if (type === 1) {
9013
+ if (outerSkuId) newList[newList.length - 1].outerSkuId = outerSkuId;
9014
+ if (skuId) newList[newList.length - 1].skuId = skuId;
9015
+ }
9016
+ //替换成sku的图片
9017
+ picUrl && (newList[newList.length - 1].picUrl = picUrl);
9018
+ onChange === null || onChange === void 0 ? void 0 : onChange({
9019
+ shopId: shopId,
9020
+ imgList: newList
9021
+ });
9022
+ };
9023
+ //选择回调
9024
+ var onSubmit = /*#__PURE__*/function () {
9025
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(list) {
9026
+ var newList, newImgList, _yield$querySkus, data, _skuRef$current, options;
9027
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9028
+ while (1) switch (_context2.prev = _context2.next) {
9029
+ case 0:
9030
+ console.log('🚀 ~ file: table.tsx:160 ~ onSubmit ~ list:', list);
9031
+ newList = list.map(function (item) {
9032
+ //过滤属性 只保存需要的字段
9033
+ var params = {
9034
+ uuid: kmkfUtils.uuid(),
9035
+ platform: item.platform,
9036
+ price: item.price,
9037
+ canDelete: true,
9038
+ title: item.title,
9039
+ outerId: item.outerId,
9040
+ picUrl: item.picUrl,
9041
+ numIid: item.numIid,
9042
+ skuId: item.skuId,
9043
+ outerSkuId: item.outerSkuId
9044
+ };
9045
+ // if (type === 1) {
9046
+ // params.outerId = item.outerId; //编码
9047
+ // }
9048
+ if (changeSku) {
9049
+ params.propertiesName = '';
9050
+ }
9051
+ // if (type === 4) {
9052
+ // if (enableItemId) {
9053
+ // params.itemId = '';
9054
+ // }
9055
+ // if (enableSupplierName) {
9056
+ // params.supplierName = '';
9057
+ // }
9058
+ // }
9059
+ return params;
9060
+ });
9061
+ newImgList = changeSku || type === 4 ? [].concat(_toConsumableArray(imgList), _toConsumableArray(newList)) : _toConsumableArray(newList);
9062
+ onChange === null || onChange === void 0 ? void 0 : onChange({
9063
+ shopId: shopId,
9064
+ imgList: newImgList
9065
+ });
9066
+ setVisible(false);
9067
+ //供应上编码组件 || 商品组件且可以选择sku
9068
+ if (!(type === 4 && (enableItemId || enableSupplierName) || type !== 4 && changeSku && isTaobaoPlat && list.length > 0)) {
9069
+ _context2.next = 11;
9070
+ break;
9071
+ }
9072
+ _context2.next = 8;
9073
+ return querySkus({
9074
+ shopId: shopId,
9075
+ numIids: list[0].numIid
9076
+ });
9077
+ case 8:
9078
+ _yield$querySkus = _context2.sent;
9079
+ data = _yield$querySkus.data;
9080
+ if (data.length > 0 && data[0]['skus'] && data[0]['skus']['length'] > 0) {
9081
+ options = data[0]['skus'].map(function (item) {
9082
+ return {
9083
+ label: item.propertiesName.split(';').map(function (i) {
9084
+ return i.split(':').slice(2);
9085
+ }).join(';'),
9086
+ value: item.skuId,
9087
+ picUrl: item.picUrl,
9088
+ outerSkuId: item === null || item === void 0 ? void 0 : item.outerSkuId,
9089
+ skuId: item.skuId
9090
+ };
9091
+ });
9092
+ (_skuRef$current = skuRef.current) === null || _skuRef$current === void 0 ? void 0 : _skuRef$current.open({
9093
+ shopId: shopId,
9094
+ numIids: list[0].numIid,
9095
+ options: options
9096
+ });
9097
+ }
9098
+ case 11:
9099
+ case "end":
9100
+ return _context2.stop();
9101
+ }
9102
+ }, _callee2);
9103
+ }));
9104
+ return function onSubmit(_x2) {
9105
+ return _ref4.apply(this, arguments);
9106
+ };
9107
+ }();
9108
+ //商品信息
9109
+ var GOODS_INFO_COLUMNS = function GOODS_INFO_COLUMNS() {
9110
+ return [{
9111
+ dataIndex: 'title',
9112
+ title: "\u5546\u54C1\u540D\u79F0",
9113
+ align: 'center',
9114
+ ellipsis: true,
9115
+ width: 250
9116
+ }, {
9117
+ dataIndex: 'outerId',
9118
+ title: "\u5546\u54C1\u7F16\u7801",
9119
+ align: 'center',
9120
+ ellipsis: true,
9121
+ width: 250
9122
+ }, {
9123
+ dataIndex: 'picUrl',
9124
+ title: "\u56FE\u7247",
9125
+ align: 'center',
9126
+ ellipsis: true,
9127
+ width: 100,
9128
+ render: function render(val) {
9129
+ return /*#__PURE__*/React__default['default'].createElement(antd.Image, {
9130
+ width: 60,
9131
+ src: val
9132
+ });
9133
+ }
9134
+ }, {
9135
+ dataIndex: 'numIid',
9136
+ title: "\u5546\u54C1id",
9137
+ align: 'center',
9138
+ ellipsis: true,
9139
+ width: 250
9140
+ }, {
9141
+ dataIndex: 'skuId',
9142
+ title: "SKU ID",
9143
+ align: 'center',
9144
+ ellipsis: true,
9145
+ width: 250
9146
+ }, {
9147
+ dataIndex: 'outerSkuId',
9148
+ title: "SKU \u7F16\u7801",
9149
+ align: 'center',
9150
+ ellipsis: true,
9151
+ width: 250
9152
+ }, {
9153
+ dataIndex: 'propertiesName',
9154
+ title: "SKU \u4FE1\u606F",
9155
+ align: 'center',
9156
+ ellipsis: true,
9157
+ width: 250
9158
+ }];
9159
+ };
9160
+ var headerList = showHeader || {
9161
+ 1: ['title', 'outerId', 'picUrl', 'numIid', 'skuId', 'outerSkuId', 'propertiesName' // sku 信息
9162
+ ]
9163
+ }[type] || [];
9164
+ var newColumns = React.useMemo(function () {
9165
+ var columnList = [{
9166
+ dataIndex: '',
9167
+ title: '序号',
9168
+ align: 'center',
9169
+ ellipsis: true,
9170
+ width: 50,
9171
+ render: function render(val, record, index) {
9172
+ return /*#__PURE__*/React__default['default'].createElement("span", null, index + 1);
9173
+ }
9174
+ }].concat(_toConsumableArray(GOODS_INFO_COLUMNS().filter(function (t) {
9175
+ return headerList.includes(t === null || t === void 0 ? void 0 : t.dataIndex);
9176
+ })));
9177
+ if (!disabled) {
9178
+ columnList.push({
9179
+ dataIndex: '',
9180
+ title: "\u64CD\u4F5C",
9181
+ align: 'center',
9182
+ ellipsis: true,
9183
+ width: 100,
9184
+ render: function render(val, record, index) {
9185
+ return /*#__PURE__*/React__default['default'].createElement(antd.Button, {
9186
+ type: "link",
9187
+ onClick: function onClick() {
9188
+ return handleDelete(record, index);
9189
+ }
9190
+ }, "\u5220\u9664");
9191
+ }
9192
+ });
9193
+ }
9194
+ return columnList;
9195
+ }, [headerList, value, disabled]);
9196
+ var handleChangeGoods = function handleChangeGoods() {
9197
+ var _props$value2;
9198
+ if (!((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.shopId)) {
9199
+ antd.message.error('请选择店铺');
9200
+ return;
9201
+ }
9202
+ setVisible(true);
9203
+ };
9204
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, !disabled && showChangeBtn && /*#__PURE__*/React__default['default'].createElement("div", {
9205
+ style: {
9206
+ float: 'right'
9207
+ }
9208
+ }, /*#__PURE__*/React__default['default'].createElement(antd.Button, {
9209
+ type: "link",
9210
+ onClick: handleChangeGoods
9211
+ }, "\u9009\u62E9\u5546\u54C1"), otherOperations), /*#__PURE__*/React__default['default'].createElement(antd.Table, {
9212
+ columns: newColumns,
9213
+ dataSource: value.imgList,
9214
+ rowKey: 'uuid',
9215
+ size: "small",
9216
+ pagination: false,
9217
+ scroll: {
9218
+ x: '100%'
9219
+ },
9220
+ locale: {
9221
+ emptyText: '暂无数据'
9222
+ }
9223
+ }), visible ? /*#__PURE__*/React__default['default'].createElement(GoodsModal, {
9224
+ visible: visible,
9225
+ onSubmit: onSubmit,
9226
+ width: width,
9227
+ type: type,
9228
+ imgList: imgList,
9229
+ shopList: shopList,
9230
+ shopId: shopId,
9231
+ maxLength: maxLength,
9232
+ changeSku: changeSku,
9233
+ onCancel: function onCancel() {
9234
+ setVisible(false);
9235
+ }
9236
+ }) : null, /*#__PURE__*/React__default['default'].createElement(Sku, {
9237
+ handleOk: handleSelectSku,
9238
+ ref: skuRef,
9239
+ userNick: userNick,
9240
+ type: type
9241
+ }));
9242
+ };
9243
+
8888
9244
  var TBGoodSerial = function TBGoodSerial(props) {
8889
- return /*#__PURE__*/React__default['default'].createElement(Goods, _objectSpread2(_objectSpread2({}, props), {}, {
9245
+ return /*#__PURE__*/React__default['default'].createElement(GoodItem, _objectSpread2(_objectSpread2({}, props), {}, {
8890
9246
  type: 1
8891
9247
  }));
8892
9248
  };
@@ -10347,7 +10703,7 @@ var GoodsModal$2 = /*#__PURE__*/React.forwardRef(GoodsModal$1);
10347
10703
  // skuId: string;
10348
10704
  // styleId: string;
10349
10705
  // }
10350
- var GoodItem = function GoodItem(props) {
10706
+ var GoodItem$1 = function GoodItem(props) {
10351
10707
  var _props$value = props.value,
10352
10708
  value = _props$value === void 0 ? [] : _props$value,
10353
10709
  onChange = props.onChange,
@@ -10722,7 +11078,7 @@ var BsGoods = function BsGoods(props) {
10722
11078
  bsGoods: list
10723
11079
  }));
10724
11080
  };
10725
- return /*#__PURE__*/React__default['default'].createElement(GoodItem, _objectSpread2(_objectSpread2({
11081
+ return /*#__PURE__*/React__default['default'].createElement(GoodItem$1, _objectSpread2(_objectSpread2({
10726
11082
  key: 'bsGoods'
10727
11083
  }, props), {}, {
10728
11084
  disabled: disabled,
@@ -10920,12 +11276,12 @@ var BsExchange = function BsExchange(props) {
10920
11276
  onChange: function onChange(val) {
10921
11277
  return changeTypeHandle(val);
10922
11278
  }
10923
- }), !(value === null || value === void 0 ? void 0 : (_value$bsExchangeType4 = value.bsExchangeType) === null || _value$bsExchangeType4 === void 0 ? void 0 : _value$bsExchangeType4.length) ? /*#__PURE__*/React__default['default'].createElement(GoodItem, _objectSpread2(_objectSpread2({
11279
+ }), !(value === null || value === void 0 ? void 0 : (_value$bsExchangeType4 = value.bsExchangeType) === null || _value$bsExchangeType4 === void 0 ? void 0 : _value$bsExchangeType4.length) ? /*#__PURE__*/React__default['default'].createElement(GoodItem$1, _objectSpread2(_objectSpread2({
10924
11280
  key: 'bsExchangeGoods'
10925
11281
  }, other), {}, {
10926
11282
  disabled: disabled,
10927
11283
  showChangeBtn: false
10928
- })) : null, ['1', '3'].includes(value === null || value === void 0 ? void 0 : (_value$bsExchangeType5 = value.bsExchangeType) === null || _value$bsExchangeType5 === void 0 ? void 0 : _value$bsExchangeType5[0]) ? /*#__PURE__*/React__default['default'].createElement(GoodItem, _objectSpread2(_objectSpread2({
11284
+ })) : null, ['1', '3'].includes(value === null || value === void 0 ? void 0 : (_value$bsExchangeType5 = value.bsExchangeType) === null || _value$bsExchangeType5 === void 0 ? void 0 : _value$bsExchangeType5[0]) ? /*#__PURE__*/React__default['default'].createElement(GoodItem$1, _objectSpread2(_objectSpread2({
10929
11285
  key: 'bsExchangeGoods'
10930
11286
  }, other), {}, {
10931
11287
  disabled: disabled,
@@ -10941,7 +11297,7 @@ var BsExchange = function BsExchange(props) {
10941
11297
  border: '1px dashed',
10942
11298
  marginBottom: '8px'
10943
11299
  }
10944
- }, /*#__PURE__*/React__default['default'].createElement("div", null, "\u9000\u56DE\u5546\u54C1"), /*#__PURE__*/React__default['default'].createElement(GoodItem, _objectSpread2(_objectSpread2({
11300
+ }, /*#__PURE__*/React__default['default'].createElement("div", null, "\u9000\u56DE\u5546\u54C1"), /*#__PURE__*/React__default['default'].createElement(GoodItem$1, _objectSpread2(_objectSpread2({
10945
11301
  key: 'bsReturnGoods'
10946
11302
  }, other), {}, {
10947
11303
  disabled: disabled,
@@ -10951,7 +11307,7 @@ var BsExchange = function BsExchange(props) {
10951
11307
  onChange: function onChange(val) {
10952
11308
  return changeReturnHandle(val, index, 'bsExchangeReturnGoods');
10953
11309
  }
10954
- })), /*#__PURE__*/React__default['default'].createElement("div", null, "\u6362\u51FA\u5546\u54C1"), /*#__PURE__*/React__default['default'].createElement(GoodItem, _objectSpread2(_objectSpread2({
11310
+ })), /*#__PURE__*/React__default['default'].createElement("div", null, "\u6362\u51FA\u5546\u54C1"), /*#__PURE__*/React__default['default'].createElement(GoodItem$1, _objectSpread2(_objectSpread2({
10955
11311
  key: 'bsOutGoods'
10956
11312
  }, other), {}, {
10957
11313
  disabled: disabled,
@@ -10963,7 +11319,7 @@ var BsExchange = function BsExchange(props) {
10963
11319
  return changeReturnHandle(val, index, 'bsExchangeSwapOutGoods');
10964
11320
  }
10965
11321
  })));
10966
- })), ['3', '4'].includes(value === null || value === void 0 ? void 0 : (_value$bsExchangeType6 = value.bsExchangeType) === null || _value$bsExchangeType6 === void 0 ? void 0 : _value$bsExchangeType6[0]) ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", null, "\u8D60\u54C1\u4FE1\u606F"), /*#__PURE__*/React__default['default'].createElement(GoodItem, _objectSpread2(_objectSpread2({
11322
+ })), ['3', '4'].includes(value === null || value === void 0 ? void 0 : (_value$bsExchangeType6 = value.bsExchangeType) === null || _value$bsExchangeType6 === void 0 ? void 0 : _value$bsExchangeType6[0]) ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", null, "\u8D60\u54C1\u4FE1\u606F"), /*#__PURE__*/React__default['default'].createElement(GoodItem$1, _objectSpread2(_objectSpread2({
10967
11323
  headerText: "\u8D60\u54C1",
10968
11324
  key: 'bsGiftGoods',
10969
11325
  disabled: disabled,
@@ -11074,7 +11430,7 @@ var BsReissue = function BsReissue(props) {
11074
11430
  onChange: function onChange(val) {
11075
11431
  return changeTypeHandle(val);
11076
11432
  }
11077
- }), /*#__PURE__*/React__default['default'].createElement(GoodItem, _objectSpread2(_objectSpread2({
11433
+ }), /*#__PURE__*/React__default['default'].createElement(GoodItem$1, _objectSpread2(_objectSpread2({
11078
11434
  key: 'reissueGoods'
11079
11435
  }, other), {}, {
11080
11436
  disabled: disabled,
@@ -11171,7 +11527,7 @@ var BsReturnGoods = function BsReturnGoods(props) {
11171
11527
  onChange: function onChange(val) {
11172
11528
  return changeTypeHandle(val);
11173
11529
  }
11174
- }), /*#__PURE__*/React__default['default'].createElement(GoodItem, _objectSpread2(_objectSpread2({
11530
+ }), /*#__PURE__*/React__default['default'].createElement(GoodItem$1, _objectSpread2(_objectSpread2({
11175
11531
  key: 'returnGoods'
11176
11532
  }, other), {}, {
11177
11533
  disabled: disabled,
@@ -11348,7 +11704,7 @@ var WlnGoods = function WlnGoods(props) {
11348
11704
  wlnGoods: list
11349
11705
  }));
11350
11706
  };
11351
- return /*#__PURE__*/React__default['default'].createElement(GoodItem, _objectSpread2(_objectSpread2({
11707
+ return /*#__PURE__*/React__default['default'].createElement(GoodItem$1, _objectSpread2(_objectSpread2({
11352
11708
  key: 'wlnGoods'
11353
11709
  }, props), {}, {
11354
11710
  disabled: disabled,
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { GoodsProps } from '../../common/Goods';
3
- declare const TBGoodSerial: (props: Partial<GoodsProps>) => React.JSX.Element;
2
+ import { GoodsTableProps } from '../../common/Goods/Table';
3
+ declare const TBGoodSerial: (props: Partial<GoodsTableProps>) => React.JSX.Element;
4
4
  export default TBGoodSerial;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ export interface GoodsTableProps {
3
+ value?: {
4
+ shopId: string;
5
+ imgList: any[];
6
+ };
7
+ showChangeBtn?: boolean;
8
+ type?: number;
9
+ enableItemId?: boolean;
10
+ enableSupplierName?: boolean;
11
+ userNick?: string;
12
+ maxLength: number;
13
+ canUpdateNumber?: boolean;
14
+ onChange?: (value: any) => void;
15
+ shopList: any[];
16
+ otherOperations?: React.JSX.Element;
17
+ showHeader?: string[];
18
+ shopId?: string;
19
+ disabled?: boolean;
20
+ changeSku?: boolean;
21
+ width?: string | number;
22
+ }
23
+ declare const GoodItem: (props: Partial<GoodsTableProps>) => React.JSX.Element;
24
+ export default GoodItem;
@@ -9,6 +9,7 @@ interface GoodModelProps {
9
9
  shopList: any[];
10
10
  changeSku?: boolean;
11
11
  width?: string | number;
12
+ numIidType?: 'string' | 'number';
12
13
  onSubmit: (...args: any[]) => any;
13
14
  onCancel: (...args: any[]) => any;
14
15
  }
@@ -6,6 +6,7 @@ declare type SkuProps = {
6
6
  propertiesName: string;
7
7
  picUrl?: string;
8
8
  outerSkuId?: string;
9
+ skuId?: string;
9
10
  }) => void;
10
11
  userNick: string | undefined;
11
12
  type?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "0.22.1-alpha.0",
3
+ "version": "0.23.0-alpha.0",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -20,7 +20,7 @@
20
20
  "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/kmkf-utils": "^0.22.1-alpha.0",
23
+ "@kmkf-fe-packages/kmkf-utils": "^0.23.0-alpha.0",
24
24
  "lodash": "^4.17.21",
25
25
  "pubsub-js": "^1.9.4",
26
26
  "react-copy-to-clipboard": "^5.1.0",
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "6247a93346f10a6ef9edd2adcccb6e4087015a66"
64
+ "gitHead": "c3067c39d74b6ffc99ff417e58f87486cf7a5d50"
65
65
  }