@bit-sun/business-component 1.1.28 → 1.1.29

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
@@ -294,10 +294,9 @@ function ownKeys$1(object, enumerableOnly) {
294
294
 
295
295
  if (Object.getOwnPropertySymbols) {
296
296
  var symbols = Object.getOwnPropertySymbols(object);
297
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
297
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
298
298
  return Object.getOwnPropertyDescriptor(object, sym).enumerable;
299
- });
300
- keys.push.apply(keys, symbols);
299
+ })), keys.push.apply(keys, symbols);
301
300
  }
302
301
 
303
302
  return keys;
@@ -305,19 +304,12 @@ function ownKeys$1(object, enumerableOnly) {
305
304
 
306
305
  function _objectSpread2$1(target) {
307
306
  for (var i = 1; i < arguments.length; i++) {
308
- var source = arguments[i] != null ? arguments[i] : {};
309
-
310
- if (i % 2) {
311
- ownKeys$1(Object(source), true).forEach(function (key) {
312
- _defineProperty$1(target, key, source[key]);
313
- });
314
- } else if (Object.getOwnPropertyDescriptors) {
315
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
316
- } else {
317
- ownKeys$1(Object(source)).forEach(function (key) {
318
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
319
- });
320
- }
307
+ var source = null != arguments[i] ? arguments[i] : {};
308
+ i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
309
+ _defineProperty$1(target, key, source[key]);
310
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
311
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
312
+ });
321
313
  }
322
314
 
323
315
  return target;
@@ -328,14 +320,17 @@ function _arrayWithHoles$1(arr) {
328
320
  }
329
321
 
330
322
  function _iterableToArrayLimit$1(arr, i) {
331
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
323
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
324
+
325
+ if (_i == null) return;
332
326
  var _arr = [];
333
327
  var _n = true;
334
328
  var _d = false;
335
- var _e = undefined;
329
+
330
+ var _s, _e;
336
331
 
337
332
  try {
338
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
333
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
339
334
  _arr.push(_s.value);
340
335
 
341
336
  if (i && _arr.length === i) break;
@@ -418,17 +413,11 @@ function _objectWithoutProperties$1(source, excluded) {
418
413
  function _typeof(obj) {
419
414
  "@babel/helpers - typeof";
420
415
 
421
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
422
- _typeof = function _typeof(obj) {
423
- return typeof obj;
424
- };
425
- } else {
426
- _typeof = function _typeof(obj) {
427
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
428
- };
429
- }
430
-
431
- return _typeof(obj);
416
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
417
+ return typeof obj;
418
+ } : function (obj) {
419
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
420
+ }, _typeof(obj);
432
421
  }
433
422
 
434
423
  /**
@@ -2432,7 +2421,8 @@ var SearchSelect = function SearchSelect(props) {
2432
2421
  mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
2433
2422
  mappingTextShowKeyField = _ref.mappingTextShowKeyField,
2434
2423
  _ref$mappingValueFiel = _ref.mappingValueField,
2435
- mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel;
2424
+ mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
2425
+ mappingTextShowTextField = _ref.mappingTextShowTextField;
2436
2426
 
2437
2427
  var resultSourceKey = sourceName || (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.sourceName) || 'supplierCode';
2438
2428
  var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
@@ -2681,6 +2671,8 @@ var SearchSelect = function SearchSelect(props) {
2681
2671
  delete params[key];
2682
2672
  } else if (Array.isArray(element)) {
2683
2673
  params[key] = element.join(',');
2674
+ } else if (element == null || element === undefined || String(element).trim() === '') {
2675
+ delete params[key];
2684
2676
  }
2685
2677
  })();
2686
2678
  }
@@ -2713,14 +2705,44 @@ var SearchSelect = function SearchSelect(props) {
2713
2705
  } else {
2714
2706
  var keys = res.list ? 'list' : 'items';
2715
2707
  source = res ? res[keys] ? res[keys].map(function (item) {
2708
+ var textShowText = item[mappingTextField];
2709
+
2710
+ if (mappingTextShowTextField) {
2711
+ textShowText = [];
2712
+
2713
+ if (Array.isArray(mappingTextShowTextField)) {
2714
+ mappingTextShowTextField.forEach(function (r) {
2715
+ textShowText.push(item[r]);
2716
+ });
2717
+ } else {
2718
+ textShowText = item[mappingTextShowTextField];
2719
+ }
2720
+ }
2721
+
2716
2722
  return _objectSpread2(_objectSpread2({}, item), {}, {
2717
2723
  text: item[mappingTextField],
2724
+ textShowText: textShowText,
2718
2725
  textShowKey: item[mappingTextShowKeyField || mappingValueField],
2719
2726
  value: item[mappingValueField]
2720
2727
  });
2721
2728
  }) : Array.isArray(res) && (res === null || res === void 0 ? void 0 : res.map(function (item) {
2729
+ var textShowText = item[mappingTextField];
2730
+
2731
+ if (mappingTextShowTextField) {
2732
+ textShowText = [];
2733
+
2734
+ if (Array.isArray(mappingTextShowTextField)) {
2735
+ mappingTextShowTextField.forEach(function (r) {
2736
+ textShowText.push(item[r]);
2737
+ });
2738
+ } else {
2739
+ textShowText = item[mappingTextShowTextField];
2740
+ }
2741
+ }
2742
+
2722
2743
  return _objectSpread2(_objectSpread2({}, item), {}, {
2723
2744
  text: item[mappingTextField],
2745
+ textShowText: textShowText,
2724
2746
  textShowKey: item[mappingTextShowKeyField || mappingValueField],
2725
2747
  value: item[mappingValueField]
2726
2748
  });
@@ -2753,7 +2775,8 @@ var SearchSelect = function SearchSelect(props) {
2753
2775
  var target = e.target;
2754
2776
  var totalPage = Math.ceil(itemsTotal / pageSize); // 判断是否滑动到底部
2755
2777
 
2756
- var isTouchGround = target.scrollTop + target.offsetHeight === target.scrollHeight; // 判断数据是否还没有加载到了最后一页
2778
+ var isTouchGround = target.scrollTop + target.offsetHeight === target.scrollHeight; // >=scrollHeight
2779
+ // 判断数据是否还没有加载到了最后一页
2757
2780
 
2758
2781
  var canPageAdd = scrollPage < totalPage;
2759
2782
 
@@ -2763,6 +2786,20 @@ var SearchSelect = function SearchSelect(props) {
2763
2786
  getData({
2764
2787
  currentPage: nextScrollPage
2765
2788
  }); // 调用api方法
2789
+ } //判断是否滑动到顶部
2790
+
2791
+
2792
+ var isTouchTop = target.scrollTop === 0; // <=0
2793
+ // 判断数据是否到第一页
2794
+
2795
+ var canPageJian = scrollPage > 1;
2796
+
2797
+ if (isTouchTop && canPageJian) {
2798
+ var preScrollPage = scrollPage - 1;
2799
+ setScrollPage(preScrollPage);
2800
+ getData({
2801
+ currentPage: preScrollPage
2802
+ }); // 调用api方法
2766
2803
  }
2767
2804
  };
2768
2805
 
@@ -2802,7 +2839,7 @@ var SearchSelect = function SearchSelect(props) {
2802
2839
  };
2803
2840
  }));
2804
2841
  setIndeterminate(!!value.length && value.length < itemsTotal);
2805
- setCheckedAll(value.length === itemsTotal); // 需清空数据
2842
+ setCheckedAll(itemsTotal && value.length === itemsTotal); // 需清空数据
2806
2843
 
2807
2844
  if (!value.length) {
2808
2845
  setDoubleArr([]);
@@ -2860,6 +2897,10 @@ var SearchSelect = function SearchSelect(props) {
2860
2897
  form.resetFields();
2861
2898
  setTableFormParams({});
2862
2899
  setIsModalVisible(false);
2900
+
2901
+ if (selectMode) {
2902
+ run();
2903
+ }
2863
2904
  };
2864
2905
 
2865
2906
  var onSearchChange = function onSearchChange(e) {
@@ -2878,6 +2919,10 @@ var SearchSelect = function SearchSelect(props) {
2878
2919
  getData(_objectSpread2(_objectSpread2({}, params), {}, {
2879
2920
  pageSize: tableInitPageSize
2880
2921
  }), 2);
2922
+
2923
+ if (selectMode) {
2924
+ getData(params);
2925
+ }
2881
2926
  };
2882
2927
 
2883
2928
  var onResetTable = function onResetTable() {
@@ -2898,14 +2943,22 @@ var SearchSelect = function SearchSelect(props) {
2898
2943
 
2899
2944
  var onChangeCheckAll = function onChangeCheckAll(e) {
2900
2945
  if (e.target.checked) {
2901
- // 如果下拉框有所有数据就处理选中所有,如果没有 就默认查出所有数据
2902
- if (items.length === itemsTotal) {
2903
- var currentItemsData = JSON.parse(JSON.stringify(items));
2904
- setSelectedRowKeys(currentItemsData.map(function (i) {
2905
- return i.value;
2906
- }));
2907
- setPopValue(currentItemsData);
2946
+ // 如果下拉框有所有数据就处理选中所有【items.length === itemsTotal】(最多可选100条)
2947
+ // 如果超过100条 就默认查出所有数据
2948
+ var currentItemsData = JSON.parse(JSON.stringify(items));
2949
+ var totalPage = Math.ceil(itemsTotal / (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize));
2950
+
2951
+ for (var i = 0; i <= totalPage - 1; i++) {
2952
+ doubleArr[i] = currentItemsData.slice((tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize) * i, (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize) * (i + 1));
2908
2953
  }
2954
+
2955
+ setDoubleArr(doubleArr);
2956
+ setSelectedRowKeys(currentItemsData.map(function (i) {
2957
+ return i.value;
2958
+ }));
2959
+ setPopValue(currentItemsData);
2960
+
2961
+ if (items.length < itemsTotal) ;
2909
2962
  } else {
2910
2963
  setSelectedRowKeys([]);
2911
2964
  setPopValue([]);
@@ -2930,13 +2983,15 @@ var SearchSelect = function SearchSelect(props) {
2930
2983
  return txt.replace(regexp, "<span style=\"color:red\">".concat(heightTxt, "</span>"));
2931
2984
  };
2932
2985
 
2933
- return /*#__PURE__*/React.createElement("div", {
2986
+ return /*#__PURE__*/React.createElement(Tooltip, {
2987
+ title: text
2988
+ }, /*#__PURE__*/React.createElement("div", {
2934
2989
  ref: function ref(nodeElement) {
2935
2990
  if (nodeElement) {
2936
2991
  nodeElement.innerHTML = heightLightTxt(text, filterTxt);
2937
2992
  }
2938
2993
  }
2939
- });
2994
+ }));
2940
2995
  }; // 扁平化二维数组的方法
