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

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
@@ -14376,6 +14376,12 @@ var getColumns$4 = function getColumns(_ref) {
14376
14376
  };
14377
14377
  };
14378
14378
 
14379
+ var fillAttrs = function fillAttrs(item) {
14380
+ if (!item.width) item.width = 150;
14381
+ if (typeof item.ellipsis !== 'boolean') item.ellipsis = true;
14382
+ if (!item.align) item.align = 'center';
14383
+ return item;
14384
+ };
14379
14385
  var getColumns$5 = function getColumns() {
14380
14386
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
14381
14387
  _ref$text = _ref.text,
@@ -14629,7 +14635,218 @@ var getColumns$5 = function getColumns() {
14629
14635
  }
14630
14636
  }) : /*#__PURE__*/React.createElement("span", null, val);
14631
14637
  }
14632
- }]
14638
+ }],
14639
+ JST_RETURN_GOODS: [{
14640
+ dataIndex: 'name',
14641
+ title: '商品名称'
14642
+ }, {
14643
+ dataIndex: 'skuId',
14644
+ title: '商品编码'
14645
+ }, {
14646
+ dataIndex: 'iId',
14647
+ title: '款式编码'
14648
+ }, {
14649
+ dataIndex: 'pic',
14650
+ title: '商品图片',
14651
+ width: 100,
14652
+ render: function render(val) {
14653
+ return /*#__PURE__*/React.createElement(Image, {
14654
+ width: 60,
14655
+ src: val
14656
+ });
14657
+ }
14658
+ }, {
14659
+ dataIndex: 'propertiesValue',
14660
+ title: '规格值'
14661
+ }, {
14662
+ dataIndex: 'saleBasePrice',
14663
+ title: '原价',
14664
+ render: function render(price) {
14665
+ return price || price === 0 ? Number(price).toFixed(2) : '';
14666
+ }
14667
+ }, {
14668
+ dataIndex: 'salePrice',
14669
+ title: '单价',
14670
+ width: 120,
14671
+ render: function render(val, record, index) {
14672
+ return !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
14673
+ style: {
14674
+ width: 70
14675
+ },
14676
+ value: val,
14677
+ min: 0,
14678
+ precision: 2,
14679
+ onChange: function onChange(num) {
14680
+ return updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(num, index, 'salePrice');
14681
+ }
14682
+ }) : /*#__PURE__*/React.createElement("span", null, val || val === 0 ? Number(val).toFixed(2) : '');
14683
+ }
14684
+ }, {
14685
+ dataIndex: 'qty',
14686
+ title: '数量',
14687
+ width: 100,
14688
+ render: function render(val, record, index) {
14689
+ return !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
14690
+ style: {
14691
+ width: 70
14692
+ },
14693
+ value: val,
14694
+ min: 1,
14695
+ precision: 0,
14696
+ onChange: function onChange(num) {
14697
+ return updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(num, index, 'qty');
14698
+ }
14699
+ }) : /*#__PURE__*/React.createElement("span", null, val);
14700
+ }
14701
+ }, {
14702
+ dataIndex: 'saleAmount',
14703
+ title: '总金额',
14704
+ render: function render(val, record) {
14705
+ return (record.qty || 0) * (+record.salePrice || 0);
14706
+ }
14707
+ }, {
14708
+ dataIndex: 'batchId',
14709
+ title: '批次号'
14710
+ }, {
14711
+ dataIndex: 'isGift',
14712
+ title: '是否赠品',
14713
+ width: 100,
14714
+ render: function render(val, record, index) {
14715
+ return !disabled ? /*#__PURE__*/React.createElement(Select, {
14716
+ value: val,
14717
+ onChange: function onChange(value) {
14718
+ updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(value, index, 'isGift');
14719
+ },
14720
+ options: [{
14721
+ label: '是',
14722
+ value: true
14723
+ }, {
14724
+ label: '否',
14725
+ value: false
14726
+ }]
14727
+ }) : /*#__PURE__*/React.createElement("span", null, typeof val !== 'boolean' ? '' : val ? '是' : '否');
14728
+ }
14729
+ }, {
14730
+ dataIndex: 'remark',
14731
+ title: '备注',
14732
+ render: function render(val, record, index) {
14733
+ return !disabled ? /*#__PURE__*/React.createElement(Input, {
14734
+ style: {
14735
+ width: 70
14736
+ },
14737
+ value: val,
14738
+ onChange: function onChange(e) {
14739
+ return updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(e.target.value, index, 'remark');
14740
+ }
14741
+ }) : /*#__PURE__*/React.createElement("span", null, val);
14742
+ }
14743
+ }, {
14744
+ dataIndex: 'outerOiId',
14745
+ title: '子订单号',
14746
+ width: 240
14747
+ }].map(fillAttrs),
14748
+ JST_EXCHANGE_GOODS: [{
14749
+ dataIndex: 'name',
14750
+ title: '商品名称'
14751
+ }, {
14752
+ dataIndex: 'skuId',
14753
+ title: '商品编码'
14754
+ }, {
14755
+ dataIndex: 'iId',
14756
+ title: '款式编码'
14757
+ }, {
14758
+ dataIndex: 'pic',
14759
+ title: '商品图片',
14760
+ width: 100,
14761
+ render: function render(val) {
14762
+ return /*#__PURE__*/React.createElement(Image, {
14763
+ width: 60,
14764
+ src: val
14765
+ });
14766
+ }
14767
+ }, {
14768
+ dataIndex: 'propertiesValue',
14769
+ title: '规格值'
14770
+ }, {
14771
+ dataIndex: 'saleBasePrice',
14772
+ title: '原价',
14773
+ render: function render(price) {
14774
+ return price || price === 0 ? Number(price).toFixed(2) : '';
14775
+ }
14776
+ }, {
14777
+ dataIndex: 'salePrice',
14778
+ title: '单价',
14779
+ width: 120,
14780
+ render: function render(val, record, index) {
14781
+ return !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
14782
+ style: {
14783
+ width: 70
14784
+ },
14785
+ value: val,
14786
+ min: 0,
14787
+ precision: 2,
14788
+ onChange: function onChange(num) {
14789
+ return updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(num, index, 'salePrice');
14790
+ }
14791
+ }) : /*#__PURE__*/React.createElement("span", null, val || val === 0 ? Number(val).toFixed(2) : '');
14792
+ }
14793
+ }, {
14794
+ dataIndex: 'qty',
14795
+ title: '数量',
14796
+ width: 100,
14797
+ render: function render(val, record, index) {
14798
+ return !disabled ? /*#__PURE__*/React.createElement(InputNumber, {
14799
+ style: {
14800
+ width: 70
14801
+ },
14802
+ value: val,
14803
+ min: 1,
14804
+ precision: 0,
14805
+ onChange: function onChange(num) {
14806
+ return updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(num, index, 'qty');
14807
+ }
14808
+ }) : /*#__PURE__*/React.createElement("span", null, val);
14809
+ }
14810
+ }, {
14811
+ dataIndex: 'saleAmount',
14812
+ title: '总金额',
14813
+ render: function render(val, record) {
14814
+ return (record.qty || 0) * (+record.salePrice || 0);
14815
+ }
14816
+ }, {
14817
+ dataIndex: 'isGift',
14818
+ title: '是否赠品',
14819
+ width: 100,
14820
+ render: function render(val, record, index) {
14821
+ return !disabled ? /*#__PURE__*/React.createElement(Select, {
14822
+ value: val,
14823
+ onChange: function onChange(value) {
14824
+ updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(value, index, 'isGift');
14825
+ },
14826
+ options: [{
14827
+ label: '是',
14828
+ value: true
14829
+ }, {
14830
+ label: '否',
14831
+ value: false
14832
+ }]
14833
+ }) : /*#__PURE__*/React.createElement("span", null, typeof val !== 'boolean' ? '' : val ? '是' : '否');
14834
+ }
14835
+ }, {
14836
+ dataIndex: 'remark',
14837
+ title: '备注',
14838
+ render: function render(val, record, index) {
14839
+ return !disabled ? /*#__PURE__*/React.createElement(Input, {
14840
+ style: {
14841
+ width: 70
14842
+ },
14843
+ value: val,
14844
+ onChange: function onChange(e) {
14845
+ return updateHandle === null || updateHandle === void 0 ? void 0 : updateHandle(e.target.value, index, 'remark');
14846
+ }
14847
+ }) : /*#__PURE__*/React.createElement("span", null, val);
14848
+ }
14849
+ }].map(fillAttrs)
14633
14850
  };
