@bit-sun/business-component 2.1.17 → 2.1.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.
@@ -10,6 +10,7 @@ declare class SortableTable extends React.Component {
10
10
  onSearchSort: boolean;
11
11
  isDefaultValue: boolean;
12
12
  defaultValue: never[];
13
+ bsTableCode: string;
13
14
  };
14
15
  patchUserColumnConfig: (config: any) => void;
15
16
  getConfigFromlocalstorage: () => any;
package/dist/index.esm.js CHANGED
@@ -10793,6 +10793,7 @@ var handleDefaultPrefixUrl = function handleDefaultPrefixUrl(type) {
10793
10793
  result = '/user';
10794
10794
  break;
10795
10795
  case 'deliveryMode':
10796
+ case 'ruleTemplate':
10796
10797
  result = '/basic';
10797
10798
  break;
10798
10799
  default:
@@ -12406,6 +12407,60 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
12406
12407
  }]
12407
12408
  }, modalTableBusProps);
12408
12409
  }
12410
+ // 规则场景选择器
12411
+ if (type === 'ruleTemplate') {
12412
+ requestConfig = _objectSpread2({
12413
+ url: "".concat(prefixUrl.selectPrefix, "/ruleTemplate"),
12414
+ // filter: 'qp-name,code-orGroup,like', // 过滤参数
12415
+ filter: 'qp-name-like',
12416
+ mappingTextField: 'name',
12417
+ mappingTextShowKeyField: 'code',
12418
+ mappingValueField: 'code',
12419
+ otherParams: {
12420
+ sorter: 'desc-id'
12421
+ },
12422
+ sourceName: 'ruleTemplateCode'
12423
+ }, requestConfigProp);
12424
+ tableSearchForm = [{
12425
+ name: 'qp-name-like',
12426
+ label: '规则场景名称'
12427
+ }, {
12428
+ name: 'qp-code-like',
12429
+ label: '规则场景编码'
12430
+ }];
12431
+ modalTableProps = _objectSpread2({
12432
+ modalTableTitle: '选择规则场景',
12433
+ tableSearchForm: tableSearchForm,
12434
+ tableColumns: [{
12435
+ title: '规则场景编码',
12436
+ dataIndex: 'code'
12437
+ }, {
12438
+ title: '规则场景名称',
12439
+ dataIndex: 'name',
12440
+ render: function render(text) {
12441
+ return handleTextOverflow(text);
12442
+ }
12443
+ }, {
12444
+ title: '条件对象',
12445
+ dataIndex: 'objectName',
12446
+ render: function render(text) {
12447
+ return handleTextOverflow(text);
12448
+ }
12449
+ }, {
12450
+ dataIndex: 'extName',
12451
+ title: '条件扩展',
12452
+ render: function render(text) {
12453
+ return handleTextOverflow(text);
12454
+ }
12455
+ }, {
12456
+ dataIndex: 'actionName',
12457
+ title: '执行动作',
12458
+ render: function render(text) {
12459
+ return handleTextOverflow(text);
12460
+ }
12461
+ }]
12462
+ }, modalTableBusProps);
12463
+ }
12409
12464
  return {
12410
12465
  modalTableProps: modalTableProps,
12411
12466
  requestConfig: requestConfig,
@@ -12456,6 +12511,25 @@ var BusinessSearchSelect$1 = /*#__PURE__*/React.memo(BusinessSearchSelect, funct
12456
12511
  return true;
12457
12512
  });
12458
12513
 
12514
+ function handleSelectColumn(c, parentProps) {
12515
+ var result = c;
12516
+ var exceptColumns = (parentProps === null || parentProps === void 0 ? void 0 : parentProps.exceptColumns) || [];
12517
+ var coverColumns = (parentProps === null || parentProps === void 0 ? void 0 : parentProps.coverColumns) || [];
12518
+ var additionColumns = (parentProps === null || parentProps === void 0 ? void 0 : parentProps.additionColumns) || [];
12519
+ // 过滤不需要展示内容
12520
+ if (exceptColumns === null || exceptColumns === void 0 ? void 0 : exceptColumns.length) {
12521
+ result = result.filter(function (i) {
12522
+ return !exceptColumns.includes(i.dataIndex);
12523
+ });
12524
+ }
12525
+ // 追加
12526
+ if (additionColumns === null || additionColumns === void 0 ? void 0 : additionColumns.length) ;
12527
+ // 覆盖内容
12528
+ if (coverColumns === null || coverColumns === void 0 ? void 0 : coverColumns.length) {
12529
+ result = coverColumns;
12530
+ }
12531
+ return result;
12532
+ }
12459
12533
  var AddSkuSelect = function AddSkuSelect(parProps) {
12460
12534
  var selectProps = {
12461
12535
  mode: 'multiple'
@@ -12464,6 +12538,88 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
12464
12538
  _useState2 = _slicedToArray(_useState, 2),
12465
12539
  value = _useState2[0],
12466
12540
  setValue = _useState2[1];
12541
+ var initialSelectColumn = [{
12542
+ title: 'SKU编码',
12543
+ width: 150,
12544
+ dataIndex: 'skuCode'
12545
+ }, {
12546
+ title: 'SKU名称',
12547
+ width: 200,
12548
+ ellipsis: {
12549
+ showTitle: false
12550
+ },
12551
+ render: function render(text) {
12552
+ return /*#__PURE__*/React.createElement(Tooltip, {
12553
+ placement: "topLeft",
12554
+ title: text
12555
+ }, text);
12556
+ },
12557
+ dataIndex: 'name'
12558
+ }, {
12559
+ title: '图片',
12560
+ dataIndex: 'itemUrl',
12561
+ width: 200,
12562
+ ellipsis: {
12563
+ showTitle: false
12564
+ },
12565
+ render: function render(text, record) {
12566
+ return /*#__PURE__*/React.createElement(Tooltip, {
12567
+ placement: "topLeft",
12568
+ title: text
12569
+ }, tableColumnsImage(getSkuImg(record), {
12570
+ width: 28,
12571
+ height: 28
12572
+ }));
12573
+ }
12574
+ }, {
12575
+ title: '数量',
12576
+ width: 100,
12577
+ isInputItem: true,
12578
+ dataIndex: 'count'
12579
+ }, {
12580
+ title: '单位',
12581
+ dataIndex: 'selectUnitCode',
12582
+ width: 80,
12583
+ ellipsis: {
12584
+ showTitle: false
12585
+ },
12586
+ render: function render(text, record) {
12587
+ var _record$packingUnitLi;
12588
+ if (record === null || record === void 0 ? void 0 : (_record$packingUnitLi = record.packingUnitList) === null || _record$packingUnitLi === void 0 ? void 0 : _record$packingUnitLi.length) {
12589
+ var basePackUnit = record === null || record === void 0 ? void 0 : record.packingUnitList[0];
12590
+ record.selectUnitCode = basePackUnit.unitCode;
12591
+ return basePackUnit.name || basePackUnit.unitCode;
12592
+ }
12593
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
12594
+ }
12595
+ }, {
12596
+ title: '所属SPU编码',
12597
+ width: 150,
12598
+ ellipsis: {
12599
+ showTitle: false
12600
+ },
12601
+ dataIndex: 'itemCode',
12602
+ render: function render(text) {
12603
+ return /*#__PURE__*/React.createElement(Tooltip, {
12604
+ placement: "topLeft",
12605
+ title: text
12606
+ }, text);
12607
+ }
12608
+ }, {
12609
+ title: '规格',
12610
+ width: 200,
12611
+ ellipsis: {
12612
+ showTitle: false
12613
+ },
12614
+ render: function render(text) {
12615
+ return /*#__PURE__*/React.createElement(Tooltip, {
12616
+ placement: "topLeft",
12617
+ title: text
12618
+ }, text);
12619
+ },
12620
+ dataIndex: 'propertyNameAndValue'
12621
+ }];
12622
+ var mTpSelectColumn = handleSelectColumn(initialSelectColumn, parProps);
12467
12623
  var props = {
12468
12624
  buttonText: parProps.buttonText || '新增',
12469
12625
  buttonProps: parProps.buttonProps || {},
@@ -12686,87 +12842,7 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
12686
12842
  },
12687
12843
  dataIndex: 'brandName'
12688
12844
  }],
