@bit-sun/business-component 2.3.18 → 2.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import axios from 'axios';
2
- import { message as message$1, Popover, Card, Avatar, Tooltip, Image, Menu, Space, Dropdown, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, InputNumber, Typography, Alert, Anchor, Breadcrumb, Drawer as Drawer$1, List, Tree, Row, Col, Tabs, Affix, Cascader, DatePicker, TimePicker, Switch } from 'antd';
2
+ import { message as message$1, Image, Popover, Card, Avatar, Tooltip, Menu, Space, Dropdown, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect, Tag, InputNumber, Typography, Alert, Anchor, Breadcrumb, Drawer as Drawer$1, List, Tree, Row, Col, Tabs, Affix, Cascader, DatePicker, TimePicker, Switch } from 'antd';
3
3
  import _, { omit, debounce, cloneDeep as cloneDeep$1, throttle, isEmpty } from 'lodash';
4
4
  import { history, formatMessage, useLocation, Link, useModel, useIntl } from 'umi';
5
5
  import isEqual from 'lodash/isEqual';
@@ -2579,7 +2579,8 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2579
2579
  needModalTable = _props$needModalTable === void 0 ? true : _props$needModalTable,
2580
2580
  _props$getPopupContai = props.getPopupContainer,
2581
2581
  _getPopupContainer = _props$getPopupContai === void 0 ? undefined : _props$getPopupContai,
2582
- fieldComponent = props.fieldComponent;
2582
+ fieldComponent = props.fieldComponent,
2583
+ selectBusinessType = props.selectBusinessType;
2583
2584
  var _ref = requestConfig || {},
2584
2585
  url = _ref.url,
2585
2586
  otherParams = _ref.otherParams,
@@ -2996,6 +2997,13 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2996
2997
  useEffect(function () {
2997
2998
  makeUniqueValue();
2998
2999
  }, [resultSourceKey]);
3000
+ useEffect(function () {
3001
+ if (init) {
3002
+ setItems([]);
3003
+ setItemsTotal(0);
3004
+ run('init');
3005
+ }
3006
+ }, [selectBusinessType]);
2999
3007
  var showModal = function showModal() {
3000
3008
  getData({
3001
3009
  pageSize: tableInitPageSize,
@@ -4207,30 +4215,31 @@ var noEmptyArray = function noEmptyArray(arr) {
4207
4215
  };
4208
4216
  //设置queryTable默认列宽
4209
4217
  var getItemDefaultWidth$1 = function getItemDefaultWidth(item) {
4218
+ var _ref;
4210
4219
  var defaultWidth = 200;
4211
- var lowerCaseKey = (item.key || item.dataIndex).toLowerCase();
4220
+ var lowerCaseKey = (_ref = item.key || item.dataIndex) === null || _ref === void 0 ? void 0 : _ref.toLowerCase();
4212
4221
  switch (true) {
4213
4222
  case (item === null || item === void 0 ? void 0 : item.title) === '操作' || lowerCaseKey === 'operate':
4214
4223
  defaultWidth = 60;
4215
4224
  break;
4216
- case lowerCaseKey.indexOf('number') > -1:
4217
- case lowerCaseKey.indexOf('quantity') > -1:
4218
- case lowerCaseKey.indexOf('amount') > -1:
4225
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('number')) > -1:
4226
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('quantity')) > -1:
4227
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('amount')) > -1:
4219
4228
  defaultWidth = 90;
4220
4229
  break;
4221
- case lowerCaseKey.indexOf('no') > -1:
4230
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('no')) > -1:
4222
4231
  defaultWidth = 200;
4223
4232
  break;
4224
- case lowerCaseKey.indexOf('code') > -1:
4233
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('code')) > -1:
4225
4234
  defaultWidth = 170;
4226
4235
  break;
4227
- case lowerCaseKey.indexOf('time') > -1:
4236
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('time')) > -1:
4228
4237
  defaultWidth = 130;
4229
4238
  break;
4230
- case lowerCaseKey.indexOf('status') > -1:
4239
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('status')) > -1:
4231
4240
  defaultWidth = 100;
4232
4241
  break;
4233
- case lowerCaseKey.indexOf('user') > -1:
4242
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('user')) > -1:
4234
4243
  defaultWidth = 130;
4235
4244
  break;
4236
4245
  }
@@ -4377,7 +4386,9 @@ var AddSelect = function AddSelect(props) {
4377
4386
  _props$businessType = props.businessType,
4378
4387
  businessType = _props$businessType === void 0 ? 'sku' : _props$businessType,
4379
4388
  _props$isAllowRepeate = props.isAllowRepeatedSelect,
4380
- isAllowRepeatedSelect = _props$isAllowRepeate === void 0 ? false : _props$isAllowRepeate;
4389
+ isAllowRepeatedSelect = _props$isAllowRepeate === void 0 ? false : _props$isAllowRepeate,
4390
+ _props$noUseItemEanco = props.noUseItemEancode,
4391
+ noUseItemEancode = _props$noUseItemEanco === void 0 ? true : _props$noUseItemEanco;
4381
4392
  var _ref = requestConfig || {},
4382
4393
  url = _ref.url,
4383
4394
  otherParams = _ref.otherParams,
@@ -5051,8 +5062,10 @@ var AddSelect = function AddSelect(props) {
5051
5062
  pageSize: 5000,
5052
5063
  currentPage: 1
5053
5064
  })]).then(function (x) {
5054
- formatSource(x, 0, 2, tableSearchForm, ['id', 'name']);
5055
- formatTreeDataSource(x, 1, 3, tableSearchForm);
5065
+ var searchPosition1 = noUseItemEancode ? 3 : 2;
5066
+ var searchPosition2 = noUseItemEancode ? 4 : 3;
5067
+ formatSource(x, 0, searchPosition1, tableSearchForm, ['id', 'name']);
5068
+ formatTreeDataSource(x, 1, searchPosition2, tableSearchForm);
5056
5069
  });
5057
5070
  }
5058
5071
  if (businessType == 'skc') {
@@ -8682,7 +8695,7 @@ var BusinessSearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
8682
8695
  needModalTable: needModalTable,
8683
8696
  modalTableProps: modalTableProps
8684
8697
  });
