@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.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,
@@ -14991,6 +15220,7 @@ var GoodItem$1 = function GoodItem(props) {
14991
15220
  onDelete = props.onDelete,
14992
15221
  onModeChange = props.onModeChange,
14993
15222
  tradeGoods = props.tradeGoods;
15223
+ var uniqueKey = (tradeGoods === null || tradeGoods === void 0 ? void 0 : tradeGoods.uniqueKey) || 'uuid';
14994
15224
  var refModal = useRef();
14995
15225
  console.debug('表格数据', value);
14996
15226
  var handleDelete = function handleDelete(record, index) {
@@ -15010,7 +15240,7 @@ var GoodItem$1 = function GoodItem(props) {
15010
15240
  // TODO: 商品订单中以选中商品
15011
15241
  var selectedGoods = useMemo(function () {
15012
15242
  return value === null || value === void 0 ? void 0 : value.map(function (v) {
15013
- return v === null || v === void 0 ? void 0 : v[MAIN_FIELD];
15243
+ return v === null || v === void 0 ? void 0 : v[uniqueKey];
15014
15244
  });
15015
15245
  }, [value]);
15016
15246
  var updateHandle = function updateHandle(val, index, columnType) {
@@ -15065,6 +15295,8 @@ var GoodItem$1 = function GoodItem(props) {
15065
15295
  case 'GY_GOODS':
15066
15296
  case 'JST_GOODS':
15067
15297
  case 'JST_REISSUE_GOODS':
15298
+ case 'JST_EXCHANGE_GOODS':
15299
+ case 'JST_RETURN_GOODS':
15068
15300
  case 'GY_REISSUE_GOODS':
15069
15301
  {
15070
15302
  columns = getColumnsMap({
@@ -15246,7 +15478,7 @@ var GoodItem$1 = function GoodItem(props) {
15246
15478
  originAmount: !isNull(retailPrice) ? Number(retailPrice) : null
15247
15479
  });
15248
15480
  });
15249
- } else if (['JST_GOODS', 'JST_REISSUE_GOODS'].includes(type)) {
15481
+ } else if (['JST_GOODS', 'JST_REISSUE_GOODS', 'JST_RETURN_GOODS', 'JST_EXCHANGE_GOODS'].includes(type)) {
15250
15482
  newList = list.map(function (item) {
15251
15483
  return {
15252
15484
  name: item.goodName,
@@ -15294,7 +15526,7 @@ var GoodItem$1 = function GoodItem(props) {
15294
15526
  var onSelectChange = function onSelectChange(newSelectedRowKeys) {
15295
15527
  setSelectedRowKeys(newSelectedRowKeys);
15296
15528
  onSelect === null || onSelect === void 0 ? void 0 : onSelect(value.filter(function (t) {
15297
- return newSelectedRowKeys.includes(t.uuid);
15529
+ return newSelectedRowKeys.includes(t[uniqueKey]);
15298
15530
  }));
15299
15531
  };
15300
15532
  var handleChangeGoods = function handleChangeGoods() {
@@ -15326,17 +15558,19 @@ var GoodItem$1 = function GoodItem(props) {
15326
15558
  checked: isStrict,
15327
15559
  onChange: handleCheckboxChange
15328
15560
  }, "\u5408\u5E76\u5355\uFF0C\u52FE\u9009\u540E\u53EA\u5C55\u793A\u5F53\u524D\u5E73\u53F0\u8BA2\u5355\u5546\u54C1"), !isEmpty(tradeGoods) && /*#__PURE__*/React.createElement(SelectTradeGoods, {
15561
+ uniqueKey: uniqueKey,
15329
15562
  columns: orderColumns,
15330
15563
  dataSource: tradeGoods.originDataSource,
15564
+ getDataSourceAsync: tradeGoods.getDataSourceAsync,
15331
15565
  selectedRowKeys: selectedGoods,
15332
15566
  onChangeSelectedKeys: tradeGoods.selectedGoodsChange
15333
- }), /*#__PURE__*/React.createElement(Button, {
15567
+ }), showErpGoodsBtn && /*#__PURE__*/React.createElement(Button, {
15334
15568
  type: "link",
15335
15569
  onClick: handleChangeGoods
15336
15570
  }, getButtonText(type)), otherOperations), /*#__PURE__*/React.createElement(Table, _objectSpread2(_objectSpread2({}, tableConfig), {}, {
15337
15571
  columns: newColumns,
15338
15572
  dataSource: value,
15339
- rowKey: 'uuid',
15573
+ rowKey: uniqueKey,
15340
15574
  size: "small",
15341
15575
  pagination: false,
15342
15576
  scroll: {
@@ -16988,27 +17222,57 @@ var CommonReturnGoods = function CommonReturnGoods(props) {
16988
17222
  };
16989
17223
 
16990
17224
  var componentMap$3 = {
16991
- 'WDT_EXCHANGE_GOODS': {
17225
+ WDT_EXCHANGE_GOODS: {
16992
17226
  type: 'wdt',
16993
17227
  valueKey: 'wdtExchangeGoods',
16994
17228
  returnTypeKey: 'wdtExchangeType',
16995
17229
  name: '旺店通',
16996
17230
  eventNameMap: {
16997
- changeShopCode: 'wdtChangeShopCode',
16998
- exchangeDeleteGood: 'wdtExchangeDeleteGood',
17231
+ // pubsub 事件
16999
17232
  exchangeCopyGood: 'wdtExchangeCopyGood',
17000
17233
  exchangeBackCopyGood: 'wdtExchangeBackCopyGood'
17001
17234
  }
17235
+ },
17236
+ JST_EXCHANGE_GOODS: {
17237
+ type: 'jst',
17238
+ valueKey: 'jstExchangeGoods',
17239
+ returnTypeKey: 'jstExchangeType',
17240
+ systemOrder: 'jstSystemOrder',
17241
+ systemOrderNo: 'jstSystemOrderNo',
17242
+ oIdKey: 'oId',
17243
+ goodDetailsKey: 'items',
17244
+ skuIdKey: 'skuId',
17245
+ outerOiIdKey: '',
17246
+ name: '聚水潭',
17247
+ updateGoodsHandle: updateJstGoodsHandle,
17248
+ eventNameMap: {
17249
+ // pubsub 事件
17250
+ exchangeCopyGood: 'jstExchangeCopyGood',
17251
+ exchangeBackCopyGood: 'jstExchangeBackCopyGood',
17252
+ returnGoodsSysorder: 'jstReturnGoodsSysorder',
17253
+ returnGoodsSysorderBack: 'jstReturnGoodsSysorderBack'
17254
+ }
17002
17255
  }
17003
17256
  };
17004
17257
  var CommonExchangeGoods = function CommonExchangeGoods(props) {
17258
+ var _componentMap$compTyp, _componentMap$compTyp4;
17005
17259
  var value = props.value,
17006
17260
  onChange = props.onChange,
17007
17261
  disabled = props.disabled,
17008
17262
  compType = props.type;
17263
+ 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
17264
  var valueRef = useRef({});
17265
+ // PS: 目前选择订单商品,只有聚水潭换出商品,而且聚水潭不用考虑合并单,所以这个值一直是 false
17266
+ var _useState = useState(false),
17267
+ _useState2 = _slicedToArray(_useState, 2),
17268
+ isStrict = _useState2[0],
17269
+ setIsStrict = _useState2[1];
17270
+ var _useState3 = useState([]),
17271
+ _useState4 = _slicedToArray(_useState3, 2),
17272
+ originDataSource = _useState4[0],
17273
+ setOriginDataSource = _useState4[1];
17010
17274
  useEffect(function () {
17011
- var subscription = pubsub.subscribe(componentMap$3[compType].eventNameMap.exchangeBackCopyGood, function (_, data) {
17275
+ var subscription = componentMap$3[compType].eventNameMap.exchangeBackCopyGood && pubsub.subscribe(componentMap$3[compType].eventNameMap.exchangeBackCopyGood, function (_, data) {
17012
17276
  if (disabled) return;
17013
17277
  var newValue = {
17014
17278
  shopCode: data === null || data === void 0 ? void 0 : data.shopCode
@@ -17030,26 +17294,11 @@ var CommonExchangeGoods = function CommonExchangeGoods(props) {
17030
17294
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
17031
17295
  });
17032
17296
  return function () {
17033
- pubsub.unsubscribe(subscription);
17297
+ subscription && pubsub.unsubscribe(subscription);
17034
17298
  };
17035
- });
17299
+ }, []);
17036
17300
  useEffect(function () {
17037
17301
  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
17302
  }, [value]);
17054
17303
  var changeGoodHandle = function changeGoodHandle(val) {
17055
17304
  var newValue = _objectSpread2({}, value);
@@ -17064,13 +17313,53 @@ var CommonExchangeGoods = function CommonExchangeGoods(props) {
17064
17313
  };
17065
17314
  var copyGoods = function copyGoods() {
17066
17315
  var copyHandle = function copyHandle() {
17067
- pubsub.publish(componentMap$3[compType].eventNameMap.exchangeCopyGood, 'WDT_EXCHANGE_GOODS');
17316
+ pubsub.publish(componentMap$3[compType].eventNameMap.exchangeCopyGood, compType);
17068
17317
  };
17069
17318
  return /*#__PURE__*/React.createElement(Button, {
17070
17319
  type: "link",
17071
17320
  onClick: copyHandle
17072
17321
  }, "\u590D\u5236\u9000\u56DE\u5546\u54C1");
17073
17322
  };
17323
+ var selectedGoodsChange = useCallback(function (skuList) {
17324
+ var _componentMap$compTyp2, _componentMap$compTyp3, _uniqBy;
17325
+ var newValue = _objectSpread2({}, value);
17326
+ // 原订单商品
17327
+ var originTradeGoodList = originDataSource || [];
17328
+ // 当前选中的所有商品【包含了原订单+商品库】
17329
+ 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]) || [];
17330
+ 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) {
17331
+ return skuList.includes(item[uniqueKey]);
17332
+ });
17333
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
17334
+ }, [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]);
17335
+ var getGoodDetails = function getGoodDetails(_ref) {
17336
+ var _componentMap$compTyp5, _componentMap$compTyp6, _order$componentMap$c, _componentMap$compTyp7;
17337
+ var returnGoodsValue = _ref.returnGoodsValue,
17338
+ mode = _ref.mode,
17339
+ sysOrderNo = _ref.sysOrderNo;
17340
+ 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];
17341
+ 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];
17342
+ var order = systemOrderNo && ((systemOrder === null || systemOrder === void 0 ? void 0 : systemOrder.orders) || []).find(function (order) {
17343
+ return order[componentMap$3[compType].oIdKey] === systemOrderNo;
17344
+ });
17345
+ 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) : []);
17346
+ var orderNo = systemOrder === null || systemOrder === void 0 ? void 0 : systemOrder.orderNo;
17347
+ return mode ? goodDetails.filter(function (goodItem) {
17348
+ return !orderNo || goodItem[componentMap$3[compType].outerOiIdKey] === orderNo;
17349
+ }) : goodDetails;
17350
+ };
17351
+ var getDataSourceAsync = function getDataSourceAsync() {
17352
+ return new Promise(function (resolve) {
17353
+ pubsub.subscribeOnce(componentMap$3[compType].eventNameMap.returnGoodsSysorderBack, function (_, data) {
17354
+ resolve(data);
17355
+ setOriginDataSource(getGoodDetails({
17356
+ returnGoodsValue: data,
17357
+ mode: isStrict
17358
+ }));
17359
+ });
17360
+ pubsub.publish(componentMap$3[compType].eventNameMap.returnGoodsSysorder, compType);
17361
+ });
17362
+ };
17074
17363
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GoodItem$1, _objectSpread2(_objectSpread2({
17075
17364
  key: componentMap$3[compType].type
17076
17365
  }, props), {}, {
@@ -17080,6 +17369,12 @@ var CommonExchangeGoods = function CommonExchangeGoods(props) {
17080
17369
  shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
17081
17370
  value: value === null || value === void 0 ? void 0 : value[componentMap$3[compType].valueKey],
17082
17371
  otherOperations: copyGoods(),
17372
+ tradeGoods: {
17373
+ uniqueKey: uniqueKey,
17374
+ originDataSource: originDataSource,
17375
+ getDataSourceAsync: getDataSourceAsync,
17376
+ selectedGoodsChange: selectedGoodsChange
17377
+ },
17083
17378
  onChange: function onChange(val) {
17084
17379
  return changeGoodHandle(val);
17085
17380
  }
@@ -17361,6 +17656,7 @@ var wdtReissue = function wdtReissue(props) {
17361
17656
  var _excluded$i = ["value", "onChange", "reasonList", "disabled", "type"];
17362
17657
  var typeMap$2 = {
17363
17658
  JST_REISSUE_GOODS: {
17659
+ compType: '补发',
17364
17660
  key: 'jstReissueGoods',
17365
17661
  typeName: 'jstReissueType',
17366
17662
  systemOrder: 'jstSystemOrder',
@@ -17370,12 +17666,34 @@ var typeMap$2 = {
17370
17666
  updateGoodsHandle: updateJstGoodsHandle,
17371
17667
  orderTypeKey: 'orderType',
17372
17668
  oIdKey: 'oId',
17373
- outerOiIdKey: 'outerOiId',
17669
+ outerOiIdKey: '',
17374
17670
  goodDetailsKey: 'items'
17671
+ },
17672
+ JST_RETURN_GOODS: {
17673
+ compType: '退货',
17674
+ key: 'jstReturnGoods',
17675
+ typeName: 'jstReturnType',
17676
+ systemOrder: 'jstSystemOrder',
17677
+ systemOrderNo: 'jstSystemOrderNo',
17678
+ systemOrderBillType: 'jstSystemOrderBillType',
17679
+ getOrderList: jstUtils.getJstOrderListSingleton,
17680
+ updateGoodsHandle: updateJstGoodsHandle,
17681
+ orderTypeKey: 'orderType',
17682
+ oIdKey: 'oId',
17683
+ outerOiIdKey: '',
17684
+ goodDetailsKey: 'items',
17685
+ showErpGoodsBtn: false,
17686
+ eventNameMap: {
17687
+ // pubsub 事件
17688
+ exchangeCopyGood: 'jstExchangeCopyGood',
17689
+ exchangeBackCopyGood: 'jstExchangeBackCopyGood',
17690
+ returnGoodsSysorder: 'jstReturnGoodsSysorder',
17691
+ returnGoodsSysorderBack: 'jstReturnGoodsSysorderBack'
17692
+ }
17375
17693
  }
17376
17694
  };
17377
17695
  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;
17696
+ 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
17697
  var value = props.value,
17380
17698
  onChange = props.onChange,
17381
17699
  _props$reasonList = props.reasonList,
@@ -17398,6 +17716,30 @@ var PublicReissue = function PublicReissue(props) {
17398
17716
  }
17399
17717
  return;
17400
17718
  }, [value]);
17719
+ var valueRef = useRef({});
17720
+ useEffect(function () {
17721
+ valueRef.current = value;
17722
+ }, [value]);
17723
+ useEffect(function () {
17724
+ var subscription;
17725
+ var subscription2;
17726
+ if (typeMap$2[type].eventNameMap) {
17727
+ subscription = pubsub.subscribe(typeMap$2[type].eventNameMap.exchangeCopyGood, function () {
17728
+ var _valueRef$current, _valueRef$current2;
17729
+ pubsub.publish(typeMap$2[type].eventNameMap.exchangeBackCopyGood, {
17730
+ 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]) || []),
17731
+ shopCode: valueRef === null || valueRef === void 0 ? void 0 : (_valueRef$current2 = valueRef.current) === null || _valueRef$current2 === void 0 ? void 0 : _valueRef$current2.shopCode
17732
+ });
17733
+ });
17734
+ subscription2 = pubsub.subscribe(typeMap$2[type].eventNameMap.returnGoodsSysorder, function () {
17735
+ pubsub.publish(typeMap$2[type].eventNameMap.returnGoodsSysorderBack, cloneDeep(valueRef.current));
17736
+ });
17737
+ }
17738
+ return function () {
17739
+ subscription && pubsub.unsubscribe(subscription);
17740
+ subscription2 && pubsub.unsubscribe(subscription2);
17741
+ };
17742
+ }, []);
17401
17743
  var getOrderList = /*#__PURE__*/function () {
17402
17744
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(orderNo) {
17403
17745
  var _typeMap$type4;
@@ -17509,29 +17851,26 @@ var PublicReissue = function PublicReissue(props) {
17509
17851
  }
17510
17852
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
17511
17853
  };
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]]);
17854
+ //显示选择商品按钮
17855
+ 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
17856
  var selectedGoodsChange = useCallback(function (skuList) {
17518
- var _typeMap$type33, _typeMap$type34, _uniqBy;
17857
+ var _typeMap$type32, _typeMap$type33, _uniqBy;
17519
17858
  var newValue = _objectSpread2({}, value);
17520
17859
  // 原订单商品
17521
17860
  var originTradeGoodList = getGoodDetails({
17522
17861
  mode: isStrict
17523
17862
  }) || [];
17524
17863
  // 当前选中的所有商品【包含了原订单+商品库】
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) {
17864
+ 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)]) || [];
17865
+ 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
17866
  return skuList.includes(item.uuid);
17528
17867
  });
17529
17868
  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]);
17869
+ }, [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
17870
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Row, {
17532
17871
  gutter: 8,
17533
17872
  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())
17873
+ 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
17874
  }, /*#__PURE__*/React.createElement(Col, {
17536
17875
  className: "gutter-row",
17537
17876
  xs: {
@@ -17546,11 +17885,11 @@ var PublicReissue = function PublicReissue(props) {
17546
17885
  },
17547
17886
  disabled: disabled,
17548
17887
  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)],
17888
+ 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
17889
  onChange: function onChange(val) {
17551
17890
  return changeSystemOrderHandle(val);
17552
17891
  },
17553
- placeholder: "\u9009\u62E9\u8865\u53D1\u7CFB\u7EDF\u5355"
17892
+ 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
17893
  }, ((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
17894
  return /*#__PURE__*/React.createElement(Select.Option, {
17556
17895
  key: item[typeMap$2[type].oIdKey],
@@ -17595,8 +17934,9 @@ var PublicReissue = function PublicReissue(props) {
17595
17934
  disabled: disabled,
17596
17935
  canUpdateNumber: showChangeBtn,
17597
17936
  showChangeBtn: showChangeBtn,
17937
+ 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
17938
  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)],
17939
+ 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
17940
  onChange: function onChange(val) {
17601
17941
  return changeGoodHandle(val);
17602
17942
  },