12689
- selectColumn: [{
12690
- title: 'SKU编码',
12691
- width: 150,
12692
- dataIndex: 'skuCode'
12693
- }, {
12694
- title: 'SKU名称',
12695
- width: 200,
12696
- ellipsis: {
12697
- showTitle: false
12698
- },
12699
- render: function render(text) {
12700
- return /*#__PURE__*/React.createElement(Tooltip, {
12701
- placement: "topLeft",
12702
- title: text
12703
- }, text);
12704
- },
12705
- dataIndex: 'name'
12706
- }, {
12707
- title: '图片',
12708
- dataIndex: 'itemUrl',
12709
- width: 200,
12710
- ellipsis: {
12711
- showTitle: false
12712
- },
12713
- render: function render(text, record) {
12714
- return /*#__PURE__*/React.createElement(Tooltip, {
12715
- placement: "topLeft",
12716
- title: text
12717
- }, tableColumnsImage(getSkuImg(record), {
12718
- width: 28,
12719
- height: 28
12720
- }));
12721
- }
12722
- }, {
12723
- title: '数量',
12724
- width: 100,
12725
- isInputItem: true,
12726
- dataIndex: 'count'
12727
- }, {
12728
- title: '单位',
12729
- dataIndex: 'selectUnitCode',
12730
- width: 80,
12731
- ellipsis: {
12732
- showTitle: false
12733
- },
12734
- render: function render(text, record) {
12735
- var _record$packingUnitLi;
12736
- if (record === null || record === void 0 ? void 0 : (_record$packingUnitLi = record.packingUnitList) === null || _record$packingUnitLi === void 0 ? void 0 : _record$packingUnitLi.length) {
12737
- var basePackUnit = record === null || record === void 0 ? void 0 : record.packingUnitList[0];
12738
- record.selectUnitCode = basePackUnit.unitCode;
12739
- return basePackUnit.name || basePackUnit.unitCode;
12740
- }
12741
- return /*#__PURE__*/React.createElement(React.Fragment, null);
12742
- }
12743
- }, {
12744
- title: '所属SPU编码',
12745
- width: 150,
12746
- ellipsis: {
12747
- showTitle: false
12748
- },
12749
- dataIndex: 'itemCode',
12750
- render: function render(text) {
12751
- return /*#__PURE__*/React.createElement(Tooltip, {
12752
- placement: "topLeft",
12753
- title: text
12754
- }, text);
12755
- }
12756
- }, {
12757
- title: '规格',
12758
- width: 200,
12759
- ellipsis: {
12760
- showTitle: false
12761
- },
12762
- render: function render(text) {
12763
- return /*#__PURE__*/React.createElement(Tooltip, {
12764
- placement: "topLeft",
12765
- title: text
12766
- }, text);
12767
- },
12768
- dataIndex: 'propertyNameAndValue'
12769
- }]
12845
+ selectColumn: mTpSelectColumn
12770
12846
  };