8685
- }, [props === null || props === void 0 ? void 0 : props.value, props.disabled]);
8698
+ }, [props === null || props === void 0 ? void 0 : props.value, props.disabled, props.selectBusinessType]);
8686
8699
  useImperativeHandle(ref, function () {
8687
8700
  return {
8688
8701
  getRef: function getRef() {
@@ -8704,9 +8717,13 @@ var BusinessSearchSelect$1 = /*#__PURE__*/React.memo(BusinessSearchSelect, funct
8704
8717
  if (props && props.disabled !== nextProps.disabled) {
8705
8718
  return false;
8706
8719
  }
8720
+ if (props && props.selectBusinessType !== nextProps.selectBusinessType) {
8721
+ return false;
8722
+ }
8707
8723
  return true;
8708
8724
  });
8709
8725
 
8726
+ // import { getCurrentTargetBgId } from '@/utils/LocalstorageUtils';
8710
8727
  function handleSelectColumn(c, parentProps) {
8711
8728
  var result = c;
8712
8729
  var exceptColumns = (parentProps === null || parentProps === void 0 ? void 0 : parentProps.exceptColumns) || [];
@@ -8718,7 +8735,7 @@ function handleSelectColumn(c, parentProps) {
8718
8735
  return !exceptColumns.includes(i.dataIndex);
8719
8736
  });
8720
8737
  }
8721
- // 追加
8738
+ // 追加(最好不用这个,当组件不固定时候会有影响)
8722
8739
  if (additionColumns === null || additionColumns === void 0 ? void 0 : additionColumns.length) {
8723
8740
  additionColumns.forEach(function (i) {
8724
8741
  result.splice(i.position, 0, i.column);
@@ -8731,6 +8748,7 @@ function handleSelectColumn(c, parentProps) {
8731
8748
  return result;
8732
8749
  }
8733
8750
  var AddSkuSelect = function AddSkuSelect(parProps) {
8751
+ var _parProps$requestConf, _parProps$requestConf2;
8734
8752
  var selectProps = {
8735
8753
  mode: 'multiple'
8736
8754
  };
@@ -8738,12 +8756,26 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8738
8756
  _useState2 = _slicedToArray(_useState, 2),
8739
8757
  value = _useState2[0],
8740
8758
  setValue = _useState2[1];
8759
+ var isNoUseItemBarcode = (parProps === null || parProps === void 0 ? void 0 : parProps.noUseItemEancode) !== undefined ? parProps === null || parProps === void 0 ? void 0 : parProps.noUseItemEancode : true; // 默认不加商品条码,兼容老项目
8741
8760
  //注⚠️:自定义过表头的请记得传tableCodeList参数
8742
8761
  var initialSelectColumn = [{
8743
8762
  title: 'SKU编码',
8744
8763
  width: 150,
8745
8764
  dataIndex: 'skuCode'
8746
- }, {
8765
+ }].concat(_toConsumableArray(isNoUseItemBarcode ? [] : [{
8766
+ title: '商品条码',
8767
+ width: 100,
8768
+ ellipsis: {
8769
+ showTitle: false
8770
+ },
8771
+ dataIndex: 'itemEancode',
8772
+ render: function render(text) {
8773
+ return /*#__PURE__*/React.createElement(Tooltip, {
8774
+ placement: "topLeft",
8775
+ title: text
8776
+ }, text);
8777
+ }
8778
+ }]), [{
8747
8779
  title: 'SKU名称',
8748
8780
  width: 200,
8749
8781
  ellipsis: {
@@ -8819,7 +8851,7 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8819
8851
  }, text);
8820
8852
  },
8821
8853
  dataIndex: 'propertyNameAndValue'
8822
- }];
8854
+ }]);
8823
8855
  var mTpSelectColumn = handleSelectColumn(initialSelectColumn, parProps);
8824
8856
  var props = {
8825
8857
  buttonText: parProps.buttonText || '新增',
@@ -8830,11 +8862,11 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8830
8862
  requestConfig: _objectSpread2({
8831
8863
  url: "/items/sku/pager/v2",
8832
8864
  filter: 'qp-name-like',
8833
- otherParams: {
8865
+ otherParams: _objectSpread2({
8834
8866
  'qp-combination-eq': false,
8835
8867
  'qp-approveStatus-eq': 1,
8836
8868
  'qp-status-eq': 1
8837
- },
8869
+ }, (parProps === null || parProps === void 0 ? void 0 : (_parProps$requestConf = parProps.requestConfig) === null || _parProps$requestConf === void 0 ? void 0 : _parProps$requestConf.addOtherParams) || {}),
8838
8870
  mappingTextField: 'name',
8839
8871
  mappingValueField: 'skuCode'
8840
8872
  }, parProps.requestConfig),
@@ -8846,7 +8878,8 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8846
8878
  beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
8847
8879
  onSaveCallback: parProps.onSaveCallback,
8848
8880
  businessType: 'sku',
8849
- isAllowRepeatedSelect: !!(parProps === null || parProps === void 0 ? void 0 : parProps.isAllowRepeatedSelect)
8881
+ isAllowRepeatedSelect: !!(parProps === null || parProps === void 0 ? void 0 : parProps.isAllowRepeatedSelect),
8882
+ noUseItemEancode: isNoUseItemBarcode
8850
8883
  };
8851
8884
  var modalTableProps = {
8852
8885
  modalTableTitle: '选择商品',
@@ -8856,7 +8889,14 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8856
8889
  }, {
8857
8890
  name: 'qp-skuName-like',
8858
8891
  label: 'SKU名称'
8859
- }, {
8892
+ }].concat(_toConsumableArray(isNoUseItemBarcode ? [] : [{
8893
+ name: 'qp-code-in',
8894
+ label: '商品条码',
8895
+ field: {
8896
+ type: 'multipleQueryInput',
8897
+ props: _objectSpread2({}, ((_parProps$requestConf2 = parProps.requestConfig) === null || _parProps$requestConf2 === void 0 ? void 0 : _parProps$requestConf2.itemEancodeValueRequestConfig) || {})
8898
+ }
8899
+ }]), [{
8860
8900
  name: 'qp-brandId-in',
8861
8901
  type: 'select',
8862
8902
  label: '品牌',
@@ -8901,7 +8941,7 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8901
8941
  }
8902
8942
  }
8903
8943
  }
8904
- }],
8944
+ }]),
8905
8945
  tableColumns: [{
8906
8946
  title: 'SKU编码',
8907
8947
  width: 150,
@@ -8935,20 +8975,20 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8935
8975
  height: 20
8936
8976
  }));
8937
8977
  }
8938
- }, {
8939
- title: '国际条码',
8978
+ }].concat(_toConsumableArray(isNoUseItemBarcode ? [] : [{
8979
+ title: '商品条码',
8940
8980
  width: 100,
8941
8981
  ellipsis: {
8942
8982
  showTitle: false
8943
8983
  },
8944
- dataIndex: 'barCode',
8984
+ dataIndex: 'itemEancode',
8945
8985
  render: function render(text) {
8946
8986
  return /*#__PURE__*/React.createElement(Tooltip, {
8947
8987
  placement: "topLeft",
8948
8988
  title: text
8949
8989
  }, text);
8950
8990
  }
8951
- }, {
8991
+ }]), [{
8952
8992
  title: '所属SPU名称',
8953
8993
  width: 100,
8954
8994
  ellipsis: {
@@ -9039,7 +9079,7 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
9039
9079
  }, text);
9040
9080
  },
9041
9081
  dataIndex: 'brandName'
9042
- }],
9082
+ }]),
9043
9083
  selectColumn: mTpSelectColumn
9044
9084
  };
9045
9085
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AddSelect, _objectSpread2(_objectSpread2({}, props), {}, {
@@ -9047,6 +9087,7 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
9047
9087
  })));
9048
9088
  };
9049
9089
  var AddSkcSelect = function AddSkcSelect(parProps) {
9090
+ var _parProps$requestConf3;
9050
9091
  var selectProps = {
9051
9092
  mode: 'multiple'
9052
9093
  };
@@ -9124,9 +9165,9 @@ var AddSkcSelect = function AddSkcSelect(parProps) {
9124
9165
  requestConfig: _objectSpread2({
9125
9166
  url: "/items/skc/skcSelect",
9126
9167
  filter: 'qp-name-like',
9127
- otherParams: {
9168
+ otherParams: _objectSpread2({
9128
9169
  'qp-skcStatus-eq': 1
9129
- },
9170
+ }, (parProps === null || parProps === void 0 ? void 0 : (_parProps$requestConf3 = parProps.requestConfig) === null || _parProps$requestConf3 === void 0 ? void 0 : _parProps$requestConf3.addOtherParams) || {}),
9130
9171
  mappingTextField: 'name',
9131
9172
  mappingValueField: 'code'
9132
9173
  }, parProps.requestConfig),
@@ -9326,6 +9367,7 @@ var AddSkcSelect = function AddSkcSelect(parProps) {
9326
9367
  })));