14634
14851
  };
14635
14852
 
@@ -14877,39 +15094,49 @@ var getBsE3ReissueGoodColumns = function getBsE3ReissueGoodColumns(_ref4) {
14877
15094
  };
14878
15095
 
14879
15096
  var GoodsModalMap = {
14880
- 'WDT_REISSUE_GOODS': WdtGoodsModal,
14881
- 'WDT_GOODS': WdtGoodsModal,
14882
- 'WDT_EXCHANGE_GOODS': WdtGoodsModal,
14883
- 'BS_E3_REISSUE_GOODS': BsE3GoodsModal,
14884
- 'BS_E3_GOODS': BsE3GoodsModal,
14885
- 'BS_E3_EXCHANGE_GOODS': BsE3GoodsModal,
14886
- 'GY_GOODS': GyGoodsModal$2,
14887
- 'GY_REISSUE_GOODS': GyGoodsModal$2,
14888
- 'JST_GOODS': JstGoodsModal,
14889
- 'JST_REISSUE_GOODS': JstGoodsModal,
14890
- 'OTHER_GOODS': GoodsModal$2
15097
+ WDT_REISSUE_GOODS: WdtGoodsModal,
15098
+ WDT_GOODS: WdtGoodsModal,
15099
+ WDT_EXCHANGE_GOODS: WdtGoodsModal,
15100
+ BS_E3_REISSUE_GOODS: BsE3GoodsModal,
15101
+ BS_E3_GOODS: BsE3GoodsModal,
15102
+ BS_E3_EXCHANGE_GOODS: BsE3GoodsModal,
15103
+ GY_GOODS: GyGoodsModal$2,
15104
+ GY_REISSUE_GOODS: GyGoodsModal$2,
15105
+ JST_GOODS: JstGoodsModal,
15106
+ JST_REISSUE_GOODS: JstGoodsModal,
15107
+ JST_RETURN_GOODS: JstGoodsModal,
15108
+ JST_EXCHANGE_GOODS: JstGoodsModal,
15109
+ OTHER_GOODS: GoodsModal$2
14891
15110
  };