12771
12847
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AddSelect, _objectSpread2(_objectSpread2({}, props), {}, {
12772
12848
  modalTableProps: modalTableProps
@@ -15144,9 +15220,11 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15144
15220
  searchDataSource: false,
15145
15221
  onSearchSort: false,
15146
15222
  isDefaultValue: false,
15147
- defaultValue: []
15223
+ defaultValue: [],
15224
+ bsTableCode: '' //设置table 列的标识
15148
15225
  };
15149
15226
  _this.patchUserColumnConfig = function (config) {
15227
+ var that = _assertThisInitialized(_this);
15150
15228
  var configvalue = config ? config.map(function (item) {
15151
15229
  return {
15152
15230
  key: item.key,
@@ -15160,7 +15238,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15160
15238
  url: '/user/appConfig/saveUserOrder',
15161
15239
  method: 'POST',
15162
15240
  data: {
15163
- code: window.location.hash,
15241
+ code: that.state.bsTableCode,
15164
15242
  detail: configvalue ? JSON.stringify(configvalue) : ''
15165
15243
  }
15166
15244
  }).then(function (res) {
@@ -15176,7 +15254,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15176
15254
  var config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
15177
15255
  var configArray = JSON.parse(config);
15178
15256
  var configSetting = configArray.filter(function (item) {
15179
- return item.code === window.location.hash;
15257
+ return item.code === _this.state.bsTableCode;
15180
15258
  });
15181
15259
  if (configSetting.length && configSetting[0].detail) {
15182
15260
  return JSON.parse(configSetting[0].detail);
@@ -15185,17 +15263,19 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15185
15263
  };
15186
15264
  _this.patchConfigToLocalstorage = function (configvalue) {
15187
15265
  var setShowColumns = _this.props.setShowColumns;
15188
- var sortDataSource = _this.state.sortDataSource;
15266
+ var _this$state = _this.state,
15267
+ sortDataSource = _this$state.sortDataSource,
15268
+ bsTableCode = _this$state.bsTableCode;
15189
15269
  var config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
15190
15270
  var configArray = JSON.parse(config);
15191
15271
  var currentSetting = configArray.filter(function (item) {
15192
- return item.code === window.location.hash;
15272
+ return item.code === bsTableCode;
15193
15273
  });
15194
15274
  if (currentSetting.length) {
15195
15275
  currentSetting[0].detail = JSON.stringify(configvalue);
15196
15276
  } else {
15197
15277
  configArray.push({
15198
- "code": window.location.hash,
15278
+ "code": bsTableCode,
15199
15279
  "detail": JSON.stringify(configvalue)
15200
15280
  });
15201
15281
  }
@@ -15426,10 +15506,10 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15426
15506
  _this.setInitValue();
15427
15507
  };
15428
15508
  _this.handleOk = function (e) {
15429
- var _this$state = _this.state,
15430
- sortDataSource = _this$state.sortDataSource,
15431
- isDefaultValue = _this$state.isDefaultValue,
15432
- defaultValue = _this$state.defaultValue;
15509
+ var _this$state2 = _this.state,
15510
+ sortDataSource = _this$state2.sortDataSource,
15511
+ isDefaultValue = _this$state2.isDefaultValue,
15512
+ defaultValue = _this$state2.defaultValue;
15433
15513
  if (!sortDataSource.length) {
15434
15514
  message.warning('至少选择一列!');
15435
15515
  return;
@@ -15447,9 +15527,9 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15447
15527
  });
15448
15528
  };
15449
15529
  _this.handleTableHeadHidden = function (title) {
15450
- var _this$state2 = _this.state,
15451
- sortDataSource = _this$state2.sortDataSource,
15452
- dataSource = _this$state2.dataSource;
15530
+ var _this$state3 = _this.state,
15531
+ sortDataSource = _this$state3.sortDataSource,
15532
+ dataSource = _this$state3.dataSource;
15453
15533
  _this.setState({
15454
15534
  sortDataSource: sortDataSource.filter(function (item) {
15455
15535
  return item.title !== title;
@@ -15508,9 +15588,9 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15508
15588
  }, restProps));
15509
15589
  };
15510
15590
  _this.onChange = function (e, title) {
15511
- var _this$state3 = _this.state,
15512
- sortDataSource = _this$state3.sortDataSource,
15513
- dataSource = _this$state3.dataSource;
15591
+ var _this$state4 = _this.state,
15592
+ sortDataSource = _this$state4.sortDataSource,
15593
+ dataSource = _this$state4.dataSource;
15514
15594
  if (!e.target.checked) {
15515
15595
  _this.setState({
15516
15596
  sortDataSource: sortDataSource.filter(function (item) {
@@ -15580,7 +15660,8 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15580
15660
  value: function componentDidMount() {
15581
15661
  var _this$props2 = this.props,
15582
15662
  datasource = _this$props2.datasource,
15583
- showColumn = _this$props2.showColumn;
15663
+ showColumn = _this$props2.showColumn,
15664
+ bsTableCode = _this$props2.bsTableCode;
15584
15665
  var config = this.getConfigFromlocalstorage();
15585
15666
  this.setState({
15586
15667
  dataSource: datasource.map(function (item) {
@@ -15621,19 +15702,20 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15621
15702
  return innerKey && innerKey === itemKey;
15622
15703
  })[0]) === null || _showColumn$filter$ === void 0 ? void 0 : _showColumn$filter$.width) || item.width
15623
15704
  });
15624
- })
15705
+ }),
15706
+ bsTableCode: bsTableCode
15625
15707
  });
15626
15708
  }
15627
15709
  }, {
15628
15710
  key: "render",
15629
15711
  value: function render() {
15630
15712
  var _this2 = this;
15631
- var _this$state4 = this.state,
15632
- dataSource = _this$state4.dataSource,
15633
- searchDataSource = _this$state4.searchDataSource,
15634
- sortDataSource = _this$state4.sortDataSource,
15635
- visible = _this$state4.visible,
15636
- onSearchSort = _this$state4.onSearchSort;
15713
+ var _this$state5 = this.state,
15714
+ dataSource = _this$state5.dataSource,
15715
+ searchDataSource = _this$state5.searchDataSource,
15716
+ sortDataSource = _this$state5.sortDataSource,
15717
+ visible = _this$state5.visible,
15718
+ onSearchSort = _this$state5.onSearchSort;
15637
15719
  var seatchDataSource = dataSource.filter(function (item) {
15638
15720
  var _item$title;
15639
15721
  return (item === null || item === void 0 ? void 0 : (_item$title = item.title) === null || _item$title === void 0 ? void 0 : _item$title.indexOf(searchDataSource || '')) > -1;
@@ -15849,12 +15931,14 @@ var index$5 = (function (props) {
15849
15931
  showColumn = _useState12[0],
15850
15932
  setShowColumns = _useState12[1];
15851
15933
  var _props$isPage = props.isPage,
15852
- pagination = props.pagination;
15934
+ pagination = props.pagination,
15935
+ tableCode = props.tableCode;
15853
15936
  var _useState13 = useState('100vh'),
15854
15937
  _useState14 = _slicedToArray(_useState13, 2),
15855
15938
  height = _useState14[0],
15856
15939
  setHeight = _useState14[1];
15857
15940
  var sortTableRef = useRef(null);
15941
+ var bsTableCode = tableCode || window.location.hash; //设置列字段的唯一标识
15858
15942
  // 获取table高度
15859
15943
  var getTableHeight = function getTableHeight() {
15860
15944
  var _document$querySelect, _document$querySelect2, _document$querySelect3;
@@ -15876,7 +15960,7 @@ var index$5 = (function (props) {
15876
15960
  var config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
15877
15961
  var configArray = JSON.parse(config);
15878
15962
  var configSetting = configArray.filter(function (item) {
15879
- return item.code === window.location.hash;
15963
+ return item.code === bsTableCode;
15880
15964
  });
15881
15965
  if (configSetting.length && configSetting[0].detail) {
15882
15966
  return JSON.parse(configSetting[0].detail);
@@ -16139,7 +16223,8 @@ var index$5 = (function (props) {
16139
16223
  ref: sortTableRef,
16140
16224
  setShowColumns: setShowColumns,
16141
16225
  showColumn: showColumn,
16142
- datasource: (value === null || value === void 0 ? void 0 : value.columns) || []
16226
+ datasource: (value === null || value === void 0 ? void 0 : value.columns) || [],
16227
+ bsTableCode: bsTableCode
16143
16228
  }))))
16144
16229
  }
16145
16230
  }, {
package/dist/index.js CHANGED
@@ -10807,6 +10807,7 @@ var handleDefaultPrefixUrl = function handleDefaultPrefixUrl(type) {
10807
10807
  result = '/user';
10808
10808
  break;
10809
10809
  case 'deliveryMode':
10810
+ case 'ruleTemplate':
10810
10811
  result = '/basic';
10811
10812
  break;
10812
10813
  default:
@@ -12420,6 +12421,60 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
12420
12421
  }]
12421
12422
  }, modalTableBusProps);
12422
12423
  }
12424
+ // 规则场景选择器
12425
+ if (type === 'ruleTemplate') {
12426
+ requestConfig = _objectSpread2({
12427
+ url: "".concat(prefixUrl.selectPrefix, "/ruleTemplate"),
12428
+ // filter: 'qp-name,code-orGroup,like', // 过滤参数
12429
+ filter: 'qp-name-like',
12430
+ mappingTextField: 'name',
12431
+ mappingTextShowKeyField: 'code',
12432
+ mappingValueField: 'code',
12433
+ otherParams: {
12434
+ sorter: 'desc-id'
12435
+ },
12436
+ sourceName: 'ruleTemplateCode'
12437
+ }, requestConfigProp);
12438
+ tableSearchForm = [{
12439
+ name: 'qp-name-like',
12440
+ label: '规则场景名称'
12441
+ }, {
12442
+ name: 'qp-code-like',
12443
+ label: '规则场景编码'
12444
+ }];
12445
+ modalTableProps = _objectSpread2({
12446
+ modalTableTitle: '选择规则场景',
12447
+ tableSearchForm: tableSearchForm,
12448
+ tableColumns: [{
12449
+ title: '规则场景编码',
12450
+ dataIndex: 'code'
12451
+ }, {
12452
+ title: '规则场景名称',
12453
+ dataIndex: 'name',
12454
+ render: function render(text) {
12455
+ return handleTextOverflow(text);
12456
+ }
12457
+ }, {
12458
+ title: '条件对象',
12459
+ dataIndex: 'objectName',
12460
+ render: function render(text) {
12461
+ return handleTextOverflow(text);
12462
+ }
12463
+ }, {
12464
+ dataIndex: 'extName',
12465
+ title: '条件扩展',
12466
+ render: function render(text) {
12467
+ return handleTextOverflow(text);
12468
+ }
12469
+ }, {
12470
+ dataIndex: 'actionName',
12471
+ title: '执行动作',
12472
+ render: function render(text) {
12473
+ return handleTextOverflow(text);
12474
+ }
12475
+ }]
12476
+ }, modalTableBusProps);
12477
+ }
12423
12478
  return {
12424
12479
  modalTableProps: modalTableProps,
12425
12480
  requestConfig: requestConfig,
@@ -12470,6 +12525,25 @@ var BusinessSearchSelect$1 = /*#__PURE__*/React__default['default'].memo(Busines
12470
12525
  return true;
12471
12526
  });
12472
12527
 
12528
+ function handleSelectColumn(c, parentProps) {
12529
+ var result = c;
12530
+ var exceptColumns = (parentProps === null || parentProps === void 0 ? void 0 : parentProps.exceptColumns) || [];
12531
+ var coverColumns = (parentProps === null || parentProps === void 0 ? void 0 : parentProps.coverColumns) || [];
12532
+ var additionColumns = (parentProps === null || parentProps === void 0 ? void 0 : parentProps.additionColumns) || [];
12533
+ // 过滤不需要展示内容
12534
+ if (exceptColumns === null || exceptColumns === void 0 ? void 0 : exceptColumns.length) {
12535
+ result = result.filter(function (i) {
12536
+ return !exceptColumns.includes(i.dataIndex);
12537
+ });
12538
+ }
12539
+ // 追加
12540
+ if (additionColumns === null || additionColumns === void 0 ? void 0 : additionColumns.length) ;
12541
+ // 覆盖内容
12542
+ if (coverColumns === null || coverColumns === void 0 ? void 0 : coverColumns.length) {
12543
+ result = coverColumns;
12544
+ }
12545
+ return result;
12546
+ }
12473
12547
  var AddSkuSelect = function AddSkuSelect(parProps) {
12474
12548
  var selectProps = {
12475
12549
  mode: 'multiple'
@@ -12478,6 +12552,88 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
12478
12552
  _useState2 = _slicedToArray(_useState, 2),
12479
12553
  value = _useState2[0],
12480
12554
  setValue = _useState2[1];
12555
+ var initialSelectColumn = [{
12556
+ title: 'SKU编码',
12557
+ width: 150,
12558
+ dataIndex: 'skuCode'
12559
+ }, {
12560
+ title: 'SKU名称',
12561
+ width: 200,
12562
+ ellipsis: {
12563
+ showTitle: false
12564
+ },
12565
+ render: function render(text) {
12566
+ return /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
12567
+ placement: "topLeft",
12568
+ title: text
12569
+ }, text);
12570
+ },
12571
+ dataIndex: 'name'
12572
+ }, {
12573
+ title: '图片',
12574
+ dataIndex: 'itemUrl',
12575
+ width: 200,
12576
+ ellipsis: {
12577
+ showTitle: false
12578
+ },
12579
+ render: function render(text, record) {
12580
+ return /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
12581
+ placement: "topLeft",
12582
+ title: text
12583
+ }, tableColumnsImage(getSkuImg(record), {
12584
+ width: 28,
12585
+ height: 28
12586
+ }));
12587
+ }
12588
+ }, {
12589
+ title: '数量',
12590
+ width: 100,
12591
+ isInputItem: true,
12592
+ dataIndex: 'count'
12593
+ }, {
12594
+ title: '单位',
12595
+ dataIndex: 'selectUnitCode',
12596
+ width: 80,
12597
+ ellipsis: {
12598
+ showTitle: false
12599
+ },
12600
+ render: function render(text, record) {
12601
+ var _record$packingUnitLi;
12602
+ if (record === null || record === void 0 ? void 0 : (_record$packingUnitLi = record.packingUnitList) === null || _record$packingUnitLi === void 0 ? void 0 : _record$packingUnitLi.length) {
12603
+ var basePackUnit = record === null || record === void 0 ? void 0 : record.packingUnitList[0];
12604
+ record.selectUnitCode = basePackUnit.unitCode;
12605
+ return basePackUnit.name || basePackUnit.unitCode;
12606
+ }
12607
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
12608
+ }
12609
+ }, {
12610
+ title: '所属SPU编码',
12611
+ width: 150,
12612
+ ellipsis: {
12613
+ showTitle: false
12614
+ },
12615
+ dataIndex: 'itemCode',
12616
+ render: function render(text) {
12617
+ return /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
12618
+ placement: "topLeft",
12619
+ title: text
12620
+ }, text);
12621
+ }
12622
+ }, {
12623
+ title: '规格',
12624
+ width: 200,
12625
+ ellipsis: {
12626
+ showTitle: false
12627
+ },
12628
+ render: function render(text) {
12629
+ return /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
12630
+ placement: "topLeft",
12631
+ title: text
12632
+ }, text);
12633
+ },
12634
+ dataIndex: 'propertyNameAndValue'
12635
+ }];
12636
+ var mTpSelectColumn = handleSelectColumn(initialSelectColumn, parProps);
12481
12637
  var props = {
12482
12638
  buttonText: parProps.buttonText || '新增',
12483
12639
  buttonProps: parProps.buttonProps || {},
@@ -12700,87 +12856,7 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
12700
12856
  },