2941
2996
 
2942
2997
 
@@ -2983,6 +3038,7 @@ var SearchSelect = function SearchSelect(props) {
2983
3038
  }); // 单选直接选中 不需要确定
2984
3039
 
2985
3040
  handleSelectOver(filterRows);
3041
+ handleCancel();
2986
3042
  }
2987
3043
 
2988
3044
  setSelectedRowKeys(sksResult);
@@ -3058,6 +3114,14 @@ var SearchSelect = function SearchSelect(props) {
3058
3114
  },
3059
3115
  placeholder: "\u8BF7\u9009\u62E9"
3060
3116
  }, i === null || i === void 0 ? void 0 : (_i$field4 = i.field) === null || _i$field4 === void 0 ? void 0 : _i$field4.props)));
3117
+ }
3118
+
3119
+ if ((i === null || i === void 0 ? void 0 : i.type) === 'businessSearchSelect') {
3120
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Form.Item, {
3121
+ name: i.name,
3122
+ label: i.label,
3123
+ key: i.name
3124
+ }, /*#__PURE__*/React.createElement(BusinessSearchSelect$1, _objectSpread2({}, i.field.props))));
3061
3125
  } // 默认type是input
3062
3126
 
3063
3127
 
@@ -3170,7 +3234,7 @@ var SearchSelect = function SearchSelect(props) {
3170
3234
  key: item.value,
3171
3235
  label: item.text
3172
3236
  }, LightHeightOption({
3173
- text: "".concat(item.textShowKey, " ").concat(item.text),
3237
+ text: "".concat(item.textShowKey, " ").concat(Array.isArray(item.textShowText) && item.textShowText.join(' ') || item.textShowText),
3174
3238
  filterTxt: searchValue
3175
3239
  }));
