@kmkf-fe-packages/basic-components 0.7.15-alpha.3 → 0.7.15-alpha.31

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
@@ -5,6 +5,7 @@ import request, { extend as extend$1 } from 'umi-request';
5
5
  import { AddressData, BsAddressData, request as request$1, LogisticsAddressData } from '@kmkf-fe-packages/kmkf-utils';
6
6
  import zhCN from 'antd/lib/locale/zh_CN';
7
7
  import pubsub from 'pubsub-js';
8
+ import { cloneDeep } from 'lodash';
8
9
 
9
10
  function _iterableToArrayLimit(arr, i) {
10
11
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
@@ -6939,7 +6940,7 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
6939
6940
  var beforeUpload = function beforeUpload(file) {
6940
6941
  console.log('beforeUpload', file);
6941
6942
  var size = file.size / 1024 / 1024 < maxSize;
6942
- if (value.length > maxCount) {
6943
+ if (value.length >= maxCount) {
6943
6944
  message.error("\u6700\u591A\u6DFB\u52A0".concat(maxCount, "\u4E2A\u6587\u4EF6\uFF01"));
6944
6945
  return Upload.LIST_IGNORE;
6945
6946
  }
@@ -6962,7 +6963,7 @@ var ApaasUploadAsync$1 = function ApaasUploadAsync(_ref) {
6962
6963
  className: styles$2.tips
6963
6964
  }, "\u5141\u8BB8\u4E0A\u4F20", maxCount, "\u4E2A\u6587\u4EF6"), /*#__PURE__*/React.createElement(Dragger, _objectSpread2({
6964
6965
  disabled: disabled,
6965
- multiple: true,
6966
+ multiple: false,
6966
6967
  accept: accept,
6967
6968
  name: "file",
6968
6969
  maxCount: maxCount,
@@ -7151,7 +7152,8 @@ function ApaasRate(props) {
7151
7152
  var address = AddressData.getInstance();
7152
7153
  var bsAddress = BsAddressData.getInstance();
7153
7154
  var Province = function Province(props) {
7154
- var type = props.type;
7155
+ var _props$type = props.type,
7156
+ type = _props$type === void 0 ? 'workOrder' : _props$type;
7155
7157
  var _useState = useState([]),
7156
7158
  _useState2 = _slicedToArray(_useState, 2),
7157
7159
  option = _useState2[0],
@@ -7162,7 +7164,7 @@ var Province = function Province(props) {
7162
7164
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7163
7165
  while (1) switch (_context.prev = _context.next) {
7164
7166
  case 0:
7165
- setOptions(type === 'workOrder' ? address.addressOptions || [] : bsAddress.addressOptions || []);
7167
+ setOptions(type !== 'bs' ? address.addressOptions || [] : bsAddress.addressOptions || []);
7166
7168
  case 1:
7167
7169
  case "end":
7168
7170
  return _context.stop();
@@ -7210,7 +7212,7 @@ var ParseLogistics = function ParseLogistics(props) {
7210
7212
  });
7211
7213
  };
7212
7214
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(TextArea, {
7213
- placeholder: "\u590D\u5236\u7269\u6D41\u4FE1\u606F\uFF0C\u70B9\u51FB\u667A\u80FD\u8BC6\u522B",
7215
+ placeholder: "\u590D\u5236\u4FE1\u606F\uFF0C\u70B9\u51FB\u667A\u80FD\u8BC6\u522B",
7214
7216
  rows: 3,
7215
7217
  value: value,
7216
7218
  onChange: function onChange(e) {
@@ -7370,9 +7372,6 @@ var BuyerNick = function BuyerNick(props) {
7370
7372
  },
7371
7373
  onBlur: function onBlur(e) {
7372
7374
  _onBlur === null || _onBlur === void 0 ? void 0 : _onBlur(e.target.value, 'buyerNick');
7373
- },
7374
- style: {
7375
- marginRight: '8px'
7376
7375
  }
7377
7376
  });
7378
7377
  };
@@ -7577,9 +7576,6 @@ var AliPay = function AliPay(props) {
7577
7576
  value: value === null || value === void 0 ? void 0 : value.name,
7578
7577
  onChange: function onChange(e) {
7579
7578
  changeValue(e, 'name');
7580
- },
7581
- style: {
7582
- marginRight: '8px'
7583
7579
  }
7584
7580
  })) : null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Input, {
7585
7581
  placeholder: "\u8BF7\u8F93\u5165\u652F\u4ED8\u5B9D\u8D26\u53F7",
@@ -7590,10 +7586,7 @@ var AliPay = function AliPay(props) {
7590
7586
  onBlur: function onBlur(e) {
7591
7587
  _onBlur === null || _onBlur === void 0 ? void 0 : _onBlur(e.target.value, 'alipayAccount');
7592
7588
  },
7593
- disabled: disabled,
7594
- style: {
7595
- marginRight: '8px'
7596
- }
7589
+ disabled: disabled
7597
7590
  })));
7598
7591
  };
7599
7592
 
@@ -8980,6 +8973,12 @@ var Payment = function Payment(props) {
8980
8973
  placeholder: '请输入支付宝账号',
8981
8974
  required: zhiFubaoRequired,
8982
8975
  show: true
8976
+ }, {
8977
+ label: '打款状态',
8978
+ name: 'enterprisePaymentStatus',
8979
+ placeholder: '',
8980
+ required: false,
8981
+ show: true
8983
8982
  }];
8984
8983
  return /*#__PURE__*/React.createElement(React.Fragment, null, PaymentList.map(function (item) {
8985
8984
  return item.show && /*#__PURE__*/React.createElement(Form.Item, {
@@ -9318,6 +9317,47 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9318
9317
  typeof onChange === 'function' && onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9319
9318
  trajectoryCompany: val
9320
9319
  }));
9320
+ handleSearchSnapshot(val);
9321
+ };
9322
+ var handleSearchSnapshot = function handleSearchSnapshot(company) {
9323
+ var trajectoryCompany = value.trajectoryCompany,
9324
+ trajectoryCode = value.trajectoryCode,
9325
+ trajectoryPhone = value.trajectoryPhone;
9326
+ var newCompany = company ? company : trajectoryCompany;
9327
+ if (newCompany === 'SF' && !(newCompany && trajectoryCode && trajectoryPhone)) {
9328
+ return;
9329
+ } else if (!(newCompany && trajectoryCode)) {
9330
+ return;
9331
+ }
9332
+ try {
9333
+ extendRequest('/qy/logistics/logisticsTraceSearch', {
9334
+ method: 'post',
9335
+ data: {
9336
+ mailNo: trajectoryCode,
9337
+ cpCode: newCompany,
9338
+ mobile: trajectoryPhone
9339
+ }
9340
+ }).then(function (res) {
9341
+ var result = res.result,
9342
+ success = res.success,
9343
+ data = res.data,
9344
+ msg = res.message;
9345
+ if (result === 100 || success) {
9346
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9347
+ trajectorySnapshot: data === null || data === void 0 ? void 0 : data.logisticsStatusDesc,
9348
+ trajectoryCompany: newCompany
9349
+ }));
9350
+ } else {
9351
+ msg && message.error(msg);
9352
+ }
9353
+ });
9354
+ } catch (err) {
9355
+ onChange(_objectSpread2(_objectSpread2({}, value), {}, {
9356
+ trajectorySnapshot: '',
9357
+ trajectoryCompany: newCompany
9358
+ }));
9359
+ (err === null || err === void 0 ? void 0 : err.message) && message.error(err === null || err === void 0 ? void 0 : err.message);
9360
+ }
9321
9361
  };
