@kmkf-fe-packages/basic-components 2.0.12-beta.25 → 2.0.12-beta.26

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.js CHANGED
@@ -14388,6 +14388,12 @@ var getColumns$4 = function getColumns(_ref) {
14388
14388
  };
14389
14389
  };
14390
14390
 
14391
+ var fillAttrs = function fillAttrs(item) {
14392
+ if (!item.width) item.width = 150;
14393
+ if (typeof item.ellipsis !== 'boolean') item.ellipsis = true;
14394
+ if (!item.align) item.align = 'center';
14395
+ return item;
14396
+ };
14391
14397
  var getColumns$5 = function getColumns() {
14392
14398
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
14393
14399
  _ref$text = _ref.text,
@@ -14641,7 +14647,218 @@ var getColumns$5 = function getColumns() {
14641
14647
  }
14642
14648
  }) : /*#__PURE__*/React__default['default'].createElement("span", null, val);
14643
14649
  }
14644
- }]
14650
+ }],
14651
+ JST_RETURN_GOODS: [{
14652
+ dataIndex: 'name',
14653
+ title: '商品名称'
14654
+ }, {
14655
+ dataIndex: 'skuId',
14656
+ title: '商品编码'
14657
+ }, {
14658
+ dataIndex: 'iId',
14659
+ title: '款式编码'
14660
+ }, {
14661
+ dataIndex: 'pic',
14662
+ title: '商品图片',
14663
+ width: 100,
14664
+ render: function render(val) {
14665
+ return /*#__PURE__*/React__default['default'].createElement(antd.Image, {
14666
+ width: 60,
14667
+ src: val
14668
+ });
14669
+ }
14670
+ }, {
14671
+ dataIndex: 'propertiesValue',
14672
+ title: '规格值'
14673
+ }, {
14674
+ dataIndex: 'saleBasePrice',
14675
+ title: '原价',
14676
+ render: function render(price) {
14677
+ return price || price === 0 ? Number(price).toFixed(2) : '';
14678
+ }
14679
+ }, {
14680
+ dataIndex: 'salePrice',
14681
+ title: '单价',
14682
+ width: 120,
14683
+ render: function render(val, record, index) {
14684
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
14685
+ style: {
14686
+ width: 70
14687
+ },
14688
+ value: val,
14689
+ min: 0,
14690
+ precision: 2,
14691
+ onChange: function onChange(num) {
14692
+ return updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(num, index, 'salePrice');
14693
+ }
14694
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val || val === 0 ? Number(val).toFixed(2) : '');
14695
+ }
14696
+ }, {
14697
+ dataIndex: 'qty',
14698
+ title: '数量',
14699
+ width: 100,
14700
+ render: function render(val, record, index) {
14701
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
14702
+ style: {
14703
+ width: 70
14704
+ },
14705
+ value: val,
14706
+ min: 1,
14707
+ precision: 0,
14708
+ onChange: function onChange(num) {
14709
+ return updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(num, index, 'qty');
14710
+ }
14711
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val);
14712
+ }
14713
+ }, {
14714
+ dataIndex: 'saleAmount',
14715
+ title: '总金额',
14716
+ render: function render(val, record) {
14717
+ return (record.qty || 0) * (+record.salePrice || 0);
14718
+ }
14719
+ }, {
14720
+ dataIndex: 'batchId',
14721
+ title: '批次号'
14722
+ }, {
14723
+ dataIndex: 'isGift',
14724
+ title: '是否赠品',
14725
+ width: 100,
14726
+ render: function render(val, record, index) {
14727
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.Select, {
14728
+ value: val,
14729
+ onChange: function onChange(value) {
14730
+ updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(value, index, 'isGift');
14731
+ },
14732
+ options: [{
14733
+ label: '是',
14734
+ value: true
14735
+ }, {
14736
+ label: '否',
14737
+ value: false
14738
+ }]
14739
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, typeof val !== 'boolean' ? '' : val ? '是' : '否');
14740
+ }
14741
+ }, {
14742
+ dataIndex: 'remark',
14743
+ title: '备注',
14744
+ render: function render(val, record, index) {
14745
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.Input, {
14746
+ style: {
14747
+ width: 70
14748
+ },
14749
+ value: val,
14750
+ onChange: function onChange(e) {
14751
+ return updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(e.target.value, index, 'remark');
14752
+ }
14753
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val);
14754
+ }
14755
+ }, {
14756
+ dataIndex: 'outerOiId',
14757
+ title: '子订单号',
14758
+ width: 240
14759
+ }].map(fillAttrs),
14760
+ JST_EXCHANGE_GOODS: [{
14761
+ dataIndex: 'name',
14762
+ title: '商品名称'
14763
+ }, {
14764
+ dataIndex: 'skuId',
14765
+ title: '商品编码'
14766
+ }, {
14767
+ dataIndex: 'iId',
14768
+ title: '款式编码'
14769
+ }, {
14770
+ dataIndex: 'pic',
14771
+ title: '商品图片',
14772
+ width: 100,
14773
+ render: function render(val) {
14774
+ return /*#__PURE__*/React__default['default'].createElement(antd.Image, {
14775
+ width: 60,
14776
+ src: val
14777
+ });
14778
+ }
14779
+ }, {
14780
+ dataIndex: 'propertiesValue',
14781
+ title: '规格值'
14782
+ }, {
14783
+ dataIndex: 'saleBasePrice',
14784
+ title: '原价',
14785
+ render: function render(price) {
14786
+ return price || price === 0 ? Number(price).toFixed(2) : '';
14787
+ }
14788
+ }, {
14789
+ dataIndex: 'salePrice',
14790
+ title: '单价',
14791
+ width: 120,
14792
+ render: function render(val, record, index) {
14793
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
14794
+ style: {
14795
+ width: 70
14796
+ },
14797
+ value: val,
14798
+ min: 0,
14799
+ precision: 2,
14800
+ onChange: function onChange(num) {
14801
+ return updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(num, index, 'salePrice');
14802
+ }
14803
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val || val === 0 ? Number(val).toFixed(2) : '');
14804
+ }
14805
+ }, {
14806
+ dataIndex: 'qty',
14807
+ title: '数量',
14808
+ width: 100,
14809
+ render: function render(val, record, index) {
14810
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.InputNumber, {
14811
+ style: {
14812
+ width: 70
14813
+ },
14814
+ value: val,
14815
+ min: 1,
14816
+ precision: 0,
14817
+ onChange: function onChange(num) {
14818
+ return updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(num, index, 'qty');
14819
+ }
14820
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val);
14821
+ }
14822
+ }, {
14823
+ dataIndex: 'saleAmount',
14824
+ title: '总金额',
14825
+ render: function render(val, record) {
14826
+ return (record.qty || 0) * (+record.salePrice || 0);
14827
+ }
14828
+ }, {
14829
+ dataIndex: 'isGift',
14830
+ title: '是否赠品',
14831
+ width: 100,
14832
+ render: function render(val, record, index) {
14833
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.Select, {
14834
+ value: val,
14835
+ onChange: function onChange(value) {
14836
+ updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(value, index, 'isGift');
14837
+ },
14838
+ options: [{
14839
+ label: '是',
14840
+ value: true
14841
+ }, {
14842
+ label: '否',
14843
+ value: false
14844
+ }]
14845
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, typeof val !== 'boolean' ? '' : val ? '是' : '否');
14846
+ }
14847
+ }, {
14848
+ dataIndex: 'remark',
14849
+ title: '备注',
14850
+ render: function render(val, record, index) {
14851
+ return !disabled ? /*#__PURE__*/React__default['default'].createElement(antd.Input, {
14852
+ style: {
14853
+ width: 70
14854
+ },
14855
+ value: val,
14856
+ onChange: function onChange(e) {
14857
+ return updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(e.target.value, index, 'remark');
14858
+ }
14859
+ }) : /*#__PURE__*/React__default['default'].createElement("span", null, val);
14860
+ }
14861
+ }].map(fillAttrs)
14645
14862
  };