3176
3240
  })), needModalTable && /*#__PURE__*/React.createElement(Button, {
@@ -3549,31 +3613,50 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
3549
3613
 
3550
3614
  if (type === 'skuCommodity') {
3551
3615
  requestConfig = _objectSpread2({
3552
- url: "".concat(prefixUrl.selectPrefix, "/sku"),
3553
- filter: 'qp-name,skuCode-orGroup,like',
3616
+ url: "".concat(prefixUrl.selectPrefix, "/sku/pager/v2"),
3617
+ filter: 'skuCodeAndSkuName',
3554
3618
  mappingTextField: 'name',
3555
3619
  mappingValueField: 'skuCode',
3620
+ mappingTextShowTextField: ['name', 'propertyNameAndValue'],
3556
3621
  otherParams: {
3557
- 'qp-approveStatus-eq': 2,
3622
+ 'qp-approveStatus-eq': 1,
3623
+ 'qp-type-eq': 10,
3558
3624
  sorter: 'desc-id'
3559
3625
  },
3560
3626
  sourceName: 'skuCode'
3561
3627
  }, requestConfigProp);
3562
3628
  tableSearchForm = [{
3563
- name: 'qp-name-like',
3629
+ name: 'qp-skuName-like',
3564
3630
  label: 'SKU名称'
3565
3631
  }, {
3566
3632
  name: 'qp-skuCode-like',
3567
3633
  label: 'SKU编码'
3568
3634
  }, {
3569
- name: 'qp-barCode-like',
3570
- label: '条形码'
3635
+ name: 'qp-code-like',
3636
+ label: '国际条码'
3571
3637
  }, {
3572
3638
  name: 'qp-itemName-like',
3573
3639
  label: '所属SPU名称'
3574
3640
  }, {
3575
3641
  name: 'qp-itemCode-like',
3576
3642
  label: '所属SPU编码'
3643
+ }, {
3644
+ name: 'qp-externalCode-like',
3645
+ label: '外部编码'
3646
+ }, {
3647
+ name: 'qp-propertyValueCode-in',
3648
+ type: 'businessSearchSelect',
3649
+ label: '规格',
3650
+ field: {
3651
+ type: 'businessSearchSelect',
3652
+ props: {
3653
+ selectBusinessType: 'skuPropertyValue',
3654
+ selectProps: {
3655
+ mode: 'multiple',
3656
+ maxTagCount: 1
3657
+ }
3658
+ }
3659
+ }
3577
3660
  }, {
3578
3661
  name: 'qp-brandId-in',
3579
3662
  type: 'select',
@@ -3649,9 +3732,9 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
3649
3732
  pageSize: 5000,
3650
3733
  currentPage: 1
3651
3734
  })]).then(function (x) {
3652
- formatSource(x, 0, 5, tableSearchForm, ['id', 'name']);
3653
- formatTreeDataSource(x, 1, 6, tableSearchForm);
3654
- formatSource(x, 2, 7, tableSearchForm, ['id', 'name']);
3735
+ formatSource(x, 0, 7, tableSearchForm, ['id', 'name']);
3736
+ formatTreeDataSource(x, 1, 8, tableSearchForm);
3737
+ formatSource(x, 2, 9, tableSearchForm, ['id', 'name']);
3655
3738
  });
3656
3739
  modalTableProps = _objectSpread2({
3657
3740
  modalTableTitle: '选择SKU',
@@ -3663,11 +3746,20 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
3663
3746
  title: 'SKU名称',
3664
3747
  dataIndex: 'name'
3665
3748
  }, {
3666
- title: '所属SPU',
3749
+ title: '国际条码',
3750
+ dataIndex: 'barCode'
3751
+ }, {
3752
+ title: '所属SPU名称',
3667
3753
  dataIndex: 'itemName'
3754
+ }, {
3755
+ title: '所属SPU编码',
3756
+ dataIndex: 'itemCode'
3757
+ }, {
3758
+ title: '外部编码',
3759
+ dataIndex: 'externalCode'
3668
3760
  }, {
3669
3761
  title: '规格',
3670
- dataIndex: 'skuSpec'
3762
+ dataIndex: 'propertyNameAndValue'
3671
3763
  }, {
3672
3764
  title: '类目',
3673
3765
  dataIndex: 'categoryName'
@@ -3677,11 +3769,24 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
3677
3769
  }, {
3678
3770
  title: '品牌',
3679
3771
  dataIndex: 'brandName'
3680
- }, {
3681
- title: '条形码',
3682
- dataIndex: 'barCode'
3683
3772
  }]
3684
3773
  }, modalTableBusProps);
3774
+ } // 商品规格选择器(无弹窗)
3775
+
3776
+
3777
+ if (type === 'skuPropertyValue') {
3778
+ requestConfig = _objectSpread2({
3779
+ url: "".concat(prefixUrl.selectPrefix, "/skuPropertyValue/list"),
3780
+ filter: 'qp-value-like',
3781
+ mappingTextField: 'value',
3782
+ mappingTextShowKeyField: 'propertyValueCode',
3783
+ mappingValueField: 'propertyValueCode',
3784
+ otherParams: {
3785
+ sorter: 'desc-id'
3786
+ },
3787
+ sourceName: 'qp-propertyValueCode-in'
3788
+ }, requestConfigProp);
3789
+ needModalTable = false;
3685
3790
  } // 仓库选择器(物理、逻辑仓)
3686
3791
 
3687
3792
 
@@ -4393,7 +4498,7 @@ var BusinessSearchSelect = function BusinessSearchSelect(props) {
4393
4498
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MemoSearchSelect, _objectSpread2({}, currentProps)));
4394
4499
  };
4395
4500
 