9322
9362
  //物流公司
9323
9363
  var LogisticsCompany = function LogisticsCompany() {
@@ -9329,7 +9369,8 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9329
9369
  options: options,
9330
9370
  showSearch: true,
9331
9371
  style: {
9332
- width: '100%'
9372
+ width: '100%',
9373
+ marginBottom: '8px'
9333
9374
  },
9334
9375
  filterOption: function filterOption(input, option) {
9335
9376
  return option.label.includes(input);
@@ -9344,12 +9385,35 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9344
9385
  onChange: function onChange(e) {
9345
9386
  return handleInputChange(e, 'trajectoryCode');
9346
9387
  },
9347
- value: value === null || value === void 0 ? void 0 : value.trajectoryCode
9388
+ value: value === null || value === void 0 ? void 0 : value.trajectoryCode,
9389
+ onBlur: function onBlur() {
9390
+ return handleSearchSnapshot();
9391
+ }
9392
+ });
9393
+ };
9394
+ //sf手机号
9395
+ var LogisticsPhone = function LogisticsPhone() {
9396
+ return /*#__PURE__*/React.createElement(Input, {
9397
+ disabled: disabled,
9398
+ style: {
9399
+ marginTop: '8px'
9400
+ },
9401
+ placeholder: "\u624B\u673A\u53F7",
9402
+ onChange: function onChange(e) {
9403
+ return handleInputChange(e, 'trajectoryPhone');
9404
+ },
9405
+ value: value === null || value === void 0 ? void 0 : value.trajectoryPhone,
9406
+ onBlur: function onBlur() {
9407
+ return handleSearchSnapshot();
9408
+ }
9348
9409
  });
9349
9410
  };
9350
9411
  //物流快照
9351
9412
  var LogisticsSnapshot = function LogisticsSnapshot() {
9352
9413
  return /*#__PURE__*/React.createElement(Input, {
9414
+ style: {
9415
+ marginTop: '8px'
9416
+ },
9353
9417
  disabled: true,
9354
9418
  placeholder: "\u7269\u6D41\u5FEB\u7167",
9355
9419
  onChange: function onChange(e) {
@@ -9358,7 +9422,7 @@ var LogisticsTrajectory = function LogisticsTrajectory(props) {
9358
9422
  value: value === null || value === void 0 ? void 0 : value.trajectorySnapshot
9359
9423
  });
9360
9424
  };
9361
- return /*#__PURE__*/React.createElement("div", null, LogisticsCompany(), LogisticsCode(), showField.includes('snapshot') ? /*#__PURE__*/React.createElement(LogisticsSnapshot, null) : null);
9425
+ return /*#__PURE__*/React.createElement("div", null, LogisticsCompany(), LogisticsCode(), (value === null || value === void 0 ? void 0 : value.trajectoryCompany) === 'SF' ? LogisticsPhone() : null, showField.includes('snapshot') ? /*#__PURE__*/React.createElement(LogisticsSnapshot, null) : null);
9362
9426
  };
9363
9427
 
9364
9428
  var jstGoods = function jstGoods(props) {
@@ -9422,7 +9486,7 @@ var jstGoods = function jstGoods(props) {
9422
9486
  return setChangeIndex(index);
9423
9487
  }
9424
9488
  }, "\u5305\u88F9".concat(index + 1)));
