@bit-sun/business-component 4.2.5-per-alpha.1 → 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;
20005
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
+ }
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
  /**
@@ -20333,50 +20551,152 @@ var BsSulaQueryTable = (function (props) {
20333
20551
  * ]
20334
20552
  * @returns []
20335
20553
  */
20336
- var getTableSummaryInfo = function getTableSummaryInfo() {
20337
- var summaryList = props.summaryList,
20338
- rowSelection = props.rowSelection,
20339
- expandable = props.expandable;
20554
+ var getTableSummaryInfo = React$1.useCallback(function () {
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
- };
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]);
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',
@@ -22382,6 +22713,12 @@ var DrawContent$1 = function DrawContent(_ref) {
22382
22713
  _useState16 = _slicedToArray(_useState15, 2),
22383
22714
  showScroll = _useState16[0],
22384
22715
  setShowScroll = _useState16[1];
22716
+ // 添加refs来跟踪组件状态和清理资源
22717
+ var isUnmountedRef = React$1.useRef(false);
22718
+ var timeoutRef = React$1.useRef(null);
22719
+ var resizeHandlerRef = React$1.useRef(null);
22720
+ var debounceTimerRef = React$1.useRef(null);
22721
+ var drawContentRef = React$1.useRef(null);
22385
22722
  React$1.useEffect(function () {
22386
22723
  var _originRoutes$find;
22387
22724
  getMenuContentHeight();
@@ -22405,26 +22742,68 @@ var DrawContent$1 = function DrawContent(_ref) {
22405
22742
  sethomepageData(homepageDataList);
22406
22743
  setroutesData(routesDataList);
22407
22744
  setAuthorityMenu(authorityMenuList);
22408
- window.onresize = function () {
22409
- getMenuContentHeight();
22745
+ // 创建resize处理函数并保存引用
22746
+ var handleResize = function handleResize() {
22747
+ if (!isUnmountedRef.current) {
22748
+ getMenuContentHeight();
22749
+ }
22750
+ };
22751
+ resizeHandlerRef.current = handleResize;
22752
+ window.addEventListener('resize', handleResize);
22753
+ // 清理函数
22754
+ return function () {
22755
+ isUnmountedRef.current = true;
22756
+ if (resizeHandlerRef.current) {
22757
+ window.removeEventListener('resize', resizeHandlerRef.current);
22758
+ resizeHandlerRef.current = null;
22759
+ }
22760
+ if (timeoutRef.current) {
22761
+ clearTimeout(timeoutRef.current);
22762
+ timeoutRef.current = null;
22763
+ }
22764
+ if (debounceTimerRef.current) {
22765
+ clearTimeout(debounceTimerRef.current);
22766
+ debounceTimerRef.current = null;
22767
+ }
22768
+ // 清理DOM引用
22769
+ drawContentRef.current = null;
22410
22770
  };
22411
22771
  }, []);
22412
22772
  React$1.useLayoutEffect(function () {
22413
- setTimeout(function () {
22414
- var drawContentHeight = document.getElementById("drawContent").scrollHeight;
22415
- if (drawContentHeight > rightMenuHeight) {
22416
- setMoreBtnShow(true);
22773
+ timeoutRef.current = setTimeout(function () {
22774
+ if (!isUnmountedRef.current) {
22775
+ // 使用缓存的DOM引用,避免重复查询
22776
+ if (!drawContentRef.current) {
22777
+ drawContentRef.current = document.getElementById("drawContent");
22778
+ }
22779
+ if (drawContentRef.current) {
22780
+ var drawContentHeight = drawContentRef.current.scrollHeight;
22781
+ if (drawContentHeight > rightMenuHeight) {
22782
+ setMoreBtnShow(true);
22783
+ }
22784
+ }
22417
22785
  }
22418
22786
  }, 0);
22787
+ return function () {
22788
+ if (timeoutRef.current) {
22789
+ clearTimeout(timeoutRef.current);
22790
+ timeoutRef.current = null;
22791
+ }
22792
+ };
22793
+ }, [rightMenuHeight]);
22794
+ var getMenuContentHeight = React$1.useCallback(function () {
22795
+ if (!isUnmountedRef.current) {
22796
+ var clientHeight = document.body.clientHeight;
22797
+ setHeight(clientHeight - 190);
22798
+ setDrawHeight(clientHeight - 70);
22799
+ }
22419
22800
  }, []);
22420
- var getMenuContentHeight = function getMenuContentHeight() {
22421
- var clientHeight = document.body.clientHeight;
22422
- setHeight(clientHeight - 190);
22423
- setDrawHeight(clientHeight - 70);
22424
- };
22425
- var _renderChildItem = function renderChildItem(child) {
22801
+ // 优化递归渲染函数,使用React.memo减少重复渲染
22802
+ var renderChildItem = React$1.useCallback(function (child) {
22426
22803
  if (!child.hideInMenu && child.children) {
22427
- 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, {
22428
22807
  style: {
22429
22808
  color: '#000',
22430
22809
  fontWeight: 'bold'
@@ -22432,10 +22811,17 @@ var DrawContent$1 = function DrawContent(_ref) {
22432
22811
  }, umi.formatMessage({
22433
22812
  id: "".concat(child.locale)
22434
22813
  })), child.children.map(function (menuItem) {
22435
- return _renderChildItem(menuItem);
22814
+ return renderChildItem(menuItem);
22436
22815
  }));
22437
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;
22438
22823
  return /*#__PURE__*/React__default['default'].createElement(antd.List.Item, {
22824
+ key: child.path,
22439
22825
  style: {
22440
22826
  fontSize: '12px'
22441
22827
  },
@@ -22446,22 +22832,17 @@ var DrawContent$1 = function DrawContent(_ref) {
22446
22832
  onMenuClick(e, child);
22447
22833
  }
22448
22834
  }, /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
22449
- title: umi.formatMessage({
22450
- id: "".concat(child.locale)
22451
- })
22452
- }, umi.formatMessage({
22453
- id: "".concat(child.locale)
22454
- }).length > 10 ? "".concat(umi.formatMessage({
22455
- id: "".concat(child.name)
22456
- }).slice(0, 10), "...") : umi.formatMessage({
22457
- id: "".concat(child.locale)
22458
- })), /*#__PURE__*/React__default['default'].createElement("img", {
22835
+ title: displayText
22836
+ }, truncatedText), /*#__PURE__*/React__default['default'].createElement("img", {
22459
22837
  className: "allFuncOnMouseroverImg",
22460
- src: right
22838
+ src: right,
22839
+ alt: "arrow"
22461
22840
  })));
22462
22841
  }
22463
- };
22464
- var onMenuClick = function onMenuClick(e, item) {
22842
+ return null;
22843
+ }, [onMenuClick]);
22844
+ var onMenuClick = React$1.useCallback(function (e, item) {
22845
+ if (isUnmountedRef.current) return;
22465
22846
  e.stopPropagation();
22466
22847
  e.preventDefault();
22467
22848
  var searchHistory = JSON.parse(localStorage.getItem("".concat(itemPath, "_search_history")) || '[]');
@@ -22486,8 +22867,67 @@ var DrawContent$1 = function DrawContent(_ref) {
22486
22867
  pathname: item.path
22487
22868
  });
22488
22869
  onClose();
22489
- };
22490
- var searchHistoryList = JSON.parse(localStorage.getItem("".concat(itemPath, "_search_history")) || '[]');
22870
+ }, [itemPath, onClose]);
22871
+ // 创建debounce搜索函数
22872
+ var debouncedSearch = React$1.useCallback(function (value) {
22873
+ if (debounceTimerRef.current) {
22874
+ clearTimeout(debounceTimerRef.current);
22875
+ }
22876
+ debounceTimerRef.current = setTimeout(function () {
22877
+ if (!isUnmountedRef.current) {
22878
+ searchMenuData(authorityMenu, value, setSearchMenuData);
22879
+ }
22880
+ }, 600);
22881
+ }, [authorityMenu]);
22882
+ var handleSearchChange = React$1.useCallback(function (e) {
22883
+ if (!isUnmountedRef.current) {
22884
+ debouncedSearch(e.target.value);
22885
+ }
22886
+ }, [debouncedSearch]);
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]);
22491
22931
  return /*#__PURE__*/React__default['default'].createElement("div", {
22492
22932
  style: {
22493
22933
  height: "".concat(drawHeight, "px")
@@ -22507,16 +22947,7 @@ var DrawContent$1 = function DrawContent(_ref) {
22507
22947
  onClick: function onClick(e) {
22508
22948
  e.stopPropagation();
22509
22949
  e.preventDefault();
22510
- if (item.component) {
22511
- umi.history.push({
22512
- pathname: item.path
22513
- });
22514
- onClose();
22515
- } else {
22516
- setCurrentOneLevel(item.path);
22517
- var currentDom = document.getElementById(item.path);
22518
- currentDom && currentDom.scrollIntoView();
22519
- }
22950
+ handleMenuItemClick(item);
22520
22951
  }
22521
22952
  }, item.name);
22522
22953
  })), /*#__PURE__*/React__default['default'].createElement("div", {
@@ -22525,9 +22956,7 @@ var DrawContent$1 = function DrawContent(_ref) {
22525
22956
  position: 'relative'
22526
22957
  }
22527
22958
  }, /*#__PURE__*/React__default['default'].createElement("img", {
22528
- onClick: function onClick() {
22529
- onClose();
22530
- },
22959
+ onClick: handleCloseClick,
22531
22960
  style: {
22532
22961
  position: 'absolute',
22533
22962
  right: '15px',
@@ -22551,9 +22980,7 @@ var DrawContent$1 = function DrawContent(_ref) {
22551
22980
  placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD",
22552
22981
  allowClear: true,
22553
22982
  prefix: /*#__PURE__*/React__default['default'].createElement(icons.SearchOutlined, null),
22554
- onChange: _.debounce(function (e) {
22555
- searchMenuData(authorityMenu, e.target.value, setSearchMenuData);
22556
- }, 600)
22983
+ onChange: handleSearchChange
22557
22984
  }), /*#__PURE__*/React__default['default'].createElement("div", {
22558
22985
  style: {
22559
22986
  marginTop: '10px'
@@ -22578,8 +23005,8 @@ var DrawContent$1 = function DrawContent(_ref) {
22578
23005
  className: 'search_menu_content'
22579
23006
  }, SearhData.map(function (item) {
22580
23007
  return /*#__PURE__*/React__default['default'].createElement("div", {
22581
- onClick: function onClick(e) {
22582
- onMenuClick(e, item);
23008
+ onClick: function onClick() {
23009
+ return handleSearchResultClick(item);
22583
23010
  },
22584
23011
  key: item.path
22585
23012
  }, item.name);
@@ -22636,7 +23063,7 @@ var DrawContent$1 = function DrawContent(_ref) {
22636
23063
  bordered: true,
22637
23064
  dataSource: item.children,
22638
23065
  renderItem: function renderItem(child) {
22639
- return _renderChildItem(child);
23066
+ return renderChildItem(child);
22640
23067
  }
22641
23068
  });
22642
23069
  })), /*#__PURE__*/React__default['default'].createElement("div", {
@@ -22650,10 +23077,7 @@ var DrawContent$1 = function DrawContent(_ref) {
22650
23077
  height: '30px'
22651
23078
  }
22652
23079
  }, /*#__PURE__*/React__default['default'].createElement("span", {
22653
- onClick: function onClick() {
22654
- setShowScroll(true);
22655
- setMoreBtnShow(false);
22656
- },
23080
+ onClick: handleMoreButtonClick,
22657
23081
  style: {
22658
23082
  color: '#8c8c8c'
22659
23083
  }
@@ -23003,18 +23427,15 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23003
23427
  };
23004
23428
  _this.getDictionaryTextByValue = function (dicCode, value) {
23005
23429
  var _dicData2;
23006
- var startPerformance = performance.now();
23007
23430
  if (window.dicDataTextValue) {
23008
23431
  var dicDataTextValue = window.dicDataTextValue;
23009
23432
  var _dicData = [];
23010
23433
  _dicData = dicDataTextValue[dicCode];
23011
- var endPerformance1 = performance.now();
23012
23434
  if (value === undefined) return "-";
23013
23435
  if (!_dicData) {
23014
23436
  // throw new Error(`当前${dicCode}字典值合没有${value}的数据`)
23015
23437
  return value;
23016
23438
  }
23017
- var endPerformance = performance.now();
23018
23439
  return _dicData[value] || value;
23019
23440
  }
23020
23441
  var dicData = [];
@@ -23073,131 +23494,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23073
23494
  _this.onEdit = function (targetKey, action) {
23074
23495
  _this.tabActions[action](targetKey);
23075
23496
  };
23076
- // DOM节点计数辅助函数
23077
- _this.countTabPaneDOMNodes = function () {
23078
- var tabPanes = document.querySelectorAll('.ant-tabs-tabpane');
23079
- var globalTabsTabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
23080
- var activeTabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane-active');
23081
- var hiddenTabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane:not(.ant-tabs-tabpane-active)');
23082
- console.log("[DOM\u8BA1\u6570] \u5168\u5C40TabPane\u8282\u70B9\u6570: ".concat(tabPanes.length, ", globalTabs\u5185TabPane\u8282\u70B9\u6570: ").concat(globalTabsTabPanes.length));
23083
- console.log("[DOM\u8BA1\u6570] \u6D3B\u8DC3TabPane\u8282\u70B9\u6570: ".concat(activeTabPanes.length, ", \u975E\u6D3B\u8DC3TabPane\u8282\u70B9\u6570: ").concat(hiddenTabPanes.length));
23084
- // 详细列出每个TabPane的key和状态
23085
- globalTabsTabPanes.forEach(function (pane, index) {
23086
- var isActive = pane.classList.contains('ant-tabs-tabpane-active');
23087
- var key = pane.getAttribute('data-node-key') || pane.id || "\u672A\u77E5-".concat(index);
23088
- console.log("[DOM\u8BE6\u60C5] TabPane ".concat(index + 1, ": key=").concat(key, ", \u6D3B\u8DC3=").concat(isActive));
23089
- });
23090
- return {
23091
- total: tabPanes.length,
23092
- globalTabs: globalTabsTabPanes.length,
23093
- active: activeTabPanes.length,
23094
- hidden: hiddenTabPanes.length
23095
- };
23096
- };
23097
- // 测试方法:验证页签删除后DOM状态
23098
- _this.testTabDeletion = function () {
23099
- console.log('=== 页签删除测试开始 ===');
23100
- console.log('当前页签状态:', _this.state.listenRouterState.map(function (item) {
23101
- return item.key;
23102
- }));
23103
- console.log('当前活跃页签:', _this.state.activeKey);
23104
- _this.countTabPaneDOMNodes();
23105
- // 提供删除建议
23106
- var listenRouterState = _this.state.listenRouterState;
23107
- if (listenRouterState.length > 1) {
23108
- var _listenRouterState$fi;
23109
- var testKey = (_listenRouterState$fi = listenRouterState.find(function (item) {
23110
- return item.key !== '/';
23111
- })) === null || _listenRouterState$fi === void 0 ? void 0 : _listenRouterState$fi.key;
23112
- if (testKey) {
23113
- console.log("\u5EFA\u8BAE\u6D4B\u8BD5\uFF1A\u5220\u9664\u9875\u7B7E ".concat(testKey));
23114
- console.log("\u6267\u884C\u547D\u4EE4\uFF1Awindow.testDeleteTab('".concat(testKey, "')"));
23115
- }
23116
- }
23117
- console.log('=== 页签删除测试结束 ===');
23118
- };
23119
- // 强制清理DOM节点的方法
23120
- _this.forceCleanupDOM = function () {
23121
- console.log('[强制清理] 开始强制清理DOM节点...');
23122
- var beforeCount = _this.countTabPaneDOMNodes();
23123
- console.log("[\u5F3A\u5236\u6E05\u7406] \u6E05\u7406\u524DDOM\u8282\u70B9\u6570: ".concat(beforeCount.total));
23124
- // 强制垃圾回收
23125
- if (window.gc) {
23126
- window.gc();
23127
- console.log('[强制清理] 已触发垃圾回收');
23128
- }
23129
- // 清理所有可能的引用
23130
- var tabsContainer = document.getElementById('globalTabs');
23131
- if (tabsContainer) {
23132
- var tabPanes = tabsContainer.querySelectorAll('.ant-tabs-tabpane');
23133
- tabPanes.forEach(function (pane, index) {
23134
- if (pane.style.display === 'none' || pane.getAttribute('aria-hidden') === 'true') {
23135
- var _pane$parentNode;
23136
- console.log("[\u5F3A\u5236\u6E05\u7406] \u53D1\u73B0\u9690\u85CF\u7684TabPane\u8282\u70B9 ".concat(index, ", \u5C1D\u8BD5\u6E05\u7406..."));
23137
- // 清理事件监听器
23138
- var clone = pane.cloneNode(true);
23139
- (_pane$parentNode = pane.parentNode) === null || _pane$parentNode === void 0 ? void 0 : _pane$parentNode.replaceChild(clone, pane);
23140
- }
23141
- });
23142
- }
23143
- setTimeout(function () {
23144
- var afterCount = _this.countTabPaneDOMNodes();
23145
- console.log("[\u5F3A\u5236\u6E05\u7406] \u6E05\u7406\u540EDOM\u8282\u70B9\u6570: ".concat(afterCount.total));
23146
- console.log("[\u5F3A\u5236\u6E05\u7406] DOM\u8282\u70B9\u51CF\u5C11: ".concat(beforeCount.total - afterCount.total));
23147
- }, 200);
23148
- };
23149
- // 分析内存泄漏的方法
23150
- _this.analyzeMemoryLeaks = function () {
23151
- console.log('[内存分析] 开始分析可能的内存泄漏...');
23152
- // 检查全局事件监听器
23153
- var listeners = window.getEventListeners ? window.getEventListeners(document) : {};
23154
- console.log('[内存分析] 全局事件监听器:', listeners);
23155
- // 检查定时器
23156
- console.log('[内存分析] 当前活跃定时器数量:', Object.keys(window).filter(function (key) {
23157
- return key.includes('timeout') || key.includes('interval');
23158
- }).length);
23159
- // 检查TabPane节点详情
23160
- var tabsContainer = document.getElementById('globalTabs');
23161
- if (tabsContainer) {
23162
- var tabPanes = tabsContainer.querySelectorAll('.ant-tabs-tabpane');
23163
- console.log("[\u5185\u5B58\u5206\u6790] \u53D1\u73B0 ".concat(tabPanes.length, " \u4E2ATabPane\u8282\u70B9:"));
23164
- tabPanes.forEach(function (pane, index) {
23165
- var key = pane.getAttribute('data-node-key') || pane.id;
23166
- var isVisible = pane.style.display !== 'none' && pane.getAttribute('aria-hidden') !== 'true';
23167
- var hasContent = pane.children.length > 0;
23168
- console.log(" TabPane ".concat(index, ": key=").concat(key, ", visible=").concat(isVisible, ", hasContent=").concat(hasContent, ", children=").concat(pane.children.length));
23169
- });
23170
- }
23171
- // 检查React组件实例
23172
- var reactInstances = document.querySelectorAll('[data-reactroot], [data-react-checksum]');
23173
- console.log("[\u5185\u5B58\u5206\u6790] React\u5B9E\u4F8B\u6570\u91CF: ".concat(reactInstances.length));
23174
- };
23175
- // 强制清除所有TabPane节点
23176
- _this.forceClearTabPanes = function () {
23177
- console.log('[强制清除] 开始强制清除所有TabPane节点...');
23178
- var beforeCount = _this.countTabPaneDOMNodes();
23179
- var tabsContainer = document.getElementById('globalTabs');
23180
- if (tabsContainer) {
23181
- var tabPanes = tabsContainer.querySelectorAll('.ant-tabs-tabpane');
23182
- console.log("[\u5F3A\u5236\u6E05\u9664] \u53D1\u73B0 ".concat(tabPanes.length, " \u4E2ATabPane\u8282\u70B9\uFF0C\u51C6\u5907\u6E05\u9664..."));
23183
- tabPanes.forEach(function (pane, index) {
23184
- var key = pane.getAttribute('data-node-key') || pane.id;
23185
- var isActive = !pane.getAttribute('aria-hidden') && pane.style.display !== 'none';
23186
- if (!isActive) {
23187
- console.log("[\u5F3A\u5236\u6E05\u9664] \u79FB\u9664\u975E\u6D3B\u8DC3TabPane ".concat(index, " (key: ").concat(key, ")"));
23188
- pane.remove();
23189
- }
23190
- });
23191
- }
23192
- setTimeout(function () {
23193
- var afterCount = _this.countTabPaneDOMNodes();
23194
- console.log("[\u5F3A\u5236\u6E05\u9664] \u6E05\u9664\u524D: ".concat(beforeCount.total, ", \u6E05\u9664\u540E: ").concat(afterCount.total, ", \u51CF\u5C11: ").concat(beforeCount.total - afterCount.total));
23195
- }, 100);
23196
- };
23197
23497
  _this.tabActions = {
23198
23498
  remove: function remove(targetKey) {
23199
- console.log("[\u9875\u7B7E\u5220\u9664] \u5F00\u59CB\u5220\u9664\u9875\u7B7E: ".concat(targetKey));
23200
- _this.countTabPaneDOMNodes();
23201
23499
  var _this$state = _this.state,
23202
23500
  listenRouterState = _this$state.listenRouterState,
23203
23501
  activeKey = _this$state.activeKey,
@@ -23241,11 +23539,6 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23241
23539
  pathname: newKey
23242
23540
  });
23243
23541
  _this.checkisNavSlide();
23244
- // 延迟检查DOM节点变化,确保React完成渲染
23245
- setTimeout(function () {
23246
- console.log("[\u9875\u7B7E\u5220\u9664] \u5220\u9664\u9875\u7B7E ".concat(targetKey, " \u540E\u7684DOM\u72B6\u6001:"));
23247
- _this.countTabPaneDOMNodes();
23248
- }, 100);
23249
23542
  });
23250
23543
  }
23251
23544
  };
@@ -23277,18 +23570,44 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23277
23570
  });
23278
23571
  _this.setShowMenu(false);
23279
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
+ };
23280
23589
  _this.getMenuDom = function (menuData) {
23281
- return menuData.map(function (item) {
23282
- return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("div", {
23283
- onClick: function onClick() {
23284
- _this.handleMenuClick(item);
23285
- },
23286
- 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'),
23287
23599
  style: {
23288
- fontWeight: item.children || !item.component ? 'bolder' : '400',
23600
+ fontWeight: hasChildren ? 'bolder' : '400',
23289
23601
  paddingLeft: '10px',
23290
- marginTop: item.children || !item.component ? '5px' : '0px',
23291
- 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
+ }
23292
23611
  }
23293
23612
  }, item.name), !!item.children && !!item.children.length && _this.getMenuDom(item.children));
23294
23613
  });