9327
9368
  };
9328
9369
  var AddSpuSelect = function AddSpuSelect(parProps) {
9370
+ var _parProps$requestConf4;
9329
9371
  var selectProps = {
9330
9372
  mode: 'multiple'
9331
9373
  };
@@ -9412,11 +9454,11 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
9412
9454
  requestConfig: _objectSpread2({
9413
9455
  url: "/items/item",
9414
9456
  filter: 'qp-itemCode,name-orGroup,like',
9415
- otherParams: {
9457
+ otherParams: _objectSpread2({
9416
9458
  'qp-approveStatus-eq': 1,
9417
9459
  'qp-status-eq': 1,
9418
9460
  sorter: 'desc-id'
9419
- },
9461
+ }, (parProps === null || parProps === void 0 ? void 0 : (_parProps$requestConf4 = parProps.requestConfig) === null || _parProps$requestConf4 === void 0 ? void 0 : _parProps$requestConf4.addOtherParams) || {}),
9420
9462
  mappingTextField: 'name',
9421
9463
  mappingValueField: 'itemCode'
9422
9464
  }, parProps.requestConfig),
@@ -29480,7 +29522,8 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
29480
29522
  }
29481
29523
  var parallelTreeData = _this.coverToParallel(ruleTreeData, []) || [];
29482
29524
  var currentTreeItem = (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.elementId) && parallelTreeData.find(function (i) {
29483
- return i.key === (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.elementId);
29525
+ var _i$key;
29526
+ return ((i === null || i === void 0 ? void 0 : (_i$key = i.key) === null || _i$key === void 0 ? void 0 : _i$key.indexOf('.')) > -1 ? i.id : i.key) === (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.elementId);
29484
29527
  });
29485
29528
  var dataChoiceBusinessType = currentTreeItem === null || currentTreeItem === void 0 ? void 0 : currentTreeItem.dataChoiceBusinessType;
29486
29529
  var dataInputBusinessType = currentTreeItem === null || currentTreeItem === void 0 ? void 0 : currentTreeItem.dataInputBusinessType;
@@ -29685,10 +29728,11 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
29685
29728
  }
29686
29729
  }), "\u6DFB\u52A0\u6761\u4EF6"))));
29687
29730
  };
29688
- _this.handleEditExtraInfoResponse = function (code, val, parentDetail) {
29731
+ _this.handleEditExtraInfoResponse = function (code, val, parentDetail, classDataIndex) {
29689
29732
  var ruleClassData = _this.state.ruleClassData;
29690
29733
  var callBack = _this.props.callBack;
29691
29734
  parentDetail.extraInfo.response[code] = val;
29735
+ ruleClassData[classDataIndex].extraInfo.response[code] = val;
29692
29736
  _this.setState({
29693
29737
  ruleClassData: ruleClassData
29694
29738
  }, function () {
@@ -29696,7 +29740,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
29696
29740
  });
29697
29741
  };
29698
29742
  // 场景需要返回值2022.11.15
29699
- _this.renderResItem = function (itemDetail, parentDetail, ruleReturnConfig, disabled, boxStyle) {
29743
+ _this.renderResItem = function (itemDetail, parentDetail, ruleReturnConfig, classDataIndex, disabled, boxStyle) {
29700
29744
  var _ruleReturnConfig$rig;
29701
29745
  var isShowResponse = itemDetail.response['enable'];
29702
29746
  var isRightText = ruleReturnConfig === null || ruleReturnConfig === void 0 ? void 0 : (_ruleReturnConfig$rig = ruleReturnConfig.rightText) === null || _ruleReturnConfig$rig === void 0 ? void 0 : _ruleReturnConfig$rig.length;
@@ -29712,7 +29756,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
29712
29756
  var value = val;
29713
29757
  if (isObj(code)) {
29714
29758
  Object.keys(code).forEach(function (ite) {
29715
- _this.handleEditExtraInfoResponse(ite, code[ite], parentDetail);
29759
+ _this.handleEditExtraInfoResponse(ite, code[ite], parentDetail, classDataIndex);
29716
29760
  });
29717
29761
  return;
29718
29762
  }
@@ -29725,7 +29769,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
29725
29769
  var _val$PCDCode;
29726
29770
  value = val.value || ((_val$PCDCode = val.PCDCode) === null || _val$PCDCode === void 0 ? void 0 : _val$PCDCode.join('/'));
29727
29771
  }
29728
- _this.handleEditExtraInfoResponse('value', value, parentDetail);
29772
+ _this.handleEditExtraInfoResponse('value', value, parentDetail, classDataIndex);
29729
29773
  };
29730
29774
  return isShowResponse && /*#__PURE__*/React.createElement("div", {
29731
29775
  style: {
@@ -29734,7 +29778,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
29734
29778
  }, _this.renderFormCompItem(ruleReturnConfig, showValue, handleEdit, {}, boxStyle, disabled), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
29735
29779
  className: 'icon_btn_style',
29736
29780
  onClick: function onClick() {
29737
- _this.handleEditExtraInfoResponse('enable', false, parentDetail);
29781
+ _this.handleEditExtraInfoResponse('enable', false, parentDetail, classDataIndex);
29738
29782
  },
29739
29783
  style: {
29740
29784
  color: 'gray',
@@ -30343,12 +30387,12 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
30343
30387
  type: "link",
30344
30388
  onClick: function onClick() {
30345
30389
  if (isHaveRuleReturnConfig) {
30346
- _this.handleEditExtraInfoResponse('enable', true, parentDetail);
30390
+ _this.handleEditExtraInfoResponse('enable', true, parentDetail, classDataIndex);
30347
30391
  } else {
30348
30392
  message$1.warn('未配置返回');
30349
30393
  }
30350
30394
  }
30351
- }, "\u65B0\u589E\u8FD4\u56DE\u503C")), isHaveRuleReturnConfig && _this.renderResItem(itemDetail, parentDetail, ruleReturnConfig, disabled, RuleActionItemStyle) || null, isHaveRuleTypeData && _this.renderActionList(itemDetail, parentDetail, handleRuleTypeData, selectRuleActionData, classDataIndex, disabled, RuleActionItemStyle) || null);
30395
+ }, "\u65B0\u589E\u8FD4\u56DE\u503C")), isHaveRuleReturnConfig && _this.renderResItem(itemDetail, parentDetail, ruleReturnConfig, classDataIndex, disabled, RuleActionItemStyle) || null, isHaveRuleTypeData && _this.renderActionList(itemDetail, parentDetail, handleRuleTypeData, selectRuleActionData, classDataIndex, disabled, RuleActionItemStyle) || null);
30352
30396
  };
30353
30397
  //添加同一层级条件