14892
- var MAIN_FIELD = 'uuid';
14893
15111
  var SelectTradeGoods = function SelectTradeGoods(_ref) {
14894
15112
  var columns = _ref.columns,
14895
15113
  dataSource = _ref.dataSource,
15114
+ getDataSourceAsync = _ref.getDataSourceAsync,
14896
15115
  selectedRowKeys = _ref.selectedRowKeys,
14897
- onChangeSelectedKeys = _ref.onChangeSelectedKeys;
15116
+ onChangeSelectedKeys = _ref.onChangeSelectedKeys,
15117
+ _ref$uniqueKey = _ref.uniqueKey,
15118
+ uniqueKey = _ref$uniqueKey === void 0 ? 'uuid' : _ref$uniqueKey;
14898
15119
  var _useState = useState(false),
14899
15120
  _useState2 = _slicedToArray(_useState, 2),
14900
15121
  tradeGoodsVisible = _useState2[0],
14901
15122
  setTradeGoodsVisible = _useState2[1];
14902
15123
  var openModal = function openModal() {
14903
- return setTradeGoodsVisible(true);
15124
+ if (getDataSourceAsync) {
15125
+ getDataSourceAsync().then(function () {
15126
+ setTradeGoodsVisible(true);
15127
+ });
15128
+ } else {
15129
+ setTradeGoodsVisible(true);
15130
+ }
14904
15131
  };
14905
15132
  var closeModal = function closeModal() {
14906
15133
  return setTradeGoodsVisible(false);
14907
15134
  };
14908
15135
  var currentTradeOriginGoods = intersection(dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
14909
- return item === null || item === void 0 ? void 0 : item[MAIN_FIELD];
15136
+ return item === null || item === void 0 ? void 0 : item[uniqueKey];
14910
15137
  }), selectedRowKeys);
14911
15138
  var unCurrentTradeOriginGoods = difference(selectedRowKeys, dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
14912
- return item === null || item === void 0 ? void 0 : item[MAIN_FIELD];
15139
+ return item === null || item === void 0 ? void 0 : item[uniqueKey];
14913
15140
  }));
