@bit-sun/business-component 1.1.14 → 1.1.15

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
@@ -2448,6 +2448,7 @@ var SearchSelect = function SearchSelect(props) {
2448
2448
  fieldValToParam = _ref.fieldValToParam,
2449
2449
  _ref$mappingTextField = _ref.mappingTextField,
2450
2450
  mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
2451
+ mappingTextShowKeyField = _ref.mappingTextShowKeyField,
2451
2452
  _ref$mappingValueFiel = _ref.mappingValueField,
2452
2453
  mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
2453
2454
  _ref$sourceName = _ref.sourceName,
@@ -2508,12 +2509,12 @@ var SearchSelect = function SearchSelect(props) {
2508
2509
  popvalue = _useState14[0],
2509
2510
  setPopValue = _useState14[1];
2510
2511
 
2511
- var _useDebounceFn = useDebounceFn(function () {
2512
+ var _useDebounceFn = useDebounceFn(function (v) {
2512
2513
  // 优化搜索参数 支持传多个
2513
2514
  var searchParams = {};
2514
2515
 
2515
2516
  if (typeof selectParamsKey === 'string') {
2516
- searchParams = _defineProperty({}, selectParamsKey, searchValue);
2517
+ searchParams = _defineProperty({}, selectParamsKey, v ? initVal : searchValue);
2517
2518
  }
2518
2519
 
2519
2520
  if (Array.isArray(selectParamsKey)) {
@@ -2634,11 +2635,13 @@ var SearchSelect = function SearchSelect(props) {
2634
2635
  source = res ? res[keys] ? res[keys].map(function (item) {
2635
2636
  return _objectSpread2(_objectSpread2({}, item), {}, {
2636
2637
  text: item[mappingTextField],
2638
+ textShowKey: item[mappingTextShowKeyField || mappingValueField],
2637
2639
  value: item[mappingValueField]
2638
2640
  });
2639
2641
  }) : Array.isArray(res) && (res === null || res === void 0 ? void 0 : res.map(function (item) {
2640
2642
  return _objectSpread2(_objectSpread2({}, item), {}, {
2641
2643
  text: item[mappingTextField],
2644
+ textShowKey: item[mappingTextShowKeyField || mappingValueField],
2642
2645
  value: item[mappingValueField]
2643
2646
  });
2644
2647
  })) : [];
@@ -2649,7 +2652,6 @@ var SearchSelect = function SearchSelect(props) {
2649
2652
  if (type === 1) {
2650
2653
  var _ctx$form;
2651
2654
 
2652
- console.log(sourceName, 'sourceName');
2653
2655
  ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(sourceName, source);
2654
2656
  setItems(source);
2655
2657
  setItemsTotal(Number(res === null || res === void 0 ? void 0 : res.total));
@@ -2685,7 +2687,7 @@ var SearchSelect = function SearchSelect(props) {
2685
2687
  };
2686
2688
 
2687
2689
  useEffect(function () {
2688
- getData();
2690
+ run('init');
2689
2691
  }, []);
2690
2692
  useEffect(function () {
2691
2693
  if (value) {
@@ -2748,7 +2750,14 @@ var SearchSelect = function SearchSelect(props) {
2748
2750
 
2749
2751
  var handleOk = function handleOk() {
2750
2752
  if (popvalue === null || popvalue === void 0 ? void 0 : popvalue.length) {
2751
- formaData(popvalue);
2753
+ var _ctx$form2;
2754
+
2755
+ formaData(popvalue); // 解决选择最后1页的sku,返回后,不显示名称问题
2756
+
2757
+ var source = _.uniqBy(items.concat(popvalue), 'value');
2758
+
2759
+ ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldSource(sourceName, source);
2760
+ setItems(source);
2752
2761
  }
2753
2762
 
2754
2763
  setIsModalVisible(false);
@@ -3047,7 +3056,7 @@ var SearchSelect = function SearchSelect(props) {
3047
3056
  key: item.value,
3048
3057
  label: item.text
3049
3058
  }, LightHeightOption({
3050
- text: "".concat(item.value, " ").concat(item.text),
3059
+ text: "".concat(item.textShowKey, " ").concat(item.text),
3051
3060
  filterTxt: searchValue
3052
3061
  }));
3053
3062
  })), /*#__PURE__*/React.createElement(Button, {
@@ -3533,6 +3542,7 @@ function commonFun(type, prefixUrl) {
3533
3542
  url: "".concat(prefixUrl.selectPrefix, "/physicalWarehouse"),
3534
3543
  filter: 'qp-nameAndCode-like',
3535
3544
  mappingTextField: 'physicalWarehouseName',
3545
+ mappingTextShowKeyField: 'physicalWarehouseCode',
3536
3546
  mappingValueField: 'id',
3537
3547
  otherParams: {
3538
3548
  sorter: 'desc-id'
@@ -3615,6 +3625,7 @@ function commonFun(type, prefixUrl) {
3615
3625
  url: "".concat(prefixUrl.selectPrefix, "/realWarehouse"),
3616
3626
  filter: 'qp-nameAndCode-like',
3617
3627
  mappingTextField: 'realWarehouseName',
3628
+ mappingTextShowKeyField: 'realWarehouseCode',
3618
3629
  mappingValueField: 'id',
3619
3630
  otherParams: {
3620
3631
  sorter: 'desc-id'
package/dist/index.js CHANGED
@@ -2459,6 +2459,7 @@ var SearchSelect = function SearchSelect(props) {
2459
2459
  fieldValToParam = _ref.fieldValToParam,
2460
2460
  _ref$mappingTextField = _ref.mappingTextField,
2461
2461
  mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
2462
+ mappingTextShowKeyField = _ref.mappingTextShowKeyField,
2462
2463
  _ref$mappingValueFiel = _ref.mappingValueField,
2463
2464
  mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
2464
2465
  _ref$sourceName = _ref.sourceName,
@@ -2519,12 +2520,12 @@ var SearchSelect = function SearchSelect(props) {
2519
2520
  popvalue = _useState14[0],
2520
2521
  setPopValue = _useState14[1];
2521
2522
 
2522
- var _useDebounceFn = ahooks.useDebounceFn(function () {
2523
+ var _useDebounceFn = ahooks.useDebounceFn(function (v) {
2523
2524
  // 优化搜索参数 支持传多个
2524
2525
  var searchParams = {};
2525
2526
 
2526
2527
  if (typeof selectParamsKey === 'string') {
2527
- searchParams = _defineProperty({}, selectParamsKey, searchValue);
2528
+ searchParams = _defineProperty({}, selectParamsKey, v ? initVal : searchValue);
2528
2529
  }
2529
2530
 
2530
2531
  if (Array.isArray(selectParamsKey)) {
@@ -2645,11 +2646,13 @@ var SearchSelect = function SearchSelect(props) {
2645
2646
  source = res ? res[keys] ? res[keys].map(function (item) {
2646
2647
  return _objectSpread2(_objectSpread2({}, item), {}, {
2647
2648
  text: item[mappingTextField],
2649
+ textShowKey: item[mappingTextShowKeyField || mappingValueField],
2648
2650
  value: item[mappingValueField]
2649
2651
  });
2650
2652
  }) : Array.isArray(res) && (res === null || res === void 0 ? void 0 : res.map(function (item) {
2651
2653
  return _objectSpread2(_objectSpread2({}, item), {}, {
2652
2654
  text: item[mappingTextField],
2655
+ textShowKey: item[mappingTextShowKeyField || mappingValueField],
2653
2656
  value: item[mappingValueField]
2654
2657
  });
2655
2658
  })) : [];
@@ -2660,7 +2663,6 @@ var SearchSelect = function SearchSelect(props) {
2660
2663
  if (type === 1) {
2661
2664
  var _ctx$form;
2662
2665
 
2663
- console.log(sourceName, 'sourceName');
2664
2666
  ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(sourceName, source);
2665
2667
  setItems(source);
2666
2668
  setItemsTotal(Number(res === null || res === void 0 ? void 0 : res.total));
@@ -2696,7 +2698,7 @@ var SearchSelect = function SearchSelect(props) {
2696
2698
  };
2697
2699
 
2698
2700
  React.useEffect(function () {
2699
- getData();
2701
+ run('init');
2700
2702
  }, []);
2701
2703
  React.useEffect(function () {
2702
2704
  if (value) {
@@ -2759,7 +2761,14 @@ var SearchSelect = function SearchSelect(props) {
2759
2761
 
2760
2762
  var handleOk = function handleOk() {
2761
2763
  if (popvalue === null || popvalue === void 0 ? void 0 : popvalue.length) {
2762
- formaData(popvalue);
2764
+ var _ctx$form2;
2765
+
2766
+ formaData(popvalue); // 解决选择最后1页的sku,返回后,不显示名称问题
2767
+
2768
+ var source = ___default['default'].uniqBy(items.concat(popvalue), 'value');
2769
+
2770
+ ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldSource(sourceName, source);
2771
+ setItems(source);
2763
2772
  }
2764
2773
 
2765
2774
  setIsModalVisible(false);
@@ -3058,7 +3067,7 @@ var SearchSelect = function SearchSelect(props) {
3058
3067
  key: item.value,
3059
3068
  label: item.text
3060
3069
  }, LightHeightOption({
3061
- text: "".concat(item.value, " ").concat(item.text),
3070
+ text: "".concat(item.textShowKey, " ").concat(item.text),
3062
3071
  filterTxt: searchValue
3063
3072
  }));
3064
3073
  })), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
@@ -3544,6 +3553,7 @@ function commonFun(type, prefixUrl) {
3544
3553
  url: "".concat(prefixUrl.selectPrefix, "/physicalWarehouse"),
3545
3554
  filter: 'qp-nameAndCode-like',
3546
3555
  mappingTextField: 'physicalWarehouseName',
3556
+ mappingTextShowKeyField: 'physicalWarehouseCode',
3547
3557
  mappingValueField: 'id',
3548
3558
  otherParams: {
3549
3559
  sorter: 'desc-id'
@@ -3626,6 +3636,7 @@ function commonFun(type, prefixUrl) {
3626
3636
  url: "".concat(prefixUrl.selectPrefix, "/realWarehouse"),
3627
3637
  filter: 'qp-nameAndCode-like',
3628
3638
  mappingTextField: 'realWarehouseName',
3639
+ mappingTextShowKeyField: 'realWarehouseCode',
3629
3640
  mappingValueField: 'id',
3630
3641
  otherParams: {
3631
3642
  sorter: 'desc-id'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "1.1.14",
3
+ "version": "1.1.15",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -351,6 +351,7 @@ export function commonFun (type?: string, prefixUrl: any) {
351
351
  url: `${prefixUrl.selectPrefix}/physicalWarehouse`,
352
352
  filter: 'qp-nameAndCode-like', // 过滤参数
353
353
  mappingTextField: 'physicalWarehouseName',
354
+ mappingTextShowKeyField: 'physicalWarehouseCode',
354
355
  mappingValueField: 'id',
355
356
  otherParams: {
356
357
  sorter: 'desc-id'
@@ -420,6 +421,7 @@ export function commonFun (type?: string, prefixUrl: any) {
420
421
  url: `${prefixUrl.selectPrefix}/realWarehouse`,
421
422
  filter: 'qp-nameAndCode-like', // 过滤参数
422
423
  mappingTextField: 'realWarehouseName',
424
+ mappingTextShowKeyField: 'realWarehouseCode',
423
425
  mappingValueField: 'id',
424
426
  otherParams: {
425
427
  sorter: 'desc-id'
@@ -20,7 +20,7 @@ const SearchSelect = (props: any) => {
20
20
  requestConfig,
21
21
  ctx,
22
22
  } = props;
23
- const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField='name', mappingValueField='code', sourceName='supplierCode' } = requestConfig || {};
23
+ const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField='name', mappingTextShowKeyField,mappingValueField='code', sourceName='supplierCode' } = requestConfig || {};
24
24
 
25
25
  const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
26
26
  const initVal = value || (selectMode ? [] : null);
@@ -47,11 +47,11 @@ const SearchSelect = (props: any) => {
47
47
  const [isModalVisible, setIsModalVisible] = useState(false);
48
48
  const [popvalue, setPopValue] = useState(initVal);
49
49
  const { run } = useDebounceFn(
50
- () => {
50
+ (v?: any) => {
51
51
  // 优化搜索参数 支持传多个
52
52
  let searchParams = {};
53
53
  if(typeof selectParamsKey === 'string') {
54
- searchParams = { [selectParamsKey]: searchValue }
54
+ searchParams = { [selectParamsKey]: v ? initVal : searchValue }
55
55
  }
56
56
  if(Array.isArray(selectParamsKey)) {
57
57
  selectParamsKey.forEach((i: any) => {
@@ -128,6 +128,7 @@ const SearchSelect = (props: any) => {
128
128
  return {
129
129
  ...item,
130
130
  text: item[mappingTextField],
131
+ textShowKey: item[mappingTextShowKeyField || mappingValueField],
131
132
  value: item[mappingValueField],
132
133
  };
133
134
  })
@@ -136,6 +137,7 @@ const SearchSelect = (props: any) => {
136
137
  return {
137
138
  ...item,
138
139
  text: item[mappingTextField],
140
+ textShowKey: item[mappingTextShowKeyField || mappingValueField],
139
141
  value: item[mappingValueField],
140
142
  };
141
143
  })
@@ -143,7 +145,6 @@ const SearchSelect = (props: any) => {
143
145
  }
144
146
  source = Array.isArray(source) ? source : []
145
147
  if(type === 1) {
146
- console.log(sourceName, 'sourceName')
147
148
  ctx?.form?.setFieldSource(sourceName, source)
148
149
  setItems(source)
149
150
  setItemsTotal(Number(res?.total))
@@ -171,7 +172,7 @@ const SearchSelect = (props: any) => {
171
172
  }
172
173
 
173
174
  useEffect(() => {
174
- getData()
175
+ run('init')
175
176
  }, [])
176
177
 
177
178
  useEffect(() => {
@@ -203,6 +204,10 @@ const SearchSelect = (props: any) => {
203
204
  const handleOk = () => {
204
205
  if(popvalue?.length) {
205
206
  formaData(popvalue);
207
+ // 解决选择最后1页的sku,返回后,不显示名称问题
208
+ const source = _.uniqBy(items.concat(popvalue), 'value')
209
+ ctx?.form?.setFieldSource(sourceName, source)
210
+ setItems(source)
206
211
  }
207
212
  setIsModalVisible(false);
208
213
  };
@@ -430,7 +435,7 @@ const SearchSelect = (props: any) => {
430
435
  >
431
436
  {items.map(item => (
432
437
  <Option key={item.value} label={item.text}>
433
- {LightHeightOption({ text: `${item.value} ${item.text}`, filterTxt: searchValue })}
438
+ {LightHeightOption({ text: `${item.textShowKey} ${item.text}`, filterTxt: searchValue })}
434
439
  </Option>
435
440
  ))}
436
441
  </Select>