4396
- var index = /*#__PURE__*/React.memo(BusinessSearchSelect, function (props, nextProps) {
4501
+ var BusinessSearchSelect$1 = /*#__PURE__*/React.memo(BusinessSearchSelect, function (props, nextProps) {
4397
4502
  if (props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
4398
4503
  return false;
4399
4504
  }
@@ -4490,7 +4595,7 @@ var CommodityEntry = function CommodityEntry(props) {
4490
4595
  * @LastEditTime: 2022-01-14 17:17:26
4491
4596
  * @LastEditors: rodchen
4492
4597
  */
4493
- var index$1 = (function (storageKeyString) {
4598
+ var index = (function (storageKeyString) {
4494
4599
  var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
4495
4600
  var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
4496
4601
  if (typeof seconds !== 'number') throw new Error('seconds should be number');
@@ -4550,4 +4655,4 @@ function getStorageVale(storageKeyString) {
4550
4655
  var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
4551
4656
  axios.defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
4552
4657
 
4553
- export { index as BusinessSearchSelect, index$1 as CheckOneUser, CommodityEntry, DataValidation, QueryMutipleInput, SearchSelect };
4658
+ export { BusinessSearchSelect$1 as BusinessSearchSelect, index as CheckOneUser, CommodityEntry, DataValidation, QueryMutipleInput, SearchSelect };
package/dist/index.js CHANGED
@@ -305,10 +305,9 @@ function ownKeys$1(object, enumerableOnly) {
305
305
 
306
306
  if (Object.getOwnPropertySymbols) {
307
307
  var symbols = Object.getOwnPropertySymbols(object);
308
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
308
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
309
309
  return Object.getOwnPropertyDescriptor(object, sym).enumerable;
310
- });
311
- keys.push.apply(keys, symbols);
310
+ })), keys.push.apply(keys, symbols);
312
311
  }
313
312
 
314
313
  return keys;
@@ -316,19 +315,12 @@ function ownKeys$1(object, enumerableOnly) {
316
315
 
317
316
  function _objectSpread2$1(target) {
318
317
  for (var i = 1; i < arguments.length; i++) {
319
- var source = arguments[i] != null ? arguments[i] : {};
320
-
321
- if (i % 2) {
322
- ownKeys$1(Object(source), true).forEach(function (key) {
323
- _defineProperty$1(target, key, source[key]);
324
- });
325
- } else if (Object.getOwnPropertyDescriptors) {
326
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
327
- } else {
328
- ownKeys$1(Object(source)).forEach(function (key) {
329
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
330
- });
331
- }
318
+ var source = null != arguments[i] ? arguments[i] : {};
319
+ i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
320
+ _defineProperty$1(target, key, source[key]);
321
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
322
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
323
+ });
332
324
  }
333
325
 
334
326
  return target;
@@ -339,14 +331,17 @@ function _arrayWithHoles$1(arr) {
339
331
  }
340
332
 
341
333
  function _iterableToArrayLimit$1(arr, i) {
342
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
334
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
335
+
336
+ if (_i == null) return;
343
337
  var _arr = [];
344
338
  var _n = true;
345
339
  var _d = false;
346
- var _e = undefined;
340
+
341
+ var _s, _e;
347
342
 
348
343
  try {
349
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
344
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
350
345
  _arr.push(_s.value);
351
346
 
352
347
  if (i && _arr.length === i) break;
@@ -429,17 +424,11 @@ function _objectWithoutProperties$1(source, excluded) {
429
424
  function _typeof(obj) {
430
425
  "@babel/helpers - typeof";
431
426
 
432
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
433
- _typeof = function _typeof(obj) {
434
- return typeof obj;
435
- };
436
- } else {
437
- _typeof = function _typeof(obj) {
438
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
439
- };
440
- }
441
-
442
- return _typeof(obj);
427
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
428
+ return typeof obj;
429
+ } : function (obj) {
430
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
431
+ }, _typeof(obj);
443
432
  }
444
433
 
445
434
  /**
@@ -2443,7 +2432,8 @@ var SearchSelect = function SearchSelect(props) {
2443
2432
  mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
2444
2433
  mappingTextShowKeyField = _ref.mappingTextShowKeyField,
2445
2434
  _ref$mappingValueFiel = _ref.mappingValueField,
2446
- mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel;
2435
+ mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
2436
+ mappingTextShowTextField = _ref.mappingTextShowTextField;
2447
2437
 
2448
2438
  var resultSourceKey = sourceName || (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.sourceName) || 'supplierCode';
2449
2439
  var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
@@ -2692,6 +2682,8 @@ var SearchSelect = function SearchSelect(props) {
2692
2682
  delete params[key];
2693
2683
  } else if (Array.isArray(element)) {
2694
2684
  params[key] = element.join(',');
2685
+ } else if (element == null || element === undefined || String(element).trim() === '') {
2686
+ delete params[key];
2695
2687
  }
2696
2688
  })();
2697
2689
  }
@@ -2724,14 +2716,44 @@ var SearchSelect = function SearchSelect(props) {
2724
2716
  } else {
2725
2717
  var keys = res.list ? 'list' : 'items';
2726
2718
  source = res ? res[keys] ? res[keys].map(function (item) {
2719
+ var textShowText = item[mappingTextField];
2720
+
2721
+ if (mappingTextShowTextField) {
2722
+ textShowText = [];
2723
+
2724
+ if (Array.isArray(mappingTextShowTextField)) {
2725
+ mappingTextShowTextField.forEach(function (r) {
2726
+ textShowText.push(item[r]);
2727
+ });
2728
+ } else {
2729
+ textShowText = item[mappingTextShowTextField];
2730
+ }
2731
+ }
2732
+
2727
2733
  return _objectSpread2(_objectSpread2({}, item), {}, {
2728
2734
  text: item[mappingTextField],
2735
+ textShowText: textShowText,
2729
2736
  textShowKey: item[mappingTextShowKeyField || mappingValueField],
2730
2737
  value: item[mappingValueField]
2731
2738
  });
2732
2739
  }) : Array.isArray(res) && (res === null || res === void 0 ? void 0 : res.map(function (item) {
2740
+ var textShowText = item[mappingTextField];
2741
+
2742
+ if (mappingTextShowTextField) {
2743
+ textShowText = [];
2744
+
2745
+ if (Array.isArray(mappingTextShowTextField)) {
2746
+ mappingTextShowTextField.forEach(function (r) {
2747
+ textShowText.push(item[r]);
2748
+ });
2749
+ } else {
2750
+ textShowText = item[mappingTextShowTextField];
2751
+ }
2752
+ }
2753
+
2733
2754
  return _objectSpread2(_objectSpread2({}, item), {}, {
2734
2755
  text: item[mappingTextField],
2756
+ textShowText: textShowText,
2735
2757
  textShowKey: item[mappingTextShowKeyField || mappingValueField],
2736
2758
  value: item[mappingValueField]
2737
2759
  });
@@ -2764,7 +2786,8 @@ var SearchSelect = function SearchSelect(props) {
2764
2786
  var target = e.target;
2765
2787
  var totalPage = Math.ceil(itemsTotal / pageSize); // 判断是否滑动到底部
2766
2788
 
2767
- var isTouchGround = target.scrollTop + target.offsetHeight === target.scrollHeight; // 判断数据是否还没有加载到了最后一页
2789
+ var isTouchGround = target.scrollTop + target.offsetHeight === target.scrollHeight; // >=scrollHeight
2790
+ // 判断数据是否还没有加载到了最后一页
2768
2791
 
2769
2792
  var canPageAdd = scrollPage < totalPage;
2770
2793
 
@@ -2774,6 +2797,20 @@ var SearchSelect = function SearchSelect(props) {
2774
2797
  getData({
2775
2798
  currentPage: nextScrollPage
2776
2799
  }); // 调用api方法
2800
+ } //判断是否滑动到顶部
2801
+
2802
+
2803
+ var isTouchTop = target.scrollTop === 0; // <=0
2804
+ // 判断数据是否到第一页
2805
+
2806
+ var canPageJian = scrollPage > 1;
2807
+
2808
+ if (isTouchTop && canPageJian) {
2809
+ var preScrollPage = scrollPage - 1;
2810
+ setScrollPage(preScrollPage);
2811
+ getData({
2812
+ currentPage: preScrollPage
2813
+ }); // 调用api方法
2777
2814
  }
2778
2815
  };
2779
2816
 
@@ -2813,7 +2850,7 @@ var SearchSelect = function SearchSelect(props) {
2813
2850
  };
2814
2851
  }));
2815
2852
  setIndeterminate(!!value.length && value.length < itemsTotal);
2816
- setCheckedAll(value.length === itemsTotal); // 需清空数据
2853
+ setCheckedAll(itemsTotal && value.length === itemsTotal); // 需清空数据
2817
2854
 
2818
2855
  if (!value.length) {
2819
2856
  setDoubleArr([]);
@@ -2871,6 +2908,10 @@ var SearchSelect = function SearchSelect(props) {
2871
2908
  form.resetFields();
2872
2909
  setTableFormParams({});
2873
2910
  setIsModalVisible(false);
2911
+
2912
+ if (selectMode) {
2913
+ run();
2914
+ }
2874
2915
  };
2875
2916
 
2876
2917
  var onSearchChange = function onSearchChange(e) {
@@ -2889,6 +2930,10 @@ var SearchSelect = function SearchSelect(props) {
2889
2930
  getData(_objectSpread2(_objectSpread2({}, params), {}, {
2890
2931
  pageSize: tableInitPageSize
2891
2932
  }), 2);
2933
+
2934
+ if (selectMode) {
2935
+ getData(params);
2936
+ }
2892
2937
  };
2893
2938
 
2894
2939
  var onResetTable = function onResetTable() {
@@ -2909,14 +2954,22 @@ var SearchSelect = function SearchSelect(props) {
2909
2954
 
2910
2955
  var onChangeCheckAll = function onChangeCheckAll(e) {
2911
2956
  if (e.target.checked) {
2912
- // 如果下拉框有所有数据就处理选中所有,如果没有 就默认查出所有数据
2913
- if (items.length === itemsTotal) {
2914
- var currentItemsData = JSON.parse(JSON.stringify(items));
2915
- setSelectedRowKeys(currentItemsData.map(function (i) {
2916
- return i.value;
2917
- }));
2918
- setPopValue(currentItemsData);
2957
+ // 如果下拉框有所有数据就处理选中所有【items.length === itemsTotal】(最多可选100条)
2958
+ // 如果超过100条 就默认查出所有数据
2959
+ var currentItemsData = JSON.parse(JSON.stringify(items));
2960
+ var totalPage = Math.ceil(itemsTotal / (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize));
2961
+
2962
+ for (var i = 0; i <= totalPage - 1; i++) {
2963
+ doubleArr[i] = currentItemsData.slice((tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize) * i, (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize) * (i + 1));
2919
2964
  }
2965
+
2966
+ setDoubleArr(doubleArr);
2967
+ setSelectedRowKeys(currentItemsData.map(function (i) {
2968
+ return i.value;
2969
+ }));
2970
+ setPopValue(currentItemsData);
2971
+
2972
+ if (items.length < itemsTotal) ;
2920
2973
  } else {
2921
2974
  setSelectedRowKeys([]);
2922
2975
  setPopValue([]);
@@ -2941,13 +2994,15 @@ var SearchSelect = function SearchSelect(props) {
2941
2994
  return txt.replace(regexp, "<span style=\"color:red\">".concat(heightTxt, "</span>"));
2942
2995
  };
2943
2996
 
2944
- return /*#__PURE__*/React__default['default'].createElement("div", {
2997
+ return /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
2998
+ title: text
2999
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
2945
3000
  ref: function ref(nodeElement) {
2946
3001
  if (nodeElement) {
2947
3002
  nodeElement.innerHTML = heightLightTxt(text, filterTxt);
2948
3003
  }
2949
3004
  }
2950
- });
3005
+ }));
2951
3006
  }; // 扁平化二维数组的方法
2952
3007
 
2953
3008
 
@@ -2994,6 +3049,7 @@ var SearchSelect = function SearchSelect(props) {
2994
3049
  }); // 单选直接选中 不需要确定
2995
3050
 
2996
3051
  handleSelectOver(filterRows);
3052
+ handleCancel();
2997
3053
  }
2998
3054
 
2999
3055
  setSelectedRowKeys(sksResult);
@@ -3069,6 +3125,14 @@ var SearchSelect = function SearchSelect(props) {
3069
3125
  },
3070
3126
  placeholder: "\u8BF7\u9009\u62E9"
3071
3127
  }, i === null || i === void 0 ? void 0 : (_i$field4 = i.field) === null || _i$field4 === void 0 ? void 0 : _i$field4.props)));
