@bit-sun/business-component 2.2.17 → 2.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2082,6 +2082,8 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2082
2082
  isMap = _ref.isMap,
2083
2083
  fixedparameter = _ref.fixedparameter,
2084
2084
  fieldValToParam = _ref.fieldValToParam,
2085
+ _ref$fixedparamsDisab = _ref.fixedparamsDisabled,
2086
+ fixedparamsDisabled = _ref$fixedparamsDisab === void 0 ? false : _ref$fixedparamsDisab,
2085
2087
  _ref$mappingTextField = _ref.mappingTextField,
2086
2088
  mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
2087
2089
  mappingTextShowKeyField = _ref.mappingTextShowKeyField,
@@ -2109,6 +2111,12 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2109
2111
  optionLabelProp: "label",
2110
2112
  autoClearSearchValue: false
2111
2113
  });
2114
+ var tableInitPagination = {
2115
+ showQuickJumper: true,
2116
+ total: 0,
2117
+ current: 1,
2118
+ pageSize: tableInitPageSize
2119
+ };
2112
2120
  var _useState = useState([]),
2113
2121
  _useState2 = _slicedToArray(_useState, 2),
2114
2122
  items = _useState2[0],
@@ -2177,12 +2185,7 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2177
2185
  _useState20 = _slicedToArray(_useState19, 2),
2178
2186
  tableData = _useState20[0],
2179
2187
  setTableData = _useState20[1];
2180
- var _useState21 = useState({
2181
- showQuickJumper: true,
2182
- total: 0,
2183
- current: 1,
2184
- pageSize: tableInitPageSize
2185
- }),
2188
+ var _useState21 = useState(tableInitPagination),
2186
2189
  _useState22 = _slicedToArray(_useState21, 2),
2187
2190
  tablePagination = _useState22[0],
2188
2191
  setTablePagination = _useState22[1];
@@ -2231,10 +2234,21 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2231
2234
  },
2232
2235
  getTableFormRef: function getTableFormRef() {
2233
2236
  return form;
2237
+ },
2238
+ // 解决下拉框数据源的问题
2239
+ getSelectDataSource: function getSelectDataSource() {
2240
+ return items;
2241
+ },
2242
+ setSelectDataSource: function setSelectDataSource(list, listTotal) {
2243
+ setItems(list);
2244
+ setItemsTotal(listTotal);
2245
+ },
2246
+ refreshSelectDataSource: function refreshSelectDataSource() {
2247
+ refreshItems();
2234
2248
  }
2235
2249
  };
2236
2250
  });
2237
- // 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
2251
+ // 获取数据源 (type: 1下拉框 2/3弹框 不传值默认为下拉框)
2238
2252
  var getData = function getData() {
2239
2253
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2240
2254
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
@@ -2247,7 +2261,20 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2247
2261
  var fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
2248
2262
  if (fixedParamVal) {
2249
2263
  fixedParam[item] = fixedParamVal;
2250
- form.setFieldsValue(_objectSpread2(_objectSpread2({}, form === null || form === void 0 ? void 0 : form.getFieldsValue()), {}, _defineProperty({}, item, fixedParamVal)));
2264
+ // 解决依赖项在弹窗中回显/更改(如果不能更改,传参fixedparamsDisabled为true即可)
2265
+ if (type == 2 || type == 3) {
2266
+ var fixedChangeParamVal = form.getFieldValue(item);
2267
+ // 依赖项在弹窗form中更改--①更换依赖值;②去掉依赖值
2268
+ var isDependenceValueChange = fixedChangeParamVal && fixedChangeParamVal !== fixedParamVal || type == 2 && !fixedChangeParamVal;
2269
+ var dependenceValue = isDependenceValueChange ? fixedChangeParamVal : fixedParamVal;
2270
+ fixedParam[item] = dependenceValue;
2271
+ form.setFieldsValue(_objectSpread2(_objectSpread2({}, form === null || form === void 0 ? void 0 : form.getFieldsValue()), {}, _defineProperty({}, item, dependenceValue)));
2272
+ if (isDependenceValueChange) {
2273
+ ctx.form.setFieldValue(fieldValToParam[index], fixedChangeParamVal); // 更改依赖项
2274
+ ctx.form.setFieldValue(resultSourceKey, null); // 同时清空之前依赖项对应的选择项
2275
+ refreshItems();
2276
+ }
2277
+ }
2251
2278
  }
2252
2279
  });
2253
2280
  }
@@ -2457,7 +2484,7 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2457
2484
  getData({
2458
2485
  pageSize: tableInitPageSize,
2459
2486
  currentPage: 1
2460
- }, 2);
2487
+ }, 3);
2461
2488
  setIsModalVisible(true);
2462
2489
  // 回显