14914
15141
  var handleChangeSelectedKeys = function handleChangeSelectedKeys(keys) {
14915
15142
  console.log('handleChangeSelectedKeys', keys, unCurrentTradeOriginGoods);
@@ -14928,7 +15155,7 @@ var SelectTradeGoods = function SelectTradeGoods(_ref) {
14928
15155
  footer: null,
14929
15156
  onCancel: closeModal
14930
15157
  }, /*#__PURE__*/React.createElement(Table, {
14931
- rowKey: MAIN_FIELD,
15158
+ rowKey: uniqueKey,
14932
15159
  rowSelection: rowSelection,
14933
15160
  columns: columns,
14934
15161
  dataSource: dataSource,
@@ -14950,7 +15177,7 @@ var getButtonText = function getButtonText() {
14950
15177
  if (['GY_GOODS', 'GY_REISSUE_GOODS'].includes(type)) {
14951
15178
  return '选择管易ERP商品';
14952
15179
  }
14953
- if (['JST_GOODS', 'JST_REISSUE_GOODS'].includes(type)) {
15180
+ if (['JST_GOODS', 'JST_REISSUE_GOODS', 'JST_RETURN_GOODS', 'JST_EXCHANGE_GOODS'].includes(type)) {
14954
15181
  return '选择聚水潭ERP商品';
14955
15182
  }
14956
15183
  return '选择商品';
@@ -14972,6 +15199,8 @@ var GoodItem$1 = function GoodItem(props) {
14972
15199
  maxLength = _props$maxLength === void 0 ? 20 : _props$maxLength,
14973
15200
  _props$showChangeBtn = props.showChangeBtn,
14974
15201
  showChangeBtn = _props$showChangeBtn === void 0 ? true : _props$showChangeBtn,
15202
+ _props$showErpGoodsBt = props.showErpGoodsBtn,
15203
+ showErpGoodsBtn = _props$showErpGoodsBt === void 0 ? true : _props$showErpGoodsBt,
14975
15204
  _props$showModeBtn = props.showModeBtn,
14976
15205
  showModeBtn = _props$showModeBtn === void 0 ? false : _props$showModeBtn,
14977
15206
  _props$isStrict = props.isStrict,
@@ -14990,7 +15219,12 @@ var GoodItem$1 = function GoodItem(props) {
14990
15219
  onSelect = props.onSelect,
14991
15220
  onDelete = props.onDelete,
14992
15221
  onModeChange = props.onModeChange,
14993
- tradeGoods = props.tradeGoods;
15222
+ tradeGoods = props.tradeGoods,
15223
+ form = props.form;
15224
+ var uniqueKey = (tradeGoods === null || tradeGoods === void 0 ? void 0 : tradeGoods.uniqueKey) || 'uuid';
15225
+ // 监听聚水潭退货商品
15226
+ var jstReturnGoods = Form === null || Form === void 0 ? void 0 : Form.useWatch('3979edfd6d', form);
15227
+ var isShowSelectTradeGoods = type !== 'JST_EXCHANGE_GOODS' || (jstReturnGoods === null || jstReturnGoods === void 0 ? void 0 : jstReturnGoods.jstSystemOrderNo);
14994
15228
  var refModal = useRef();
14995
15229
  console.debug('表格数据', value);
14996
15230
  var handleDelete = function handleDelete(record, index) {
@@ -15010,7 +15244,7 @@ var GoodItem$1 = function GoodItem(props) {
15010
15244
  // TODO: 商品订单中以选中商品
15011
15245
  var selectedGoods = useMemo(function () {
15012
15246
  return value === null || value === void 0 ? void 0 : value.map(function (v) {
15013
- return v === null || v === void 0 ? void 0 : v[MAIN_FIELD];
15247
+ return v === null || v === void 0 ? void 0 : v[uniqueKey];
15014
15248
  });
15015
15249
  }, [value]);
15016
15250
  var updateHandle = function updateHandle(val, index, columnType) {
@@ -15065,6 +15299,8 @@ var GoodItem$1 = function GoodItem(props) {
15065
15299
  case 'GY_GOODS':
15066
15300
  case 'JST_GOODS':
15067
15301
  case 'JST_REISSUE_GOODS':
15302
+ case 'JST_EXCHANGE_GOODS':
15303
+ case 'JST_RETURN_GOODS':
15068
15304
  case 'GY_REISSUE_GOODS':
15069
15305
  {
15070
15306
  columns = getColumnsMap({
@@ -15246,7 +15482,7 @@ var GoodItem$1 = function GoodItem(props) {
15246
15482
  originAmount: !isNull(retailPrice) ? Number(retailPrice) : null
15247
15483
  });
15248
15484
  });
15249
- } else if (['JST_GOODS', 'JST_REISSUE_GOODS'].includes(type)) {
15485
+ } else if (['JST_GOODS', 'JST_REISSUE_GOODS', 'JST_RETURN_GOODS', 'JST_EXCHANGE_GOODS'].includes(type)) {
15250
15486
  newList = list.map(function (item) {
15251
15487
  return {
15252
15488
  name: item.goodName,
@@ -15294,7 +15530,7 @@ var GoodItem$1 = function GoodItem(props) {
15294
15530
  var onSelectChange = function onSelectChange(newSelectedRowKeys) {
15295
15531
  setSelectedRowKeys(newSelectedRowKeys);
15296
15532
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(value.filter(function (t) {
15297
- return newSelectedRowKeys.includes(t.uuid);
15533
+ return newSelectedRowKeys.includes(t[uniqueKey]);
15298
15534
  }));
15299
15535
  };
15300
15536
  var handleChangeGoods = function handleChangeGoods() {
@@ -15325,18 +15561,20 @@ var GoodItem$1 = function GoodItem(props) {
15325
15561
  }, showModeBtn && /*#__PURE__*/React.createElement(Checkbox, {
15326
15562
  checked: isStrict,
15327
15563
  onChange: handleCheckboxChange
15328
- }, "\u5408\u5E76\u5355\uFF0C\u52FE\u9009\u540E\u53EA\u5C55\u793A\u5F53\u524D\u5E73\u53F0\u8BA2\u5355\u5546\u54C1"), !isEmpty(tradeGoods) && /*#__PURE__*/React.createElement(SelectTradeGoods, {
15564
+ }, "\u5408\u5E76\u5355\uFF0C\u52FE\u9009\u540E\u53EA\u5C55\u793A\u5F53\u524D\u5E73\u53F0\u8BA2\u5355\u5546\u54C1"), !isEmpty(tradeGoods) && isShowSelectTradeGoods && /*#__PURE__*/React.createElement(SelectTradeGoods, {
15565
+ uniqueKey: uniqueKey,
15329
15566
  columns: orderColumns,
15330
15567
  dataSource: tradeGoods.originDataSource,
15568
+ getDataSourceAsync: tradeGoods.getDataSourceAsync,
15331
15569
  selectedRowKeys: selectedGoods,
15332
15570
  onChangeSelectedKeys: tradeGoods.selectedGoodsChange
15333
- }), /*#__PURE__*/React.createElement(Button, {
15571
+ }), showErpGoodsBtn && /*#__PURE__*/React.createElement(Button, {
15334
15572
  type: "link",
15335
15573
  onClick: handleChangeGoods
15336
15574
  }, getButtonText(type)), otherOperations), /*#__PURE__*/React.createElement(Table, _objectSpread2(_objectSpread2({}, tableConfig), {}, {
15337
15575
  columns: newColumns,
15338
15576
  dataSource: value,
15339
- rowKey: 'uuid',
15577
+ rowKey: uniqueKey,
15340
15578
  size: "small",
15341
15579
  pagination: false,
15342
15580
  scroll: {
@@ -16988,27 +17226,57 @@ var CommonReturnGoods = function CommonReturnGoods(props) {
16988
17226
  };
16989
17227
 
16990
17228
  var componentMap$3 = {
16991
- 'WDT_EXCHANGE_GOODS': {
17229
+ WDT_EXCHANGE_GOODS: {
16992
17230
  type: 'wdt',
16993
17231
  valueKey: 'wdtExchangeGoods',
16994
17232
  returnTypeKey: 'wdtExchangeType',
16995
17233
  name: '旺店通',
16996
17234
  eventNameMap: {
16997
- changeShopCode: 'wdtChangeShopCode',
16998
- exchangeDeleteGood: 'wdtExchangeDeleteGood',
17235
+ // pubsub 事件
16999
17236
  exchangeCopyGood: 'wdtExchangeCopyGood',
17000
17237
  exchangeBackCopyGood: 'wdtExchangeBackCopyGood'
17001
17238
  }
17239
+ },
17240
+ JST_EXCHANGE_GOODS: {
17241
+ type: 'jst',
17242
+ valueKey: 'jstExchangeGoods',
17243
+ returnTypeKey: 'jstExchangeType',
17244
+ systemOrder: 'jstSystemOrder',
17245
+ systemOrderNo: 'jstSystemOrderNo',
17246
+ oIdKey: 'oId',
17247
+ goodDetailsKey: 'items',
17248
+ skuIdKey: 'skuId',
17249
+ outerOiIdKey: '',
17250
+ name: '聚水潭',
17251
+ updateGoodsHandle: updateJstGoodsHandle,
17252
+ eventNameMap: {
17253
+ // pubsub 事件
17254
+ exchangeCopyGood: 'jstExchangeCopyGood',
17255
+ exchangeBackCopyGood: 'jstExchangeBackCopyGood',
17256
+ returnGoodsSysorder: 'jstReturnGoodsSysorder',
17257
+ returnGoodsSysorderBack: 'jstReturnGoodsSysorderBack'
17258
+ }
17002
17259
  }
17003
17260
  };
17004
17261
  var CommonExchangeGoods = function CommonExchangeGoods(props) {
17262
+ var _componentMap$compTyp, _componentMap$compTyp4;
17005
17263
  var value = props.value,
17006
17264
  onChange = props.onChange,
17007
17265
  disabled = props.disabled,
17008
17266
  compType = props.type;
17267
+ 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';
17009
17268
  var valueRef = useRef({});
17269
+ // PS: 目前选择订单商品,只有聚水潭换出商品,而且聚水潭不用考虑合并单,所以这个值一直是 false
17270
+ var _useState = useState(false),
17271
+ _useState2 = _slicedToArray(_useState, 2),
17272
+ isStrict = _useState2[0],
17273
+ setIsStrict = _useState2[1];
17274
+ var _useState3 = useState([]),
17275
+ _useState4 = _slicedToArray(_useState3, 2),
17276
+ originDataSource = _useState4[0],
17277
+ setOriginDataSource = _useState4[1];
17010
17278
  useEffect(function () {
17011
- var subscription = pubsub.subscribe(componentMap$3[compType].eventNameMap.exchangeBackCopyGood, function (_, data) {
17279
+ var subscription = componentMap$3[compType].eventNameMap.exchangeBackCopyGood && pubsub.subscribe(componentMap$3[compType].eventNameMap.exchangeBackCopyGood, function (_, data) {
17012
17280
  if (disabled) return;
17013
17281
  var newValue = {
17014
17282
  shopCode: data === null || data === void 0 ? void 0 : data.shopCode
@@ -17030,26 +17298,11 @@ var CommonExchangeGoods = function CommonExchangeGoods(props) {
17030
17298
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
17031
17299
  });
17032
17300
  return function () {
17033
- pubsub.unsubscribe(subscription);
17301
+ subscription && pubsub.unsubscribe(subscription);
17034
17302
  };
17035
- });
17303
+ }, []);
17036
17304
  useEffect(function () {
17037
17305
  valueRef.current = value;
17038
- pubsub.subscribeOnce(componentMap$3[compType].eventNameMap.exchangeDeleteGood, function (_, data) {
17039
- if (disabled) return;
17040
- if (value) {
17041
- var newValue = _objectSpread2({}, value);
17042
- newValue[componentMap$3[compType].valueKey] = newValue[componentMap$3[compType].valueKey].filter(function (item) {
17043
- return item.sku !== data;
17044
- });
17045
- onChange(newValue);
17046
- }
17047
- });
17048
- pubsub.subscribeOnce(componentMap$3[compType].eventNameMap.changeShopCode, function (type, data) {
17049
- onChange(_objectSpread2(_objectSpread2({}, value), {}, {
17050
- shopCode: data.shopCode
17051
- }));
17052
- });
17053
17306
  }, [value]);
17054
17307
  var changeGoodHandle = function changeGoodHandle(val) {
17055
17308
  var newValue = _objectSpread2({}, value);
@@ -17064,13 +17317,53 @@ var CommonExchangeGoods = function CommonExchangeGoods(props) {
17064
17317
  };
17065
17318
  var copyGoods = function copyGoods() {
17066
17319
  var copyHandle = function copyHandle() {
17067
- pubsub.publish(componentMap$3[compType].eventNameMap.exchangeCopyGood, 'WDT_EXCHANGE_GOODS');
17320
+ pubsub.publish(componentMap$3[compType].eventNameMap.exchangeCopyGood, compType);
17068
17321
  };
17069
17322
  return /*#__PURE__*/React.createElement(Button, {
17070
17323
  type: "link",
17071
17324
  onClick: copyHandle
17072
17325
  }, "\u590D\u5236\u9000\u56DE\u5546\u54C1");
17073
17326
  };
17327
+ var selectedGoodsChange = useCallback(function (skuList) {
17328
+ var _componentMap$compTyp2, _componentMap$compTyp3, _uniqBy;
17329
+ var newValue = _objectSpread2({}, value);
17330
+ // 原订单商品
17331
+ var originTradeGoodList = originDataSource || [];
17332
+ // 当前选中的所有商品【包含了原订单+商品库】
17333
+ 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]) || [];
17334
+ 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 = uniqBy(originTradeGoodList.concat(currentSelectGoodList), uniqueKey)) === null || _uniqBy === void 0 ? void 0 : _uniqBy.filter(function (item) {
17335
+ return skuList.includes(item[uniqueKey]);
17336
+ });
17337
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
17338
+ }, [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]);
17339
+ var getGoodDetails = function getGoodDetails(_ref) {
17340
+ var _componentMap$compTyp5, _componentMap$compTyp6, _order$componentMap$c, _componentMap$compTyp7;
17341
+ var returnGoodsValue = _ref.returnGoodsValue,
17342
+ mode = _ref.mode,
17343
+ sysOrderNo = _ref.sysOrderNo;
17344
+ 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];
17345
+ 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];
17346
+ var order = systemOrderNo && ((systemOrder === null || systemOrder === void 0 ? void 0 : systemOrder.orders) || []).find(function (order) {
17347
+ return order[componentMap$3[compType].oIdKey] === systemOrderNo;
17348
+ });
17349
+ var goodDetails = 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) : []);
17350
+ var orderNo = systemOrder === null || systemOrder === void 0 ? void 0 : systemOrder.orderNo;
17351
+ return mode ? goodDetails.filter(function (goodItem) {
17352
+ return !orderNo || goodItem[componentMap$3[compType].outerOiIdKey] === orderNo;
17353
+ }) : goodDetails;
17354
+ };
17355
+ var getDataSourceAsync = function getDataSourceAsync() {
17356
+ return new Promise(function (resolve) {
17357
+ pubsub.subscribeOnce(componentMap$3[compType].eventNameMap.returnGoodsSysorderBack, function (_, data) {
17358
+ resolve(data);
17359
+ setOriginDataSource(getGoodDetails({
17360
+ returnGoodsValue: data,
17361
+ mode: isStrict
17362
+ }));
17363
+ });
17364
+ pubsub.publish(componentMap$3[compType].eventNameMap.returnGoodsSysorder, compType);
17365
+ });
17366
+ };
17074
17367
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
17075
17368
  key: componentMap$3[compType].type
17076
17369
  }, props), {}, {
@@ -17080,6 +17373,12 @@ var CommonExchangeGoods = function CommonExchangeGoods(props) {
17080
17373
  shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
17081
17374
  value: value === null || value === void 0 ? void 0 : value[componentMap$3[compType].valueKey],
17082
17375
  otherOperations: copyGoods(),
17376
+ tradeGoods: {
17377
+ uniqueKey: uniqueKey,
17378
+ originDataSource: originDataSource,
17379
+ getDataSourceAsync: getDataSourceAsync,
17380
+ selectedGoodsChange: selectedGoodsChange
17381
+ },
17083
17382
  onChange: function onChange(val) {
17084
17383
  return changeGoodHandle(val);
17085
17384
  }
@@ -17361,6 +17660,7 @@ var wdtReissue = function wdtReissue(props) {
17361
17660
  var _excluded$i = ["value", "onChange", "reasonList", "disabled", "type"];
17362
17661
  var typeMap$2 = {
17363
17662
  JST_REISSUE_GOODS: {
17663
+ compType: '补发',
17364
17664
  key: 'jstReissueGoods',
17365
17665
  typeName: 'jstReissueType',
17366
17666
  systemOrder: 'jstSystemOrder',
@@ -17370,12 +17670,34 @@ var typeMap$2 = {
17370
17670
  updateGoodsHandle: updateJstGoodsHandle,
17371
17671
  orderTypeKey: 'orderType',
17372
17672
  oIdKey: 'oId',
17373
- outerOiIdKey: 'outerOiId',
17673
+ outerOiIdKey: '',
17374
17674
  goodDetailsKey: 'items'
17675
+ },
17676
+ JST_RETURN_GOODS: {
17677
+ compType: '退货',
17678
+ key: 'jstReturnGoods',
17679
+ typeName: 'jstReturnType',
17680
+ systemOrder: 'jstSystemOrder',
17681
+ systemOrderNo: 'jstSystemOrderNo',
17682
+ systemOrderBillType: 'jstSystemOrderBillType',
17683
+ getOrderList: jstUtils.getJstOrderListSingleton,
17684
+ updateGoodsHandle: updateJstGoodsHandle,
17685
+ orderTypeKey: 'orderType',
17686
+ oIdKey: 'oId',
17687
+ outerOiIdKey: '',
17688
+ goodDetailsKey: 'items',
17689
+ showErpGoodsBtn: false,
17690
+ eventNameMap: {
17691
+ // pubsub 事件
17692
+ exchangeCopyGood: 'jstExchangeCopyGood',
17693
+ exchangeBackCopyGood: 'jstExchangeBackCopyGood',
17694
+ returnGoodsSysorder: 'jstReturnGoodsSysorder',
17695
+ returnGoodsSysorderBack: 'jstReturnGoodsSysorderBack'
17696
+ }
17375
17697
  }
17376
17698
  };
17377
17699
  var PublicReissue = function PublicReissue(props) {
17378
- var _typeMap$type32, _typeMap$type35, _typeMap$type36, _typeMap$type37, _value$typeMap$type$s6, _typeMap$type38, _typeMap$type39, _typeMap$type40, _typeMap$type41, _typeMap$type42;
17700
+ 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;
17379
17701
  var value = props.value,
17380
17702
  onChange = props.onChange,
17381
17703
  _props$reasonList = props.reasonList,
@@ -17398,6 +17720,30 @@ var PublicReissue = function PublicReissue(props) {
17398
17720
  }
17399
17721
  return;
17400
17722
  }, [value]);
17723
+ var valueRef = useRef({});
17724
+ useEffect(function () {
17725
+ valueRef.current = value;
17726
+ }, [value]);
17727
+ useEffect(function () {
17728
+ var subscription;
17729
+ var subscription2;
17730
+ if (typeMap$2[type].eventNameMap) {
17731
+ subscription = pubsub.subscribe(typeMap$2[type].eventNameMap.exchangeCopyGood, function () {
17732
+ var _valueRef$current, _valueRef$current2;
17733
+ pubsub.publish(typeMap$2[type].eventNameMap.exchangeBackCopyGood, {
17734
+ list: 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]) || []),
17735
+ shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current2 = valueRef.current) === null || _valueRef$current2 === void 0 ? void 0 : _valueRef$current2.shopCode
17736
+ });
17737
+ });
17738
+ subscription2 = pubsub.subscribe(typeMap$2[type].eventNameMap.returnGoodsSysorder, function () {
17739
+ pubsub.publish(typeMap$2[type].eventNameMap.returnGoodsSysorderBack, cloneDeep(valueRef.current));
17740
+ });
17741
+ }
17742
+ return function () {
17743
+ subscription && pubsub.unsubscribe(subscription);
17744
+ subscription2 && pubsub.unsubscribe(subscription2);
17745
+ };
17746
+ }, []);
17401
17747
  var getOrderList = /*#__PURE__*/function () {
17402
17748
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(orderNo) {
17403
17749
  var _typeMap$type4;
@@ -17509,29 +17855,26 @@ var PublicReissue = function PublicReissue(props) {
17509
17855
  }
17510
17856
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
17511
17857
  };
17512
- //显示选择商品按钮 原单换不显示选择商品
17513
- var showChangeBtn = useMemo(function () {
17514
- var _typeMap$type31;
17515
- return !!(value === null || value === void 0 ? void 0 : value[(_typeMap$type31 = typeMap$2[type]) === null || _typeMap$type31 === void 0 ? void 0 : _typeMap$type31.systemOrderNo]);
17516
- }, [value === null || value === void 0 ? void 0 : value[(_typeMap$type32 = typeMap$2[type]) === null || _typeMap$type32 === void 0 ? void 0 : _typeMap$type32.systemOrderNo]]);
17858
+ //显示选择商品按钮
17859
+ 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]);
17517
17860
  var selectedGoodsChange = useCallback(function (skuList) {
17518
- var _typeMap$type33, _typeMap$type34, _uniqBy;
17861
+ var _typeMap$type32, _typeMap$type33, _uniqBy;
17519
17862
  var newValue = _objectSpread2({}, value);
17520
17863
  // 原订单商品
17521
17864
  var originTradeGoodList = getGoodDetails({
17522
17865
  mode: isStrict
17523
17866
  }) || [];
17524
17867
  // 当前选中的所有商品【包含了原订单+商品库】
17525
- 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)]) || [];
17526
- 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 = uniqBy(originTradeGoodList.concat(currentSelectGoodList), 'uuid')) === null || _uniqBy === void 0 ? void 0 : _uniqBy.filter(function (item) {
17868
+ 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)]) || [];
17869
+ 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 = uniqBy(originTradeGoodList.concat(currentSelectGoodList), 'uuid')) === null || _uniqBy === void 0 ? void 0 : _uniqBy.filter(function (item) {
17527
17870
  return skuList.includes(item.uuid);
17528
17871
  });
17529
17872
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
17530
- }, [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]);
17873
+ }, [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]);
17531
17874
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Row, {
17532
17875
  gutter: 8,
17533
17876
  wrap: true,
17534
- 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())
17877
+ 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())
17535
17878
  }, /*#__PURE__*/React.createElement(Col, {
17536
17879
  className: "gutter-row",
17537
17880
  xs: {
@@ -17546,11 +17889,11 @@ var PublicReissue = function PublicReissue(props) {
17546
17889
  },
17547
17890
  disabled: disabled,
17548
17891
  allowClear: false,
17549
- 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)],
17892
+ 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)],
17550
17893
  onChange: function onChange(val) {
17551
17894
  return changeSystemOrderHandle(val);
17552
17895
  },
17553
- placeholder: "\u9009\u62E9\u8865\u53D1\u7CFB\u7EDF\u5355"
17896
+ 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")
17554
17897
  }, ((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) {
17555
17898
  return /*#__PURE__*/React.createElement(Select.Option, {
17556
17899
  key: item[typeMap$2[type].oIdKey],
@@ -17595,8 +17938,9 @@ var PublicReissue = function PublicReissue(props) {
17595
17938
  disabled: disabled,
17596
17939
  canUpdateNumber: showChangeBtn,
17597
17940
  showChangeBtn: showChangeBtn,
17941
+ 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,
17598
17942
  shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
17599
- 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)],
17943
+ 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)],
17600
17944
  onChange: function onChange(val) {
17601
17945
  return changeGoodHandle(val);
17602
17946
  },