@bit-sun/business-component 4.2.0-alpha.6.9 → 4.2.5-per-alpha.2
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/.umirc.ts +14 -10
- package/dist/components/Business/AddSelectBusiness/index.d.ts +3 -4
- package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +2 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +1 -2
- package/dist/components/Business/BsLayouts/index.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +19 -8
- package/dist/components/Business/BsSulaQueryTable/index.d.ts +1 -2
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +9 -17
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +14 -15
- package/dist/components/Business/CommodityEntry/index.d.ts +1 -2
- package/dist/components/Business/CommonAlert/index.d.ts +1 -2
- package/dist/components/Business/CommonGuideWrapper/index.d.ts +3 -3
- package/dist/components/Business/DetailPageWrapper/index.d.ts +11 -12
- package/dist/components/Business/HomePageWrapper/index.d.ts +1 -2
- package/dist/components/Business/ItemPropertySelector/index.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/FieldsModifyModal.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/FieldsSettingsTable.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/Formula.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/MaintainOptions.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/drawer/index.d.ts +1 -2
- package/dist/components/Business/PropertyModal/index.d.ts +1 -2
- package/dist/components/Business/PropertyModal/propertyGroup.d.ts +1 -1
- package/dist/components/Business/SearchSelect/index.d.ts +1 -1
- package/dist/components/Business/StateFlow/index.d.ts +1 -2
- package/dist/components/Business/TreeSearchSelect/index.d.ts +1 -1
- package/dist/components/Business/columnSettingTable/columnSetting.d.ts +6 -6
- package/dist/components/Business/columnSettingTable/components/TableSumComponent.d.ts +1 -2
- package/dist/components/Business/columnSettingTable/index.d.ts +3 -3
- package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +3 -3
- package/dist/components/Business/columnSettingTable/utils.d.ts +1 -2
- package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +1 -1
- package/dist/components/Common/ParagraphCopier/index.d.ts +1 -1
- package/dist/components/Common/Section/index.d.ts +1 -1
- package/dist/components/Functional/AddSelect/index.d.ts +1 -2
- package/dist/components/Functional/AuthButton/index.d.ts +1 -2
- package/dist/components/Functional/DataImport/index.d.ts +4 -4
- package/dist/components/Functional/DataValidation/index.d.ts +5 -5
- package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +1 -2
- package/dist/components/Functional/QueryMutipleInput/index.d.ts +1 -2
- package/dist/components/Functional/QueryMutipleSelect/index.d.ts +1 -2
- package/dist/components/Functional/SearchSelect/index.d.ts +1 -1
- package/dist/components/Functional/SearchSelect/utils.d.ts +2 -3
- package/dist/components/Functional/TreeSearchSelect/index.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.d.ts +1 -1
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/Formula.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/InnerSelect.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/RenderCompItem.d.ts +1 -2
- package/dist/components/Solution/RuleSetter/RuleInstance.d.ts +1 -2
- package/dist/components/Solution/RuleSetter/baseRule.d.ts +1 -1
- package/dist/components/Solution/RuleSetter/index.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +2203 -1852
- package/dist/index.js +2196 -1847
- package/dist/plugin/TableColumnSetting/index.d.ts +5 -5
- package/dist/utils/TableUtils.d.ts +18 -19
- package/dist/utils/luckysheetLoader.d.ts +21 -0
- package/dist/utils/utils.d.ts +0 -41
- package/package.json +1 -1
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +94 -25
- package/src/components/Business/BsLayouts/index.tsx +235 -129
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +144 -4
- package/src/components/Business/BsSulaQueryTable/index.md +120 -0
- package/src/components/Business/BsSulaQueryTable/index.tsx +241 -24
- package/src/components/Business/BsSulaQueryTable/setting.tsx +232 -17
- package/src/components/Business/DetailPageWrapper/index.tsx +30 -27
- package/src/components/Business/HomePageWrapper/index.tsx +10 -8
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +38 -234
- package/src/components/Business/columnSettingTable/index.tsx +6 -7
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +22 -23
- package/src/components/Functional/AddSelect/index.tsx +0 -92
- package/src/components/Functional/DataImport/index.tsx +76 -3
- package/src/components/Functional/DataValidation/index.tsx +81 -3
- package/src/components/Functional/SearchSelect/index.tsx +2 -5
- package/src/components/Solution/RuleComponent/index.js +0 -1
- package/src/index.ts +0 -2
- package/src/utils/luckysheetLoader.ts +164 -0
- package/src/utils/utils.ts +1 -41
- package/dist/components/Business/SystemLog/index.d.ts +0 -78
- package/src/components/Business/SystemLog/index.md +0 -37
- package/src/components/Business/SystemLog/index.tsx +0 -87
|
@@ -38,14 +38,14 @@ declare class TableColumnSetting extends React.Component<TableColumnSettingProps
|
|
|
38
38
|
} | {
|
|
39
39
|
title: string;
|
|
40
40
|
dataIndex: string;
|
|
41
|
-
render: (text: any, record: any) =>
|
|
41
|
+
render: (text: any, record: any) => JSX.Element;
|
|
42
42
|
className?: undefined;
|
|
43
43
|
width?: undefined;
|
|
44
44
|
} | {
|
|
45
45
|
title: string;
|
|
46
46
|
dataIndex: string;
|
|
47
47
|
className: string;
|
|
48
|
-
render: () =>
|
|
48
|
+
render: () => JSX.Element;
|
|
49
49
|
width?: undefined;
|
|
50
50
|
})[];
|
|
51
51
|
showModal: () => void;
|
|
@@ -53,13 +53,13 @@ declare class TableColumnSetting extends React.Component<TableColumnSettingProps
|
|
|
53
53
|
handleCancel: (e: React.MouseEvent<HTMLElement>) => void;
|
|
54
54
|
handleTableHeadHidden: (title: string) => void;
|
|
55
55
|
onSortEnd: ({ oldIndex, newIndex }: any) => void;
|
|
56
|
-
DraggableContainer: (props: any) =>
|
|
57
|
-
DraggableBodyRow: ({ className, style, ...restProps }: any) =>
|
|
56
|
+
DraggableContainer: (props: any) => JSX.Element;
|
|
57
|
+
DraggableBodyRow: ({ className, style, ...restProps }: any) => JSX.Element;
|
|
58
58
|
onChange: (e: any, title: any) => void;
|
|
59
59
|
handleReset: () => void;
|
|
60
60
|
handleResetSetting: () => Promise<unknown>;
|
|
61
61
|
onSearch: (e: any) => void;
|
|
62
62
|
onSearchSort: (e: any) => void;
|
|
63
|
-
render():
|
|
63
|
+
render(): JSX.Element;
|
|
64
64
|
}
|
|
65
65
|
export default TableColumnSetting;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import moment from 'moment';
|
|
3
2
|
type mediaListType = {
|
|
4
3
|
type: number;
|
|
@@ -49,24 +48,24 @@ declare const updateGuanDate: (requestParams: any, dateKeyParams?: any) => {
|
|
|
49
48
|
};
|
|
50
49
|
submit: any;
|
|
51
50
|
};
|
|
52
|
-
declare const textIcon: (type: string | number, text?: string) =>
|
|
53
|
-
declare const handleTextDoubleOrId: (textOne: string | undefined, textTwo: string | undefined) =>
|
|
54
|
-
declare const handleTextDouble: (textOne: string | undefined, textTwo: string | undefined) =>
|
|
55
|
-
declare const handleTextOverflow: (text: string | undefined, width?: number) =>
|
|
56
|
-
declare const handleTextLineFeed: (text: string | undefined, width?: number) =>
|
|
57
|
-
declare const handleTextTooltip: (text: any) =>
|
|
58
|
-
declare const handleTextBreakSpaces: (text: any) =>
|
|
59
|
-
declare const handleStatusBadge: (text: any, color: any) =>
|
|
60
|
-
declare const HandleTotalCount: (totalParams: any) =>
|
|
51
|
+
declare const textIcon: (type: string | number, text?: string) => JSX.Element | undefined;
|
|
52
|
+
declare const handleTextDoubleOrId: (textOne: string | undefined, textTwo: string | undefined) => JSX.Element;
|
|
53
|
+
declare const handleTextDouble: (textOne: string | undefined, textTwo: string | undefined) => JSX.Element;
|
|
54
|
+
declare const handleTextOverflow: (text: string | undefined, width?: number) => JSX.Element;
|
|
55
|
+
declare const handleTextLineFeed: (text: string | undefined, width?: number) => JSX.Element;
|
|
56
|
+
declare const handleTextTooltip: (text: any) => JSX.Element;
|
|
57
|
+
declare const handleTextBreakSpaces: (text: any) => JSX.Element;
|
|
58
|
+
declare const handleStatusBadge: (text: any, color: any) => JSX.Element;
|
|
59
|
+
declare const HandleTotalCount: (totalParams: any) => JSX.Element;
|
|
61
60
|
declare const handleCommonTimeRender: (text: any, format?: any) => any;
|
|
62
|
-
declare const handleTooltip: (text: any, timeTrue?: boolean) =>
|
|
63
|
-
declare const handleTooltipHours: (text: any, timeTrue?: boolean) =>
|
|
61
|
+
declare const handleTooltip: (text: any, timeTrue?: boolean) => JSX.Element;
|
|
62
|
+
declare const handleTooltipHours: (text: any, timeTrue?: boolean) => JSX.Element;
|
|
64
63
|
type tableColumnsImageType = {
|
|
65
64
|
width?: number | string;
|
|
66
65
|
height?: number | string;
|
|
67
66
|
[key: string]: any;
|
|
68
67
|
};
|
|
69
|
-
declare const tableColumnsImage: (url?: string, paramsObj?: tableColumnsImageType) =>
|
|
68
|
+
declare const tableColumnsImage: (url?: string, paramsObj?: tableColumnsImageType) => JSX.Element;
|
|
70
69
|
interface ColumnsEditInterfave {
|
|
71
70
|
text?: string;
|
|
72
71
|
record?: any;
|
|
@@ -82,7 +81,7 @@ interface ColumnsEditInterfave {
|
|
|
82
81
|
};
|
|
83
82
|
[key: string]: any;
|
|
84
83
|
}
|
|
85
|
-
declare const ColumnsEdit: (props: ColumnsEditInterfave) =>
|
|
84
|
+
declare const ColumnsEdit: (props: ColumnsEditInterfave) => JSX.Element;
|
|
86
85
|
type UserColumnsType = {
|
|
87
86
|
name: string;
|
|
88
87
|
department?: string;
|
|
@@ -90,13 +89,13 @@ type UserColumnsType = {
|
|
|
90
89
|
company?: string;
|
|
91
90
|
avatar?: string;
|
|
92
91
|
};
|
|
93
|
-
declare const userColumns: (props: UserColumnsType) =>
|
|
94
|
-
declare const userInfoCard: (props: any) =>
|
|
92
|
+
declare const userColumns: (props: UserColumnsType) => JSX.Element;
|
|
93
|
+
declare const userInfoCard: (props: any) => JSX.Element;
|
|
95
94
|
declare const getItemDefaultWidth: (item: any) => number;
|
|
96
|
-
declare const sulaTableRenderTooltip: ({ text }: any) =>
|
|
95
|
+
declare const sulaTableRenderTooltip: ({ text }: any) => JSX.Element;
|
|
97
96
|
declare const renderNumberText: ({ text }: any) => any;
|
|
98
97
|
declare const renderFixed2: (text: any) => any;
|
|
99
|
-
declare const handleTextWarpCustom: (text: any, style?: {}) =>
|
|
98
|
+
declare const handleTextWarpCustom: (text: any, style?: {}) => JSX.Element;
|
|
100
99
|
declare const calculateValidPeriod: (start: any, end: any) => string;
|
|
101
|
-
declare const handleTextWarp: (text: any) =>
|
|
100
|
+
declare const handleTextWarp: (text: any) => JSX.Element;
|
|
102
101
|
export { getSkuImg, updateGuanDate, textIcon, handleTextDoubleOrId, handleTextDouble, handleTextOverflow, handleTextLineFeed, handleTextTooltip, handleTextBreakSpaces, handleStatusBadge, HandleTotalCount, handleTooltip, handleCommonTimeRender, handleTooltipHours, tableColumnsImage, ColumnsEdit, userColumns, userInfoCard, getItemDefaultWidth, renderNumberText, sulaTableRenderTooltip, renderFixed2, handleTextWarpCustom, handleTextWarp, calculateValidPeriod };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Luckysheet 动态加载器
|
|
3
|
+
* 实现按需加载 luckysheet 的 CSS 和 JS 资源
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 动态加载 Luckysheet 资源
|
|
7
|
+
* @returns Promise<void>
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadLuckysheet(): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* 重置加载状态(用于测试或强制重新加载)
|
|
12
|
+
*/
|
|
13
|
+
export declare function resetLuckysheetLoader(): void;
|
|
14
|
+
/**
|
|
15
|
+
* 获取加载状态
|
|
16
|
+
* @returns 加载状态信息
|
|
17
|
+
*/
|
|
18
|
+
export declare function getLuckysheetLoadStatus(): {
|
|
19
|
+
loaded: boolean;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
};
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -31,44 +31,3 @@ export declare const randomString: (len?: any) => string;
|
|
|
31
31
|
export declare const createUniqID: (length: any) => string;
|
|
32
32
|
export declare const handleConvertResponse: (items: any, total: number) => object;
|
|
33
33
|
export declare const noEmptyArray: (targetObj: any) => boolean;
|
|
34
|
-
export declare const formContainerAndItemLayout: (type: string, title: any, name: string) => {
|
|
35
|
-
container: {
|
|
36
|
-
type: string;
|
|
37
|
-
props: {
|
|
38
|
-
title: any;
|
|
39
|
-
id: number;
|
|
40
|
-
level: number;
|
|
41
|
-
name: string;
|
|
42
|
-
bordered?: undefined;
|
|
43
|
-
isWhiteCard?: undefined;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
itemLayout: {
|
|
47
|
-
span: number;
|
|
48
|
-
labelCol: {
|
|
49
|
-
span: number;
|
|
50
|
-
};
|
|
51
|
-
wrapperCol: {
|
|
52
|
-
span: number;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
} | {
|
|
56
|
-
container: {
|
|
57
|
-
type: string;
|
|
58
|
-
props: {
|
|
59
|
-
title: any;
|
|
60
|
-
id: number;
|
|
61
|
-
level: number;
|
|
62
|
-
bordered: null;
|
|
63
|
-
isWhiteCard: boolean;
|
|
64
|
-
name: string;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
itemLayout: {
|
|
68
|
-
wrapperCol: {
|
|
69
|
-
span: number;
|
|
70
|
-
};
|
|
71
|
-
span?: undefined;
|
|
72
|
-
labelCol?: undefined;
|
|
73
|
-
};
|
|
74
|
-
};
|
package/package.json
CHANGED
package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import React, { useEffect, useState, useLayoutEffect, useImperativeHandle } from 'react';
|
|
2
|
+
import React, { useEffect, useState, useLayoutEffect, useImperativeHandle, useCallback, useRef } from 'react';
|
|
3
3
|
import { List, Tooltip, Input, Button } from 'antd';
|
|
4
4
|
import { Link, formatMessage, history } from 'umi';
|
|
5
5
|
import classNames from 'classnames';
|
|
@@ -27,6 +27,12 @@ const DrawContent = ({onClose, originRoutes=[], itemPath}: any) => {
|
|
|
27
27
|
|
|
28
28
|
const [moreBtnShow, setMoreBtnShow] = useState(false);
|
|
29
29
|
const [showScroll, setShowScroll] = useState(false);
|
|
30
|
+
|
|
31
|
+
// 添加refs来跟踪组件状态和清理资源
|
|
32
|
+
const isUnmountedRef = useRef(false);
|
|
33
|
+
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
|
|
34
|
+
const resizeHandlerRef = useRef<(() => void) | null>(null);
|
|
35
|
+
const debounceTimerRef = useRef<NodeJS.Timeout | null>(null);
|
|
30
36
|
|
|
31
37
|
useEffect(() => {
|
|
32
38
|
getMenuContentHeight();
|
|
@@ -51,28 +57,64 @@ const DrawContent = ({onClose, originRoutes=[], itemPath}: any) => {
|
|
|
51
57
|
setroutesData(routesDataList)
|
|
52
58
|
setAuthorityMenu(authorityMenuList)
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
// 创建resize处理函数并保存引用
|
|
61
|
+
const handleResize = () => {
|
|
62
|
+
if (!isUnmountedRef.current) {
|
|
63
|
+
getMenuContentHeight();
|
|
64
|
+
}
|
|
56
65
|
};
|
|
66
|
+
resizeHandlerRef.current = handleResize;
|
|
67
|
+
window.addEventListener('resize', handleResize);
|
|
68
|
+
|
|
69
|
+
// 清理函数
|
|
70
|
+
return () => {
|
|
71
|
+
isUnmountedRef.current = true;
|
|
72
|
+
if (resizeHandlerRef.current) {
|
|
73
|
+
window.removeEventListener('resize', resizeHandlerRef.current);
|
|
74
|
+
resizeHandlerRef.current = null;
|
|
75
|
+
}
|
|
76
|
+
if (timeoutRef.current) {
|
|
77
|
+
clearTimeout(timeoutRef.current);
|
|
78
|
+
timeoutRef.current = null;
|
|
79
|
+
}
|
|
80
|
+
if (debounceTimerRef.current) {
|
|
81
|
+
clearTimeout(debounceTimerRef.current);
|
|
82
|
+
debounceTimerRef.current = null;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
57
85
|
}, []);
|
|
58
86
|
|
|
59
87
|
useLayoutEffect(() => {
|
|
60
|
-
setTimeout(() => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
88
|
+
timeoutRef.current = setTimeout(() => {
|
|
89
|
+
if (!isUnmountedRef.current) {
|
|
90
|
+
const drawContentElement = document.getElementById("drawContent");
|
|
91
|
+
if (drawContentElement) {
|
|
92
|
+
let drawContentHeight = drawContentElement.scrollHeight;
|
|
93
|
+
if (drawContentHeight > rightMenuHeight) {
|
|
94
|
+
setMoreBtnShow(true);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}, 0);
|
|
99
|
+
|
|
100
|
+
return () => {
|
|
101
|
+
if (timeoutRef.current) {
|
|
102
|
+
clearTimeout(timeoutRef.current);
|
|
103
|
+
timeoutRef.current = null;
|
|
64
104
|
}
|
|
65
|
-
}
|
|
66
|
-
}, [])
|
|
105
|
+
};
|
|
106
|
+
}, [rightMenuHeight])
|
|
67
107
|
|
|
68
|
-
const getMenuContentHeight = () => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
108
|
+
const getMenuContentHeight = useCallback(() => {
|
|
109
|
+
if (!isUnmountedRef.current) {
|
|
110
|
+
let clientHeight = document.body.clientHeight;
|
|
111
|
+
setHeight(clientHeight - 190);
|
|
112
|
+
setDrawHeight(clientHeight - 70);
|
|
113
|
+
}
|
|
114
|
+
}, []);
|
|
73
115
|
|
|
74
116
|
|
|
75
|
-
const renderChildItem = (child) => {
|
|
117
|
+
const renderChildItem = useCallback((child) => {
|
|
76
118
|
if (!child.hideInMenu && child.children) {
|
|
77
119
|
return (
|
|
78
120
|
<>
|
|
@@ -102,9 +144,11 @@ const DrawContent = ({onClose, originRoutes=[], itemPath}: any) => {
|
|
|
102
144
|
</List.Item>
|
|
103
145
|
);
|
|
104
146
|
}
|
|
105
|
-
}
|
|
147
|
+
}, [onMenuClick]);
|
|
106
148
|
|
|
107
|
-
const onMenuClick = (e, item) => {
|
|
149
|
+
const onMenuClick = useCallback((e, item) => {
|
|
150
|
+
if (isUnmountedRef.current) return;
|
|
151
|
+
|
|
108
152
|
e.stopPropagation();
|
|
109
153
|
e.preventDefault();
|
|
110
154
|
let searchHistory = JSON.parse(localStorage.getItem(`${itemPath}_search_history`) || '[]');
|
|
@@ -127,7 +171,25 @@ const DrawContent = ({onClose, originRoutes=[], itemPath}: any) => {
|
|
|
127
171
|
pathname: item.path
|
|
128
172
|
})
|
|
129
173
|
onClose();
|
|
130
|
-
};
|
|
174
|
+
}, [itemPath, onClose]);
|
|
175
|
+
|
|
176
|
+
// 创建debounce搜索函数
|
|
177
|
+
const debouncedSearch = useCallback((value: string) => {
|
|
178
|
+
if (debounceTimerRef.current) {
|
|
179
|
+
clearTimeout(debounceTimerRef.current);
|
|
180
|
+
}
|
|
181
|
+
debounceTimerRef.current = setTimeout(() => {
|
|
182
|
+
if (!isUnmountedRef.current) {
|
|
183
|
+
searchMenuData(authorityMenu, value, setSearchMenuData);
|
|
184
|
+
}
|
|
185
|
+
}, 600);
|
|
186
|
+
}, [authorityMenu]);
|
|
187
|
+
|
|
188
|
+
const handleSearchChange = useCallback((e: any) => {
|
|
189
|
+
if (!isUnmountedRef.current) {
|
|
190
|
+
debouncedSearch(e.target.value);
|
|
191
|
+
}
|
|
192
|
+
}, [debouncedSearch]);
|
|
131
193
|
|
|
132
194
|
|
|
133
195
|
let searchHistoryList = JSON.parse(localStorage.getItem(`${itemPath}_search_history`) || '[]');
|
|
@@ -144,6 +206,7 @@ const DrawContent = ({onClose, originRoutes=[], itemPath}: any) => {
|
|
|
144
206
|
color: currentOneLevel === item.path ? '#005cff' : '#000000'
|
|
145
207
|
}}
|
|
146
208
|
onClick={(e) => {
|
|
209
|
+
if (isUnmountedRef.current) return;
|
|
147
210
|
e.stopPropagation();
|
|
148
211
|
e.preventDefault()
|
|
149
212
|
if (item.component) {
|
|
@@ -164,7 +227,11 @@ const DrawContent = ({onClose, originRoutes=[], itemPath}: any) => {
|
|
|
164
227
|
</div>
|
|
165
228
|
<div style={{flexGrow: 1, position: 'relative'}}>
|
|
166
229
|
<img
|
|
167
|
-
onClick={() => {
|
|
230
|
+
onClick={() => {
|
|
231
|
+
if (!isUnmountedRef.current) {
|
|
232
|
+
onClose();
|
|
233
|
+
}
|
|
234
|
+
}}
|
|
168
235
|
style={{position: 'absolute', right: '15px', top: '17px', cursor: 'pointer'}} width={24} src={closeicon} />
|
|
169
236
|
|
|
170
237
|
<div style={{ padding: '10px', marginBottom: '10px', width: '100%', }}>
|
|
@@ -173,9 +240,7 @@ const DrawContent = ({onClose, originRoutes=[], itemPath}: any) => {
|
|
|
173
240
|
placeholder="请输入关键词"
|
|
174
241
|
allowClear
|
|
175
242
|
prefix={<SearchOutlined />}
|
|
176
|
-
onChange={
|
|
177
|
-
searchMenuData(authorityMenu, e.target.value, setSearchMenuData);
|
|
178
|
-
}, 600)}
|
|
243
|
+
onChange={handleSearchChange}
|
|
179
244
|
/>
|
|
180
245
|
<div style={{marginTop: '10px'}}>
|
|
181
246
|
<span style={{ color: '#8c8c8c', opacity: '0.6' }}>最近访问: </span>
|
|
@@ -195,7 +260,9 @@ const DrawContent = ({onClose, originRoutes=[], itemPath}: any) => {
|
|
|
195
260
|
{
|
|
196
261
|
SearhData.map((item: any) => (
|
|
197
262
|
<div onClick={(e) => {
|
|
198
|
-
|
|
263
|
+
if (!isUnmountedRef.current) {
|
|
264
|
+
onMenuClick(e, item);
|
|
265
|
+
}
|
|
199
266
|
}} key={item.path}>{item.name}</div>
|
|
200
267
|
))
|
|
201
268
|
}
|
|
@@ -263,8 +330,10 @@ const DrawContent = ({onClose, originRoutes=[], itemPath}: any) => {
|
|
|
263
330
|
}}>
|
|
264
331
|
<span
|
|
265
332
|
onClick={() => {
|
|
266
|
-
|
|
267
|
-
|
|
333
|
+
if (!isUnmountedRef.current) {
|
|
334
|
+
setShowScroll(true);
|
|
335
|
+
setMoreBtnShow(false);
|
|
336
|
+
}
|
|
268
337
|
}}
|
|
269
338
|
style={{color: '#8c8c8c'}}
|
|
270
339
|
>
|