3128
+ }
3129
+
3130
+ if ((i === null || i === void 0 ? void 0 : i.type) === 'businessSearchSelect') {
3131
+ return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(antd.Form.Item, {
3132
+ name: i.name,
3133
+ label: i.label,
3134
+ key: i.name
3135
+ }, /*#__PURE__*/React__default['default'].createElement(BusinessSearchSelect$1, _objectSpread2({}, i.field.props))));
3072
3136
  } // 默认type是input
3073
3137
 
3074
3138
 
@@ -3181,7 +3245,7 @@ var SearchSelect = function SearchSelect(props) {
3181
3245
  key: item.value,
3182
3246
  label: item.text
3183
3247
  }, LightHeightOption({
3184
- text: "".concat(item.textShowKey, " ").concat(item.text),
3248
+ text: "".concat(item.textShowKey, " ").concat(Array.isArray(item.textShowText) && item.textShowText.join(' ') || item.textShowText),
3185
3249
  filterTxt: searchValue
3186
3250
  }));
3187
3251
  })), needModalTable && /*#__PURE__*/React__default['default'].createElement(antd.Button, {
@@ -3560,31 +3624,50 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
3560
3624
 
3561
3625
  if (type === 'skuCommodity') {
3562
3626
  requestConfig = _objectSpread2({
3563
- url: "".concat(prefixUrl.selectPrefix, "/sku"),
3564
- filter: 'qp-name,skuCode-orGroup,like',
3627
+ url: "".concat(prefixUrl.selectPrefix, "/sku/pager/v2"),
3628
+ filter: 'skuCodeAndSkuName',
3565
3629
  mappingTextField: 'name',
3566
3630
  mappingValueField: 'skuCode',
3631
+ mappingTextShowTextField: ['name', 'propertyNameAndValue'],
3567
3632
  otherParams: {
3568
- 'qp-approveStatus-eq': 2,
3633
+ 'qp-approveStatus-eq': 1,
3634
+ 'qp-type-eq': 10,
3569
3635
  sorter: 'desc-id'
3570
3636
  },
3571
3637
  sourceName: 'skuCode'
3572
3638
  }, requestConfigProp);
3573
3639
  tableSearchForm = [{
3574
- name: 'qp-name-like',
3640
+ name: 'qp-skuName-like',
3575
3641
  label: 'SKU名称'
3576
3642
  }, {
3577
3643
  name: 'qp-skuCode-like',
3578
3644
  label: 'SKU编码'
3579
3645
  }, {
3580
- name: 'qp-barCode-like',
3581
- label: '条形码'
3646
+ name: 'qp-code-like',
3647
+ label: '国际条码'
3582
3648
  }, {
3583
3649
  name: 'qp-itemName-like',
3584
3650
  label: '所属SPU名称'
3585
3651
  }, {
3586
3652
  name: 'qp-itemCode-like',
3587
3653
  label: '所属SPU编码'
3654
+ }, {
3655
+ name: 'qp-externalCode-like',
3656
+ label: '外部编码'
3657
+ }, {
3658
+ name: 'qp-propertyValueCode-in',
3659
+ type: 'businessSearchSelect',
3660
+ label: '规格',
3661
+ field: {
3662
+ type: 'businessSearchSelect',
3663
+ props: {
3664
+ selectBusinessType: 'skuPropertyValue',
3665
+ selectProps: {
3666
+ mode: 'multiple',
3667
+ maxTagCount: 1
3668
+ }
3669
+ }
3670
+ }
3588
3671
  }, {
3589
3672
  name: 'qp-brandId-in',
3590
3673
  type: 'select',
@@ -3660,9 +3743,9 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
3660
3743
  pageSize: 5000,
3661
3744
  currentPage: 1
3662
3745
  })]).then(function (x) {
3663
- formatSource(x, 0, 5, tableSearchForm, ['id', 'name']);
3664
- formatTreeDataSource(x, 1, 6, tableSearchForm);
3665
- formatSource(x, 2, 7, tableSearchForm, ['id', 'name']);
3746
+ formatSource(x, 0, 7, tableSearchForm, ['id', 'name']);
3747
+ formatTreeDataSource(x, 1, 8, tableSearchForm);
3748
+ formatSource(x, 2, 9, tableSearchForm, ['id', 'name']);
3666
3749
  });
3667
3750
  modalTableProps = _objectSpread2({
3668
3751
  modalTableTitle: '选择SKU',
@@ -3674,11 +3757,20 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
3674
3757
  title: 'SKU名称',
3675
3758
  dataIndex: 'name'
3676
3759
  }, {
3677
- title: '所属SPU',
3760
+ title: '国际条码',
3761
+ dataIndex: 'barCode'
3762
+ }, {
3763
+ title: '所属SPU名称',
3678
3764
  dataIndex: 'itemName'
3765
+ }, {
3766
+ title: '所属SPU编码',
3767
+ dataIndex: 'itemCode'
3768
+ }, {
3769
+ title: '外部编码',
3770
+ dataIndex: 'externalCode'
3679
3771
  }, {
3680
3772
  title: '规格',
3681
- dataIndex: 'skuSpec'
3773
+ dataIndex: 'propertyNameAndValue'
3682
3774
  }, {
3683
3775
  title: '类目',
3684
3776
  dataIndex: 'categoryName'
@@ -3688,11 +3780,24 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
3688
3780
  }, {
3689
3781
  title: '品牌',
3690
3782
  dataIndex: 'brandName'
3691
- }, {
3692
- title: '条形码',
3693
- dataIndex: 'barCode'
3694
3783
  }]
3695
3784
  }, modalTableBusProps);
