@bit-sun/business-component 4.2.5-per-alpha.2 → 4.2.5-per-alpha.3

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.js CHANGED
@@ -277,6 +277,9 @@ function _possibleConstructorReturn(t, e) {
277
277
  if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
278
278
  return _assertThisInitialized(t);
279
279
  }
280
+ function _readOnlyError(r) {
281
+ throw new TypeError('"' + r + '" is read-only');
282
+ }
280
283
  function _regenerator() {
281
284
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
282
285
  var e,
@@ -2037,7 +2040,6 @@ var getItemDefaultWidth$1 = function getItemDefaultWidth(item) {
2037
2040
  defaultWidth = 130;
2038
2041
  break;
2039
2042
  }
2040
- console.log(defaultWidth);
2041
2043
  return defaultWidth;
2042
2044
  };
2043
2045
  var sulaTableRenderTooltip = function sulaTableRenderTooltip(_ref) {
@@ -2235,7 +2237,6 @@ var getJoinDictionaryText = function getJoinDictionaryText(dicCode, value) {
2235
2237
  var handleBeforeUpload = function handleBeforeUpload(file, size, suffixRule) {
2236
2238
  var extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase();
2237
2239
  var isFileType = suffixRule.length > 0 && suffixRule.includes(extName);
2238
- console.log(file, extName, isFileType, suffixRule, suffixRule.includes(extName));
2239
2240
  if (!isFileType) {
2240
2241
  antd.message.error("\u8BF7\u4E0A\u4F20".concat(suffixRule.toString(), "\u7B49\u683C\u5F0F\u7684\u6587\u4EF6!"));
2241
2242
  }
@@ -2322,7 +2323,6 @@ var socketFunctions = {
2322
2323
  getPrinterList: function getPrinterList(socket) {
2323
2324
  var request = socketFunctions.getRequestObject('getPrinters');
2324
2325
  if (socket.readyState === 1) {
2325
- console.log(request, socket, 'getPrintList');
2326
2326
  socket.send(JSON.stringify(request));
2327
2327
  }
2328
2328
  },
@@ -2403,7 +2403,6 @@ var socketFunctions = {
2403
2403
  totalDocumentCount: 100
2404
2404
  }
2405
2405
  };
2406
- console.log(socket, '打印前的最后一步', request);
2407
2406
  socket.send(JSON.stringify(request));
2408
2407
  }
2409
2408
  };
@@ -2567,7 +2566,6 @@ function _loadLuckysheet() {
2567
2566
  while (1) switch (_context.p = _context.n) {
2568
2567
  case 0:
2569
2568
  _context.p = 0;
2570
- console.log('开始动态加载 Luckysheet 资源...');
2571
2569
  // 并行加载所有 CSS 文件
2572
2570
  cssPromises = LUCKYSHEET_RESOURCES.css.map(function (url) {
2573
2571
  return loadCSS(url);
@@ -2575,7 +2573,6 @@ function _loadLuckysheet() {
2575
2573
  _context.n = 1;
2576
2574
  return Promise.all(cssPromises);
2577
2575
  case 1:
2578
- console.log('Luckysheet CSS 文件加载完成');
2579
2576
  // 顺序加载 JS 文件(保证依赖顺序)
2580
2577
  _iterator = _createForOfIteratorHelper(LUCKYSHEET_RESOURCES.js);
2581
2578
  _context.p = 2;
@@ -2603,7 +2600,6 @@ function _loadLuckysheet() {
2603
2600
  _iterator.f();
2604
2601
  return _context.f(7);
2605
2602
  case 8:
2606
- console.log('Luckysheet JS 文件加载完成');
2607
2603
  // 等待 luckysheet 对象可用
2608
2604
  retryCount = 0;
2609
2605
  maxRetries = 50; // 最多等待 5 秒
@@ -2628,13 +2624,11 @@ function _loadLuckysheet() {
2628
2624
  throw new Error('Luckysheet 加载超时,请检查网络连接');
2629
2625
  case 12:
2630
2626
  cache.loaded = true;
2631
- console.log('Luckysheet 动态加载完成');
2632
2627
  _context.n = 14;
2633
2628
  break;
2634
2629
  case 13:
2635
2630
  _context.p = 13;
2636
2631
  _t2 = _context.v;
2637
- console.error('Luckysheet 加载失败:', _t2);
2638
2632
  cache.loading = null; // 重置加载状态,允许重试
2639
2633
  throw _t2;
2640
2634
  case 14:
@@ -2951,7 +2945,6 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
2951
2945
  };
2952
2946
  };
2953
2947
  _this.getData = function () {
2954
- console.time();
2955
2948
  var sheetData = luckysheet.getSheetData();
2956
2949
  var data = JSON.parse(JSON.stringify(sheetData)).filter(function (item) {
2957
2950
  return item[0];
@@ -3083,7 +3076,6 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3083
3076
  errorListCheck: false,
3084
3077
  resultData: res
3085
3078
  });
3086
- console.log(setExportData);
3087
3079
  setExportData([123123]);
3088
3080
  }).catch(function (err) {});
3089
3081
  };
@@ -3339,7 +3331,6 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3339
3331
  case 4:
3340
3332
  _context.p = 4;
3341
3333
  _t = _context.v;
3342
- console.error('DataValidation 组件初始化失败:', _t);
3343
3334
  this.setState({
3344
3335
  luckysheetLoading: false,
3345
3336
  luckysheetLoadError: _t.message || '加载失败'
@@ -3426,7 +3417,6 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3426
3417
  left: '0px',
3427
3418
  top: '0px'
3428
3419
  };
3429
- console.log('itemsTemp', itemsTemp);
3430
3420
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
3431
3421
  className: "sheet_table_top"
3432
3422
  }, /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement("span", null, "\u6392\u5E8F\u5217"), /*#__PURE__*/React__default['default'].createElement(antd.Dropdown, {
@@ -3823,7 +3813,6 @@ var DataImport = /*#__PURE__*/function (_React$Component) {
3823
3813
  };
3824
3814
  };
3825
3815
  _this.getData = function () {
3826
- console.time();
3827
3816
  var sheetData = luckysheet$1.getSheetData();
3828
3817
  var data = JSON.parse(JSON.stringify(sheetData)).filter(function (item) {
3829
3818
  return item[0];
@@ -3917,7 +3906,6 @@ var DataImport = /*#__PURE__*/function (_React$Component) {
3917
3906
  errorListCheck: false,
3918
3907
  resultData: res
3919
3908
  });
3920
- console.log(setExportData);
3921
3909
  setExportData([123123]);
3922
3910
  }).catch(function (err) {});
3923
3911
  };
@@ -4140,7 +4128,6 @@ var DataImport = /*#__PURE__*/function (_React$Component) {
4140
4128
  case 5:
4141
4129
  _context.p = 5;
4142
4130
  _t = _context.v;
4143
- console.error('加载 Luckysheet 失败:', _t);
4144
4131
  this.setState({
4145
4132
  luckysheetLoading: false,
4146
4133
  luckysheetLoadError: _t.message || '加载失败'
@@ -4984,6 +4971,8 @@ var QueryMutipleSearchSelect = function QueryMutipleSearchSelect(_ref) {
4984
4971
  _useState14 = _slicedToArray(_useState13, 2),
4985
4972
  uniqueValue = _useState14[0],
4986
4973
  setUniqueValue = _useState14[1];
4974
+ var selectTimerRef = React$1.useRef(null);
4975
+ var isUnmountedRef = React$1.useRef(false);
4987
4976
  React$1.useEffect(function () {
4988
4977
  setPopValue(value);
4989
4978
  onValueChange(value);
@@ -4991,6 +4980,16 @@ var QueryMutipleSearchSelect = function QueryMutipleSearchSelect(_ref) {
4991
4980
  React$1.useEffect(function () {
4992
4981
  setUniqueValue(makeUniqueValue());
4993
4982
  }, [resultSourceKey]);
4983
+ // 组件卸载时清理定时器
4984
+ React$1.useEffect(function () {
4985
+ return function () {
4986
+ isUnmountedRef.current = true;
4987
+ if (selectTimerRef.current) {
4988
+ clearTimeout(selectTimerRef.current);
4989
+ selectTimerRef.current = null;
4990
+ }
4991
+ };
4992
+ }, []);
4994
4993
  var showModal = function showModal() {
4995
4994
  setIsModalVisible(true);
4996
4995
  //弹窗打开时 默认搜索内容换行显示
@@ -5097,8 +5096,19 @@ var QueryMutipleSearchSelect = function QueryMutipleSearchSelect(_ref) {
5097
5096
  },
5098
5097
  onSelect: function onSelect() {
5099
5098
  if (selectMode) return;
5100
- setTimeout(function () {
5101
- setOpen(false);
5099
+ // 清理之前的定时器
5100
+ if (selectTimerRef.current) {
5101
+ clearTimeout(selectTimerRef.current);
5102
+ selectTimerRef.current = null;
5103
+ }
5104
+ selectTimerRef.current = setTimeout(function () {
5105
+ try {
5106
+ if (!isUnmountedRef.current) {
5107
+ setOpen(false);
5108
+ }
5109
+ } catch (error) {} finally {
5110
+ selectTimerRef.current = null;
5111
+ }
5102
5112
  }, 0);
5103
5113
  },
5104
5114
  style: {
@@ -9706,7 +9716,6 @@ var BillEntry = function BillEntry(_ref3) {
9706
9716
  }, [data]);
9707
9717
  React$1.useEffect(function () {
9708
9718
  setInitialShowColumn(codeSelected, selectColumns, function (res) {
9709
- console.log(res, '---res');
9710
9719
  setShowColumnsCallback(res);
9711
9720
  });
9712
9721
  }, [selectColumns]);
@@ -14054,7 +14063,6 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
14054
14063
  }, parProps.requestConfig),
14055
14064
  selectProps: selectProps,
14056
14065
  onChange: function onChange(value) {
14057
- console.log(value);
14058
14066
  setValue(value);
14059
14067
  },
14060
14068
  beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
@@ -14378,7 +14386,6 @@ var AddSkcSelect = function AddSkcSelect(parProps) {
14378
14386
  }, parProps.requestConfig),
14379
14387
  selectProps: selectProps,
14380
14388
  onChange: function onChange(value) {
14381
- console.log(value);
14382
14389
  setValue(value);
14383
14390
  },
14384
14391
  beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
@@ -14695,7 +14702,6 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
14695
14702
  }, parProps.requestConfig),
14696
14703
  selectProps: selectProps,
14697
14704
  onChange: function onChange(value) {
14698
- console.log(value);
14699
14705
  setValue(value);
14700
14706
  },
14701
14707
  beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
@@ -17153,9 +17159,7 @@ var doDetailPageAction = function doDetailPageAction(config) {
17153
17159
  okType: 'danger',
17154
17160
  cancelText: '取消',
17155
17161
  onOk: onOk,
17156
- onCancel: function onCancel() {
17157
- console.log('Cancel');
17158
- }
17162
+ onCancel: function onCancel() {}
17159
17163
  });
17160
17164
  }
17161
17165
  }
@@ -17600,13 +17604,10 @@ var _excluded$f = ["children"];
17600
17604
  var index$4 = (function (props) {
17601
17605
  var _useLocation = umi.useLocation(),
17602
17606
  pathname = _useLocation.pathname;
17603
- var _useState = React$1.useState(pathname + 'id'),
17604
- _useState2 = _slicedToArray(_useState, 1),
17605
- id = _useState2[0];
17606
17607
  var children = props.children,
17607
17608
  restProps = _objectWithoutProperties(props, _excluded$f);
17608
17609
  return /*#__PURE__*/React__default['default'].createElement("div", {
17609
- id: id,
17610
+ id: "home-page-wrapper",
17610
17611
  className: 'home_page_wrapper'
17611
17612
  }, /*#__PURE__*/React__default['default'].createElement(HeaderWrapper, _objectSpread2({
17612
17613
  pathname: pathname
@@ -17621,10 +17622,11 @@ var HeaderWrapper = /*#__PURE__*/React__default['default'].memo(function (_ref)
17621
17622
  extra = _ref.extra,
17622
17623
  title = _ref.title,
17623
17624
  pathToRegexp = _ref.pathToRegexp;
17624
- var _useState3 = React$1.useState([]),
17625
- _useState4 = _slicedToArray(_useState3, 2),
17626
- breadcrumbArr = _useState4[0],
17627
- setBreadCrumbArr = _useState4[1];
17625
+ var _useState = React$1.useState([]),
17626
+ _useState2 = _slicedToArray(_useState, 2),
17627
+ breadcrumbArr = _useState2[0],
17628
+ setBreadCrumbArr = _useState2[1];
17629
+ var isMountedRef = React__default['default'].useRef(true);
17628
17630
  var basePath = window.top == window ? '' : "/".concat(itemPath);
17629
17631
  var menuRoutes = React$1.useMemo(function () {
17630
17632
  var _routes$find;
@@ -17635,13 +17637,13 @@ var HeaderWrapper = /*#__PURE__*/React__default['default'].memo(function (_ref)
17635
17637
  var breadcrumbNameMap = React$1.useMemo(function () {
17636
17638
  return getMainCrumbNameMap(memoizeOneFormatter(menuRoutes, ''));
17637
17639
  }, [menuRoutes]); // 只有menuRoutes变化时才重新创建
17638
- var matchParamsPath = function matchParamsPath(pathname, breadcrumbNameMap) {
17640
+ var matchParamsPath = React$1.useCallback(function (pathname, breadcrumbNameMap) {
17639
17641
  var pathKey = Object.keys(breadcrumbNameMap).find(function (key) {
17640
17642
  return pathToRegexp ? pathToRegexp(key).test(pathname) : false;
17641
17643
  });
17642
17644
  return pathKey ? breadcrumbNameMap[pathKey] : undefined;
17643
- };
17644
- var getPageTitle = function getPageTitle(pathname) {
17645
+ }, [pathToRegexp]);
17646
+ var getPageTitle = React$1.useCallback(function (pathname) {
17645
17647
  var currRouterData = matchParamsPath("".concat(basePath).concat(pathname), breadcrumbNameMap);
17646
17648
  if (!currRouterData) {
17647
17649
  return '';
@@ -17651,17 +17653,37 @@ var HeaderWrapper = /*#__PURE__*/React__default['default'].memo(function (_ref)
17651
17653
  breadcrumbArrs.pop();
17652
17654
  breadcrumbArrs.push(title);
17653
17655
  }
17654
- setBreadCrumbArr(_toConsumableArray(breadcrumbArrs));
17656
+ // 只在组件挂载时更新状态,避免内存泄漏
17657
+ if (isMountedRef.current) {
17658
+ setBreadCrumbArr(_toConsumableArray(breadcrumbArrs));
17659
+ }
17655
17660
  var pageName = umi.formatMessage({
17656
17661
  id: currRouterData.locale || currRouterData.name,
17657
17662
  defaultMessage: currRouterData.name
17658
17663
  });
17659
17664
  return title ? title : window.top === window ? pageName : "".concat(currRouterData.name);
17660
- };
17665
+ }, [matchParamsPath, breadcrumbNameMap, basePath, title]);
17661
17666
  var pageTitle = React$1.useMemo(function () {
17662
17667
  return getPageTitle(pathname);
17663
- }, [pathname, title]);
17664
- React$1.useEffect(function () {}, [pathname]);
17668
+ }, [getPageTitle, pathname]);
17669
+ React$1.useEffect(function () {
17670
+ // 路径变化时的清理逻辑
17671
+ return function () {
17672
+ // 只在组件仍挂载时清理状态
17673
+ if (isMountedRef.current) {
17674
+ setBreadCrumbArr([]);
17675
+ }
17676
+ };
17677
+ }, [pathname]);
17678
+ // 组件卸载时清理所有引用
17679
+ React$1.useEffect(function () {
17680
+ return function () {
17681
+ // 标记组件已卸载
17682
+ isMountedRef.current = false;
17683
+ // 清理所有状态和引用
17684
+ setBreadCrumbArr([]);
17685
+ };
17686
+ }, []);
17665
17687
  return /*#__PURE__*/React__default['default'].createElement("div", {
17666
17688
  className: 'bs_home_page_head_wrapper'
17667
17689
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -17676,9 +17698,10 @@ var HeaderWrapper = /*#__PURE__*/React__default['default'].memo(function (_ref)
17676
17698
  }, item));
17677
17699
  }))), extra ? /*#__PURE__*/React__default['default'].createElement(antd.Space, null, extra) : ''), alertProps && (/*#__PURE__*/React__default['default'].createElement(CommonAlert, _objectSpread2({}, alertProps))));
17678
17700
  }, function (prevProps, nextProps) {
17679
- // if (prevProps.pathname !== nextProps.pathname) {
17680
- // return false;
17681
- // }
17701
+ // 如果关键属性发生变化,则需要重新渲染
17702
+ if (prevProps.pathname !== nextProps.pathname || prevProps.title !== nextProps.title || prevProps.itemPath !== nextProps.itemPath || prevProps.routes !== nextProps.routes || prevProps.pathToRegexp !== nextProps.pathToRegexp || JSON.stringify(prevProps.alertProps) !== JSON.stringify(nextProps.alertProps) || prevProps.extra !== nextProps.extra) {
17703
+ return false;
17704
+ }
17682
17705
  return true;
17683
17706
  });
17684
17707
 
@@ -17735,7 +17758,6 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
17735
17758
  reject('');
17736
17759
  }
17737
17760
  }).catch(function (error) {
17738
- console.error('[SortableTable] 请求失败:', error);
17739
17761
  reject(error);
17740
17762
  });
17741
17763
  });
@@ -18262,7 +18284,6 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
18262
18284
  reject('');
18263
18285
  }
18264
18286
  }).catch(function (error) {
18265
- console.error('[SortableTable] 重置请求失败:', error);
18266
18287
  antd.message.error('重置表头列自定义失败,请稍后尝试');
18267
18288
  reject(error);
18268
18289
  });