30354
30398
  _this.addPeerRule = function (itemDetail) {
package/dist/index.js CHANGED
@@ -2598,7 +2598,8 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2598
2598
  needModalTable = _props$needModalTable === void 0 ? true : _props$needModalTable,
2599
2599
  _props$getPopupContai = props.getPopupContainer,
2600
2600
  _getPopupContainer = _props$getPopupContai === void 0 ? undefined : _props$getPopupContai,
2601
- fieldComponent = props.fieldComponent;
2601
+ fieldComponent = props.fieldComponent,
2602
+ selectBusinessType = props.selectBusinessType;
2602
2603
  var _ref = requestConfig || {},
2603
2604
  url = _ref.url,
2604
2605
  otherParams = _ref.otherParams,
@@ -3015,6 +3016,13 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
3015
3016
  React.useEffect(function () {
3016
3017
  makeUniqueValue();
3017
3018
  }, [resultSourceKey]);
3019
+ React.useEffect(function () {
3020
+ if (init) {
3021
+ setItems([]);
3022
+ setItemsTotal(0);
3023
+ run('init');
3024
+ }
3025
+ }, [selectBusinessType]);
3018
3026
  var showModal = function showModal() {
3019
3027
  getData({
3020
3028
  pageSize: tableInitPageSize,
@@ -4226,30 +4234,31 @@ var noEmptyArray = function noEmptyArray(arr) {
4226
4234
  };
4227
4235
  //设置queryTable默认列宽
4228
4236
  var getItemDefaultWidth$1 = function getItemDefaultWidth(item) {
4237
+ var _ref;
4229
4238
  var defaultWidth = 200;
4230
- var lowerCaseKey = (item.key || item.dataIndex).toLowerCase();
4239
+ var lowerCaseKey = (_ref = item.key || item.dataIndex) === null || _ref === void 0 ? void 0 : _ref.toLowerCase();
4231
4240
  switch (true) {
4232
4241
  case (item === null || item === void 0 ? void 0 : item.title) === '操作' || lowerCaseKey === 'operate':
4233
4242
  defaultWidth = 60;
4234
4243
  break;
4235
- case lowerCaseKey.indexOf('number') > -1:
4236
- case lowerCaseKey.indexOf('quantity') > -1:
4237
- case lowerCaseKey.indexOf('amount') > -1:
4244
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('number')) > -1:
4245
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('quantity')) > -1:
4246
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('amount')) > -1:
4238
4247
  defaultWidth = 90;
4239
4248
  break;
4240
- case lowerCaseKey.indexOf('no') > -1:
4249
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('no')) > -1:
4241
4250
  defaultWidth = 200;
4242
4251
  break;
4243
- case lowerCaseKey.indexOf('code') > -1:
4252
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('code')) > -1:
4244
4253
  defaultWidth = 170;
4245
4254
  break;
4246
- case lowerCaseKey.indexOf('time') > -1:
4255
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('time')) > -1:
4247
4256
  defaultWidth = 130;
4248
4257
  break;
4249
- case lowerCaseKey.indexOf('status') > -1:
4258
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('status')) > -1:
4250
4259
  defaultWidth = 100;
4251
4260
  break;
4252
- case lowerCaseKey.indexOf('user') > -1:
4261
+ case (lowerCaseKey === null || lowerCaseKey === void 0 ? void 0 : lowerCaseKey.indexOf('user')) > -1:
4253
4262
  defaultWidth = 130;
4254
4263
  break;
4255
4264
  }
@@ -4396,7 +4405,9 @@ var AddSelect = function AddSelect(props) {
4396
4405
  _props$businessType = props.businessType,
4397
4406
  businessType = _props$businessType === void 0 ? 'sku' : _props$businessType,
4398
4407
  _props$isAllowRepeate = props.isAllowRepeatedSelect,
4399
- isAllowRepeatedSelect = _props$isAllowRepeate === void 0 ? false : _props$isAllowRepeate;
4408
+ isAllowRepeatedSelect = _props$isAllowRepeate === void 0 ? false : _props$isAllowRepeate,
4409
+ _props$noUseItemEanco = props.noUseItemEancode,
4410
+ noUseItemEancode = _props$noUseItemEanco === void 0 ? true : _props$noUseItemEanco;
4400
4411
  var _ref = requestConfig || {},
4401
4412
  url = _ref.url,
4402
4413
  otherParams = _ref.otherParams,
@@ -5070,8 +5081,10 @@ var AddSelect = function AddSelect(props) {
5070
5081
  pageSize: 5000,
5071
5082
  currentPage: 1
5072
5083
  })]).then(function (x) {
5073
- formatSource(x, 0, 2, tableSearchForm, ['id', 'name']);
5074
- formatTreeDataSource(x, 1, 3, tableSearchForm);
5084
+ var searchPosition1 = noUseItemEancode ? 3 : 2;
5085
+ var searchPosition2 = noUseItemEancode ? 4 : 3;
5086
+ formatSource(x, 0, searchPosition1, tableSearchForm, ['id', 'name']);
5087
+ formatTreeDataSource(x, 1, searchPosition2, tableSearchForm);
5075
5088
  });
5076
5089
  }
5077
5090
  if (businessType == 'skc') {
@@ -8701,7 +8714,7 @@ var BusinessSearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
8701
8714
  needModalTable: needModalTable,
8702
8715
  modalTableProps: modalTableProps
8703
8716
  });
8704
- }, [props === null || props === void 0 ? void 0 : props.value, props.disabled]);
8717
+ }, [props === null || props === void 0 ? void 0 : props.value, props.disabled, props.selectBusinessType]);
8705
8718
  React.useImperativeHandle(ref, function () {
8706
8719
  return {
8707
8720
  getRef: function getRef() {
@@ -8723,9 +8736,13 @@ var BusinessSearchSelect$1 = /*#__PURE__*/React__default['default'].memo(Busines
8723
8736
  if (props && props.disabled !== nextProps.disabled) {
8724
8737
  return false;
8725
8738
  }
8739
+ if (props && props.selectBusinessType !== nextProps.selectBusinessType) {
8740
+ return false;
8741
+ }
8726
8742
  return true;
8727
8743
  });
8728
8744
 
8745
+ // import { getCurrentTargetBgId } from '@/utils/LocalstorageUtils';
8729
8746
  function handleSelectColumn(c, parentProps) {
8730
8747
  var result = c;
8731
8748
  var exceptColumns = (parentProps === null || parentProps === void 0 ? void 0 : parentProps.exceptColumns) || [];
@@ -8737,7 +8754,7 @@ function handleSelectColumn(c, parentProps) {
8737
8754
  return !exceptColumns.includes(i.dataIndex);
8738
8755
  });
8739
8756
  }
8740
- // 追加
8757
+ // 追加(最好不用这个,当组件不固定时候会有影响)
8741
8758
  if (additionColumns === null || additionColumns === void 0 ? void 0 : additionColumns.length) {
8742
8759
  additionColumns.forEach(function (i) {
8743
8760
  result.splice(i.position, 0, i.column);
@@ -8750,6 +8767,7 @@ function handleSelectColumn(c, parentProps) {
8750
8767
  return result;
8751
8768
  }
8752
8769
  var AddSkuSelect = function AddSkuSelect(parProps) {
8770
+ var _parProps$requestConf, _parProps$requestConf2;
8753
8771
  var selectProps = {
8754
8772
  mode: 'multiple'
8755
8773
  };
@@ -8757,12 +8775,26 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8757
8775
  _useState2 = _slicedToArray(_useState, 2),
8758
8776
  value = _useState2[0],
8759
8777
  setValue = _useState2[1];
8778
+ var isNoUseItemBarcode = (parProps === null || parProps === void 0 ? void 0 : parProps.noUseItemEancode) !== undefined ? parProps === null || parProps === void 0 ? void 0 : parProps.noUseItemEancode : true; // 默认不加商品条码,兼容老项目
8760
8779
  //注⚠️:自定义过表头的请记得传tableCodeList参数
8761
8780
  var initialSelectColumn = [{
8762
8781
  title: 'SKU编码',
8763
8782
  width: 150,
8764
8783
  dataIndex: 'skuCode'
8765
- }, {
8784
+ }].concat(_toConsumableArray(isNoUseItemBarcode ? [] : [{
8785
+ title: '商品条码',
8786
+ width: 100,
8787
+ ellipsis: {
8788
+ showTitle: false
8789
+ },
8790
+ dataIndex: 'itemEancode',
8791
+ render: function render(text) {
8792
+ return /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
8793
+ placement: "topLeft",
8794
+ title: text
8795
+ }, text);
8796
+ }
8797
+ }]), [{
8766
8798
  title: 'SKU名称',
8767
8799
  width: 200,
8768
8800
  ellipsis: {
@@ -8838,7 +8870,7 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8838
8870
  }, text);
8839
8871
  },
8840
8872
  dataIndex: 'propertyNameAndValue'
8841
- }];
8873
+ }]);
8842
8874
  var mTpSelectColumn = handleSelectColumn(initialSelectColumn, parProps);