14646
14863
  };
14647
14864
 
@@ -14889,39 +15106,49 @@ var getBsE3ReissueGoodColumns = function getBsE3ReissueGoodColumns(_ref4) {
14889
15106
  };
14890
15107
 
14891
15108
  var GoodsModalMap = {
14892
- 'WDT_REISSUE_GOODS': WdtGoodsModal,
14893
- 'WDT_GOODS': WdtGoodsModal,
14894
- 'WDT_EXCHANGE_GOODS': WdtGoodsModal,
14895
- 'BS_E3_REISSUE_GOODS': BsE3GoodsModal,
14896
- 'BS_E3_GOODS': BsE3GoodsModal,
14897
- 'BS_E3_EXCHANGE_GOODS': BsE3GoodsModal,
14898
- 'GY_GOODS': GyGoodsModal$2,
14899
- 'GY_REISSUE_GOODS': GyGoodsModal$2,
14900
- 'JST_GOODS': JstGoodsModal,
14901
- 'JST_REISSUE_GOODS': JstGoodsModal,
14902
- 'OTHER_GOODS': GoodsModal$2
15109
+ WDT_REISSUE_GOODS: WdtGoodsModal,
15110
+ WDT_GOODS: WdtGoodsModal,
15111
+ WDT_EXCHANGE_GOODS: WdtGoodsModal,
15112
+ BS_E3_REISSUE_GOODS: BsE3GoodsModal,
15113
+ BS_E3_GOODS: BsE3GoodsModal,
15114
+ BS_E3_EXCHANGE_GOODS: BsE3GoodsModal,
15115
+ GY_GOODS: GyGoodsModal$2,
15116
+ GY_REISSUE_GOODS: GyGoodsModal$2,
15117
+ JST_GOODS: JstGoodsModal,
15118
+ JST_REISSUE_GOODS: JstGoodsModal,
15119
+ JST_RETURN_GOODS: JstGoodsModal,
15120
+ JST_EXCHANGE_GOODS: JstGoodsModal,
15121
+ OTHER_GOODS: GoodsModal$2
14903
15122
  };