@@ -23520,8 +23839,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23520
23839
  return _createClass(BasicLayout, [{
23521
23840
  key: "componentDidMount",
23522
23841
  value: function componentDidMount() {
23523
- var _this2 = this,
23524
- _window$$wujie,
23842
+ var _window$$wujie,
23843
+ _this2 = this,
23525
23844
  _localStorage$getItem,
23526
23845
  _localStorage$getItem2;
23527
23846
  var _this$props = this.props,
@@ -23529,17 +23848,6 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23529
23848
  location = _this$props.location,
23530
23849
  itemPath = _this$props.itemPath,
23531
23850
  pathToRegexp = _this$props.pathToRegexp;
23532
- // 将测试方法暴露到全局,方便调试
23533
- window.testTabDeletion = this.testTabDeletion;
23534
- window.countTabPaneDOMNodes = this.countTabPaneDOMNodes;
23535
- window.testDeleteTab = function (key) {
23536
- console.log("[\u6D4B\u8BD5] \u624B\u52A8\u5220\u9664\u9875\u7B7E: ".concat(key));
23537
- _this2.tabActions.remove(key);
23538
- };
23539
- window.forceCleanupDOM = this.forceCleanupDOM;
23540
- window.analyzeMemoryLeaks = this.analyzeMemoryLeaks;
23541
- window.forceClearTabPanes = this.forceClearTabPanes;
23542
- console.log('[调试工具] 已暴露全局方法: window.testTabDeletion(), window.countTabPaneDOMNodes(), window.testDeleteTab(key), window.forceCleanupDOM(), window.analyzeMemoryLeaks(), window.forceClearTabPanes()');
23543
23851
  var istParent = 0;
23544
23852
  var self = this;
23545
23853
  // window.top != window &&
@@ -23741,7 +24049,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23741
24049
  }, {
23742
24050
  key: "componentWillUnmount",
23743
24051
  value: function componentWillUnmount() {
23744
- var _window$$wujie3;
24052
+ var _window$$wujie3,
24053
+ _this3 = this;
23745
24054
  // 清理路由监听器
23746
24055
  if (UN_LISTTEN_DRP) {
23747
24056
  UN_LISTTEN_DRP();
@@ -23757,21 +24066,72 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23757
24066
  clearTimeout(timeoutId);
23758
24067
  });
23759
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
+ }
23760
24085
  // 清理实例属性
23761
24086
  this.routerArray = null;
23762
24087
  this.authMenuPathList = null;
23763
24088
  this.docsId = null;
23764
24089
  this.lastTwoRouterArray = null;
23765
- this.cachedTabsElements = null;
23766
24090
  this.cachedBreadcrumbNameMap = null;
23767
24091
  this.cachedWeiqianduanProps = null;
23768
24092
  this.cachedOperationsSlot = null;
23769
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
+ }
23770
24130
  }
23771
24131
  }, {
23772
24132
  key: "render",
23773
24133
  value: function render() {
23774
- var _this3 = this;
24134
+ var _this4 = this;
23775
24135
  var _this$state4 = this.state,
23776
24136
  listenRouterState = _this$state4.listenRouterState,
23777
24137
  activeKey = _this$state4.activeKey,
@@ -23795,7 +24155,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23795
24155
  className: "tab_title_content"
23796
24156
  }, item.tab, item.key !== '/' && (/*#__PURE__*/React__default['default'].createElement(ItemMenu, {
23797
24157
  info: item,
23798
- operateFun: _this3.operateFun,
24158
+ operateFun: _this4.operateFun,
23799
24159
  listenRouterState: listenRouterState
23800
24160
  })));
