@bit-sun/business-component 4.2.5-per-alpha.2 → 4.2.5-per-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.fatherrc.ts +4 -0
- package/dist/index.esm.js +827 -353
- package/dist/index.js +827 -353
- package/package.json +5 -4
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +75 -45
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +13 -10
- package/src/components/Business/BsLayouts/index.tsx +142 -27
- package/src/components/Business/BsSulaQueryTable/index.tsx +588 -161
- package/src/components/Business/BsSulaQueryTable/setting.tsx +34 -24
- package/src/components/Business/HomePageWrapper/index.tsx +43 -13
- package/src/components/Business/JsonQueryTable/configTree/index.js +29 -2
- package/src/components/Functional/QueryMutipleSelect/index.tsx +33 -4
package/dist/index.esm.js
CHANGED
|
@@ -254,6 +254,9 @@ function _possibleConstructorReturn(t, e) {
|
|
|
254
254
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
255
255
|
return _assertThisInitialized(t);
|
|
256
256
|
}
|
|
257
|
+
function _readOnlyError(r) {
|
|
258
|
+
throw new TypeError('"' + r + '" is read-only');
|
|
259
|
+
}
|
|
257
260
|
function _regenerator() {
|
|
258
261
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
259
262
|
var e,
|
|
@@ -2014,7 +2017,6 @@ var getItemDefaultWidth$1 = function getItemDefaultWidth(item) {
|
|
|
2014
2017
|
defaultWidth = 130;
|
|
2015
2018
|
break;
|
|
2016
2019
|
}
|
|
2017
|
-
console.log(defaultWidth);
|
|
2018
2020
|
return defaultWidth;
|
|
2019
2021
|
};
|
|
2020
2022
|
var sulaTableRenderTooltip = function sulaTableRenderTooltip(_ref) {
|
|
@@ -2212,7 +2214,6 @@ var getJoinDictionaryText = function getJoinDictionaryText(dicCode, value) {
|
|
|
2212
2214
|
var handleBeforeUpload = function handleBeforeUpload(file, size, suffixRule) {
|
|
2213
2215
|
var extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase();
|
|
2214
2216
|
var isFileType = suffixRule.length > 0 && suffixRule.includes(extName);
|
|
2215
|
-
console.log(file, extName, isFileType, suffixRule, suffixRule.includes(extName));
|
|
2216
2217
|
if (!isFileType) {
|
|
2217
2218
|
message$1.error("\u8BF7\u4E0A\u4F20".concat(suffixRule.toString(), "\u7B49\u683C\u5F0F\u7684\u6587\u4EF6!"));
|
|
2218
2219
|
}
|
|
@@ -2299,7 +2300,6 @@ var socketFunctions = {
|
|
|
2299
2300
|
getPrinterList: function getPrinterList(socket) {
|
|
2300
2301
|
var request = socketFunctions.getRequestObject('getPrinters');
|
|
2301
2302
|
if (socket.readyState === 1) {
|
|
2302
|
-
console.log(request, socket, 'getPrintList');
|
|
2303
2303
|
socket.send(JSON.stringify(request));
|
|
2304
2304
|
}
|
|
2305
2305
|
},
|
|
@@ -2380,7 +2380,6 @@ var socketFunctions = {
|
|
|
2380
2380
|
totalDocumentCount: 100
|
|
2381
2381
|
}
|
|
2382
2382
|
};
|
|
2383
|
-
console.log(socket, '打印前的最后一步', request);
|
|
2384
2383
|
socket.send(JSON.stringify(request));
|
|
2385
2384
|
}
|
|
2386
2385
|
};
|
|
@@ -2544,7 +2543,6 @@ function _loadLuckysheet() {
|
|
|
2544
2543
|
while (1) switch (_context.p = _context.n) {
|
|
2545
2544
|
case 0:
|
|
2546
2545
|
_context.p = 0;
|
|
2547
|
-
console.log('开始动态加载 Luckysheet 资源...');
|
|
2548
2546
|
// 并行加载所有 CSS 文件
|
|
2549
2547
|
cssPromises = LUCKYSHEET_RESOURCES.css.map(function (url) {
|
|
2550
2548
|
return loadCSS(url);
|
|
@@ -2552,7 +2550,6 @@ function _loadLuckysheet() {
|
|
|
2552
2550
|
_context.n = 1;
|
|
2553
2551
|
return Promise.all(cssPromises);
|
|
2554
2552
|
case 1:
|
|
2555
|
-
console.log('Luckysheet CSS 文件加载完成');
|
|
2556
2553
|
// 顺序加载 JS 文件(保证依赖顺序)
|
|
2557
2554
|
_iterator = _createForOfIteratorHelper(LUCKYSHEET_RESOURCES.js);
|
|
2558
2555
|
_context.p = 2;
|
|
@@ -2580,7 +2577,6 @@ function _loadLuckysheet() {
|
|
|
2580
2577
|
_iterator.f();
|
|
2581
2578
|
return _context.f(7);
|
|
2582
2579
|
case 8:
|
|
2583
|
-
console.log('Luckysheet JS 文件加载完成');
|
|
2584
2580
|
// 等待 luckysheet 对象可用
|
|
2585
2581
|
retryCount = 0;
|
|
2586
2582
|
maxRetries = 50; // 最多等待 5 秒
|
|
@@ -2605,13 +2601,11 @@ function _loadLuckysheet() {
|
|
|
2605
2601
|
throw new Error('Luckysheet 加载超时,请检查网络连接');
|
|
2606
2602
|
case 12:
|
|
2607
2603
|
cache.loaded = true;
|
|
2608
|
-
console.log('Luckysheet 动态加载完成');
|
|
2609
2604
|
_context.n = 14;
|
|
2610
2605
|
break;
|
|
2611
2606
|
case 13:
|
|
2612
2607
|
_context.p = 13;
|
|
2613
2608
|
_t2 = _context.v;
|
|
2614
|
-
console.error('Luckysheet 加载失败:', _t2);
|
|
2615
2609
|
cache.loading = null; // 重置加载状态,允许重试
|
|
2616
2610
|
throw _t2;
|
|
2617
2611
|
case 14:
|
|
@@ -2928,7 +2922,6 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2928
2922
|
};
|
|
2929
2923
|
};
|
|
2930
2924
|
_this.getData = function () {
|
|
2931
|
-
console.time();
|
|
2932
2925
|
var sheetData = luckysheet.getSheetData();
|
|
2933
2926
|
var data = JSON.parse(JSON.stringify(sheetData)).filter(function (item) {
|
|
2934
2927
|
return item[0];
|
|
@@ -3060,7 +3053,6 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
3060
3053
|
errorListCheck: false,
|
|
3061
3054
|
resultData: res
|
|
3062
3055
|
});
|
|
3063
|
-
console.log(setExportData);
|
|
3064
3056
|
setExportData([123123]);
|
|
3065
3057
|
}).catch(function (err) {});
|
|
3066
3058
|
};
|
|
@@ -3316,7 +3308,6 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
3316
3308
|
case 4:
|
|
3317
3309
|
_context.p = 4;
|
|
3318
3310
|
_t = _context.v;
|
|
3319
|
-
console.error('DataValidation 组件初始化失败:', _t);
|
|
3320
3311
|
this.setState({
|
|
3321
3312
|
luckysheetLoading: false,
|
|
3322
3313
|
luckysheetLoadError: _t.message || '加载失败'
|
|
@@ -3403,7 +3394,6 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
3403
3394
|
left: '0px',
|
|
3404
3395
|
top: '0px'
|
|
3405
3396
|
};
|
|
3406
|
-
console.log('itemsTemp', itemsTemp);
|
|
3407
3397
|
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("div", {
|
|
3408
3398
|
className: "sheet_table_top"
|
|
3409
3399
|
}, /*#__PURE__*/React$1.createElement(Space, null, /*#__PURE__*/React$1.createElement("span", null, "\u6392\u5E8F\u5217"), /*#__PURE__*/React$1.createElement(Dropdown, {
|
|
@@ -3800,7 +3790,6 @@ var DataImport = /*#__PURE__*/function (_React$Component) {
|
|
|
3800
3790
|
};
|
|
3801
3791
|
};
|
|
3802
3792
|
_this.getData = function () {
|
|
3803
|
-
console.time();
|
|
3804
3793
|
var sheetData = luckysheet$1.getSheetData();
|
|
3805
3794
|
var data = JSON.parse(JSON.stringify(sheetData)).filter(function (item) {
|
|
3806
3795
|
return item[0];
|
|
@@ -3894,7 +3883,6 @@ var DataImport = /*#__PURE__*/function (_React$Component) {
|
|
|
3894
3883
|
errorListCheck: false,
|
|
3895
3884
|
resultData: res
|
|
3896
3885
|
});
|
|
3897
|
-
console.log(setExportData);
|
|
3898
3886
|
setExportData([123123]);
|
|
3899
3887
|
}).catch(function (err) {});
|
|
3900
3888
|
};
|
|
@@ -4117,7 +4105,6 @@ var DataImport = /*#__PURE__*/function (_React$Component) {
|
|
|
4117
4105
|
case 5:
|
|
4118
4106
|
_context.p = 5;
|
|
4119
4107
|
_t = _context.v;
|
|
4120
|
-
console.error('加载 Luckysheet 失败:', _t);
|
|
4121
4108
|
this.setState({
|
|
4122
4109
|
luckysheetLoading: false,
|
|
4123
4110
|
luckysheetLoadError: _t.message || '加载失败'
|
|
@@ -4961,6 +4948,8 @@ var QueryMutipleSearchSelect = function QueryMutipleSearchSelect(_ref) {
|
|
|
4961
4948
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
4962
4949
|
uniqueValue = _useState14[0],
|
|
4963
4950
|
setUniqueValue = _useState14[1];
|
|
4951
|
+
var selectTimerRef = useRef(null);
|
|
4952
|
+
var isUnmountedRef = useRef(false);
|
|
4964
4953
|
useEffect(function () {
|
|
4965
4954
|
setPopValue(value);
|
|
4966
4955
|
onValueChange(value);
|
|
@@ -4968,6 +4957,16 @@ var QueryMutipleSearchSelect = function QueryMutipleSearchSelect(_ref) {
|
|
|
4968
4957
|
useEffect(function () {
|
|
4969
4958
|
setUniqueValue(makeUniqueValue());
|
|
4970
4959
|
}, [resultSourceKey]);
|
|
4960
|
+
// 组件卸载时清理定时器
|
|
4961
|
+
useEffect(function () {
|
|
4962
|
+
return function () {
|
|
4963
|
+
isUnmountedRef.current = true;
|
|
4964
|
+
if (selectTimerRef.current) {
|
|
4965
|
+
clearTimeout(selectTimerRef.current);
|
|
4966
|
+
selectTimerRef.current = null;
|
|
4967
|
+
}
|
|
4968
|
+
};
|
|
4969
|
+
}, []);
|
|
4971
4970
|
var showModal = function showModal() {
|
|
4972
4971
|
setIsModalVisible(true);
|
|
4973
4972
|
//弹窗打开时 默认搜索内容换行显示
|
|
@@ -5074,8 +5073,19 @@ var QueryMutipleSearchSelect = function QueryMutipleSearchSelect(_ref) {
|
|
|
5074
5073
|
},
|
|
5075
5074
|
onSelect: function onSelect() {
|
|
5076
5075
|
if (selectMode) return;
|
|
5077
|
-
|
|
5078
|
-
|
|
5076
|
+
// 清理之前的定时器
|
|
5077
|
+
if (selectTimerRef.current) {
|
|
5078
|
+
clearTimeout(selectTimerRef.current);
|
|
5079
|
+
selectTimerRef.current = null;
|
|
5080
|
+
}
|
|
5081
|
+
selectTimerRef.current = setTimeout(function () {
|
|
5082
|
+
try {
|
|
5083
|
+
if (!isUnmountedRef.current) {
|
|
5084
|
+
setOpen(false);
|
|
5085
|
+
}
|
|
5086
|
+
} catch (error) {} finally {
|
|
5087
|
+
selectTimerRef.current = null;
|
|
5088
|
+
}
|
|
5079
5089
|
}, 0);
|
|
5080
5090
|
},
|
|
5081
5091
|
style: {
|
|
@@ -9683,7 +9693,6 @@ var BillEntry = function BillEntry(_ref3) {
|
|
|
9683
9693
|
}, [data]);
|
|
9684
9694
|
useEffect(function () {
|
|
9685
9695
|
setInitialShowColumn(codeSelected, selectColumns, function (res) {
|
|
9686
|
-
console.log(res, '---res');
|
|
9687
9696
|
setShowColumnsCallback(res);
|
|
9688
9697
|
});
|
|
9689
9698
|
}, [selectColumns]);
|
|
@@ -14031,7 +14040,6 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
|
|
|
14031
14040
|
}, parProps.requestConfig),
|
|
14032
14041
|
selectProps: selectProps,
|
|
14033
14042
|
onChange: function onChange(value) {
|
|
14034
|
-
console.log(value);
|
|
14035
14043
|
setValue(value);
|
|
14036
14044
|
},
|
|
14037
14045
|
beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
|
|
@@ -14355,7 +14363,6 @@ var AddSkcSelect = function AddSkcSelect(parProps) {
|
|
|
14355
14363
|
}, parProps.requestConfig),
|
|
14356
14364
|
selectProps: selectProps,
|
|
14357
14365
|
onChange: function onChange(value) {
|
|
14358
|
-
console.log(value);
|
|
14359
14366
|
setValue(value);
|
|
14360
14367
|
},
|
|
14361
14368
|
beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
|
|
@@ -14672,7 +14679,6 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
|
|
|
14672
14679
|
}, parProps.requestConfig),
|
|
14673
14680
|
selectProps: selectProps,
|
|
14674
14681
|
onChange: function onChange(value) {
|
|
14675
|
-
console.log(value);
|
|
14676
14682
|
setValue(value);
|
|
14677
14683
|
},
|
|
14678
14684
|
beforeShowModal: parProps === null || parProps === void 0 ? void 0 : parProps.beforeShowModal,
|
|
@@ -17130,9 +17136,7 @@ var doDetailPageAction = function doDetailPageAction(config) {
|
|
|
17130
17136
|
okType: 'danger',
|
|
17131
17137
|
cancelText: '取消',
|
|
17132
17138
|
onOk: onOk,
|
|
17133
|
-
onCancel: function onCancel() {
|
|
17134
|
-
console.log('Cancel');
|
|
17135
|
-
}
|
|
17139
|
+
onCancel: function onCancel() {}
|
|
17136
17140
|
});
|
|
17137
17141
|
}
|
|
17138
17142
|
}
|
|
@@ -17577,13 +17581,10 @@ var _excluded$f = ["children"];
|
|
|
17577
17581
|
var index$4 = (function (props) {
|
|
17578
17582
|
var _useLocation = useLocation(),
|
|
17579
17583
|
pathname = _useLocation.pathname;
|
|
17580
|
-
var _useState = useState(pathname + 'id'),
|
|
17581
|
-
_useState2 = _slicedToArray(_useState, 1),
|
|
17582
|
-
id = _useState2[0];
|
|
17583
17584
|
var children = props.children,
|
|
17584
17585
|
restProps = _objectWithoutProperties(props, _excluded$f);
|
|
17585
17586
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
17586
|
-
id:
|
|
17587
|
+
id: "home-page-wrapper",
|
|
17587
17588
|
className: 'home_page_wrapper'
|
|
17588
17589
|
}, /*#__PURE__*/React$1.createElement(HeaderWrapper, _objectSpread2({
|
|
17589
17590
|
pathname: pathname
|
|
@@ -17598,10 +17599,11 @@ var HeaderWrapper = /*#__PURE__*/React$1.memo(function (_ref) {
|
|
|
17598
17599
|
extra = _ref.extra,
|
|
17599
17600
|
title = _ref.title,
|
|
17600
17601
|
pathToRegexp = _ref.pathToRegexp;
|
|
17601
|
-
var
|
|
17602
|
-
|
|
17603
|
-
breadcrumbArr =
|
|
17604
|
-
setBreadCrumbArr =
|
|
17602
|
+
var _useState = useState([]),
|
|
17603
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17604
|
+
breadcrumbArr = _useState2[0],
|
|
17605
|
+
setBreadCrumbArr = _useState2[1];
|
|
17606
|
+
var isMountedRef = React$1.useRef(true);
|
|
17605
17607
|
var basePath = window.top == window ? '' : "/".concat(itemPath);
|
|
17606
17608
|
var menuRoutes = useMemo(function () {
|
|
17607
17609
|
var _routes$find;
|
|
@@ -17612,13 +17614,13 @@ var HeaderWrapper = /*#__PURE__*/React$1.memo(function (_ref) {
|
|
|
17612
17614
|
var breadcrumbNameMap = useMemo(function () {
|
|
17613
17615
|
return getMainCrumbNameMap(memoizeOneFormatter(menuRoutes, ''));
|
|
17614
17616
|
}, [menuRoutes]); // 只有menuRoutes变化时才重新创建
|
|
17615
|
-
var matchParamsPath = function
|
|
17617
|
+
var matchParamsPath = useCallback(function (pathname, breadcrumbNameMap) {
|
|
17616
17618
|
var pathKey = Object.keys(breadcrumbNameMap).find(function (key) {
|
|
17617
17619
|
return pathToRegexp ? pathToRegexp(key).test(pathname) : false;
|
|
17618
17620
|
});
|
|
17619
17621
|
return pathKey ? breadcrumbNameMap[pathKey] : undefined;
|
|
17620
|
-
};
|
|
17621
|
-
var getPageTitle = function
|
|
17622
|
+
}, [pathToRegexp]);
|
|
17623
|
+
var getPageTitle = useCallback(function (pathname) {
|
|
17622
17624
|
var currRouterData = matchParamsPath("".concat(basePath).concat(pathname), breadcrumbNameMap);
|
|
17623
17625
|
if (!currRouterData) {
|
|
17624
17626
|
return '';
|
|
@@ -17628,17 +17630,37 @@ var HeaderWrapper = /*#__PURE__*/React$1.memo(function (_ref) {
|
|
|
17628
17630
|
breadcrumbArrs.pop();
|
|
17629
17631
|
breadcrumbArrs.push(title);
|
|
17630
17632
|
}
|
|
17631
|
-
|
|
17633
|
+
// 只在组件挂载时更新状态,避免内存泄漏
|
|
17634
|
+
if (isMountedRef.current) {
|
|
17635
|
+
setBreadCrumbArr(_toConsumableArray(breadcrumbArrs));
|
|
17636
|
+
}
|
|
17632
17637
|
var pageName = formatMessage({
|
|
17633
17638
|
id: currRouterData.locale || currRouterData.name,
|
|
17634
17639
|
defaultMessage: currRouterData.name
|
|
17635
17640
|
});
|
|
17636
17641
|
return title ? title : window.top === window ? pageName : "".concat(currRouterData.name);
|
|
17637
|
-
};
|
|
17642
|
+
}, [matchParamsPath, breadcrumbNameMap, basePath, title]);
|
|
17638
17643
|
var pageTitle = useMemo(function () {
|
|
17639
17644
|
return getPageTitle(pathname);
|
|
17640
|
-
}, [
|
|
17641
|
-
useEffect(function () {
|
|
17645
|
+
}, [getPageTitle, pathname]);
|
|
17646
|
+
useEffect(function () {
|
|
17647
|
+
// 路径变化时的清理逻辑
|
|
17648
|
+
return function () {
|
|
17649
|
+
// 只在组件仍挂载时清理状态
|
|
17650
|
+
if (isMountedRef.current) {
|
|
17651
|
+
setBreadCrumbArr([]);
|
|
17652
|
+
}
|
|
17653
|
+
};
|
|
17654
|
+
}, [pathname]);
|
|
17655
|
+
// 组件卸载时清理所有引用
|
|
17656
|
+
useEffect(function () {
|
|
17657
|
+
return function () {
|
|
17658
|
+
// 标记组件已卸载
|
|
17659
|
+
isMountedRef.current = false;
|
|
17660
|
+
// 清理所有状态和引用
|
|
17661
|
+
setBreadCrumbArr([]);
|
|
17662
|
+
};
|
|
17663
|
+
}, []);
|
|
17642
17664
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
17643
17665
|
className: 'bs_home_page_head_wrapper'
|
|
17644
17666
|
}, /*#__PURE__*/React$1.createElement("div", {
|
|
@@ -17653,9 +17675,10 @@ var HeaderWrapper = /*#__PURE__*/React$1.memo(function (_ref) {
|
|
|
17653
17675
|
}, item));
|
|
17654
17676
|
}))), extra ? /*#__PURE__*/React$1.createElement(Space, null, extra) : ''), alertProps && (/*#__PURE__*/React$1.createElement(CommonAlert, _objectSpread2({}, alertProps))));
|
|
17655
17677
|
}, function (prevProps, nextProps) {
|
|
17656
|
-
//
|
|
17657
|
-
|
|
17658
|
-
|
|
17678
|
+
// 如果关键属性发生变化,则需要重新渲染
|
|
17679
|
+
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) {
|
|
17680
|
+
return false;
|
|
17681
|
+
}
|
|
17659
17682
|
return true;
|
|
17660
17683
|
});
|
|
17661
17684
|
|
|
@@ -17712,7 +17735,6 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
17712
17735
|
reject('');
|
|
17713
17736
|
}
|
|
17714
17737
|
}).catch(function (error) {
|
|
17715
|
-
console.error('[SortableTable] 请求失败:', error);
|
|
17716
17738
|
reject(error);
|
|
17717
17739
|
});
|
|
17718
17740
|
});
|
|
@@ -18239,7 +18261,6 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
18239
18261
|
reject('');
|
|
18240
18262
|
}
|
|
18241
18263
|
}).catch(function (error) {
|
|
18242
|
-
console.error('[SortableTable] 重置请求失败:', error);
|
|
18243
18264
|
message$1.error('重置表头列自定义失败,请稍后尝试');
|
|
18244
18265
|
reject(error);
|
|
18245
18266
|
});
|
|
@@ -18272,6 +18293,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
18272
18293
|
_this.isUnmounted = false;
|
|
18273
18294
|
_this.requestController = null;
|
|
18274
18295
|
_this.debounceTimer = null;
|
|
18296
|
+
_this.cleanupTimer = null;
|
|
18275
18297
|
// Modal组件ref,用于直接访问DOM进行清理
|
|
18276
18298
|
_this.modalRef = /*#__PURE__*/React$1.createRef();
|
|
18277
18299
|
return _this;
|
|
@@ -18340,19 +18362,15 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
18340
18362
|
}, {
|
|
18341
18363
|
key: "componentWillUnmount",
|
|
18342
18364
|
value: function componentWillUnmount() {
|
|
18343
|
-
console.log('[SortableTable] 组件即将卸载,开始清理资源');
|
|
18344
18365
|
// 设置卸载标志,防止异步操作
|
|
18345
18366
|
this.isUnmounted = true;
|
|
18346
18367
|
try {
|
|
18347
18368
|
// 1. 取消请求
|
|
18348
18369
|
if (this.requestController) {
|
|
18349
18370
|
try {
|
|
18350
|
-
console.log('[SortableTable] 取消进行中的请求');
|
|
18351
18371
|
this.requestController.abort();
|
|
18352
18372
|
this.requestController = null;
|
|
18353
|
-
} catch (abortError) {
|
|
18354
|
-
console.warn('[SortableTable] 取消请求时出错:', abortError);
|
|
18355
|
-
}
|
|
18373
|
+
} catch (abortError) {}
|
|
18356
18374
|
}
|
|
18357
18375
|
// 2. 清理定时器
|
|
18358
18376
|
if (this.debounceTimer) {
|
|
@@ -18443,22 +18461,15 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
18443
18461
|
if (modalElement._reactInternalInstance) {
|
|
18444
18462
|
modalElement._reactInternalInstance = null;
|
|
18445
18463
|
}
|
|
18446
|
-
} catch (error) {
|
|
18447
|
-
console.warn('[SortableTable] Modal ref清理失败:', error);
|
|
18448
|
-
}
|
|
18464
|
+
} catch (error) {}
|
|
18449
18465
|
this.modalRef.current = null;
|
|
18450
18466
|
}
|
|
18451
18467
|
this.modalRef = null;
|
|
18452
18468
|
// 7. 清理状态引用
|
|
18453
18469
|
this.state = null;
|
|
18454
18470
|
// 8. 防止组件卸载后的setState调用
|
|
18455
|
-
this.setState = function () {
|
|
18456
|
-
|
|
18457
|
-
};
|
|
18458
|
-
console.log('[SortableTable] 组件清理完成,__reactEventHandlers引用已断开');
|
|
18459
|
-
} catch (error) {
|
|
18460
|
-
console.warn('[SortableTable] 组件清理失败:', error);
|
|
18461
|
-
}
|
|
18471
|
+
this.setState = function () {};
|
|
18472
|
+
} catch (error) {}
|
|
18462
18473
|
}
|
|
18463
18474
|
}, {
|
|
18464
18475
|
key: "render",
|
|
@@ -18494,37 +18505,44 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
|
|
|
18494
18505
|
searchDataSource: '',
|
|
18495
18506
|
onSearchSort: ''
|
|
18496
18507
|
});
|
|
18508
|
+
// 清理之前的定时器
|
|
18509
|
+
if (_this2.cleanupTimer) {
|
|
18510
|
+
clearTimeout(_this2.cleanupTimer);
|
|
18511
|
+
_this2.cleanupTimer = null;
|
|
18512
|
+
}
|
|
18497
18513
|
// 强制清理React Fiber节点和DOM引用
|
|
18498
|
-
setTimeout(function () {
|
|
18514
|
+
_this2.cleanupTimer = setTimeout(function () {
|
|
18499
18515
|
try {
|
|
18500
|
-
|
|
18501
|
-
|
|
18502
|
-
|
|
18503
|
-
|
|
18504
|
-
|
|
18505
|
-
|
|
18506
|
-
|
|
18507
|
-
|
|
18508
|
-
|
|
18509
|
-
|
|
18510
|
-
|
|
18511
|
-
|
|
18516
|
+
if (!_this2.isUnmounted) {
|
|
18517
|
+
// 清理所有带有sort_table类名的DOM节点的React引用
|
|
18518
|
+
var sortTableElements = document.querySelectorAll('.sort_table, .sort_table_column_wrapper, .sort_table_column, .sort_table_content_wrapper, .sort_table_column_count');
|
|
18519
|
+
sortTableElements.forEach(function (element) {
|
|
18520
|
+
// 清理React内部实例引用
|
|
18521
|
+
var reactKeys = Object.keys(element).filter(function (key) {
|
|
18522
|
+
return key.startsWith('__reactInternalInstance') || key.startsWith('__reactEventHandlers');
|
|
18523
|
+
});
|
|
18524
|
+
reactKeys.forEach(function (key) {
|
|
18525
|
+
try {
|
|
18526
|
+
delete element[key];
|
|
18527
|
+
} catch (e) {
|
|
18528
|
+
// 忽略删除失败
|
|
18529
|
+
}
|
|
18530
|
+
});
|
|
18531
|
+
// 清理React Fiber引用
|
|
18532
|
+
if (element._reactInternalFiber) {
|
|
18533
|
+
element._reactInternalFiber = null;
|
|
18534
|
+
}
|
|
18535
|
+
if (element._reactInternalInstance) {
|
|
18536
|
+
element._reactInternalInstance = null;
|
|
18512
18537
|
}
|
|
18513
18538
|
});
|
|
18514
|
-
//
|
|
18515
|
-
if (
|
|
18516
|
-
|
|
18517
|
-
}
|
|
18518
|
-
if (element._reactInternalInstance) {
|
|
18519
|
-
element._reactInternalInstance = null;
|
|
18539
|
+
// 强制垃圾回收提示
|
|
18540
|
+
if (window.gc) {
|
|
18541
|
+
window.gc();
|
|
18520
18542
|
}
|
|
18521
|
-
});
|
|
18522
|
-
// 强制垃圾回收提示
|
|
18523
|
-
if (window.gc) {
|
|
18524
|
-
window.gc();
|
|
18525
18543
|
}
|
|
18526
|
-
} catch (error) {
|
|
18527
|
-
|
|
18544
|
+
} catch (error) {} finally {
|
|
18545
|
+
_this2.cleanupTimer = null;
|
|
18528
18546
|
}
|
|
18529
18547
|
}, 100);
|
|
18530
18548
|
},
|
|
@@ -18916,7 +18934,6 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
|
|
|
18916
18934
|
_this.patchUserSearchFieldsConfig(sortDataSource);
|
|
18917
18935
|
};
|
|
18918
18936
|
_this.handleCancel = function (e) {
|
|
18919
|
-
console.log(e);
|
|
18920
18937
|
_this.setState({
|
|
18921
18938
|
visible: false,
|
|
18922
18939
|
searchDataSource: ''
|
|
@@ -19099,7 +19116,6 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
|
|
|
19099
19116
|
key: "componentWillUnmount",
|
|
19100
19117
|
value: function componentWillUnmount() {
|
|
19101
19118
|
var _this2 = this;
|
|
19102
|
-
console.log('[SearchItemTable] 开始清理组件资源');
|
|
19103
19119
|
var cleanupTasks = [
|
|
19104
19120
|
// 取消所有进行中的请求
|
|
19105
19121
|
function () {
|
|
@@ -19107,11 +19123,8 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
|
|
|
19107
19123
|
if (_this2.requestControlle) {
|
|
19108
19124
|
_this2.requestController.abort();
|
|
19109
19125
|
_this2.requestController = null;
|
|
19110
|
-
console.log('[SearchItemTable] 请求已取消');
|
|
19111
19126
|
}
|
|
19112
|
-
} catch (error) {
|
|
19113
|
-
console.warn('[SearchItemTable] 请求取消失败:', error);
|
|
19114
|
-
}
|
|
19127
|
+
} catch (error) {}
|
|
19115
19128
|
},
|
|
19116
19129
|
// 清理定时器
|
|
19117
19130
|
function () {
|
|
@@ -19119,21 +19132,14 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
|
|
|
19119
19132
|
if (_this2.debounceTimer) {
|
|
19120
19133
|
clearTimeout(_this2.debounceTimer);
|
|
19121
19134
|
_this2.debounceTimer = null;
|
|
19122
|
-
console.log('[SearchItemTable] 防抖定时器已清理');
|
|
19123
19135
|
}
|
|
19124
|
-
} catch (error) {
|
|
19125
|
-
console.warn('[SearchItemTable] 定时器清理失败:', error);
|
|
19126
|
-
}
|
|
19136
|
+
} catch (error) {}
|
|
19127
19137
|
},
|
|
19128
19138
|
// 清理状态引用
|
|
19129
19139
|
function () {
|
|
19130
19140
|
try {
|
|
19131
|
-
_this2.setState = function () {
|
|
19132
|
-
|
|
19133
|
-
};
|
|
19134
|
-
} catch (error) {
|
|
19135
|
-
console.warn('[SearchItemTable] setState清理失败:', error);
|
|
19136
|
-
}
|
|
19141
|
+
_this2.setState = function () {};
|
|
19142
|
+
} catch (error) {}
|
|
19137
19143
|
},
|
|
19138
19144
|
// 清理DOM事件监听器
|
|
19139
19145
|
function () {
|
|
@@ -19142,11 +19148,8 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
|
|
|
19142
19148
|
_this2.dragContainer.removeEventListener('dragstart', _this2.handleDragStart);
|
|
19143
19149
|
_this2.dragContainer.removeEventListener('dragend', _this2.handleDragEnd);
|
|
19144
19150
|
_this2.dragContainer = null;
|
|
19145
|
-
console.log('[SearchItemTable] DOM事件监听器已清理');
|
|
19146
19151
|
}
|
|
19147
|
-
} catch (error) {
|
|
19148
|
-
console.warn('[SearchItemTable] DOM事件清理失败:', error);
|
|
19149
|
-
}
|
|
19152
|
+
} catch (error) {}
|
|
19150
19153
|
},
|
|
19151
19154
|
// 清理全局事件监听器
|
|
19152
19155
|
function () {
|
|
@@ -19156,9 +19159,7 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
|
|
|
19156
19159
|
document.removeEventListener('keydown', _this2.handleGlobalKeydown);
|
|
19157
19160
|
window.removeEventListener('resize', _this2.handleWindowResize);
|
|
19158
19161
|
}
|
|
19159
|
-
} catch (error) {
|
|
19160
|
-
console.warn('[SearchItemTable] 全局事件清理失败:', error);
|
|
19161
|
-
}
|
|
19162
|
+
} catch (error) {}
|
|
19162
19163
|
},
|
|
19163
19164
|
// 清理Table组件引用
|
|
19164
19165
|
function () {
|
|
@@ -19166,9 +19167,7 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
|
|
|
19166
19167
|
if (_this2.tableRef && _this2.tableRef.current) {
|
|
19167
19168
|
_this2.tableRef.current = null;
|
|
19168
19169
|
}
|
|
19169
|
-
} catch (error) {
|
|
19170
|
-
console.warn('[SearchItemTable] Table组件清理失败:', error);
|
|
19171
|
-
}
|
|
19170
|
+
} catch (error) {}
|
|
19172
19171
|
},
|
|
19173
19172
|
// 清理react-sortable-hoc相关内存
|
|
19174
19173
|
function () {
|
|
@@ -19176,9 +19175,7 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
|
|
|
19176
19175
|
if (_this2.sortableContext) {
|
|
19177
19176
|
_this2.sortableContext = null;
|
|
19178
19177
|
}
|
|
19179
|
-
} catch (error) {
|
|
19180
|
-
console.warn('[SearchItemTable] sortable-hoc清理失败:', error);
|
|
19181
|
-
}
|
|
19178
|
+
} catch (error) {}
|
|
19182
19179
|
},
|
|
19183
19180
|
// 清理localStorage监听器
|
|
19184
19181
|
function () {
|
|
@@ -19186,9 +19183,7 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
|
|
|
19186
19183
|
if (typeof window !== 'undefined' && window.removeEventListener) {
|
|
19187
19184
|
window.removeEventListener('storage', _this2.handleStorageChange);
|
|
19188
19185
|
}
|
|
19189
|
-
} catch (error) {
|
|
19190
|
-
console.warn('[SearchItemTable] localStorage监听器清理失败:', error);
|
|
19191
|
-
}
|
|
19186
|
+
} catch (error) {}
|
|
19192
19187
|
}];
|
|
19193
19188
|
// 执行清理任务,即使某个任务失败也继续执行其他任务
|
|
19194
19189
|
var successCount = 0;
|
|
@@ -19196,11 +19191,8 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
|
|
|
19196
19191
|
try {
|
|
19197
19192
|
task();
|
|
19198
19193
|
successCount++;
|
|
19199
|
-
} catch (error) {
|
|
19200
|
-
console.error("[SearchItemTable] \u6E05\u7406\u4EFB\u52A1".concat(index + 1, "\u6267\u884C\u5931\u8D25:"), error);
|
|
19201
|
-
}
|
|
19194
|
+
} catch (error) {}
|
|
19202
19195
|
});
|
|
19203
|
-
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"));
|
|
19204
19196
|
// 最终状态验证
|
|
19205
19197
|
var finalState = {
|
|
19206
19198
|
requestCancelled: !this.requestController,
|
|
@@ -19209,7 +19201,6 @@ var SearchItemTable = /*#__PURE__*/function (_React$Component) {
|
|
|
19209
19201
|
tableRefCleared: !this.tableRef,
|
|
19210
19202
|
sortableContextCleared: !this.sortableContext
|
|
19211
19203
|
};
|
|
19212
|
-
console.log('[SearchItemTable] 最终清理状态:', finalState);
|
|
19213
19204
|
}
|
|
19214
19205
|
}, {
|
|
19215
19206
|
key: "render",
|
|
@@ -19421,17 +19412,8 @@ var ResizeableTitle$2 = function ResizeableTitle(props) {
|
|
|
19421
19412
|
var currentStart = useRef(0);
|
|
19422
19413
|
var uuidref = useRef(uuid());
|
|
19423
19414
|
var prevWidthRef = useRef(width);
|
|
19424
|
-
|
|
19425
|
-
|
|
19426
|
-
markerPosition.current = {
|
|
19427
|
-
left: e.clientX,
|
|
19428
|
-
top: e.clientY
|
|
19429
|
-
};
|
|
19430
|
-
setIsResizing(true);
|
|
19431
|
-
document.addEventListener('mousemove', handleMouseMove);
|
|
19432
|
-
document.addEventListener('mouseup', _handleMouseUp);
|
|
19433
|
-
};
|
|
19434
|
-
var handleMouseMove = function handleMouseMove(e) {
|
|
19415
|
+
// 使用useCallback优化事件处理函数,避免重复创建
|
|
19416
|
+
var handleMouseMove = useCallback(function (e) {
|
|
19435
19417
|
e.stopPropagation();
|
|
19436
19418
|
e.preventDefault();
|
|
19437
19419
|
// 更新标记位置
|
|
@@ -19444,12 +19426,22 @@ var ResizeableTitle$2 = function ResizeableTitle(props) {
|
|
|
19444
19426
|
dom.style.left = "".concat(e.clientX, "px");
|
|
19445
19427
|
dom.style.top = "".concat(e.clientY - 20, "px");
|
|
19446
19428
|
}
|
|
19447
|
-
};
|
|
19448
|
-
var
|
|
19429
|
+
}, []);
|
|
19430
|
+
var handleMouseUp = useCallback(function (e) {
|
|
19449
19431
|
document.removeEventListener('mousemove', handleMouseMove);
|
|
19450
|
-
document.removeEventListener('mouseup',
|
|
19432
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
19451
19433
|
setIsResizing(false);
|
|
19452
|
-
};
|
|
19434
|
+
}, [handleMouseMove]);
|
|
19435
|
+
var handleMouseDown = useCallback(function (e) {
|
|
19436
|
+
currentStart.current = e.clientX;
|
|
19437
|
+
markerPosition.current = {
|
|
19438
|
+
left: e.clientX,
|
|
19439
|
+
top: e.clientY
|
|
19440
|
+
};
|
|
19441
|
+
setIsResizing(true);
|
|
19442
|
+
document.addEventListener('mousemove', handleMouseMove);
|
|
19443
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
19444
|
+
}, [handleMouseMove, handleMouseUp]);
|
|
19453
19445
|
var handleresize = function handleresize(e, data, title) {
|
|
19454
19446
|
var _data$size;
|
|
19455
19447
|
var newWidth = (data === null || data === void 0 ? void 0 : (_data$size = data.size) === null || _data$size === void 0 ? void 0 : _data$size.width) || 0;
|
|
@@ -19470,6 +19462,14 @@ var ResizeableTitle$2 = function ResizeableTitle(props) {
|
|
|
19470
19462
|
setInnerWidth(width);
|
|
19471
19463
|
}
|
|
19472
19464
|
}, [width]);
|
|
19465
|
+
// 组件卸载时清理事件监听器
|
|
19466
|
+
useEffect(function () {
|
|
19467
|
+
return function () {
|
|
19468
|
+
// 确保在组件卸载时移除可能残留的事件监听器
|
|
19469
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
19470
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
19471
|
+
};
|
|
19472
|
+
}, [handleMouseMove, handleMouseUp]);
|
|
19473
19473
|
return /*#__PURE__*/React$1.createElement(Resizable, {
|
|
19474
19474
|
width: innerWidth,
|
|
19475
19475
|
height: 0,
|
|
@@ -19523,11 +19523,8 @@ var BsSulaQueryTable = (function (props) {
|
|
|
19523
19523
|
// 定时器引用,用于清理
|
|
19524
19524
|
var debounceTimer = useRef(null);
|
|
19525
19525
|
var resizeTimer = useRef(null);
|
|
19526
|
-
//
|
|
19527
|
-
|
|
19528
|
-
var handleGlobalClick = useRef(null);
|
|
19529
|
-
var handleGlobalKeydown = useRef(null);
|
|
19530
|
-
var handleStorageChange = useRef(null);
|
|
19526
|
+
var tableHeightTimer = useRef(null); // 新增:管理getTableHeight的定时器
|
|
19527
|
+
// 移除未使用的事件处理函数引用,避免内存泄漏
|
|
19531
19528
|
// 获取 table columns中所有的 key 防止有的地方是 dataindex
|
|
19532
19529
|
var checkedList = useMemo(function () {
|
|
19533
19530
|
return props.columns.filter(function (col) {
|
|
@@ -19635,7 +19632,36 @@ var BsSulaQueryTable = (function (props) {
|
|
|
19635
19632
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
19636
19633
|
height = _useState18[0],
|
|
19637
19634
|
setHeight = _useState18[1];
|
|
19635
|
+
// 使用ref避免setHeight的闭包引用
|
|
19636
|
+
var heightRef = useRef(height);
|
|
19637
|
+
// 同步height状态到ref
|
|
19638
|
+
useEffect(function () {
|
|
19639
|
+
heightRef.current = height;
|
|
19640
|
+
}, [height]);
|
|
19638
19641
|
var bsTableCodeExport = "".concat(bsTableCode, "___Export"); //设置导出列字段的唯一标识
|
|
19642
|
+
// 获取table高度
|
|
19643
|
+
var getTableHeight = useCallback(function () {
|
|
19644
|
+
// 清理之前的定时器
|
|
19645
|
+
if (tableHeightTimer.current) {
|
|
19646
|
+
clearTimeout(tableHeightTimer.current);
|
|
19647
|
+
tableHeightTimer.current = null;
|
|
19648
|
+
}
|
|
19649
|
+
tableHeightTimer.current = setTimeout(function () {
|
|
19650
|
+
try {
|
|
19651
|
+
var _window$top, _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;
|
|
19652
|
+
var cancelHeight = window.top == window ? 303 : 223;
|
|
19653
|
+
var _isFullScreen = window.top.document.fullScreen || window.top.document.webkitIsFullScreen || window.top.document.mozFullScreen;
|
|
19654
|
+
// wujie子应用iframe首次加载获取不到client以及dom元素高度兼容处理
|
|
19655
|
+
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;
|
|
19656
|
+
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;
|
|
19657
|
+
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;
|
|
19658
|
+
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';
|
|
19659
|
+
setHeight(h);
|
|
19660
|
+
} catch (error) {} finally {
|
|
19661
|
+
tableHeightTimer.current = null;
|
|
19662
|
+
}
|
|
19663
|
+
}, 0);
|
|
19664
|
+
}, []);
|
|
19639
19665
|
//监测是否按下esc键
|
|
19640
19666
|
function checkFull() {
|
|
19641
19667
|
var _window, _window$parent;
|
|
@@ -19752,20 +19778,12 @@ var BsSulaQueryTable = (function (props) {
|
|
|
19752
19778
|
clearTimeout(resizeTimer.current);
|
|
19753
19779
|
resizeTimer.current = null;
|
|
19754
19780
|
}
|
|
19781
|
+
if (tableHeightTimer.current) {
|
|
19782
|
+
clearTimeout(tableHeightTimer.current);
|
|
19783
|
+
tableHeightTimer.current = null;
|
|
19784
|
+
}
|
|
19755
19785
|
// 清理所有事件监听器
|
|
19756
19786
|
window.removeEventListener('resize', handleWindowResize);
|
|
19757
|
-
if (handleBeforeUnload.current) {
|
|
19758
|
-
window.removeEventListener('beforeunload', handleBeforeUnload.current);
|
|
19759
|
-
}
|
|
19760
|
-
if (handleGlobalClick.current) {
|
|
19761
|
-
document.removeEventListener('click', handleGlobalClick.current);
|
|
19762
|
-
}
|
|
19763
|
-
if (handleGlobalKeydown.current) {
|
|
19764
|
-
document.removeEventListener('keydown', handleGlobalKeydown.current);
|
|
19765
|
-
}
|
|
19766
|
-
if (handleStorageChange.current) {
|
|
19767
|
-
window.removeEventListener('storage', handleStorageChange.current);
|
|
19768
|
-
}
|
|
19769
19787
|
var cleanupTimeout = 5000; // 5秒超时保护
|
|
19770
19788
|
// 创建清理任务队列,按优先级顺序执行
|
|
19771
19789
|
var cleanupTasks = [
|
|
@@ -19784,7 +19802,6 @@ var BsSulaQueryTable = (function (props) {
|
|
|
19784
19802
|
}
|
|
19785
19803
|
resolve();
|
|
19786
19804
|
} catch (error) {
|
|
19787
|
-
console.warn('[BsSulaQueryTable] 第一阶段清理错误:', error);
|
|
19788
19805
|
resolve(); // 即使出错也继续
|
|
19789
19806
|
}
|
|
19790
19807
|
});
|
|
@@ -19818,9 +19835,7 @@ var BsSulaQueryTable = (function (props) {
|
|
|
19818
19835
|
}
|
|
19819
19836
|
// 禁用setState防止内存泄漏
|
|
19820
19837
|
if (ref.current.setState) {
|
|
19821
|
-
ref.current.setState = function () {
|
|
19822
|
-
console.warn("[".concat(name, "] \u7EC4\u4EF6\u5DF2\u5378\u8F7D\uFF0C\u5FFD\u7565setState\u8C03\u7528"));
|
|
19823
|
-
};
|
|
19838
|
+
ref.current.setState = function () {};
|
|
19824
19839
|
}
|
|
19825
19840
|
// 清理DOM事件监听器
|
|
19826
19841
|
if (ref.current.removeEventListener) {
|
|
@@ -19828,16 +19843,14 @@ var BsSulaQueryTable = (function (props) {
|
|
|
19828
19843
|
ref.current.removeEventListener('click', null);
|
|
19829
19844
|
ref.current.removeEventListener('resize', null);
|
|
19830
19845
|
}
|
|
19831
|
-
console.log("[BsSulaQueryTable] ".concat(name, " \u7EC4\u4EF6\u5DF2\u5B89\u5168\u5378\u8F7D"));
|
|
19832
19846
|
}
|
|
19833
|
-
} catch (componentError) {
|
|
19834
|
-
console.warn("[BsSulaQueryTable] ".concat(name, " \u5378\u8F7D\u5931\u8D25:"), componentError);
|
|
19835
|
-
// 继续处理其他组件
|
|
19836
|
-
}
|
|
19847
|
+
} catch (componentError) {}
|
|
19837
19848
|
});
|
|
19849
|
+
// 清理临时数组和WeakSet
|
|
19850
|
+
tempInstancesRef.current = [];
|
|
19851
|
+
summaryInstancesRef.current = new WeakSet();
|
|
19838
19852
|
resolve();
|
|
19839
19853
|
} catch (error) {
|
|
19840
|
-
console.warn('[BsSulaQueryTable] 第二阶段清理错误:', error);
|
|
19841
19854
|
resolve();
|
|
19842
19855
|
}
|
|
19843
19856
|
});
|
|
@@ -19848,21 +19861,9 @@ var BsSulaQueryTable = (function (props) {
|
|
|
19848
19861
|
try {
|
|
19849
19862
|
// 清理全局事件监听器
|
|
19850
19863
|
window.removeEventListener('resize', handleWindowResize);
|
|
19851
|
-
|
|
19852
|
-
window.removeEventListener('beforeunload', handleBeforeUnload.current);
|
|
19853
|
-
}
|
|
19854
|
-
if (handleGlobalClick.current) {
|
|
19855
|
-
document.removeEventListener('click', handleGlobalClick.current);
|
|
19856
|
-
}
|
|
19857
|
-
if (handleGlobalKeydown.current) {
|
|
19858
|
-
document.removeEventListener('keydown', handleGlobalKeydown.current);
|
|
19859
|
-
}
|
|
19860
|
-
if (handleStorageChange.current) {
|
|
19861
|
-
window.removeEventListener('storage', handleStorageChange.current);
|
|
19862
|
-
}
|
|
19864
|
+
// 全局事件监听器已在上层清理
|
|
19863
19865
|
resolve();
|
|
19864
19866
|
} catch (error) {
|
|
19865
|
-
console.warn('[BsSulaQueryTable] 第三阶段清理错误:', error);
|
|
19866
19867
|
resolve();
|
|
19867
19868
|
}
|
|
19868
19869
|
});
|
|
@@ -19894,8 +19895,6 @@ var BsSulaQueryTable = (function (props) {
|
|
|
19894
19895
|
case 4:
|
|
19895
19896
|
_context.p = 4;
|
|
19896
19897
|
_t = _context.v;
|
|
19897
|
-
console.warn('[BsSulaQueryTable] 清理任务执行失败:', _t);
|
|
19898
|
-
// 继续执行下一个任务
|
|
19899
19898
|
case 5:
|
|
19900
19899
|
_i++;
|
|
19901
19900
|
_context.n = 1;
|
|
@@ -19910,9 +19909,132 @@ var BsSulaQueryTable = (function (props) {
|
|
|
19910
19909
|
};
|
|
19911
19910
|
}();
|
|
19912
19911
|
// 异步执行清理任务
|
|
19913
|
-
executeCleanupTasks().catch(function (error) {
|
|
19914
|
-
|
|
19915
|
-
|
|
19912
|
+
executeCleanupTasks().catch(function (error) {});
|
|
19913
|
+
// 设置卸载标志,防止后续创建新的Summary组件
|
|
19914
|
+
isUnmountedRef.current = true;
|
|
19915
|
+
// 清理Summary相关的DOM节点和React Fiber引用
|
|
19916
|
+
try {
|
|
19917
|
+
// 清理Summary组件实例
|
|
19918
|
+
if (tempInstancesRef.current && tempInstancesRef.current.length > 0) {
|
|
19919
|
+
tempInstancesRef.current.forEach(function (instance) {
|
|
19920
|
+
try {
|
|
19921
|
+
// 首先调用实例的自定义清理方法
|
|
19922
|
+
if (typeof instance._bsQueryTableCleanup === 'function') {
|
|
19923
|
+
instance._bsQueryTableCleanup();
|
|
19924
|
+
}
|
|
19925
|
+
// 清理React Fiber节点引用
|
|
19926
|
+
if (instance._reactInternalFiber) {
|
|
19927
|
+
// 断开stateNode引用链
|
|
19928
|
+
if (instance._reactInternalFiber.stateNode) {
|
|
19929
|
+
instance._reactInternalFiber.stateNode = null;
|
|
19930
|
+
}
|
|
19931
|
+
// 断开child引用链
|
|
19932
|
+
if (instance._reactInternalFiber.child) {
|
|
19933
|
+
instance._reactInternalFiber.child = null;
|
|
19934
|
+
}
|
|
19935
|
+
// 断开memoizedProps引用链
|
|
19936
|
+
if (instance._reactInternalFiber.memoizedProps) {
|
|
19937
|
+
instance._reactInternalFiber.memoizedProps = null;
|
|
19938
|
+
}
|
|
19939
|
+
// 清理updateQueue
|
|
19940
|
+
if (instance._reactInternalFiber.updateQueue) {
|
|
19941
|
+
instance._reactInternalFiber.updateQueue = null;
|
|
19942
|
+
}
|
|
19943
|
+
// 清理lastEffect
|
|
19944
|
+
if (instance._reactInternalFiber.lastEffect) {
|
|
19945
|
+
instance._reactInternalFiber.lastEffect = null;
|
|
19946
|
+
}
|
|
19947
|
+
}
|
|
19948
|
+
// 清理React 18+ Fiber节点引用
|
|
19949
|
+
if (instance._reactInternals) {
|
|
19950
|
+
if (instance._reactInternals.stateNode) {
|
|
19951
|
+
instance._reactInternals.stateNode = null;
|
|
19952
|
+
}
|
|
19953
|
+
if (instance._reactInternals.child) {
|
|
19954
|
+
instance._reactInternals.child = null;
|
|
19955
|
+
}
|
|
19956
|
+
if (instance._reactInternals.memoizedProps) {
|
|
19957
|
+
instance._reactInternals.memoizedProps = null;
|
|
19958
|
+
}
|
|
19959
|
+
if (instance._reactInternals.updateQueue) {
|
|
19960
|
+
instance._reactInternals.updateQueue = null;
|
|
19961
|
+
}
|
|
19962
|
+
}
|
|
19963
|
+
// 清理React实例的内部引用
|
|
19964
|
+
if (instance && _typeof(instance) === 'object') {
|
|
19965
|
+
// 清理可能的DOM引用
|
|
19966
|
+
if (instance.current && _typeof(instance.current) === 'object') {
|
|
19967
|
+
var domNode = instance.current;
|
|
19968
|
+
// 清理DOM节点上的React Fiber引用
|
|
19969
|
+
var reactKeys = Object.keys(domNode).filter(function (key) {
|
|
19970
|
+
return key.startsWith('__reactFiber') || key.startsWith('__reactInternalInstance') || key.startsWith('__reactEventHandlers');
|
|
19971
|
+
});
|
|
19972
|
+
reactKeys.forEach(function (key) {
|
|
19973
|
+
try {
|
|
19974
|
+
delete domNode[key];
|
|
19975
|
+
} catch (e) {}
|
|
19976
|
+
});
|
|
19977
|
+
}
|
|
19978
|
+
}
|
|
19979
|
+
} catch (error) {}
|
|
19980
|
+
});
|
|
19981
|
+
}
|
|
19982
|
+
// DOM节点引用已简化,无需额外清理
|
|
19983
|
+
// 清理context相关的闭包引用
|
|
19984
|
+
try {
|
|
19985
|
+
// 清理getTableSummaryInfo函数中可能的context引用
|
|
19986
|
+
if (typeof getTableSummaryInfo === 'function') {
|
|
19987
|
+
// 尝试清理函数闭包中的context引用
|
|
19988
|
+
Object.defineProperty(getTableSummaryInfo, 'context', {
|
|
19989
|
+
value: null,
|
|
19990
|
+
writable: true,
|
|
19991
|
+
configurable: true
|
|
19992
|
+
});
|
|
19993
|
+
}
|
|
19994
|
+
// 清理可能的全局context引用
|
|
19995
|
+
if (typeof window !== 'undefined') {
|
|
19996
|
+
// 清理可能存在的全局context缓存
|
|
19997
|
+
var contextKeys = Object.keys(window).filter(function (key) {
|
|
19998
|
+
return key.includes('context') || key.includes('Context') || key.includes('restProps') || key.includes('setPagePath');
|
|
19999
|
+
});
|
|
20000
|
+
contextKeys.forEach(function (key) {
|
|
20001
|
+
try {
|
|
20002
|
+
if (window[key] && _typeof(window[key]) === 'object') {
|
|
20003
|
+
// 清理context对象的引用
|
|
20004
|
+
Object.keys(window[key]).forEach(function (contextKey) {
|
|
20005
|
+
if (window[key][contextKey] && _typeof(window[key][contextKey]) === 'object') {
|
|
20006
|
+
window[key][contextKey] = null;
|
|
20007
|
+
}
|
|
20008
|
+
});
|
|
20009
|
+
}
|
|
20010
|
+
} catch (e) {}
|
|
20011
|
+
});
|
|
20012
|
+
}
|
|
20013
|
+
// 清理组件内部可能的context引用
|
|
20014
|
+
if (config && _typeof(config) === 'object') {
|
|
20015
|
+
// 清理config中可能的context引用
|
|
20016
|
+
Object.keys(config).forEach(function (key) {
|
|
20017
|
+
if (config[key] && _typeof(config[key]) === 'object' && config[key].context) {
|
|
20018
|
+
config[key].context = null;
|
|
20019
|
+
}
|
|
20020
|
+
});
|
|
20021
|
+
}
|
|
20022
|
+
} catch (contextError) {}
|
|
20023
|
+
} catch (error) {}
|
|
20024
|
+
// 清理memoConfig引用,断开与外部库的连接
|
|
20025
|
+
if (memoConfigRef.current) {
|
|
20026
|
+
// 将summaryList设置为null,通知外部库释放引用
|
|
20027
|
+
if (memoConfigRef.current.summaryList) {
|
|
20028
|
+
memoConfigRef.current.summaryList = null;
|
|
20029
|
+
}
|
|
20030
|
+
// 清理其他可能的函数引用
|
|
20031
|
+
Object.keys(memoConfigRef.current).forEach(function (key) {
|
|
20032
|
+
if (typeof memoConfigRef.current[key] === 'function') {
|
|
20033
|
+
memoConfigRef.current[key] = null;
|
|
20034
|
+
}
|
|
20035
|
+
});
|
|
20036
|
+
memoConfigRef.current = null;
|
|
20037
|
+
}
|
|
19916
20038
|
// 清理所有ref引用
|
|
19917
20039
|
if (rowsRef.current) {
|
|
19918
20040
|
rowsRef.current = null;
|
|
@@ -19929,12 +20051,35 @@ var BsSulaQueryTable = (function (props) {
|
|
|
19929
20051
|
if (exportTableRef.current) {
|
|
19930
20052
|
exportTableRef.current = null;
|
|
19931
20053
|
}
|
|
20054
|
+
// 强制断开与外部库的引用关系
|
|
20055
|
+
try {
|
|
20056
|
+
// 清理全局事件监听器
|
|
20057
|
+
if (typeof window !== 'undefined') {
|
|
20058
|
+
window.removeEventListener('resize', watchWinResize);
|
|
20059
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
20060
|
+
}
|
|
20061
|
+
// 清理可能的全局变量引用
|
|
20062
|
+
if (typeof window !== 'undefined' && window.__bsSulaQueryTableInstances) {
|
|
20063
|
+
var instances = window.__bsSulaQueryTableInstances;
|
|
20064
|
+
var instanceIndex = instances.findIndex(function (instance) {
|
|
20065
|
+
return instance.id === componentId;
|
|
20066
|
+
});
|
|
20067
|
+
if (instanceIndex > -1) {
|
|
20068
|
+
instances.splice(instanceIndex, 1);
|
|
20069
|
+
}
|
|
20070
|
+
}
|
|
20071
|
+
// 强制垃圾回收提示(仅开发环境)
|
|
20072
|
+
if (process.env.NODE_ENV === 'development' && typeof window !== 'undefined' && window.gc) {
|
|
20073
|
+
setTimeout(function () {
|
|
20074
|
+
try {
|
|
20075
|
+
window.gc();
|
|
20076
|
+
} catch (e) {
|
|
20077
|
+
// 忽略垃圾回收错误
|
|
20078
|
+
}
|
|
20079
|
+
}, 100);
|
|
20080
|
+
}
|
|
20081
|
+
} catch (error) {}
|
|
19932
20082
|
// 最终状态验证
|
|
19933
|
-
console.log('[BsSulaQueryTable] 组件卸载流程完成,清理状态:', {
|
|
19934
|
-
refsCleared: !rowsRef.current && !sortTableRef.current && !searchTableRef.current,
|
|
19935
|
-
timersCleared: !debounceTimer.current && !resizeTimer.current
|
|
19936
|
-
});
|
|
19937
|
-
console.log('[BsSulaQueryTable] 主组件及所有子组件已完全卸载,内存已清理');
|
|
19938
20083
|
};
|
|
19939
20084
|
}, []);
|
|
19940
20085
|
useEffect(function () {
|
|
@@ -19966,22 +20111,30 @@ var BsSulaQueryTable = (function (props) {
|
|
|
19966
20111
|
// 清理之前的定时器
|
|
19967
20112
|
if (debounceTimer.current) {
|
|
19968
20113
|
clearTimeout(debounceTimer.current);
|
|
20114
|
+
debounceTimer.current = null;
|
|
19969
20115
|
}
|
|
19970
20116
|
// 设置新的定时器
|
|
19971
20117
|
debounceTimer.current = setTimeout(function () {
|
|
19972
|
-
|
|
19973
|
-
|
|
19974
|
-
|
|
19975
|
-
|
|
19976
|
-
|
|
19977
|
-
|
|
19978
|
-
|
|
19979
|
-
|
|
19980
|
-
|
|
19981
|
-
|
|
20118
|
+
try {
|
|
20119
|
+
// 检查组件是否已卸载
|
|
20120
|
+
if (isUnmountedRef.current) {
|
|
20121
|
+
return;
|
|
20122
|
+
}
|
|
20123
|
+
// getTableHeight();
|
|
20124
|
+
if (!checkFull()) {
|
|
20125
|
+
// addTabsNavStyle(true);
|
|
20126
|
+
// 全屏下按键esc后要执行的动作
|
|
20127
|
+
// isFullScreen 为true 此时为全屏状态 false 为非全屏状态
|
|
20128
|
+
if (!isFullScreen) {
|
|
20129
|
+
// 按下esc键退出全屏
|
|
20130
|
+
setIsFnllScreen(false);
|
|
20131
|
+
} else {
|
|
20132
|
+
setIsFnllScreen(false);
|
|
20133
|
+
}
|
|
19982
20134
|
}
|
|
20135
|
+
} catch (error) {} finally {
|
|
20136
|
+
debounceTimer.current = null;
|
|
19983
20137
|
}
|
|
19984
|
-
debounceTimer.current = null;
|
|
19985
20138
|
}, 10);
|
|
19986
20139
|
}, [isFullScreen]);
|
|
19987
20140
|
var setCommonRenderFn = function setCommonRenderFn(columns) {
|
|
@@ -19996,8 +20149,8 @@ var BsSulaQueryTable = (function (props) {
|
|
|
19996
20149
|
}
|
|
19997
20150
|
});
|
|
19998
20151
|
};
|
|
19999
|
-
// 处理 table 基本参数
|
|
20000
|
-
var setTableProps = function
|
|
20152
|
+
// 处理 table 基本参数 - 使用useCallback避免闭包引用
|
|
20153
|
+
var setTableProps = useCallback(function () {
|
|
20001
20154
|
var _value$tableProps3, _value$tableProps4, _value$tableProps4$in, _tableProps$initialPa;
|
|
20002
20155
|
var defaultPageSize = 20;
|
|
20003
20156
|
var baseTableProps = {
|
|
@@ -20008,7 +20161,7 @@ var BsSulaQueryTable = (function (props) {
|
|
|
20008
20161
|
expandable: props.expandable,
|
|
20009
20162
|
scroll: {
|
|
20010
20163
|
x: props.overScrollX || 'max-content',
|
|
20011
|
-
y: (props === null || props === void 0 ? void 0 : props.overScrollY) ||
|
|
20164
|
+
y: (props === null || props === void 0 ? void 0 : props.overScrollY) || heightRef.current
|
|
20012
20165
|
},
|
|
20013
20166
|
bordered: typeof value.bordered === 'boolean' ? value.bordered : true,
|
|
20014
20167
|
sticky: typeof value.sticky === 'boolean' ? value.sticky : true,
|
|
@@ -20039,7 +20192,7 @@ var BsSulaQueryTable = (function (props) {
|
|
|
20039
20192
|
showQuickJumper: true,
|
|
20040
20193
|
hideOnSinglePage: value.hideOnSinglePage || false
|
|
20041
20194
|
}, (_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);
|
|
20042
|
-
var handleRowClick = function
|
|
20195
|
+
var handleRowClick = useCallback(function (record) {
|
|
20043
20196
|
var _rowsRef$current, _rowsRef$current2;
|
|
20044
20197
|
var rowKey = value.rowKey;
|
|
20045
20198
|
var newSelectedRowKeys = _toConsumableArray((rowsRef === null || rowsRef === void 0 ? void 0 : (_rowsRef$current = rowsRef.current) === null || _rowsRef$current === void 0 ? void 0 : _rowsRef$current.selectedRowKeys) || []);
|
|
@@ -20064,16 +20217,15 @@ var BsSulaQueryTable = (function (props) {
|
|
|
20064
20217
|
// 直接将 record 作为数组元素传递
|
|
20065
20218
|
rowSelection.onChange(newSelectedRowKeys, newSelectedRows);
|
|
20066
20219
|
}
|
|
20067
|
-
};
|
|
20068
|
-
var handleRowDoubleClick = function
|
|
20069
|
-
console.log('handleRowDoubleClick', record);
|
|
20220
|
+
}, [value.rowKey, value.rowSelection]);
|
|
20221
|
+
var handleRowDoubleClick = useCallback(function (record) {
|
|
20070
20222
|
if (props.viewPagePath) {
|
|
20071
20223
|
var path = eval("`".concat(props.viewPagePath.replace(/'/g, '`').replace(/#{(.*?)}/g, function (match, p) {
|
|
20072
20224
|
return "${".concat(p, "}");
|
|
20073
20225
|
}), "`"));
|
|
20074
20226
|
history.push(path);
|
|
20075
20227
|
}
|
|
20076
|
-
};
|
|
20228
|
+
}, [props.viewPagePath, history]);
|
|
20077
20229
|
var tableProps = _objectSpread2(_objectSpread2({}, baseTableProps), {}, {
|
|
20078
20230
|
initialPaging: {
|
|
20079
20231
|
pagination: paginationConfig
|
|
@@ -20095,7 +20247,7 @@ var BsSulaQueryTable = (function (props) {
|
|
|
20095
20247
|
tableProps.initialPaging.pagination.showSizeChanger = true;
|
|
20096
20248
|
}
|
|
20097
20249
|
return tableProps;
|
|
20098
|
-
};
|
|
20250
|
+
}, [value, props, rowsRef, history]); // 不包含height依赖,使用heightRef.current
|
|
20099
20251
|
var handleTimeValue = function handleTimeValue() {
|
|
20100
20252
|
var _value$actionsRender, _value$exportConfig;
|
|
20101
20253
|
var actionsRender = ((_value$actionsRender = value.actionsRender) !== null && _value$actionsRender !== void 0 ? _value$actionsRender : []).map(function (x) {
|
|
@@ -20294,12 +20446,78 @@ var BsSulaQueryTable = (function (props) {
|
|
|
20294
20446
|
(_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();
|
|
20295
20447
|
}
|
|
20296
20448
|
}
|
|
20297
|
-
setTimeout(function () {
|
|
20298
|
-
|
|
20299
|
-
|
|
20449
|
+
var timeoutId = setTimeout(function () {
|
|
20450
|
+
try {
|
|
20451
|
+
// 检查组件是否已卸载
|
|
20452
|
+
if (isUnmountedRef.current) {
|
|
20453
|
+
return;
|
|
20454
|
+
}
|
|
20455
|
+
// 处理页面刷新两面
|
|
20456
|
+
localStorage.removeItem('isTabChange');
|
|
20457
|
+
} catch (error) {}
|
|
20300
20458
|
}, 0);
|
|
20459
|
+
return function () {
|
|
20460
|
+
clearTimeout(timeoutId);
|
|
20461
|
+
};
|
|
20301
20462
|
}, [pathname]);
|
|
20463
|
+
// 增强的外部库引用管理
|
|
20464
|
+
useEffect(function () {
|
|
20465
|
+
// 生成唯一组件ID
|
|
20466
|
+
var componentId = "bsSulaQueryTable_".concat(Date.now(), "_").concat(Math.random().toString(36).substr(2, 9));
|
|
20467
|
+
// 注册到全局实例管理器(如果存在)
|
|
20468
|
+
if (typeof window !== 'undefined') {
|
|
20469
|
+
if (!window.__bsSulaQueryTableInstances) {
|
|
20470
|
+
window.__bsSulaQueryTableInstances = [];
|
|
20471
|
+
}
|
|
20472
|
+
window.__bsSulaQueryTableInstances.push({
|
|
20473
|
+
id: componentId,
|
|
20474
|
+
cleanup: function cleanup() {
|
|
20475
|
+
// 提供给外部库的清理接口
|
|
20476
|
+
isUnmountedRef.current = true;
|
|
20477
|
+
if (memoConfigRef.current) {
|
|
20478
|
+
memoConfigRef.current.summaryList = null;
|
|
20479
|
+
}
|
|
20480
|
+
}
|
|
20481
|
+
});
|
|
20482
|
+
}
|
|
20483
|
+
return function () {
|
|
20484
|
+
// 从全局实例管理器中移除
|
|
20485
|
+
if (typeof window !== 'undefined' && window.__bsSulaQueryTableInstances) {
|
|
20486
|
+
var instances = window.__bsSulaQueryTableInstances;
|
|
20487
|
+
var instanceIndex = instances.findIndex(function (instance) {
|
|
20488
|
+
return instance.id === componentId;
|
|
20489
|
+
});
|
|
20490
|
+
if (instanceIndex > -1) {
|
|
20491
|
+
instances.splice(instanceIndex, 1);
|
|
20492
|
+
}
|
|
20493
|
+
}
|
|
20494
|
+
};
|
|
20495
|
+
}, []);
|
|
20302
20496
|
var expandedRowKeys = props === null || props === void 0 ? void 0 : (_props$expandable = props.expandable) === null || _props$expandable === void 0 ? void 0 : _props$expandable.expandedRowKeys;
|
|
20497
|
+
// 组件卸载状态跟踪
|
|
20498
|
+
var isUnmountedRef = useRef(false);
|
|
20499
|
+
// 使用WeakSet减少强引用,避免内存泄漏
|
|
20500
|
+
var summaryInstancesRef = useRef(new WeakSet());
|
|
20501
|
+
// 临时存储强引用用于清理,清理完成后立即清空
|
|
20502
|
+
var tempInstancesRef = useRef([]);
|
|
20503
|
+
// 存储memoConfig引用,用于卸载时清理
|
|
20504
|
+
var memoConfigRef = useRef(null);
|
|
20505
|
+
// 使用ref存储状态,避免getTableSummaryInfo函数的闭包依赖
|
|
20506
|
+
var stateRef = useRef({
|
|
20507
|
+
summaryList: props.summaryList,
|
|
20508
|
+
rowSelection: props.rowSelection,
|
|
20509
|
+
expandable: props.expandable,
|
|
20510
|
+
showColumn: showColumn
|
|
20511
|
+
});
|
|
20512
|
+
// 更新stateRef
|
|
20513
|
+
useEffect(function () {
|
|
20514
|
+
stateRef.current = {
|
|
20515
|
+
summaryList: props.summaryList,
|
|
20516
|
+
rowSelection: props.rowSelection,
|
|
20517
|
+
expandable: props.expandable,
|
|
20518
|
+
showColumn: showColumn
|
|
20519
|
+
};
|
|
20520
|
+
}, [props.summaryList, props.rowSelection, props.expandable, showColumn]);
|
|
20303
20521
|
//todo summary属性已经被使用,为了兼容之前的,现在使用 summaryList
|
|
20304
20522
|
//结构为了实现多行总结栏 定义如下(lableShow: boolean 是否显示列文本)
|
|
20305
20523
|
/**
|
|
@@ -20311,49 +20529,151 @@ var BsSulaQueryTable = (function (props) {
|
|
|
20311
20529
|
* @returns []
|
|
20312
20530
|
*/
|
|
20313
20531
|
var getTableSummaryInfo = useCallback(function () {
|
|
20314
|
-
|
|
20315
|
-
|
|
20316
|
-
|
|
20532
|
+
// 检查组件是否已卸载,避免创建新的JSX元素
|
|
20533
|
+
if (isUnmountedRef.current) {
|
|
20534
|
+
return undefined;
|
|
20535
|
+
}
|
|
20536
|
+
// 使用ref访问状态,避免闭包依赖
|
|
20537
|
+
var _stateRef$current = stateRef.current,
|
|
20538
|
+
summaryList = _stateRef$current.summaryList,
|
|
20539
|
+
rowSelection = _stateRef$current.rowSelection,
|
|
20540
|
+
expandable = _stateRef$current.expandable,
|
|
20541
|
+
showColumn = _stateRef$current.showColumn;
|
|
20317
20542
|
if (summaryList && Array.isArray(summaryList)) {
|
|
20318
20543
|
var summaryRow = rowSelection ? [{}].concat(_toConsumableArray(showColumn)) : _toConsumableArray(showColumn);
|
|
20319
20544
|
if (expandable) {
|
|
20320
20545
|
summaryRow.unshift({});
|
|
20321
20546
|
}
|
|
20322
20547
|
// let summaryInitial = summary().cont;
|
|
20323
|
-
|
|
20324
|
-
|
|
20548
|
+
// 创建Summary组件并跟踪实例,添加强化的清理逻辑
|
|
20549
|
+
var summaryElement = /*#__PURE__*/React$1.createElement(Table.Summary, {
|
|
20550
|
+
fixed: true,
|
|
20551
|
+
ref: function ref(_ref5) {
|
|
20552
|
+
if (_ref5 && !isUnmountedRef.current) {
|
|
20553
|
+
summaryInstancesRef.current.add(_ref5);
|
|
20554
|
+
tempInstancesRef.current.push(_ref5);
|
|
20555
|
+
// 为每个Summary实例添加清理标记
|
|
20556
|
+
if (_ref5 && _typeof(_ref5) === 'object') {
|
|
20557
|
+
_ref5._bsQueryTableCleanup = function () {
|
|
20558
|
+
try {
|
|
20559
|
+
// 清理可能的context引用
|
|
20560
|
+
if (_ref5.context) {
|
|
20561
|
+
_ref5.context = null;
|
|
20562
|
+
}
|
|
20563
|
+
// 清理可能的props引用
|
|
20564
|
+
if (_ref5.props) {
|
|
20565
|
+
Object.keys(_ref5.props).forEach(function (key) {
|
|
20566
|
+
if (typeof _ref5.props[key] === 'function') {
|
|
20567
|
+
_ref5.props[key] = null;
|
|
20568
|
+
}
|
|
20569
|
+
});
|
|
20570
|
+
}
|
|
20571
|
+
// 清理可能的state引用
|
|
20572
|
+
if (_ref5.state) {
|
|
20573
|
+
_ref5.state = null;
|
|
20574
|
+
}
|
|
20575
|
+
} catch (error) {}
|
|
20576
|
+
};
|
|
20577
|
+
}
|
|
20578
|
+
} else if (_ref5 && isUnmountedRef.current) {
|
|
20579
|
+
// 如果组件已卸载但仍有ref回调,立即清理
|
|
20580
|
+
|
|
20581
|
+
if (typeof _ref5._bsQueryTableCleanup === 'function') {
|
|
20582
|
+
_ref5._bsQueryTableCleanup();
|
|
20583
|
+
}
|
|
20584
|
+
}
|
|
20585
|
+
}
|
|
20325
20586
|
}, Array.isArray(summaryList) && summaryList.map(function (summaryItem, summaryIndex) {
|
|
20587
|
+
// 再次检查卸载状态
|
|
20588
|
+
if (isUnmountedRef.current) return null;
|
|
20326
20589
|
return /*#__PURE__*/React$1.createElement(Table.Summary.Row, {
|
|
20327
|
-
key: summaryIndex
|
|
20590
|
+
key: summaryIndex,
|
|
20591
|
+
ref: function ref(_ref6) {
|
|
20592
|
+
if (_ref6 && !isUnmountedRef.current) {
|
|
20593
|
+
summaryInstancesRef.current.add(_ref6);
|
|
20594
|
+
tempInstancesRef.current.push(_ref6);
|
|
20595
|
+
// 为Summary.Row添加清理标记
|
|
20596
|
+
if (_ref6 && _typeof(_ref6) === 'object') {
|
|
20597
|
+
_ref6._bsQueryTableCleanup = function () {
|
|
20598
|
+
try {
|
|
20599
|
+
if (_ref6.context) _ref6.context = null;
|
|
20600
|
+
if (_ref6.props) {
|
|
20601
|
+
Object.keys(_ref6.props).forEach(function (key) {
|
|
20602
|
+
if (typeof _ref6.props[key] === 'function') {
|
|
20603
|
+
_ref6.props[key] = null;
|
|
20604
|
+
}
|
|
20605
|
+
});
|
|
20606
|
+
}
|
|
20607
|
+
if (_ref6.state) _ref6.state = null;
|
|
20608
|
+
} catch (error) {}
|
|
20609
|
+
};
|
|
20610
|
+
}
|
|
20611
|
+
} else if (_ref6 && isUnmountedRef.current) {
|
|
20612
|
+
if (typeof _ref6._bsQueryTableCleanup === 'function') {
|
|
20613
|
+
_ref6._bsQueryTableCleanup();
|
|
20614
|
+
}
|
|
20615
|
+
}
|
|
20616
|
+
}
|
|
20328
20617
|
}, summaryRow.map(function (item, index) {
|
|
20618
|
+
// 检查卸载状态
|
|
20619
|
+
if (isUnmountedRef.current) return null;
|
|
20329
20620
|
var _summaryItem$cout = summaryItem.cout,
|
|
20330
20621
|
cout = _summaryItem$cout === void 0 ? [] : _summaryItem$cout;
|
|
20331
20622
|
var target = cout.filter(function (inner) {
|
|
20332
20623
|
return inner.key && (inner.key === item.dataIndex || inner.key === item.key);
|
|
20333
20624
|
})[0];
|
|
20625
|
+
var cellRef = function cellRef(ref) {
|
|
20626
|
+
if (ref && !isUnmountedRef.current) {
|
|
20627
|
+
summaryInstancesRef.current.add(ref);
|
|
20628
|
+
tempInstancesRef.current.push(ref);
|
|
20629
|
+
// 为Summary.Cell添加清理标记
|
|
20630
|
+
if (ref && _typeof(ref) === 'object') {
|
|
20631
|
+
ref._bsQueryTableCleanup = function () {
|
|
20632
|
+
try {
|
|
20633
|
+
if (ref.context) ref.context = null;
|
|
20634
|
+
if (ref.props) {
|
|
20635
|
+
Object.keys(ref.props).forEach(function (key) {
|
|
20636
|
+
if (typeof ref.props[key] === 'function') {
|
|
20637
|
+
ref.props[key] = null;
|
|
20638
|
+
}
|
|
20639
|
+
});
|
|
20640
|
+
}
|
|
20641
|
+
if (ref.state) ref.state = null;
|
|
20642
|
+
} catch (error) {}
|
|
20643
|
+
};
|
|
20644
|
+
}
|
|
20645
|
+
} else if (ref && isUnmountedRef.current) {
|
|
20646
|
+
if (typeof ref._bsQueryTableCleanup === 'function') {
|
|
20647
|
+
ref._bsQueryTableCleanup();
|
|
20648
|
+
}
|
|
20649
|
+
}
|
|
20650
|
+
};
|
|
20334
20651
|
if (target) {
|
|
20335
20652
|
var _target$value;
|
|
20336
20653
|
var labelText = target.labelShow ? "".concat(item.title, ":") : "";
|
|
20337
20654
|
return /*#__PURE__*/React$1.createElement(Table.Summary.Cell, {
|
|
20338
20655
|
index: index,
|
|
20339
|
-
key: "Table.Summary.Cell_".concat(item.index)
|
|
20656
|
+
key: "Table.Summary.Cell_".concat(item.index),
|
|
20657
|
+
ref: cellRef
|
|
20340
20658
|
}, /*#__PURE__*/React$1.createElement(Text$2, {
|
|
20341
20659
|
type: "danger"
|
|
20342
20660
|
}, "".concat(labelText, " ").concat((_target$value = target.value) !== null && _target$value !== void 0 ? _target$value : '')));
|
|
20343
20661
|
} else {
|
|
20344
20662
|
return /*#__PURE__*/React$1.createElement(Table.Summary.Cell, {
|
|
20345
20663
|
index: index,
|
|
20346
|
-
key: "Table.Summary.Cell_".concat(item.index)
|
|
20664
|
+
key: "Table.Summary.Cell_".concat(item.index),
|
|
20665
|
+
ref: cellRef
|
|
20347
20666
|
}, /*#__PURE__*/React$1.createElement(Text$2, {
|
|
20348
20667
|
type: "danger"
|
|
20349
20668
|
}, " "));
|
|
20350
20669
|
}
|
|
20351
20670
|
}));
|
|
20352
20671
|
}));
|
|
20672
|
+
return summaryElement;
|
|
20353
20673
|
} else {
|
|
20354
20674
|
return undefined;
|
|
20355
20675
|
}
|
|
20356
|
-
}, [
|
|
20676
|
+
}, []); // 移除所有依赖项,使用stateRef访问最新状态
|
|
20357
20677
|
var columnsDom = /*#__PURE__*/React$1.createElement("span", {
|
|
20358
20678
|
className: "ant-dropdown-link"
|
|
20359
20679
|
}, /*#__PURE__*/React$1.createElement("div", {
|
|
@@ -20375,7 +20695,11 @@ var BsSulaQueryTable = (function (props) {
|
|
|
20375
20695
|
bsTableCode: bsTableCode
|
|
20376
20696
|
});
|
|
20377
20697
|
var memoConfig = useMemo(function () {
|
|
20378
|
-
|
|
20698
|
+
// 检查组件是否已卸载
|
|
20699
|
+
if (isUnmountedRef.current) {
|
|
20700
|
+
return {};
|
|
20701
|
+
}
|
|
20702
|
+
var memoConfigObject = _objectSpread2(_objectSpread2({}, config), {}, {
|
|
20379
20703
|
summary: props.summary,
|
|
20380
20704
|
summaryList: props.summaryList ? getTableSummaryInfo : undefined,
|
|
20381
20705
|
statusMapping: props.statusMapping,
|
|
@@ -20383,7 +20707,12 @@ var BsSulaQueryTable = (function (props) {
|
|
|
20383
20707
|
columnsDom: columnsDom,
|
|
20384
20708
|
queryFieldsDom: queryFieldsDom
|
|
20385
20709
|
});
|
|
20386
|
-
|
|
20710
|
+
// 存储memoConfig引用用于清理
|
|
20711
|
+
memoConfigRef.current = memoConfigObject;
|
|
20712
|
+
return memoConfigObject;
|
|
20713
|
+
}, [
|
|
20714
|
+
// 只保留必要的依赖项,避免不必要的重新计算
|
|
20715
|
+
showColumn, props.statusMapping, showSearchFields, expandedRowKeys, getTableSummaryInfo, props.summaryList, props.summary, props.rowSelection, props.expandable, config, bsTableCode]);
|
|
20387
20716
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
20388
20717
|
data: "bssulaquerydatadiv",
|
|
20389
20718
|
id: "bs-sula-query-table"
|
|
@@ -22226,31 +22555,33 @@ var CustomerMenu = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
22226
22555
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
22227
22556
|
settingModal = _useState4[0],
|
|
22228
22557
|
settingModalFn = _useState4[1];
|
|
22229
|
-
var handleMenuClick = function
|
|
22558
|
+
var handleMenuClick = useCallback(function (item) {
|
|
22230
22559
|
if (item.children || !item.component) return;
|
|
22231
|
-
setIsDrawer(
|
|
22560
|
+
setIsDrawer(false);
|
|
22232
22561
|
history.push({
|
|
22233
22562
|
pathname: item.path
|
|
22234
22563
|
});
|
|
22235
|
-
};
|
|
22236
|
-
var
|
|
22237
|
-
return menuData.map(function (item) {
|
|
22564
|
+
}, []);
|
|
22565
|
+
var getMenuDom = useCallback(function (menuData) {
|
|
22566
|
+
return menuData.map(function (item, index) {
|
|
22238
22567
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
22568
|
+
key: "".concat(item.path || item.name, "-").concat(index),
|
|
22239
22569
|
style: {
|
|
22240
22570
|
paddingLeft: '10px'
|
|
22241
22571
|
}
|
|
22242
22572
|
}, /*#__PURE__*/React$1.createElement("div", {
|
|
22243
|
-
onClick: function
|
|
22244
|
-
handleMenuClick(item);
|
|
22573
|
+
onClick: item.children || !item.component ? undefined : function () {
|
|
22574
|
+
return handleMenuClick(item);
|
|
22245
22575
|
},
|
|
22246
22576
|
className: 'menu_item'.concat(" ", item.children || !item.component ? '' : 'link_style'),
|
|
22247
22577
|
style: {
|
|
22248
22578
|
fontWeight: item.children || !item.component ? 'bolder' : '400',
|
|
22249
|
-
paddingLeft: '4px'
|
|
22579
|
+
paddingLeft: '4px',
|
|
22580
|
+
cursor: item.children || !item.component ? 'default' : 'pointer'
|
|
22250
22581
|
}
|
|
22251
|
-
}, item.name), !!item.children && !!item.children.length &&
|
|
22582
|
+
}, item.name), !!item.children && !!item.children.length && getMenuDom(item.children));
|
|
22252
22583
|
});
|
|
22253
|
-
};
|
|
22584
|
+
}, [handleMenuClick]);
|
|
22254
22585
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
22255
22586
|
className: 'customer_menu_content'
|
|
22256
22587
|
}, /*#__PURE__*/React$1.createElement("div", {
|
|
@@ -22295,7 +22626,7 @@ var CustomerMenu = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
22295
22626
|
visible: isDrawer
|
|
22296
22627
|
}, /*#__PURE__*/React$1.createElement("div", null, /*#__PURE__*/React$1.createElement("p", {
|
|
22297
22628
|
className: 'menu_title_line'
|
|
22298
|
-
}, "\u81EA\u5B9A\u4E49\u83DC\u5355"),
|
|
22629
|
+
}, "\u81EA\u5B9A\u4E49\u83DC\u5355"), getMenuDom(menuData)))), /*#__PURE__*/React$1.createElement(Modal, _objectSpread2({
|
|
22299
22630
|
title: /*#__PURE__*/React$1.createElement("span", {
|
|
22300
22631
|
style: {
|
|
22301
22632
|
fontWeight: '600',
|
|
@@ -22364,6 +22695,7 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22364
22695
|
var timeoutRef = useRef(null);
|
|
22365
22696
|
var resizeHandlerRef = useRef(null);
|
|
22366
22697
|
var debounceTimerRef = useRef(null);
|
|
22698
|
+
var drawContentRef = useRef(null);
|
|
22367
22699
|
useEffect(function () {
|
|
22368
22700
|
var _originRoutes$find;
|
|
22369
22701
|
getMenuContentHeight();
|
|
@@ -22410,14 +22742,19 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22410
22742
|
clearTimeout(debounceTimerRef.current);
|
|
22411
22743
|
debounceTimerRef.current = null;
|
|
22412
22744
|
}
|
|
22745
|
+
// 清理DOM引用
|
|
22746
|
+
drawContentRef.current = null;
|
|
22413
22747
|
};
|
|
22414
22748
|
}, []);
|
|
22415
22749
|
useLayoutEffect(function () {
|
|
22416
22750
|
timeoutRef.current = setTimeout(function () {
|
|
22417
22751
|
if (!isUnmountedRef.current) {
|
|
22418
|
-
|
|
22419
|
-
if (
|
|
22420
|
-
|
|
22752
|
+
// 使用缓存的DOM引用,避免重复查询
|
|
22753
|
+
if (!drawContentRef.current) {
|
|
22754
|
+
drawContentRef.current = document.getElementById("drawContent");
|
|
22755
|
+
}
|
|
22756
|
+
if (drawContentRef.current) {
|
|
22757
|
+
var drawContentHeight = drawContentRef.current.scrollHeight;
|
|
22421
22758
|
if (drawContentHeight > rightMenuHeight) {
|
|
22422
22759
|
setMoreBtnShow(true);
|
|
22423
22760
|
}
|
|
@@ -22438,9 +22775,12 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22438
22775
|
setDrawHeight(clientHeight - 70);
|
|
22439
22776
|
}
|
|
22440
22777
|
}, []);
|
|
22778
|
+
// 优化递归渲染函数,使用React.memo减少重复渲染
|
|
22441
22779
|
var renderChildItem = useCallback(function (child) {
|
|
22442
22780
|
if (!child.hideInMenu && child.children) {
|
|
22443
|
-
return /*#__PURE__*/React$1.createElement(React$1.Fragment,
|
|
22781
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, {
|
|
22782
|
+
key: child.path || child.locale
|
|
22783
|
+
}, /*#__PURE__*/React$1.createElement(List.Item, {
|
|
22444
22784
|
style: {
|
|
22445
22785
|
color: '#000',
|
|
22446
22786
|
fontWeight: 'bold'
|
|
@@ -22451,7 +22791,14 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22451
22791
|
return renderChildItem(menuItem);
|
|
22452
22792
|
}));
|
|
22453
22793
|
} else if (!child.hideInMenu && child.path) {
|
|
22794
|
+
var displayText = formatMessage({
|
|
22795
|
+
id: "".concat(child.locale)
|
|
22796
|
+
});
|
|
22797
|
+
var truncatedText = displayText.length > 10 ? "".concat(formatMessage({
|
|
22798
|
+
id: "".concat(child.name)
|
|
22799
|
+
}).slice(0, 10), "...") : displayText;
|
|
22454
22800
|
return /*#__PURE__*/React$1.createElement(List.Item, {
|
|
22801
|
+
key: child.path,
|
|
22455
22802
|
style: {
|
|
22456
22803
|
fontSize: '12px'
|
|
22457
22804
|
},
|
|
@@ -22462,20 +22809,14 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22462
22809
|
onMenuClick(e, child);
|
|
22463
22810
|
}
|
|
22464
22811
|
}, /*#__PURE__*/React$1.createElement(Tooltip, {
|
|
22465
|
-
title:
|
|
22466
|
-
|
|
22467
|
-
})
|
|
22468
|
-
}, formatMessage({
|
|
22469
|
-
id: "".concat(child.locale)
|
|
22470
|
-
}).length > 10 ? "".concat(formatMessage({
|
|
22471
|
-
id: "".concat(child.name)
|
|
22472
|
-
}).slice(0, 10), "...") : formatMessage({
|
|
22473
|
-
id: "".concat(child.locale)
|
|
22474
|
-
})), /*#__PURE__*/React$1.createElement("img", {
|
|
22812
|
+
title: displayText
|
|
22813
|
+
}, truncatedText), /*#__PURE__*/React$1.createElement("img", {
|
|
22475
22814
|
className: "allFuncOnMouseroverImg",
|
|
22476
|
-
src: right
|
|
22815
|
+
src: right,
|
|
22816
|
+
alt: "arrow"
|
|
22477
22817
|
})));
|
|
22478
22818
|
}
|
|
22819
|
+
return null;
|
|
22479
22820
|
}, [onMenuClick]);
|
|
22480
22821
|
var onMenuClick = useCallback(function (e, item) {
|
|
22481
22822
|
if (isUnmountedRef.current) return;
|
|
@@ -22520,7 +22861,50 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22520
22861
|
debouncedSearch(e.target.value);
|
|
22521
22862
|
}
|
|
22522
22863
|
}, [debouncedSearch]);
|
|
22523
|
-
|
|
22864
|
+
// 优化菜单项点击处理器
|
|
22865
|
+
var handleMenuItemClick = useCallback(function (item) {
|
|
22866
|
+
if (isUnmountedRef.current) return;
|
|
22867
|
+
if (item.component) {
|
|
22868
|
+
history.push({
|
|
22869
|
+
pathname: item.path
|
|
22870
|
+
});
|
|
22871
|
+
onClose();
|
|
22872
|
+
} else {
|
|
22873
|
+
setCurrentOneLevel(item.path);
|
|
22874
|
+
var currentDom = document.getElementById(item.path);
|
|
22875
|
+
currentDom && currentDom.scrollIntoView();
|
|
22876
|
+
}
|
|
22877
|
+
}, [onClose]);
|
|
22878
|
+
// 优化关闭按钮点击处理器
|
|
22879
|
+
var handleCloseClick = useCallback(function () {
|
|
22880
|
+
if (!isUnmountedRef.current) {
|
|
22881
|
+
onClose();
|
|
22882
|
+
}
|
|
22883
|
+
}, [onClose]);
|
|
22884
|
+
// 优化搜索结果点击处理器
|
|
22885
|
+
var handleSearchResultClick = useCallback(function (item) {
|
|
22886
|
+
if (!isUnmountedRef.current) {
|
|
22887
|
+
onMenuClick({
|
|
22888
|
+
stopPropagation: function stopPropagation() {},
|
|
22889
|
+
preventDefault: function preventDefault() {}
|
|
22890
|
+
}, item);
|
|
22891
|
+
}
|
|
22892
|
+
}, [onMenuClick]);
|
|
22893
|
+
// 优化更多按钮点击处理器
|
|
22894
|
+
var handleMoreButtonClick = useCallback(function () {
|
|
22895
|
+
if (!isUnmountedRef.current) {
|
|
22896
|
+
setShowScroll(true);
|
|
22897
|
+
setMoreBtnShow(false);
|
|
22898
|
+
}
|
|
22899
|
+
}, []);
|
|
22900
|
+
// 使用useMemo缓存searchHistoryList,避免每次渲染都重新解析localStorage
|
|
22901
|
+
var searchHistoryList = useMemo(function () {
|
|
22902
|
+
try {
|
|
22903
|
+
return JSON.parse(localStorage.getItem("".concat(itemPath, "_search_history")) || '[]');
|
|
22904
|
+
} catch (error) {
|
|
22905
|
+
return [];
|
|
22906
|
+
}
|
|
22907
|
+
}, [itemPath]);
|
|
22524
22908
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
22525
22909
|
style: {
|
|
22526
22910
|
height: "".concat(drawHeight, "px")
|
|
@@ -22538,19 +22922,9 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22538
22922
|
color: currentOneLevel === item.path ? '#005cff' : '#000000'
|
|
22539
22923
|
},
|
|
22540
22924
|
onClick: function onClick(e) {
|
|
22541
|
-
if (isUnmountedRef.current) return;
|
|
22542
22925
|
e.stopPropagation();
|
|
22543
22926
|
e.preventDefault();
|
|
22544
|
-
|
|
22545
|
-
history.push({
|
|
22546
|
-
pathname: item.path
|
|
22547
|
-
});
|
|
22548
|
-
onClose();
|
|
22549
|
-
} else {
|
|
22550
|
-
setCurrentOneLevel(item.path);
|
|
22551
|
-
var currentDom = document.getElementById(item.path);
|
|
22552
|
-
currentDom && currentDom.scrollIntoView();
|
|
22553
|
-
}
|
|
22927
|
+
handleMenuItemClick(item);
|
|
22554
22928
|
}
|
|
22555
22929
|
}, item.name);
|
|
22556
22930
|
})), /*#__PURE__*/React$1.createElement("div", {
|
|
@@ -22559,11 +22933,7 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22559
22933
|
position: 'relative'
|
|
22560
22934
|
}
|
|
22561
22935
|
}, /*#__PURE__*/React$1.createElement("img", {
|
|
22562
|
-
onClick:
|
|
22563
|
-
if (!isUnmountedRef.current) {
|
|
22564
|
-
onClose();
|
|
22565
|
-
}
|
|
22566
|
-
},
|
|
22936
|
+
onClick: handleCloseClick,
|
|
22567
22937
|
style: {
|
|
22568
22938
|
position: 'absolute',
|
|
22569
22939
|
right: '15px',
|
|
@@ -22612,10 +22982,8 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22612
22982
|
className: 'search_menu_content'
|
|
22613
22983
|
}, SearhData.map(function (item) {
|
|
22614
22984
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
22615
|
-
onClick: function onClick(
|
|
22616
|
-
|
|
22617
|
-
onMenuClick(e, item);
|
|
22618
|
-
}
|
|
22985
|
+
onClick: function onClick() {
|
|
22986
|
+
return handleSearchResultClick(item);
|
|
22619
22987
|
},
|
|
22620
22988
|
key: item.path
|
|
22621
22989
|
}, item.name);
|
|
@@ -22686,12 +23054,7 @@ var DrawContent$1 = function DrawContent(_ref) {
|
|
|
22686
23054
|
height: '30px'
|
|
22687
23055
|
}
|
|
22688
23056
|
}, /*#__PURE__*/React$1.createElement("span", {
|
|
22689
|
-
onClick:
|
|
22690
|
-
if (!isUnmountedRef.current) {
|
|
22691
|
-
setShowScroll(true);
|
|
22692
|
-
setMoreBtnShow(false);
|
|
22693
|
-
}
|
|
22694
|
-
},
|
|
23057
|
+
onClick: handleMoreButtonClick,
|
|
22695
23058
|
style: {
|
|
22696
23059
|
color: '#8c8c8c'
|
|
22697
23060
|
}
|
|
@@ -23041,18 +23404,15 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23041
23404
|
};
|
|
23042
23405
|
_this.getDictionaryTextByValue = function (dicCode, value) {
|
|
23043
23406
|
var _dicData2;
|
|
23044
|
-
var startPerformance = performance.now();
|
|
23045
23407
|
if (window.dicDataTextValue) {
|
|
23046
23408
|
var dicDataTextValue = window.dicDataTextValue;
|
|
23047
23409
|
var _dicData = [];
|
|
23048
23410
|
_dicData = dicDataTextValue[dicCode];
|
|
23049
|
-
var endPerformance1 = performance.now();
|
|
23050
23411
|
if (value === undefined) return "-";
|
|
23051
23412
|
if (!_dicData) {
|
|
23052
23413
|
// throw new Error(`当前${dicCode}字典值合没有${value}的数据`)
|
|
23053
23414
|
return value;
|
|
23054
23415
|
}
|
|
23055
|
-
var endPerformance = performance.now();
|
|
23056
23416
|
return _dicData[value] || value;
|
|
23057
23417
|
}
|
|
23058
23418
|
var dicData = [];
|
|
@@ -23187,18 +23547,44 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23187
23547
|
});
|
|
23188
23548
|
_this.setShowMenu(false);
|
|
23189
23549
|
};
|
|
23550
|
+
// 使用WeakMap存储菜单项引用,避免强引用
|
|
23551
|
+
_this.menuItemsWeakMap = new WeakMap();
|
|
23552
|
+
// 容器级别的事件委托处理器
|
|
23553
|
+
_this.handleMenuContainerClick = function (event) {
|
|
23554
|
+
var target = event.target.closest('[data-menu-item]');
|
|
23555
|
+
if (!target) return;
|
|
23556
|
+
var itemPath = target.getAttribute('data-item-path');
|
|
23557
|
+
var hasChildren = target.getAttribute('data-has-children') === 'true';
|
|
23558
|
+
if (!hasChildren && itemPath) {
|
|
23559
|
+
// 从WeakMap中获取完整的item对象
|
|
23560
|
+
var item = _this.menuItemsWeakMap.get(target) || {
|
|
23561
|
+
path: itemPath
|
|
23562
|
+
};
|
|
23563
|
+
_this.handleMenuClick(item);
|
|
23564
|
+
}
|
|
23565
|
+
};
|
|
23190
23566
|
_this.getMenuDom = function (menuData) {
|
|
23191
|
-
return menuData.map(function (item) {
|
|
23192
|
-
|
|
23193
|
-
|
|
23194
|
-
|
|
23195
|
-
|
|
23196
|
-
|
|
23567
|
+
return menuData.map(function (item, index) {
|
|
23568
|
+
var hasChildren = item.children || !item.component;
|
|
23569
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
23570
|
+
key: "".concat(item.path || item.name, "-").concat(index)
|
|
23571
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
23572
|
+
"data-menu-item": "true",
|
|
23573
|
+
"data-item-path": item.path,
|
|
23574
|
+
"data-has-children": hasChildren,
|
|
23575
|
+
className: 'menu_item'.concat(" ", hasChildren ? '' : 'link_style'),
|
|
23197
23576
|
style: {
|
|
23198
|
-
fontWeight:
|
|
23577
|
+
fontWeight: hasChildren ? 'bolder' : '400',
|
|
23199
23578
|
paddingLeft: '10px',
|
|
23200
|
-
marginTop:
|
|
23201
|
-
fontSize:
|
|
23579
|
+
marginTop: hasChildren ? '5px' : '0px',
|
|
23580
|
+
fontSize: hasChildren ? '14px' : '12px',
|
|
23581
|
+
cursor: hasChildren ? 'default' : 'pointer'
|
|
23582
|
+
},
|
|
23583
|
+
ref: function ref(el) {
|
|
23584
|
+
// 使用WeakMap存储元素与item的关联
|
|
23585
|
+
if (el && !hasChildren) {
|
|
23586
|
+
_this.menuItemsWeakMap.set(el, item);
|
|
23587
|
+
}
|
|
23202
23588
|
}
|
|
23203
23589
|
}, item.name), !!item.children && !!item.children.length && _this.getMenuDom(item.children));
|
|
23204
23590
|
});
|
|
@@ -23640,7 +24026,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23640
24026
|
}, {
|
|
23641
24027
|
key: "componentWillUnmount",
|
|
23642
24028
|
value: function componentWillUnmount() {
|
|
23643
|
-
var _window$$wujie3
|
|
24029
|
+
var _window$$wujie3,
|
|
24030
|
+
_this3 = this;
|
|
23644
24031
|
// 清理路由监听器
|
|
23645
24032
|
if (UN_LISTTEN_DRP) {
|
|
23646
24033
|
UN_LISTTEN_DRP();
|
|
@@ -23656,21 +24043,72 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23656
24043
|
clearTimeout(timeoutId);
|
|
23657
24044
|
});
|
|
23658
24045
|
this.timeoutIds.clear();
|
|
24046
|
+
// 清理DOM缓存引用
|
|
24047
|
+
if (this.cachedTabsElements) {
|
|
24048
|
+
this.cachedTabsElements.globalTabsNav = null;
|
|
24049
|
+
this.cachedTabsElements.globalTabsNavWrap = null;
|
|
24050
|
+
this.cachedTabsElements = null;
|
|
24051
|
+
}
|
|
24052
|
+
// 清理ref引用
|
|
24053
|
+
if (this.allFunc && this.allFunc.current) {
|
|
24054
|
+
this.allFunc.current = null;
|
|
24055
|
+
}
|
|
24056
|
+
if (this.customerMenuRef && this.customerMenuRef.current) {
|
|
24057
|
+
this.customerMenuRef.current = null;
|
|
24058
|
+
}
|
|
24059
|
+
if (this.actionRef && this.actionRef.current) {
|
|
24060
|
+
this.actionRef.current = null;
|
|
24061
|
+
}
|
|
23659
24062
|
// 清理实例属性
|
|
23660
24063
|
this.routerArray = null;
|
|
23661
24064
|
this.authMenuPathList = null;
|
|
23662
24065
|
this.docsId = null;
|
|
23663
24066
|
this.lastTwoRouterArray = null;
|
|
23664
|
-
this.cachedTabsElements = null;
|
|
23665
24067
|
this.cachedBreadcrumbNameMap = null;
|
|
23666
24068
|
this.cachedWeiqianduanProps = null;
|
|
23667
24069
|
this.cachedOperationsSlot = null;
|
|
23668
24070
|
this.lastIsSliderState = null;
|
|
24071
|
+
// 清理菜单容器的事件监听器
|
|
24072
|
+
var menuContainer = document.querySelector('.sub_menu_content');
|
|
24073
|
+
if (menuContainer) {
|
|
24074
|
+
menuContainer.removeEventListener('click', this.handleMenuContainerClick);
|
|
24075
|
+
// 清理所有菜单项的data属性和引用
|
|
24076
|
+
var menuItems = menuContainer.querySelectorAll('[data-menu-item]');
|
|
24077
|
+
menuItems.forEach(function (item) {
|
|
24078
|
+
// 从WeakMap中移除引用
|
|
24079
|
+
if (_this3.menuItemsWeakMap && _this3.menuItemsWeakMap.has(item)) {
|
|
24080
|
+
_this3.menuItemsWeakMap.delete(item);
|
|
24081
|
+
}
|
|
24082
|
+
// 清理data属性
|
|
24083
|
+
item.removeAttribute('data-menu-item');
|
|
24084
|
+
item.removeAttribute('data-item-path');
|
|
24085
|
+
item.removeAttribute('data-has-children');
|
|
24086
|
+
});
|
|
24087
|
+
}
|
|
24088
|
+
// 清理WeakMap
|
|
24089
|
+
if (this.menuItemsWeakMap) {
|
|
24090
|
+
// WeakMap会自动清理,但显式清空以确保
|
|
24091
|
+
this.menuItemsWeakMap = null;
|
|
24092
|
+
}
|
|
24093
|
+
// 清理方法引用,断开闭包链
|
|
24094
|
+
this.handleMenuClick = null;
|
|
24095
|
+
this.handleMenuContainerClick = null;
|
|
24096
|
+
this.getMenuDom = null;
|
|
24097
|
+
this.setShowMenu = null;
|
|
24098
|
+
this.getTabsNavElements = null;
|
|
24099
|
+
this.setTabNavTransLate = null;
|
|
24100
|
+
this.checkisNavSlide = null;
|
|
24101
|
+
// 强制触发垃圾回收(如果可用)
|
|
24102
|
+
if (window.gc && typeof window.gc === 'function') {
|
|
24103
|
+
setTimeout(function () {
|
|
24104
|
+
return window.gc();
|
|
24105
|
+
}, 0);
|
|
24106
|
+
}
|
|
23669
24107
|
}
|
|
23670
24108
|
}, {
|
|
23671
24109
|
key: "render",
|
|
23672
24110
|
value: function render() {
|
|
23673
|
-
var
|
|
24111
|
+
var _this4 = this;
|
|
23674
24112
|
var _this$state4 = this.state,
|
|
23675
24113
|
listenRouterState = _this$state4.listenRouterState,
|
|
23676
24114
|
activeKey = _this$state4.activeKey,
|
|
@@ -23694,7 +24132,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23694
24132
|
className: "tab_title_content"
|
|
23695
24133
|
}, item.tab, item.key !== '/' && (/*#__PURE__*/React$1.createElement(ItemMenu, {
|
|
23696
24134
|
info: item,
|
|
23697
|
-
operateFun:
|
|
24135
|
+
operateFun: _this4.operateFun,
|
|
23698
24136
|
listenRouterState: listenRouterState
|
|
23699
24137
|
})));
|
|
23700
24138
|
};
|
|
@@ -23728,7 +24166,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23728
24166
|
}, /*#__PURE__*/React$1.createElement("a", {
|
|
23729
24167
|
onClick: function onClick() {
|
|
23730
24168
|
// 关闭全部
|
|
23731
|
-
|
|
24169
|
+
_this4.updateState([_objectSpread2(_objectSpread2({}, _this4.state.homeRouter), {}, {
|
|
23732
24170
|
key: '/',
|
|
23733
24171
|
tab: '欢迎',
|
|
23734
24172
|
closable: false
|
|
@@ -23754,7 +24192,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23754
24192
|
} else {
|
|
23755
24193
|
newActiveKey = listenRouterState[1].key;
|
|
23756
24194
|
}
|
|
23757
|
-
|
|
24195
|
+
_this4.updateState(listenRouterState.filter(function (d) {
|
|
23758
24196
|
return d.key !== activeKey;
|
|
23759
24197
|
}), listenRouterKey.filter(function (d) {
|
|
23760
24198
|
return d !== activeKey;
|
|
@@ -23781,7 +24219,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23781
24219
|
// message.warning('首页不可关闭。');
|
|
23782
24220
|
// return;
|
|
23783
24221
|
// }
|
|
23784
|
-
|
|
24222
|
+
_this4.updateState(listenRouterState.filter(function (d, i) {
|
|
23785
24223
|
return i >= index || d.key === '/';
|
|
23786
24224
|
}), listenRouterKey.filter(function (d, i) {
|
|
23787
24225
|
return i >= index || d === '/';
|
|
@@ -23798,7 +24236,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23798
24236
|
var index = listenRouterState.findIndex(function (item) {
|
|
23799
24237
|
return item.key === activeKey;
|
|
23800
24238
|
});
|
|
23801
|
-
|
|
24239
|
+
_this4.updateState(listenRouterState.filter(function (d, i) {
|
|
23802
24240
|
return i <= index || d.key === '/';
|
|
23803
24241
|
}), listenRouterKey.filter(function (d, i) {
|
|
23804
24242
|
return i <= index || d === '/';
|
|
@@ -23844,7 +24282,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23844
24282
|
opacity: this.state.isSlider ? 1 : 0.5
|
|
23845
24283
|
},
|
|
23846
24284
|
onClick: function onClick() {
|
|
23847
|
-
|
|
24285
|
+
_this4.setTabNavTransLate(-100);
|
|
23848
24286
|
}
|
|
23849
24287
|
}, /*#__PURE__*/React$1.createElement(DoubleLeftOutlined, null)))),
|
|
23850
24288
|
right: (/*#__PURE__*/React$1.createElement("div", {
|
|
@@ -23853,7 +24291,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23853
24291
|
},
|
|
23854
24292
|
className: 'tab_right_operate',
|
|
23855
24293
|
onClick: function onClick() {
|
|
23856
|
-
|
|
24294
|
+
_this4.setTabNavTransLate(100);
|
|
23857
24295
|
}
|
|
23858
24296
|
}, /*#__PURE__*/React$1.createElement(DoubleRightOutlined, null)))
|
|
23859
24297
|
};
|
|
@@ -23869,7 +24307,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23869
24307
|
return /*#__PURE__*/React$1.createElement(CustomerMenuHeader, {
|
|
23870
24308
|
originRoutes: originRoutes,
|
|
23871
24309
|
itemPath: itemPath,
|
|
23872
|
-
handleClose:
|
|
24310
|
+
handleClose: _this4.handleClose,
|
|
23873
24311
|
collapsed: collapse
|
|
23874
24312
|
});
|
|
23875
24313
|
},
|
|
@@ -23878,10 +24316,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23878
24316
|
return /*#__PURE__*/React$1.createElement("div", null, /*#__PURE__*/React$1.createElement(CustomerMenu, {
|
|
23879
24317
|
originRoutes: originRoutes,
|
|
23880
24318
|
itemPath: itemPath,
|
|
23881
|
-
ref:
|
|
23882
|
-
actionRef:
|
|
23883
|
-
handleClose:
|
|
23884
|
-
isCollapse:
|
|
24319
|
+
ref: _this4.customerMenuRef,
|
|
24320
|
+
actionRef: _this4.actionRef,
|
|
24321
|
+
handleClose: _this4.handleClose,
|
|
24322
|
+
isCollapse: _this4.state.collapse
|
|
23885
24323
|
}));
|
|
23886
24324
|
}
|
|
23887
24325
|
return /*#__PURE__*/React$1.createElement("div", {
|
|
@@ -23889,7 +24327,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23889
24327
|
}, /*#__PURE__*/React$1.createElement("span", {
|
|
23890
24328
|
className: "collapse_icon",
|
|
23891
24329
|
onClick: function onClick() {
|
|
23892
|
-
|
|
24330
|
+
_this4.setState({
|
|
23893
24331
|
collapse: !collapse
|
|
23894
24332
|
});
|
|
23895
24333
|
}
|
|
@@ -23902,7 +24340,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23902
24340
|
},
|
|
23903
24341
|
collapsed: collapse,
|
|
23904
24342
|
onCollapse: function onCollapse(boo) {
|
|
23905
|
-
|
|
24343
|
+
_this4.setState({
|
|
23906
24344
|
collapse: boo
|
|
23907
24345
|
});
|
|
23908
24346
|
},
|
|
@@ -23938,14 +24376,14 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23938
24376
|
},
|
|
23939
24377
|
onMouseEnter: function onMouseEnter() {
|
|
23940
24378
|
if (menuItemProps.pro_layout_parentKeys && menuItemProps.pro_layout_parentKeys.length) return;
|
|
23941
|
-
|
|
24379
|
+
_this4.setState({
|
|
23942
24380
|
currentSubMenuData: menuItemProps.children,
|
|
23943
24381
|
currentSubPath: menuItemProps.path
|
|
23944
24382
|
});
|
|
23945
|
-
|
|
24383
|
+
_this4.setShowMenu(true);
|
|
23946
24384
|
},
|
|
23947
24385
|
onMouseLeave: function onMouseLeave() {
|
|
23948
|
-
|
|
24386
|
+
_this4.setShowMenu(false);
|
|
23949
24387
|
}
|
|
23950
24388
|
}, defaultDom, showSubMenu && currentSubPath === menuItemProps.path && !collapse && (/*#__PURE__*/React$1.createElement(CaretLeftOutlined, {
|
|
23951
24389
|
style: {
|
|
@@ -23964,7 +24402,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
23964
24402
|
}, '');
|
|
23965
24403
|
},
|
|
23966
24404
|
postMenuData: function postMenuData(menus) {
|
|
23967
|
-
return _toConsumableArray(filterByMenuDate(menus || [],
|
|
24405
|
+
return _toConsumableArray(filterByMenuDate(menus || [], _this4.state.keyWord));
|
|
23968
24406
|
},
|
|
23969
24407
|
links: [!this.state.collapse ? (/*#__PURE__*/React$1.createElement(AllFunc$1, {
|
|
23970
24408
|
ref: this.allFunc,
|
|
@@ -24026,13 +24464,12 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
24026
24464
|
tabBarGutter: 8,
|
|
24027
24465
|
onEdit: this.onEdit,
|
|
24028
24466
|
tabBarExtraContent: OperationsSlot,
|
|
24029
|
-
destroyInactiveTabPane
|
|
24467
|
+
// destroyInactiveTabPane={true}
|
|
24030
24468
|
animated: false,
|
|
24031
24469
|
hideAdd: true,
|
|
24032
24470
|
ref: function ref(tabsRef) {
|
|
24033
|
-
if (tabsRef && !
|
|
24034
|
-
|
|
24035
|
-
console.log('[Tabs配置] destroyInactiveTabPane已设置为true,animated设置为false');
|
|
24471
|
+
if (tabsRef && !_this4.tabsRef) {
|
|
24472
|
+
_this4.tabsRef = tabsRef;
|
|
24036
24473
|
}
|
|
24037
24474
|
}
|
|
24038
24475
|
}, listenRouterState.map(function (item, index) {
|
|
@@ -24040,7 +24477,7 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
24040
24477
|
tab: /*#__PURE__*/React$1.createElement(TabTitle, {
|
|
24041
24478
|
item: item,
|
|
24042
24479
|
index: index,
|
|
24043
|
-
updateState:
|
|
24480
|
+
updateState: _this4.updateState
|
|
24044
24481
|
}),
|
|
24045
24482
|
style: {
|
|
24046
24483
|
marginTop: isWeiqianduan ? 0 : 30
|
|
@@ -24052,10 +24489,10 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
24052
24489
|
})
|
|
24053
24490
|
}, /*#__PURE__*/React$1.createElement(WrapperComponent, {
|
|
24054
24491
|
item: item,
|
|
24055
|
-
routerProps:
|
|
24056
|
-
getDictionarySource:
|
|
24057
|
-
getDictionaryTextByValue:
|
|
24058
|
-
timeFormat:
|
|
24492
|
+
routerProps: _this4.props,
|
|
24493
|
+
getDictionarySource: _this4.getDictionarySource,
|
|
24494
|
+
getDictionaryTextByValue: _this4.getDictionaryTextByValue,
|
|
24495
|
+
timeFormat: _this4.timeFormat,
|
|
24059
24496
|
transparentProps: transparentProps,
|
|
24060
24497
|
activeKey: activeKey,
|
|
24061
24498
|
listenRouterState: listenRouterState
|
|
@@ -24082,11 +24519,12 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
24082
24519
|
itemPath: itemPath
|
|
24083
24520
|
}, drawerLeftParams)), /*#__PURE__*/React$1.createElement("div", {
|
|
24084
24521
|
onMouseEnter: function onMouseEnter() {
|
|
24085
|
-
|
|
24522
|
+
_this4.setShowMenu(true);
|
|
24086
24523
|
},
|
|
24087
24524
|
onMouseLeave: function onMouseLeave() {
|
|
24088
|
-
|
|
24525
|
+
_this4.setShowMenu(false);
|
|
24089
24526
|
},
|
|
24527
|
+
onClick: this.handleMenuContainerClick,
|
|
24090
24528
|
className: 'sub_menu_content',
|
|
24091
24529
|
style: {
|
|
24092
24530
|
display: showSubMenu && !collapse ? 'block' : 'none'
|
|
@@ -24097,16 +24535,20 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
24097
24535
|
}(React$1.PureComponent);
|
|
24098
24536
|
var WrapperComponent = /*#__PURE__*/function (_React$Component) {
|
|
24099
24537
|
function WrapperComponent(props) {
|
|
24100
|
-
var
|
|
24538
|
+
var _this5;
|
|
24101
24539
|
_classCallCheck(this, WrapperComponent);
|
|
24102
|
-
|
|
24540
|
+
_this5 = _callSuper(this, WrapperComponent, [props]);
|
|
24103
24541
|
// 初始化组件状态
|
|
24104
24542
|
// 通用事件处理器,用于清理
|
|
24105
|
-
|
|
24543
|
+
_this5.handleEvent = function (event) {
|
|
24106
24544
|
// 空的事件处理器,仅用于清理时移除监听器
|
|
24107
24545
|
};
|
|
24108
|
-
|
|
24109
|
-
|
|
24546
|
+
// 拖拽事件处理器,用于清理
|
|
24547
|
+
_this5.handleDragEvent = function (event) {
|
|
24548
|
+
// 空的拖拽事件处理器,仅用于清理时移除监听器
|
|
24549
|
+
};
|
|
24550
|
+
_this5.isUnmounted = false;
|
|
24551
|
+
return _this5;
|
|
24110
24552
|
}
|
|
24111
24553
|
_inherits(WrapperComponent, _React$Component);
|
|
24112
24554
|
return _createClass(WrapperComponent, [{
|
|
@@ -24117,19 +24559,44 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
24117
24559
|
}, {
|
|
24118
24560
|
key: "componentWillUnmount",
|
|
24119
24561
|
value: function componentWillUnmount() {
|
|
24120
|
-
var
|
|
24562
|
+
var _this6 = this;
|
|
24121
24563
|
// 设置卸载标志
|
|
24122
24564
|
this.isUnmounted = true;
|
|
24123
24565
|
// 清理可能的DOM事件监听器
|
|
24124
24566
|
try {
|
|
24125
|
-
var currentElement = document.
|
|
24567
|
+
var currentElement = document.getElementById('globalTabs-panel-' + this.props.item.key);
|
|
24126
24568
|
if (currentElement) {
|
|
24127
24569
|
// 移除所有可能的事件监听器
|
|
24128
24570
|
var events = ['click', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'focus', 'blur'];
|
|
24129
24571
|
events.forEach(function (eventType) {
|
|
24130
|
-
currentElement.removeEventListener(eventType,
|
|
24131
|
-
currentElement.removeEventListener(eventType,
|
|
24572
|
+
currentElement.removeEventListener(eventType, _this6.handleEvent, true);
|
|
24573
|
+
currentElement.removeEventListener(eventType, _this6.handleEvent, false);
|
|
24574
|
+
});
|
|
24575
|
+
// 清理拖拽相关的事件监听器
|
|
24576
|
+
var dragEvents = ['dragstart', 'dragend', 'dragover', 'dragenter', 'dragleave', 'drop'];
|
|
24577
|
+
dragEvents.forEach(function (eventType) {
|
|
24578
|
+
currentElement.removeEventListener(eventType, _this6.handleDragEvent, true);
|
|
24579
|
+
currentElement.removeEventListener(eventType, _this6.handleDragEvent, false);
|
|
24580
|
+
});
|
|
24581
|
+
// 清理react-dnd相关的属性和状态
|
|
24582
|
+
if (currentElement._reactInternalFiber) {
|
|
24583
|
+
delete currentElement._reactInternalFiber;
|
|
24584
|
+
}
|
|
24585
|
+
if (currentElement._reactInternalInstance) {
|
|
24586
|
+
delete currentElement._reactInternalInstance;
|
|
24587
|
+
}
|
|
24588
|
+
// 清理可能的拖拽状态数据
|
|
24589
|
+
var dragStateKeys = Object.keys(currentElement).filter(function (key) {
|
|
24590
|
+
return key.includes('drag') || key.includes('drop') || key.includes('dnd');
|
|
24132
24591
|
});
|
|
24592
|
+
dragStateKeys.forEach(function (key) {
|
|
24593
|
+
try {
|
|
24594
|
+
delete currentElement[key];
|
|
24595
|
+
} catch (e) {
|
|
24596
|
+
// 忽略删除失败的情况
|
|
24597
|
+
}
|
|
24598
|
+
});
|
|
24599
|
+
null, _readOnlyError("currentElement");
|
|
24133
24600
|
}
|
|
24134
24601
|
// 强制垃圾回收提示
|
|
24135
24602
|
if (window.gc && typeof window.gc === 'function') {
|
|
@@ -24145,26 +24612,24 @@ var WrapperComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
24145
24612
|
var _nextProps$item,
|
|
24146
24613
|
_nextProps$item$key,
|
|
24147
24614
|
_this$props$listenRou,
|
|
24148
|
-
|
|
24615
|
+
_this7 = this,
|
|
24149
24616
|
_nextProps$listenRout;
|
|
24150
24617
|
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) {
|
|
24151
24618
|
return true;
|
|
24152
24619
|
}
|
|
24153
24620
|
// 检测页签是否已被删除:比较当前和下一个listenRouterState
|
|
24154
24621
|
var currentTabExists = (_this$props$listenRou = this.props.listenRouterState) === null || _this$props$listenRou === void 0 ? void 0 : _this$props$listenRou.some(function (tab) {
|
|
24155
|
-
return tab.key ===
|
|
24622
|
+
return tab.key === _this7.props.item.key;
|
|
24156
24623
|
});
|
|
24157
24624
|
var nextTabExists = (_nextProps$listenRout = nextProps.listenRouterState) === null || _nextProps$listenRout === void 0 ? void 0 : _nextProps$listenRout.some(function (tab) {
|
|
24158
|
-
return tab.key ===
|
|
24625
|
+
return tab.key === _this7.props.item.key;
|
|
24159
24626
|
});
|
|
24160
24627
|
// 如果页签从存在变为不存在,说明被删除了,允许更新以便正确销毁
|
|
24161
24628
|
if (currentTabExists && !nextTabExists) {
|
|
24162
|
-
console.log("\u9875\u7B7E ".concat(this.props.item.key, " \u5DF2\u88AB\u5220\u9664\uFF0C\u5141\u8BB8\u7EC4\u4EF6\u66F4\u65B0\u4EE5\u4FBF\u9500\u6BC1"));
|
|
24163
24629
|
return true;
|
|
24164
24630
|
}
|
|
24165
24631
|
// 如果页签不再是活跃状态,允许更新以便正确销毁
|
|
24166
24632
|
if (nextProps.activeKey !== nextProps.item.key && this.props.activeKey === this.props.item.key) {
|
|
24167
|
-
console.log("\u9875\u7B7E ".concat(this.props.item.key, " \u4E0D\u518D\u6D3B\u8DC3\uFF0C\u5141\u8BB8\u7EC4\u4EF6\u66F4\u65B0"));
|
|
24168
24633
|
return true;
|
|
24169
24634
|
}
|
|
24170
24635
|
// 如果页签变为活跃状态或内容发生变化,允许更新
|
|
@@ -30598,6 +31063,8 @@ var ConfigTree = (function (props) {
|
|
|
30598
31063
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
30599
31064
|
activeLine = _useState4[0],
|
|
30600
31065
|
setActiveLine = _useState4[1];
|
|
31066
|
+
var highlightTimerRef = React$1.useRef(null);
|
|
31067
|
+
var isUnmountedRef = React$1.useRef(false);
|
|
30601
31068
|
useEffect(function () {
|
|
30602
31069
|
setTreeData(parseData(data));
|
|
30603
31070
|
}, [data]);
|
|
@@ -30609,10 +31076,32 @@ var ConfigTree = (function (props) {
|
|
|
30609
31076
|
}
|
|
30610
31077
|
}, [treeData, currentLine]);
|
|
30611
31078
|
useEffect(function () {
|
|
30612
|
-
|
|
30613
|
-
|
|
31079
|
+
// 清理之前的定时器
|
|
31080
|
+
if (highlightTimerRef.current) {
|
|
31081
|
+
clearTimeout(highlightTimerRef.current);
|
|
31082
|
+
highlightTimerRef.current = null;
|
|
31083
|
+
}
|
|
31084
|
+
highlightTimerRef.current = setTimeout(function () {
|
|
31085
|
+
try {
|
|
31086
|
+
if (!isUnmountedRef.current) {
|
|
31087
|
+
setTreeData(createHighLightTreeData(treeData, activeLine));
|
|
31088
|
+
}
|
|
31089
|
+
} catch (error) {} finally {
|
|
31090
|
+
highlightTimerRef.current = null;
|
|
31091
|
+
}
|
|
30614
31092
|
});
|
|
30615
31093
|
}, [activeLine]);
|
|
31094
|
+
|
|
31095
|
+
// 组件卸载时清理定时器
|
|
31096
|
+
useEffect(function () {
|
|
31097
|
+
return function () {
|
|
31098
|
+
isUnmountedRef.current = true;
|
|
31099
|
+
if (highlightTimerRef.current) {
|
|
31100
|
+
clearTimeout(highlightTimerRef.current);
|
|
31101
|
+
highlightTimerRef.current = null;
|
|
31102
|
+
}
|
|
31103
|
+
};
|
|
31104
|
+
}, []);
|
|
30616
31105
|
var handleSelect = function handleSelect(node, hasChildren) {
|
|
30617
31106
|
var noActiveData = clearActiveNode(treeData);
|
|
30618
31107
|
setTreeData(noActiveData);
|
|
@@ -31844,7 +32333,6 @@ var FieldsModifyModal = function FieldsModifyModal(props) {
|
|
|
31844
32333
|
}),
|
|
31845
32334
|
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(',')) || []
|
|
31846
32335
|
});
|
|
31847
|
-
console.log(record, 'record');
|
|
31848
32336
|
var trueOrFalseSource = [{
|
|
31849
32337
|
text: '是',
|
|
31850
32338
|
value: true
|
|
@@ -32830,7 +33318,6 @@ var FieldsSettingsTable = (function (props) {
|
|
|
32830
33318
|
render: function render(_ref) {
|
|
32831
33319
|
var text = _ref.text;
|
|
32832
33320
|
var jsonEditorVal = localStorage.getItem('jsonEditorVal') || '';
|
|
32833
|
-
console.log('jsonEditorVal', jsonEditorVal);
|
|
32834
33321
|
return jsonEditorVal.indexOf(text) >= 0 ? '是' : "否";
|
|
32835
33322
|
}
|
|
32836
33323
|
}, {
|
|
@@ -33105,9 +33592,7 @@ function hanleCallbackValue(codeProps, value, customerFields) {
|
|
|
33105
33592
|
}
|
|
33106
33593
|
}
|
|
33107
33594
|
return extensionFields[fieldName2] || extensionFields[fieldName1] || '';
|
|
33108
|
-
} catch (e) {
|
|
33109
|
-
console.log('e', e);
|
|
33110
|
-
}
|
|
33595
|
+
} catch (e) {}
|
|
33111
33596
|
}
|
|
33112
33597
|
});
|
|
33113
33598
|
} else {
|
|
@@ -33475,9 +33960,7 @@ var getColumnItem = function getColumnItem(_ref) {
|
|
|
33475
33960
|
if (JSON.parse(item.info || '{}').dictionaryCode) {
|
|
33476
33961
|
dictionaryCode = JSON.parse(item.info || '{}').dictionaryCode;
|
|
33477
33962
|
}
|
|
33478
|
-
} catch (e) {
|
|
33479
|
-
console.log('error', e);
|
|
33480
|
-
}
|
|
33963
|
+
} catch (e) {}
|
|
33481
33964
|
ites.sourceList = dictionaryCode && getDictionarySource(dictionaryCode) || [];
|
|
33482
33965
|
}
|
|
33483
33966
|
if (item.choiceType == 10) {
|
|
@@ -33487,9 +33970,7 @@ var getColumnItem = function getColumnItem(_ref) {
|
|
|
33487
33970
|
if (JSON.parse(item.info || '{}').enumeration) {
|
|
33488
33971
|
enumeration = JSON.parse(item.info || '{}').enumeration;
|
|
33489
33972
|
}
|
|
33490
|
-
} catch (e) {
|
|
33491
|
-
console.log('error', e);
|
|
33492
|
-
}
|
|
33973
|
+
} catch (e) {}
|
|
33493
33974
|
ites.sourceList = enumeration && Object.keys(enumeration).map(function (key) {
|
|
33494
33975
|
return {
|
|
33495
33976
|
value: key,
|
|
@@ -33584,7 +34065,6 @@ function _getMetaData() {
|
|
|
33584
34065
|
}).then(function (res) {
|
|
33585
34066
|
resolve(res.data);
|
|
33586
34067
|
}).catch(function (error) {
|
|
33587
|
-
console.log(error, 'error');
|
|
33588
34068
|
reject([]);
|
|
33589
34069
|
});
|
|
33590
34070
|
}));
|
|
@@ -33831,9 +34311,7 @@ var CustomSelectorModal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
33831
34311
|
if (JSON.parse(item.info).isLikeQuery) {
|
|
33832
34312
|
name = "qp-".concat(item.code, "-like");
|
|
33833
34313
|
}
|
|
33834
|
-
} catch (e) {
|
|
33835
|
-
console.log('error', e);
|
|
33836
|
-
}
|
|
34314
|
+
} catch (e) {}
|
|
33837
34315
|
return {
|
|
33838
34316
|
name: name,
|
|
33839
34317
|
label: item.name,
|
|
@@ -37397,7 +37875,6 @@ var RuleField = /*#__PURE__*/function (_Component) {
|
|
|
37397
37875
|
this.getRegularThresholdRange(nextProps.queryIdentify, nextProps.propertyCode, nextProps.queryIdentifyType);
|
|
37398
37876
|
}
|
|
37399
37877
|
if (JSON.stringify(nextProps.initialThresholdQuery) != JSON.stringify(this.props.initialThresholdQuery)) {
|
|
37400
|
-
console.log(findChangedThresholdQuery(this.props.initialThresholdQuery, nextProps.initialThresholdQuery));
|
|
37401
37878
|
var changedPropsVal = findChangedThresholdQuery(this.props.initialThresholdQuery, nextProps.initialThresholdQuery);
|
|
37402
37879
|
this.setState({
|
|
37403
37880
|
thresholdQuery: _objectSpread2({}, nextProps.initialThresholdQuery)
|
|
@@ -37965,7 +38442,6 @@ function RenderCompItem(props) {
|
|
|
37965
38442
|
}
|
|
37966
38443
|
return Item;
|
|
37967
38444
|
});
|
|
37968
|
-
console.log((ites === null || ites === void 0 ? void 0 : ites.dictionaryCode) && !getDictionarySource(ites.dictionaryCode));
|
|
37969
38445
|
var _useState = useState(getDictionarySource(ites.dictionaryCode) || []),
|
|
37970
38446
|
_useState2 = _slicedToArray(_useState, 2),
|
|
37971
38447
|
dictData = _useState2[0],
|
|
@@ -38527,7 +39003,6 @@ function RenderCompItem(props) {
|
|
|
38527
39003
|
key: showValue(ites.code),
|
|
38528
39004
|
// FIXME http://192.168.13.78/mep-fed-group/web/libs/business-component/-/merge_requests/45#note_115667
|
|
38529
39005
|
setValue: function setValue(val, formulaName) {
|
|
38530
|
-
console.log(val, 'val');
|
|
38531
39006
|
var value = val.map(function (item) {
|
|
38532
39007
|
return item.value.replace(/[a-zA-Z_]+\.\w+/g, function (i) {
|
|
38533
39008
|
return '{' + i + '}';
|
|
@@ -39896,7 +40371,6 @@ var formatRegularList = function formatRegularList(data) {
|
|
|
39896
40371
|
var handleRuleShowBack = function handleRuleShowBack(data, functionRuleList, ruleReturnList) {
|
|
39897
40372
|
var result = data === null || data === void 0 ? void 0 : data.map(function (item, index) {
|
|
39898
40373
|
var _item$result, _item$result3;
|
|
39899
|
-
console.log('data', item);
|
|
39900
40374
|
var newResponse = [];
|
|
39901
40375
|
//新数据都用responseArray形式
|
|
39902
40376
|
if (Array.isArray(item === null || item === void 0 ? void 0 : (_item$result = item.result) === null || _item$result === void 0 ? void 0 : _item$result.responseArray)) {
|