14904
- var MAIN_FIELD = 'uuid';
14905
15123
  var SelectTradeGoods = function SelectTradeGoods(_ref) {
14906
15124
  var columns = _ref.columns,
14907
15125
  dataSource = _ref.dataSource,
15126
+ getDataSourceAsync = _ref.getDataSourceAsync,
14908
15127
  selectedRowKeys = _ref.selectedRowKeys,
14909
- onChangeSelectedKeys = _ref.onChangeSelectedKeys;
15128
+ onChangeSelectedKeys = _ref.onChangeSelectedKeys,
15129
+ _ref$uniqueKey = _ref.uniqueKey,
15130
+ uniqueKey = _ref$uniqueKey === void 0 ? 'uuid' : _ref$uniqueKey;
14910
15131
  var _useState = React.useState(false),
14911
15132
  _useState2 = _slicedToArray(_useState, 2),
14912
15133
  tradeGoodsVisible = _useState2[0],
14913
15134
  setTradeGoodsVisible = _useState2[1];
14914
15135
  var openModal = function openModal() {
14915
- return setTradeGoodsVisible(true);
15136
+ if (getDataSourceAsync) {
15137
+ getDataSourceAsync().then(function () {
15138
+ setTradeGoodsVisible(true);
15139
+ });
15140
+ } else {
15141
+ setTradeGoodsVisible(true);
15142
+ }
14916
15143
  };
14917
15144
  var closeModal = function closeModal() {
14918
15145
  return setTradeGoodsVisible(false);
14919
15146
  };
14920
15147
  var currentTradeOriginGoods = lodash.intersection(dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
14921
- return item === null || item === void 0 ? void 0 : item[MAIN_FIELD];
15148
+ return item === null || item === void 0 ? void 0 : item[uniqueKey];
14922
15149
  }), selectedRowKeys);
14923
15150
  var unCurrentTradeOriginGoods = lodash.difference(selectedRowKeys, dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
14924
- return item === null || item === void 0 ? void 0 : item[MAIN_FIELD];
15151
+ return item === null || item === void 0 ? void 0 : item[uniqueKey];
14925
15152
  }));