3785
+ } // 商品规格选择器(无弹窗)
3786
+
3787
+
3788
+ if (type === 'skuPropertyValue') {
3789
+ requestConfig = _objectSpread2({
3790
+ url: "".concat(prefixUrl.selectPrefix, "/skuPropertyValue/list"),
3791
+ filter: 'qp-value-like',
3792
+ mappingTextField: 'value',
3793
+ mappingTextShowKeyField: 'propertyValueCode',
3794
+ mappingValueField: 'propertyValueCode',
3795
+ otherParams: {
3796
+ sorter: 'desc-id'
3797
+ },
3798
+ sourceName: 'qp-propertyValueCode-in'
3799
+ }, requestConfigProp);
3800
+ needModalTable = false;
3696
3801
  } // 仓库选择器(物理、逻辑仓)
3697
3802
 
3698
3803
 
@@ -4404,7 +4509,7 @@ var BusinessSearchSelect = function BusinessSearchSelect(props) {
4404
4509
  return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(MemoSearchSelect, _objectSpread2({}, currentProps)));
4405
4510
  };
4406
4511
 
4407
- var index = /*#__PURE__*/React__default['default'].memo(BusinessSearchSelect, function (props, nextProps) {
4512
+ var BusinessSearchSelect$1 = /*#__PURE__*/React__default['default'].memo(BusinessSearchSelect, function (props, nextProps) {
4408
4513
  if (props && props.labelInValue && props.value && JSON.stringify(props.value) !== JSON.stringify(nextProps.value)) {
4409
4514
  return false;
4410
4515
  }
@@ -4501,7 +4606,7 @@ var CommodityEntry = function CommodityEntry(props) {
4501
4606
  * @LastEditTime: 2022-01-14 17:17:26
4502
4607
  * @LastEditors: rodchen
4503
4608
  */
4504
- var index$1 = (function (storageKeyString) {
4609
+ var index = (function (storageKeyString) {
4505
4610
  var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
4506
4611
  var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
4507
4612
  if (typeof seconds !== 'number') throw new Error('seconds should be number');
@@ -4561,8 +4666,8 @@ function getStorageVale(storageKeyString) {
4561
4666
  var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
4562
4667
  axios__default['default'].defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
4563
4668
 
4564
- exports.BusinessSearchSelect = index;
4565
- exports.CheckOneUser = index$1;
4669
+ exports.BusinessSearchSelect = BusinessSearchSelect$1;
4670
+ exports.CheckOneUser = index;
4566
4671
  exports.CommodityEntry = CommodityEntry;
4567
4672
  exports.DataValidation = DataValidation;
4568
4673
  exports.QueryMutipleInput = QueryMutipleInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "1.1.28",
3
+ "version": "1.1.29",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -164,23 +164,37 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
164
164
  // 商品选择器
165
165
  if(type === 'skuCommodity') {
166
166
  requestConfig = {
167
- url: `${prefixUrl.selectPrefix}/sku`,
168
- filter: 'qp-name,skuCode-orGroup,like', // 过滤参数
167
+ url: `${prefixUrl.selectPrefix}/sku/pager/v2`,
168
+ filter: 'skuCodeAndSkuName', // 过滤参数
169
169
  mappingTextField: 'name',
170
170
  mappingValueField: 'skuCode',
171
+ mappingTextShowTextField: ['name', 'propertyNameAndValue'],
171
172
  otherParams: {
172
- 'qp-approveStatus-eq':2,
173
+ 'qp-approveStatus-eq': 1,
174
+ 'qp-type-eq': 10, // 查唯一国际条码
173
175
  sorter: 'desc-id'
174
176
  }, // 默认参数
175
177
  sourceName: 'skuCode',
176
178
  ...requestConfigProp,
177
179
  }
178
180
  tableSearchForm = [
179
- { name: 'qp-name-like', label: 'SKU名称' },
181
+ { name: 'qp-skuName-like', label: 'SKU名称' },
180
182
  { name: 'qp-skuCode-like', label: 'SKU编码' },
181
- { name: 'qp-barCode-like', label: '条形码' },
183
+ { name: 'qp-code-like', label: '国际条码' },
182
184
  { name: 'qp-itemName-like', label: '所属SPU名称' },
183
185
  { name: 'qp-itemCode-like', label: '所属SPU编码' },
186
+ { name: 'qp-externalCode-like', label: '外部编码' },
187
+ { name: 'qp-propertyValueCode-in', type: 'businessSearchSelect', label: '规格', field: {
188
+ type: 'businessSearchSelect',
189
+ props: {
190
+ selectBusinessType: 'skuPropertyValue',
191
+ selectProps: {
192
+ mode: 'multiple',
193
+ maxTagCount: 1,
194
+ }
195
+ },
196
+ }
197
+ },
184
198
  { name: 'qp-brandId-in', type: 'select', label: '品牌', field: {
185
199
  type: 'select',
186
200
  props: {
@@ -242,9 +256,9 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
242
256
  currentPage: 1,
243
257
  }),
244
258
  ]).then((x: any)=>{
245
- formatSource(x,0, 5, tableSearchForm,['id','name']);
246
- formatTreeDataSource(x,1, 6, tableSearchForm);
247
- formatSource(x,2, 7, tableSearchForm,['id','name']);
259
+ formatSource(x,0, 7, tableSearchForm,['id','name']);
260
+ formatTreeDataSource(x,1, 8, tableSearchForm);
261
+ formatSource(x,2, 9, tableSearchForm,['id','name']);
248
262
  })
249
263
  modalTableProps = {
250
264
  modalTableTitle: '选择SKU',
@@ -259,12 +273,24 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
259
273
  dataIndex: 'name',
260
274
  },
261
275
  {
262
- title: '所属SPU',
276
+ title: '国际条码',
277
+ dataIndex: 'barCode',
278
+ },
279
+ {
280
+ title: '所属SPU名称',
263
281
  dataIndex: 'itemName',
264
282
  },
283
+ {
284
+ title: '所属SPU编码',
285
+ dataIndex: 'itemCode',
286
+ },
287
+ {
288
+ title: '外部编码',
289
+ dataIndex: 'externalCode',
290
+ },
265
291
  {
266
292
  title: '规格',
267
- dataIndex: 'skuSpec',
293
+ dataIndex: 'propertyNameAndValue',
268
294
  },
269
295
  {
270
296
  title: '类目',
@@ -278,15 +304,28 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
278
304
  title: '品牌',
279
305
  dataIndex: 'brandName',
280
306
  },
281
- {
282
- title: '条形码',
283
- dataIndex: 'barCode',
284
- },
285
307
  ],
286
308
  ...modalTableBusProps
287
309
  }
288
310
  }
289
311
 
312
+ // 商品规格选择器(无弹窗)
313
+ if(type === 'skuPropertyValue') {
314
+ requestConfig = {
315
+ url: `${prefixUrl.selectPrefix}/skuPropertyValue/list`,
316
+ filter: 'qp-value-like', // 过滤参数
317
+ mappingTextField: 'value',
318
+ mappingTextShowKeyField: 'propertyValueCode',
319
+ mappingValueField: 'propertyValueCode',
320
+ otherParams: {
321
+ sorter: 'desc-id'
322
+ }, // 默认参数
323
+ sourceName: 'qp-propertyValueCode-in',
324
+ ...requestConfigProp,
325
+ }
326
+ needModalTable = false
327
+ }
328
+
290
329
  // 仓库选择器(物理、逻辑仓)
291
330
  if(type === 'physicalWarehouse') {
292
331
  requestConfig = {
@@ -110,8 +110,8 @@ export default () => {
110
110
  setValue(value)
111
111
  },
112
112
  // requestConfig: {
113
- // url: `/bop/api/sku`,
114
- // filter: 'qp-name,skuCode-orGroup,like',
113
+ // url: `/bop/api/sku/pager/v2`,
114
+ // filter: 'skuCodeAndSkuName',
115
115
  // mappingValueField: 'skuCode',
116
116
  // otherParams: {
117
117
  // sorter: 'desc-id'
@@ -147,6 +147,107 @@ export default () => {
147
147
  };
148
148
  ```
149
149
 
150
+ [comment]: <> (## 商品规格选择器 Select-SPGG-001)
151
+
152
+ [comment]: <> (```tsx)
153
+
154
+ [comment]: <> (import React, { useState } from 'react';)
155
+
156
+ [comment]: <> (import { Tabs } from 'antd';)
157
+
158
+ [comment]: <> (import {BusinessSearchSelect} from '../../../index.ts';)
159
+
160
+ [comment]: <> (const { TabPane } = Tabs;)
161
+
162
+ [comment]: <> (export default &#40;&#41; => {)
163
+
164
+ [comment]: <> ( const selectProps = {)
165
+
166
+ [comment]: <> ( // mode: 'multiple',)
167
+
168
+ [comment]: <> ( // maxTagCount: 1,)
169
+
170
+ [comment]: <> ( // disabled: true)
171
+
172
+ [comment]: <> ( })
173
+
174
+ [comment]: <> ( const selectPropsMultiple = {)
175
+
176
+ [comment]: <> ( mode: 'multiple',)
177
+
178
+ [comment]: <> ( maxTagCount: 1,)
179
+
180
+ [comment]: <> ( })
181
+
182
+ [comment]: <> ( const [ tabKey, setTabKey ] = useState&#40;'single'&#41;)
183
+
184
+ [comment]: <> ( const [value, setValue] = useState&#40;selectProps?.mode ? [] : null&#41;;)
185
+
186
+ [comment]: <> ( const props = {)
187
+
188
+ [comment]: <> ( value,)
189
+
190
+ [comment]: <> ( onChange: &#40;value: any&#41; => {)
191
+
192
+ [comment]: <> ( console.log&#40;value&#41;)
193
+
194
+ [comment]: <> ( setValue&#40;value&#41;)
195
+
196
+ [comment]: <> ( },)
197
+
198
+ [comment]: <> ( prefixUrl: { selectPrefix: '/bop/api', formSelectFix: '/bop/api' },)
199
+
200
+ [comment]: <> ( selectProps,)
201
+
202
+ [comment]: <> ( selectBusinessType: 'skuPropertyValue',)
203
+
204
+ [comment]: <> ( };)
205
+
206
+ [comment]: <> ( const onTabChange = &#40;key&#41; => {)
207
+
208
+ [comment]: <> ( setTabKey&#40;key&#41;)
209
+
210
+ [comment]: <> ( setValue&#40;key === 'single' ? null: []&#41;)
211
+
212
+ [comment]: <> ( })
213
+
214
+ [comment]: <> ( return &#40;)
215
+
216
+ [comment]: <> ( <div>)
217
+
218
+ [comment]: <> ( <Tabs onChange={onTabChange} activeKey={tabKey}>)
219
+
220
+ [comment]: <> ( <TabPane tab='单选' key='single'>)
221
+
222
+ [comment]: <> ( {tabKey === 'single' && &#40;)
223
+
224
+ [comment]: <> ( <BusinessSearchSelect {...props} />)
225
+
226
+ [comment]: <> ( &#41;})
227
+
228
+ [comment]: <> ( </TabPane>)
229
+
230
+ [comment]: <> ( <TabPane tab='多选' key='multiple'>)
231
+
232
+ [comment]: <> ( {tabKey === 'multiple' && &#40;)
233
+
234
+ [comment]: <> ( <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />)
235
+
236
+ [comment]: <> ( &#41;})
237
+
238
+ [comment]: <> ( </TabPane>)
239
+
240
+ [comment]: <> ( </Tabs>)
241
+
242
+ [comment]: <> ( </div>)
243
+
244
+ [comment]: <> ( &#41;;)
245
+
246
+ [comment]: <> (};)
247
+
248
+ [comment]: <> (```)
249
+
250
+
150
251
  ## 仓库选择器(物理仓) Select-Warehouse-001
151
252
 
152
253
  ```tsx
@@ -7,6 +7,7 @@ import axios from 'axios';
7
7
  import { stringify } from 'querystring';
8
8
  import _ from "loadsh"
9
9
  import './index.less';
10
+ import { BusinessSearchSelect } from '@/index';
10
11
 
11
12
  const { Option } = Select;
12
13
 
@@ -23,7 +24,7 @@ const SearchSelect = (props: any) => {
23
24
  needModalTable=true,
24
25
  getPopupContainer=undefined
25
26
  } = props;
26
- const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField='name', mappingTextShowKeyField,mappingValueField='code' } = requestConfig || {};
27
+ const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField='name', mappingTextShowKeyField,mappingValueField='code', mappingTextShowTextField } = requestConfig || {};
27
28
  const resultSourceKey = sourceName || requestConfig?.sourceName || 'supplierCode'
28
29
 
29
30
  const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
@@ -184,6 +185,8 @@ const SearchSelect = (props: any) => {
184
185
  delete params[key]
185
186
  }else if (Array.isArray(element)) {
186
187
  params[key] = element.join(',');
188
+ } else if(element == null || element === undefined || String(element).trim() === '') {
189
+ delete params[key]
187
190
  }
188
191
  }
189
192
  }
@@ -219,18 +222,42 @@ const SearchSelect = (props: any) => {
219
222
  source = res
220
223
  ? res[keys]
221
224
  ? res[keys].map((item: any) => {
225
+ let textShowText = item[mappingTextField]
226
+ if(mappingTextShowTextField) {
227
+ textShowText = []
228
+ if(Array.isArray(mappingTextShowTextField)) {
229
+ mappingTextShowTextField.forEach((r: any) => {
230
+ textShowText.push(item[r])
231
+ })
232
+ } else {
233
+ textShowText = item[mappingTextShowTextField]
234
+ }
235
+ }
222
236
  return {
223
237
  ...item,
224
238
  text: item[mappingTextField],
239
+ textShowText,
225
240
  textShowKey: item[mappingTextShowKeyField || mappingValueField],
226
241
  value: item[mappingValueField],
227
242
  };
228
243
  })
229
244
  : Array.isArray(res) &&
230
245
  res?.map((item: Record<string, any>) => {
246
+ let textShowText = item[mappingTextField]
247
+ if(mappingTextShowTextField) {
248
+ textShowText = []
249
+ if(Array.isArray(mappingTextShowTextField)) {
250
+ mappingTextShowTextField.forEach((r: any) => {
251
+ textShowText.push(item[r])
252
+ })
253
+ } else {
254
+ textShowText = item[mappingTextShowTextField]
255
+ }
256
+ }
231
257
  return {
232
258
  ...item,
233
259
  text: item[mappingTextField],
260
+ textShowText,
234
261
  textShowKey: item[mappingTextShowKeyField || mappingValueField],
235
262
  value: item[mappingValueField],
236
263
  };
@@ -255,7 +282,7 @@ const SearchSelect = (props: any) => {
255
282
  const { target } = e;
256
283
  const totalPage = Math.ceil(itemsTotal / pageSize)
257
284
  // 判断是否滑动到底部
258
- const isTouchGround = target.scrollTop + target.offsetHeight === target.scrollHeight
285
+ const isTouchGround = target.scrollTop + target.offsetHeight === target.scrollHeight // >=scrollHeight
259
286
  // 判断数据是否还没有加载到了最后一页
260
287
  const canPageAdd = scrollPage < totalPage
261
288
  if (isTouchGround && canPageAdd) {
@@ -263,6 +290,16 @@ const SearchSelect = (props: any) => {
263
290
  setScrollPage(nextScrollPage);
264
291
  getData({currentPage: nextScrollPage}); // 调用api方法
265
292
  }
293
+
294
+ //判断是否滑动到顶部
295
+ const isTouchTop = target.scrollTop ===0 // <=0
296
+ // 判断数据是否到第一页
297
+ const canPageJian = scrollPage > 1
298
+ if (isTouchTop && canPageJian) {
299
+ const preScrollPage = scrollPage - 1;
300
+ setScrollPage(preScrollPage);
301
+ getData({currentPage: preScrollPage}); // 调用api方法
302
+ }
266
303
  }
267
304
 
268
305
  useEffect(() => {
@@ -289,7 +326,7 @@ const SearchSelect = (props: any) => {
289
326
  setSelectedRowKeys(labelInValue ? value.map(i => i.key) : value)
290
327
  setPopValue(labelInValue ? value.map(i => ({ value: i.key, text: i.label })) : value.map(i => ({ value: i })));
291
328
  setIndeterminate(!!value.length && value.length < itemsTotal);
292
- setCheckedAll(value.length === itemsTotal);
329
+ setCheckedAll(itemsTotal && value.length === itemsTotal);
293
330
  // 需清空数据
294
331
  if(!value.length) {
295
332
  setDoubleArr([])
@@ -330,6 +367,9 @@ const SearchSelect = (props: any) => {
330
367
  form.resetFields();
331
368
  setTableFormParams({});
332
369
  setIsModalVisible(false);
370
+ if(selectMode) {
371
+ run();
372
+ }
333
373
  };
334
374
 
335
375
  const onSearchChange = (e) => {
@@ -346,6 +386,9 @@ const SearchSelect = (props: any) => {
346
386
  const params = form.getFieldsValue();
347
387
  setTableFormParams(params);
348
388
  getData({ ...params, pageSize: tableInitPageSize }, 2)
389
+ if(selectMode){
390
+ getData(params)
391
+ }
349
392
  }
350
393
 
351
394
  const onResetTable = () => {
@@ -360,12 +403,17 @@ const SearchSelect = (props: any) => {
360
403
 
361
404
  const onChangeCheckAll = (e) => {
362
405
  if(e.target.checked) {
363
- // 如果下拉框有所有数据就处理选中所有,如果没有 就默认查出所有数据
364
- if(items.length === itemsTotal) {
365
- const currentItemsData = JSON.parse(JSON.stringify(items))
366
- setSelectedRowKeys(currentItemsData.map(i => i.value))
367
- setPopValue(currentItemsData);
368
- } else {
406
+ // 如果下拉框有所有数据就处理选中所有【items.length === itemsTotal】(最多可选100条)
407
+ // 如果超过100条 就默认查出所有数据
408
+ const currentItemsData = JSON.parse(JSON.stringify(items))
409
+ const totalPage = Math.ceil(itemsTotal / tablePagination?.pageSize)
410
+ for(let i=0; i <= totalPage-1; i++){
411
+ doubleArr[i] = currentItemsData.slice(tablePagination?.pageSize*i,tablePagination?.pageSize*(i+1))
412
+ }
413
+ setDoubleArr(doubleArr)
414
+ setSelectedRowKeys(currentItemsData.map(i => i.value))
415
+ setPopValue(currentItemsData);
416
+ if(items.length < itemsTotal) {
369
417
  // TODO 请求接口获取所有数据
370
418
  }
371
419
  } else {
@@ -390,12 +438,14 @@ const SearchSelect = (props: any) => {
390
438
  return txt.replace(regexp, `<span style="color:red">${heightTxt}</span>`)
391
439
  }
392
440
  return (
393
- <div ref={(nodeElement) => {
394
- if (nodeElement) {
395
- nodeElement.innerHTML = heightLightTxt(text, filterTxt)
396
- }
397
- }}
398
- />
441
+ <Tooltip title={text}>
442
+ <div ref={(nodeElement) => {
443
+ if (nodeElement) {
444
+ nodeElement.innerHTML = heightLightTxt(text, filterTxt)
445
+ }
446
+ }}
447
+ />
448
+ </Tooltip>
399
449
  )
400
450
  }
401
451
 
@@ -438,6 +488,7 @@ const SearchSelect = (props: any) => {
438
488
  sksResult = selectRows.map((i) => i.value)
439
489
  // 单选直接选中 不需要确定
440
490
  handleSelectOver(filterRows)
491
+ handleCancel();
441
492
  }
442
493
 
443
494
  setSelectedRowKeys(sksResult)
@@ -494,6 +545,16 @@ const SearchSelect = (props: any) => {
494
545
  )
495
546
  }
496
547
 
548
+ if(i?.type === 'businessSearchSelect') {
549
+ return (
550
+ <div>
551
+ <Form.Item name={i.name} label={i.label} key={i.name}>
552
+ <BusinessSearchSelect {...i.field.props} />
553
+ </Form.Item>
554
+ </div>
555
+ )
556
+ }
557
+
497
558
  // 默认type是input
498
559
  return (
499
560
  <Form.Item name={i.name} label={i.label} key={i.name}>
@@ -570,7 +631,7 @@ const SearchSelect = (props: any) => {
570
631
  >
571
632
  {items.map(item => (
572
633
  <Option key={item.value} label={item.text}>
573
- {LightHeightOption({ text: `${item.textShowKey} ${item.text}`, filterTxt: searchValue })}
634
+ {LightHeightOption({ text: `${item.textShowKey} ${Array.isArray(item.textShowText) && item.textShowText.join(' ') || item.textShowText}`, filterTxt: searchValue })}
574
635
  </Option>
575
636
  ))}
576
637
  </Select>