8843
8875
  var props = {
8844
8876
  buttonText: parProps.buttonText || '新增',
@@ -8849,11 +8881,11 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8849
8881
  requestConfig: _objectSpread2({
8850
8882
  url: "/items/sku/pager/v2",
8851
8883
  filter: 'qp-name-like',
8852
- otherParams: {
8884
+ otherParams: _objectSpread2({
8853
8885
  'qp-combination-eq': false,
8854
8886
  'qp-approveStatus-eq': 1,
8855
8887
  'qp-status-eq': 1
8856
- },
8888
+ }, (parProps === null || parProps === void 0 ? void 0 : (_parProps$requestConf = parProps.requestConfig) === null || _parProps$requestConf === void 0 ? void 0 : _parProps$requestConf.addOtherParams) || {}),
8857
8889
  mappingTextField: 'name',
8858
8890
  mappingValueField: 'skuCode'
8859
8891
  }, parProps.requestConfig),
@@ -8865,7 +8897,8 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8865
8897
  beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
8866
8898
  onSaveCallback: parProps.onSaveCallback,
8867
8899
  businessType: 'sku',
8868
- isAllowRepeatedSelect: !!(parProps === null || parProps === void 0 ? void 0 : parProps.isAllowRepeatedSelect)
8900
+ isAllowRepeatedSelect: !!(parProps === null || parProps === void 0 ? void 0 : parProps.isAllowRepeatedSelect),
8901
+ noUseItemEancode: isNoUseItemBarcode
8869
8902
  };
8870
8903
  var modalTableProps = {
8871
8904
  modalTableTitle: '选择商品',
@@ -8875,7 +8908,14 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8875
8908
  }, {
8876
8909
  name: 'qp-skuName-like',
8877
8910
  label: 'SKU名称'
8878
- }, {
8911
+ }].concat(_toConsumableArray(isNoUseItemBarcode ? [] : [{
8912
+ name: 'qp-code-in',
8913
+ label: '商品条码',
8914
+ field: {
8915
+ type: 'multipleQueryInput',
8916
+ props: _objectSpread2({}, ((_parProps$requestConf2 = parProps.requestConfig) === null || _parProps$requestConf2 === void 0 ? void 0 : _parProps$requestConf2.itemEancodeValueRequestConfig) || {})
8917
+ }
8918
+ }]), [{
8879
8919
  name: 'qp-brandId-in',
8880
8920
  type: 'select',
8881
8921
  label: '品牌',
@@ -8920,7 +8960,7 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8920
8960
  }
8921
8961
  }
8922
8962
  }
8923
- }],
8963
+ }]),
8924
8964
  tableColumns: [{
8925
8965
  title: 'SKU编码',
8926
8966
  width: 150,
@@ -8954,20 +8994,20 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
8954
8994
  height: 20
8955
8995
  }));
8956
8996
  }
8957
- }, {
8958
- title: '国际条码',
8997
+ }].concat(_toConsumableArray(isNoUseItemBarcode ? [] : [{
8998
+ title: '商品条码',
8959
8999
  width: 100,
8960
9000
  ellipsis: {
8961
9001
  showTitle: false
8962
9002
  },
8963
- dataIndex: 'barCode',
9003
+ dataIndex: 'itemEancode',
8964
9004
  render: function render(text) {
8965
9005
  return /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
8966
9006
  placement: "topLeft",
8967
9007
  title: text
8968
9008
  }, text);
8969
9009
  }
8970
- }, {
9010
+ }]), [{
8971
9011
  title: '所属SPU名称',
8972
9012
  width: 100,
8973
9013
  ellipsis: {
@@ -9058,7 +9098,7 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
9058
9098
  }, text);
9059
9099
  },
9060
9100
  dataIndex: 'brandName'
9061
- }],
9101
+ }]),
9062
9102
  selectColumn: mTpSelectColumn
9063
9103
  };
9064
9104
  return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(AddSelect, _objectSpread2(_objectSpread2({}, props), {}, {
@@ -9066,6 +9106,7 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
9066
9106
  })));
9067
9107
  };
9068
9108
  var AddSkcSelect = function AddSkcSelect(parProps) {
9109
+ var _parProps$requestConf3;
9069
9110
  var selectProps = {
9070
9111
  mode: 'multiple'
9071
9112
  };
@@ -9143,9 +9184,9 @@ var AddSkcSelect = function AddSkcSelect(parProps) {
9143
9184
  requestConfig: _objectSpread2({
9144
9185
  url: "/items/skc/skcSelect",
9145
9186
  filter: 'qp-name-like',
9146
- otherParams: {
9187
+ otherParams: _objectSpread2({
9147
9188
  'qp-skcStatus-eq': 1
9148
- },
9189
+ }, (parProps === null || parProps === void 0 ? void 0 : (_parProps$requestConf3 = parProps.requestConfig) === null || _parProps$requestConf3 === void 0 ? void 0 : _parProps$requestConf3.addOtherParams) || {}),
9149
9190
  mappingTextField: 'name',
9150
9191
  mappingValueField: 'code'
9151
9192
  }, parProps.requestConfig),
@@ -9345,6 +9386,7 @@ var AddSkcSelect = function AddSkcSelect(parProps) {
9345
9386
  })));
9346
9387
  };
9347
9388
  var AddSpuSelect = function AddSpuSelect(parProps) {
9389
+ var _parProps$requestConf4;
9348
9390
  var selectProps = {
9349
9391
  mode: 'multiple'
9350
9392
  };
@@ -9431,11 +9473,11 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
9431
9473
  requestConfig: _objectSpread2({
9432
9474
  url: "/items/item",
9433
9475
  filter: 'qp-itemCode,name-orGroup,like',
9434
- otherParams: {
9476
+ otherParams: _objectSpread2({
9435
9477
  'qp-approveStatus-eq': 1,
9436
9478
  'qp-status-eq': 1,
9437
9479
  sorter: 'desc-id'
9438
- },
9480
+ }, (parProps === null || parProps === void 0 ? void 0 : (_parProps$requestConf4 = parProps.requestConfig) === null || _parProps$requestConf4 === void 0 ? void 0 : _parProps$requestConf4.addOtherParams) || {}),
9439
9481
  mappingTextField: 'name',
9440
9482
  mappingValueField: 'itemCode'
9441
9483
  }, parProps.requestConfig),
@@ -29499,7 +29541,8 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
29499
29541
  }