12701
12857
  dataIndex: 'brandName'
12702
12858
  }],
12703
- selectColumn: [{
12704
- title: 'SKU编码',
12705
- width: 150,
12706
- dataIndex: 'skuCode'
12707
- }, {
12708
- title: 'SKU名称',
12709
- width: 200,
12710
- ellipsis: {
12711
- showTitle: false
12712
- },
12713
- render: function render(text) {
12714
- return /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
12715
- placement: "topLeft",
12716
- title: text
12717
- }, text);
12718
- },
12719
- dataIndex: 'name'
12720
- }, {
12721
- title: '图片',
12722
- dataIndex: 'itemUrl',
12723
- width: 200,
12724
- ellipsis: {
12725
- showTitle: false
12726
- },
12727
- render: function render(text, record) {
12728
- return /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
12729
- placement: "topLeft",
12730
- title: text
12731
- }, tableColumnsImage(getSkuImg(record), {
12732
- width: 28,
12733
- height: 28
12734
- }));
12735
- }
12736
- }, {
12737
- title: '数量',
12738
- width: 100,
12739
- isInputItem: true,
12740
- dataIndex: 'count'
12741
- }, {
12742
- title: '单位',
12743
- dataIndex: 'selectUnitCode',
12744
- width: 80,
12745
- ellipsis: {
12746
- showTitle: false
12747
- },
12748
- render: function render(text, record) {
12749
- var _record$packingUnitLi;
12750
- if (record === null || record === void 0 ? void 0 : (_record$packingUnitLi = record.packingUnitList) === null || _record$packingUnitLi === void 0 ? void 0 : _record$packingUnitLi.length) {
12751
- var basePackUnit = record === null || record === void 0 ? void 0 : record.packingUnitList[0];
12752
- record.selectUnitCode = basePackUnit.unitCode;
12753
- return basePackUnit.name || basePackUnit.unitCode;
12754
- }
12755
- return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null);
12756
- }
12757
- }, {
12758
- title: '所属SPU编码',
12759
- width: 150,
12760
- ellipsis: {
12761
- showTitle: false
12762
- },
12763
- dataIndex: 'itemCode',
12764
- render: function render(text) {
12765
- return /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
12766
- placement: "topLeft",
12767
- title: text
12768
- }, text);
12769
- }
12770
- }, {
12771
- title: '规格',
12772
- width: 200,
12773
- ellipsis: {
12774
- showTitle: false
12775
- },
12776
- render: function render(text) {
12777
- return /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
12778
- placement: "topLeft",
12779
- title: text
12780
- }, text);
12781
- },
12782
- dataIndex: 'propertyNameAndValue'
12783
- }]
12859
+ selectColumn: mTpSelectColumn
12784
12860
  };