@@ -18295,6 +18316,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
18295
18316
  _this.isUnmounted = false;
18296
18317
  _this.requestController = null;
18297
18318
  _this.debounceTimer = null;
18319
+ _this.cleanupTimer = null;
18298
18320
  // Modal组件ref,用于直接访问DOM进行清理
18299
18321
  _this.modalRef = /*#__PURE__*/React__default['default'].createRef();
18300
18322
  return _this;
@@ -18363,19 +18385,15 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
18363
18385
  }, {
18364
18386
  key: "componentWillUnmount",
18365
18387
  value: function componentWillUnmount() {
18366
- console.log('[SortableTable] 组件即将卸载,开始清理资源');
18367
18388
  // 设置卸载标志,防止异步操作
18368
18389
  this.isUnmounted = true;
18369
18390
  try {
18370
18391
  // 1. 取消请求
18371
18392
  if (this.requestController) {
18372
18393
  try {
18373
- console.log('[SortableTable] 取消进行中的请求');
18374
18394
  this.requestController.abort();
18375
18395
  this.requestController = null;
18376
- } catch (abortError) {
18377
- console.warn('[SortableTable] 取消请求时出错:', abortError);
18378
- }
18396
+ } catch (abortError) {}
18379
18397
  }
18380
18398
  // 2. 清理定时器
18381
18399
  if (this.debounceTimer) {
@@ -18466,22 +18484,15 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
18466
18484
  if (modalElement._reactInternalInstance) {
18467
18485
  modalElement._reactInternalInstance = null;
18468
18486
  }
18469
- } catch (error) {
18470
- console.warn('[SortableTable] Modal ref清理失败:', error);
18471
- }
18487
+ } catch (error) {}
18472
18488
  this.modalRef.current = null;
18473
18489
  }
18474
18490
  this.modalRef = null;
18475
18491
  // 7. 清理状态引用
18476
18492
  this.state = null;
18477
18493
  // 8. 防止组件卸载后的setState调用
18478
- this.setState = function () {
18479
- console.warn('[SortableTable] 组件已卸载,忽略setState调用');
18480
- };
18481
- console.log('[SortableTable] 组件清理完成,__reactEventHandlers引用已断开');
18482
- } catch (error) {
18483
- console.warn('[SortableTable] 组件清理失败:', error);
18484
- }
18494
+ this.setState = function () {};
18495
+ } catch (error) {}
18485
18496
  }
18486
18497
  }, {
18487
18498
  key: "render",
@@ -18517,37 +18528,44 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
18517
18528
  searchDataSource: '',
18518
18529
  onSearchSort: ''
18519
18530
  });
18531
+ // 清理之前的定时器
18532
+ if (_this2.cleanupTimer) {
18533
+ clearTimeout(_this2.cleanupTimer);
18534
+ _this2.cleanupTimer = null;
18535
+ }
18520
18536
  // 强制清理React Fiber节点和DOM引用
18521
- setTimeout(function () {
18537
+ _this2.cleanupTimer = setTimeout(function () {
18522
18538
  try {
18523
- // 清理所有带有sort_table类名的DOM节点的React引用
18524
- var sortTableElements = document.querySelectorAll('.sort_table, .sort_table_column_wrapper, .sort_table_column, .sort_table_content_wrapper, .sort_table_column_count');
18525
- sortTableElements.forEach(function (element) {
18526
- // 清理React内部实例引用
18527
- var reactKeys = Object.keys(element).filter(function (key) {
18528
- return key.startsWith('__reactInternalInstance') || key.startsWith('__reactEventHandlers');
18529
- });
18530
- reactKeys.forEach(function (key) {
18531
- try {
18532
- delete element[key];
18533
- } catch (e) {
18534
- // 忽略删除失败
18539
+ if (!_this2.isUnmounted) {
18540
+ // 清理所有带有sort_table类名的DOM节点的React引用
18541
+ var sortTableElements = document.querySelectorAll('.sort_table, .sort_table_column_wrapper, .sort_table_column, .sort_table_content_wrapper, .sort_table_column_count');
18542
+ sortTableElements.forEach(function (element) {
18543
+ // 清理React内部实例引用
18544
+ var reactKeys = Object.keys(element).filter(function (key) {
18545
+ return key.startsWith('__reactInternalInstance') || key.startsWith('__reactEventHandlers');
18546
+ });
18547
+ reactKeys.forEach(function (key) {
18548
+ try {
18549
+ delete element[key];
18550
+ } catch (e) {
18551
+ // 忽略删除失败
18552
+ }
18553
+ });
18554
+ // 清理React Fiber引用
18555
+ if (element._reactInternalFiber) {
18556
+ element._reactInternalFiber = null;
18557
+ }
18558
+ if (element._reactInternalInstance) {
18559
+ element._reactInternalInstance = null;
18535
18560
  }
18536
18561
  });
18537
- // 清理React Fiber引用
18538
- if (element._reactInternalFiber) {
18539
- element._reactInternalFiber = null;
18540
- }
18541
- if (element._reactInternalInstance) {
18542
- element._reactInternalInstance = null;
18562
+ // 强制垃圾回收提示
18563
+ if (window.gc) {
18564
+ window.gc();
18543
18565
  }
18544
- });
18545
- // 强制垃圾回收提示
18546
- if (window.gc) {
18547
- window.gc();
18548
18566
  }
18549
- } catch (error) {
18550
- console.warn('[SortableTable] Modal afterClose清理失败:', error);
18567
+ } catch (error) {} finally {
18568
+ _this2.cleanupTimer = null;
18551
18569
  }
18552
18570
  }, 100);
18553
18571
  },
@@ -18939,7 +18957,6 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
18939
18957
  _this.patchUserSearchFieldsConfig(sortDataSource);
18940
18958
  };
18941
18959
  _this.handleCancel = function (e) {
18942
- console.log(e);
18943
18960
  _this.setState({
18944
18961
  visible: false,
18945
18962
  searchDataSource: ''
@@ -19122,7 +19139,6 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
19122
19139
  key: "componentWillUnmount",
19123
19140
  value: function componentWillUnmount() {
19124
19141
  var _this2 = this;
19125
- console.log('[SearchItemTable] 开始清理组件资源');
19126
19142
  var cleanupTasks = [
19127
19143
  // 取消所有进行中的请求
19128
19144
  function () {
@@ -19130,11 +19146,8 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
19130
19146
  if (_this2.requestControlle) {
19131
19147
  _this2.requestController.abort();
19132
19148
  _this2.requestController = null;
19133
- console.log('[SearchItemTable] 请求已取消');
19134
19149
  }
19135
- } catch (error) {
19136
- console.warn('[SearchItemTable] 请求取消失败:', error);
19137
- }
19150
+ } catch (error) {}
19138
19151
  },
19139
19152
  // 清理定时器
19140
19153
  function () {
@@ -19142,21 +19155,14 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
19142
19155
  if (_this2.debounceTimer) {
19143
19156
  clearTimeout(_this2.debounceTimer);
19144
19157
  _this2.debounceTimer = null;
19145
- console.log('[SearchItemTable] 防抖定时器已清理');
19146
19158
  }
19147
- } catch (error) {
19148
- console.warn('[SearchItemTable] 定时器清理失败:', error);
19149
- }
19159
+ } catch (error) {}
19150
19160
  },
19151
19161
  // 清理状态引用
19152
19162
  function () {
19153
19163
  try {
19154
- _this2.setState = function () {
19155
- console.warn('[SearchItemTable] 组件已卸载,忽略setState调用');
19156
- };
19157
- } catch (error) {
19158
- console.warn('[SearchItemTable] setState清理失败:', error);
19159
- }
19164
+ _this2.setState = function () {};
19165
+ } catch (error) {}
19160
19166
  },
19161
19167
  // 清理DOM事件监听器
19162
19168
  function () {
@@ -19165,11 +19171,8 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
19165
19171
  _this2.dragContainer.removeEventListener('dragstart', _this2.handleDragStart);
19166
19172
  _this2.dragContainer.removeEventListener('dragend', _this2.handleDragEnd);
19167
19173
  _this2.dragContainer = null;
19168
- console.log('[SearchItemTable] DOM事件监听器已清理');
19169
19174
  }
19170
- } catch (error) {
19171
- console.warn('[SearchItemTable] DOM事件清理失败:', error);
19172
- }
19175
+ } catch (error) {}
19173
19176
  },
19174
19177
  // 清理全局事件监听器
19175
19178
  function () {
@@ -19179,9 +19182,7 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
19179
19182
  document.removeEventListener('keydown', _this2.handleGlobalKeydown);
19180
19183
  window.removeEventListener('resize', _this2.handleWindowResize);
19181
19184
  }
19182
- } catch (error) {
19183
- console.warn('[SearchItemTable] 全局事件清理失败:', error);
19184
- }
19185
+ } catch (error) {}
19185
19186
  },
19186
19187
  // 清理Table组件引用
19187
19188
  function () {
@@ -19189,9 +19190,7 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
19189
19190
  if (_this2.tableRef && _this2.tableRef.current) {
19190
19191
  _this2.tableRef.current = null;
19191
19192
  }
19192
- } catch (error) {
19193
- console.warn('[SearchItemTable] Table组件清理失败:', error);
19194
- }
19193
+ } catch (error) {}
19195
19194
  },
19196
19195
  // 清理react-sortable-hoc相关内存
19197
19196
  function () {
@@ -19199,9 +19198,7 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
19199
19198
  if (_this2.sortableContext) {
19200
19199
  _this2.sortableContext = null;
19201
19200
  }
19202
- } catch (error) {
19203
- console.warn('[SearchItemTable] sortable-hoc清理失败:', error);
19204
- }
19201
+ } catch (error) {}
19205
19202
  },
19206
19203
  // 清理localStorage监听器
19207
19204
  function () {
@@ -19209,9 +19206,7 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
19209
19206
  if (typeof window !== 'undefined' && window.removeEventListener) {
19210
19207
  window.removeEventListener('storage', _this2.handleStorageChange);
19211
19208
  }
19212
- } catch (error) {
19213
- console.warn('[SearchItemTable] localStorage监听器清理失败:', error);
19214
- }
19209
+ } catch (error) {}
19215
19210
  }];
19216
19211
  // 执行清理任务,即使某个任务失败也继续执行其他任务
19217
19212
  var successCount = 0;