29500
29542
  var parallelTreeData = _this.coverToParallel(ruleTreeData, []) || [];
29501
29543
  var currentTreeItem = (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.elementId) && parallelTreeData.find(function (i) {
29502
- return i.key === (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.elementId);
29544
+ var _i$key;
29545
+ return ((i === null || i === void 0 ? void 0 : (_i$key = i.key) === null || _i$key === void 0 ? void 0 : _i$key.indexOf('.')) > -1 ? i.id : i.key) === (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.elementId);
29503
29546
  });
29504
29547
  var dataChoiceBusinessType = currentTreeItem === null || currentTreeItem === void 0 ? void 0 : currentTreeItem.dataChoiceBusinessType;
29505
29548
  var dataInputBusinessType = currentTreeItem === null || currentTreeItem === void 0 ? void 0 : currentTreeItem.dataInputBusinessType;
@@ -29704,10 +29747,11 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
29704
29747
  }
29705
29748
  }), "\u6DFB\u52A0\u6761\u4EF6"))));
29706
29749
  };
29707
- _this.handleEditExtraInfoResponse = function (code, val, parentDetail) {
29750
+ _this.handleEditExtraInfoResponse = function (code, val, parentDetail, classDataIndex) {
29708
29751
  var ruleClassData = _this.state.ruleClassData;
29709
29752
  var callBack = _this.props.callBack;
29710
29753
  parentDetail.extraInfo.response[code] = val;
29754
+ ruleClassData[classDataIndex].extraInfo.response[code] = val;
29711
29755
  _this.setState({
29712
29756
  ruleClassData: ruleClassData
29713
29757
  }, function () {
@@ -29715,7 +29759,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
29715
29759
  });
29716
29760
  };
29717
29761
  // 场景需要返回值2022.11.15
29718
- _this.renderResItem = function (itemDetail, parentDetail, ruleReturnConfig, disabled, boxStyle) {
29762
+ _this.renderResItem = function (itemDetail, parentDetail, ruleReturnConfig, classDataIndex, disabled, boxStyle) {
29719
29763
  var _ruleReturnConfig$rig;
29720
29764
  var isShowResponse = itemDetail.response['enable'];
29721
29765
  var isRightText = ruleReturnConfig === null || ruleReturnConfig === void 0 ? void 0 : (_ruleReturnConfig$rig = ruleReturnConfig.rightText) === null || _ruleReturnConfig$rig === void 0 ? void 0 : _ruleReturnConfig$rig.length;
@@ -29731,7 +29775,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
29731
29775
  var value = val;
29732
29776
  if (isObj(code)) {
29733
29777
  Object.keys(code).forEach(function (ite) {
29734
- _this.handleEditExtraInfoResponse(ite, code[ite], parentDetail);
29778
+ _this.handleEditExtraInfoResponse(ite, code[ite], parentDetail, classDataIndex);
29735
29779
  });
29736
29780
  return;
29737
29781
  }
@@ -29744,7 +29788,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
29744
29788
  var _val$PCDCode;
29745
29789
  value = val.value || ((_val$PCDCode = val.PCDCode) === null || _val$PCDCode === void 0 ? void 0 : _val$PCDCode.join('/'));
29746
29790
  }
29747
- _this.handleEditExtraInfoResponse('value', value, parentDetail);
29791
+ _this.handleEditExtraInfoResponse('value', value, parentDetail, classDataIndex);
29748
29792
  };
29749
29793
  return isShowResponse && /*#__PURE__*/React__default['default'].createElement("div", {
29750
29794
  style: {
@@ -29753,7 +29797,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
29753
29797
  }, _this.renderFormCompItem(ruleReturnConfig, showValue, handleEdit, {}, boxStyle, disabled), /*#__PURE__*/React__default['default'].createElement(icons.MinusCircleOutlined, {
29754
29798
  className: 'icon_btn_style',
29755
29799
  onClick: function onClick() {
29756
- _this.handleEditExtraInfoResponse('enable', false, parentDetail);
29800
+ _this.handleEditExtraInfoResponse('enable', false, parentDetail, classDataIndex);
29757
29801
  },
29758
29802
  style: {
29759
29803
  color: 'gray',
@@ -30362,12 +30406,12 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
30362
30406
  type: "link",
30363
30407
  onClick: function onClick() {
30364
30408
  if (isHaveRuleReturnConfig) {
30365
- _this.handleEditExtraInfoResponse('enable', true, parentDetail);
30409
+ _this.handleEditExtraInfoResponse('enable', true, parentDetail, classDataIndex);
30366
30410
  } else {
30367
30411
  antd.message.warn('未配置返回');
30368
30412
  }
30369
30413
  }
30370
- }, "\u65B0\u589E\u8FD4\u56DE\u503C")), isHaveRuleReturnConfig && _this.renderResItem(itemDetail, parentDetail, ruleReturnConfig, disabled, RuleActionItemStyle) || null, isHaveRuleTypeData && _this.renderActionList(itemDetail, parentDetail, handleRuleTypeData, selectRuleActionData, classDataIndex, disabled, RuleActionItemStyle) || null);
30414
+ }, "\u65B0\u589E\u8FD4\u56DE\u503C")), isHaveRuleReturnConfig && _this.renderResItem(itemDetail, parentDetail, ruleReturnConfig, classDataIndex, disabled, RuleActionItemStyle) || null, isHaveRuleTypeData && _this.renderActionList(itemDetail, parentDetail, handleRuleTypeData, selectRuleActionData, classDataIndex, disabled, RuleActionItemStyle) || null);
30371
30415
  };
30372
30416
  //添加同一层级条件