2463
2490
  if (value) {
@@ -2495,18 +2522,18 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2495
2522
  var handleSelectOver = function handleSelectOver(selectedValue) {
2496
2523
  if (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.length) {
2497
2524
  var _ctx$form2;
2498
- formaData(selectedValue);
2499
2525
  // 解决选择最后1页的sku,返回后,不显示名称问题
2500
2526
  var source = _.uniqBy(items.concat(selectedValue), 'value');
2501
2527
  ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldSource(resultSourceKey, source);
2502
2528
  setItems(source);
2529
+ formaData(selectedValue, source);
2503
2530
  }
2504
2531
  };
2505
2532
  var handleOk = function handleOk() {
2506
2533
  handleSelectOver(popvalue);
2507
2534
  handleCancel();
2508
2535
  };
2509
- var formaData = function formaData(value) {
2536
+ var formaData = function formaData(value, source) {
2510
2537
  if (labelInValue) {
2511
2538
  var formatResult = value.map(function (i) {
2512
2539
  return {
@@ -2515,17 +2542,26 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2515
2542
  value: i[mappingValueField]
2516
2543
  };
2517
2544
  });
2518
- onChange(selectMode ? formatResult : formatResult[0], value);
2545
+ onChange(selectMode ? formatResult : formatResult[0], value, source);
2519
2546
  } else {
2520
2547
  var _formatResult = selectMode ? value.map(function (i) {
2521
2548
  return i.value;
2522
2549
  }) : _.get(value[0], 'value');
2523
- onChange(_formatResult, value);
2550
+ onChange(_formatResult, value, source);
2524
2551
  }
2525
2552
  };
2526
- var handleCancel = function handleCancel() {
2553
+ var clearModalTable = function clearModalTable() {
2527
2554
  form.resetFields();
2528
2555
  setTableFormParams({});
2556
+ setTableData([]);
2557
+ setTablePagination(tableInitPagination);
2558
+ setSelectedRowKeys([]);
2559
+ setDoubleArr([]);
2560
+ setCheckedAll(false);
2561
+ setIndeterminate(false);
2562
+ };
2563
+ var handleCancel = function handleCancel() {
2564
+ clearModalTable();
2529
2565
  setIsModalVisible(false);
2530
2566
  if (selectMode) {
2531
2567
  run();
@@ -2533,7 +2569,7 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2533
2569
  };
2534
2570
  var refreshItems = function refreshItems() {
2535
2571
  // 查看是否存在关联值 如果有关联值 就查询 没有就不能查询
2536
- if (fieldValToParam && ctx) {
2572
+ if (fieldValToParam && ctx && fixedparamsDisabled) {
2537
2573
  var formValueList = [];
2538
2574
  fieldValToParam.forEach(function (item, index) {
2539
2575
  var fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
@@ -2707,11 +2743,7 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2707
2743
  var formItem = function formItem(list) {
2708
2744
  if (isModalVisible && (list === null || list === void 0 ? void 0 : list.length)) {
2709
2745
  var setDisabled = function setDisabled(name) {
2710
- var _requestConfig$fixedp = requestConfig.fixedparamsDisabled,
2711
- fixedparamsDisabled = _requestConfig$fixedp === void 0 ? false : _requestConfig$fixedp,
2712
- _requestConfig$fixedp2 = requestConfig.fixedparameter,
2713
- fixedparameter = _requestConfig$fixedp2 === void 0 ? [] : _requestConfig$fixedp2;
2714
- if (fixedparamsDisabled && fixedparameter.find(function (item) {
2746
+ if (fixedparamsDisabled && (fixedparameter === null || fixedparameter === void 0 ? void 0 : fixedparameter.length) && fixedparameter.find(function (item) {
2715
2747
  return item === name;
2716
2748
  })) {
2717
2749
  return true;
@@ -10498,10 +10530,10 @@ var AddSelect = function AddSelect(props) {
10498
10530
  });
10499
10531
  }
10500
10532
  if (businessType == 'skc') {
10501
- Promise.all([loadSelectSource("/items/item/propertyValue", {
10502
- pageSize: 5000,
10533
+ Promise.all([loadSelectSource("/items/item/propertyValue/sizeBySkcConfig", {
10534
+ pageSize: 10000,
10503
10535
  currentPage: 1,
10504
- 'qp-propertyId-eq': '1467042217951883265'
10536
+ type: 2 // 类型:1尺码;2颜色
10505
10537
  }), loadSelectSource("/items/category/queryCategoryTree", {
10506
10538
  pageSize: 5000,
10507
10539
  currentPage: 1
@@ -10628,8 +10660,6 @@ var AddSelect = function AddSelect(props) {
10628
10660
  message.error(Error);
10629
10661
  }
10630
10662
  handleLoading(isContinue, false);
10631
- }).finally(function () {
10632
- handleLoading(isContinue, false);
10633
10663
  });
10634
10664
  } else {
10635
10665
  !isContinue && handleCancel();
@@ -12809,6 +12839,10 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
12809
12839
  filter: 'qp-code,name-orGroup,like',
12810
12840
  mappingTextField: 'name',
12811
12841
  mappingValueField: 'code',
12842
+ otherParams: {
12843
+ 'qp-skcStatus-eq': 1 // 状态:0禁用 1启用
12844
+ },
12845
+
12812
12846
  sourceName: 'qp-skcCode-eq'
12813
12847
  }, requestConfigProp);
12814
12848
  tableSearchForm = [{
@@ -13825,6 +13859,11 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
13825
13859
  }
13826
13860
  // 配送方式选择器
13827
13861
  if (type === 'deliveryMode') {
13862
+ var _requestConfigProp$fi;
13863
+ var isLogisCompanyCodeSingleSearch = requestConfigProp === null || requestConfigProp === void 0 ? void 0 : (_requestConfigProp$fi = requestConfigProp.fixedparameter) === null || _requestConfigProp$fi === void 0 ? void 0 : _requestConfigProp$fi.some(function (i) {
13864
+ return i == 'qp-logisCompanyCode-eq';
13865
+ });
13866
+ var logisCompanyCodeSingleSearchName = isLogisCompanyCodeSingleSearch ? 'qp-logisCompanyCode-eq' : 'qp-logisCompanyCode-in';
13828
13867
  requestConfig = _objectSpread2({
13829
13868
  url: "".concat(prefixUrl.selectPrefix, "/deliveryMode"),
13830
13869
  filter: 'qp-name,code-orGroup,like',
@@ -13843,23 +13882,24 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
13843
13882
  name: 'qp-code-like',
13844
13883
  label: '配送方式编码'
13845
13884
  }, {
13846
- name: 'qp-logisCompanyCode-in',
13885
+ name: logisCompanyCodeSingleSearchName,
13847
13886
  type: 'select',
13848
13887
  label: '所属物流商',
13849
13888
  field: {
13850
13889
  type: 'select',
13851
- props: {
13890
+ props: _objectSpread2(_objectSpread2({}, isLogisCompanyCodeSingleSearch ? {} : {
13852
13891
  mode: 'multiple',
13892
+ maxTagCount: 1
13893
+ }), {}, {
13853
13894
  notFoundContent: '暂无数据',
13854
13895
  allowClear: true,
13855
13896
  showSearch: true,
13856
13897
  showArrow: true,
13857
- maxTagCount: 1,
13858
13898
  optionFilterProp: 'children',
13859
13899
  filterOption: function filterOption(input, option) {
13860
13900
  return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
13861
13901
  }
13862
- }
13902
+ })
13863
13903
  }
13864
13904
  }, {
13865
13905
  name: 'qp-recordChannnelCode-in',
@@ -14401,7 +14441,7 @@ var AddSkcSelect = function AddSkcSelect(parProps) {
14401
14441
  setPropertyList = _useState6[1];
14402
14442
  useEffect(function () {
14403
14443
  // type: 1 尺码组; 2 配码组
14404
- axios.get("/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2").then(function (result) {
14444
+ axios.get("/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2&qp-status-eq=1").then(function (result) {
14405
14445
  var _result, _result2;
14406
14446
  result = result.data;
14407
14447
  if (((_result = result) === null || _result === void 0 ? void 0 : _result.status) && result.status !== '0' || ((_result2 = result) === null || _result2 === void 0 ? void 0 : _result2.code) && result.code !== '000000') {
@@ -22155,6 +22195,43 @@ var index$6 = /*#__PURE__*/forwardRef(function (props, ref) {
22155
22195
  _useState8 = _slicedToArray(_useState7, 2),
22156
22196
  multiTableData = _useState8[0],
22157
22197
  setMmultiTableData = _useState8[1]; //多表头数据
22198
+ var _useState9 = useState(10),
22199
+ _useState10 = _slicedToArray(_useState9, 2),
22200
+ viewCount = _useState10[0],
22201
+ setViewCount = _useState10[1]; //虚拟表格每次渲染数量
22202
+ var itemWidth = 100; // 表格每一项宽度
22203
+ var viewPort = useRef(null);
22204
+ //起始渲染item
22205
+ var _useState11 = useState(0),
22206
+ _useState12 = _slicedToArray(_useState11, 2),
22207
+ startIndex = _useState12[0],
22208
+ setStartIndex = _useState12[1];
22209
+ //结束渲染item
22210
+ var endIndex = useMemo(function () {
22211
+ return startIndex + viewCount;
22212
+ }, [startIndex, viewCount]);
22213
+ //表格偏移量
22214
+ var _useState13 = useState(0),
22215
+ _useState14 = _slicedToArray(_useState13, 2),
22216
+ offsetWidth = _useState14[0],
22217
+ setOffset = _useState14[1];
22218
+ useEffect(function () {
22219
+ var viewPortWidth = viewPort.current.clientWidth;
22220
+ var defaultTableWidth = viewPortWidth - (props.colHeaderWidth || 400);
22221
+ var viewCount = Math.floor(defaultTableWidth / itemWidth) + 2 <= 10 ? 10 : Math.floor(defaultTableWidth / itemWidth) + 2;
22222
+ setViewCount(viewCount);
22223
+ }, []);
22224
+ var onScroll = function onScroll() {
22225
+ var scrollWidth = viewPort.current.scrollLeft;
22226
+ var startIndex = Math.floor(scrollWidth / itemWidth);
22227
+ var offsetWidth = startIndex * itemWidth;
22228
+ setStartIndex(startIndex);
22229
+ setOffset(offsetWidth);
22230
+ };
22231
+ // 占位符,表格列总宽度
22232
+ var placeholderWidth = useMemo(function () {
22233
+ return colTableData.length * 100;
22234
+ }, [colTableData]);
22158
22235
  useImperativeHandle(ref, function () {
22159
22236
  return {
22160
22237
  // 暴露子组件刷新表格方法出去,父组件可以调用该方法刷新表格数据
@@ -22234,15 +22311,24 @@ var index$6 = /*#__PURE__*/forwardRef(function (props, ref) {
22234
22311
  var tableWidth = width ? "".concat(width, "px") : '100%';
22235
22312
  var tableHeight = "".concat(height || 400, "px");
22236
22313
  var rightAreaWidth = 'calc(100% - ' + "".concat(config.colHeaderWidth, "px") + ')';
22237
- console.log('reder');
22238
22314
  return /*#__PURE__*/React.createElement("div", {
22239
22315
  style: {
22240
22316
  width: tableWidth,
22241
22317
  height: tableHeight
22242
22318
  },
22243
22319
  key: 'moreTreeTable',
22244
- className: 'editTableWrapper'
22245
- }, /*#__PURE__*/React.createElement("table", {
22320
+ className: 'editTableWrapper',
22321
+ onScroll: onScroll,
22322
+ ref: viewPort
22323
+ }, /*#__PURE__*/React.createElement("div", {
22324
+ style: {
22325
+ width: "".concat(config.colHeaderWidth + 1 + placeholderWidth, "px"),
22326
+ position: 'absolute',
22327
+ top: 0,
22328
+ left: 0,
22329
+ height: '100%'
22330
+ }
22331
+ }), /*#__PURE__*/React.createElement("table", {
22246
22332
  style: {
22247
22333
  width: "".concat(config.colHeaderWidth + 1, "px"),
22248
22334
  height: "".concat(config.colHeaderToTop, "px"),
@@ -22320,17 +22406,18 @@ var index$6 = /*#__PURE__*/forwardRef(function (props, ref) {
22320
22406
  className: 'value_table'.concat(" ", 'table_border_style')
22321
22407
  }, /*#__PURE__*/React.createElement("table", {
22322
22408
  style: {
22323
- width: '100%',
22324
- display: config.tableType === 'col-header-table' ? '' : 'none'
22409
+ width: '800px',
22410
+ display: config.tableType === 'col-header-table' ? '' : 'none',
22411
+ transform: "translateX(".concat(offsetWidth, "px)")
22325
22412
  },
22326
22413
  className: 'editTable__block'.concat(" ", 'table_border_style')
22327
22414
  }, /*#__PURE__*/React.createElement("tbody", null, config.colLastData.map(function (item, index) {
22328
22415
  var fixedTop = item.fixed ? "".concat(index * 40 + config.colHeaderToTop, "px") : 0;
22329
- return /*#__PURE__*/React.createElement("tr", null, colTableData.map(function (record, index) {
22416
+ return /*#__PURE__*/React.createElement("tr", null, colTableData.slice(startIndex, endIndex + 1).map(function (record, index) {
22330
22417
  return /*#__PURE__*/React.createElement("td", {
22331
22418
  style: {
22332
22419
  background: index % 2 === 1 || item.fixed ? '#f7f8fb' : '#fff',
22333
- width: '100px',
22420
+ width: "".concat(itemWidth, "px"),
22334
22421
  height: '40px',
22335
22422
  position: item.fixed ? 'sticky' : '',
22336
22423
  top: fixedTop,
package/dist/index.js CHANGED
@@ -2100,6 +2100,8 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2100
2100
  isMap = _ref.isMap,
2101
2101
  fixedparameter = _ref.fixedparameter,
2102
2102
  fieldValToParam = _ref.fieldValToParam,
2103
+ _ref$fixedparamsDisab = _ref.fixedparamsDisabled,
2104
+ fixedparamsDisabled = _ref$fixedparamsDisab === void 0 ? false : _ref$fixedparamsDisab,
2103
2105
  _ref$mappingTextField = _ref.mappingTextField,
2104
2106
  mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
2105
2107
  mappingTextShowKeyField = _ref.mappingTextShowKeyField,
@@ -2127,6 +2129,12 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2127
2129
  optionLabelProp: "label",
2128
2130
  autoClearSearchValue: false
2129
2131
  });
2132
+ var tableInitPagination = {
2133
+ showQuickJumper: true,
2134
+ total: 0,
2135
+ current: 1,
2136
+ pageSize: tableInitPageSize
2137
+ };
2130
2138
  var _useState = React.useState([]),
2131
2139
  _useState2 = _slicedToArray(_useState, 2),
2132
2140
  items = _useState2[0],
@@ -2195,12 +2203,7 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2195
2203
  _useState20 = _slicedToArray(_useState19, 2),
2196
2204
  tableData = _useState20[0],
2197
2205
  setTableData = _useState20[1];
2198
- var _useState21 = React.useState({
2199
- showQuickJumper: true,
2200
- total: 0,
2201
- current: 1,
2202
- pageSize: tableInitPageSize
2203
- }),
2206
+ var _useState21 = React.useState(tableInitPagination),
2204
2207
  _useState22 = _slicedToArray(_useState21, 2),
2205
2208
  tablePagination = _useState22[0],
2206
2209
  setTablePagination = _useState22[1];
@@ -2249,10 +2252,21 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2249
2252
  },
2250
2253
  getTableFormRef: function getTableFormRef() {
2251
2254
  return form;
2255
+ },
2256
+ // 解决下拉框数据源的问题
2257
+ getSelectDataSource: function getSelectDataSource() {
2258
+ return items;
2259
+ },
2260
+ setSelectDataSource: function setSelectDataSource(list, listTotal) {
2261
+ setItems(list);
2262
+ setItemsTotal(listTotal);
2263
+ },
2264
+ refreshSelectDataSource: function refreshSelectDataSource() {
2265
+ refreshItems();
2252
2266
  }
2253
2267
  };
2254
2268
  });
2255
- // 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
2269
+ // 获取数据源 (type: 1下拉框 2/3弹框 不传值默认为下拉框)
2256
2270
  var getData = function getData() {
2257
2271
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2258
2272
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
@@ -2265,7 +2279,20 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2265
2279
  var fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
2266
2280
  if (fixedParamVal) {
2267
2281
  fixedParam[item] = fixedParamVal;
2268
- form.setFieldsValue(_objectSpread2(_objectSpread2({}, form === null || form === void 0 ? void 0 : form.getFieldsValue()), {}, _defineProperty({}, item, fixedParamVal)));
2282
+ // 解决依赖项在弹窗中回显/更改(如果不能更改,传参fixedparamsDisabled为true即可)
2283
+ if (type == 2 || type == 3) {
2284
+ var fixedChangeParamVal = form.getFieldValue(item);
2285
+ // 依赖项在弹窗form中更改--①更换依赖值;②去掉依赖值
2286
+ var isDependenceValueChange = fixedChangeParamVal && fixedChangeParamVal !== fixedParamVal || type == 2 && !fixedChangeParamVal;
2287
+ var dependenceValue = isDependenceValueChange ? fixedChangeParamVal : fixedParamVal;
2288
+ fixedParam[item] = dependenceValue;
2289
+ form.setFieldsValue(_objectSpread2(_objectSpread2({}, form === null || form === void 0 ? void 0 : form.getFieldsValue()), {}, _defineProperty({}, item, dependenceValue)));
2290
+ if (isDependenceValueChange) {
2291
+ ctx.form.setFieldValue(fieldValToParam[index], fixedChangeParamVal); // 更改依赖项
2292
+ ctx.form.setFieldValue(resultSourceKey, null); // 同时清空之前依赖项对应的选择项
2293
+ refreshItems();
2294
+ }
2295
+ }
2269
2296
  }
2270
2297
  });
2271
2298
  }
@@ -2475,7 +2502,7 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2475
2502
  getData({
2476
2503
  pageSize: tableInitPageSize,
2477
2504
  currentPage: 1
2478
- }, 2);
2505
+ }, 3);
2479
2506
  setIsModalVisible(true);
2480
2507
  // 回显
2481
2508
  if (value) {
@@ -2513,18 +2540,18 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2513
2540
  var handleSelectOver = function handleSelectOver(selectedValue) {
2514
2541
  if (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.length) {
2515
2542
  var _ctx$form2;
2516
- formaData(selectedValue);
2517
2543
  // 解决选择最后1页的sku,返回后,不显示名称问题
2518
2544
  var source = ___default['default'].uniqBy(items.concat(selectedValue), 'value');
2519
2545
  ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldSource(resultSourceKey, source);
2520
2546
  setItems(source);
2547
+ formaData(selectedValue, source);
2521
2548
  }
2522
2549
  };
2523
2550
  var handleOk = function handleOk() {
2524
2551
  handleSelectOver(popvalue);
2525
2552
  handleCancel();
2526
2553
  };
2527
- var formaData = function formaData(value) {
2554
+ var formaData = function formaData(value, source) {
2528
2555
  if (labelInValue) {
2529
2556
  var formatResult = value.map(function (i) {
2530
2557
  return {
@@ -2533,17 +2560,26 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2533
2560
  value: i[mappingValueField]
2534
2561
  };
2535
2562
  });
2536
- onChange(selectMode ? formatResult : formatResult[0], value);
2563
+ onChange(selectMode ? formatResult : formatResult[0], value, source);
2537
2564
  } else {
2538
2565
  var _formatResult = selectMode ? value.map(function (i) {
2539
2566
  return i.value;
2540
2567
  }) : ___default['default'].get(value[0], 'value');
2541
- onChange(_formatResult, value);
2568
+ onChange(_formatResult, value, source);
2542
2569
  }
2543
2570
  };
2544
- var handleCancel = function handleCancel() {
2571
+ var clearModalTable = function clearModalTable() {
2545
2572
  form.resetFields();
2546
2573
  setTableFormParams({});
2574
+ setTableData([]);
2575
+ setTablePagination(tableInitPagination);
2576
+ setSelectedRowKeys([]);
2577
+ setDoubleArr([]);
2578
+ setCheckedAll(false);
2579
+ setIndeterminate(false);
2580
+ };
2581
+ var handleCancel = function handleCancel() {
2582
+ clearModalTable();
2547
2583
  setIsModalVisible(false);
2548
2584
  if (selectMode) {
2549
2585
  run();
@@ -2551,7 +2587,7 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2551
2587
  };
2552
2588
  var refreshItems = function refreshItems() {
2553
2589
  // 查看是否存在关联值 如果有关联值 就查询 没有就不能查询
2554
- if (fieldValToParam && ctx) {
2590
+ if (fieldValToParam && ctx && fixedparamsDisabled) {
2555
2591
  var formValueList = [];
2556
2592
  fieldValToParam.forEach(function (item, index) {
2557
2593
  var fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
@@ -2725,11 +2761,7 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2725
2761
  var formItem = function formItem(list) {
2726
2762
  if (isModalVisible && (list === null || list === void 0 ? void 0 : list.length)) {
2727
2763
  var setDisabled = function setDisabled(name) {
2728
- var _requestConfig$fixedp = requestConfig.fixedparamsDisabled,
2729
- fixedparamsDisabled = _requestConfig$fixedp === void 0 ? false : _requestConfig$fixedp,
2730
- _requestConfig$fixedp2 = requestConfig.fixedparameter,
2731
- fixedparameter = _requestConfig$fixedp2 === void 0 ? [] : _requestConfig$fixedp2;
2732
- if (fixedparamsDisabled && fixedparameter.find(function (item) {
2764
+ if (fixedparamsDisabled && (fixedparameter === null || fixedparameter === void 0 ? void 0 : fixedparameter.length) && fixedparameter.find(function (item) {
2733
2765
  return item === name;
2734
2766
  })) {
2735
2767
  return true;
@@ -10516,10 +10548,10 @@ var AddSelect = function AddSelect(props) {
10516
10548
  });
10517
10549
  }
10518
10550
  if (businessType == 'skc') {
10519
- Promise.all([loadSelectSource("/items/item/propertyValue", {
10520
- pageSize: 5000,
10551
+ Promise.all([loadSelectSource("/items/item/propertyValue/sizeBySkcConfig", {
10552
+ pageSize: 10000,
10521
10553
  currentPage: 1,
10522
- 'qp-propertyId-eq': '1467042217951883265'
10554
+ type: 2 // 类型:1尺码;2颜色
10523
10555
  }), loadSelectSource("/items/category/queryCategoryTree", {
10524
10556
  pageSize: 5000,
10525
10557
  currentPage: 1
@@ -10646,8 +10678,6 @@ var AddSelect = function AddSelect(props) {
10646
10678
  antd.message.error(Error);
10647
10679
  }
10648
10680
  handleLoading(isContinue, false);
10649
- }).finally(function () {
10650
- handleLoading(isContinue, false);
10651
10681
  });
10652
10682
  } else {
10653
10683
  !isContinue && handleCancel();
@@ -12827,6 +12857,10 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
12827
12857
  filter: 'qp-code,name-orGroup,like',
12828
12858
  mappingTextField: 'name',
12829
12859
  mappingValueField: 'code',
12860
+ otherParams: {
12861
+ 'qp-skcStatus-eq': 1 // 状态:0禁用 1启用
12862
+ },
12863
+
12830
12864
  sourceName: 'qp-skcCode-eq'
12831
12865
  }, requestConfigProp);
12832
12866
  tableSearchForm = [{
@@ -13843,6 +13877,11 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
13843
13877
  }
13844
13878
  // 配送方式选择器
13845
13879
  if (type === 'deliveryMode') {
13880
+ var _requestConfigProp$fi;
13881
+ var isLogisCompanyCodeSingleSearch = requestConfigProp === null || requestConfigProp === void 0 ? void 0 : (_requestConfigProp$fi = requestConfigProp.fixedparameter) === null || _requestConfigProp$fi === void 0 ? void 0 : _requestConfigProp$fi.some(function (i) {
13882
+ return i == 'qp-logisCompanyCode-eq';
13883
+ });
13884
+ var logisCompanyCodeSingleSearchName = isLogisCompanyCodeSingleSearch ? 'qp-logisCompanyCode-eq' : 'qp-logisCompanyCode-in';
13846
13885
  requestConfig = _objectSpread2({
13847
13886
  url: "".concat(prefixUrl.selectPrefix, "/deliveryMode"),
13848
13887
  filter: 'qp-name,code-orGroup,like',
@@ -13861,23 +13900,24 @@ function commonFun(type, prefixUrl, requestConfigProp, modalTableBusProps) {
13861
13900
  name: 'qp-code-like',
13862
13901
  label: '配送方式编码'
13863
13902
  }, {
13864
- name: 'qp-logisCompanyCode-in',
13903
+ name: logisCompanyCodeSingleSearchName,
13865
13904
  type: 'select',
13866
13905
  label: '所属物流商',
13867
13906
  field: {
13868
13907
  type: 'select',
13869
- props: {
13908
+ props: _objectSpread2(_objectSpread2({}, isLogisCompanyCodeSingleSearch ? {} : {
13870
13909
  mode: 'multiple',
13910
+ maxTagCount: 1
13911
+ }), {}, {
13871
13912
  notFoundContent: '暂无数据',
13872
13913
  allowClear: true,
13873
13914
  showSearch: true,
13874
13915
  showArrow: true,
13875
- maxTagCount: 1,
13876
13916
  optionFilterProp: 'children',
13877
13917
  filterOption: function filterOption(input, option) {
13878
13918
  return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
13879
13919
  }
13880
- }
13920
+ })
13881
13921
  }
13882
13922
  }, {
13883
13923
  name: 'qp-recordChannnelCode-in',
@@ -14419,7 +14459,7 @@ var AddSkcSelect = function AddSkcSelect(parProps) {
14419
14459
  setPropertyList = _useState6[1];
14420
14460
  React.useEffect(function () {
14421
14461
  // type: 1 尺码组; 2 配码组
14422
- axios__default['default'].get("/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2").then(function (result) {
14462
+ axios__default['default'].get("/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2&qp-status-eq=1").then(function (result) {
14423
14463
  var _result, _result2;
14424
14464
  result = result.data;
14425
14465
  if (((_result = result) === null || _result === void 0 ? void 0 : _result.status) && result.status !== '0' || ((_result2 = result) === null || _result2 === void 0 ? void 0 : _result2.code) && result.code !== '000000') {
@@ -22173,6 +22213,43 @@ var index$6 = /*#__PURE__*/React.forwardRef(function (props, ref) {
22173
22213
  _useState8 = _slicedToArray(_useState7, 2),
22174
22214
  multiTableData = _useState8[0],
22175
22215
  setMmultiTableData = _useState8[1]; //多表头数据
22216
+ var _useState9 = React.useState(10),
22217
+ _useState10 = _slicedToArray(_useState9, 2),
22218
+ viewCount = _useState10[0],
22219
+ setViewCount = _useState10[1]; //虚拟表格每次渲染数量
22220
+ var itemWidth = 100; // 表格每一项宽度
22221
+ var viewPort = React.useRef(null);
22222
+ //起始渲染item
22223
+ var _useState11 = React.useState(0),
22224
+ _useState12 = _slicedToArray(_useState11, 2),
22225
+ startIndex = _useState12[0],
22226
+ setStartIndex = _useState12[1];
22227
+ //结束渲染item
22228
+ var endIndex = React.useMemo(function () {
22229
+ return startIndex + viewCount;
22230
+ }, [startIndex, viewCount]);
22231
+ //表格偏移量
22232
+ var _useState13 = React.useState(0),
22233
+ _useState14 = _slicedToArray(_useState13, 2),
22234
+ offsetWidth = _useState14[0],
22235
+ setOffset = _useState14[1];
22236
+ React.useEffect(function () {
22237
+ var viewPortWidth = viewPort.current.clientWidth;
22238
+ var defaultTableWidth = viewPortWidth - (props.colHeaderWidth || 400);
22239
+ var viewCount = Math.floor(defaultTableWidth / itemWidth) + 2 <= 10 ? 10 : Math.floor(defaultTableWidth / itemWidth) + 2;
22240
+ setViewCount(viewCount);
22241
+ }, []);
22242
+ var onScroll = function onScroll() {
22243
+ var scrollWidth = viewPort.current.scrollLeft;
22244
+ var startIndex = Math.floor(scrollWidth / itemWidth);
22245
+ var offsetWidth = startIndex * itemWidth;
22246
+ setStartIndex(startIndex);
22247
+ setOffset(offsetWidth);
22248
+ };
22249
+ // 占位符,表格列总宽度
22250
+ var placeholderWidth = React.useMemo(function () {
22251
+ return colTableData.length * 100;
22252
+ }, [colTableData]);
22176
22253
  React.useImperativeHandle(ref, function () {
22177
22254
  return {
22178
22255
  // 暴露子组件刷新表格方法出去,父组件可以调用该方法刷新表格数据
@@ -22252,15 +22329,24 @@ var index$6 = /*#__PURE__*/React.forwardRef(function (props, ref) {
22252
22329
  var tableWidth = width ? "".concat(width, "px") : '100%';
22253
22330
  var tableHeight = "".concat(height || 400, "px");
22254
22331
  var rightAreaWidth = 'calc(100% - ' + "".concat(config.colHeaderWidth, "px") + ')';
22255
- console.log('reder');
22256
22332
  return /*#__PURE__*/React__default['default'].createElement("div", {
22257
22333
  style: {
22258
22334
  width: tableWidth,
22259
22335
  height: tableHeight
22260
22336
  },
22261
22337
  key: 'moreTreeTable',
22262
- className: 'editTableWrapper'
22263
- }, /*#__PURE__*/React__default['default'].createElement("table", {
22338
+ className: 'editTableWrapper',
22339
+ onScroll: onScroll,
22340
+ ref: viewPort
22341
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
22342
+ style: {
22343
+ width: "".concat(config.colHeaderWidth + 1 + placeholderWidth, "px"),
22344
+ position: 'absolute',
22345
+ top: 0,
22346
+ left: 0,
22347
+ height: '100%'
22348
+ }
22349
+ }), /*#__PURE__*/React__default['default'].createElement("table", {
22264
22350
  style: {
22265
22351
  width: "".concat(config.colHeaderWidth + 1, "px"),
22266
22352
  height: "".concat(config.colHeaderToTop, "px"),
@@ -22338,17 +22424,18 @@ var index$6 = /*#__PURE__*/React.forwardRef(function (props, ref) {
22338
22424
  className: 'value_table'.concat(" ", 'table_border_style')
22339
22425
  }, /*#__PURE__*/React__default['default'].createElement("table", {
22340
22426
  style: {
22341
- width: '100%',
22342
- display: config.tableType === 'col-header-table' ? '' : 'none'
22427
+ width: '800px',
22428
+ display: config.tableType === 'col-header-table' ? '' : 'none',
22429
+ transform: "translateX(".concat(offsetWidth, "px)")
22343
22430
  },
22344
22431
  className: 'editTable__block'.concat(" ", 'table_border_style')
22345
22432
  }, /*#__PURE__*/React__default['default'].createElement("tbody", null, config.colLastData.map(function (item, index) {
22346
22433
  var fixedTop = item.fixed ? "".concat(index * 40 + config.colHeaderToTop, "px") : 0;
22347
- return /*#__PURE__*/React__default['default'].createElement("tr", null, colTableData.map(function (record, index) {
22434
+ return /*#__PURE__*/React__default['default'].createElement("tr", null, colTableData.slice(startIndex, endIndex + 1).map(function (record, index) {
22348
22435
  return /*#__PURE__*/React__default['default'].createElement("td", {
22349
22436
  style: {
22350
22437
  background: index % 2 === 1 || item.fixed ? '#f7f8fb' : '#fff',
22351
- width: '100px',
22438
+ width: "".concat(itemWidth, "px"),
22352
22439
  height: '40px',
22353
22440
  position: item.fixed ? 'sticky' : '',
22354
22441
  top: fixedTop,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.2.17",
3
+ "version": "2.2.19",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -355,7 +355,7 @@ export const AddSkcSelect = (parProps: any) => {
355
355
 
356
356
  useEffect(() => {
357
357
  // type: 1 尺码组; 2 配码组
358
- axios.get(`/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2`).then((result: any) => {
358
+ axios.get(`/items/itemPropertyValueGroup/listNoPage?qp-type-eq=2&qp-status-eq=1`).then((result: any) => {
359
359
  result = result.data;
360
360
  if ((result?.status && result.status !== '0') || (result?.code && result.code !== '000000')) {
361
361
  message.error(result.msg);
@@ -616,6 +616,9 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
616
616
  filter: 'qp-code,name-orGroup,like', // 过滤参数
617
617
  mappingTextField: 'name',
618
618
  mappingValueField: 'code',
619
+ otherParams: {
620
+ 'qp-skcStatus-eq': 1, // 状态:0禁用 1启用
621
+ }, // 默认参数
619
622
  sourceName: 'qp-skcCode-eq',
620
623
  ...requestConfigProp,
621
624
  }
@@ -1569,6 +1572,8 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
1569
1572
 
1570
1573
  // 配送方式选择器
1571
1574
  if(type === 'deliveryMode') {
1575
+ const isLogisCompanyCodeSingleSearch = requestConfigProp?.fixedparameter?.some((i: any) => i == 'qp-logisCompanyCode-eq');
1576
+ const logisCompanyCodeSingleSearchName = isLogisCompanyCodeSingleSearch ? 'qp-logisCompanyCode-eq' : 'qp-logisCompanyCode-in';
1572
1577
  requestConfig = {
1573
1578
  url: `${prefixUrl.selectPrefix}/deliveryMode`,
1574
1579
  filter: 'qp-name,code-orGroup,like', // 过滤参数
@@ -1584,15 +1589,17 @@ export function commonFun (type?: string, prefixUrl: any, requestConfigProp?: an
1584
1589
  tableSearchForm = [
1585
1590
  { name: 'qp-name-like', label: '配送方式名称' },
1586
1591
  { name: 'qp-code-like', label: '配送方式编码' },
1587
- { name: 'qp-logisCompanyCode-in', type: 'select', label: '所属物流商', field: {
1592
+ { name: logisCompanyCodeSingleSearchName, type: 'select', label: '所属物流商', field: {
1588
1593
  type: 'select',
1589
1594
  props: {
1590
- mode: 'multiple',
1595
+ ...(isLogisCompanyCodeSingleSearch ? {} : {
1596
+ mode: 'multiple',
1597
+ maxTagCount: 1,
1598
+ }),
1591
1599
  notFoundContent: '暂无数据',
1592
1600
  allowClear: true,
1593
1601
  showSearch: true,
1594
1602
  showArrow: true,
1595
- maxTagCount: 1,
1596
1603
  optionFilterProp: 'children',
1597
1604
  filterOption: (input: string, option: { props: { children: string } }) =>
1598
1605
  option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0,
@@ -20,6 +20,34 @@ import React, { useState, useRef } from 'react';
20
20
 
21
21
  export default () => {
22
22
  const colTableRef = useRef(null);
23
+
24
+ let colTableData = [];
25
+ for (let i = 1; i < 10001; i++) {
26
+ colTableData.push({
27
+ '1111-1-2': '1',
28
+ '1111-1-3': '2',
29
+ '1111-2-2': '3',
30
+ '1111-2-3': '4',
31
+ '1111-3-2': '5',
32
+ '2222-3-3': '6',
33
+ '2222-4': '7',
34
+ 'fixed1': '标题1',
35
+ 'fixed2': `标题1-${i}`,
36
+ })
37
+ }
38
+ for (let j = 1; j < 10001; j++) {
39
+ colTableData.push({
40
+ '1111-1-2': '1',
41
+ '1111-1-3': '2',
42
+ '1111-2-2': '3',
43
+ '1111-2-3': '4',
44
+ '1111-3-2': '5',
45
+ '2222-3-3': '6',
46
+ '2222-4': '7',
47
+ 'fixed1': '标题2',
48
+ 'fixed2': `标题2-${j}`,
49
+ })
50
+ }
23
51
  const data = {
24
52
  colHead: [
25
53
  {
@@ -148,95 +176,7 @@ export default () => {
148
176
  },
149
177
  ],
150
178
  //纵向表头数据
151
- tableValue2: [
152
- {
153
- '1111-1-2': '1',
154
- '1111-1-3': '2',
155
- '1111-2-2': '3',
156
- '1111-2-3': '4',
157
- '1111-3-2': '5',
158
- '2222-3-3': '6',
159
- '2222-4': '7',
160
- 'fixed1': '标题1',
161
- 'fixed2': '标题1-1',
162
- },
163
- {
164
- '1111-1-2': '1',
165
- '1111-1-3': '2',
166
- '1111-2-2': '3',
167
- '1111-2-3': '4',
168
- '1111-3-2': '5',
169
- '2222-3-3': '6',
170
- '2222-4': '7',
171
- 'fixed1': '标题1',
172
- 'fixed2': '标题1-2',
173
- },
174
- {
175
- '1111-1-2': '1',
176
- '1111-1-3': '2',
177
- '1111-2-2': '3',
178
- '1111-2-3': '4',
179
- '1111-3-2': '5',
180
- '2222-3-3': '6',
181
- '2222-4': '7',
182
- 'fixed1': '标题1',
183
- 'fixed2': '标题1-3',
184
- },
185
- {
186
- '1111-1-2': '1',
187
- '1111-1-3': '2',
188
- '1111-2-2': '3',
189
- '1111-2-3': '4',
190
- '1111-3-2': '5',
191
- '2222-3-3': '6',
192
- '2222-4': '7',
193
- 'fixed1': '标题1',
194
- 'fixed2': '标题1-4',
195
- },
196
- {
197
- '1111-1-2': '1',
198
- '1111-1-3': '2',
199
- '1111-2-2': '3',
200
- '1111-2-3': '4',
201
- '1111-3-2': '5',
202
- '2222-3-3': '6',
203
- '2222-4': '7',
204
- 'fixed1': '标题1',
205
- 'fixed2': '标题1-5',
206
- },
207
- {
208
- 'fixed1': '标题2',
209
- 'fixed2': '标题2-1',
210
- },
211
- {
212
- 'fixed1': '标题2',
213
- 'fixed2': '标题2-2',
214
- },
215
- {
216
- 'fixed1': '标题2',
217
- 'fixed2': '标题2-3',
218
- },
219
- {
220
- 'fixed1': '标题2',
221
- 'fixed2': '标题2-4',
222
- },
223
- {
224
- 'fixed1': '标题2',
225
- 'fixed2': '标题2-5',
226
- },
227
- {
228
- 'fixed1': '标题2',
229
- 'fixed2': '标题2-6',
230
- },
231
- {
232
- 'fixed1': '标题2',
233
- 'fixed2': '标题2-7',
234
- },
235
- {
236
- 'fixed1': '标题2',
237
- 'fixed2': '标题2-8',
238
- },
239
- ],
179
+ tableValue2: colTableData,
240
180
  };
241
181
  return (
242
182
  <MoreTreeTable
@@ -1,5 +1,5 @@
1
1
  // @ts-nocheck
2
- import React, { useState, useEffect, useImperativeHandle, forwardRef } from 'react';
2
+ import React, { useState, useEffect, useImperativeHandle, forwardRef, useMemo, useRef } from 'react';
3
3
  import { getAllColumns, convertToRows, headersToRows } from './utils';
4
4
  import './index.less';
5
5
 
@@ -17,6 +17,41 @@ export default forwardRef((props, ref) => {
17
17
  });
18
18
  const [colTableData, setColTableData] = useState([]); //纵向表头数据
19
19
  const [multiTableData, setMmultiTableData] = useState({}); //多表头数据
20
+ const [viewCount, setViewCount] = useState(10); //虚拟表格每次渲染数量
21
+ const itemWidth = 100; // 表格每一项宽度
22
+
23
+ const viewPort = useRef(null);
24
+
25
+ //起始渲染item
26
+ const [startIndex, setStartIndex] = useState(0);
27
+
28
+ //结束渲染item
29
+ const endIndex = useMemo(() => {
30
+ return startIndex + viewCount;
31
+ }, [startIndex, viewCount])
32
+
33
+ //表格偏移量
34
+ const [offsetWidth, setOffset] = useState(0);
35
+
36
+ useEffect(() => { //根据容器宽度计算每次渲染个数
37
+ let viewPortWidth = viewPort.current.clientWidth;
38
+ let defaultTableWidth = viewPortWidth - (props.colHeaderWidth || 400);
39
+ let viewCount = Math.floor(defaultTableWidth/itemWidth) + 2 <= 10 ? 10 : Math.floor(defaultTableWidth/itemWidth) + 2;
40
+ setViewCount(viewCount)
41
+ }, [])
42
+
43
+ const onScroll = () => {
44
+ const scrollWidth = viewPort.current.scrollLeft;
45
+ const startIndex = Math.floor(scrollWidth/itemWidth);
46
+ const offsetWidth = startIndex * itemWidth;
47
+ setStartIndex(startIndex);
48
+ setOffset(offsetWidth);
49
+ }
50
+
51
+ // 占位符,表格列总宽度
52
+ const placeholderWidth = useMemo(() => {
53
+ return colTableData.length*100
54
+ }, [colTableData])
20
55
 
21
56
 
22
57
  useImperativeHandle(ref, () => ({
@@ -94,6 +129,7 @@ export default forwardRef((props, ref) => {
94
129
  getDataSource: getDataSource,
95
130
  }
96
131
 
132
+
97
133
 
98
134
  // if (!show) {
99
135
  // return <div>loading</div>;
@@ -103,13 +139,22 @@ export default forwardRef((props, ref) => {
103
139
  let tableWidth = width ? `${width}px` : '100%';
104
140
  let tableHeight = `${height || 400}px`;
105
141
  const rightAreaWidth = 'calc(100% - ' + `${config.colHeaderWidth}px` + ')';
106
- console.log('reder')
107
142
  return (
108
143
  <div
109
144
  style={{width: tableWidth, height: tableHeight}}
110
145
  key='moreTreeTable'
111
146
  className={'editTableWrapper'}
147
+ onScroll={onScroll}
148
+ ref={viewPort}
112
149
  >
150
+ <div style={{
151
+ width: `${config.colHeaderWidth + 1 + placeholderWidth}px`,
152
+ position: 'absolute',
153
+ top: 0,
154
+ left: 0,
155
+ height: '100%',
156
+ }}
157
+ ></div>
113
158
  {/* -------------------------------------左上角区域--------------------------------------- */}
114
159
  <table
115
160
  style={{
@@ -234,8 +279,9 @@ export default forwardRef((props, ref) => {
234
279
  {/* ------------------------------------纵向表头数据-------------------------------------- */}
235
280
  <table
236
281
  style={{
237
- width: '100%',
282
+ width: '800px',
238
283
  display: config.tableType === 'col-header-table' ? '' : 'none',
284
+ transform: `translateX(${offsetWidth}px)`
239
285
  }}
240
286
  className={`${'editTable__block'} ${'table_border_style'}`}
241
287
  >
@@ -244,12 +290,12 @@ export default forwardRef((props, ref) => {
244
290
  let fixedTop = item.fixed ? `${index*40 + config.colHeaderToTop}px` : 0;
245
291
  return (
246
292
  <tr>
247
- {colTableData.map((record, index) => {
293
+ {colTableData.slice(startIndex, endIndex+1).map((record, index) => {
248
294
  return (
249
295
  <td
250
296
  style={{
251
297
  background: (index % 2 === 1) || item.fixed ? '#f7f8fb' : '#fff',
252
- width: '100px',
298
+ width: `${itemWidth}px`,
253
299
  height: '40px',
254
300
  position: item.fixed ? 'sticky' : '',
255
301
  top: fixedTop,
@@ -619,10 +619,10 @@ const AddSelect = (props: any) => {
619
619
  }
620
620
  if(businessType == 'skc') {
621
621
  Promise.all([
622
- loadSelectSource(`/items/item/propertyValue`, {
623
- pageSize: 5000,
622
+ loadSelectSource(`/items/item/propertyValue/sizeBySkcConfig`, {
623
+ pageSize: 10000,
624
624
  currentPage: 1,
625
- 'qp-propertyId-eq': '1467042217951883265'
625
+ type: 2, // 类型:1尺码;2颜色
626
626
  }),
627
627
  loadSelectSource(`/items/category/queryCategoryTree`, {
628
628
  pageSize: 5000,
@@ -758,8 +758,6 @@ const AddSelect = (props: any) => {
758
758
  message.error(Error);
759
759
  }
760
760
  handleLoading(isContinue,false)
761
- }).finally(() => {
762
- handleLoading(isContinue,false)
763
761
  })
764
762
  } else {
765
763
  !isContinue && handleCancel();
@@ -32,6 +32,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
32
32
  isMap,
33
33
  fixedparameter,
34
34
  fieldValToParam,
35
+ fixedparamsDisabled = false,
35
36
  mappingTextField = 'name',
36
37
  mappingTextShowKeyField,
37
38
  mappingValueField = 'code',
@@ -58,6 +59,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
58
59
  optionLabelProp: "label",
59
60
  autoClearSearchValue: false
60
61
  }
62
+ const tableInitPagination = { showQuickJumper: true, total: 0, current: 1, pageSize: tableInitPageSize }
61
63
 
62
64
  const [items, setItems] = useState([]);
63
65
  const [scrollPage, setScrollPage] = useState(1);
@@ -96,7 +98,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
96
98
  const [form] = Form.useForm();
97
99
  const [caretLeftFlag, setCaretLeftFlag] = useState(true);
98
100
  const [tableData, setTableData] = useState([]);
99
- const [tablePagination, setTablePagination] = useState({ showQuickJumper: true, total: 0, current: 1, pageSize: tableInitPageSize })
101
+ const [tablePagination, setTablePagination] = useState(tableInitPagination)
100
102
  const [selectedRowKeys, setSelectedRowKeys] = useState([]);
101
103
  const [doubleArr, setDoubleArr] = useState([]); // 存放双数组的数组
102
104
  const [checkedAll, setCheckedAll] = useState(false)
@@ -122,9 +124,18 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
122
124
  setItemsTotal(0);
123
125
  },
124
126
  getTableFormRef: () => form,
127
+ // 解决下拉框数据源的问题
128
+ getSelectDataSource: () => items,
129
+ setSelectDataSource: (list: any, listTotal: number) => {
130
+ setItems(list);
131
+ setItemsTotal(listTotal);
132
+ },
133
+ refreshSelectDataSource: () => {
134
+ refreshItems()
135
+ }
125
136
  }))
126
137
 
127
- // 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
138
+ // 获取数据源 (type: 1下拉框 2/3弹框 不传值默认为下拉框)
128
139
  const getData = (params = {}, type = 1) => {
129
140
  if (!requestConfig) return;
130
141
 
@@ -135,9 +146,22 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
135
146
  if (fixedparameter && fieldValToParam && ctx) {
136
147
  fixedparameter.forEach((item: any, index: any) => {
137
148
  const fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
138
- if (fixedParamVal) {
149
+ if(fixedParamVal) {
139
150
  fixedParam[item] = fixedParamVal;
140
- form.setFieldsValue({ ...form?.getFieldsValue(), [item]: fixedParamVal })
151
+ // 解决依赖项在弹窗中回显/更改(如果不能更改,传参fixedparamsDisabled为true即可)
152
+ if(type == 2 || type == 3) {
153
+ const fixedChangeParamVal = form.getFieldValue(item);
154
+ // 依赖项在弹窗form中更改--①更换依赖值;②去掉依赖值
155
+ const isDependenceValueChange = (fixedChangeParamVal && fixedChangeParamVal !== fixedParamVal) || (type == 2 && !fixedChangeParamVal);
156
+ const dependenceValue = isDependenceValueChange ? fixedChangeParamVal : fixedParamVal;
157
+ fixedParam[item] = dependenceValue;
158
+ form.setFieldsValue({ ...form?.getFieldsValue(), [item]: dependenceValue })
159
+ if(isDependenceValueChange) {
160
+ ctx.form.setFieldValue(fieldValToParam[index],fixedChangeParamVal) // 更改依赖项
161
+ ctx.form.setFieldValue(resultSourceKey,null) // 同时清空之前依赖项对应的选择项
162
+ refreshItems()
163
+ }
164
+ }
141
165
  }
142
166
  });
143
167
  }
@@ -365,7 +389,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
365
389
  }, [resultSourceKey])
366
390
 
367
391
  const showModal = () => {
368
- getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
392
+ getData({ pageSize: tableInitPageSize, currentPage: 1 }, 3)
369
393
  setIsModalVisible(true);
370
394
  // 回显
371
395
  if (value) {
@@ -387,11 +411,11 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
387
411
 
388
412
  const handleSelectOver = (selectedValue: any) => {
389
413
  if (selectedValue?.length) {
390
- formaData(selectedValue);
391
414
  // 解决选择最后1页的sku,返回后,不显示名称问题
392
415
  const source = _.uniqBy(items.concat(selectedValue), 'value')
393
416
  ctx?.form?.setFieldSource(resultSourceKey, source)
394
417
  setItems(source)
418
+ formaData(selectedValue, source);
395
419
  }
396
420
  }
397
421
 
@@ -400,19 +424,29 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
400
424
  handleCancel();
401
425
  };
402
426
 
403
- const formaData = (value: any) => {
427
+ const formaData = (value: any, source: any) => {
404
428
  if (labelInValue) {
405
429
  const formatResult = value.map((i: any) => ({ key: i[mappingValueField], label: i[mappingTextField], value: i[mappingValueField] }))
406
- onChange(selectMode ? formatResult : formatResult[0], value)
430
+ onChange(selectMode ? formatResult : formatResult[0], value,source)
407
431
  } else {
408
432
  const formatResult = selectMode ? value.map((i: any) => i.value) : _.get(value[0], 'value')
409
- onChange(formatResult, value)
433
+ onChange(formatResult, value,source)
410
434
  }
411
435
  };
412
436
 
413
- const handleCancel = () => {
437
+ const clearModalTable = () => {
414
438
  form.resetFields();
415
439
  setTableFormParams({});
440
+ setTableData([]);
441
+ setTablePagination(tableInitPagination);
442
+ setSelectedRowKeys([]);
443
+ setDoubleArr([]);
444
+ setCheckedAll(false);
445
+ setIndeterminate(false);
446
+ };
447
+
448
+ const handleCancel = () => {
449
+ clearModalTable();
416
450
  setIsModalVisible(false);
417
451
  if (selectMode) {
418
452
  run();
@@ -421,7 +455,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
421
455
 
422
456
  const refreshItems = () => {
423
457
  // 查看是否存在关联值 如果有关联值 就查询 没有就不能查询
424
- if (fieldValToParam && ctx) {
458
+ if (fieldValToParam && ctx && fixedparamsDisabled) {
425
459
  let formValueList = [];
426
460
  fieldValToParam.forEach((item: any, index: any) => {
427
461
  const fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
@@ -596,8 +630,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
596
630
  const formItem = (list) => {
597
631
  if (isModalVisible && list?.length) {
598
632
  const setDisabled = (name: any) => {
599
- const { fixedparamsDisabled = false, fixedparameter = [] }: any = requestConfig;
600
- if (fixedparamsDisabled && fixedparameter.find((item: any) => item === name)) {
633
+ if (fixedparamsDisabled && fixedparameter?.length && fixedparameter.find((item: any) => item === name)) {
601
634
  return true
602
635
  } else {
603
636
  return false