9425
- }))) : null, value.length ? /*#__PURE__*/React.createElement(React.Fragment, null, type === 1 ? /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Select, {
9489
+ }))) : null, value.length ? /*#__PURE__*/React.createElement(React.Fragment, null, type === 1 ? /*#__PURE__*/React.createElement(Space, null, !showField || showField === 'logisticsCompany' ? /*#__PURE__*/React.createElement(Select, {
9426
9490
  disabled: disabled,
9427
9491
  placeholder: "\u7269\u6D41\u516C\u53F8",
9428
9492
  onChange: function onChange(val) {
@@ -9437,14 +9501,14 @@ var jstGoods = function jstGoods(props) {
9437
9501
  style: {
9438
9502
  minWidth: '100px'
9439
9503
  }
9440
- }), /*#__PURE__*/React.createElement(Input, {
9504
+ }) : null, !showField || showField === 'logisticsCode' ? /*#__PURE__*/React.createElement(Input, {
9441
9505
  disabled: disabled,
9442
9506
  placeholder: "\u7269\u6D41\u5355\u53F7",
9443
9507
  onChange: function onChange(e) {
9444
9508
  return changeInputHandle(e.target.value, 'logisticsCode');
9445
9509
  },
9446
9510
  value: (_value$changeIndex2 = value[changeIndex]) === null || _value$changeIndex2 === void 0 ? void 0 : _value$changeIndex2.logisticsCode
9447
- })) : null, type === 2 ? /*#__PURE__*/React.createElement(Space, null, ['supplyId', 'all'].includes(showField) && /*#__PURE__*/React.createElement(Input, {
9511
+ }) : null) : null, type === 2 ? /*#__PURE__*/React.createElement(Space, null, ['supplyId', 'all'].includes(showField) && /*#__PURE__*/React.createElement(Input, {
9448
9512
  disabled: disabled,
9449
9513
  placeholder: "\u8BF7\u8F93\u5165\u4F9B\u9500\u5546\u7F16\u7801",
9450
9514
  onChange: function onChange(e) {
@@ -9630,15 +9694,13 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9630
9694
  _useState16 = _slicedToArray(_useState15, 2),
9631
9695
  platform = _useState16[0],
9632
9696
  setPlatform = _useState16[1]; //平台 taobao=淘宝 fxg=抖音 pdd=拼多多 sph=微信视屏号
9633
- // const [shopInfo, setShopInfo] = useState<any>({}); //店铺信息
9634
- var _useState17 = useState([{
9635
- tab: '所选商品',
9636
- key: 'onSale'
9637
- }
9638
- // { tab: '已选商品', key: 'select' },
9639
- ]),
9640
- _useState18 = _slicedToArray(_useState17, 1),
9641
- tabs = _useState18[0];
9697
+ var _useState17 = useState({}),
9698
+ _useState18 = _slicedToArray(_useState17, 2),
9699
+ shopInfo = _useState18[0],
9700
+ setShopInfo = _useState18[1]; //店铺信息
9701
+ var _Form$useForm = Form.useForm(),
9702
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
9703
+ form = _Form$useForm2[0];
9642
9704
  //选择页码
9643
9705
  var pageChange = function pageChange(page, pageSize) {
9644
9706
  setSearch(_objectSpread2(_objectSpread2({}, searchParams), {}, {
@@ -9668,53 +9730,56 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9668
9730
  /**
9669
9731
  * 查询商品
9670
9732
  */
9671
- var queryItems = /*#__PURE__*/function () {
9672
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9673
- var res, _ref2, items, totalCount;
9674
- return _regeneratorRuntime().wrap(function _callee$(_context) {
9675
- while (1) switch (_context.prev = _context.next) {
9676
- case 0:
9677
- _context.prev = 0;
9678
- setLoading(true);
9679
- _context.next = 4;
9680
- return extendRequest('/qy/gdfw/workOrder/queryItems', {
9681
- method: 'post',
9682
- data: queryPd()
9683
- });
9684
- case 4:
9685
- res = _context.sent;
9686
- _ref2 = res.data || {
9687
- items: [],
9688
- totalCount: 0
9689
- }, items = _ref2.items, totalCount = _ref2.totalCount;
9690
- items.forEach(function (item) {
9691
- item.platform = platform;
9692
- item.key = item.numIid;
9693
- });
9694
- setGoodList(_toConsumableArray(items));
9695
- setTotal(totalCount);
9696
- case 9:
9697
- _context.prev = 9;
9698
- setLoading(false);
9699
- return _context.finish(9);
9700
- case 12:
9701
- case "end":
9702
- return _context.stop();
9703
- }
9704
- }, _callee, null, [[0,, 9, 12]]);
9705
- }));
9706
- return function queryItems() {
9707
- return _ref.apply(this, arguments);
9708
- };
9709
- }();
9733
+ var queryItems = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9734
+ var params, res, _ref2, list, _total, nextKey, newList;
9735
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9736
+ while (1) switch (_context.prev = _context.next) {
9737
+ case 0:
9738
+ _context.prev = 0;
9739
+ setLoading(true);
9740
+ params = _objectSpread2({}, queryPd());
9741
+ params.shopName = shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.shopName;
9742
+ params.platform = platform;
9743
+ params.status = params.type === 'onSale' ? 1 : 0;
9744
+ delete params.type;
9745
+ _context.next = 9;
9746
+ return extendRequest('/qy/gdfw/product/listProduct', {
9747
+ method: 'post',
9748
+ data: params
9749
+ });
9750
+ case 9:
9751
+ res = _context.sent;
9752
+ _ref2 = res.data || {
9753
+ result: [],
9754
+ total: 0
9755
+ }, list = _ref2.result, _total = _ref2.total, nextKey = _ref2.nextKey;
9756
+ newList = list || [];
9757
+ newList.forEach(function (item) {
9758
+ item.numIid = item.productId;
9759
+ item.outerId = item.outId;
9760
+ item.title = item.productName;
9761
+ item.platform = platform;
9762
+ });
9763
+ setGoodList(newList);
9764
+ setTotal(_total);
9765
+ case 15:
9766
+ _context.prev = 15;
9767
+ setLoading(false);
9768
+ return _context.finish(15);
9769
+ case 18:
9770
+ case "end":
9771
+ return _context.stop();
9772
+ }
9773
+ }, _callee, null, [[0,, 15, 18]]);
9774
+ })), [searchParams]);
9710
9775
  useEffect(function () {
9711
9776
  var shopInfo = shopList.find(function (item) {
9712
9777
  return shopId === item.shopId || shopId === item.shopName;
9713
9778
  });
9714
- // setShopInfo(shopInfo);
9779
+ setShopInfo(shopInfo);
9715
9780
  var platform = shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.shopSourceStr.toLowerCase();
9716
9781
  setPlatform(platform);
9717
- }, []);
9782
+ }, [shopId]);
9718
9783
  var rowSelection = {
9719
9784
  selectedRowKeys: selectIds,
9720
9785
  onChange: function onChange(selectedRowKeys, selectedRows, info) {
@@ -9730,8 +9795,15 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9730
9795
  onSubmit(selectList);
9731
9796
  _onCancel();
9732
9797
  };
9798
+ var onFinish = function onFinish(value) {
9799
+ setSearch(_objectSpread2({}, searchParams));
9800
+ };
9801
+ var onReset = function onReset() {
9802
+ setSearch(_objectSpread2({}, searchParams));
9803
+ form.resetFields();
9804
+ };
9733
9805
  return /*#__PURE__*/React.createElement(Modal, {
9734
- title: '选择商品编码',
9806
+ title: '选择商品',
9735
9807
  okText: '确认',
9736
9808
  cancelText: '取消',
9737
9809
  visible: visible,
@@ -9741,42 +9813,33 @@ var GoodsModal$1 = function GoodsModal(props, ref) {
9741
9813
  },
9742
9814
  onOk: onOk,
9743
9815
  wrapClassName: "goodModal"
9744
- }, /*#__PURE__*/React.createElement(Tabs, {
9745
- type: "card",
9746
- activeKey: searchParams.type,
9747
- onChange: function onChange(e) {
9748
- var params = _objectSpread2(_objectSpread2({}, searchParams), {}, {
9749
- type: e,
9750
- pageNo: 1
9751
- });
9752
- setSearch(params);
9753
- }
9754
- }, tabs.map(function (tab) {
9755
- return /*#__PURE__*/React.createElement(TabPane$1, {
9756
- tab: tab.tab + (tab.key === 'select' ? "(".concat(selectList.length, ")") : ''),
9757
- key: tab.key
9758
- });
9759
- })), /*#__PURE__*/React.createElement("div", {
9760
- className: "searchBox",
9761
- style: {
9762
- display: searchParams.type === 'select' ? 'none' : ''
9763
- }
9764
9816
  }, /*#__PURE__*/React.createElement(Form, {
9765
- layout: "inline"
9766
- }, /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Input, {
9817
+ layout: "inline",
9818
+ form: form,
9819
+ onFinish: onFinish
9820
+ }, /*#__PURE__*/React.createElement(Form.Item, {
9821
+ name: "code"
9822
+ }, /*#__PURE__*/React.createElement(Input, {
9767
9823
  placeholder: "\u6B3E\u5F0F\u7F16\u7801"
9768
- })), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Input, {
9824
+ })), /*#__PURE__*/React.createElement(Form.Item, {
9825
+ name: "sku"
9826
+ }, /*#__PURE__*/React.createElement(Input, {
9769
9827
  placeholder: "\u5546\u54C1\u7F16\u7801"
9770
- })), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Input, {
9828
+ })), /*#__PURE__*/React.createElement(Form.Item, {
9829
+ name: "name"
9830
+ }, /*#__PURE__*/React.createElement(Input, {
9771
9831
  placeholder: "\u5546\u54C1\u540D\u79F0"
9772
9832
  })), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