14926
15153
  var handleChangeSelectedKeys = function handleChangeSelectedKeys(keys) {
14927
15154
  console.log('handleChangeSelectedKeys', keys, unCurrentTradeOriginGoods);
@@ -14940,7 +15167,7 @@ var SelectTradeGoods = function SelectTradeGoods(_ref) {
14940
15167
  footer: null,
14941
15168
  onCancel: closeModal
14942
15169
  }, /*#__PURE__*/React__default['default'].createElement(antd.Table, {
14943
- rowKey: MAIN_FIELD,
15170
+ rowKey: uniqueKey,
14944
15171
  rowSelection: rowSelection,
14945
15172
  columns: columns,
14946
15173
  dataSource: dataSource,
@@ -14962,7 +15189,7 @@ var getButtonText = function getButtonText() {
14962
15189
  if (['GY_GOODS', 'GY_REISSUE_GOODS'].includes(type)) {
14963
15190
  return '选择管易ERP商品';
14964
15191
  }
14965
- if (['JST_GOODS', 'JST_REISSUE_GOODS'].includes(type)) {
15192
+ if (['JST_GOODS', 'JST_REISSUE_GOODS', 'JST_RETURN_GOODS', 'JST_EXCHANGE_GOODS'].includes(type)) {
14966
15193
  return '选择聚水潭ERP商品';
14967
15194
  }
14968
15195
  return '选择商品';
@@ -14984,6 +15211,8 @@ var GoodItem$1 = function GoodItem(props) {
14984
15211
  maxLength = _props$maxLength === void 0 ? 20 : _props$maxLength,
14985
15212
  _props$showChangeBtn = props.showChangeBtn,
14986
15213
  showChangeBtn = _props$showChangeBtn === void 0 ? true : _props$showChangeBtn,
15214
+ _props$showErpGoodsBt = props.showErpGoodsBtn,
15215
+ showErpGoodsBtn = _props$showErpGoodsBt === void 0 ? true : _props$showErpGoodsBt,
14987
15216
  _props$showModeBtn = props.showModeBtn,
14988
15217
  showModeBtn = _props$showModeBtn === void 0 ? false : _props$showModeBtn,
14989
15218
  _props$isStrict = props.isStrict,
@@ -15003,6 +15232,7 @@ var GoodItem$1 = function GoodItem(props) {
15003
15232
  onDelete = props.onDelete,
15004
15233
  onModeChange = props.onModeChange,
15005
15234
  tradeGoods = props.tradeGoods;
15235
+ var uniqueKey = (tradeGoods === null || tradeGoods === void 0 ? void 0 : tradeGoods.uniqueKey) || 'uuid';
15006
15236
  var refModal = React.useRef();
15007
15237
  console.debug('表格数据', value);
15008
15238
  var handleDelete = function handleDelete(record, index) {
@@ -15022,7 +15252,7 @@ var GoodItem$1 = function GoodItem(props) {
15022
15252
  // TODO: 商品订单中以选中商品
15023
15253
  var selectedGoods = React.useMemo(function () {
15024
15254
  return value === null || value === void 0 ? void 0 : value.map(function (v) {
15025
- return v === null || v === void 0 ? void 0 : v[MAIN_FIELD];
15255
+ return v === null || v === void 0 ? void 0 : v[uniqueKey];
15026
15256
  });
15027
15257
  }, [value]);
15028
15258
  var updateHandle = function updateHandle(val, index, columnType) {
@@ -15077,6 +15307,8 @@ var GoodItem$1 = function GoodItem(props) {
15077
15307
  case 'GY_GOODS':
15078
15308
  case 'JST_GOODS':
15079
15309
  case 'JST_REISSUE_GOODS':
15310
+ case 'JST_EXCHANGE_GOODS':
15311
+ case 'JST_RETURN_GOODS':
15080
15312
  case 'GY_REISSUE_GOODS':
15081
15313
  {
15082
15314
  columns = getColumnsMap({
@@ -15258,7 +15490,7 @@ var GoodItem$1 = function GoodItem(props) {
15258
15490
  originAmount: !kmkfUtils.isNull(retailPrice) ? Number(retailPrice) : null
15259
15491
  });
15260
15492
  });
15261
- } else if (['JST_GOODS', 'JST_REISSUE_GOODS'].includes(type)) {
15493
+ } else if (['JST_GOODS', 'JST_REISSUE_GOODS', 'JST_RETURN_GOODS', 'JST_EXCHANGE_GOODS'].includes(type)) {
15262
15494
  newList = list.map(function (item) {
15263
15495
  return {
15264
15496
  name: item.goodName,
@@ -15306,7 +15538,7 @@ var GoodItem$1 = function GoodItem(props) {
15306
15538
  var onSelectChange = function onSelectChange(newSelectedRowKeys) {
15307
15539
  setSelectedRowKeys(newSelectedRowKeys);
15308
15540
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(value.filter(function (t) {
15309
- return newSelectedRowKeys.includes(t.uuid);
15541
+ return newSelectedRowKeys.includes(t[uniqueKey]);
15310
15542
  }));
15311
15543
  };
15312
15544
  var handleChangeGoods = function handleChangeGoods() {
@@ -15338,17 +15570,19 @@ var GoodItem$1 = function GoodItem(props) {
15338
15570
  checked: isStrict,
15339
15571
  onChange: handleCheckboxChange
15340
15572
  }, "\u5408\u5E76\u5355\uFF0C\u52FE\u9009\u540E\u53EA\u5C55\u793A\u5F53\u524D\u5E73\u53F0\u8BA2\u5355\u5546\u54C1"), !lodash.isEmpty(tradeGoods) && /*#__PURE__*/React__default['default'].createElement(SelectTradeGoods, {
15573
+ uniqueKey: uniqueKey,
15341
15574
  columns: orderColumns,
15342
15575
  dataSource: tradeGoods.originDataSource,
15576
+ getDataSourceAsync: tradeGoods.getDataSourceAsync,
15343
15577
  selectedRowKeys: selectedGoods,
15344
15578
  onChangeSelectedKeys: tradeGoods.selectedGoodsChange
15345
- }), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
15579
+ }), showErpGoodsBtn && /*#__PURE__*/React__default['default'].createElement(antd.Button, {
15346
15580
  type: "link",
15347
15581
  onClick: handleChangeGoods
15348
15582
  }, getButtonText(type)), otherOperations), /*#__PURE__*/React__default['default'].createElement(antd.Table, _objectSpread2(_objectSpread2({}, tableConfig), {}, {
15349
15583
  columns: newColumns,
15350
15584
  dataSource: value,
15351
- rowKey: 'uuid',
15585
+ rowKey: uniqueKey,
15352
15586
  size: "small",
15353
15587
  pagination: false,
15354
15588
  scroll: {
@@ -17000,27 +17234,57 @@ var CommonReturnGoods = function CommonReturnGoods(props) {
17000
17234
  };
17001
17235
 
17002
17236
  var componentMap$3 = {
17003
- 'WDT_EXCHANGE_GOODS': {
17237
+ WDT_EXCHANGE_GOODS: {
17004
17238
  type: 'wdt',
17005
17239
  valueKey: 'wdtExchangeGoods',
17006
17240
  returnTypeKey: 'wdtExchangeType',
17007
17241
  name: '旺店通',
17008
17242
  eventNameMap: {
17009
- changeShopCode: 'wdtChangeShopCode',
17010
- exchangeDeleteGood: 'wdtExchangeDeleteGood',
17243
+ // pubsub 事件
17011
17244
  exchangeCopyGood: 'wdtExchangeCopyGood',
17012
17245
  exchangeBackCopyGood: 'wdtExchangeBackCopyGood'
17013
17246
  }
17247
+ },
17248
+ JST_EXCHANGE_GOODS: {
17249
+ type: 'jst',
17250
+ valueKey: 'jstExchangeGoods',
17251
+ returnTypeKey: 'jstExchangeType',
17252
+ systemOrder: 'jstSystemOrder',
17253
+ systemOrderNo: 'jstSystemOrderNo',
17254
+ oIdKey: 'oId',
17255
+ goodDetailsKey: 'items',
17256
+ skuIdKey: 'skuId',
17257
+ outerOiIdKey: '',
17258
+ name: '聚水潭',
17259
+ updateGoodsHandle: kmkfUtils.updateJstGoodsHandle,
17260
+ eventNameMap: {
17261
+ // pubsub 事件
17262
+ exchangeCopyGood: 'jstExchangeCopyGood',
17263
+ exchangeBackCopyGood: 'jstExchangeBackCopyGood',
17264
+ returnGoodsSysorder: 'jstReturnGoodsSysorder',
17265
+ returnGoodsSysorderBack: 'jstReturnGoodsSysorderBack'
17266
+ }
17014
17267
  }
17015
17268
  };
17016
17269
  var CommonExchangeGoods = function CommonExchangeGoods(props) {
17270
+ var _componentMap$compTyp, _componentMap$compTyp4;
17017
17271
  var value = props.value,
17018
17272
  onChange = props.onChange,
17019
17273
  disabled = props.disabled,
17020
17274
  compType = props.type;
17275
+ var uniqueKey = (componentMap$3 === null || componentMap$3 === void 0 ? void 0 : (_componentMap$compTyp = componentMap$3[compType]) === null || _componentMap$compTyp === void 0 ? void 0 : _componentMap$compTyp.skuIdKey) || 'uuid';
17021
17276
  var valueRef = React.useRef({});
17277
+ // PS: 目前选择订单商品,只有聚水潭换出商品,而且聚水潭不用考虑合并单,所以这个值一直是 false
17278
+ var _useState = React.useState(false),
17279
+ _useState2 = _slicedToArray(_useState, 2),
17280
+ isStrict = _useState2[0],
17281
+ setIsStrict = _useState2[1];
17282
+ var _useState3 = React.useState([]),
17283
+ _useState4 = _slicedToArray(_useState3, 2),
17284
+ originDataSource = _useState4[0],
17285
+ setOriginDataSource = _useState4[1];
17022
17286
  React.useEffect(function () {
17023
- var subscription = pubsub__default['default'].subscribe(componentMap$3[compType].eventNameMap.exchangeBackCopyGood, function (_, data) {
17287
+ var subscription = componentMap$3[compType].eventNameMap.exchangeBackCopyGood && pubsub__default['default'].subscribe(componentMap$3[compType].eventNameMap.exchangeBackCopyGood, function (_, data) {
17024
17288
  if (disabled) return;
17025
17289
  var newValue = {
17026
17290
  shopCode: data === null || data === void 0 ? void 0 : data.shopCode
@@ -17042,26 +17306,11 @@ var CommonExchangeGoods = function CommonExchangeGoods(props) {
17042
17306
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
17043
17307
  });
17044
17308
  return function () {
17045
- pubsub__default['default'].unsubscribe(subscription);
17309
+ subscription && pubsub__default['default'].unsubscribe(subscription);
17046
17310
  };
17047
- });
17311
+ }, []);
17048
17312
  React.useEffect(function () {
17049
17313
  valueRef.current = value;
17050
- pubsub__default['default'].subscribeOnce(componentMap$3[compType].eventNameMap.exchangeDeleteGood, function (_, data) {
17051
- if (disabled) return;
17052
- if (value) {
17053
- var newValue = _objectSpread2({}, value);
17054
- newValue[componentMap$3[compType].valueKey] = newValue[componentMap$3[compType].valueKey].filter(function (item) {
17055
- return item.sku !== data;
17056
- });
17057
- onChange(newValue);
17058
- }
17059
- });
17060
- pubsub__default['default'].subscribeOnce(componentMap$3[compType].eventNameMap.changeShopCode, function (type, data) {
17061
- onChange(_objectSpread2(_objectSpread2({}, value), {}, {
17062
- shopCode: data.shopCode
17063
- }));
17064
- });
17065
17314
  }, [value]);
17066
17315
  var changeGoodHandle = function changeGoodHandle(val) {
17067
17316
  var newValue = _objectSpread2({}, value);
@@ -17076,13 +17325,53 @@ var CommonExchangeGoods = function CommonExchangeGoods(props) {
17076
17325
  };
17077
17326
  var copyGoods = function copyGoods() {
17078
17327
  var copyHandle = function copyHandle() {
17079
- pubsub__default['default'].publish(componentMap$3[compType].eventNameMap.exchangeCopyGood, 'WDT_EXCHANGE_GOODS');
17328
+ pubsub__default['default'].publish(componentMap$3[compType].eventNameMap.exchangeCopyGood, compType);
17080
17329
  };
17081
17330
  return /*#__PURE__*/React__default['default'].createElement(antd.Button, {
17082
17331
  type: "link",
17083
17332
  onClick: copyHandle
17084
17333
  }, "\u590D\u5236\u9000\u56DE\u5546\u54C1");
17085
17334
  };
17335
+ var selectedGoodsChange = React.useCallback(function (skuList) {
17336
+ var _componentMap$compTyp2, _componentMap$compTyp3, _uniqBy;
17337
+ var newValue = _objectSpread2({}, value);
17338
+ // 原订单商品
17339
+ var originTradeGoodList = originDataSource || [];
17340
+ // 当前选中的所有商品【包含了原订单+商品库】
17341
+ var currentSelectGoodList = (value === null || value === void 0 ? void 0 : value[componentMap$3 === null || componentMap$3 === void 0 ? void 0 : (_componentMap$compTyp2 = componentMap$3[compType]) === null || _componentMap$compTyp2 === void 0 ? void 0 : _componentMap$compTyp2.valueKey]) || [];
17342
+ newValue[componentMap$3 === null || componentMap$3 === void 0 ? void 0 : (_componentMap$compTyp3 = componentMap$3[compType]) === null || _componentMap$compTyp3 === void 0 ? void 0 : _componentMap$compTyp3.valueKey] = (_uniqBy = lodash.uniqBy(originTradeGoodList.concat(currentSelectGoodList), uniqueKey)) === null || _uniqBy === void 0 ? void 0 : _uniqBy.filter(function (item) {
17343
+ return skuList.includes(item[uniqueKey]);
17344
+ });
17345
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
17346
+ }, [value === null || value === void 0 ? void 0 : value[componentMap$3 === null || componentMap$3 === void 0 ? void 0 : (_componentMap$compTyp4 = componentMap$3[compType]) === null || _componentMap$compTyp4 === void 0 ? void 0 : _componentMap$compTyp4.valueKey], isStrict, originDataSource]);
17347
+ var getGoodDetails = function getGoodDetails(_ref) {
17348
+ var _componentMap$compTyp5, _componentMap$compTyp6, _order$componentMap$c, _componentMap$compTyp7;
17349
+ var returnGoodsValue = _ref.returnGoodsValue,
17350
+ mode = _ref.mode,
17351
+ sysOrderNo = _ref.sysOrderNo;
17352
+ var systemOrder = returnGoodsValue === null || returnGoodsValue === void 0 ? void 0 : returnGoodsValue[(_componentMap$compTyp5 = componentMap$3[compType]) === null || _componentMap$compTyp5 === void 0 ? void 0 : _componentMap$compTyp5.systemOrder];
17353
+ var systemOrderNo = sysOrderNo !== null && sysOrderNo !== void 0 ? sysOrderNo : returnGoodsValue === null || returnGoodsValue === void 0 ? void 0 : returnGoodsValue[(_componentMap$compTyp6 = componentMap$3[compType]) === null || _componentMap$compTyp6 === void 0 ? void 0 : _componentMap$compTyp6.systemOrderNo];
17354
+ var order = systemOrderNo && ((systemOrder === null || systemOrder === void 0 ? void 0 : systemOrder.orders) || []).find(function (order) {
17355
+ return order[componentMap$3[compType].oIdKey] === systemOrderNo;
17356
+ });
17357
+ var goodDetails = kmkfUtils.jstMergeIdenticalGoods((order === null || order === void 0 ? void 0 : (_order$componentMap$c = order[componentMap$3[compType].goodDetailsKey]) === null || _order$componentMap$c === void 0 ? void 0 : _order$componentMap$c.length) ? (_componentMap$compTyp7 = componentMap$3[compType]) === null || _componentMap$compTyp7 === void 0 ? void 0 : _componentMap$compTyp7.updateGoodsHandle([order], true) : []);
17358
+ var orderNo = systemOrder === null || systemOrder === void 0 ? void 0 : systemOrder.orderNo;
17359
+ return mode ? goodDetails.filter(function (goodItem) {
17360
+ return !orderNo || goodItem[componentMap$3[compType].outerOiIdKey] === orderNo;
17361
+ }) : goodDetails;
17362
+ };
17363
+ var getDataSourceAsync = function getDataSourceAsync() {
17364
+ return new Promise(function (resolve) {
17365
+ pubsub__default['default'].subscribeOnce(componentMap$3[compType].eventNameMap.returnGoodsSysorderBack, function (_, data) {
17366
+ resolve(data);
17367
+ setOriginDataSource(getGoodDetails({
17368
+ returnGoodsValue: data,
17369
+ mode: isStrict
17370
+ }));
17371
+ });
17372
+ pubsub__default['default'].publish(componentMap$3[compType].eventNameMap.returnGoodsSysorder, compType);
17373
+ });
17374
+ };
17086
17375
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(GoodItem$1, _objectSpread2(_objectSpread2({
17087
17376
  key: componentMap$3[compType].type
17088
17377
  }, props), {}, {
@@ -17092,6 +17381,12 @@ var CommonExchangeGoods = function CommonExchangeGoods(props) {
17092
17381
  shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
17093
17382
  value: value === null || value === void 0 ? void 0 : value[componentMap$3[compType].valueKey],
17094
17383
  otherOperations: copyGoods(),
17384
+ tradeGoods: {
17385
+ uniqueKey: uniqueKey,
17386
+ originDataSource: originDataSource,
17387
+ getDataSourceAsync: getDataSourceAsync,
17388
+ selectedGoodsChange: selectedGoodsChange
17389
+ },
17095
17390
  onChange: function onChange(val) {
17096
17391
  return changeGoodHandle(val);
17097
17392
  }
@@ -17373,6 +17668,7 @@ var wdtReissue = function wdtReissue(props) {
17373
17668
  var _excluded$i = ["value", "onChange", "reasonList", "disabled", "type"];
17374
17669
  var typeMap$2 = {
17375
17670
  JST_REISSUE_GOODS: {
17671
+ compType: '补发',
17376
17672
  key: 'jstReissueGoods',
17377
17673
  typeName: 'jstReissueType',
17378
17674
  systemOrder: 'jstSystemOrder',
@@ -17382,12 +17678,34 @@ var typeMap$2 = {
17382
17678
  updateGoodsHandle: kmkfUtils.updateJstGoodsHandle,
17383
17679
  orderTypeKey: 'orderType',
17384
17680
  oIdKey: 'oId',
17385
- outerOiIdKey: 'outerOiId',
17681
+ outerOiIdKey: '',
17386
17682
  goodDetailsKey: 'items'
17683
+ },
17684
+ JST_RETURN_GOODS: {
17685
+ compType: '退货',
17686
+ key: 'jstReturnGoods',
17687
+ typeName: 'jstReturnType',
17688
+ systemOrder: 'jstSystemOrder',
17689
+ systemOrderNo: 'jstSystemOrderNo',
17690
+ systemOrderBillType: 'jstSystemOrderBillType',
17691
+ getOrderList: jstUtils.getJstOrderListSingleton,
17692
+ updateGoodsHandle: kmkfUtils.updateJstGoodsHandle,
17693
+ orderTypeKey: 'orderType',
17694
+ oIdKey: 'oId',
17695
+ outerOiIdKey: '',
17696
+ goodDetailsKey: 'items',
17697
+ showErpGoodsBtn: false,
17698
+ eventNameMap: {
17699
+ // pubsub 事件
17700
+ exchangeCopyGood: 'jstExchangeCopyGood',
17701
+ exchangeBackCopyGood: 'jstExchangeBackCopyGood',
17702
+ returnGoodsSysorder: 'jstReturnGoodsSysorder',
17703
+ returnGoodsSysorderBack: 'jstReturnGoodsSysorderBack'
17704
+ }
17387
17705
  }
17388
17706
  };
17389
17707
  var PublicReissue = function PublicReissue(props) {
17390
- var _typeMap$type32, _typeMap$type35, _typeMap$type36, _typeMap$type37, _value$typeMap$type$s6, _typeMap$type38, _typeMap$type39, _typeMap$type40, _typeMap$type41, _typeMap$type42;
17708
+ var _typeMap$type31, _typeMap$type34, _typeMap$type35, _typeMap$type36, _typeMap$type37, _value$typeMap$type$s6, _typeMap$type38, _typeMap$type39, _typeMap$type40, _typeMap$type41, _typeMap$type42, _typeMap$type43;
17391
17709
  var value = props.value,
17392
17710
  onChange = props.onChange,
17393
17711
  _props$reasonList = props.reasonList,
@@ -17410,6 +17728,30 @@ var PublicReissue = function PublicReissue(props) {
17410
17728
  }
17411
17729
  return;
17412
17730
  }, [value]);
17731
+ var valueRef = React.useRef({});
17732
+ React.useEffect(function () {
17733
+ valueRef.current = value;
17734
+ }, [value]);
17735
+ React.useEffect(function () {
17736
+ var subscription;
17737
+ var subscription2;
17738
+ if (typeMap$2[type].eventNameMap) {
17739
+ subscription = pubsub__default['default'].subscribe(typeMap$2[type].eventNameMap.exchangeCopyGood, function () {
17740
+ var _valueRef$current, _valueRef$current2;
17741
+ pubsub__default['default'].publish(typeMap$2[type].eventNameMap.exchangeBackCopyGood, {
17742
+ list: lodash.cloneDeep((valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current = valueRef.current) === null || _valueRef$current === void 0 ? void 0 : _valueRef$current[typeMap$2[type].key]) || []),
17743
+ shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current2 = valueRef.current) === null || _valueRef$current2 === void 0 ? void 0 : _valueRef$current2.shopCode
17744
+ });
17745
+ });
17746
+ subscription2 = pubsub__default['default'].subscribe(typeMap$2[type].eventNameMap.returnGoodsSysorder, function () {
17747
+ pubsub__default['default'].publish(typeMap$2[type].eventNameMap.returnGoodsSysorderBack, lodash.cloneDeep(valueRef.current));
17748
+ });
17749
+ }
17750
+ return function () {
17751
+ subscription && pubsub__default['default'].unsubscribe(subscription);
17752
+ subscription2 && pubsub__default['default'].unsubscribe(subscription2);
17753
+ };
17754
+ }, []);
17413
17755
  var getOrderList = /*#__PURE__*/function () {
17414
17756
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(orderNo) {
17415
17757
  var _typeMap$type4;
@@ -17521,29 +17863,26 @@ var PublicReissue = function PublicReissue(props) {
17521
17863
  }
17522
17864
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
17523
17865
  };
17524
- //显示选择商品按钮 原单换不显示选择商品
17525
- var showChangeBtn = React.useMemo(function () {
17526
- var _typeMap$type31;
17527
- return !!(value === null || value === void 0 ? void 0 : value[(_typeMap$type31 = typeMap$2[type]) === null || _typeMap$type31 === void 0 ? void 0 : _typeMap$type31.systemOrderNo]);
17528
- }, [value === null || value === void 0 ? void 0 : value[(_typeMap$type32 = typeMap$2[type]) === null || _typeMap$type32 === void 0 ? void 0 : _typeMap$type32.systemOrderNo]]);
17866
+ //显示选择商品按钮
17867
+ var showChangeBtn = !!(value === null || value === void 0 ? void 0 : value[(_typeMap$type31 = typeMap$2[type]) === null || _typeMap$type31 === void 0 ? void 0 : _typeMap$type31.systemOrderNo]);
17529
17868
  var selectedGoodsChange = React.useCallback(function (skuList) {
17530
- var _typeMap$type33, _typeMap$type34, _uniqBy;
17869
+ var _typeMap$type32, _typeMap$type33, _uniqBy;
17531
17870
  var newValue = _objectSpread2({}, value);
17532
17871
  // 原订单商品
17533
17872
  var originTradeGoodList = getGoodDetails({
17534
17873
  mode: isStrict
17535
17874
  }) || [];
17536
17875
  // 当前选中的所有商品【包含了原订单+商品库】
17537
- var currentSelectGoodList = (value === null || value === void 0 ? void 0 : value["".concat(typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type33 = typeMap$2[type]) === null || _typeMap$type33 === void 0 ? void 0 : _typeMap$type33.key)]) || [];
17538
- newValue["".concat(typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type34 = typeMap$2[type]) === null || _typeMap$type34 === void 0 ? void 0 : _typeMap$type34.key)] = (_uniqBy = lodash.uniqBy(originTradeGoodList.concat(currentSelectGoodList), 'uuid')) === null || _uniqBy === void 0 ? void 0 : _uniqBy.filter(function (item) {
17876
+ var currentSelectGoodList = (value === null || value === void 0 ? void 0 : value["".concat(typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type32 = typeMap$2[type]) === null || _typeMap$type32 === void 0 ? void 0 : _typeMap$type32.key)]) || [];
17877
+ newValue["".concat(typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type33 = typeMap$2[type]) === null || _typeMap$type33 === void 0 ? void 0 : _typeMap$type33.key)] = (_uniqBy = lodash.uniqBy(originTradeGoodList.concat(currentSelectGoodList), 'uuid')) === null || _uniqBy === void 0 ? void 0 : _uniqBy.filter(function (item) {
17539
17878
  return skuList.includes(item.uuid);
17540
17879
  });
17541
17880
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
17542
- }, [value === null || value === void 0 ? void 0 : value["".concat(typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type35 = typeMap$2[type]) === null || _typeMap$type35 === void 0 ? void 0 : _typeMap$type35.key)], isStrict]);
17881
+ }, [value === null || value === void 0 ? void 0 : value["".concat(typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type34 = typeMap$2[type]) === null || _typeMap$type34 === void 0 ? void 0 : _typeMap$type34.key)], isStrict]);
17543
17882
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.Row, {
17544
17883
  gutter: 8,
17545
17884
  wrap: true,
17546
- id: (typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type36 = typeMap$2[type]) === null || _typeMap$type36 === void 0 ? void 0 : _typeMap$type36.key) || "".concat(Date.now())
17885
+ id: (typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type35 = typeMap$2[type]) === null || _typeMap$type35 === void 0 ? void 0 : _typeMap$type35.key) || "".concat(Date.now())
17547
17886
  }, /*#__PURE__*/React__default['default'].createElement(antd.Col, {
17548
17887
  className: "gutter-row",
17549
17888
  xs: {
@@ -17558,11 +17897,11 @@ var PublicReissue = function PublicReissue(props) {
17558
17897
  },
17559
17898
  disabled: disabled,
17560
17899
  allowClear: false,
17561
- value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type37 = typeMap$2[type]) === null || _typeMap$type37 === void 0 ? void 0 : _typeMap$type37.systemOrderNo)],
17900
+ value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type36 = typeMap$2[type]) === null || _typeMap$type36 === void 0 ? void 0 : _typeMap$type36.systemOrderNo)],
17562
17901
  onChange: function onChange(val) {
17563
17902
  return changeSystemOrderHandle(val);
17564
17903
  },
17565
- placeholder: "\u9009\u62E9\u8865\u53D1\u7CFB\u7EDF\u5355"
17904
+ placeholder: "\u9009\u62E9".concat((typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type37 = typeMap$2[type]) === null || _typeMap$type37 === void 0 ? void 0 : _typeMap$type37.compType) || '', "\u7CFB\u7EDF\u5355")
17566
17905
  }, ((value === null || value === void 0 ? void 0 : (_value$typeMap$type$s6 = value[(_typeMap$type38 = typeMap$2[type]) === null || _typeMap$type38 === void 0 ? void 0 : _typeMap$type38.systemOrder]) === null || _value$typeMap$type$s6 === void 0 ? void 0 : _value$typeMap$type$s6.showOrderInfo) || []).map(function (item) {
17567
17906
  return /*#__PURE__*/React__default['default'].createElement(antd.Select.Option, {
17568
17907
  key: item[typeMap$2[type].oIdKey],
@@ -17607,8 +17946,9 @@ var PublicReissue = function PublicReissue(props) {
17607
17946
  disabled: disabled,
17608
17947
  canUpdateNumber: showChangeBtn,
17609
17948
  showChangeBtn: showChangeBtn,
17949
+ showErpGoodsBtn: typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type42 = typeMap$2[type]) === null || _typeMap$type42 === void 0 ? void 0 : _typeMap$type42.showErpGoodsBtn,
17610
17950
  shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
17611
- value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type42 = typeMap$2[type]) === null || _typeMap$type42 === void 0 ? void 0 : _typeMap$type42.key)],
17951
+ value: value === null || value === void 0 ? void 0 : value["".concat(typeMap$2 === null || typeMap$2 === void 0 ? void 0 : (_typeMap$type43 = typeMap$2[type]) === null || _typeMap$type43 === void 0 ? void 0 : _typeMap$type43.key)],
17612
17952
  onChange: function onChange(val) {
17613
17953
  return changeGoodHandle(val);
17614
17954
  },