@@ -19219,11 +19214,8 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
19219
19214
  try {
19220
19215
  task();
19221
19216
  successCount++;
19222
- } catch (error) {
19223
- console.error("[SearchItemTable] \u6E05\u7406\u4EFB\u52A1".concat(index + 1, "\u6267\u884C\u5931\u8D25:"), error);
19224
- }
19217
+ } catch (error) {}
19225
19218
  });
19226
- console.log("[SearchItemTable] \u7EC4\u4EF6\u8D44\u6E90\u6E05\u7406\u5B8C\u6210\uFF0C\u6210\u529F\u6267\u884C".concat(successCount, "/").concat(cleanupTasks.length, "\u4E2A\u6E05\u7406\u4EFB\u52A1"));
19227
19219
  // 最终状态验证
19228
19220
  var finalState = {
19229
19221
  requestCancelled: !this.requestController,
@@ -19232,7 +19224,6 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
19232
19224
  tableRefCleared: !this.tableRef,
19233
19225
  sortableContextCleared: !this.sortableContext
19234
19226
  };
19235
- console.log('[SearchItemTable] 最终清理状态:', finalState);
19236
19227
  }
19237
19228
  }, {
19238
19229
  key: "render",
@@ -19444,17 +19435,8 @@ var ResizeableTitle$2 = function ResizeableTitle(props) {
19444
19435
  var currentStart = React$1.useRef(0);
19445
19436
  var uuidref = React$1.useRef(uuid());
19446
19437
  var prevWidthRef = React$1.useRef(width);
19447
- var handleMouseDown = function handleMouseDown(e) {
19448
- currentStart.current = e.clientX;
19449
- markerPosition.current = {
19450
- left: e.clientX,
19451
- top: e.clientY
19452
- };
19453
- setIsResizing(true);
19454
- document.addEventListener('mousemove', handleMouseMove);
19455
- document.addEventListener('mouseup', _handleMouseUp);
19456
- };
19457
- var handleMouseMove = function handleMouseMove(e) {
19438
+ // 使用useCallback优化事件处理函数,避免重复创建
19439
+ var handleMouseMove = React$1.useCallback(function (e) {
19458
19440
  e.stopPropagation();
19459
19441
  e.preventDefault();
19460
19442
  // 更新标记位置
@@ -19467,12 +19449,22 @@ var ResizeableTitle$2 = function ResizeableTitle(props) {
19467
19449
  dom.style.left = "".concat(e.clientX, "px");
19468
19450
  dom.style.top = "".concat(e.clientY - 20, "px");
19469
19451
  }
19470
- };
19471
- var _handleMouseUp = function handleMouseUp(e) {
19452
+ }, []);
19453
+ var handleMouseUp = React$1.useCallback(function (e) {
19472
19454
  document.removeEventListener('mousemove', handleMouseMove);
19473
- document.removeEventListener('mouseup', _handleMouseUp);
19455
+ document.removeEventListener('mouseup', handleMouseUp);
19474
19456
  setIsResizing(false);
19475
- };
19457
+ }, [handleMouseMove]);
19458
+ var handleMouseDown = React$1.useCallback(function (e) {
19459
+ currentStart.current = e.clientX;
19460
+ markerPosition.current = {
19461
+ left: e.clientX,
19462
+ top: e.clientY
19463
+ };
19464
+ setIsResizing(true);
19465
+ document.addEventListener('mousemove', handleMouseMove);
19466
+ document.addEventListener('mouseup', handleMouseUp);
19467
+ }, [handleMouseMove, handleMouseUp]);
19476
19468
  var handleresize = function handleresize(e, data, title) {
19477
19469
  var _data$size;
19478
19470
  var newWidth = (data === null || data === void 0 ? void 0 : (_data$size = data.size) === null || _data$size === void 0 ? void 0 : _data$size.width) || 0;
@@ -19493,6 +19485,14 @@ var ResizeableTitle$2 = function ResizeableTitle(props) {
19493
19485
  setInnerWidth(width);
19494
19486
  }
19495
19487
  }, [width]);
19488
+ // 组件卸载时清理事件监听器
19489
+ React$1.useEffect(function () {
19490
+ return function () {
19491
+ // 确保在组件卸载时移除可能残留的事件监听器
19492
+ document.removeEventListener('mousemove', handleMouseMove);
19493
+ document.removeEventListener('mouseup', handleMouseUp);
19494
+ };
19495
+ }, [handleMouseMove, handleMouseUp]);
19496
19496
  return /*#__PURE__*/React__default['default'].createElement(reactResizable.Resizable, {
19497
19497
  width: innerWidth,
19498
19498
  height: 0,
@@ -19546,11 +19546,8 @@ var BsSulaQueryTable = (function (props) {
19546
19546
  // 定时器引用,用于清理
19547
19547
  var debounceTimer = React$1.useRef(null);
19548
19548
  var resizeTimer = React$1.useRef(null);
19549
- // 事件处理函数引用,用于清理
19550
- var handleBeforeUnload = React$1.useRef(null);
19551
- var handleGlobalClick = React$1.useRef(null);
19552
- var handleGlobalKeydown = React$1.useRef(null);
19553
- var handleStorageChange = React$1.useRef(null);
19549
+ var tableHeightTimer = React$1.useRef(null); // 新增:管理getTableHeight的定时器
19550
+ // 移除未使用的事件处理函数引用,避免内存泄漏
19554
19551
  // 获取 table columns中所有的 key 防止有的地方是 dataindex
19555
19552
  var checkedList = React$1.useMemo(function () {
19556
19553
  return props.columns.filter(function (col) {
@@ -19658,7 +19655,36 @@ var BsSulaQueryTable = (function (props) {
19658
19655
  _useState18 = _slicedToArray(_useState17, 2),
19659
19656
  height = _useState18[0],
19660
19657
  setHeight = _useState18[1];
19658
+ // 使用ref避免setHeight的闭包引用
19659
+ var heightRef = React$1.useRef(height);
19660
+ // 同步height状态到ref
19661
+ React$1.useEffect(function () {
19662
+ heightRef.current = height;
19663
+ }, [height]);
19661
19664
  var bsTableCodeExport = "".concat(bsTableCode, "___Export"); //设置导出列字段的唯一标识
19665
+ // 获取table高度
19666
+ var getTableHeight = React$1.useCallback(function () {
19667
+ // 清理之前的定时器
19668
+ if (tableHeightTimer.current) {
19669
+ clearTimeout(tableHeightTimer.current);
19670
+ tableHeightTimer.current = null;
19671
+ }
19672
+ tableHeightTimer.current = setTimeout(function () {
19673
+ try {
19674
+ var _window$top, _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;
19675
+ var cancelHeight = window.top == window ? 303 : 223;
19676
+ var _isFullScreen = window.top.document.fullScreen || window.top.document.webkitIsFullScreen || window.top.document.mozFullScreen;
19677
+ // wujie子应用iframe首次加载获取不到client以及dom元素高度兼容处理
19678
+ var realIframeClientHeight = document.body.clientHeight ? document.body.clientHeight : ((_window$top = window.top) === null || _window$top === void 0 ? void 0 : _window$top.document.body.clientHeight) - 76;
19679
+ var summaryHeight = document.querySelector(".ant-tabs-tabpane-active .table-bssula-summary") ? ((_document$querySelect = document.querySelector(".ant-tabs-tabpane-active .table-bssula-summary")) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.clientHeight) || 22 : 0;
19680
+ var listTabHeight = document.querySelector(".ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav") ? ((_document$querySelect2 = document.querySelector(".ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav")) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.clientHeight) || 48 : 0;
19681
+ var h = realIframeClientHeight - summaryHeight - listTabHeight - (((_document$querySelect3 = document.querySelector(".ant-tabs-tabpane-active .ant-form ant-form-horizontal")) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.clientHeight) || 0) - (_isFullScreen ? 0 : ((_document$querySelect4 = document.querySelector(".ant-tabs-tabpane-active .ant-pro-page-container-warp")) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.clientHeight) || 0) - cancelHeight + 'px';
19682
+ setHeight(h);
19683
+ } catch (error) {} finally {
19684
+ tableHeightTimer.current = null;
19685
+ }
19686
+ }, 0);
19687
+ }, []);
19662
19688
  //监测是否按下esc键
19663
19689
  function checkFull() {
19664
19690
  var _window, _window$parent;
@@ -19775,20 +19801,12 @@ var BsSulaQueryTable = (function (props) {
19775
19801
  clearTimeout(resizeTimer.current);
19776
19802
  resizeTimer.current = null;
19777
19803
  }
19804
+ if (tableHeightTimer.current) {
19805
+ clearTimeout(tableHeightTimer.current);
19806
+ tableHeightTimer.current = null;
19807
+ }
19778
19808
  // 清理所有事件监听器
19779
19809
  window.removeEventListener('resize', handleWindowResize);
19780
- if (handleBeforeUnload.current) {
19781
- window.removeEventListener('beforeunload', handleBeforeUnload.current);
19782
- }
19783
- if (handleGlobalClick.current) {
19784
- document.removeEventListener('click', handleGlobalClick.current);
19785
- }
19786
- if (handleGlobalKeydown.current) {
19787
- document.removeEventListener('keydown', handleGlobalKeydown.current);
19788
- }
19789
- if (handleStorageChange.current) {
19790
- window.removeEventListener('storage', handleStorageChange.current);
19791
- }
19792
19810
  var cleanupTimeout = 5000; // 5秒超时保护
19793
19811
  // 创建清理任务队列,按优先级顺序执行
19794
19812
  var cleanupTasks = [
@@ -19807,7 +19825,6 @@ var BsSulaQueryTable = (function (props) {
19807
19825
  }
19808
19826
  resolve();
19809
19827
  } catch (error) {
19810
- console.warn('[BsSulaQueryTable] 第一阶段清理错误:', error);
19811
19828
  resolve(); // 即使出错也继续
19812
19829
  }
19813
19830
  });
@@ -19841,9 +19858,7 @@ var BsSulaQueryTable = (function (props) {
19841
19858
  }
19842
19859
  // 禁用setState防止内存泄漏
19843
19860
  if (ref.current.setState) {
19844
- ref.current.setState = function () {
19845
- console.warn("[".concat(name, "] \u7EC4\u4EF6\u5DF2\u5378\u8F7D\uFF0C\u5FFD\u7565setState\u8C03\u7528"));
19846
- };
19861
+ ref.current.setState = function () {};
19847
19862
  }
19848
19863
  // 清理DOM事件监听器
19849
19864
  if (ref.current.removeEventListener) {
@@ -19851,16 +19866,14 @@ var BsSulaQueryTable = (function (props) {
19851
19866
  ref.current.removeEventListener('click', null);
19852
19867
  ref.current.removeEventListener('resize', null);
19853
19868
  }
19854
- console.log("[BsSulaQueryTable] ".concat(name, " \u7EC4\u4EF6\u5DF2\u5B89\u5168\u5378\u8F7D"));
19855
19869
  }
19856
- } catch (componentError) {
19857
- console.warn("[BsSulaQueryTable] ".concat(name, " \u5378\u8F7D\u5931\u8D25:"), componentError);
19858
- // 继续处理其他组件
19859
- }
19870
+ } catch (componentError) {}
19860
19871
  });
19872
+ // 清理临时数组和WeakSet
19873
+ tempInstancesRef.current = [];
19874
+ summaryInstancesRef.current = new WeakSet();
19861
19875
  resolve();
19862
19876
  } catch (error) {
19863
- console.warn('[BsSulaQueryTable] 第二阶段清理错误:', error);
19864
19877
  resolve();
19865
19878
  }
19866
19879
  });
@@ -19871,21 +19884,9 @@ var BsSulaQueryTable = (function (props) {
19871
19884
  try {
19872
19885
  // 清理全局事件监听器
19873
19886
  window.removeEventListener('resize', handleWindowResize);
19874
- if (handleBeforeUnload.current) {
19875
- window.removeEventListener('beforeunload', handleBeforeUnload.current);
19876
- }
19877
- if (handleGlobalClick.current) {
19878
- document.removeEventListener('click', handleGlobalClick.current);
19879
- }
19880
- if (handleGlobalKeydown.current) {
19881
- document.removeEventListener('keydown', handleGlobalKeydown.current);
19882
- }
19883
- if (handleStorageChange.current) {
19884
- window.removeEventListener('storage', handleStorageChange.current);
19885
- }
19887
+ // 全局事件监听器已在上层清理
19886
19888
  resolve();
19887
19889
  } catch (error) {
19888
- console.warn('[BsSulaQueryTable] 第三阶段清理错误:', error);
19889
19890
  resolve();
19890
19891
  }
19891
19892
  });
@@ -19917,8 +19918,6 @@ var BsSulaQueryTable = (function (props) {
19917
19918
  case 4:
19918
19919
  _context.p = 4;
19919
19920
  _t = _context.v;
19920
- console.warn('[BsSulaQueryTable] 清理任务执行失败:', _t);
19921
- // 继续执行下一个任务
19922
19921
  case 5:
19923
19922
  _i++;
19924
19923
  _context.n = 1;
@@ -19933,9 +19932,132 @@ var BsSulaQueryTable = (function (props) {
19933
19932
  };
19934
19933
  }();
19935
19934
  // 异步执行清理任务
19936
- executeCleanupTasks().catch(function (error) {
19937
- console.error('[BsSulaQueryTable] 清理任务队列执行失败:', error);
19938
- });
19935
+ executeCleanupTasks().catch(function (error) {});
19936
+ // 设置卸载标志,防止后续创建新的Summary组件
19937
+ isUnmountedRef.current = true;
19938
+ // 清理Summary相关的DOM节点和React Fiber引用
19939
+ try {
19940
+ // 清理Summary组件实例
19941
+ if (tempInstancesRef.current && tempInstancesRef.current.length > 0) {
19942
+ tempInstancesRef.current.forEach(function (instance) {
19943
+ try {
19944
+ // 首先调用实例的自定义清理方法
19945
+ if (typeof instance._bsQueryTableCleanup === 'function') {
19946
+ instance._bsQueryTableCleanup();
19947
+ }
19948
+ // 清理React Fiber节点引用
19949
+ if (instance._reactInternalFiber) {
19950
+ // 断开stateNode引用链
19951
+ if (instance._reactInternalFiber.stateNode) {
19952
+ instance._reactInternalFiber.stateNode = null;
19953
+ }
19954
+ // 断开child引用链
19955
+ if (instance._reactInternalFiber.child) {
19956
+ instance._reactInternalFiber.child = null;
19957
+ }
19958
+ // 断开memoizedProps引用链
19959
+ if (instance._reactInternalFiber.memoizedProps) {
19960
+ instance._reactInternalFiber.memoizedProps = null;
19961
+ }
19962
+ // 清理updateQueue
19963
+ if (instance._reactInternalFiber.updateQueue) {
19964
+ instance._reactInternalFiber.updateQueue = null;
19965
+ }
19966
+ // 清理lastEffect
19967
+ if (instance._reactInternalFiber.lastEffect) {
19968
+ instance._reactInternalFiber.lastEffect = null;
19969
+ }
19970
+ }
19971
+ // 清理React 18+ Fiber节点引用
19972
+ if (instance._reactInternals) {
19973
+ if (instance._reactInternals.stateNode) {
19974
+ instance._reactInternals.stateNode = null;
19975
+ }
19976
+ if (instance._reactInternals.child) {
19977
+ instance._reactInternals.child = null;
19978
+ }
19979
+ if (instance._reactInternals.memoizedProps) {
19980
+ instance._reactInternals.memoizedProps = null;
19981
+ }
19982
+ if (instance._reactInternals.updateQueue) {
19983
+ instance._reactInternals.updateQueue = null;
19984
+ }
19985
+ }
19986
+ // 清理React实例的内部引用
19987
+ if (instance && _typeof(instance) === 'object') {
19988
+ // 清理可能的DOM引用
19989
+ if (instance.current && _typeof(instance.current) === 'object') {
19990
+ var domNode = instance.current;
19991
+ // 清理DOM节点上的React Fiber引用
19992
+ var reactKeys = Object.keys(domNode).filter(function (key) {
19993
+ return key.startsWith('__reactFiber') || key.startsWith('__reactInternalInstance') || key.startsWith('__reactEventHandlers');
19994
+ });
19995
+ reactKeys.forEach(function (key) {
19996
+ try {
19997
+ delete domNode[key];
19998
+ } catch (e) {}
19999
+ });
20000
+ }
20001
+ }
20002
+ } catch (error) {}
20003
+ });
20004
+ }
20005
+ // DOM节点引用已简化,无需额外清理
20006
+ // 清理context相关的闭包引用
20007
+ try {
20008
+ // 清理getTableSummaryInfo函数中可能的context引用
20009
+ if (typeof getTableSummaryInfo === 'function') {
20010
+ // 尝试清理函数闭包中的context引用
20011
+ Object.defineProperty(getTableSummaryInfo, 'context', {
20012
+ value: null,
20013
+ writable: true,
20014
+ configurable: true
20015
+ });
20016
+ }
20017
+ // 清理可能的全局context引用
20018
+ if (typeof window !== 'undefined') {
20019
+ // 清理可能存在的全局context缓存
20020
+ var contextKeys = Object.keys(window).filter(function (key) {
20021
+ return key.includes('context') || key.includes('Context') || key.includes('restProps') || key.includes('setPagePath');
20022
+ });
20023
+ contextKeys.forEach(function (key) {
20024
+ try {
20025
+ if (window[key] && _typeof(window[key]) === 'object') {
20026
+ // 清理context对象的引用
20027
+ Object.keys(window[key]).forEach(function (contextKey) {
20028
+ if (window[key][contextKey] && _typeof(window[key][contextKey]) === 'object') {
20029
+ window[key][contextKey] = null;
20030
+ }
20031
+ });
20032
+ }
20033
+ } catch (e) {}
20034
+ });
20035
+ }
20036
+ // 清理组件内部可能的context引用
20037
+ if (config && _typeof(config) === 'object') {
20038
+ // 清理config中可能的context引用
20039
+ Object.keys(config).forEach(function (key) {
20040
+ if (config[key] && _typeof(config[key]) === 'object' && config[key].context) {
20041
+ config[key].context = null;
20042
+ }
20043
+ });
20044
+ }
20045
+ } catch (contextError) {}
20046
+ } catch (error) {}
20047
+ // 清理memoConfig引用,断开与外部库的连接
20048
+ if (memoConfigRef.current) {
20049
+ // 将summaryList设置为null,通知外部库释放引用
20050
+ if (memoConfigRef.current.summaryList) {
20051
+ memoConfigRef.current.summaryList = null;
20052
+ }
20053
+ // 清理其他可能的函数引用
20054
+ Object.keys(memoConfigRef.current).forEach(function (key) {
20055
+ if (typeof memoConfigRef.current[key] === 'function') {
20056
+ memoConfigRef.current[key] = null;
20057
+ }
20058
+ });
20059
+ memoConfigRef.current = null;
20060
+ }
19939
20061
  // 清理所有ref引用
19940
20062
  if (rowsRef.current) {
19941
20063
  rowsRef.current = null;
@@ -19952,12 +20074,35 @@ var BsSulaQueryTable = (function (props) {
19952
20074
  if (exportTableRef.current) {
19953
20075
  exportTableRef.current = null;
19954
20076
  }
20077
+ // 强制断开与外部库的引用关系
20078
+ try {
20079
+ // 清理全局事件监听器
20080
+ if (typeof window !== 'undefined') {
20081
+ window.removeEventListener('resize', watchWinResize);
20082
+ window.removeEventListener('keydown', handleKeyDown);
20083
+ }
20084
+ // 清理可能的全局变量引用
20085
+ if (typeof window !== 'undefined' && window.__bsSulaQueryTableInstances) {
20086
+ var instances = window.__bsSulaQueryTableInstances;
20087
+ var instanceIndex = instances.findIndex(function (instance) {
20088
+ return instance.id === componentId;
20089
+ });
20090
+ if (instanceIndex > -1) {
20091
+ instances.splice(instanceIndex, 1);
20092
+ }
20093
+ }
20094
+ // 强制垃圾回收提示(仅开发环境)
20095
+ if (process.env.NODE_ENV === 'development' && typeof window !== 'undefined' && window.gc) {
20096
+ setTimeout(function () {
20097
+ try {
20098
+ window.gc();
20099
+ } catch (e) {
20100
+ // 忽略垃圾回收错误
20101
+ }
20102
+ }, 100);
20103
+ }
20104
+ } catch (error) {}
19955
20105
  // 最终状态验证
19956
- console.log('[BsSulaQueryTable] 组件卸载流程完成,清理状态:', {
19957
- refsCleared: !rowsRef.current && !sortTableRef.current && !searchTableRef.current,
19958
- timersCleared: !debounceTimer.current && !resizeTimer.current
19959
- });
19960
- console.log('[BsSulaQueryTable] 主组件及所有子组件已完全卸载,内存已清理');
19961
20106
  };
19962
20107
  }, []);
19963
20108
  React$1.useEffect(function () {
@@ -19989,22 +20134,30 @@ var BsSulaQueryTable = (function (props) {
19989
20134
  // 清理之前的定时器
19990
20135
  if (debounceTimer.current) {
19991
20136
  clearTimeout(debounceTimer.current);
20137
+ debounceTimer.current = null;
19992
20138
  }
19993
20139
  // 设置新的定时器
19994
20140
  debounceTimer.current = setTimeout(function () {
19995
- // getTableHeight();
19996
- if (!checkFull()) {
19997
- // addTabsNavStyle(true);
19998
- // 全屏下按键esc后要执行的动作
19999
- // isFullScreen 为true 此时为全屏状态 false 为非全屏状态
20000
- if (!isFullScreen) {
20001
- // 按下esc键退出全屏
20002
- setIsFnllScreen(false);
20003
- } else {
20004
- setIsFnllScreen(false);
20141
+ try {
20142
+ // 检查组件是否已卸载
20143
+ if (isUnmountedRef.current) {
20144
+ return;
20145
+ }
20146
+ // getTableHeight();
20147
+ if (!checkFull()) {
20148
+ // addTabsNavStyle(true);
20149
+ // 全屏下按键esc后要执行的动作
20150
+ // isFullScreen 为true 此时为全屏状态 false 为非全屏状态
20151
+ if (!isFullScreen) {
20152
+ // 按下esc键退出全屏
20153
+ setIsFnllScreen(false);
20154
+ } else {
20155
+ setIsFnllScreen(false);
20156
+ }
20005
20157
  }
20158
+ } catch (error) {} finally {
20159
+ debounceTimer.current = null;
20006
20160
  }
20007
- debounceTimer.current = null;
20008
20161
  }, 10);
20009
20162
  }, [isFullScreen]);
20010
20163
  var setCommonRenderFn = function setCommonRenderFn(columns) {
@@ -20019,8 +20172,8 @@ var BsSulaQueryTable = (function (props) {
20019
20172
  }
20020
20173
  });
20021
20174
  };
20022
- // 处理 table 基本参数
20023
- var setTableProps = function setTableProps() {
20175
+ // 处理 table 基本参数 - 使用useCallback避免闭包引用
20176
+ var setTableProps = React$1.useCallback(function () {
20024
20177
  var _value$tableProps3, _value$tableProps4, _value$tableProps4$in, _tableProps$initialPa;
20025
20178
  var defaultPageSize = 20;
20026
20179
  var baseTableProps = {
@@ -20031,7 +20184,7 @@ var BsSulaQueryTable = (function (props) {
20031
20184
  expandable: props.expandable,
20032
20185
  scroll: {
20033
20186
  x: props.overScrollX || 'max-content',
20034
- y: (props === null || props === void 0 ? void 0 : props.overScrollY) || height
20187
+ y: (props === null || props === void 0 ? void 0 : props.overScrollY) || heightRef.current
20035
20188
  },
20036
20189
  bordered: typeof value.bordered === 'boolean' ? value.bordered : true,
20037
20190
  sticky: typeof value.sticky === 'boolean' ? value.sticky : true,
@@ -20062,7 +20215,7 @@ var BsSulaQueryTable = (function (props) {
20062
20215
  showQuickJumper: true,
20063
20216
  hideOnSinglePage: value.hideOnSinglePage || false
20064
20217
  }, (_value$tableProps4 = value.tableProps) === null || _value$tableProps4 === void 0 ? void 0 : (_value$tableProps4$in = _value$tableProps4.initialPaging) === null || _value$tableProps4$in === void 0 ? void 0 : _value$tableProps4$in.pagination);
20065
- var handleRowClick = function handleRowClick(record) {
20218
+ var handleRowClick = React$1.useCallback(function (record) {
20066
20219
  var _rowsRef$current, _rowsRef$current2;
20067
20220
  var rowKey = value.rowKey;
20068
20221
  var newSelectedRowKeys = _toConsumableArray((rowsRef === null || rowsRef === void 0 ? void 0 : (_rowsRef$current = rowsRef.current) === null || _rowsRef$current === void 0 ? void 0 : _rowsRef$current.selectedRowKeys) || []);
@@ -20087,16 +20240,15 @@ var BsSulaQueryTable = (function (props) {
20087
20240
  // 直接将 record 作为数组元素传递
20088
20241
  rowSelection.onChange(newSelectedRowKeys, newSelectedRows);
20089
20242
  }
20090
- };
20091
- var handleRowDoubleClick = function handleRowDoubleClick(record) {
20092
- console.log('handleRowDoubleClick', record);
20243
+ }, [value.rowKey, value.rowSelection]);
20244
+ var handleRowDoubleClick = React$1.useCallback(function (record) {
20093
20245
  if (props.viewPagePath) {
20094
20246
  var path = eval("`".concat(props.viewPagePath.replace(/'/g, '`').replace(/#{(.*?)}/g, function (match, p) {
20095
20247
  return "${".concat(p, "}");
20096
20248
  }), "`"));
20097
20249
  umi.history.push(path);
20098
20250
  }
20099
- };
20251
+ }, [props.viewPagePath, umi.history]);
20100
20252
  var tableProps = _objectSpread2(_objectSpread2({}, baseTableProps), {}, {
20101
20253
  initialPaging: {
20102
20254
  pagination: paginationConfig
@@ -20118,7 +20270,7 @@ var BsSulaQueryTable = (function (props) {
20118
20270
  tableProps.initialPaging.pagination.showSizeChanger = true;
20119
20271
  }
20120
20272
  return tableProps;
20121
- };
20273
+ }, [value, props, rowsRef, umi.history]); // 不包含height依赖,使用heightRef.current
20122
20274
  var handleTimeValue = function handleTimeValue() {
20123
20275
  var _value$actionsRender, _value$exportConfig;
20124
20276
  var actionsRender = ((_value$actionsRender = value.actionsRender) !== null && _value$actionsRender !== void 0 ? _value$actionsRender : []).map(function (x) {
@@ -20317,12 +20469,78 @@ var BsSulaQueryTable = (function (props) {
20317
20469
  (_config$ref = config.ref) === null || _config$ref === void 0 ? void 0 : (_config$ref$current = _config$ref.current) === null || _config$ref$current === void 0 ? void 0 : (_config$ref$current$t = _config$ref$current.tableRef) === null || _config$ref$current$t === void 0 ? void 0 : (_config$ref$current$t2 = _config$ref$current$t.current) === null || _config$ref$current$t2 === void 0 ? void 0 : _config$ref$current$t2.refreshTable();
20318
20470
  }
20319
20471
  }
20320
- setTimeout(function () {
20321
- // 处理页面刷新两面
20322
- localStorage.removeItem('isTabChange');
20472
+ var timeoutId = setTimeout(function () {
20473
+ try {
20474
+ // 检查组件是否已卸载
20475
+ if (isUnmountedRef.current) {
20476
+ return;
20477
+ }
20478
+ // 处理页面刷新两面
20479
+ localStorage.removeItem('isTabChange');
20480
+ } catch (error) {}
20323
20481
  }, 0);
20482
+ return function () {
20483
+ clearTimeout(timeoutId);
20484
+ };
20324
20485
  }, [pathname]);
20486
+ // 增强的外部库引用管理
20487
+ React$1.useEffect(function () {
20488
+ // 生成唯一组件ID
20489
+ var componentId = "bsSulaQueryTable_".concat(Date.now(), "_").concat(Math.random().toString(36).substr(2, 9));
20490
+ // 注册到全局实例管理器(如果存在)
20491
+ if (typeof window !== 'undefined') {
20492
+ if (!window.__bsSulaQueryTableInstances) {
20493
+ window.__bsSulaQueryTableInstances = [];
20494
+ }
20495
+ window.__bsSulaQueryTableInstances.push({
20496
+ id: componentId,
20497
+ cleanup: function cleanup() {
20498
+ // 提供给外部库的清理接口
20499
+ isUnmountedRef.current = true;
20500
+ if (memoConfigRef.current) {
20501
+ memoConfigRef.current.summaryList = null;
20502
+ }
20503
+ }
20504
+ });
20505
+ }
20506
+ return function () {
20507
+ // 从全局实例管理器中移除
20508
+ if (typeof window !== 'undefined' && window.__bsSulaQueryTableInstances) {
20509
+ var instances = window.__bsSulaQueryTableInstances;
20510
+ var instanceIndex = instances.findIndex(function (instance) {
20511
+ return instance.id === componentId;
20512
+ });
20513
+ if (instanceIndex > -1) {
20514
+ instances.splice(instanceIndex, 1);
20515
+ }
20516
+ }
20517
+ };
20518
+ }, []);
20325
20519
  var expandedRowKeys = props === null || props === void 0 ? void 0 : (_props$expandable = props.expandable) === null || _props$expandable === void 0 ? void 0 : _props$expandable.expandedRowKeys;
20520
+ // 组件卸载状态跟踪
20521
+ var isUnmountedRef = React$1.useRef(false);
20522
+ // 使用WeakSet减少强引用,避免内存泄漏
20523
+ var summaryInstancesRef = React$1.useRef(new WeakSet());
20524
+ // 临时存储强引用用于清理,清理完成后立即清空
20525
+ var tempInstancesRef = React$1.useRef([]);
20526
+ // 存储memoConfig引用,用于卸载时清理
20527
+ var memoConfigRef = React$1.useRef(null);
20528
+ // 使用ref存储状态,避免getTableSummaryInfo函数的闭包依赖
20529
+ var stateRef = React$1.useRef({
20530
+ summaryList: props.summaryList,
20531
+ rowSelection: props.rowSelection,
20532
+ expandable: props.expandable,
20533
+ showColumn: showColumn
20534
+ });
20535
+ // 更新stateRef
20536
+ React$1.useEffect(function () {
20537
+ stateRef.current = {
20538
+ summaryList: props.summaryList,
20539
+ rowSelection: props.rowSelection,
20540
+ expandable: props.expandable,
20541
+ showColumn: showColumn
20542
+ };
20543
+ }, [props.summaryList, props.rowSelection, props.expandable, showColumn]);
20326
20544
  //todo summary属性已经被使用,为了兼容之前的,现在使用 summaryList
20327
20545
  //结构为了实现多行总结栏 定义如下(lableShow: boolean 是否显示列文本)
20328
20546
  /**
@@ -20334,49 +20552,151 @@ var BsSulaQueryTable = (function (props) {
20334
20552
  * @returns []
20335
20553
  */
20336
20554
  var getTableSummaryInfo = React$1.useCallback(function () {
20337
- var summaryList = props.summaryList,
20338
- rowSelection = props.rowSelection,
20339
- expandable = props.expandable;
20555
+ // 检查组件是否已卸载,避免创建新的JSX元素
20556
+ if (isUnmountedRef.current) {
20557
+ return undefined;
20558
+ }
20559
+ // 使用ref访问状态,避免闭包依赖
20560
+ var _stateRef$current = stateRef.current,
20561
+ summaryList = _stateRef$current.summaryList,
20562
+ rowSelection = _stateRef$current.rowSelection,
20563
+ expandable = _stateRef$current.expandable,
20564
+ showColumn = _stateRef$current.showColumn;
20340
20565
  if (summaryList && Array.isArray(summaryList)) {
20341
20566
  var summaryRow = rowSelection ? [{}].concat(_toConsumableArray(showColumn)) : _toConsumableArray(showColumn);
20342
20567
  if (expandable) {
20343
20568
  summaryRow.unshift({});
20344
20569
  }
20345
20570
  // let summaryInitial = summary().cont;
20346
- return /*#__PURE__*/React__default['default'].createElement(antd.Table.Summary, {
20347
- fixed: true
20571
+ // 创建Summary组件并跟踪实例,添加强化的清理逻辑
20572
+ var summaryElement = /*#__PURE__*/React__default['default'].createElement(antd.Table.Summary, {
20573
+ fixed: true,
20574
+ ref: function ref(_ref5) {
20575
+ if (_ref5 && !isUnmountedRef.current) {
20576
+ summaryInstancesRef.current.add(_ref5);
20577
+ tempInstancesRef.current.push(_ref5);
20578
+ // 为每个Summary实例添加清理标记
20579
+ if (_ref5 && _typeof(_ref5) === 'object') {
20580
+ _ref5._bsQueryTableCleanup = function () {
20581
+ try {
20582
+ // 清理可能的context引用
20583
+ if (_ref5.context) {
20584
+ _ref5.context = null;
20585
+ }
20586
+ // 清理可能的props引用
20587
+ if (_ref5.props) {
20588
+ Object.keys(_ref5.props).forEach(function (key) {
20589
+ if (typeof _ref5.props[key] === 'function') {
20590
+ _ref5.props[key] = null;
20591
+ }
20592
+ });
20593
+ }
20594
+ // 清理可能的state引用
20595
+ if (_ref5.state) {
20596
+ _ref5.state = null;
20597
+ }
20598
+ } catch (error) {}
20599
+ };
20600
+ }
20601
+ } else if (_ref5 && isUnmountedRef.current) {
20602
+ // 如果组件已卸载但仍有ref回调,立即清理
20603
+
20604
+ if (typeof _ref5._bsQueryTableCleanup === 'function') {
20605
+ _ref5._bsQueryTableCleanup();
20606
+ }
20607
+ }
20608
+ }
20348
20609
  }, Array.isArray(summaryList) && summaryList.map(function (summaryItem, summaryIndex) {
20610
+ // 再次检查卸载状态
20611
+ if (isUnmountedRef.current) return null;
20349
20612
  return /*#__PURE__*/React__default['default'].createElement(antd.Table.Summary.Row, {
20350
- key: summaryIndex
20613
+ key: summaryIndex,
20614
+ ref: function ref(_ref6) {
20615
+ if (_ref6 && !isUnmountedRef.current) {
20616
+ summaryInstancesRef.current.add(_ref6);
20617
+ tempInstancesRef.current.push(_ref6);
20618
+ // 为Summary.Row添加清理标记
20619
+ if (_ref6 && _typeof(_ref6) === 'object') {
20620
+ _ref6._bsQueryTableCleanup = function () {
20621
+ try {
20622
+ if (_ref6.context) _ref6.context = null;
20623
+ if (_ref6.props) {
20624
+ Object.keys(_ref6.props).forEach(function (key) {
20625
+ if (typeof _ref6.props[key] === 'function') {
20626
+ _ref6.props[key] = null;
20627
+ }
20628
+ });
20629
+ }
20630
+ if (_ref6.state) _ref6.state = null;
20631
+ } catch (error) {}
20632
+ };
20633
+ }
20634
+ } else if (_ref6 && isUnmountedRef.current) {
20635
+ if (typeof _ref6._bsQueryTableCleanup === 'function') {
20636
+ _ref6._bsQueryTableCleanup();
20637
+ }
20638
+ }
20639
+ }
20351
20640
  }, summaryRow.map(function (item, index) {
20641
+ // 检查卸载状态
20642
+ if (isUnmountedRef.current) return null;
20352
20643
  var _summaryItem$cout = summaryItem.cout,
20353
20644
  cout = _summaryItem$cout === void 0 ? [] : _summaryItem$cout;
20354
20645
  var target = cout.filter(function (inner) {
20355
20646
  return inner.key && (inner.key === item.dataIndex || inner.key === item.key);
20356
20647
  })[0];
20648
+ var cellRef = function cellRef(ref) {
20649
+ if (ref && !isUnmountedRef.current) {
20650
+ summaryInstancesRef.current.add(ref);
20651
+ tempInstancesRef.current.push(ref);
20652
+ // 为Summary.Cell添加清理标记
20653
+ if (ref && _typeof(ref) === 'object') {
20654
+ ref._bsQueryTableCleanup = function () {
20655
+ try {
20656
+ if (ref.context) ref.context = null;
20657
+ if (ref.props) {
20658
+ Object.keys(ref.props).forEach(function (key) {
20659
+ if (typeof ref.props[key] === 'function') {
20660
+ ref.props[key] = null;
20661
+ }
20662
+ });
20663
+ }
20664
+ if (ref.state) ref.state = null;
20665
+ } catch (error) {}
20666
+ };
20667
+ }
20668
+ } else if (ref && isUnmountedRef.current) {
20669
+ if (typeof ref._bsQueryTableCleanup === 'function') {
20670
+ ref._bsQueryTableCleanup();
20671
+ }
20672
+ }
20673
+ };
20357
20674
  if (target) {
20358
20675
  var _target$value;
20359
20676
  var labelText = target.labelShow ? "".concat(item.title, ":") : "";
20360
20677
  return /*#__PURE__*/React__default['default'].createElement(antd.Table.Summary.Cell, {
20361
20678
  index: index,
20362
- key: "Table.Summary.Cell_".concat(item.index)
20679
+ key: "Table.Summary.Cell_".concat(item.index),
20680
+ ref: cellRef
20363
20681
  }, /*#__PURE__*/React__default['default'].createElement(Text$2, {
20364
20682
  type: "danger"
20365
20683
  }, "".concat(labelText, " ").concat((_target$value = target.value) !== null && _target$value !== void 0 ? _target$value : '')));
20366
20684
  } else {
20367
20685
  return /*#__PURE__*/React__default['default'].createElement(antd.Table.Summary.Cell, {
20368
20686
  index: index,
20369
- key: "Table.Summary.Cell_".concat(item.index)
20687
+ key: "Table.Summary.Cell_".concat(item.index),
20688
+ ref: cellRef
20370
20689
  }, /*#__PURE__*/React__default['default'].createElement(Text$2, {
20371
20690
  type: "danger"
20372
20691
  }, " "));
20373
20692
  }
20374
20693
  }));
20375
20694
  }));
20695
+ return summaryElement;
20376
20696
  } else {
20377
20697
  return undefined;
20378
20698
  }
20379
- }, [props.summaryList, props.rowSelection, props.expandable, showColumn]);
20699
+ }, []); // 移除所有依赖项,使用stateRef访问最新状态
20380
20700
  var columnsDom = /*#__PURE__*/React__default['default'].createElement("span", {
20381
20701
  className: "ant-dropdown-link"
20382
20702
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -20398,7 +20718,11 @@ var BsSulaQueryTable = (function (props) {
20398
20718
  bsTableCode: bsTableCode
20399
20719
  });
20400
20720
  var memoConfig = React$1.useMemo(function () {
20401
- return _objectSpread2(_objectSpread2({}, config), {}, {
20721
+ // 检查组件是否已卸载
20722
+ if (isUnmountedRef.current) {
20723
+ return {};
20724
+ }
20725
+ var memoConfigObject = _objectSpread2(_objectSpread2({}, config), {}, {
20402
20726
  summary: props.summary,
20403
20727
  summaryList: props.summaryList ? getTableSummaryInfo : undefined,
20404
20728
  statusMapping: props.statusMapping,
@@ -20406,7 +20730,12 @@ var BsSulaQueryTable = (function (props) {
20406
20730
  columnsDom: columnsDom,
20407
20731
  queryFieldsDom: queryFieldsDom
20408
20732
  });
20409
- }, [checkedList, showColumn, props.statusMapping, showSearchFields, expandedRowKeys, getTableSummaryInfo, props.summaryList, props.summary]);
20733
+ // 存储memoConfig引用用于清理
20734
+ memoConfigRef.current = memoConfigObject;
20735
+ return memoConfigObject;
20736
+ }, [
20737
+ // 只保留必要的依赖项,避免不必要的重新计算
20738
+ showColumn, props.statusMapping, showSearchFields, expandedRowKeys, getTableSummaryInfo, props.summaryList, props.summary, props.rowSelection, props.expandable, config, bsTableCode]);
20410
20739
  return /*#__PURE__*/React__default['default'].createElement("div", {
20411
20740
  data: "bssulaquerydatadiv",
20412
20741
  id: "bs-sula-query-table"
@@ -22249,31 +22578,33 @@ var CustomerMenu = /*#__PURE__*/React$1.forwardRef(function (_ref, ref) {
22249
22578
  _useState4 = _slicedToArray(_useState3, 2),
22250
22579
  settingModal = _useState4[0],
22251
22580
  settingModalFn = _useState4[1];
22252
- var handleMenuClick = function handleMenuClick(item) {
22581
+ var handleMenuClick = React$1.useCallback(function (item) {
22253
22582
  if (item.children || !item.component) return;
22254
- setIsDrawer(!isDrawer);
22583
+ setIsDrawer(false);
22255
22584
  umi.history.push({
22256
22585
  pathname: item.path
22257
22586
  });
22258
- };
22259
- var _getMenuDom = function getMenuDom(menuData) {
22260
- return menuData.map(function (item) {
22587
+ }, []);
22588
+ var getMenuDom = React$1.useCallback(function (menuData) {
22589
+ return menuData.map(function (item, index) {
22261
22590
  return /*#__PURE__*/React__default['default'].createElement("div", {
22591
+ key: "".concat(item.path || item.name, "-").concat(index),
22262
22592
  style: {
22263
22593
  paddingLeft: '10px'
22264
22594
  }
22265
22595
  }, /*#__PURE__*/React__default['default'].createElement("div", {
22266
- onClick: function onClick() {
22267
- handleMenuClick(item);
22596
+ onClick: item.children || !item.component ? undefined : function () {
22597
+ return handleMenuClick(item);
22268
22598
  },
22269
22599
  className: 'menu_item'.concat(" ", item.children || !item.component ? '' : 'link_style'),
22270
22600
  style: {
22271
22601
  fontWeight: item.children || !item.component ? 'bolder' : '400',
22272
- paddingLeft: '4px'
22602
+ paddingLeft: '4px',
22603
+ cursor: item.children || !item.component ? 'default' : 'pointer'
22273
22604
  }
22274
- }, item.name), !!item.children && !!item.children.length && _getMenuDom(item.children));
22605
+ }, item.name), !!item.children && !!item.children.length && getMenuDom(item.children));
22275
22606
  });
22276
- };
22607
+ }, [handleMenuClick]);
22277
22608
  return /*#__PURE__*/React__default['default'].createElement("div", {
22278
22609
  className: 'customer_menu_content'
22279
22610
  }, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -22318,7 +22649,7 @@ var CustomerMenu = /*#__PURE__*/React$1.forwardRef(function (_ref, ref) {
22318
22649
  visible: isDrawer
22319
22650
  }, /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("p", {
22320
22651
  className: 'menu_title_line'
22321
- }, "\u81EA\u5B9A\u4E49\u83DC\u5355"), _getMenuDom(menuData)))), /*#__PURE__*/React__default['default'].createElement(antd.Modal, _objectSpread2({
22652
+ }, "\u81EA\u5B9A\u4E49\u83DC\u5355"), getMenuDom(menuData)))), /*#__PURE__*/React__default['default'].createElement(antd.Modal, _objectSpread2({
22322
22653
  title: /*#__PURE__*/React__default['default'].createElement("span", {
22323
22654
  style: {
22324
22655
  fontWeight: '600',
@@ -22387,6 +22718,7 @@ var DrawContent$1 = function DrawContent(_ref) {
22387
22718
  var timeoutRef = React$1.useRef(null);
22388
22719
  var resizeHandlerRef = React$1.useRef(null);
22389
22720
  var debounceTimerRef = React$1.useRef(null);
22721
+ var drawContentRef = React$1.useRef(null);
22390
22722
  React$1.useEffect(function () {
22391
22723
  var _originRoutes$find;
22392
22724
  getMenuContentHeight();
@@ -22433,14 +22765,19 @@ var DrawContent$1 = function DrawContent(_ref) {
22433
22765
  clearTimeout(debounceTimerRef.current);
22434
22766
  debounceTimerRef.current = null;
22435
22767
  }
22768
+ // 清理DOM引用
22769
+ drawContentRef.current = null;
22436
22770
  };
22437
22771
  }, []);
22438
22772
  React$1.useLayoutEffect(function () {
22439
22773
  timeoutRef.current = setTimeout(function () {
22440
22774
  if (!isUnmountedRef.current) {
22441
- var drawContentElement = document.getElementById("drawContent");
22442
- if (drawContentElement) {
22443
- var drawContentHeight = drawContentElement.scrollHeight;
22775
+ // 使用缓存的DOM引用,避免重复查询
22776
+ if (!drawContentRef.current) {
22777
+ drawContentRef.current = document.getElementById("drawContent");
22778
+ }
22779
+ if (drawContentRef.current) {
22780
+ var drawContentHeight = drawContentRef.current.scrollHeight;
22444
22781
  if (drawContentHeight > rightMenuHeight) {
22445
22782
  setMoreBtnShow(true);
22446
22783
  }
@@ -22461,9 +22798,12 @@ var DrawContent$1 = function DrawContent(_ref) {
22461
22798
  setDrawHeight(clientHeight - 70);
22462
22799
  }
22463
22800
  }, []);
22801
+ // 优化递归渲染函数,使用React.memo减少重复渲染
22464
22802
  var renderChildItem = React$1.useCallback(function (child) {
22465
22803
  if (!child.hideInMenu && child.children) {
22466
- return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(antd.List.Item, {
22804
+ return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, {
22805
+ key: child.path || child.locale
22806
+ }, /*#__PURE__*/React__default['default'].createElement(antd.List.Item, {
22467
22807
  style: {
22468
22808
  color: '#000',
22469
22809
  fontWeight: 'bold'
@@ -22474,7 +22814,14 @@ var DrawContent$1 = function DrawContent(_ref) {
22474
22814
  return renderChildItem(menuItem);
22475
22815
  }));
22476
22816
  } else if (!child.hideInMenu && child.path) {
22817
+ var displayText = umi.formatMessage({
22818
+ id: "".concat(child.locale)
22819
+ });
22820
+ var truncatedText = displayText.length > 10 ? "".concat(umi.formatMessage({
22821
+ id: "".concat(child.name)
22822
+ }).slice(0, 10), "...") : displayText;
22477
22823
  return /*#__PURE__*/React__default['default'].createElement(antd.List.Item, {
22824
+ key: child.path,
22478
22825
  style: {
22479
22826
  fontSize: '12px'
22480
22827
  },
@@ -22485,20 +22832,14 @@ var DrawContent$1 = function DrawContent(_ref) {
22485
22832
  onMenuClick(e, child);
22486
22833
  }
22487
22834
  }, /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
22488
- title: umi.formatMessage({
22489
- id: "".concat(child.locale)
22490
- })
22491
- }, umi.formatMessage({
22492
- id: "".concat(child.locale)
22493
- }).length > 10 ? "".concat(umi.formatMessage({
22494
- id: "".concat(child.name)
22495
- }).slice(0, 10), "...") : umi.formatMessage({
22496
- id: "".concat(child.locale)
22497
- })), /*#__PURE__*/React__default['default'].createElement("img", {
22835
+ title: displayText
22836
+ }, truncatedText), /*#__PURE__*/React__default['default'].createElement("img", {
22498
22837
  className: "allFuncOnMouseroverImg",
22499
- src: right
22838
+ src: right,
22839
+ alt: "arrow"
22500
22840
  })));
22501
22841
  }
22842
+ return null;
22502
22843
  }, [onMenuClick]);
22503
22844
  var onMenuClick = React$1.useCallback(function (e, item) {
22504
22845
  if (isUnmountedRef.current) return;
@@ -22543,7 +22884,50 @@ var DrawContent$1 = function DrawContent(_ref) {
22543
22884
  debouncedSearch(e.target.value);
22544
22885
  }
22545
22886
  }, [debouncedSearch]);
22546
- var searchHistoryList = JSON.parse(localStorage.getItem("".concat(itemPath, "_search_history")) || '[]');
22887
+ // 优化菜单项点击处理器
22888
+ var handleMenuItemClick = React$1.useCallback(function (item) {
22889
+ if (isUnmountedRef.current) return;
22890
+ if (item.component) {
22891
+ umi.history.push({
22892
+ pathname: item.path
22893
+ });
22894
+ onClose();
22895
+ } else {
22896
+ setCurrentOneLevel(item.path);
22897
+ var currentDom = document.getElementById(item.path);
22898
+ currentDom && currentDom.scrollIntoView();
22899
+ }
22900
+ }, [onClose]);
22901
+ // 优化关闭按钮点击处理器
22902
+ var handleCloseClick = React$1.useCallback(function () {
22903
+ if (!isUnmountedRef.current) {
22904
+ onClose();
22905
+ }
22906
+ }, [onClose]);
22907
+ // 优化搜索结果点击处理器
22908
+ var handleSearchResultClick = React$1.useCallback(function (item) {
22909
+ if (!isUnmountedRef.current) {
22910
+ onMenuClick({
22911
+ stopPropagation: function stopPropagation() {},
22912
+ preventDefault: function preventDefault() {}
22913
+ }, item);
22914
+ }
22915
+ }, [onMenuClick]);
22916
+ // 优化更多按钮点击处理器
22917
+ var handleMoreButtonClick = React$1.useCallback(function () {
22918
+ if (!isUnmountedRef.current) {
22919
+ setShowScroll(true);
22920
+ setMoreBtnShow(false);
22921
+ }
22922
+ }, []);
22923
+ // 使用useMemo缓存searchHistoryList,避免每次渲染都重新解析localStorage
22924
+ var searchHistoryList = React$1.useMemo(function () {
22925
+ try {
22926
+ return JSON.parse(localStorage.getItem("".concat(itemPath, "_search_history")) || '[]');
22927
+ } catch (error) {
22928
+ return [];
22929
+ }
22930
+ }, [itemPath]);
22547
22931
  return /*#__PURE__*/React__default['default'].createElement("div", {
22548
22932
  style: {
22549
22933
  height: "".concat(drawHeight, "px")
@@ -22561,19 +22945,9 @@ var DrawContent$1 = function DrawContent(_ref) {
22561
22945
  color: currentOneLevel === item.path ? '#005cff' : '#000000'
22562
22946
  },
22563
22947
  onClick: function onClick(e) {
22564
- if (isUnmountedRef.current) return;
22565
22948
  e.stopPropagation();
22566
22949
  e.preventDefault();
22567
- if (item.component) {
22568
- umi.history.push({
22569
- pathname: item.path
22570
- });
22571
- onClose();
22572
- } else {
22573
- setCurrentOneLevel(item.path);
22574
- var currentDom = document.getElementById(item.path);
22575
- currentDom && currentDom.scrollIntoView();
22576
- }
22950
+ handleMenuItemClick(item);
22577
22951
  }
22578
22952
  }, item.name);
22579
22953
  })), /*#__PURE__*/React__default['default'].createElement("div", {
@@ -22582,11 +22956,7 @@ var DrawContent$1 = function DrawContent(_ref) {
22582
22956
  position: 'relative'
22583
22957
  }
22584
22958
  }, /*#__PURE__*/React__default['default'].createElement("img", {
22585
- onClick: function onClick() {
22586
- if (!isUnmountedRef.current) {
22587
- onClose();
22588
- }
22589
- },
22959
+ onClick: handleCloseClick,
22590
22960
  style: {
22591
22961
  position: 'absolute',
22592
22962
  right: '15px',
@@ -22635,10 +23005,8 @@ var DrawContent$1 = function DrawContent(_ref) {
22635
23005
  className: 'search_menu_content'
22636
23006
  }, SearhData.map(function (item) {
22637
23007
  return /*#__PURE__*/React__default['default'].createElement("div", {
22638
- onClick: function onClick(e) {
22639
- if (!isUnmountedRef.current) {
22640
- onMenuClick(e, item);
22641
- }
23008
+ onClick: function onClick() {
23009
+ return handleSearchResultClick(item);
22642
23010
  },
22643
23011
  key: item.path
22644
23012
  }, item.name);
@@ -22709,12 +23077,7 @@ var DrawContent$1 = function DrawContent(_ref) {
22709
23077
  height: '30px'
22710
23078
  }
22711
23079
  }, /*#__PURE__*/React__default['default'].createElement("span", {
22712
- onClick: function onClick() {
22713
- if (!isUnmountedRef.current) {
22714
- setShowScroll(true);
22715
- setMoreBtnShow(false);
22716
- }
22717
- },
23080
+ onClick: handleMoreButtonClick,
22718
23081
  style: {
22719
23082
  color: '#8c8c8c'
22720
23083
  }
@@ -23064,18 +23427,15 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23064
23427
  };
23065
23428
  _this.getDictionaryTextByValue = function (dicCode, value) {
23066
23429
  var _dicData2;
23067
- var startPerformance = performance.now();
23068
23430
  if (window.dicDataTextValue) {
23069
23431
  var dicDataTextValue = window.dicDataTextValue;
23070
23432
  var _dicData = [];
23071
23433
  _dicData = dicDataTextValue[dicCode];
23072
- var endPerformance1 = performance.now();
23073
23434
  if (value === undefined) return "-";
23074
23435
  if (!_dicData) {
23075
23436
  // throw new Error(`当前${dicCode}字典值合没有${value}的数据`)
23076
23437
  return value;
23077
23438
  }
23078
- var endPerformance = performance.now();
23079
23439
  return _dicData[value] || value;
23080
23440
  }
23081
23441
  var dicData = [];
@@ -23210,18 +23570,44 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23210
23570
  });
23211
23571
  _this.setShowMenu(false);
23212
23572
  };
23573
+ // 使用WeakMap存储菜单项引用,避免强引用
23574
+ _this.menuItemsWeakMap = new WeakMap();
23575
+ // 容器级别的事件委托处理器
23576
+ _this.handleMenuContainerClick = function (event) {
23577
+ var target = event.target.closest('[data-menu-item]');
23578
+ if (!target) return;
23579
+ var itemPath = target.getAttribute('data-item-path');
23580
+ var hasChildren = target.getAttribute('data-has-children') === 'true';
23581
+ if (!hasChildren && itemPath) {
23582
+ // 从WeakMap中获取完整的item对象
23583
+ var item = _this.menuItemsWeakMap.get(target) || {
23584
+ path: itemPath
23585
+ };
23586
+ _this.handleMenuClick(item);
23587
+ }
23588
+ };
23213
23589
  _this.getMenuDom = function (menuData) {
23214
- return menuData.map(function (item) {
23215
- return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("div", {
23216
- onClick: function onClick() {
23217
- _this.handleMenuClick(item);
23218
- },
23219
- className: 'menu_item'.concat(" ", item.children || !item.component ? '' : 'link_style'),
23590
+ return menuData.map(function (item, index) {
23591
+ var hasChildren = item.children || !item.component;
23592
+ return /*#__PURE__*/React__default['default'].createElement("div", {
23593
+ key: "".concat(item.path || item.name, "-").concat(index)
23594
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
23595
+ "data-menu-item": "true",
23596
+ "data-item-path": item.path,
23597
+ "data-has-children": hasChildren,
23598
+ className: 'menu_item'.concat(" ", hasChildren ? '' : 'link_style'),
23220
23599
  style: {
23221
- fontWeight: item.children || !item.component ? 'bolder' : '400',
23600
+ fontWeight: hasChildren ? 'bolder' : '400',
23222
23601
  paddingLeft: '10px',
23223
- marginTop: item.children || !item.component ? '5px' : '0px',
23224
- fontSize: item.children || !item.component ? '14px' : '12px'
23602
+ marginTop: hasChildren ? '5px' : '0px',
23603
+ fontSize: hasChildren ? '14px' : '12px',
23604
+ cursor: hasChildren ? 'default' : 'pointer'
23605
+ },
23606
+ ref: function ref(el) {
23607
+ // 使用WeakMap存储元素与item的关联
23608
+ if (el && !hasChildren) {
23609
+ _this.menuItemsWeakMap.set(el, item);
23610
+ }
23225
23611
  }
23226
23612
  }, item.name), !!item.children && !!item.children.length && _this.getMenuDom(item.children));
23227
23613
  });
@@ -23663,7 +24049,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23663
24049
  }, {
23664
24050
  key: "componentWillUnmount",
23665
24051
  value: function componentWillUnmount() {
23666
- var _window$$wujie3;
24052
+ var _window$$wujie3,
24053
+ _this3 = this;
23667
24054
  // 清理路由监听器
23668
24055
  if (UN_LISTTEN_DRP) {
23669
24056
  UN_LISTTEN_DRP();
@@ -23679,21 +24066,72 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23679
24066
  clearTimeout(timeoutId);
23680
24067
  });
23681
24068
  this.timeoutIds.clear();
24069
+ // 清理DOM缓存引用
24070
+ if (this.cachedTabsElements) {
24071
+ this.cachedTabsElements.globalTabsNav = null;
24072
+ this.cachedTabsElements.globalTabsNavWrap = null;
24073
+ this.cachedTabsElements = null;
24074
+ }
24075
+ // 清理ref引用
24076
+ if (this.allFunc && this.allFunc.current) {
24077
+ this.allFunc.current = null;
24078
+ }
24079
+ if (this.customerMenuRef && this.customerMenuRef.current) {
24080
+ this.customerMenuRef.current = null;
24081
+ }
24082
+ if (this.actionRef && this.actionRef.current) {
24083
+ this.actionRef.current = null;
24084
+ }
23682
24085
  // 清理实例属性
23683
24086
  this.routerArray = null;
23684
24087
  this.authMenuPathList = null;
23685
24088
  this.docsId = null;
23686
24089
  this.lastTwoRouterArray = null;
23687
- this.cachedTabsElements = null;
23688
24090
  this.cachedBreadcrumbNameMap = null;
23689
24091
  this.cachedWeiqianduanProps = null;
23690
24092
  this.cachedOperationsSlot = null;
23691
24093
  this.lastIsSliderState = null;
24094
+ // 清理菜单容器的事件监听器
24095
+ var menuContainer = document.querySelector('.sub_menu_content');
24096
+ if (menuContainer) {
24097
+ menuContainer.removeEventListener('click', this.handleMenuContainerClick);
24098
+ // 清理所有菜单项的data属性和引用
24099
+ var menuItems = menuContainer.querySelectorAll('[data-menu-item]');
24100
+ menuItems.forEach(function (item) {
24101
+ // 从WeakMap中移除引用
24102
+ if (_this3.menuItemsWeakMap && _this3.menuItemsWeakMap.has(item)) {
24103
+ _this3.menuItemsWeakMap.delete(item);
24104
+ }
24105
+ // 清理data属性
24106
+ item.removeAttribute('data-menu-item');
24107
+ item.removeAttribute('data-item-path');
24108
+ item.removeAttribute('data-has-children');
24109
+ });
24110
+ }
24111
+ // 清理WeakMap
24112
+ if (this.menuItemsWeakMap) {
24113
+ // WeakMap会自动清理,但显式清空以确保
24114
+ this.menuItemsWeakMap = null;
24115
+ }
24116
+ // 清理方法引用,断开闭包链
24117
+ this.handleMenuClick = null;
24118
+ this.handleMenuContainerClick = null;
24119
+ this.getMenuDom = null;
24120
+ this.setShowMenu = null;
24121
+ this.getTabsNavElements = null;
24122
+ this.setTabNavTransLate = null;
24123
+ this.checkisNavSlide = null;
24124
+ // 强制触发垃圾回收(如果可用)
24125
+ if (window.gc && typeof window.gc === 'function') {
24126
+ setTimeout(function () {
24127
+ return window.gc();
24128
+ }, 0);
24129
+ }
23692
24130
  }
23693
24131
  }, {
23694
24132
  key: "render",
23695
24133
  value: function render() {
23696
- var _this3 = this;
24134
+ var _this4 = this;
23697
24135
  var _this$state4 = this.state,
23698
24136
  listenRouterState = _this$state4.listenRouterState,
23699
24137
  activeKey = _this$state4.activeKey,
@@ -23717,7 +24155,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23717
24155
  className: "tab_title_content"
23718
24156
  }, item.tab, item.key !== '/' && (/*#__PURE__*/React__default['default'].createElement(ItemMenu, {
23719
24157
  info: item,
23720
- operateFun: _this3.operateFun,
24158
+ operateFun: _this4.operateFun,
23721
24159
  listenRouterState: listenRouterState
23722
24160
  })));
23723
24161
  };
@@ -23751,7 +24189,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23751
24189
  }, /*#__PURE__*/React__default['default'].createElement("a", {
23752
24190
  onClick: function onClick() {
23753
24191
  // 关闭全部
23754
- _this3.updateState([_objectSpread2(_objectSpread2({}, _this3.state.homeRouter), {}, {
24192
+ _this4.updateState([_objectSpread2(_objectSpread2({}, _this4.state.homeRouter), {}, {
23755
24193
  key: '/',
23756
24194
  tab: '欢迎',
23757
24195
  closable: false
@@ -23777,7 +24215,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23777
24215
  } else {
23778
24216
  newActiveKey = listenRouterState[1].key;
23779
24217
  }
23780
- _this3.updateState(listenRouterState.filter(function (d) {
24218
+ _this4.updateState(listenRouterState.filter(function (d) {
23781
24219
  return d.key !== activeKey;
23782
24220
  }), listenRouterKey.filter(function (d) {
23783
24221
  return d !== activeKey;
@@ -23804,7 +24242,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23804
24242
  // message.warning('首页不可关闭。');
23805
24243
  // return;
23806
24244
  // }
23807
- _this3.updateState(listenRouterState.filter(function (d, i) {
24245
+ _this4.updateState(listenRouterState.filter(function (d, i) {
23808
24246
  return i >= index || d.key === '/';
23809
24247
  }), listenRouterKey.filter(function (d, i) {
23810
24248
  return i >= index || d === '/';
@@ -23821,7 +24259,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23821
24259
  var index = listenRouterState.findIndex(function (item) {
23822
24260
  return item.key === activeKey;
23823
24261
  });
23824
- _this3.updateState(listenRouterState.filter(function (d, i) {
24262
+ _this4.updateState(listenRouterState.filter(function (d, i) {
23825
24263
  return i <= index || d.key === '/';
23826
24264
  }), listenRouterKey.filter(function (d, i) {
23827
24265
  return i <= index || d === '/';
@@ -23867,7 +24305,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23867
24305
  opacity: this.state.isSlider ? 1 : 0.5
23868
24306
  },
23869
24307
  onClick: function onClick() {
23870
- _this3.setTabNavTransLate(-100);
24308
+ _this4.setTabNavTransLate(-100);
23871
24309
  }
23872
24310
  }, /*#__PURE__*/React__default['default'].createElement(icons.DoubleLeftOutlined, null)))),
23873
24311
  right: (/*#__PURE__*/React__default['default'].createElement("div", {
@@ -23876,7 +24314,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23876
24314
  },
23877
24315
  className: 'tab_right_operate',
23878
24316
  onClick: function onClick() {
23879
- _this3.setTabNavTransLate(100);
24317
+ _this4.setTabNavTransLate(100);
23880
24318
  }
23881
24319
  }, /*#__PURE__*/React__default['default'].createElement(icons.DoubleRightOutlined, null)))
23882
24320
  };
@@ -23892,7 +24330,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23892
24330
  return /*#__PURE__*/React__default['default'].createElement(CustomerMenuHeader, {
23893
24331
  originRoutes: originRoutes,
23894
24332
  itemPath: itemPath,
23895
- handleClose: _this3.handleClose,
24333
+ handleClose: _this4.handleClose,
23896
24334
  collapsed: collapse
23897
24335
  });
23898
24336
  },
@@ -23901,10 +24339,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23901
24339
  return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(CustomerMenu, {
23902
24340
  originRoutes: originRoutes,
23903
24341
  itemPath: itemPath,
23904
- ref: _this3.customerMenuRef,
23905
- actionRef: _this3.actionRef,
23906
- handleClose: _this3.handleClose,
23907
- isCollapse: _this3.state.collapse
24342
+ ref: _this4.customerMenuRef,
24343
+ actionRef: _this4.actionRef,
24344
+ handleClose: _this4.handleClose,
24345
+ isCollapse: _this4.state.collapse
23908
24346
  }));
23909
24347
  }
23910
24348
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -23912,7 +24350,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23912
24350
  }, /*#__PURE__*/React__default['default'].createElement("span", {
23913
24351
  className: "collapse_icon",
23914
24352
  onClick: function onClick() {
23915
- _this3.setState({
24353
+ _this4.setState({
23916
24354
  collapse: !collapse
23917
24355
  });
23918
24356
  }
@@ -23925,7 +24363,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23925
24363
  },
23926
24364
  collapsed: collapse,
23927
24365
  onCollapse: function onCollapse(boo) {
23928
- _this3.setState({
24366
+ _this4.setState({
23929
24367
  collapse: boo
23930
24368
  });
23931
24369
  },
@@ -23961,14 +24399,14 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23961
24399
  },
23962
24400
  onMouseEnter: function onMouseEnter() {
23963
24401
  if (menuItemProps.pro_layout_parentKeys && menuItemProps.pro_layout_parentKeys.length) return;
23964
- _this3.setState({
24402
+ _this4.setState({
23965
24403
  currentSubMenuData: menuItemProps.children,
23966
24404
  currentSubPath: menuItemProps.path
23967
24405
  });
23968
- _this3.setShowMenu(true);
24406
+ _this4.setShowMenu(true);
23969
24407
  },
23970
24408
  onMouseLeave: function onMouseLeave() {
23971
- _this3.setShowMenu(false);
24409
+ _this4.setShowMenu(false);
23972
24410
  }
23973
24411
  }, defaultDom, showSubMenu && currentSubPath === menuItemProps.path && !collapse && (/*#__PURE__*/React__default['default'].createElement(icons.CaretLeftOutlined, {
23974
24412
  style: {
@@ -23987,7 +24425,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23987
24425
  }, '');
23988
24426
  },
23989
24427
  postMenuData: function postMenuData(menus) {
23990
- return _toConsumableArray(filterByMenuDate(menus || [], _this3.state.keyWord));
24428
+ return _toConsumableArray(filterByMenuDate(menus || [], _this4.state.keyWord));
23991
24429
  },
23992
24430
  links: [!this.state.collapse ? (/*#__PURE__*/React__default['default'].createElement(AllFunc$1, {
23993
24431
  ref: this.allFunc,
@@ -24049,13 +24487,12 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
24049
24487
  tabBarGutter: 8,
24050
24488
  onEdit: this.onEdit,
24051
24489
  tabBarExtraContent: OperationsSlot,
24052
- destroyInactiveTabPane: true,
24490
+ // destroyInactiveTabPane={true}
24053
24491
  animated: false,
24054
24492
  hideAdd: true,
24055
24493
  ref: function ref(tabsRef) {
24056
- if (tabsRef && !_this3.tabsRef) {
24057
- _this3.tabsRef = tabsRef;
24058
- console.log('[Tabs配置] destroyInactiveTabPane已设置为true,animated设置为false');
24494
+ if (tabsRef && !_this4.tabsRef) {
24495
+ _this4.tabsRef = tabsRef;
24059
24496
  }
24060
24497
  }
24061
24498
  }, listenRouterState.map(function (item, index) {
@@ -24063,7 +24500,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
24063
24500
  tab: /*#__PURE__*/React__default['default'].createElement(TabTitle, {
24064
24501
  item: item,
24065
24502
  index: index,
24066
- updateState: _this3.updateState
24503
+ updateState: _this4.updateState
24067
24504
  }),
24068
24505
  style: {
24069
24506
  marginTop: isWeiqianduan ? 0 : 30
@@ -24075,10 +24512,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
24075
24512
  })
24076
24513
  }, /*#__PURE__*/React__default['default'].createElement(WrapperComponent, {
24077
24514
  item: item,
24078
- routerProps: _this3.props,
24079
- getDictionarySource: _this3.getDictionarySource,
24080
- getDictionaryTextByValue: _this3.getDictionaryTextByValue,
24081
- timeFormat: _this3.timeFormat,
24515
+ routerProps: _this4.props,
24516
+ getDictionarySource: _this4.getDictionarySource,
24517
+ getDictionaryTextByValue: _this4.getDictionaryTextByValue,
24518
+ timeFormat: _this4.timeFormat,
24082
24519
  transparentProps: transparentProps,
24083
24520
  activeKey: activeKey,
24084
24521
  listenRouterState: listenRouterState
@@ -24105,11 +24542,12 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
24105
24542
  itemPath: itemPath
24106
24543
  }, drawerLeftParams)), /*#__PURE__*/React__default['default'].createElement("div", {
24107
24544
  onMouseEnter: function onMouseEnter() {
24108
- _this3.setShowMenu(true);
24545
+ _this4.setShowMenu(true);
24109
24546
  },
24110
24547
  onMouseLeave: function onMouseLeave() {
24111
- _this3.setShowMenu(false);
24548
+ _this4.setShowMenu(false);
24112
24549
  },
24550
+ onClick: this.handleMenuContainerClick,
24113
24551
  className: 'sub_menu_content',
24114
24552
  style: {
24115
24553
  display: showSubMenu && !collapse ? 'block' : 'none'
@@ -24120,16 +24558,20 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
24120
24558
  }(React__default['default'].PureComponent);
24121
24559
  var WrapperComponent = /*#__PURE__*/function (_React$Component) {
24122
24560
  function WrapperComponent(props) {
24123
- var _this4;
24561
+ var _this5;
24124
24562
  _classCallCheck(this, WrapperComponent);
24125
- _this4 = _callSuper(this, WrapperComponent, [props]);
24563
+ _this5 = _callSuper(this, WrapperComponent, [props]);
24126
24564
  // 初始化组件状态
24127
24565
  // 通用事件处理器,用于清理
24128
- _this4.handleEvent = function (event) {
24566
+ _this5.handleEvent = function (event) {
24129
24567
  // 空的事件处理器,仅用于清理时移除监听器
24130
24568
  };
24131
- _this4.isUnmounted = false;
24132
- return _this4;
24569
+ // 拖拽事件处理器,用于清理
24570
+ _this5.handleDragEvent = function (event) {
24571
+ // 空的拖拽事件处理器,仅用于清理时移除监听器
24572
+ };
24573
+ _this5.isUnmounted = false;
24574
+ return _this5;
24133
24575
  }
24134
24576
  _inherits(WrapperComponent, _React$Component);
24135
24577
  return _createClass(WrapperComponent, [{
@@ -24140,19 +24582,44 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
24140
24582
  }, {
24141
24583
  key: "componentWillUnmount",
24142
24584
  value: function componentWillUnmount() {
24143
- var _this5 = this;
24585
+ var _this6 = this;
24144
24586
  // 设置卸载标志
24145
24587
  this.isUnmounted = true;
24146
24588
  // 清理可能的DOM事件监听器
24147
24589
  try {
24148
- var currentElement = document.querySelector("#globalTabs .ant-tabs-tabpane[data-node-key=\"".concat(this.props.item.key, "\"]"));
24590
+ var currentElement = document.getElementById('globalTabs-panel-' + this.props.item.key);
24149
24591
  if (currentElement) {
24150
24592
  // 移除所有可能的事件监听器
24151
24593
  var events = ['click', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'focus', 'blur'];
24152
24594
  events.forEach(function (eventType) {
24153
- currentElement.removeEventListener(eventType, _this5.handleEvent, true);
24154
- currentElement.removeEventListener(eventType, _this5.handleEvent, false);
24595
+ currentElement.removeEventListener(eventType, _this6.handleEvent, true);
24596
+ currentElement.removeEventListener(eventType, _this6.handleEvent, false);
24597
+ });
24598
+ // 清理拖拽相关的事件监听器
24599
+ var dragEvents = ['dragstart', 'dragend', 'dragover', 'dragenter', 'dragleave', 'drop'];
24600
+ dragEvents.forEach(function (eventType) {
24601
+ currentElement.removeEventListener(eventType, _this6.handleDragEvent, true);
24602
+ currentElement.removeEventListener(eventType, _this6.handleDragEvent, false);
24603
+ });
24604
+ // 清理react-dnd相关的属性和状态
24605
+ if (currentElement._reactInternalFiber) {
24606
+ delete currentElement._reactInternalFiber;
24607
+ }
24608
+ if (currentElement._reactInternalInstance) {
24609
+ delete currentElement._reactInternalInstance;
24610
+ }
24611
+ // 清理可能的拖拽状态数据
24612
+ var dragStateKeys = Object.keys(currentElement).filter(function (key) {
24613
+ return key.includes('drag') || key.includes('drop') || key.includes('dnd');
24155
24614
  });
24615
+ dragStateKeys.forEach(function (key) {
24616
+ try {
24617
+ delete currentElement[key];
24618
+ } catch (e) {
24619
+ // 忽略删除失败的情况
24620
+ }
24621
+ });
24622
+ null, _readOnlyError("currentElement");
24156
24623
  }
24157
24624
  // 强制垃圾回收提示
24158
24625
  if (window.gc && typeof window.gc === 'function') {
@@ -24168,26 +24635,24 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
24168
24635
  var _nextProps$item,
24169
24636
  _nextProps$item$key,
24170
24637
  _this$props$listenRou,
24171
- _this6 = this,
24638
+ _this7 = this,
24172
24639
  _nextProps$listenRout;
24173
24640
  if (window.__POWERED_BY_WUJIE__ && (nextProps === null || nextProps === void 0 ? void 0 : (_nextProps$item = nextProps.item) === null || _nextProps$item === void 0 ? void 0 : (_nextProps$item$key = _nextProps$item.key) === null || _nextProps$item$key === void 0 ? void 0 : _nextProps$item$key.indexOf('edit-template-template')) > -1) {
24174
24641
  return true;
24175
24642
  }
24176
24643
  // 检测页签是否已被删除:比较当前和下一个listenRouterState
24177
24644
  var currentTabExists = (_this$props$listenRou = this.props.listenRouterState) === null || _this$props$listenRou === void 0 ? void 0 : _this$props$listenRou.some(function (tab) {
24178
- return tab.key === _this6.props.item.key;
24645
+ return tab.key === _this7.props.item.key;
24179
24646
  });
24180
24647
  var nextTabExists = (_nextProps$listenRout = nextProps.listenRouterState) === null || _nextProps$listenRout === void 0 ? void 0 : _nextProps$listenRout.some(function (tab) {
24181
- return tab.key === _this6.props.item.key;
24648
+ return tab.key === _this7.props.item.key;
24182
24649
  });
24183
24650
  // 如果页签从存在变为不存在,说明被删除了,允许更新以便正确销毁
24184
24651
  if (currentTabExists && !nextTabExists) {
24185
- console.log("\u9875\u7B7E ".concat(this.props.item.key, " \u5DF2\u88AB\u5220\u9664\uFF0C\u5141\u8BB8\u7EC4\u4EF6\u66F4\u65B0\u4EE5\u4FBF\u9500\u6BC1"));
24186
24652
  return true;
24187
24653
  }
24188
24654
  // 如果页签不再是活跃状态,允许更新以便正确销毁
24189
24655
  if (nextProps.activeKey !== nextProps.item.key && this.props.activeKey === this.props.item.key) {
24190
- console.log("\u9875\u7B7E ".concat(this.props.item.key, " \u4E0D\u518D\u6D3B\u8DC3\uFF0C\u5141\u8BB8\u7EC4\u4EF6\u66F4\u65B0"));
24191
24656
  return true;
24192
24657
  }
24193
24658
  // 如果页签变为活跃状态或内容发生变化,允许更新
@@ -30621,6 +31086,8 @@ var ConfigTree = (function (props) {
30621
31086
  _useState4 = _slicedToArray(_useState3, 2),
30622
31087
  activeLine = _useState4[0],
30623
31088
  setActiveLine = _useState4[1];
31089
+ var highlightTimerRef = React__default['default'].useRef(null);
31090
+ var isUnmountedRef = React__default['default'].useRef(false);
30624
31091
  React$1.useEffect(function () {
30625
31092
  setTreeData(parseData(data));
30626
31093
  }, [data]);
@@ -30632,10 +31099,32 @@ var ConfigTree = (function (props) {
30632
31099
  }
30633
31100
  }, [treeData, currentLine]);
30634
31101
  React$1.useEffect(function () {
30635
- setTimeout(function () {
30636
- setTreeData(createHighLightTreeData(treeData, activeLine));
31102
+ // 清理之前的定时器
31103
+ if (highlightTimerRef.current) {
31104
+ clearTimeout(highlightTimerRef.current);
31105
+ highlightTimerRef.current = null;
31106
+ }
31107
+ highlightTimerRef.current = setTimeout(function () {
31108
+ try {
31109
+ if (!isUnmountedRef.current) {
31110
+ setTreeData(createHighLightTreeData(treeData, activeLine));
31111
+ }
31112
+ } catch (error) {} finally {
31113
+ highlightTimerRef.current = null;
31114
+ }
30637
31115
  });
30638
31116
  }, [activeLine]);
31117
+
31118
+ // 组件卸载时清理定时器
31119
+ React$1.useEffect(function () {
31120
+ return function () {
31121
+ isUnmountedRef.current = true;
31122
+ if (highlightTimerRef.current) {
31123
+ clearTimeout(highlightTimerRef.current);
31124
+ highlightTimerRef.current = null;
31125
+ }
31126
+ };
31127
+ }, []);
30639
31128
  var handleSelect = function handleSelect(node, hasChildren) {
30640
31129
  var noActiveData = clearActiveNode(treeData);
30641
31130
  setTreeData(noActiveData);
@@ -31867,7 +32356,6 @@ var FieldsModifyModal = function FieldsModifyModal(props) {
31867
32356
  }),
31868
32357
  editableStatus: ((_props$record2 = props.record) === null || _props$record2 === void 0 ? void 0 : _props$record2.editableStatus) === '' ? [] : ((_props$record3 = props.record) === null || _props$record3 === void 0 ? void 0 : (_props$record3$editab = _props$record3.editableStatus) === null || _props$record3$editab === void 0 ? void 0 : _props$record3$editab.split(',')) || []
31869
32358
  });
31870
- console.log(record, 'record');
31871
32359
  var trueOrFalseSource = [{
31872
32360
  text: '是',
31873
32361
  value: true
@@ -32853,7 +33341,6 @@ var FieldsSettingsTable = (function (props) {
32853
33341
  render: function render(_ref) {
32854
33342
  var text = _ref.text;
32855
33343
  var jsonEditorVal = localStorage.getItem('jsonEditorVal') || '';
32856
- console.log('jsonEditorVal', jsonEditorVal);
32857
33344
  return jsonEditorVal.indexOf(text) >= 0 ? '是' : "否";
32858
33345
  }
32859
33346
  }, {
@@ -33128,9 +33615,7 @@ function hanleCallbackValue(codeProps, value, customerFields) {
33128
33615
  }
33129
33616
  }
33130
33617
  return extensionFields[fieldName2] || extensionFields[fieldName1] || '';
33131
- } catch (e) {
33132
- console.log('e', e);
33133
- }
33618
+ } catch (e) {}
33134
33619
  }
33135
33620
  });
33136
33621
  } else {
@@ -33498,9 +33983,7 @@ var getColumnItem = function getColumnItem(_ref) {
33498
33983
  if (JSON.parse(item.info || '{}').dictionaryCode) {
33499
33984
  dictionaryCode = JSON.parse(item.info || '{}').dictionaryCode;
33500
33985
  }
33501
- } catch (e) {
33502
- console.log('error', e);
33503
- }
33986
+ } catch (e) {}
33504
33987
  ites.sourceList = dictionaryCode && getDictionarySource(dictionaryCode) || [];
33505
33988
  }
33506
33989
  if (item.choiceType == 10) {
@@ -33510,9 +33993,7 @@ var getColumnItem = function getColumnItem(_ref) {
33510
33993
  if (JSON.parse(item.info || '{}').enumeration) {
33511
33994
  enumeration = JSON.parse(item.info || '{}').enumeration;
33512
33995
  }
33513
- } catch (e) {
33514
- console.log('error', e);
33515
- }
33996
+ } catch (e) {}
33516
33997
  ites.sourceList = enumeration && Object.keys(enumeration).map(function (key) {
33517
33998
  return {
33518
33999
  value: key,
@@ -33607,7 +34088,6 @@ function _getMetaData() {
33607
34088
  }).then(function (res) {
33608
34089
  resolve(res.data);
33609
34090
  }).catch(function (error) {
33610
- console.log(error, 'error');
33611
34091
  reject([]);
33612
34092
  });
33613
34093
  }));
@@ -33854,9 +34334,7 @@ var CustomSelectorModal = /*#__PURE__*/React$1.forwardRef(function (props, ref)
33854
34334
  if (JSON.parse(item.info).isLikeQuery) {
33855
34335
  name = "qp-".concat(item.code, "-like");
33856
34336
  }
33857
- } catch (e) {
33858
- console.log('error', e);
33859
- }
34337
+ } catch (e) {}
33860
34338
  return {
33861
34339
  name: name,
33862
34340
  label: item.name,
@@ -37420,7 +37898,6 @@ var RuleField = /*#__PURE__*/function (_Component) {
37420
37898
  this.getRegularThresholdRange(nextProps.queryIdentify, nextProps.propertyCode, nextProps.queryIdentifyType);
37421
37899
  }
37422
37900
  if (JSON.stringify(nextProps.initialThresholdQuery) != JSON.stringify(this.props.initialThresholdQuery)) {
37423
- console.log(findChangedThresholdQuery(this.props.initialThresholdQuery, nextProps.initialThresholdQuery));
37424
37901
  var changedPropsVal = findChangedThresholdQuery(this.props.initialThresholdQuery, nextProps.initialThresholdQuery);
37425
37902
  this.setState({
37426
37903
  thresholdQuery: _objectSpread2({}, nextProps.initialThresholdQuery)
@@ -37988,7 +38465,6 @@ function RenderCompItem(props) {
37988
38465
  }
37989
38466
  return Item;
37990
38467
  });
37991
- console.log((ites === null || ites === void 0 ? void 0 : ites.dictionaryCode) && !getDictionarySource(ites.dictionaryCode));
37992
38468
  var _useState = React$1.useState(getDictionarySource(ites.dictionaryCode) || []),
37993
38469
  _useState2 = _slicedToArray(_useState, 2),
37994
38470
  dictData = _useState2[0],
@@ -38550,7 +39026,6 @@ function RenderCompItem(props) {
38550
39026
  key: showValue(ites.code),
38551
39027
  // FIXME http://192.168.13.78/mep-fed-group/web/libs/business-component/-/merge_requests/45#note_115667
38552
39028
  setValue: function setValue(val, formulaName) {
38553
- console.log(val, 'val');
38554
39029
  var value = val.map(function (item) {
38555
39030
  return item.value.replace(/[a-zA-Z_]+\.\w+/g, function (i) {
38556
39031
  return '{' + i + '}';
@@ -39919,7 +40394,6 @@ var formatRegularList = function formatRegularList(data) {
39919
40394
  var handleRuleShowBack = function handleRuleShowBack(data, functionRuleList, ruleReturnList) {
39920
40395
  var result = data === null || data === void 0 ? void 0 : data.map(function (item, index) {
39921
40396
  var _item$result, _item$result3;
39922
- console.log('data', item);
39923
40397
  var newResponse = [];
39924
40398
  //新数据都用responseArray形式
39925
40399
  if (Array.isArray(item === null || item === void 0 ? void 0 : (_item$result = item.result) === null || _item$result === void 0 ? void 0 : _item$result.responseArray)) {