30373
30417
  _this.addPeerRule = function (itemDetail) {
@@ -14,3 +14,4 @@ export declare function getUserId(): any;
14
14
  export declare function getAccountID(): any;
15
15
  export declare function getUserName(): any;
16
16
  export declare function handleUserPhone(): any;
17
+ export declare function getCurrentTargetBgId(): string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.3.18",
3
+ "version": "2.3.19",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -45,6 +45,7 @@ export default () => {
45
45
  // },
46
46
  // },
47
47
  // ],
48
+ noUseItemEancode: false,
48
49
  beforeShowModal: () => {
49
50
  return Promise.resolve(true);
50
51
  // return Promise.reject('校验有误');
@@ -11,6 +11,7 @@ import axios from 'axios';
11
11
  import { AddSelect } from '../../../index';
12
12
  import { tableColumnsImage } from '@/components/Business/BsSulaQueryTable/utils';
13
13
  import { getSkuImg } from '@/utils/TableUtils';
14
+ // import { getCurrentTargetBgId } from '@/utils/LocalstorageUtils';
14
15
 
15
16
  function handleSelectColumn(c: any, parentProps: any) {
16
17
  let result = c;
@@ -21,7 +22,7 @@ function handleSelectColumn(c: any, parentProps: any) {
21
22
  if(exceptColumns?.length) {
22
23
  result = result.filter((i: any) => !exceptColumns.includes(i.dataIndex))
23
24
  }
24
- // 追加
25
+ // 追加(最好不用这个,当组件不固定时候会有影响)
25
26
  if(additionColumns?.length) {
26
27
  additionColumns.forEach((i: any) => {
27
28
  result.splice(i.position,0,i.column)
@@ -39,6 +40,7 @@ export const AddSkuSelect = (parProps: any) => {
39
40
  mode: 'multiple',
40
41
  }
41
42
  const [value, setValue] = useState(selectProps?.mode ? [] : null);
43
+ const isNoUseItemBarcode = parProps?.noUseItemEancode !== undefined ? parProps?.noUseItemEancode : true; // 默认不加商品条码,兼容老项目
42
44
  //注⚠️:自定义过表头的请记得传tableCodeList参数
43
45
  const initialSelectColumn = [
44
46
  {
@@ -46,6 +48,21 @@ export const AddSkuSelect = (parProps: any) => {
46
48
  width: 150,
47
49
  dataIndex: 'skuCode',
48
50
  },
51
+ ...(isNoUseItemBarcode ? [] : [
52
+ {
53
+ title: '商品条码',
54
+ width: 100,
55
+ ellipsis: {
56
+ showTitle: false,
57
+ },
58
+ dataIndex: 'itemEancode',
59
+ render: (text: any) => (
60
+ <Tooltip placement="topLeft" title={text}>
61
+ {text}
62
+ </Tooltip>
63
+ ),
64
+ }
65
+ ]),
49
66
  {
50
67
  title: 'SKU名称',
51
68
  width: 200,
@@ -137,6 +154,8 @@ export const AddSkuSelect = (parProps: any) => {
137
154
  'qp-combination-eq': false,
138
155
  'qp-approveStatus-eq': 1,
139
156
  'qp-status-eq': 1,
157
+ // 'useOrgSign': getCurrentTargetBgId(), // 根据品牌、账号授权的组织+商品授权使用组织做权限过滤 这个交给业务使用的地方去做,传addOtherParams:{useOrgSign:单据中所选组织}
158
+ ...(parProps?.requestConfig?.addOtherParams || {}), // 允许在默认参数基础上,追加/覆盖已有 参数
140
159
  }, // 默认参数
141
160
  mappingTextField: 'name',
142
161
  mappingValueField: 'skuCode',
@@ -151,6 +170,7 @@ export const AddSkuSelect = (parProps: any) => {
151
170
  onSaveCallback: parProps.onSaveCallback,
152
171
  businessType: 'sku',
153
172
  isAllowRepeatedSelect: !!parProps?.isAllowRepeatedSelect,
173
+ noUseItemEancode: isNoUseItemBarcode
154
174
  };
155
175
  const modalTableProps = {
156
176
  modalTableTitle: '选择商品',
@@ -159,6 +179,14 @@ export const AddSkuSelect = (parProps: any) => {
159
179
  name: 'qp-skuCode-like', label: 'SKU编码'
160
180
  },
161
181
  { name: 'qp-skuName-like', label: 'SKU名称' },
182
+ ...(isNoUseItemBarcode ? []: [
183
+ { name: 'qp-code-in', label: '商品条码', field: {
184
+ type: 'multipleQueryInput',
185
+ props: {
186
+ ...(parProps.requestConfig?.itemEancodeValueRequestConfig || {}),
187
+ },
188
+ }}
189
+ ]),
162
190
  { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
163
191
  type: 'select',
164
192
  props: {
@@ -224,19 +252,21 @@ export const AddSkuSelect = (parProps: any) => {
224
252
  </Tooltip>
225
253
  ),
226
254
  },
227
- {
228
- title: '国际条码',
229
- width: 100,
230
- ellipsis: {
231
- showTitle: false,
232
- },
233
- dataIndex: 'barCode',
234
- render: (text: any) => (
235
- <Tooltip placement="topLeft" title={text}>
236
- {text}
237
- </Tooltip>
238
- ),
239
- },
255
+ ...(isNoUseItemBarcode ? []: [
256
+ {
257
+ title: '商品条码',
258
+ width: 100,
259
+ ellipsis: {
260
+ showTitle: false,
261
+ },
262
+ dataIndex: 'itemEancode',
263
+ render: (text: any) => (
264
+ <Tooltip placement="topLeft" title={text}>
265
+ {text}
266
+ </Tooltip>
267
+ ),
268
+ }
269
+ ]),
240
270
  {
241
271
  title: '所属SPU名称',
242
272
  width: 100,
@@ -419,7 +449,10 @@ export const AddSkcSelect = (parProps: any) => {
419
449
  requestConfig: {
420
450
  url: `/items/skc/skcSelect`,
421
451
  filter: 'qp-name-like', // 过滤参数 支持'qp-name-like'和['qp-name-like', 'qp-code-like']两种结构
422
- otherParams: { 'qp-skcStatus-eq': 1, }, // 默认参数
452
+ otherParams: {
453
+ 'qp-skcStatus-eq': 1,
454
+ ...(parProps?.requestConfig?.addOtherParams || {}), // 允许在默认参数基础上,追加/覆盖已有 参数
455
+ }, // 默认参数
423
456
  mappingTextField: 'name',
424
457
  mappingValueField: 'code',
425
458
  ...parProps.requestConfig
@@ -693,7 +726,8 @@ export const AddSpuSelect = (parProps: any) => {
693
726
  otherParams: {
694
727
  'qp-approveStatus-eq': 1, // 审核状态(0.待审批;1.审批通过;2.驳回;3.审批未通过)
695
728
  'qp-status-eq': 1,
696
- sorter: 'desc-id'
729
+ sorter: 'desc-id',
730
+ ...(parProps?.requestConfig?.addOtherParams || {}), // 允许在默认参数基础上,追加/覆盖已有 参数
697
731
  }, // 默认参数
698
732
  mappingTextField: 'name',
699
733
  mappingValueField: 'itemCode',
@@ -25,7 +25,7 @@ const BusinessSearchSelect = forwardRef((props: any, ref: any) => {
25
25
  needModalTable,
26
26
  modalTableProps
27
27
  }
28
- }, [props?.value, props.disabled]);
28
+ }, [props?.value, props.disabled, props.selectBusinessType]);
29
29
 
30
30
  useImperativeHandle(ref, () => ({
31
31
  getRef: () => innerRef,
@@ -48,5 +48,8 @@ export default React.memo(BusinessSearchSelect, (props, nextProps) => {
48
48
  if (props && props.disabled !== nextProps.disabled) {
49
49
  return false
50
50
  }
51
+ if (props && props.selectBusinessType !== nextProps.selectBusinessType) {
52
+ return false
53
+ }
51
54
  return true
52
- });
55
+ });
@@ -13,29 +13,29 @@ import {
13
13
  //设置queryTable默认列宽
14
14
  export const getItemDefaultWidth = (item: any) => {
15
15
  let defaultWidth = 200;
16
- let lowerCaseKey = (item.key || item.dataIndex).toLowerCase();
16
+ let lowerCaseKey = (item.key || item.dataIndex)?.toLowerCase();
17
17
  switch (true) {
18
18
  case item?.title === '操作' || lowerCaseKey === 'operate':
19
19
  defaultWidth = 60;
20
20
  break;
21
- case lowerCaseKey.indexOf('number') > -1:
22
- case lowerCaseKey.indexOf('quantity') > -1:
23
- case lowerCaseKey.indexOf('amount') > -1:
21
+ case lowerCaseKey?.indexOf('number') > -1:
22
+ case lowerCaseKey?.indexOf('quantity') > -1:
23
+ case lowerCaseKey?.indexOf('amount') > -1:
24
24
  defaultWidth = 90;
25
25
  break;
26
- case (lowerCaseKey.indexOf('no') > -1):
26
+ case (lowerCaseKey?.indexOf('no') > -1):
27
27
  defaultWidth = 200;
28
28
  break;
29
- case lowerCaseKey.indexOf('code') > -1:
29
+ case lowerCaseKey?.indexOf('code') > -1:
30
30
  defaultWidth = 170;
31
31
  break;
32
- case lowerCaseKey.indexOf('time') > -1:
32
+ case lowerCaseKey?.indexOf('time') > -1:
33
33
  defaultWidth = 130;
34
34
  break;
35
- case lowerCaseKey.indexOf('status') > -1:
35
+ case lowerCaseKey?.indexOf('status') > -1:
36
36
  defaultWidth = 100;
37
37
  break;
38
- case lowerCaseKey.indexOf('user') > -1:
38
+ case lowerCaseKey?.indexOf('user') > -1:
39
39
  defaultWidth = 130;
40
40
  break;
41
41
  default:
@@ -66,4 +66,4 @@ export const handleTextOverflow = (
66
66
  </span>
67
67
  </Tooltip>
68
68
  );
69
- };
69
+ };
@@ -127,7 +127,8 @@ const AddSelect = (props: any) => {
127
127
  beforeShowModal,
128
128
  tableCodeList = [], // 非必填 默认取组件定义code,如需自定义----数组第一位为供选择商品的table的code,第二位为已选择商品的table的code
129
129
  businessType = 'sku',
130
- isAllowRepeatedSelect = false
130
+ isAllowRepeatedSelect = false,
131
+ noUseItemEancode = true
131
132
  } = props;
132
133
  const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField = 'name', mappingTextShowKeyField, mappingValueField = 'code', mappingTextShowTextField } = requestConfig || {};
133
134
  const resultSourceKey = sourceName || requestConfig?.sourceName || 'supplierCode'
@@ -677,8 +678,10 @@ const AddSelect = (props: any) => {
677
678
  currentPage: 1,
678
679
  }),
679
680
  ]).then((x: any)=>{
680
- formatSource(x,0, 2, tableSearchForm,['id','name'])
681
- formatTreeDataSource(x,1, 3, tableSearchForm)
681
+ const searchPosition1 = noUseItemEancode ? 3 : 2;
682
+ const searchPosition2 = noUseItemEancode ? 4 : 3;
683
+ formatSource(x,0, searchPosition1, tableSearchForm,['id','name'])
684
+ formatTreeDataSource(x,1, searchPosition2, tableSearchForm)
682
685
  })
683
686
  }
684
687
  if(businessType == 'skc') {
@@ -25,6 +25,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
25
25
  needModalTable = true,
26
26
  getPopupContainer = undefined,
27
27
  fieldComponent,
28
+ selectBusinessType,
28
29
  } = props;
29
30
  const {
30
31
  url,
@@ -403,6 +404,14 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
403
404
  makeUniqueValue();
404
405
  }, [resultSourceKey])
405
406
 
407
+ useEffect(() => {
408
+ if (init) {
409
+ setItems([]);
410
+ setItemsTotal(0);
411
+ run('init')
412
+ }
413
+ },[selectBusinessType])
414
+
406
415
  const showModal = () => {
407
416
  getData({ pageSize: tableInitPageSize, currentPage: 1 }, 3)
408
417
  setIsModalVisible(true);
@@ -630,7 +630,7 @@ class RuleObjectComponent extends Component {
630
630
  const parallelTreeData = this.coverToParallel(ruleTreeData, []) || [];
631
631
  const currentTreeItem =
632
632
  itemDetail?.elementId &&
633
- parallelTreeData.find((i) => i.key === itemDetail?.elementId);
633
+ parallelTreeData.find((i) => (i?.key?.indexOf('.') > -1 ? i.id : i.key) === itemDetail?.elementId);
634
634
  const dataChoiceBusinessType = currentTreeItem?.dataChoiceBusinessType;
635
635
  const dataInputBusinessType = currentTreeItem?.dataInputBusinessType;
636
636
  return (
@@ -896,10 +896,12 @@ class RuleObjectComponent extends Component {
896
896
  );
897
897
  };
898
898
 
899
- handleEditExtraInfoResponse = (code, val, parentDetail) => {
899
+ handleEditExtraInfoResponse = (code, val, parentDetail,classDataIndex) => {
900
900
  const { ruleClassData } = this.state;
901
901
  const { callBack } = this.props;
902
902
  parentDetail.extraInfo.response[code] = val;
903
+ ruleClassData[classDataIndex].extraInfo.response[code] = val;
904
+
903
905
  this.setState(
904
906
  {
905
907
  ruleClassData,
@@ -914,6 +916,7 @@ class RuleObjectComponent extends Component {
914
916
  itemDetail,
915
917
  parentDetail,
916
918
  ruleReturnConfig,
919
+ classDataIndex,
917
920
  disabled,
918
921
  boxStyle,
919
922
  ) => {
@@ -932,7 +935,7 @@ class RuleObjectComponent extends Component {
932
935
  let value = val;
933
936
  if (isObj(code)) {
934
937
  Object.keys(code).forEach((ite) => {
935
- this.handleEditExtraInfoResponse(ite, code[ite], parentDetail);
938
+ this.handleEditExtraInfoResponse(ite, code[ite], parentDetail,classDataIndex);
936
939
  });
937
940
  return;
938
941
  }
@@ -942,7 +945,7 @@ class RuleObjectComponent extends Component {
942
945
  if (isObj(val)) {
943
946
  value = val.value || val.PCDCode?.join('/');
944
947
  }
945
- this.handleEditExtraInfoResponse('value', value, parentDetail);
948
+ this.handleEditExtraInfoResponse('value', value, parentDetail,classDataIndex);
946
949
  };
947
950
 
948
951
  return (
@@ -959,7 +962,7 @@ class RuleObjectComponent extends Component {
959
962
  <MinusCircleOutlined
960
963
  className={'icon_btn_style'}
961
964
  onClick={() => {
962
- this.handleEditExtraInfoResponse('enable', false, parentDetail);
965
+ this.handleEditExtraInfoResponse('enable', false, parentDetail,classDataIndex);
963
966
  }}
964
967
  style={{
965
968
  color: 'gray',
@@ -1755,7 +1758,7 @@ class RuleObjectComponent extends Component {
1755
1758
  type="link"
1756
1759
  onClick={() => {
1757
1760
  if (isHaveRuleReturnConfig) {
1758
- this.handleEditExtraInfoResponse('enable', true, parentDetail);
1761
+ this.handleEditExtraInfoResponse('enable', true, parentDetail,classDataIndex);
1759
1762
  } else {
1760
1763
  message.warn('未配置返回');
1761
1764
  }
@@ -1769,6 +1772,7 @@ class RuleObjectComponent extends Component {
1769
1772
  itemDetail,
1770
1773
  parentDetail,
1771
1774
  ruleReturnConfig,
1775
+ classDataIndex,
1772
1776
  disabled,
1773
1777
  RuleActionItemStyle,
1774
1778
  )) ||
@@ -88,3 +88,8 @@ export function handleUserPhone() {
88
88
  const enStr = str && str.slice(0, 3) + '****' + str.slice(str.length - 4);
89
89
  return enStr;
90
90
  }
91
+
92
+ // 获取当前所选组织
93
+ export function getCurrentTargetBgId() {
94
+ return localStorage.getItem('target_bg_id');
95
+ }