@bit-sun/business-component 1.1.19 → 1.1.20

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
@@ -1947,7 +1947,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
1947
1947
  }).map(function (item) {
1948
1948
  var obj = {};
1949
1949
  item.slice(0, itemsTemp.length).map(function (innerItem, index) {
1950
- obj[_this.state.items[index].code] = innerItem && innerItem.v;
1950
+ obj[_this.state.items[index].code] = innerItem && (innerItem.v === innerItem.m ? innerItem.v : innerItem.m);
1951
1951
  });
1952
1952
  return obj;
1953
1953
  });
@@ -1982,6 +1982,17 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
1982
1982
  sheetData.map(function (item, index) {
1983
1983
  if (!res[index]) return item;
1984
1984
 
1985
+ var changeVMIndex = _this.props.columns.findIndex(function (i) {
1986
+ return i === 'skuCode';
1987
+ });
1988
+
1989
+ if (_this.props.columns.find(function (i) {
1990
+ return i === 'skuCode';
1991
+ }) && item[changeVMIndex].v !== res[index].skuCode) {
1992
+ item[changeVMIndex].v = res[index].skuCode;
1993
+ item[changeVMIndex].m = res[index].skuCode;
1994
+ }
1995
+
1985
1996
  if (res[index].flag) {
1986
1997
  item[validIndex] = _objectSpread2(_objectSpread2({}, item[validIndex]), {}, {
1987
1998
  v: '通过',
@@ -2438,7 +2449,8 @@ var SearchSelect = function SearchSelect(props) {
2438
2449
  _props$labelInValue = props.labelInValue,
2439
2450
  labelInValue = _props$labelInValue === void 0 ? false : _props$labelInValue,
2440
2451
  requestConfig = props.requestConfig,
2441
- ctx = props.ctx;
2452
+ ctx = props.ctx,
2453
+ sourceName = props.sourceName;
2442
2454
 
2443
2455
  var _ref = requestConfig || {},
2444
2456
  url = _ref.url,
@@ -2450,10 +2462,9 @@ var SearchSelect = function SearchSelect(props) {
2450
2462
  mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
2451
2463
  mappingTextShowKeyField = _ref.mappingTextShowKeyField,
2452
2464
  _ref$mappingValueFiel = _ref.mappingValueField,
2453
- mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
2454
- _ref$sourceName = _ref.sourceName,
2455
- sourceName = _ref$sourceName === void 0 ? 'supplierCode' : _ref$sourceName;
2465
+ mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel;
2456
2466
 
2467
+ var resultSourceKey = sourceName || (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.sourceName) || 'supplierCode';
2457
2468
  var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
2458
2469
 
2459
2470
  var initVal = value || (selectMode ? [] : null);
@@ -2646,7 +2657,7 @@ var SearchSelect = function SearchSelect(props) {
2646
2657
  if (type === 1) {
2647
2658
  var _ctx$form;
2648
2659
 
2649
- ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(sourceName, source);
2660
+ ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(resultSourceKey, source);
2650
2661
  setItems(source);
2651
2662
  setItemsTotal(Number(res === null || res === void 0 ? void 0 : res.total));
2652
2663
  } else {
@@ -2738,7 +2749,7 @@ var SearchSelect = function SearchSelect(props) {
2738
2749
 
2739
2750
  var source = _.uniqBy(items.concat(popvalue), 'value');
2740
2751
 
2741
- ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldSource(sourceName, source);
2752
+ ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldSource(resultSourceKey, source);
2742
2753
  setItems(source);
2743
2754
  }
2744
2755
 
@@ -2895,6 +2906,11 @@ var SearchSelect = function SearchSelect(props) {
2895
2906
  setPopValue(filterRows);
2896
2907
  setIndeterminate(!!filterRows.length && filterRows.length < (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.total));
2897
2908
  setCheckedAll(filterRows.length === (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.total));
2909
+ }; // 生成唯一值
2910
+
2911
+
2912
+ var makeUniqueValue = function makeUniqueValue() {
2913
+ return ((1 + Math.random()) * 0x10000 | 0).toString(16);
2898
2914
  };
2899
2915
 
2900
2916
  var rowSelection = {
@@ -2982,7 +2998,7 @@ var SearchSelect = function SearchSelect(props) {
2982
2998
  className: 'search_select'
2983
2999
  }, /*#__PURE__*/React.createElement("div", {
2984
3000
  className: "search_select_show",
2985
- id: 'search_select_div'
3001
+ id: "search_select_div_".concat(makeUniqueValue())
2986
3002
  }, /*#__PURE__*/React.createElement(Select, _objectSpread2(_objectSpread2({
2987
3003
  virtual: true,
2988
3004
  labelInValue: labelInValue,
@@ -3028,7 +3044,7 @@ var SearchSelect = function SearchSelect(props) {
3028
3044
  onPopupScroll: SelectScroll
3029
3045
  }, currentSelectProps), {}, {
3030
3046
  getPopupContainer: function getPopupContainer() {
3031
- return document.getElementById('search_select_div');
3047
+ return document.getElementById("search_select_div_".concat(makeUniqueValue()));
3032
3048
  },
3033
3049
  style: {
3034
3050
  width: 'calc(100% - 30px)'
package/dist/index.js CHANGED
@@ -1958,7 +1958,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
1958
1958
  }).map(function (item) {
1959
1959
  var obj = {};
1960
1960
  item.slice(0, itemsTemp.length).map(function (innerItem, index) {
1961
- obj[_this.state.items[index].code] = innerItem && innerItem.v;
1961
+ obj[_this.state.items[index].code] = innerItem && (innerItem.v === innerItem.m ? innerItem.v : innerItem.m);
1962
1962
  });
1963
1963
  return obj;
1964
1964
  });
@@ -1993,6 +1993,17 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
1993
1993
  sheetData.map(function (item, index) {
1994
1994
  if (!res[index]) return item;
1995
1995
 
1996
+ var changeVMIndex = _this.props.columns.findIndex(function (i) {
1997
+ return i === 'skuCode';
1998
+ });
1999
+
2000
+ if (_this.props.columns.find(function (i) {
2001
+ return i === 'skuCode';
2002
+ }) && item[changeVMIndex].v !== res[index].skuCode) {
2003
+ item[changeVMIndex].v = res[index].skuCode;
2004
+ item[changeVMIndex].m = res[index].skuCode;
2005
+ }
2006
+
1996
2007
  if (res[index].flag) {
1997
2008
  item[validIndex] = _objectSpread2(_objectSpread2({}, item[validIndex]), {}, {
1998
2009
  v: '通过',
@@ -2449,7 +2460,8 @@ var SearchSelect = function SearchSelect(props) {
2449
2460
  _props$labelInValue = props.labelInValue,
2450
2461
  labelInValue = _props$labelInValue === void 0 ? false : _props$labelInValue,
2451
2462
  requestConfig = props.requestConfig,
2452
- ctx = props.ctx;
2463
+ ctx = props.ctx,
2464
+ sourceName = props.sourceName;
2453
2465
 
2454
2466
  var _ref = requestConfig || {},
2455
2467
  url = _ref.url,
@@ -2461,10 +2473,9 @@ var SearchSelect = function SearchSelect(props) {
2461
2473
  mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
2462
2474
  mappingTextShowKeyField = _ref.mappingTextShowKeyField,
2463
2475
  _ref$mappingValueFiel = _ref.mappingValueField,
2464
- mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel,
2465
- _ref$sourceName = _ref.sourceName,
2466
- sourceName = _ref$sourceName === void 0 ? 'supplierCode' : _ref$sourceName;
2476
+ mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel;
2467
2477
 
2478
+ var resultSourceKey = sourceName || (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.sourceName) || 'supplierCode';
2468
2479
  var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
2469
2480
 
2470
2481
  var initVal = value || (selectMode ? [] : null);
@@ -2657,7 +2668,7 @@ var SearchSelect = function SearchSelect(props) {
2657
2668
  if (type === 1) {
2658
2669
  var _ctx$form;
2659
2670
 
2660
- ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(sourceName, source);
2671
+ ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(resultSourceKey, source);
2661
2672
  setItems(source);
2662
2673
  setItemsTotal(Number(res === null || res === void 0 ? void 0 : res.total));
2663
2674
  } else {
@@ -2749,7 +2760,7 @@ var SearchSelect = function SearchSelect(props) {
2749
2760
 
2750
2761
  var source = ___default['default'].uniqBy(items.concat(popvalue), 'value');
2751
2762
 
2752
- ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldSource(sourceName, source);
2763
+ ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldSource(resultSourceKey, source);
2753
2764
  setItems(source);
2754
2765
  }
2755
2766
 
@@ -2906,6 +2917,11 @@ var SearchSelect = function SearchSelect(props) {
2906
2917
  setPopValue(filterRows);
2907
2918
  setIndeterminate(!!filterRows.length && filterRows.length < (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.total));
2908
2919
  setCheckedAll(filterRows.length === (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.total));
2920
+ }; // 生成唯一值
2921
+
2922
+
2923
+ var makeUniqueValue = function makeUniqueValue() {
2924
+ return ((1 + Math.random()) * 0x10000 | 0).toString(16);
2909
2925
  };
2910
2926
 
2911
2927
  var rowSelection = {
@@ -2993,7 +3009,7 @@ var SearchSelect = function SearchSelect(props) {
2993
3009
  className: 'search_select'
2994
3010
  }, /*#__PURE__*/React__default['default'].createElement("div", {
2995
3011
  className: "search_select_show",
2996
- id: 'search_select_div'
3012
+ id: "search_select_div_".concat(makeUniqueValue())
2997
3013
  }, /*#__PURE__*/React__default['default'].createElement(antd.Select, _objectSpread2(_objectSpread2({
2998
3014
  virtual: true,
2999
3015
  labelInValue: labelInValue,
@@ -3039,7 +3055,7 @@ var SearchSelect = function SearchSelect(props) {
3039
3055
  onPopupScroll: SelectScroll
3040
3056
  }, currentSelectProps), {}, {
3041
3057
  getPopupContainer: function getPopupContainer() {
3042
- return document.getElementById('search_select_div');
3058
+ return document.getElementById("search_select_div_".concat(makeUniqueValue()));
3043
3059
  },
3044
3060
  style: {
3045
3061
  width: 'calc(100% - 30px)'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "1.1.19",
3
+ "version": "1.1.20",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -379,7 +379,7 @@ class DataValidation extends React.Component {
379
379
  let obj = {};
380
380
 
381
381
  item.slice(0, itemsTemp.length).map((innerItem, index) => {
382
- obj[this.state.items[index].code] = innerItem && innerItem.v;
382
+ obj[this.state.items[index].code] = innerItem && (innerItem.v === innerItem.m ? innerItem.v : innerItem.m);
383
383
  });
384
384
 
385
385
  return obj;
@@ -414,6 +414,12 @@ class DataValidation extends React.Component {
414
414
  sheetData.map((item, index) => {
415
415
  if (!res[index]) return item;
416
416
 
417
+ const changeVMIndex = this.props.columns.findIndex(i => i === 'skuCode');
418
+ if(this.props.columns.find(i => i === 'skuCode') && item[changeVMIndex].v !== res[index].skuCode) {
419
+ item[changeVMIndex].v = res[index].skuCode;
420
+ item[changeVMIndex].m = res[index].skuCode;
421
+ }
422
+
417
423
  if (res[index].flag) {
418
424
  item[validIndex] = {
419
425
  ...item[validIndex],
@@ -19,8 +19,10 @@ const SearchSelect = (props: any) => {
19
19
  labelInValue=false,
20
20
  requestConfig,
21
21
  ctx,
22
+ sourceName,
22
23
  } = props;
23
- const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField='name', mappingTextShowKeyField,mappingValueField='code', sourceName='supplierCode' } = requestConfig || {};
24
+ const { url, otherParams, isMap, fixedparameter, fieldValToParam, mappingTextField='name', mappingTextShowKeyField,mappingValueField='code' } = requestConfig || {};
25
+ const resultSourceKey = sourceName || requestConfig?.sourceName || 'supplierCode'
24
26
 
25
27
  const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
26
28
  const initVal = value || (selectMode ? [] : null);
@@ -144,7 +146,7 @@ const SearchSelect = (props: any) => {
144
146
  }
145
147
  source = Array.isArray(source) ? source : []
146
148
  if(type === 1) {
147
- ctx?.form?.setFieldSource(sourceName, source)
149
+ ctx?.form?.setFieldSource(resultSourceKey, source)
148
150
  setItems(source)
149
151
  setItemsTotal(Number(res?.total))
150
152
  } else {
@@ -207,7 +209,7 @@ const SearchSelect = (props: any) => {
207
209
  formaData(popvalue);
208
210
  // 解决选择最后1页的sku,返回后,不显示名称问题
209
211
  const source = _.uniqBy(items.concat(popvalue), 'value')
210
- ctx?.form?.setFieldSource(sourceName, source)
212
+ ctx?.form?.setFieldSource(resultSourceKey, source)
211
213
  setItems(source)
212
214
  }
213
215
  handleCancel();
@@ -341,6 +343,11 @@ const SearchSelect = (props: any) => {
341
343
  setCheckedAll(filterRows.length === tablePagination?.total);
342
344
  }
343
345
 
346
+ // 生成唯一值
347
+ const makeUniqueValue = () => {
348
+ return (((1+Math.random())*0x10000)|0).toString(16);
349
+ }
350
+
344
351
  const rowSelection = {
345
352
  type: selectMode ? 'checkbox' : 'radio',
346
353
  selectedRowKeys,
@@ -396,7 +403,7 @@ const SearchSelect = (props: any) => {
396
403
 
397
404
  return (
398
405
  <div className={'search_select'}>
399
- <div className="search_select_show" id='search_select_div'>
406
+ <div className="search_select_show" id={`search_select_div_${makeUniqueValue()}`}>
400
407
  <Select
401
408
  virtual
402
409
  labelInValue={labelInValue}
@@ -430,7 +437,7 @@ const SearchSelect = (props: any) => {
430
437
  }
431
438
  onPopupScroll={SelectScroll}
432
439
  {...currentSelectProps}
433
- getPopupContainer={() => document.getElementById('search_select_div')}
440
+ getPopupContainer={() => document.getElementById(`search_select_div_${makeUniqueValue()}`)}
434
441
  style={{ width: 'calc(100% - 30px)' }}
435
442
  placeholder="请选择"
436
443
  >