12785
12861
  return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(AddSelect, _objectSpread2(_objectSpread2({}, props), {}, {
12786
12862
  modalTableProps: modalTableProps
@@ -15158,9 +15234,11 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15158
15234
  searchDataSource: false,
15159
15235
  onSearchSort: false,
15160
15236
  isDefaultValue: false,
15161
- defaultValue: []
15237
+ defaultValue: [],
15238
+ bsTableCode: '' //设置table 列的标识
15162
15239
  };
15163
15240
  _this.patchUserColumnConfig = function (config) {
15241
+ var that = _assertThisInitialized(_this);
15164
15242
  var configvalue = config ? config.map(function (item) {
15165
15243
  return {
15166
15244
  key: item.key,
@@ -15174,7 +15252,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15174
15252
  url: '/user/appConfig/saveUserOrder',
15175
15253
  method: 'POST',
15176
15254
  data: {
15177
- code: window.location.hash,
15255
+ code: that.state.bsTableCode,
15178
15256
  detail: configvalue ? JSON.stringify(configvalue) : ''
15179
15257
  }
15180
15258
  }).then(function (res) {
@@ -15190,7 +15268,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15190
15268
  var config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
15191
15269
  var configArray = JSON.parse(config);
15192
15270
  var configSetting = configArray.filter(function (item) {
15193
- return item.code === window.location.hash;
15271
+ return item.code === _this.state.bsTableCode;
15194
15272
  });
15195
15273
  if (configSetting.length && configSetting[0].detail) {
15196
15274
  return JSON.parse(configSetting[0].detail);
@@ -15199,17 +15277,19 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15199
15277
  };
15200
15278
  _this.patchConfigToLocalstorage = function (configvalue) {
15201
15279
  var setShowColumns = _this.props.setShowColumns;
15202
- var sortDataSource = _this.state.sortDataSource;
15280
+ var _this$state = _this.state,
15281
+ sortDataSource = _this$state.sortDataSource,
15282
+ bsTableCode = _this$state.bsTableCode;
15203
15283
  var config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
15204
15284
  var configArray = JSON.parse(config);
15205
15285
  var currentSetting = configArray.filter(function (item) {
15206
- return item.code === window.location.hash;
15286
+ return item.code === bsTableCode;
15207
15287
  });
15208
15288
  if (currentSetting.length) {
15209
15289
  currentSetting[0].detail = JSON.stringify(configvalue);
15210
15290
  } else {
15211
15291
  configArray.push({
15212
- "code": window.location.hash,
15292
+ "code": bsTableCode,
15213
15293
  "detail": JSON.stringify(configvalue)
15214
15294
  });
15215
15295
  }
@@ -15440,10 +15520,10 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15440
15520
  _this.setInitValue();
15441
15521
  };
15442
15522
  _this.handleOk = function (e) {
15443
- var _this$state = _this.state,
15444
- sortDataSource = _this$state.sortDataSource,
15445
- isDefaultValue = _this$state.isDefaultValue,
15446
- defaultValue = _this$state.defaultValue;
15523
+ var _this$state2 = _this.state,
15524
+ sortDataSource = _this$state2.sortDataSource,
15525
+ isDefaultValue = _this$state2.isDefaultValue,
15526
+ defaultValue = _this$state2.defaultValue;
15447
15527
  if (!sortDataSource.length) {
15448
15528
  antd.message.warning('至少选择一列!');
15449
15529
  return;
@@ -15461,9 +15541,9 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15461
15541
  });
15462
15542
  };
15463
15543
  _this.handleTableHeadHidden = function (title) {
15464
- var _this$state2 = _this.state,
15465
- sortDataSource = _this$state2.sortDataSource,
15466
- dataSource = _this$state2.dataSource;
15544
+ var _this$state3 = _this.state,
15545
+ sortDataSource = _this$state3.sortDataSource,
15546
+ dataSource = _this$state3.dataSource;
15467
15547
  _this.setState({
15468
15548
  sortDataSource: sortDataSource.filter(function (item) {
15469
15549
  return item.title !== title;
@@ -15522,9 +15602,9 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15522
15602
  }, restProps));
15523
15603
  };
15524
15604
  _this.onChange = function (e, title) {
15525
- var _this$state3 = _this.state,
15526
- sortDataSource = _this$state3.sortDataSource,
15527
- dataSource = _this$state3.dataSource;
15605
+ var _this$state4 = _this.state,
15606
+ sortDataSource = _this$state4.sortDataSource,
15607
+ dataSource = _this$state4.dataSource;
15528
15608
  if (!e.target.checked) {
15529
15609
  _this.setState({
15530
15610
  sortDataSource: sortDataSource.filter(function (item) {
@@ -15594,7 +15674,8 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15594
15674
  value: function componentDidMount() {
15595
15675
  var _this$props2 = this.props,
15596
15676
  datasource = _this$props2.datasource,
15597
- showColumn = _this$props2.showColumn;
15677
+ showColumn = _this$props2.showColumn,
15678
+ bsTableCode = _this$props2.bsTableCode;
15598
15679
  var config = this.getConfigFromlocalstorage();
15599
15680
  this.setState({
15600
15681
  dataSource: datasource.map(function (item) {
@@ -15635,19 +15716,20 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
15635
15716
  return innerKey && innerKey === itemKey;
15636
15717
  })[0]) === null || _showColumn$filter$ === void 0 ? void 0 : _showColumn$filter$.width) || item.width
15637
15718
  });
15638
- })
15719
+ }),
15720
+ bsTableCode: bsTableCode
15639
15721
  });
15640
15722
  }
15641
15723
  }, {
15642
15724
  key: "render",
15643
15725
  value: function render() {
15644
15726
  var _this2 = this;
15645
- var _this$state4 = this.state,
15646
- dataSource = _this$state4.dataSource,
15647
- searchDataSource = _this$state4.searchDataSource,
15648
- sortDataSource = _this$state4.sortDataSource,
15649
- visible = _this$state4.visible,
15650
- onSearchSort = _this$state4.onSearchSort;
15727
+ var _this$state5 = this.state,
15728
+ dataSource = _this$state5.dataSource,
15729
+ searchDataSource = _this$state5.searchDataSource,
15730
+ sortDataSource = _this$state5.sortDataSource,
15731
+ visible = _this$state5.visible,
15732
+ onSearchSort = _this$state5.onSearchSort;
15651
15733
  var seatchDataSource = dataSource.filter(function (item) {
15652
15734
  var _item$title;
15653
15735
  return (item === null || item === void 0 ? void 0 : (_item$title = item.title) === null || _item$title === void 0 ? void 0 : _item$title.indexOf(searchDataSource || '')) > -1;
@@ -15863,12 +15945,14 @@ var index$5 = (function (props) {
15863
15945
  showColumn = _useState12[0],
15864
15946
  setShowColumns = _useState12[1];
15865
15947
  var _props$isPage = props.isPage,
15866
- pagination = props.pagination;
15948
+ pagination = props.pagination,
15949
+ tableCode = props.tableCode;
15867
15950
  var _useState13 = React.useState('100vh'),
15868
15951
  _useState14 = _slicedToArray(_useState13, 2),
15869
15952
  height = _useState14[0],
15870
15953
  setHeight = _useState14[1];
15871
15954
  var sortTableRef = React.useRef(null);
15955
+ var bsTableCode = tableCode || window.location.hash; //设置列字段的唯一标识
15872
15956
  // 获取table高度
15873
15957
  var getTableHeight = function getTableHeight() {
15874
15958
  var _document$querySelect, _document$querySelect2, _document$querySelect3;
@@ -15890,7 +15974,7 @@ var index$5 = (function (props) {
15890
15974
  var config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
15891
15975
  var configArray = JSON.parse(config);
15892
15976
  var configSetting = configArray.filter(function (item) {
15893
- return item.code === window.location.hash;
15977
+ return item.code === bsTableCode;
15894
15978
  });
15895
15979
  if (configSetting.length && configSetting[0].detail) {
15896
15980
  return JSON.parse(configSetting[0].detail);
@@ -16153,7 +16237,8 @@ var index$5 = (function (props) {
16153
16237
  ref: sortTableRef,
16154
16238
  setShowColumns: setShowColumns,
16155
16239
  showColumn: showColumn,
16156
- datasource: (value === null || value === void 0 ? void 0 : value.columns) || []
16240
+ datasource: (value === null || value === void 0 ? void 0 : value.columns) || [],
16241
+ bsTableCode: bsTableCode
16157
16242
  }))))
16158
16243
  }
16159
16244
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.1.17",
3
+ "version": "2.1.19",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -11,11 +11,115 @@ import { AddSelect } from '../../../index';
11
11
  import { tableColumnsImage } from '@/components/Business/BsSulaQueryTable/utils';
12
12
  import { getSkuImg } from '@/utils/TableUtils';
13
13
 
14
+ function handleSelectColumn(c: any, parentProps: any) {
15
+ let result = c;
16
+ const exceptColumns = parentProps?.exceptColumns || [];
17
+ const coverColumns = parentProps?.coverColumns || [];
18
+ const additionColumns = parentProps?.additionColumns || [];
19
+ // 过滤不需要展示内容
20
+ if(exceptColumns?.length) {
21
+ result = result.filter((i: any) => !exceptColumns.includes(i.dataIndex))
22
+ }
23
+ // 追加
24
+ if(additionColumns?.length) {
25
+ //TODO
26
+ }
27
+ // 覆盖内容
28
+ if(coverColumns?.length) {
29
+ result = coverColumns;
30
+ }
31
+ return result
32
+ }
33
+
14
34
  export const AddSkuSelect = (parProps: any) => {
15
35
  const selectProps = {
16
36
  mode: 'multiple',
17
37
  }
18
38
  const [value, setValue] = useState(selectProps?.mode ? [] : null);
39
+ const initialSelectColumn = [
40
+ {
41
+ title: 'SKU编码',
42
+ width: 150,
43
+ dataIndex: 'skuCode',
44
+ },
45
+ {
46
+ title: 'SKU名称',
47
+ width: 200,
48
+ ellipsis: {
49
+ showTitle: false,
50
+ },
51
+ render: (text: any) => (
52
+ <Tooltip placement="topLeft" title={text}>
53
+ {text}
54
+ </Tooltip>
55
+ ),
56
+ dataIndex: 'name',
57
+ },
58
+ {
59
+ title: '图片',
60
+ dataIndex: 'itemUrl',
61
+ width: 200,
62
+ ellipsis: {
63
+ showTitle: false,
64
+ },
65
+ render: (text: any,record: any) => (
66
+ <Tooltip placement="topLeft" title={text}>
67
+ {tableColumnsImage(getSkuImg(record),{ width: 28, height: 28 })}
68
+ </Tooltip>
69
+ ),
70
+ },
71
+ {
72
+ title: '数量',
73
+ width: 100,
74
+ isInputItem: true,
75
+ dataIndex: 'count',
76
+ },
77
+ {
78
+ title: '单位',
79
+ dataIndex: 'selectUnitCode',
80
+ width: 80,
81
+ ellipsis: {
82
+ showTitle: false,
83
+ },
84
+ render: (text: any, record: any) => {
85
+ if (record?.packingUnitList?.length) {
86
+ const basePackUnit = record?.packingUnitList[0]
87
+ record.selectUnitCode = basePackUnit.unitCode
88
+ return basePackUnit.name || basePackUnit.unitCode
89
+ }
90
+
91
+
92
+ return <></>
93
+ },
94
+ },
95
+ {
96
+ title: '所属SPU编码',
97
+ width: 150,
98
+ ellipsis: {
99
+ showTitle: false,
100
+ },
101
+ dataIndex: 'itemCode',
102
+ render: (text: any) => (
103
+ <Tooltip placement="topLeft" title={text}>
104
+ {text}
105
+ </Tooltip>
106
+ ),
107
+ },
108
+ {
109
+ title: '规格',
110
+ width: 200,
111
+ ellipsis: {
112
+ showTitle: false,
113
+ },
114
+ render: (text: any) => (
115
+ <Tooltip placement="topLeft" title={text}>
116
+ {text}
117
+ </Tooltip>
118
+ ),
119
+ dataIndex: 'propertyNameAndValue',
120
+ }
121
+ ]
122
+ const mTpSelectColumn = handleSelectColumn(initialSelectColumn, parProps)
19
123
  const props = {
20
124
  buttonText: parProps.buttonText || '新增',
21
125
  buttonProps: parProps.buttonProps || {},
@@ -223,89 +327,7 @@ export const AddSkuSelect = (parProps: any) => {
223
327
  dataIndex: 'brandName',
224
328
  },
225
329
  ],
226
- selectColumn: [
227
- {
228
- title: 'SKU编码',
229
- width: 150,
230
- dataIndex: 'skuCode',
231
- },
232
- {
233
- title: 'SKU名称',
234
- width: 200,
235
- ellipsis: {
236
- showTitle: false,
237
- },
238
- render: (text: any) => (
239
- <Tooltip placement="topLeft" title={text}>
240
- {text}
241
- </Tooltip>
242
- ),
243
- dataIndex: 'name',
244
- },
245
- {
246
- title: '图片',
247
- dataIndex: 'itemUrl',
248
- width: 200,
249
- ellipsis: {
250
- showTitle: false,
251
- },
252
- render: (text: any,record: any) => (
253
- <Tooltip placement="topLeft" title={text}>
254
- {tableColumnsImage(getSkuImg(record),{ width: 28, height: 28 })}
255
- </Tooltip>
256
- ),
257
- },
258
- {
259
- title: '数量',
260
- width: 100,
261
- isInputItem: true,
262
- dataIndex: 'count',
263
- },
264
- {
265
- title: '单位',
266
- dataIndex: 'selectUnitCode',
267
- width: 80,
268
- ellipsis: {
269
- showTitle: false,
270
- },
271
- render: (text: any, record: any) => {
272
- if (record?.packingUnitList?.length) {
273
- const basePackUnit = record?.packingUnitList[0]
274
- record.selectUnitCode = basePackUnit.unitCode
275
- return basePackUnit.name || basePackUnit.unitCode
276
- }
277
-
278
-
279
- return <></>
280
- },
281
- },
282
- {
283
- title: '所属SPU编码',
284
- width: 150,
285
- ellipsis: {
286
- showTitle: false,
287
- },
288
- dataIndex: 'itemCode',
289
- render: (text: any) => (
290
- <Tooltip placement="topLeft" title={text}>
291
- {text}
292
- </Tooltip>
293
- ),
294
- },
295
- {
296
- title: '规格',
297
- width: 200,
298
- ellipsis: {
299
- showTitle: false,
300
- },
301
- render: (text: any) => (
302
- <Tooltip placement="topLeft" title={text}>
303
- {text}
304
- </Tooltip>
305
- ),
306
- dataIndex: 'propertyNameAndValue',
307
- }
308
- ]
330
+ selectColumn: mTpSelectColumn
309
331
  }
310
332
 
311
333
  return (
@@ -59,11 +59,12 @@ export default (props: any) => {
59
59
  const [value, setValue]: any = useState(props);
60
60
  const [showColumn, setShowColumns] = useState([]);
61
61
 
62
- const { isPage = true, pagination } = props;
62
+ const { isPage = true, pagination, tableCode } = props;
63
63
 
64
64
  const [height, setHeight]: any = useState('100vh');
65
65
  const sortTableRef = useRef(null);
66
-
66
+
67
+ const bsTableCode = tableCode || window.location.hash; //设置列字段的唯一标识
67
68
  // 获取table高度
68
69
  const getTableHeight = () => {
69
70
  const cancelHeight = window.top == window ? 303 : 223;
@@ -101,7 +102,7 @@ export default (props: any) => {
101
102
  let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
102
103
  let configArray = JSON.parse(config);
103
104
  let configSetting = configArray.filter(
104
- (item) => item.code === window.location.hash,
105
+ (item) => item.code === bsTableCode,
105
106
  );
106
107
 
107
108
  if (configSetting.length && configSetting[0].detail) {
@@ -371,6 +372,7 @@ export default (props: any) => {
371
372
  setShowColumns={setShowColumns}
372
373
  showColumn={showColumn}
373
374
  datasource={value?.columns || []}
375
+ bsTableCode={bsTableCode}
374
376
  />
375
377
  </span>
376
378
  </Tooltip>
@@ -42,9 +42,11 @@ class SortableTable extends React.Component {
42
42
  onSearchSort: false,
43
43
  isDefaultValue: false,
44
44
  defaultValue: [],
45
+ bsTableCode: '', //设置table 列的标识
45
46
  };
46
47
 
47
48
  patchUserColumnConfig = (config) => {
49
+ let that = this;
48
50
  let configvalue = config
49
51
  ? config.map((item) => ({
50
52
  key: item.key,
@@ -58,7 +60,7 @@ class SortableTable extends React.Component {
58
60
  url: '/user/appConfig/saveUserOrder',
59
61
  method: 'POST',
60
62
  data: {
61
- code: window.location.hash,
63
+ code: that.state.bsTableCode,
62
64
  detail: configvalue ? JSON.stringify(configvalue) : '',
63
65
  },
64
66
  }).then((res:any) => {
@@ -74,7 +76,7 @@ class SortableTable extends React.Component {
74
76
  let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
75
77
  let configArray = JSON.parse(config);
76
78
  let configSetting = configArray.filter(
77
- (item) => item.code === window.location.hash,
79
+ (item) => item.code === this.state.bsTableCode,
78
80
  );
79
81
 
80
82
  if (configSetting.length && configSetting[0].detail) {
@@ -85,15 +87,15 @@ class SortableTable extends React.Component {
85
87
 
86
88
  patchConfigToLocalstorage = (configvalue) => {
87
89
  const { setShowColumns } = this.props;
88
- const { sortDataSource } = this.state;
90
+ const { sortDataSource, bsTableCode } = this.state;
89
91
  let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]'
90
92
  let configArray = JSON.parse(config)
91
- let currentSetting = configArray.filter(item => item.code === window.location.hash)
93
+ let currentSetting = configArray.filter(item => item.code === bsTableCode)
92
94
  if (currentSetting.length) {
93
95
  currentSetting[0].detail = JSON.stringify(configvalue)
94
96
  } else {
95
97
  configArray.push({
96
- "code": window.location.hash,
98
+ "code": bsTableCode,
97
99
  "detail": JSON.stringify(configvalue)
98
100
  })
99
101
  }
@@ -147,7 +149,7 @@ class SortableTable extends React.Component {
147
149
  };
148
150
 
149
151
  componentDidMount() {
150
- const { datasource, showColumn }: any =
152
+ const { datasource, showColumn, bsTableCode }: any =
151
153
  this.props;
152
154
  let config = this.getConfigFromlocalstorage();
153
155
 
@@ -196,6 +198,7 @@ class SortableTable extends React.Component {
196
198
  }
197
199
  )[0]?.width || item.width,
198
200
  })),
201
+ bsTableCode
199
202
  });
200
203
  }
201
204
 
@@ -1474,5 +1474,57 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
1474
1474
  }
1475
1475
  }
1476
1476
 
1477
+ // 规则场景选择器
1478
+ if(type === 'ruleTemplate') {
1479
+ requestConfig = {
1480
+ url: `${prefixUrl.selectPrefix}/ruleTemplate`,
1481
+ // filter: 'qp-name,code-orGroup,like', // 过滤参数
1482
+ filter: 'qp-name-like', // 过滤参数
1483
+ mappingTextField: 'name',
1484
+ mappingTextShowKeyField: 'code',
1485
+ mappingValueField: 'code',
1486
+ otherParams: {
1487
+ sorter: 'desc-id'
1488
+ }, // 默认参数
1489
+ sourceName: 'ruleTemplateCode',
1490
+ ...requestConfigProp
1491
+ }
1492
+ tableSearchForm = [
1493
+ { name: 'qp-name-like', label: '规则场景名称' },
1494
+ { name: 'qp-code-like', label: '规则场景编码' },
1495
+ ]
1496
+ modalTableProps = {
1497
+ modalTableTitle: '选择规则场景',
1498
+ tableSearchForm,
1499
+ tableColumns: [
1500
+ {
1501
+ title: '规则场景编码',
1502
+ dataIndex: 'code',
1503
+ },
1504
+ {
1505
+ title: '规则场景名称',
1506
+ dataIndex: 'name',
1507
+ render: (text: any) => handleTextOverflow(text),
1508
+ },
1509
+ {
1510
+ title: '条件对象',
1511
+ dataIndex: 'objectName',
1512
+ render: (text: any) => handleTextOverflow(text),
1513
+ },
1514
+ {
1515
+ dataIndex: 'extName',
1516
+ title: '条件扩展',
1517
+ render: (text: any) => handleTextOverflow(text),
1518
+ },
1519
+ {
1520
+ dataIndex: 'actionName',
1521
+ title: '执行动作',
1522
+ render: (text: any) => handleTextOverflow(text),
1523
+ },
1524
+ ],
1525
+ ...modalTableBusProps
1526
+ }
1527
+ }
1528
+
1477
1529
  return { modalTableProps, requestConfig, needModalTable };
1478
1530
  }
@@ -1135,3 +1135,63 @@ export default () => {
1135
1135
  ```
1136
1136
 
1137
1137
  More skills for writing demo: https://d.umijs.org/guide/demo-principle
1138
+
1139
+
1140
+ ## 规则场景选择器 Select-GZCJ-001
1141
+
1142
+ ```tsx
1143
+ import React, { useState } from 'react';
1144
+ import { Tabs } from 'antd';
1145
+ import {BusinessSearchSelect} from '../../../index.ts';
1146
+
1147
+ const { TabPane } = Tabs;
1148
+
1149
+ export default () => {
1150
+ const selectProps = {
1151
+ // mode: 'multiple',
1152
+ // maxTagCount: 1,
1153
+ // disabled: true
1154
+ }
1155
+ const selectPropsMultiple = {
1156
+ mode: 'multiple',
1157
+ maxTagCount: 1,
1158
+ }
1159
+
1160
+ const [ tabKey, setTabKey ] = useState('single')
1161
+ const [value, setValue] = useState(selectProps?.mode ? [] : null);
1162
+
1163
+ const props = {
1164
+ value,
1165
+ onChange: (value: any) => {
1166
+ console.log(value)
1167
+ setValue(value)
1168
+ },
1169
+ selectProps,
1170
+ selectBusinessType: 'ruleTemplate',
1171
+ };
1172
+
1173
+ const onTabChange = (key) => {
1174
+ setTabKey(key)
1175
+ setValue(key === 'single' ? null: [])
1176
+ }
1177
+
1178
+ return (
1179
+ <div>
1180
+ <Tabs onChange={onTabChange} activeKey={tabKey}>
1181
+ <TabPane tab='单选' key='single'>
1182
+ {tabKey === 'single' && (
1183
+ <BusinessSearchSelect {...props} />
1184
+ )}
1185
+ </TabPane>
1186
+ <TabPane tab='多选' key='multiple'>
1187
+ {tabKey === 'multiple' && (
1188
+ <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
1189
+ )}
1190
+ </TabPane>
1191
+ </Tabs>
1192
+ </div>
1193
+ );
1194
+ };
1195
+ ```
1196
+
1197
+ More skills for writing demo: https://d.umijs.org/guide/demo-principle
@@ -87,7 +87,7 @@ const handleDefaultPrefixUrl = (type: string) => {
87
87
  case 'inventoryOrg2': case 'purchaseOrg': case 'salesOrg': case 'employee2':
88
88
  result = '/user';
89
89
  break;
90
- case 'deliveryMode':
90
+ case 'deliveryMode': case 'ruleTemplate':
91
91
  result = '/basic';
92
92
  break;
93
93
  default:
@@ -53,6 +53,38 @@ export default () => {
53
53
  tableSearchForm: [
54
54
  { name: 'qp-name-like', label: 'SKU名称' }, // field: { type: 'input', props: { placeholder: '8888'}}
55
55
  { name: 'qp-code-like', label: 'SKU编码' },
56
+ { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
57
+ type: 'select',
58
+ props: {
59
+ mode: 'multiple',
60
+ notFoundContent: '暂无数据',
61
+ allowClear: true,
62
+ showSearch: true,
63
+ showArrow: true,
64
+ maxTagCount: 1,
65
+ optionFilterProp: 'children',
66
+ filterOption: (input: string, option: { props: { children: string } }) =>
67
+ option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
68
+ },
69
+ } },
70
+ { name: 'qp-categoryId-in', type: 'treeSelect', label: '类目', field: {
71
+ type: 'treeSelect',
72
+ props: {
73
+ treeData: [],
74
+ treeCheckable: true,
75
+ showSearch: true,
76
+ allowClear: true,
77
+ showArrow: true,
78
+ treeNodeFilterProp: 'title',
79
+ treeDefaultExpandAll: true,
80
+ maxTagCount: 1,
81
+ placeholder: '请选择',
82
+ style: {
83
+ width: '100%',
84
+ },
85
+ dropdownStyle: { maxHeight: 400, maxWidth: 100, overflow: 'auto' }
86
+ },
87
+ } }
56
88
  ],
57
89
  tableColumns: [
58
90
  {