9773
9833
  type: "primary",
9774
9834
  htmlType: "submit"
9775
- }, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, null, "\u91CD\u7F6E")))), /*#__PURE__*/React.createElement(Spin, {
9835
+ }, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, {
9836
+ onClick: onReset
9837
+ }, "\u91CD\u7F6E"))), /*#__PURE__*/React.createElement(Spin, {
9776
9838
  spinning: loading
9777
9839
  }, /*#__PURE__*/React.createElement(Table, {
9778
9840
  rowSelection: rowSelection,
9779
9841
  columns: columns,
9842
+ rowKey: 'numIid',
9780
9843
  dataSource: searchParams.type == 'select' ? selectList : goodList,
9781
9844
  scroll: {
9782
9845
  y: 300
@@ -9804,8 +9867,8 @@ var GoodItem = function GoodItem(props) {
9804
9867
  value = _props$value === void 0 ? [] : _props$value,
9805
9868
  onChange = props.onChange,
9806
9869
  disabled = props.disabled,
9807
- _props$showField = props.showField,
9808
- showField = _props$showField === void 0 ? [] : _props$showField,
9870
+ _props$showHeader = props.showHeader,
9871
+ showHeader = _props$showHeader === void 0 ? [] : _props$showHeader,
9809
9872
  width = props.width,
9810
9873
  _props$shopList = props.shopList,
9811
9874
  shopList = _props$shopList === void 0 ? [] : _props$shopList,
@@ -9821,11 +9884,11 @@ var GoodItem = function GoodItem(props) {
9821
9884
  otherOperations = _props$otherOperation === void 0 ? null : _props$otherOperation,
9822
9885
  _props$canUpdateNumbe = props.canUpdateNumber,
9823
9886
  canUpdateNumber = _props$canUpdateNumbe === void 0 ? false : _props$canUpdateNumbe,
9824
- _props$headerText = props.headerText,
9825
- headerText = _props$headerText === void 0 ? '' : _props$headerText,
9826
- onSelect = props.onSelect;
9887
+ onSelect = props.onSelect,
9888
+ onDelete = props.onDelete;
9827
9889
  var refModal = useRef();
9828
9890
  var handleDelete = function handleDelete(index) {
9891
+ onDelete === null || onDelete === void 0 ? void 0 : onDelete(value[index]);
9829
9892
  var newList = value.filter(function (item, i) {
9830
9893
  return index !== i;
9831
9894
  });
@@ -9835,6 +9898,11 @@ var GoodItem = function GoodItem(props) {
9835
9898
  _useState2 = _slicedToArray(_useState, 2),
9836
9899
  selectedRowKeys = _useState2[0],
9837
9900
  setSelectedRowKeys = _useState2[1];
9901
+ useEffect(function () {
9902
+ if (!tableSelect) {
9903
+ setSelectedRowKeys([]);
9904
+ }
9905
+ }, [tableSelect]);
9838
9906
  var updateHandle = function updateHandle(val, index, type) {
9839
9907
  if (value === null || value === void 0 ? void 0 : value.length) {
9840
9908
  value[index][type] = val;
@@ -9845,37 +9913,49 @@ var GoodItem = function GoodItem(props) {
9845
9913
  var GOODS_INFO_COLUMNS = function GOODS_INFO_COLUMNS() {
9846
9914
  var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
9847
9915
  return [{
9916
+ dataIndex: 'pic',
9917
+ title: "\u56FE\u7247",
9918
+ align: 'center',
9919
+ ellipsis: true,
9920
+ width: 100,
9921
+ render: function render(val) {
9922
+ return /*#__PURE__*/React.createElement(Image, {
9923
+ width: 60,
9924
+ src: val
9925
+ });
9926
+ }
9927
+ }, {
9848
9928
  dataIndex: 'name',
9849
- title: "bs".concat(text, "\u540D\u79F0"),
9929
+ title: "".concat(text, "\u540D\u79F0"),
9850
9930
  align: 'center',
9851
9931
  ellipsis: true,
9852
- width: 200
9932
+ width: 100
9853
9933
  }, {
9854
9934
  dataIndex: 'code',
9855
- title: "bs".concat(text, "\u7F16\u7801"),
9935
+ title: "".concat(text, "\u7F16\u7801"),
9856
9936
  align: 'center',
9857
9937
  ellipsis: true,
9858
- width: 200
9938
+ width: 100
9859
9939
  }, {
9860
9940
  dataIndex: 'sku',
9861
- title: "bs".concat(text, "sku\u7F16\u7801"),
9941
+ title: "".concat(text, "sku\u7F16\u7801"),
9862
9942
  align: 'center',
9863
9943
  ellipsis: true,
9864
- width: 200
9944
+ width: 100
9865
9945
  }, {
9866
9946
  dataIndex: 'money',
9867
- title: "bs\u5B9E\u4ED8\u91D1\u989D",
9947
+ title: "\u5B9E\u4ED8\u91D1\u989D",
9868
9948
  align: 'center',
9869
9949
  ellipsis: true,
9870
9950
  width: 100
9871
9951
  }, {
9872
9952
  dataIndex: 'number',
9873
- title: "bs".concat(text, "\u6570\u91CF"),
9953
+ title: "".concat(text, "\u6570\u91CF"),
9874
9954
  align: 'center',
9875
9955
  ellipsis: true,
9876
9956
  width: 100,
9877
9957
  render: function render(val, record, index) {
9878
- return canUpdateNumber && !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
9958
+ return record.canUpdateNumber && !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
9879
9959
  value: val,
9880
9960
  onChange: function onChange(num) {
9881
9961
  return updateHandle(num, index, 'number');
@@ -9884,13 +9964,13 @@ var GoodItem = function GoodItem(props) {
9884
9964
  }
9885
9965
  }, {
9886
9966
  dataIndex: 'share',
9887
- title: "bs\u5206\u644A\u4EF7",
9967
+ title: "\u5206\u644A\u4EF7",
9888
9968
  align: 'center',
9889
9969
  ellipsis: true,
9890
- width: 100
9970
+ width: 70
9891
9971
  }, {
9892
9972
  dataIndex: 'type',
9893
- title: "bs\u8D60\u54C1\u7C7B\u578B",
9973
+ title: "\u8D60\u54C1\u7C7B\u578B",
9894
9974
  align: 'center',
9895
9975
  ellipsis: true,
9896
9976
  width: 100
@@ -9906,20 +9986,8 @@ var GoodItem = function GoodItem(props) {
9906
9986
  render: function render(val, record, index) {
9907
9987
  return /*#__PURE__*/React.createElement("span", null, index + 1);
9908
9988
  }
9909
- }, {
9910
- dataIndex: 'pic',
9911
- title: "bs\u56FE\u7247",
9912
- align: 'center',
9913
- ellipsis: true,
9914
- width: 200,
9915
- render: function render(val) {
9916
- return /*#__PURE__*/React.createElement(Image, {
9917
- width: 60,
9918
- src: val
9919
- });
9920
- }
9921
- }].concat(_toConsumableArray(GOODS_INFO_COLUMNS(headerText).filter(function (t) {
9922
- return showField.includes(t === null || t === void 0 ? void 0 : t.dataIndex);
9989
+ }].concat(_toConsumableArray(GOODS_INFO_COLUMNS().filter(function (t) {
9990
+ return showHeader.includes(t === null || t === void 0 ? void 0 : t.dataIndex);
9923
9991
  })));
9924
9992
  if (!disabled) {
9925
9993
  columnList.push({
@@ -9927,6 +9995,7 @@ var GoodItem = function GoodItem(props) {
9927
9995
  title: "\u64CD\u4F5C",
9928
9996
  align: 'center',
9929
9997
  ellipsis: true,
9998
+ width: 100,
9930
9999
  render: function render(val, record, index) {
9931
10000
  return record.canDelete ? /*#__PURE__*/React.createElement(Button, {
9932
10001
  type: "link",
@@ -9938,7 +10007,7 @@ var GoodItem = function GoodItem(props) {
9938
10007
  });
9939
10008
  }
9940
10009
  return columnList;
9941
- }, [showField, value, disabled]);
10010
+ }, [showHeader, value, disabled]);
9942
10011
  var onSubmit = function onSubmit(list) {
9943
10012
  var newList = list.map(function (item) {
9944
10013
  var picUrl = item.picUrl,
@@ -9953,9 +10022,10 @@ var GoodItem = function GoodItem(props) {
9953
10022
  sku: '',
9954
10023
  money: price,
9955
10024
  share: '',
9956
- number: 3,
10025
+ number: 1,
9957
10026
  type: '',
9958
- canDelete: true
10027
+ canDelete: true,
10028
+ canUpdateNumber: canUpdateNumber
9959
10029
  };
9960
10030
  });
9961
10031
  onChange === null || onChange === void 0 ? void 0 : onChange([].concat(_toConsumableArray(value), _toConsumableArray(newList)));
@@ -9980,9 +10050,11 @@ var GoodItem = function GoodItem(props) {
9980
10050
  params.rowSelection = rowSelection;
9981
10051
  }
9982
10052
  return params;
9983
- }, [tableSelect]);
9984
- return /*#__PURE__*/React.createElement(React.Fragment, null, !disabled && showChangeBtn && /*#__PURE__*/React.createElement(Space, {
9985
- align: "end"
10053
+ }, [tableSelect, selectedRowKeys]);
10054
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !disabled && showChangeBtn && /*#__PURE__*/React.createElement("div", {
10055
+ style: {
10056
+ float: 'right'
10057
+ }
9986
10058
  }, /*#__PURE__*/React.createElement(Button, {
9987
10059
  type: "link",
9988
10060
  onClick: handleChangeGoods
@@ -10025,7 +10097,7 @@ var BsGoods = function BsGoods(props) {
10025
10097
  var ref = useRef();
10026
10098
  var reissueRef = useRef();
10027
10099
  useEffect(function () {
10028
- ref.current = pubsub.subscribe('type', function (type, val) {
10100
+ ref.current = pubsub.subscribeOnce('type', function (type, val) {
10029
10101
  console.log('goods', type, val, value);
10030
10102
  if (disabled) return;
10031
10103
  setWithInfo({
@@ -10033,7 +10105,7 @@ var BsGoods = function BsGoods(props) {
10033
10105
  val: val
10034
10106
  });
10035
10107
  setTableSelect(['2', '4'].includes(val));
10036
- if (['1', '3'].includes(val)) {
10108
+ if (['1', '3'].includes(val) && (value === null || value === void 0 ? void 0 : value.length)) {
10037
10109
  pubsub.publish('selectList', {
10038
10110
  type: val,
10039
10111
  list: _toConsumableArray(value).map(function (item) {
@@ -10042,10 +10114,9 @@ var BsGoods = function BsGoods(props) {
10042
10114
  })
10043
10115
  });
10044
10116
  }
10045
- // pubsub.unsubscribe('type');
10046
10117
  });
10047
10118
  //补发
10048
- reissueRef.current = pubsub.subscribe('reissueType', function (type, val) {
10119
+ reissueRef.current = pubsub.subscribeOnce('reissueType', function (type, val) {
10049
10120
  if (disabled) return;
10050
10121
  console.log('reissueType', type, val, value);
10051
10122
  setWithInfo({
@@ -10053,7 +10124,7 @@ var BsGoods = function BsGoods(props) {
10053
10124
  val: val
10054
10125
  });
10055
10126
  setTableSelect(['2', '4'].includes(val));
10056
- if (['1', '3'].includes(val)) {
10127
+ if (['1', '3'].includes(val) && (value === null || value === void 0 ? void 0 : value.length)) {
10057
10128
  pubsub.publish('reissueSelectList', {
10058
10129
  type: val,
10059
10130
  list: (value || []).map(function (item) {
@@ -10062,9 +10133,7 @@ var BsGoods = function BsGoods(props) {
10062
10133
  })
10063
10134
  });
10064
10135
  }
10065
- // pubsub.unsubscribe('reissueType');
10066
10136
  });
10067
-
10068
10137
  return function () {
10069
10138
  pubsub.unsubscribe(ref.current);
10070
10139
  pubsub.unsubscribe(reissueRef.current);
@@ -10072,30 +10141,38 @@ var BsGoods = function BsGoods(props) {
10072
10141
  }, [value, withInfo, disabled]);
10073
10142
  var _onSelect = useCallback(function (list) {
10074
10143
  if (disabled) return;
10075
- // console.log('withInfo', withInfo, list);
10144
+ console.log('withInfo', withInfo, list);
10145
+ var newList = cloneDeep(list);
10076
10146
  pubsub.publish(withInfo.type === 'reissueType' ? 'reissueSelectList' : 'selectList', {
10077
10147
  type: withInfo.val,
10078
- list: list.map(function (item) {
10148
+ list: newList.map(function (item) {
10079
10149
  item.canDelete = true;
10080
10150
  return item;
10081
10151
  })
10082
10152
  });
10083
10153
  }, [withInfo]);
10154
+ var _onDelete = function onDelete(item) {
10155
+ var deleteId = item === null || item === void 0 ? void 0 : item.id;
10156
+ pubsub.publish('deleteGood', deleteId);
10157
+ pubsub.publish('reissueDeleteGood', deleteId);
10158
+ };
10084
10159
  return /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10085
10160
  key: 'bsGoods',
10086
- headerText: "\u5546\u54C1",
10087
10161
  disabled: disabled
10088
10162
  }, props), {}, {
10089
10163
  tableSelect: tableSelect,
10090
10164
  onSelect: function onSelect(list) {
10091
10165
  return _onSelect(list);
10166
+ },
10167
+ onDelete: function onDelete(item) {
10168
+ return _onDelete(item);
10092
10169
  }
10093
10170
  }));
10094
10171
  };
10095
10172
 
10096
10173
  var _excluded$b = ["value", "onChange", "reasonList", "disabled"];
10097
10174
  var BsExchange = function BsExchange(props) {
10098
- var _value$bsExchangeType2, _value$bsExchangeType3, _value$bsExchangeType4;
10175
+ var _value$bsExchangeType4, _value$bsExchangeType5, _value$bsExchangeType6;
10099
10176
  var value = props.value,
10100
10177
  onChange = props.onChange,
10101
10178
  _props$reasonList = props.reasonList,
@@ -10103,25 +10180,39 @@ var BsExchange = function BsExchange(props) {
10103
10180
  disabled = props.disabled,
10104
10181
  other = _objectWithoutProperties(props, _excluded$b);
10105
10182
  useEffect(function () {
10106
- pubsub.subscribe('selectList', function (_, data) {
10183
+ pubsub.subscribeOnce('selectList', function (_, data) {
10107
10184
  if (disabled) return;
10108
10185
  if (value) {
10109
- // console.log(
10110
- // 'BsExchange',
10111
- // 'getListHandle',
10112
- // data,
10113
- // value,
10114
- // getListHandle([...data.list], value),
10115
- // );
10186
+ var newData = cloneDeep(data);
10187
+ console.log('BsExchange', 'getListHandle', data, value, getListHandle(_toConsumableArray(newData.list), value));
10116
10188
  onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10117
- bsExchangeReturnGoods: getListHandle(_toConsumableArray(data.list), value)
10189
+ bsExchangeReturnGoods: getListHandle(_toConsumableArray(newData.list), value)
10118
10190
  }));
10119
10191
  }
10120
- pubsub.unsubscribe('selectList');
10192
+ });
10193
+ pubsub.subscribeOnce('deleteGood', function (_, data) {
10194
+ if (disabled) return;
10195
+ if (value) {
10196
+ var _value$bsExchangeType, _value$bsExchangeType2;
10197
+ var newValue = _objectSpread2({}, value);
10198
+ if (['2', '4'].includes((_value$bsExchangeType = value.bsExchangeType) === null || _value$bsExchangeType === void 0 ? void 0 : _value$bsExchangeType[0])) {
10199
+ newValue.bsExchangeReturnGoods = newValue.bsExchangeReturnGoods.map(function (item) {
10200
+ item.bsExchangeReturnGoods = item.bsExchangeReturnGoods.filter(function (t) {
10201
+ return t.id !== data;
10202
+ });
10203
+ return item;
10204
+ });
10205
+ } else if (['1', '3'].includes((_value$bsExchangeType2 = value.bsExchangeType) === null || _value$bsExchangeType2 === void 0 ? void 0 : _value$bsExchangeType2[0])) {
10206
+ newValue.bsExchangeReturnGoods = newValue.bsExchangeReturnGoods.filter(function (item) {
10207
+ return item.id !== data;
10208
+ });
10209
+ }
10210
+ onChange(newValue);
10211
+ }
10121
10212
  });
10122
10213
  }, [value]);
10123
10214
  var getListHandle = function getListHandle(list, val) {
10124
- var _val$bsExchangeType;
10215
+ var _val$bsExchangeType, _val$bsExchangeType2;
10125
10216
  //如果是原单换
10126
10217
  if (['1', '3'].includes(val === null || val === void 0 ? void 0 : (_val$bsExchangeType = val.bsExchangeType) === null || _val$bsExchangeType === void 0 ? void 0 : _val$bsExchangeType[0])) {
10127
10218
  return list.reduce(function (prv, next) {
@@ -10138,7 +10229,7 @@ var BsExchange = function BsExchange(props) {
10138
10229
  }
10139
10230
  return prv;
10140
10231
  }, []);
10141
- } else {
10232
+ } else if (['2', '4'].includes(val === null || val === void 0 ? void 0 : (_val$bsExchangeType2 = val.bsExchangeType) === null || _val$bsExchangeType2 === void 0 ? void 0 : _val$bsExchangeType2[0])) {
10142
10233
  //补发换货
10143
10234
  return list.reduce(function (prv, next, index) {
10144
10235
  next.canDelete = true;
@@ -10163,6 +10254,14 @@ var BsExchange = function BsExchange(props) {
10163
10254
  }, []);
10164
10255
  }
10165
10256
  };
10257
+ var changeTypeHandle = function changeTypeHandle(val) {
10258
+ var newValue = _objectSpread2({}, value);
10259
+ newValue.bsExchangeType = val;
10260
+ newValue.bsExchangeReturnGoods = [];
10261
+ newValue.bsExchangeGiftGoods = [];
10262
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10263
+ pubsub.publish('type', val[0]);
10264
+ };
10166
10265
  var changeHandle = function changeHandle(val, key) {
10167
10266
  var newValue = _objectSpread2({}, value);
10168
10267
  newValue[key] = val;
@@ -10177,19 +10276,22 @@ var BsExchange = function BsExchange(props) {
10177
10276
  var newValue = _objectSpread2({}, value);
10178
10277
  newValue.bsExchangeReturnGoods[index][key] = (val || []).map(function (t) {
10179
10278
  t.index = index;
10279
+ if (key === 'bsExchangeGiftGoods') {
10280
+ t.money = 0;
10281
+ }
10180
10282
  return t;
10181
10283
  });
10182
10284
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10183
10285
  };
10184
10286
  //显示选择商品按钮 原单换不显示选择商品
10185
10287
  var showChangeBtn = useMemo(function () {
10186
- var _value$bsExchangeType;
10187
- return ['2', '4'].includes(value === null || value === void 0 ? void 0 : (_value$bsExchangeType = value.bsExchangeType) === null || _value$bsExchangeType === void 0 ? void 0 : _value$bsExchangeType[0]) || disabled;
10288
+ var _value$bsExchangeType3;
10289
+ return ['2', '4'].includes(value === null || value === void 0 ? void 0 : (_value$bsExchangeType3 = value.bsExchangeType) === null || _value$bsExchangeType3 === void 0 ? void 0 : _value$bsExchangeType3[0]) || !!disabled;
10188
10290
  }, [value === null || value === void 0 ? void 0 : value.bsExchangeType]);
10189
10291
  var copyGoods = function copyGoods(index) {
10190
10292
  var copyHandle = function copyHandle() {
10191
10293
  var newValue = _objectSpread2({}, value);
10192
- newValue.bsExchangeReturnGoods[index]['bsExchangeSwapOutGoods'] = _objectSpread2(_objectSpread2({}, newValue.bsExchangeReturnGoods[index]['bsExchangeSwapOutGoods']), newValue.bsExchangeReturnGoods[index]['bsExchangeReturnGoods']);
10294
+ newValue.bsExchangeReturnGoods[index]['bsExchangeSwapOutGoods'] = [].concat(_toConsumableArray(newValue.bsExchangeReturnGoods[index]['bsExchangeSwapOutGoods']), _toConsumableArray(newValue.bsExchangeReturnGoods[index]['bsExchangeReturnGoods']));
10193
10295
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, newValue));
10194
10296
  };
10195
10297
  return /*#__PURE__*/React.createElement(Button, {
@@ -10198,32 +10300,32 @@ var BsExchange = function BsExchange(props) {
10198
10300
  }, "\u590D\u5236\u9000\u56DE\u5546\u54C1");
10199
10301
  };
10200
10302
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Cascader, {
10303
+ style: {
10304
+ marginBottom: '8px'
10305
+ },
10201
10306
  disabled: disabled,
10202
10307
  allowClear: false,
10203
10308
  options: reasonList,
10204
10309
  value: value === null || value === void 0 ? void 0 : value.bsExchangeType,
10205
10310
  onChange: function onChange(val) {
10206
- return changeHandle(val, 'bsExchangeType');
10311
+ return changeTypeHandle(val);
10207
10312
  }
10208
- }), !(value === null || value === void 0 ? void 0 : (_value$bsExchangeType2 = value.bsExchangeType) === null || _value$bsExchangeType2 === void 0 ? void 0 : _value$bsExchangeType2.length) ? /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10313
+ }), !(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({
10209
10314
  key: 'bsExchangeGoods'
10210
10315
  }, other), {}, {
10211
- headerText: "\u5546\u54C1",
10212
10316
  disabled: disabled,
10213
10317
  showChangeBtn: false
10214
- })) : null, ['1', '3'].includes(value === null || value === void 0 ? void 0 : (_value$bsExchangeType3 = value.bsExchangeType) === null || _value$bsExchangeType3 === void 0 ? void 0 : _value$bsExchangeType3[0]) ? /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10318
+ })) : 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({
10215
10319
  key: 'bsExchangeGoods'
10216
10320
  }, other), {}, {
10217
- headerText: "\u5546\u54C1",
10218
10321
  disabled: disabled,
10219
- showChangeBtn: showChangeBtn,
10322
+ showChangeBtn: false,
10220
10323
  value: value === null || value === void 0 ? void 0 : value.bsExchangeReturnGoods,
10221
10324
  onChange: function onChange(val) {
10222
10325
  return changeHandle(val, 'bsExchangeReturnGoods');
10223
10326
  }
10224
10327
  })) : /*#__PURE__*/React.createElement(React.Fragment, null, ((value === null || value === void 0 ? void 0 : value.bsExchangeReturnGoods) || []).map(function (item, index) {
10225
10328
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, "\u9000\u56DE\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10226
- headerText: "\u9000\u56DE",
10227
10329
  key: 'bsReturnGoods'
10228
10330
  }, other), {}, {
10229
10331
  disabled: disabled,
@@ -10233,20 +10335,17 @@ var BsExchange = function BsExchange(props) {
10233
10335
  return changeReturnHandle(val, index, 'bsExchangeReturnGoods');
10234
10336
  }
10235
10337
  })), /*#__PURE__*/React.createElement("div", null, "\u6362\u51FA\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10236
- headerText: "\u6362\u51FA",
10237
10338
  key: 'bsOutGoods'
10238
10339
  }, other), {}, {
10239
10340
  disabled: disabled,
10240
10341
  showChangeBtn: showChangeBtn,
10241
- otherOperations: function otherOperations() {
10242
- return copyGoods(index);
10243
- },
10342
+ otherOperations: copyGoods(index),
10244
10343
  value: item === null || item === void 0 ? void 0 : item.bsExchangeSwapOutGoods,
10245
10344
  onChange: function onChange(val) {
10246
10345
  return changeReturnHandle(val, index, 'bsExchangeSwapOutGoods');
10247
10346
  }
10248
10347
  })));
10249
- })), ['3', '4'].includes(value === null || value === void 0 ? void 0 : (_value$bsExchangeType4 = value.bsExchangeType) === null || _value$bsExchangeType4 === void 0 ? void 0 : _value$bsExchangeType4[0]) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, "\u8D60\u54C1\u4FE1\u606F"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10348
+ })), ['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({
10250
10349
  headerText: "\u8D60\u54C1",
10251
10350
  key: 'bsGiftGoods',
10252
10351
  disabled: disabled
@@ -10267,22 +10366,32 @@ var BsReissue = function BsReissue(props) {
10267
10366
  disabled = props.disabled,
10268
10367
  other = _objectWithoutProperties(props, _excluded$c);
10269
10368
  useEffect(function () {
10270
- pubsub.subscribe('reissueSelectList', function (_, data) {
10369
+ pubsub.subscribeOnce('reissueSelectList', function (_, data) {
10271
10370
  if (disabled) return;
10272
- // console.log(data, value);
10371
+ console.log(data, value);
10273
10372
  if (value) {
10373
+ var newData = cloneDeep(data);
10274
10374
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10275
- bsReissueGoods: ((data === null || data === void 0 ? void 0 : data.list) || []).map(function (item) {
10375
+ bsReissueGoods: ((newData === null || newData === void 0 ? void 0 : newData.list) || []).map(function (item) {
10276
10376
  item.money = 0;
10377
+ item.canUpdateNumber = ['2', '4'].includes(newData === null || newData === void 0 ? void 0 : newData.type);
10277
10378
  return item;
10278
10379
  })
10279
10380
  }));
10280
10381
  }
10281
- pubsub.unsubscribe('reissueSelectList');
10382
+ });
10383
+ pubsub.subscribeOnce('reissueDeleteGood', function (_, data) {
10384
+ if (disabled) return;
10385
+ if (value) {
10386
+ var newValue = _objectSpread2({}, value);
10387
+ newValue.bsReissueGoods = newValue.bsReissueGoods.filter(function (item) {
10388
+ return item.id !== data;
10389
+ });
10390
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10391
+ }
10282
10392
  });
10283
10393
  }, [value, disabled]);
10284
10394
  var changeHandle = function changeHandle(val, key) {
10285
- console.log('changeHandle', val, key, value);
10286
10395
  var newValue = _objectSpread2({}, value);
10287
10396
  if (key === 'bsReissueGoods') {
10288
10397
  val = (val || []).map(function (item) {
@@ -10305,6 +10414,9 @@ var BsReissue = function BsReissue(props) {
10305
10414
  return ['2', '3', '4'].includes(value === null || value === void 0 ? void 0 : (_value$bsReissueType = value.bsReissueType) === null || _value$bsReissueType === void 0 ? void 0 : _value$bsReissueType[0]);
10306
10415
  }, [value === null || value === void 0 ? void 0 : value.bsReissueType]);
10307
10416
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Cascader, {
10417
+ style: {
10418
+ marginBottom: '8px'
10419
+ },
10308
10420
  disabled: disabled,
10309
10421
  allowClear: false,
10310
10422
  options: reasonList,
@@ -10313,11 +10425,10 @@ var BsReissue = function BsReissue(props) {
10313
10425
  return changeHandle(val, 'bsReissueType');
10314
10426
  }
10315
10427
  }), /*#__PURE__*/React.createElement("div", null, "\u9000\u56DE\u5546\u54C1"), /*#__PURE__*/React.createElement(GoodItem, _objectSpread2(_objectSpread2({
10316
- headerText: "\u8865\u53D1",
10317
10428
  key: 'reissueGoods'
10318
10429
  }, other), {}, {
10319
10430
  disabled: disabled,
10320
- canUpdateNumber: true,
10431
+ canUpdateNumber: showChangeBtn,
10321
10432
  showChangeBtn: showChangeBtn,
10322
10433
  value: value === null || value === void 0 ? void 0 : value.bsReissueGoods,
10323
10434
  onChange: function onChange(val) {