23801
24161
  };
@@ -23829,7 +24189,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23829
24189
  }, /*#__PURE__*/React__default['default'].createElement("a", {
23830
24190
  onClick: function onClick() {
23831
24191
  // 关闭全部
23832
- _this3.updateState([_objectSpread2(_objectSpread2({}, _this3.state.homeRouter), {}, {
24192
+ _this4.updateState([_objectSpread2(_objectSpread2({}, _this4.state.homeRouter), {}, {
23833
24193
  key: '/',
23834
24194
  tab: '欢迎',
23835
24195
  closable: false
@@ -23855,7 +24215,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23855
24215
  } else {
23856
24216
  newActiveKey = listenRouterState[1].key;
23857
24217
  }
23858
- _this3.updateState(listenRouterState.filter(function (d) {
24218
+ _this4.updateState(listenRouterState.filter(function (d) {
23859
24219
  return d.key !== activeKey;
23860
24220
  }), listenRouterKey.filter(function (d) {
23861
24221
  return d !== activeKey;
@@ -23882,7 +24242,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23882
24242
  // message.warning('首页不可关闭。');
23883
24243
  // return;
23884
24244
  // }
23885
- _this3.updateState(listenRouterState.filter(function (d, i) {
24245
+ _this4.updateState(listenRouterState.filter(function (d, i) {
23886
24246
  return i >= index || d.key === '/';
23887
24247
  }), listenRouterKey.filter(function (d, i) {
23888
24248
  return i >= index || d === '/';
@@ -23899,7 +24259,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23899
24259
  var index = listenRouterState.findIndex(function (item) {
23900
24260
  return item.key === activeKey;
23901
24261
  });
23902
- _this3.updateState(listenRouterState.filter(function (d, i) {
24262
+ _this4.updateState(listenRouterState.filter(function (d, i) {
23903
24263
  return i <= index || d.key === '/';
23904
24264
  }), listenRouterKey.filter(function (d, i) {
23905
24265
  return i <= index || d === '/';
@@ -23945,7 +24305,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23945
24305
  opacity: this.state.isSlider ? 1 : 0.5
23946
24306
  },
23947
24307
  onClick: function onClick() {
23948
- _this3.setTabNavTransLate(-100);
24308
+ _this4.setTabNavTransLate(-100);
23949
24309
  }
23950
24310
  }, /*#__PURE__*/React__default['default'].createElement(icons.DoubleLeftOutlined, null)))),
23951
24311
  right: (/*#__PURE__*/React__default['default'].createElement("div", {
@@ -23954,7 +24314,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23954
24314
  },
23955
24315
  className: 'tab_right_operate',
23956
24316
  onClick: function onClick() {
23957
- _this3.setTabNavTransLate(100);
24317
+ _this4.setTabNavTransLate(100);
23958
24318
  }
23959
24319
  }, /*#__PURE__*/React__default['default'].createElement(icons.DoubleRightOutlined, null)))
23960
24320
  };
@@ -23970,7 +24330,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23970
24330
  return /*#__PURE__*/React__default['default'].createElement(CustomerMenuHeader, {
23971
24331
  originRoutes: originRoutes,
23972
24332
  itemPath: itemPath,
23973
- handleClose: _this3.handleClose,
24333
+ handleClose: _this4.handleClose,
23974
24334
  collapsed: collapse
23975
24335
  });
23976
24336
  },
@@ -23979,10 +24339,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23979
24339
  return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(CustomerMenu, {
23980
24340
  originRoutes: originRoutes,
23981
24341
  itemPath: itemPath,
23982
- ref: _this3.customerMenuRef,
23983
- actionRef: _this3.actionRef,
23984
- handleClose: _this3.handleClose,
23985
- isCollapse: _this3.state.collapse
24342
+ ref: _this4.customerMenuRef,
24343
+ actionRef: _this4.actionRef,
24344
+ handleClose: _this4.handleClose,
24345
+ isCollapse: _this4.state.collapse
23986
24346
  }));
23987
24347
  }
23988
24348
  return /*#__PURE__*/React__default['default'].createElement("div", {
@@ -23990,7 +24350,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
23990
24350
  }, /*#__PURE__*/React__default['default'].createElement("span", {
23991
24351
  className: "collapse_icon",
23992
24352
  onClick: function onClick() {
23993
- _this3.setState({
24353
+ _this4.setState({
23994
24354
  collapse: !collapse
23995
24355
  });
23996
24356
  }
@@ -24003,7 +24363,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
24003
24363
  },
24004
24364
  collapsed: collapse,
24005
24365
  onCollapse: function onCollapse(boo) {
24006
- _this3.setState({
24366
+ _this4.setState({
24007
24367
  collapse: boo
24008
24368
  });
24009
24369
  },
@@ -24039,14 +24399,14 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
24039
24399
  },
24040
24400
  onMouseEnter: function onMouseEnter() {
24041
24401
  if (menuItemProps.pro_layout_parentKeys && menuItemProps.pro_layout_parentKeys.length) return;
24042
- _this3.setState({
24402
+ _this4.setState({
24043
24403
  currentSubMenuData: menuItemProps.children,
24044
24404
  currentSubPath: menuItemProps.path
24045
24405
  });
24046
- _this3.setShowMenu(true);
24406
+ _this4.setShowMenu(true);
24047
24407
  },
24048
24408
  onMouseLeave: function onMouseLeave() {
24049
- _this3.setShowMenu(false);
24409
+ _this4.setShowMenu(false);
24050
24410
  }
24051
24411
  }, defaultDom, showSubMenu && currentSubPath === menuItemProps.path && !collapse && (/*#__PURE__*/React__default['default'].createElement(icons.CaretLeftOutlined, {
24052
24412
  style: {
@@ -24065,7 +24425,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
24065
24425
  }, '');
24066
24426
  },
24067
24427
  postMenuData: function postMenuData(menus) {
24068
- return _toConsumableArray(filterByMenuDate(menus || [], _this3.state.keyWord));
24428
+ return _toConsumableArray(filterByMenuDate(menus || [], _this4.state.keyWord));
24069
24429
  },
24070
24430
  links: [!this.state.collapse ? (/*#__PURE__*/React__default['default'].createElement(AllFunc$1, {
24071
24431
  ref: this.allFunc,
@@ -24127,13 +24487,12 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
24127
24487
  tabBarGutter: 8,
24128
24488
  onEdit: this.onEdit,
24129
24489
  tabBarExtraContent: OperationsSlot,
24130
- destroyInactiveTabPane: true,
24490
+ // destroyInactiveTabPane={true}
24131
24491
  animated: false,
24132
24492
  hideAdd: true,
24133
24493
  ref: function ref(tabsRef) {
24134
- if (tabsRef && !_this3.tabsRef) {
24135
- _this3.tabsRef = tabsRef;
24136
- console.log('[Tabs配置] destroyInactiveTabPane已设置为true,animated设置为false');
24494
+ if (tabsRef && !_this4.tabsRef) {
24495
+ _this4.tabsRef = tabsRef;
24137
24496
  }
24138
24497
  }
24139
24498
  }, listenRouterState.map(function (item, index) {
@@ -24141,7 +24500,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
24141
24500
  tab: /*#__PURE__*/React__default['default'].createElement(TabTitle, {
24142
24501
  item: item,
24143
24502
  index: index,
24144
- updateState: _this3.updateState
24503
+ updateState: _this4.updateState
24145
24504
  }),
24146
24505
  style: {
24147
24506
  marginTop: isWeiqianduan ? 0 : 30
@@ -24153,10 +24512,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
24153
24512
  })
24154
24513
  }, /*#__PURE__*/React__default['default'].createElement(WrapperComponent, {
24155
24514
  item: item,
24156
- routerProps: _this3.props,
24157
- getDictionarySource: _this3.getDictionarySource,
24158
- getDictionaryTextByValue: _this3.getDictionaryTextByValue,
24159
- timeFormat: _this3.timeFormat,
24515
+ routerProps: _this4.props,
24516
+ getDictionarySource: _this4.getDictionarySource,
24517
+ getDictionaryTextByValue: _this4.getDictionaryTextByValue,
24518
+ timeFormat: _this4.timeFormat,
24160
24519
  transparentProps: transparentProps,
24161
24520
  activeKey: activeKey,
24162
24521
  listenRouterState: listenRouterState
@@ -24183,11 +24542,12 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
24183
24542
  itemPath: itemPath
24184
24543
  }, drawerLeftParams)), /*#__PURE__*/React__default['default'].createElement("div", {
24185
24544
  onMouseEnter: function onMouseEnter() {
24186
- _this3.setShowMenu(true);
24545
+ _this4.setShowMenu(true);
24187
24546
  },
24188
24547
  onMouseLeave: function onMouseLeave() {
24189
- _this3.setShowMenu(false);
24548
+ _this4.setShowMenu(false);
24190
24549
  },
24550
+ onClick: this.handleMenuContainerClick,
24191
24551
  className: 'sub_menu_content',
24192
24552
  style: {
24193
24553
  display: showSubMenu && !collapse ? 'block' : 'none'
@@ -24198,135 +24558,76 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
24198
24558
  }(React__default['default'].PureComponent);
24199
24559
  var WrapperComponent = /*#__PURE__*/function (_React$Component) {
24200
24560
  function WrapperComponent(props) {
24201
- var _this4;
24561
+ var _this5;
24202
24562
  _classCallCheck(this, WrapperComponent);
24203
- _this4 = _callSuper(this, WrapperComponent, [props]);
24204
- _this4.setupDOMObserver = function () {
24205
- if (_this4.domObserver || _this4.isUnmounted) return;
24206
- var globalTabsContainer = document.getElementById('globalTabs');
24207
- if (!globalTabsContainer) return;
24208
- _this4.domObserver = new MutationObserver(function (mutations) {
24209
- if (_this4.isUnmounted) return;
24210
- mutations.forEach(function (mutation) {
24211
- if (mutation.type === 'childList') {
24212
- // 检查是否有TabPane节点被添加或删除
24213
- var addedTabPanes = Array.from(mutation.addedNodes).filter(function (node) {
24214
- return node.nodeType === Node.ELEMENT_NODE && node.classList && node.classList.contains('ant-tabs-tabpane');
24215
- });
24216
- var removedTabPanes = Array.from(mutation.removedNodes).filter(function (node) {
24217
- return node.nodeType === Node.ELEMENT_NODE && node.classList && node.classList.contains('ant-tabs-tabpane');
24218
- });
24219
- if (addedTabPanes.length > 0) {
24220
- console.log("[DOM\u76D1\u63A7] \u68C0\u6D4B\u5230 ".concat(addedTabPanes.length, " \u4E2ATabPane\u8282\u70B9\u88AB\u6DFB\u52A0"));
24221
- addedTabPanes.forEach(function (node) {
24222
- var key = node.getAttribute('data-node-key') || '未知';
24223
- console.log("[DOM\u76D1\u63A7] \u6DFB\u52A0\u7684TabPane: ".concat(key));
24224
- });
24225
- }
24226
- if (removedTabPanes.length > 0) {
24227
- console.log("[DOM\u76D1\u63A7] \u68C0\u6D4B\u5230 ".concat(removedTabPanes.length, " \u4E2ATabPane\u8282\u70B9\u88AB\u5220\u9664"));
24228
- removedTabPanes.forEach(function (node) {
24229
- var key = node.getAttribute('data-node-key') || '未知';
24230
- console.log("[DOM\u76D1\u63A7] \u5220\u9664\u7684TabPane: ".concat(key));
24231
- // 检查是否是当前组件对应的TabPane
24232
- if (key === _this4.props.item.key) {
24233
- console.log("[DOM\u76D1\u63A7] \u5F53\u524D\u7EC4\u4EF6 ".concat(_this4.props.item.key, " \u5BF9\u5E94\u7684TabPane\u5DF2\u4ECEDOM\u4E2D\u5220\u9664"));
24234
- }
24235
- });
24236
- }
24237
- // 统计当前DOM中的TabPane数量
24238
- var currentTabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
24239
- console.log("[DOM\u76D1\u63A7] \u5F53\u524DDOM\u4E2DTabPane\u8282\u70B9\u603B\u6570: ".concat(currentTabPanes.length));
24240
- }
24241
- });
24242
- });
24243
- // 开始观察
24244
- _this4.domObserver.observe(globalTabsContainer, {
24245
- childList: true,
24246
- subtree: true
24247
- });
24248
- console.log("[DOM\u76D1\u63A7] \u5DF2\u4E3A\u9875\u7B7E ".concat(_this4.props.item.key, " \u8BBE\u7F6EDOM\u53D8\u5316\u76D1\u63A7"));
24249
- };
24563
+ _this5 = _callSuper(this, WrapperComponent, [props]);
24564
+ // 初始化组件状态
24250
24565
  // 通用事件处理器,用于清理
24251
- _this4.handleEvent = function (event) {
24566
+ _this5.handleEvent = function (event) {
24252
24567
  // 空的事件处理器,仅用于清理时移除监听器
24253
24568
  };
24254
- console.log("WrapperComponent \u6784\u9020\u51FD\u6570: \u9875\u7B7E ".concat(props.item.key, " \u521B\u5EFA"));
24255
- // 初始化MutationObserver
24256
- _this4.domObserver = null;
24257
- _this4.isUnmounted = false;
24258
- // 统计当前DOM节点数
24259
- setTimeout(function () {
24260
- var tabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
24261
- console.log("[\u7EC4\u4EF6\u521B\u5EFA] \u9875\u7B7E ".concat(props.item.key, " \u521B\u5EFA\u540E\uFF0CDOM\u4E2DTabPane\u8282\u70B9\u6570: ").concat(tabPanes.length));
24262
- }, 0);
24263
- return _this4;
24569
+ // 拖拽事件处理器,用于清理
24570
+ _this5.handleDragEvent = function (event) {
24571
+ // 空的拖拽事件处理器,仅用于清理时移除监听器
24572
+ };
24573
+ _this5.isUnmounted = false;
24574
+ return _this5;
24264
24575
  }
24265
24576
  _inherits(WrapperComponent, _React$Component);
24266
24577
  return _createClass(WrapperComponent, [{
24267
24578
  key: "componentDidMount",
24268
24579
  value: function componentDidMount() {
24269
- console.log("WrapperComponent \u6302\u8F7D: \u9875\u7B7E ".concat(this.props.item.key, " \u5DF2\u6302\u8F7D\u5230DOM"));
24270
- var tabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
24271
- console.log("[\u7EC4\u4EF6\u6302\u8F7D] \u9875\u7B7E ".concat(this.props.item.key, " \u6302\u8F7D\u540E\uFF0CDOM\u4E2DTabPane\u8282\u70B9\u6570: ").concat(tabPanes.length));
24272
- // 设置MutationObserver监控DOM变化
24273
- this.setupDOMObserver();
24580
+ // 组件挂载完成
24274
24581
  }
24275
24582
  }, {
24276
24583
  key: "componentWillUnmount",
24277
24584
  value: function componentWillUnmount() {
24278
- var _this5 = this;
24279
- console.log("WrapperComponent \u5378\u8F7D: \u9875\u7B7E ".concat(this.props.item.key, " \u7EC4\u4EF6\u6B63\u5728\u9500\u6BC1"));
24585
+ var _this6 = this;
24280
24586
  // 设置卸载标志
24281
24587
  this.isUnmounted = true;
24282
- var tabPanes = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
24283
- console.log("[\u7EC4\u4EF6\u5378\u8F7D] \u9875\u7B7E ".concat(this.props.item.key, " \u5378\u8F7D\u524D\uFF0CDOM\u4E2DTabPane\u8282\u70B9\u6570: ").concat(tabPanes.length));
24284
- // 清理MutationObserver
24285
- if (this.domObserver) {
24286
- this.domObserver.disconnect();
24287
- this.domObserver = null;
24288
- console.log("[\u6E05\u7406] \u5DF2\u65AD\u5F00\u9875\u7B7E ".concat(this.props.item.key, " \u7684DOM\u76D1\u63A7"));
24289
- }
24290
- // 强制清理所有可能的引用和事件监听器
24588
+ // 清理可能的DOM事件监听器
24291
24589
  try {
24292
- // 清理组件内部的所有引用
24293
- if (this.props && _typeof(this.props) === 'object') {
24294
- Object.keys(this.props).forEach(function (key) {
24295
- if (_this5.props[key] && _typeof(_this5.props[key]) === 'object') {
24296
- // 不直接删除props,但清理可能的循环引用
24297
- console.log("[\u6E05\u7406] \u68C0\u67E5prop: ".concat(key));
24298
- }
24299
- });
24300
- }
24301
- // 清理可能的DOM事件监听器
24302
- 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);
24303
24591
  if (currentElement) {
24304
24592
  // 移除所有可能的事件监听器
24305
24593
  var events = ['click', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'focus', 'blur'];
24306
24594
  events.forEach(function (eventType) {
24307
- currentElement.removeEventListener(eventType, _this5.handleEvent, true);
24308
- currentElement.removeEventListener(eventType, _this5.handleEvent, false);
24595
+ currentElement.removeEventListener(eventType, _this6.handleEvent, true);
24596
+ currentElement.removeEventListener(eventType, _this6.handleEvent, false);
24309
24597
  });
24310
- console.log("[\u6E05\u7406] \u5DF2\u6E05\u7406\u9875\u7B7E ".concat(this.props.item.key, " \u7684DOM\u4E8B\u4EF6\u76D1\u542C\u5668"));
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');
24614
+ });
24615
+ dragStateKeys.forEach(function (key) {
24616
+ try {
24617
+ delete currentElement[key];
24618
+ } catch (e) {
24619
+ // 忽略删除失败的情况
24620
+ }
24621
+ });
24622
+ null, _readOnlyError("currentElement");
24311
24623
  }
24312
24624
  // 强制垃圾回收提示
24313
24625
  if (window.gc && typeof window.gc === 'function') {
24314
24626
  window.gc();
24315
- console.log("[\u6E05\u7406] \u5DF2\u89E6\u53D1\u5783\u573E\u56DE\u6536");
24316
24627
  }
24317
24628
  } catch (error) {
24318
- console.error("[\u6E05\u7406\u9519\u8BEF] \u9875\u7B7E ".concat(this.props.item.key, " \u6E05\u7406\u8FC7\u7A0B\u4E2D\u51FA\u9519:"), error);
24629
+ // 清理过程中的错误处理
24319
24630
  }
24320
- // 延迟检查卸载后的DOM状态
24321
- setTimeout(function () {
24322
- var tabPanesAfter = document.querySelectorAll('#globalTabs .ant-tabs-tabpane');
24323
- console.log("[\u7EC4\u4EF6\u5378\u8F7D] \u9875\u7B7E ".concat(_this5.props.item.key, " \u5378\u8F7D\u540E\uFF0CDOM\u4E2DTabPane\u8282\u70B9\u6570: ").concat(tabPanesAfter.length));
24324
- // 强制检查内存使用情况
24325
- if (window.performance && window.performance.memory) {
24326
- var memory = window.performance.memory;
24327
- console.log("[\u5185\u5B58\u76D1\u63A7] \u5378\u8F7D\u540E\u5185\u5B58\u4F7F\u7528: ".concat((memory.usedJSHeapSize / 1024 / 1024).toFixed(2), "MB / ").concat((memory.totalJSHeapSize / 1024 / 1024).toFixed(2), "MB"));
24328
- }
24329
- }, 100);
24330
24631
  }
24331
24632
  }, {
24332
24633
  key: "shouldComponentUpdate",
@@ -24334,26 +24635,24 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
24334
24635
  var _nextProps$item,
24335
24636
  _nextProps$item$key,
24336
24637
  _this$props$listenRou,
24337
- _this6 = this,
24638
+ _this7 = this,
24338
24639
  _nextProps$listenRout;
24339
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) {
24340
24641
  return true;
24341
24642
  }
24342
24643
  // 检测页签是否已被删除:比较当前和下一个listenRouterState
24343
24644
  var currentTabExists = (_this$props$listenRou = this.props.listenRouterState) === null || _this$props$listenRou === void 0 ? void 0 : _this$props$listenRou.some(function (tab) {
24344
- return tab.key === _this6.props.item.key;
24645
+ return tab.key === _this7.props.item.key;
24345
24646
  });
24346
24647
  var nextTabExists = (_nextProps$listenRout = nextProps.listenRouterState) === null || _nextProps$listenRout === void 0 ? void 0 : _nextProps$listenRout.some(function (tab) {
24347
- return tab.key === _this6.props.item.key;
24648
+ return tab.key === _this7.props.item.key;
24348
24649
  });
24349
24650
  // 如果页签从存在变为不存在,说明被删除了,允许更新以便正确销毁
24350
24651
  if (currentTabExists && !nextTabExists) {
24351
- console.log("\u9875\u7B7E ".concat(this.props.item.key, " \u5DF2\u88AB\u5220\u9664\uFF0C\u5141\u8BB8\u7EC4\u4EF6\u66F4\u65B0\u4EE5\u4FBF\u9500\u6BC1"));
24352
24652
  return true;
24353
24653
  }
24354
24654
  // 如果页签不再是活跃状态,允许更新以便正确销毁
24355
24655
  if (nextProps.activeKey !== nextProps.item.key && this.props.activeKey === this.props.item.key) {
24356
- console.log("\u9875\u7B7E ".concat(this.props.item.key, " \u4E0D\u518D\u6D3B\u8DC3\uFF0C\u5141\u8BB8\u7EC4\u4EF6\u66F4\u65B0"));
24357
24656
  return true;
24358
24657
  }
24359
24658
  // 如果页签变为活跃状态或内容发生变化,允许更新
@@ -28012,7 +28311,7 @@ pp$5.currentThisScope = function() {
28012
28311
  }
28013
28312
  };
28014
28313
 
28015
- var Node$1 = function Node(parser, pos, loc) {
28314
+ var Node = function Node(parser, pos, loc) {
28016
28315
  this.type = "";
28017
28316
  this.start = pos;
28018
28317
  this.end = 0;
@@ -28029,11 +28328,11 @@ var Node$1 = function Node(parser, pos, loc) {
28029
28328
  var pp$6 = Parser.prototype;
28030
28329
 
28031
28330
  pp$6.startNode = function() {
28032
- return new Node$1(this, this.start, this.startLoc)
28331
+ return new Node(this, this.start, this.startLoc)
28033
28332
  };
28034
28333
 
28035
28334
  pp$6.startNodeAt = function(pos, loc) {
28036
- return new Node$1(this, pos, loc)
28335
+ return new Node(this, pos, loc)
28037
28336
  };
28038
28337
 
28039
28338
  // Finish an AST node, adding `type` and `end` properties.
@@ -30101,7 +30400,7 @@ Parser.acorn = {
30101
30400
  Position: Position,
30102
30401
  SourceLocation: SourceLocation,
30103
30402
  getLineInfo: getLineInfo,
30104
- Node: Node$1,
30403
+ Node: Node,
30105
30404
  TokenType: TokenType,
30106
30405
  tokTypes: types,
30107
30406
  keywordTypes: keywords$1,
@@ -30787,6 +31086,8 @@ var ConfigTree = (function (props) {
30787
31086
  _useState4 = _slicedToArray(_useState3, 2),
30788
31087
  activeLine = _useState4[0],
30789
31088
  setActiveLine = _useState4[1];
31089
+ var highlightTimerRef = React__default['default'].useRef(null);
31090
+ var isUnmountedRef = React__default['default'].useRef(false);
30790
31091
  React$1.useEffect(function () {
30791
31092
  setTreeData(parseData(data));
30792
31093
  }, [data]);
@@ -30798,10 +31099,32 @@ var ConfigTree = (function (props) {
30798
31099
  }
30799
31100
  }, [treeData, currentLine]);
30800
31101
  React$1.useEffect(function () {
30801
- setTimeout(function () {
30802
- 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
+ }
30803
31115
  });
30804
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
+ }, []);
30805
31128
  var handleSelect = function handleSelect(node, hasChildren) {
30806
31129
  var noActiveData = clearActiveNode(treeData);
30807
31130
  setTreeData(noActiveData);
@@ -32033,7 +32356,6 @@ var FieldsModifyModal = function FieldsModifyModal(props) {
32033
32356
  }),
32034
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(',')) || []
32035
32358
  });
32036
- console.log(record, 'record');
32037
32359
  var trueOrFalseSource = [{
32038
32360
  text: '是',
32039
32361
  value: true
@@ -33019,7 +33341,6 @@ var FieldsSettingsTable = (function (props) {
33019
33341
  render: function render(_ref) {
33020
33342
  var text = _ref.text;
33021
33343
  var jsonEditorVal = localStorage.getItem('jsonEditorVal') || '';
33022
- console.log('jsonEditorVal', jsonEditorVal);
33023
33344
  return jsonEditorVal.indexOf(text) >= 0 ? '是' : "否";
33024
33345
  }
33025
33346
  }, {
@@ -33294,9 +33615,7 @@ function hanleCallbackValue(codeProps, value, customerFields) {
33294
33615
  }
33295
33616
  }
33296
33617
  return extensionFields[fieldName2] || extensionFields[fieldName1] || '';
33297
- } catch (e) {
33298
- console.log('e', e);
33299
- }
33618
+ } catch (e) {}
33300
33619
  }
33301
33620
  });
33302
33621
  } else {
@@ -33664,9 +33983,7 @@ var getColumnItem = function getColumnItem(_ref) {
33664
33983
  if (JSON.parse(item.info || '{}').dictionaryCode) {
33665
33984
  dictionaryCode = JSON.parse(item.info || '{}').dictionaryCode;
33666
33985
  }
33667
- } catch (e) {
33668
- console.log('error', e);
33669
- }
33986
+ } catch (e) {}
33670
33987
  ites.sourceList = dictionaryCode && getDictionarySource(dictionaryCode) || [];
33671
33988
  }
33672
33989
  if (item.choiceType == 10) {
@@ -33676,9 +33993,7 @@ var getColumnItem = function getColumnItem(_ref) {
33676
33993
  if (JSON.parse(item.info || '{}').enumeration) {
33677
33994
  enumeration = JSON.parse(item.info || '{}').enumeration;
33678
33995
  }
33679
- } catch (e) {
33680
- console.log('error', e);
33681
- }
33996
+ } catch (e) {}
33682
33997
  ites.sourceList = enumeration && Object.keys(enumeration).map(function (key) {
33683
33998
  return {
33684
33999
  value: key,
@@ -33773,7 +34088,6 @@ function _getMetaData() {
33773
34088
  }).then(function (res) {
33774
34089
  resolve(res.data);
33775
34090
  }).catch(function (error) {
33776
- console.log(error, 'error');
33777
34091
  reject([]);
33778
34092
  });
33779
34093
  }));
@@ -34020,9 +34334,7 @@ var CustomSelectorModal = /*#__PURE__*/React$1.forwardRef(function (props, ref)
34020
34334
  if (JSON.parse(item.info).isLikeQuery) {
34021
34335
  name = "qp-".concat(item.code, "-like");
34022
34336
  }
34023
- } catch (e) {
34024
- console.log('error', e);
34025
- }
34337
+ } catch (e) {}
34026
34338
  return {
34027
34339
  name: name,
34028
34340
  label: item.name,
@@ -37586,7 +37898,6 @@ var RuleField = /*#__PURE__*/function (_Component) {
37586
37898
  this.getRegularThresholdRange(nextProps.queryIdentify, nextProps.propertyCode, nextProps.queryIdentifyType);
37587
37899
  }
37588
37900
  if (JSON.stringify(nextProps.initialThresholdQuery) != JSON.stringify(this.props.initialThresholdQuery)) {
37589
- console.log(findChangedThresholdQuery(this.props.initialThresholdQuery, nextProps.initialThresholdQuery));
37590
37901
  var changedPropsVal = findChangedThresholdQuery(this.props.initialThresholdQuery, nextProps.initialThresholdQuery);
37591
37902
  this.setState({
37592
37903
  thresholdQuery: _objectSpread2({}, nextProps.initialThresholdQuery)
@@ -38154,7 +38465,6 @@ function RenderCompItem(props) {
38154
38465
  }
38155
38466
  return Item;
38156
38467
  });
38157
- console.log((ites === null || ites === void 0 ? void 0 : ites.dictionaryCode) && !getDictionarySource(ites.dictionaryCode));
38158
38468
  var _useState = React$1.useState(getDictionarySource(ites.dictionaryCode) || []),
38159
38469
  _useState2 = _slicedToArray(_useState, 2),
38160
38470
  dictData = _useState2[0],
@@ -38716,7 +39026,6 @@ function RenderCompItem(props) {
38716
39026
  key: showValue(ites.code),
38717
39027
  // FIXME http://192.168.13.78/mep-fed-group/web/libs/business-component/-/merge_requests/45#note_115667
38718
39028
  setValue: function setValue(val, formulaName) {
38719
- console.log(val, 'val');
38720
39029
  var value = val.map(function (item) {
38721
39030
  return item.value.replace(/[a-zA-Z_]+\.\w+/g, function (i) {
38722
39031
  return '{' + i + '}';
@@ -40085,7 +40394,6 @@ var formatRegularList = function formatRegularList(data) {
40085
40394
  var handleRuleShowBack = function handleRuleShowBack(data, functionRuleList, ruleReturnList) {
40086
40395
  var result = data === null || data === void 0 ? void 0 : data.map(function (item, index) {
40087
40396
  var _item$result, _item$result3;
40088
- console.log('data', item);
40089
40397
  var newResponse = [];
40090
40398
  //新数据都用responseArray形式
40091
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)) {