@zw-team/react-lib 1.0.1
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/README.md +207 -0
- package/dist/components/AccessReport/index.d.ts +29 -0
- package/dist/components/AccessReport/index.js +129 -0
- package/dist/components/Avatar/Avatar.d.ts +3 -0
- package/dist/components/Avatar/Avatar.js +58 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Avatar/types.d.ts +9 -0
- package/dist/components/Avatar/types.js +0 -0
- package/dist/components/Block/Block.css +8 -0
- package/dist/components/Block/Block.d.ts +4 -0
- package/dist/components/Block/Block.js +11 -0
- package/dist/components/Block/index.d.ts +2 -0
- package/dist/components/Block/index.js +2 -0
- package/dist/components/Block/types.d.ts +3 -0
- package/dist/components/Block/types.js +0 -0
- package/dist/components/ConfigProvider/ConfigContext.d.ts +4 -0
- package/dist/components/ConfigProvider/ConfigContext.js +19 -0
- package/dist/components/ConfigProvider/ConfigProvider.d.ts +4 -0
- package/dist/components/ConfigProvider/ConfigProvider.js +57 -0
- package/dist/components/ConfigProvider/index.d.ts +2 -0
- package/dist/components/ConfigProvider/index.js +2 -0
- package/dist/components/ConfigProvider/types.d.ts +19 -0
- package/dist/components/ConfigProvider/types.js +0 -0
- package/dist/components/CustomColumn/CustomColumn.d.ts +4 -0
- package/dist/components/CustomColumn/CustomColumn.js +388 -0
- package/dist/components/CustomColumn/CustomColumn.scss +135 -0
- package/dist/components/CustomColumn/index.d.ts +2 -0
- package/dist/components/CustomColumn/index.js +2 -0
- package/dist/components/CustomColumn/types.d.ts +19 -0
- package/dist/components/CustomColumn/types.js +0 -0
- package/dist/components/DatePicker/DatePicker.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.js +89 -0
- package/dist/components/DatePicker/datePickerOption.d.ts +14 -0
- package/dist/components/DatePicker/datePickerOption.js +149 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/index.js +2 -0
- package/dist/components/DatePicker/types.d.ts +12 -0
- package/dist/components/DatePicker/types.js +0 -0
- package/dist/components/DatePickerPanel/DatePickerPanel.d.ts +6 -0
- package/dist/components/DatePickerPanel/DatePickerPanel.js +397 -0
- package/dist/components/DatePickerPanel/datePickerPanel.scss +362 -0
- package/dist/components/DatePickerPanel/index.d.ts +2 -0
- package/dist/components/DatePickerPanel/index.js +2 -0
- package/dist/components/DatePickerPanel/type.d.ts +23 -0
- package/dist/components/DatePickerPanel/type.js +0 -0
- package/dist/components/DownloadCenter/DownloadCenter.d.ts +5 -0
- package/dist/components/DownloadCenter/DownloadCenter.js +367 -0
- package/dist/components/DownloadCenter/index.css +54 -0
- package/dist/components/DownloadCenter/index.d.ts +2 -0
- package/dist/components/DownloadCenter/index.js +2 -0
- package/dist/components/DownloadCenter/types.d.ts +27 -0
- package/dist/components/DownloadCenter/types.js +0 -0
- package/dist/components/Fireworks/Fireworks.d.ts +11 -0
- package/dist/components/Fireworks/Fireworks.js +415 -0
- package/dist/components/Fireworks/imgs/birthday-cake.svg +180 -0
- package/dist/components/Fireworks/imgs/hb.png +0 -0
- package/dist/components/Fireworks/imgs/sd.png +0 -0
- package/dist/components/Fireworks/imgs/xc.png +0 -0
- package/dist/components/Fireworks/imgs/yd.png +0 -0
- package/dist/components/Fireworks/index.d.ts +2 -0
- package/dist/components/Fireworks/index.js +2 -0
- package/dist/components/Fireworks/index.scss +9 -0
- package/dist/components/Fireworks/types.d.ts +6 -0
- package/dist/components/Fireworks/types.js +0 -0
- package/dist/components/Form/Form.css +4 -0
- package/dist/components/Form/Form.d.ts +9 -0
- package/dist/components/Form/Form.js +18 -0
- package/dist/components/Form/index.d.ts +1 -0
- package/dist/components/Form/index.js +2 -0
- package/dist/components/FormItem/FormItem.css +38 -0
- package/dist/components/FormItem/FormItem.d.ts +9 -0
- package/dist/components/FormItem/FormItem.js +25 -0
- package/dist/components/FormItem/index.d.ts +1 -0
- package/dist/components/FormItem/index.js +2 -0
- package/dist/components/HomeData/HomeData.d.ts +6 -0
- package/dist/components/HomeData/HomeData.js +364 -0
- package/dist/components/HomeData/HomeData.scss +161 -0
- package/dist/components/HomeData/index.d.ts +1 -0
- package/dist/components/HomeData/index.js +2 -0
- package/dist/components/Icon/Icon.d.ts +4 -0
- package/dist/components/Icon/Icon.js +34 -0
- package/dist/components/Icon/index.d.ts +2 -0
- package/dist/components/Icon/index.js +2 -0
- package/dist/components/Icon/types.d.ts +8 -0
- package/dist/components/Icon/types.js +0 -0
- package/dist/components/Log/index.d.ts +2 -0
- package/dist/components/Log/index.js +2 -0
- package/dist/components/Log/src/Detail.d.ts +7 -0
- package/dist/components/Log/src/Detail.js +71 -0
- package/dist/components/Log/src/Detail.scss +27 -0
- package/dist/components/Log/src/Log.d.ts +5 -0
- package/dist/components/Log/src/Log.js +335 -0
- package/dist/components/Log/src/Log.scss +50 -0
- package/dist/components/Log/src/useLogTableColumns.d.ts +2 -0
- package/dist/components/Log/src/useLogTableColumns.js +141 -0
- package/dist/components/Log/types.d.ts +5 -0
- package/dist/components/Log/types.js +0 -0
- package/dist/components/LogButton/LogButton.d.ts +4 -0
- package/dist/components/LogButton/LogButton.js +30 -0
- package/dist/components/LogButton/index.d.ts +2 -0
- package/dist/components/LogButton/index.js +2 -0
- package/dist/components/LogButton/logbutton.css +15 -0
- package/dist/components/LogButton/types.d.ts +10 -0
- package/dist/components/LogButton/types.js +0 -0
- package/dist/components/LogDialog/BiLogManager.d.ts +29 -0
- package/dist/components/LogDialog/BiLogManager.js +78 -0
- package/dist/components/LogDialog/LogDialog.d.ts +8 -0
- package/dist/components/LogDialog/LogDialog.js +106 -0
- package/dist/components/LogDialog/LogDialog.scss +29 -0
- package/dist/components/LogDialog/index.d.ts +3 -0
- package/dist/components/LogDialog/index.js +3 -0
- package/dist/components/LogDialog/types.d.ts +8 -0
- package/dist/components/LogDialog/types.js +0 -0
- package/dist/components/MediaPreview/MediaPreview.d.ts +5 -0
- package/dist/components/MediaPreview/MediaPreview.js +124 -0
- package/dist/components/MediaPreview/hook.d.ts +26 -0
- package/dist/components/MediaPreview/hook.js +174 -0
- package/dist/components/MediaPreview/index.css +202 -0
- package/dist/components/MediaPreview/index.d.ts +2 -0
- package/dist/components/MediaPreview/index.js +2 -0
- package/dist/components/MediaPreview/types.d.ts +24 -0
- package/dist/components/MediaPreview/types.js +0 -0
- package/dist/components/Modal/Modal.d.ts +3 -0
- package/dist/components/Modal/Modal.js +31 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/Modal/index.js +2 -0
- package/dist/components/Modal/types.d.ts +8 -0
- package/dist/components/Modal/types.js +0 -0
- package/dist/components/ModalStore/ModalProvider.d.ts +11 -0
- package/dist/components/ModalStore/ModalProvider.js +15 -0
- package/dist/components/ModalStore/ModalStore.d.ts +78 -0
- package/dist/components/ModalStore/ModalStore.js +188 -0
- package/dist/components/ModalStore/index.d.ts +3 -0
- package/dist/components/ModalStore/index.js +4 -0
- package/dist/components/ModalStore/types.d.ts +73 -0
- package/dist/components/ModalStore/types.js +0 -0
- package/dist/components/MoreButton/MoreButton.d.ts +3 -0
- package/dist/components/MoreButton/MoreButton.js +50 -0
- package/dist/components/MoreButton/index.d.ts +2 -0
- package/dist/components/MoreButton/index.js +2 -0
- package/dist/components/MoreButton/types.d.ts +15 -0
- package/dist/components/MoreButton/types.js +0 -0
- package/dist/components/NavbarTool/NavbarTool.d.ts +5 -0
- package/dist/components/NavbarTool/NavbarTool.js +143 -0
- package/dist/components/NavbarTool/components/index.css +49 -0
- package/dist/components/NavbarTool/components/index.d.ts +5 -0
- package/dist/components/NavbarTool/components/index.js +98 -0
- package/dist/components/NavbarTool/index.css +14 -0
- package/dist/components/NavbarTool/index.d.ts +2 -0
- package/dist/components/NavbarTool/index.js +2 -0
- package/dist/components/NavbarTool/types.d.ts +40 -0
- package/dist/components/NavbarTool/types.js +0 -0
- package/dist/components/NoticeCenter/NoticeCenter.d.ts +4 -0
- package/dist/components/NoticeCenter/NoticeCenter.js +334 -0
- package/dist/components/NoticeCenter/assets/notice.png +0 -0
- package/dist/components/NoticeCenter/assets/tongzhi.png +0 -0
- package/dist/components/NoticeCenter/index.d.ts +2 -0
- package/dist/components/NoticeCenter/index.js +2 -0
- package/dist/components/NoticeCenter/noticeCenter.scss +232 -0
- package/dist/components/NoticeCenter/types.d.ts +6 -0
- package/dist/components/NoticeCenter/types.js +0 -0
- package/dist/components/Pagination/BiPagination.css +152 -0
- package/dist/components/Pagination/Pagination.d.ts +5 -0
- package/dist/components/Pagination/Pagination.js +67 -0
- package/dist/components/Pagination/index.d.ts +2 -0
- package/dist/components/Pagination/index.js +2 -0
- package/dist/components/Pagination/types.d.ts +14 -0
- package/dist/components/Pagination/types.js +0 -0
- package/dist/components/ResponseInterceptor/index.d.ts +17 -0
- package/dist/components/ResponseInterceptor/index.js +43 -0
- package/dist/components/SuperDate/SuperDate.d.ts +6 -0
- package/dist/components/SuperDate/SuperDate.js +113 -0
- package/dist/components/SuperDate/SuperDate.scss +42 -0
- package/dist/components/SuperDate/components/CustomRangPanel/CustomRangPanel.d.ts +5 -0
- package/dist/components/SuperDate/components/CustomRangPanel/CustomRangPanel.js +87 -0
- package/dist/components/SuperDate/components/CustomRangPanel/CustomRangPanel.scss +52 -0
- package/dist/components/SuperDate/components/DynamicTimeCom/DynamicTimeCom.d.ts +6 -0
- package/dist/components/SuperDate/components/DynamicTimeCom/DynamicTimeCom.js +129 -0
- package/dist/components/SuperDate/components/DynamicTimeCom/dynamicTimeCom.scss +70 -0
- package/dist/components/SuperDate/constant.d.ts +35 -0
- package/dist/components/SuperDate/constant.js +27 -0
- package/dist/components/SuperDate/index.d.ts +2 -0
- package/dist/components/SuperDate/index.js +2 -0
- package/dist/components/SuperDate/store.d.ts +68 -0
- package/dist/components/SuperDate/store.js +254 -0
- package/dist/components/SuperDate/types.d.ts +34 -0
- package/dist/components/SuperDate/types.js +0 -0
- package/dist/components/SuperDate/utils.d.ts +18 -0
- package/dist/components/SuperDate/utils.js +14 -0
- package/dist/components/SystemLink/SystemLink.d.ts +4 -0
- package/dist/components/SystemLink/SystemLink.js +85 -0
- package/dist/components/SystemLink/index.d.ts +1 -0
- package/dist/components/SystemLink/index.js +2 -0
- package/dist/components/SystemLink/index.scss +142 -0
- package/dist/components/Table/ResizableTitle.d.ts +3 -0
- package/dist/components/Table/ResizableTitle.js +43 -0
- package/dist/components/Table/Table.d.ts +9 -0
- package/dist/components/Table/Table.js +189 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/Table/index.js +2 -0
- package/dist/components/Table/index.scss +42 -0
- package/dist/components/Table/types.d.ts +24 -0
- package/dist/components/Table/types.js +0 -0
- package/dist/components/Table/useHeaderPopper.d.ts +8 -0
- package/dist/components/Table/useHeaderPopper.js +95 -0
- package/dist/components/TableHeaderPopper/EditBox.d.ts +6 -0
- package/dist/components/TableHeaderPopper/EditBox.js +208 -0
- package/dist/components/TableHeaderPopper/Popover.d.ts +6 -0
- package/dist/components/TableHeaderPopper/Popover.js +85 -0
- package/dist/components/TableHeaderPopper/index.d.ts +3 -0
- package/dist/components/TableHeaderPopper/index.js +3 -0
- package/dist/components/TableHeaderPopper/index.scss +96 -0
- package/dist/components/TaskCenter/TaskCenter.d.ts +4 -0
- package/dist/components/TaskCenter/TaskCenter.js +257 -0
- package/dist/components/TaskCenter/TaskCenter.scss +44 -0
- package/dist/components/TaskCenter/api.d.ts +13 -0
- package/dist/components/TaskCenter/api.js +13 -0
- package/dist/components/TaskCenter/index.d.ts +2 -0
- package/dist/components/TaskCenter/index.js +2 -0
- package/dist/components/TaskCenter/types.d.ts +29 -0
- package/dist/components/TaskCenter/types.js +0 -0
- package/dist/components/TooltipIcon/TooltipIcon.d.ts +3 -0
- package/dist/components/TooltipIcon/TooltipIcon.js +43 -0
- package/dist/components/TooltipIcon/index.d.ts +2 -0
- package/dist/components/TooltipIcon/index.js +2 -0
- package/dist/components/TooltipIcon/types.d.ts +14 -0
- package/dist/components/TooltipIcon/types.js +0 -0
- package/dist/components/Verification/content.d.ts +11 -0
- package/dist/components/Verification/content.js +223 -0
- package/dist/components/Verification/index.css +43 -0
- package/dist/components/Verification/index.d.ts +1 -0
- package/dist/components/Verification/index.js +37 -0
- package/dist/components/index.d.ts +32 -0
- package/dist/components/index.js +29 -0
- package/dist/config/index.d.ts +83 -0
- package/dist/config/index.js +115 -0
- package/dist/config/theme/index.d.ts +368 -0
- package/dist/config/theme/index.js +369 -0
- package/dist/hooks/createAlive.d.ts +11 -0
- package/dist/hooks/createAlive.js +22 -0
- package/dist/hooks/createGlobalState.d.ts +7 -0
- package/dist/hooks/createGlobalState.js +28 -0
- package/dist/hooks/index.d.ts +26 -0
- package/dist/hooks/index.js +25 -0
- package/dist/hooks/useAsync.d.ts +27 -0
- package/dist/hooks/useAsync.js +76 -0
- package/dist/hooks/useClickOther.d.ts +10 -0
- package/dist/hooks/useClickOther.js +30 -0
- package/dist/hooks/useCopyToClipboard.d.ts +7 -0
- package/dist/hooks/useCopyToClipboard.js +32 -0
- package/dist/hooks/useCreate.d.ts +7 -0
- package/dist/hooks/useCreate.js +21 -0
- package/dist/hooks/useEventListener.d.ts +22 -0
- package/dist/hooks/useEventListener.js +33 -0
- package/dist/hooks/useHistoryStore.d.ts +16 -0
- package/dist/hooks/useHistoryStore.js +106 -0
- package/dist/hooks/useIntersectionObserver.d.ts +8 -0
- package/dist/hooks/useIntersectionObserver.js +23 -0
- package/dist/hooks/useInterval.d.ts +8 -0
- package/dist/hooks/useInterval.js +19 -0
- package/dist/hooks/useLatest.d.ts +2 -0
- package/dist/hooks/useLatest.js +12 -0
- package/dist/hooks/useLockAsyncFn.d.ts +7 -0
- package/dist/hooks/useLockAsyncFn.js +24 -0
- package/dist/hooks/useLockFn.d.ts +7 -0
- package/dist/hooks/useLockFn.js +17 -0
- package/dist/hooks/useMergedState.d.ts +10 -0
- package/dist/hooks/useMergedState.js +30 -0
- package/dist/hooks/useMountedState.d.ts +4 -0
- package/dist/hooks/useMountedState.js +13 -0
- package/dist/hooks/usePermission.d.ts +8 -0
- package/dist/hooks/usePermission.js +21 -0
- package/dist/hooks/usePersistFn.d.ts +8 -0
- package/dist/hooks/usePersistFn.js +13 -0
- package/dist/hooks/useReactive.d.ts +7 -0
- package/dist/hooks/useReactive.js +34 -0
- package/dist/hooks/useRefresh.d.ts +5 -0
- package/dist/hooks/useRefresh.js +8 -0
- package/dist/hooks/useToggle.d.ts +16 -0
- package/dist/hooks/useToggle.js +20 -0
- package/dist/hooks/useUnmount.d.ts +6 -0
- package/dist/hooks/useUnmount.js +10 -0
- package/dist/hooks/useUpdateEffect.d.ts +9 -0
- package/dist/hooks/useUpdateEffect.js +10 -0
- package/dist/hooks/useWindowSize.d.ts +6 -0
- package/dist/hooks/useWindowSize.js +15 -0
- package/dist/hooks/util.d.ts +9 -0
- package/dist/hooks/util.js +6 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -0
- package/dist/utils/array.d.ts +12 -0
- package/dist/utils/array.js +15 -0
- package/dist/utils/classNames.d.ts +4 -0
- package/dist/utils/classNames.js +19 -0
- package/dist/utils/date.d.ts +98 -0
- package/dist/utils/date.js +101 -0
- package/dist/utils/debounce.d.ts +8 -0
- package/dist/utils/debounce.js +38 -0
- package/dist/utils/deepClone.d.ts +6 -0
- package/dist/utils/deepClone.js +10 -0
- package/dist/utils/empty.d.ts +16 -0
- package/dist/utils/empty.js +24 -0
- package/dist/utils/formatPrice.d.ts +2 -0
- package/dist/utils/formatPrice.js +15 -0
- package/dist/utils/getUUID.d.ts +1 -0
- package/dist/utils/getUUID.js +17 -0
- package/dist/utils/getUrlParams.d.ts +11 -0
- package/dist/utils/getUrlParams.js +10 -0
- package/dist/utils/index.d.ts +20 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/listToTree.d.ts +12 -0
- package/dist/utils/listToTree.js +14 -0
- package/dist/utils/object.d.ts +6 -0
- package/dist/utils/object.js +5 -0
- package/dist/utils/ossUpload.d.ts +45 -0
- package/dist/utils/ossUpload.js +88 -0
- package/dist/utils/parseTo.d.ts +6 -0
- package/dist/utils/parseTo.js +9 -0
- package/dist/utils/request/accessReport.d.ts +2 -0
- package/dist/utils/request/accessReport.js +27 -0
- package/dist/utils/request/defaultRequest.d.ts +9 -0
- package/dist/utils/request/defaultRequest.js +33 -0
- package/dist/utils/request/exportDownload.d.ts +2 -0
- package/dist/utils/request/exportDownload.js +28 -0
- package/dist/utils/request/index.d.ts +29 -0
- package/dist/utils/request/index.js +40 -0
- package/dist/utils/request/noticeCenter.d.ts +2 -0
- package/dist/utils/request/noticeCenter.js +28 -0
- package/dist/utils/svgIcon/index.d.ts +47 -0
- package/dist/utils/svgIcon/index.js +76 -0
- package/dist/utils/throttle.d.ts +10 -0
- package/dist/utils/throttle.js +21 -0
- package/dist/utils/time/index.d.ts +7 -0
- package/dist/utils/time/index.js +12 -0
- package/dist/utils/tools.d.ts +43 -0
- package/dist/utils/tools.js +57 -0
- package/package.json +116 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Popover } from "antd";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import request from "../../utils/request/index.js";
|
|
5
|
+
import { getEnv, getToken } from "../../utils/tools.js";
|
|
6
|
+
import "./index.scss";
|
|
7
|
+
const SystemLink = ()=>{
|
|
8
|
+
const [systemList, setSystemList] = useState([]);
|
|
9
|
+
useEffect(()=>{
|
|
10
|
+
getSystemList();
|
|
11
|
+
}, []);
|
|
12
|
+
const getSystemList = async ()=>{
|
|
13
|
+
try {
|
|
14
|
+
const env = getEnv();
|
|
15
|
+
const res = await request({
|
|
16
|
+
env,
|
|
17
|
+
system: 'zq',
|
|
18
|
+
api: '/api/index/system'
|
|
19
|
+
});
|
|
20
|
+
if (1 === res.status_code) setSystemList(res.data || []);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error('获取系统列表失败:', error);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const getTokenParamType = (link)=>{
|
|
26
|
+
if (link.includes('/sso')) return 'token';
|
|
27
|
+
if (link.includes('/public/sso')) return 'authorization';
|
|
28
|
+
if ('http://scan.lzyl99.com/sso' === link || 'http://wechatbi.lzyl99.com/login/authorization' === link) return 'authorization';
|
|
29
|
+
return '';
|
|
30
|
+
};
|
|
31
|
+
const buildSystemUrl = (link)=>{
|
|
32
|
+
const tokenParam = getTokenParamType(link);
|
|
33
|
+
return tokenParam ? `${link}?${tokenParam}=${getToken()}` : link;
|
|
34
|
+
};
|
|
35
|
+
const goSystem = (system)=>{
|
|
36
|
+
const url = buildSystemUrl(system.link);
|
|
37
|
+
window.open(url, '_blank');
|
|
38
|
+
};
|
|
39
|
+
const renderSystemItem = (item)=>/*#__PURE__*/ jsxs("div", {
|
|
40
|
+
className: "system-item",
|
|
41
|
+
onClick: ()=>goSystem(item),
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ jsx("div", {
|
|
44
|
+
className: "system-logo",
|
|
45
|
+
children: /*#__PURE__*/ jsx("img", {
|
|
46
|
+
src: item.logo_path,
|
|
47
|
+
alt: item.short_name
|
|
48
|
+
})
|
|
49
|
+
}),
|
|
50
|
+
/*#__PURE__*/ jsx("p", {
|
|
51
|
+
className: "system-name",
|
|
52
|
+
children: item.short_name
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ jsx("p", {
|
|
55
|
+
className: "go-system",
|
|
56
|
+
children: "前往平台"
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
}, item.id);
|
|
60
|
+
const popoverContent = /*#__PURE__*/ jsx("div", {
|
|
61
|
+
className: "system-list",
|
|
62
|
+
children: systemList.map(renderSystemItem)
|
|
63
|
+
});
|
|
64
|
+
return /*#__PURE__*/ jsx("div", {
|
|
65
|
+
className: "bi-system-link",
|
|
66
|
+
children: /*#__PURE__*/ jsx(Popover, {
|
|
67
|
+
placement: "top",
|
|
68
|
+
trigger: "hover",
|
|
69
|
+
overlayClassName: "system-link-popper",
|
|
70
|
+
content: popoverContent,
|
|
71
|
+
destroyTooltipOnHide: true,
|
|
72
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
73
|
+
type: "text",
|
|
74
|
+
className: "system-link-button",
|
|
75
|
+
"aria-label": "系统链接",
|
|
76
|
+
icon: /*#__PURE__*/ jsx("span", {
|
|
77
|
+
className: "button-icon-dot",
|
|
78
|
+
children: "⋮⋮⋮"
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
const SystemLink_SystemLink = SystemLink;
|
|
85
|
+
export { SystemLink_SystemLink as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BiSystemLink } from './SystemLink';
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
.bi-system-link {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
|
|
5
|
+
> span {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.system-link-button {
|
|
12
|
+
padding: 3px;
|
|
13
|
+
width: 32px;
|
|
14
|
+
height: 32px;
|
|
15
|
+
display: block;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
|
|
19
|
+
.anticon {
|
|
20
|
+
font-size: 24px;
|
|
21
|
+
color: #4e5969;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:hover {
|
|
25
|
+
background-color: #f2f3f5;
|
|
26
|
+
|
|
27
|
+
.anticon {
|
|
28
|
+
color: #4e5969;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
span {
|
|
33
|
+
display: block;
|
|
34
|
+
height: 100%;
|
|
35
|
+
width: 100%;
|
|
36
|
+
}
|
|
37
|
+
.icon-span {
|
|
38
|
+
position: relative;
|
|
39
|
+
.anticon-more {
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.button-icon-dot {
|
|
45
|
+
font-size: 24px;
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.system-list {
|
|
51
|
+
max-width: 585px;
|
|
52
|
+
padding: 20px;
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-wrap: wrap;
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
|
|
57
|
+
.system-item {
|
|
58
|
+
text-align: center;
|
|
59
|
+
width: 100px;
|
|
60
|
+
flex-grow: 0;
|
|
61
|
+
flex-shrink: 0;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
margin-bottom: 10px;
|
|
64
|
+
margin-right: 10px;
|
|
65
|
+
border-radius: 4px;
|
|
66
|
+
transition: background-color 0.3s;
|
|
67
|
+
position: relative;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
|
|
70
|
+
&:nth-child(5n) {
|
|
71
|
+
margin-right: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&:hover {
|
|
75
|
+
background-color: rgba(155, 232, 203, 0.2);
|
|
76
|
+
|
|
77
|
+
.go-system {
|
|
78
|
+
bottom: 0;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.system-logo {
|
|
83
|
+
transition: all 0.1s;
|
|
84
|
+
width: 48px;
|
|
85
|
+
height: 48px;
|
|
86
|
+
display: flex;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
align-items: center;
|
|
89
|
+
border-radius: 8px;
|
|
90
|
+
border: 1px solid #f2f3f5;
|
|
91
|
+
margin: 10px auto 8px;
|
|
92
|
+
background-color: #ffffff;
|
|
93
|
+
|
|
94
|
+
img {
|
|
95
|
+
width: 80%;
|
|
96
|
+
height: 80%;
|
|
97
|
+
object-fit: contain;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.system-name {
|
|
102
|
+
line-height: 26px;
|
|
103
|
+
height: 26px;
|
|
104
|
+
margin: 0;
|
|
105
|
+
font-size: 14px;
|
|
106
|
+
font-weight: 400;
|
|
107
|
+
color: #333333;
|
|
108
|
+
overflow: hidden;
|
|
109
|
+
white-space: nowrap;
|
|
110
|
+
text-overflow: ellipsis;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.go-system {
|
|
114
|
+
line-height: 26px;
|
|
115
|
+
height: 26px;
|
|
116
|
+
margin: 0;
|
|
117
|
+
background: #00bf8a;
|
|
118
|
+
border-radius: 0px 0px 4px 4px;
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
font-weight: 400;
|
|
121
|
+
color: #ffffff;
|
|
122
|
+
position: absolute;
|
|
123
|
+
bottom: -26px;
|
|
124
|
+
transition: bottom ease-in 0.1s;
|
|
125
|
+
left: 0;
|
|
126
|
+
width: 100%;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// 弹出框样式
|
|
132
|
+
.system-link-popper {
|
|
133
|
+
padding: 0 !important;
|
|
134
|
+
|
|
135
|
+
.ant-popover-inner {
|
|
136
|
+
border-radius: 8px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.ant-popover-inner-content {
|
|
140
|
+
padding: 0;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Resizable } from "react-resizable";
|
|
3
|
+
import "react-resizable/css/styles.css";
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
const clearSelection = ()=>{
|
|
6
|
+
if (window.getSelection) {
|
|
7
|
+
const selection = window.getSelection();
|
|
8
|
+
if (selection) {
|
|
9
|
+
if (selection.empty) selection.empty();
|
|
10
|
+
else if (selection.removeAllRanges) selection.removeAllRanges();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const ResizableTitle_ResizableTitle = (props)=>{
|
|
15
|
+
const { onResize, width, ...restProps } = props;
|
|
16
|
+
if (!width) return /*#__PURE__*/ jsx("th", {
|
|
17
|
+
...restProps
|
|
18
|
+
});
|
|
19
|
+
useEffect(()=>{
|
|
20
|
+
document.querySelectorAll('.react-resizable-handle').forEach((elem)=>{
|
|
21
|
+
if (elem.onclick) return;
|
|
22
|
+
elem.onclick = (event)=>{
|
|
23
|
+
event.stopPropagation();
|
|
24
|
+
return false;
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
}, []);
|
|
28
|
+
return /*#__PURE__*/ jsx(Resizable, {
|
|
29
|
+
width: width,
|
|
30
|
+
height: 0,
|
|
31
|
+
onResize: onResize,
|
|
32
|
+
draggableOpts: {
|
|
33
|
+
onMouseDown: (e)=>{
|
|
34
|
+
clearSelection();
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
children: /*#__PURE__*/ jsx("th", {
|
|
38
|
+
...restProps
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const ResizableTitle = ResizableTitle_ResizableTitle;
|
|
43
|
+
export { ResizableTitle as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { BiTableProps } from './types';
|
|
3
|
+
import './index.scss';
|
|
4
|
+
export declare const useBiTable: () => Record<string, any>;
|
|
5
|
+
type BiTableComponent = React.FC<BiTableProps> & {
|
|
6
|
+
Resizable: React.FC<BiTableProps>;
|
|
7
|
+
};
|
|
8
|
+
declare const BiTableWithStatic: BiTableComponent;
|
|
9
|
+
export default BiTableWithStatic;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Empty, Table, Typography } from "antd";
|
|
3
|
+
import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { isNumeric } from "../../utils/index.js";
|
|
5
|
+
import { TableHeaderEditBox, TableHeaderPopper } from "../TableHeaderPopper/index.js";
|
|
6
|
+
import ResizableTitle from "./ResizableTitle.js";
|
|
7
|
+
import { useHeaderPopper } from "./useHeaderPopper.js";
|
|
8
|
+
import "./index.scss";
|
|
9
|
+
const BiTableContext = /*#__PURE__*/ createContext(null);
|
|
10
|
+
const useBiTable = ()=>{
|
|
11
|
+
const context = useContext(BiTableContext);
|
|
12
|
+
if (!context) throw new Error('useBiTable must be used within BiTableProvider');
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
15
|
+
const getSummaryKey = (column)=>{
|
|
16
|
+
const columnMap = {};
|
|
17
|
+
column.forEach((item, index)=>{
|
|
18
|
+
if (index && !item.noSummary) columnMap[item.dataIndex] = {
|
|
19
|
+
index,
|
|
20
|
+
val: 0
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
return columnMap;
|
|
24
|
+
};
|
|
25
|
+
const { Text } = Typography;
|
|
26
|
+
const BiTable = (props)=>{
|
|
27
|
+
const { data = [], column = [], pagination = null, stickyTop = '', headerPopperType = '', showSummary = false, sumText = '合计', summaryMethod = null, loading = false, locale = {}, ...restProps } = props;
|
|
28
|
+
const headerPopper = useHeaderPopper(headerPopperType);
|
|
29
|
+
const TableHeaderEditBoxRef = useRef(null);
|
|
30
|
+
const handleTableHeaderDbClick = (prop)=>{
|
|
31
|
+
if (TableHeaderEditBoxRef.current && headerPopper && headerPopper.editEnabled && prop) TableHeaderEditBoxRef.current.show(prop);
|
|
32
|
+
};
|
|
33
|
+
const formatColumns = useMemo(()=>{
|
|
34
|
+
const formatFn = (columnData)=>{
|
|
35
|
+
const column = Object.assign({}, columnData);
|
|
36
|
+
if ('function' == typeof column.width) column.width = column.width();
|
|
37
|
+
if ('function' == typeof column.minWidth) column.minWidth = column.minWidth();
|
|
38
|
+
const originalTitle = column.title;
|
|
39
|
+
column.title = 'function' == typeof originalTitle && null != originalTitle ? (props)=>/*#__PURE__*/ jsxs("div", {
|
|
40
|
+
onDoubleClick: ()=>handleTableHeaderDbClick(column.dataIndex),
|
|
41
|
+
style: {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
justifyContent: 'center'
|
|
45
|
+
},
|
|
46
|
+
children: [
|
|
47
|
+
originalTitle(props),
|
|
48
|
+
headerPopperType && /*#__PURE__*/ jsx(TableHeaderPopper, {
|
|
49
|
+
prop: column.dataIndex
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
}) : /*#__PURE__*/ jsxs("div", {
|
|
53
|
+
onDoubleClick: ()=>handleTableHeaderDbClick(column.dataIndex),
|
|
54
|
+
style: {
|
|
55
|
+
display: 'flex',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
justifyContent: 'center'
|
|
58
|
+
},
|
|
59
|
+
children: [
|
|
60
|
+
originalTitle,
|
|
61
|
+
headerPopperType && /*#__PURE__*/ jsx(TableHeaderPopper, {
|
|
62
|
+
prop: column.dataIndex
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
if (column.children && Array.isArray(column.children)) column.children = column.children?.map((item)=>formatFn(item));
|
|
67
|
+
return column;
|
|
68
|
+
};
|
|
69
|
+
return column.map((col)=>formatFn(col));
|
|
70
|
+
}, [
|
|
71
|
+
column
|
|
72
|
+
]);
|
|
73
|
+
const formatSticky = useMemo(()=>stickyTop ? {
|
|
74
|
+
offsetHeader: stickyTop
|
|
75
|
+
} : {}, [
|
|
76
|
+
stickyTop
|
|
77
|
+
]);
|
|
78
|
+
const summaryRender = useCallback((pageData)=>{
|
|
79
|
+
if (!showSummary) return null;
|
|
80
|
+
let columnMap = getSummaryKey(column);
|
|
81
|
+
if (summaryMethod && 'function' == typeof summaryMethod) {
|
|
82
|
+
const source = summaryMethod(pageData);
|
|
83
|
+
columnMap = {};
|
|
84
|
+
Object.keys(source).forEach((key)=>{
|
|
85
|
+
const idx = column.findIndex((c)=>c.dataIndex === key);
|
|
86
|
+
if (-1 !== idx) columnMap[key] = {
|
|
87
|
+
index: idx,
|
|
88
|
+
val: source[key]
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
} else for(const key in columnMap)pageData.forEach((item)=>{
|
|
92
|
+
if (item[key] && isNumeric(item[key])) columnMap[key].val += parseFloat(item[key]);
|
|
93
|
+
});
|
|
94
|
+
console.log(columnMap, 123123123);
|
|
95
|
+
return /*#__PURE__*/ jsx(Table.Summary, {
|
|
96
|
+
fixed: true,
|
|
97
|
+
children: /*#__PURE__*/ jsxs(Table.Summary.Row, {
|
|
98
|
+
children: [
|
|
99
|
+
'function' != typeof summaryMethod && /*#__PURE__*/ jsx(Table.Summary.Cell, {
|
|
100
|
+
index: 0,
|
|
101
|
+
children: sumText
|
|
102
|
+
}),
|
|
103
|
+
Object.keys(columnMap).map((cell)=>/*#__PURE__*/ jsx(Table.Summary.Cell, {
|
|
104
|
+
index: columnMap[cell].index,
|
|
105
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
106
|
+
children: columnMap[cell].val || ''
|
|
107
|
+
})
|
|
108
|
+
}, columnMap[cell].index))
|
|
109
|
+
]
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
}, [
|
|
113
|
+
showSummary,
|
|
114
|
+
sumText,
|
|
115
|
+
summaryMethod,
|
|
116
|
+
column
|
|
117
|
+
]);
|
|
118
|
+
return /*#__PURE__*/ jsxs(BiTableContext.Provider, {
|
|
119
|
+
value: {
|
|
120
|
+
headerPopper
|
|
121
|
+
},
|
|
122
|
+
children: [
|
|
123
|
+
/*#__PURE__*/ jsx(Table, {
|
|
124
|
+
dataSource: data,
|
|
125
|
+
sticky: formatSticky,
|
|
126
|
+
columns: formatColumns,
|
|
127
|
+
pagination: pagination || false,
|
|
128
|
+
summary: summaryRender,
|
|
129
|
+
loading: {
|
|
130
|
+
spinning: loading,
|
|
131
|
+
indicator: /*#__PURE__*/ jsx("div", {
|
|
132
|
+
className: "bi-table-loading-mask"
|
|
133
|
+
})
|
|
134
|
+
},
|
|
135
|
+
locale: {
|
|
136
|
+
emptyText: /*#__PURE__*/ jsx(Empty, {
|
|
137
|
+
styles: {
|
|
138
|
+
image: {
|
|
139
|
+
height: 0
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
description: /*#__PURE__*/ jsx("div", {
|
|
143
|
+
className: "bi-table-empty"
|
|
144
|
+
})
|
|
145
|
+
}),
|
|
146
|
+
...locale
|
|
147
|
+
},
|
|
148
|
+
...restProps
|
|
149
|
+
}),
|
|
150
|
+
/*#__PURE__*/ jsx(TableHeaderEditBox, {
|
|
151
|
+
ref: TableHeaderEditBoxRef
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
const ResizableBiTable = (props)=>{
|
|
157
|
+
const { column, ...restProps } = props;
|
|
158
|
+
const [columns, setColumns] = useState(column);
|
|
159
|
+
const handleResize = (key)=>(e, { size })=>{
|
|
160
|
+
setColumns((columns)=>columns.map((column)=>{
|
|
161
|
+
if (column.key === key) return {
|
|
162
|
+
...column,
|
|
163
|
+
width: size.width
|
|
164
|
+
};
|
|
165
|
+
return column;
|
|
166
|
+
}));
|
|
167
|
+
};
|
|
168
|
+
const columnsWithResize = columns.map((col, index)=>({
|
|
169
|
+
...col,
|
|
170
|
+
onHeaderCell: (column)=>({
|
|
171
|
+
width: column.width,
|
|
172
|
+
onResize: handleResize(col.key)
|
|
173
|
+
})
|
|
174
|
+
}));
|
|
175
|
+
return /*#__PURE__*/ jsx(BiTable, {
|
|
176
|
+
components: {
|
|
177
|
+
header: {
|
|
178
|
+
cell: ResizableTitle
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
column: columnsWithResize,
|
|
182
|
+
...restProps
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
const BiTableWithStatic = Object.assign(BiTable, {
|
|
186
|
+
Resizable: ResizableBiTable
|
|
187
|
+
});
|
|
188
|
+
const Table_Table = BiTableWithStatic;
|
|
189
|
+
export { Table_Table as default, useBiTable };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.react-resizable-handle{
|
|
2
|
+
background-color:transparent;
|
|
3
|
+
right: 0;
|
|
4
|
+
top: 0;
|
|
5
|
+
height: 100%;
|
|
6
|
+
width: 2px;
|
|
7
|
+
cursor: col-resize;
|
|
8
|
+
}
|
|
9
|
+
.bi-table-loading-mask{
|
|
10
|
+
background-image: url(https://wanxiaomeng-1255977238.file.myqcloud.com/bi-eleme/loading.gif);
|
|
11
|
+
background-size: auto 120px;
|
|
12
|
+
background-repeat: no-repeat;
|
|
13
|
+
background-position: 50%;
|
|
14
|
+
position: absolute !important;
|
|
15
|
+
z-index: 2000;
|
|
16
|
+
margin: 0;
|
|
17
|
+
top: 50% !important;
|
|
18
|
+
transform: translate(-50%,-50%) !important;
|
|
19
|
+
right: 0 !important;
|
|
20
|
+
bottom: 0 !important;
|
|
21
|
+
left: 50% !important;
|
|
22
|
+
width: auto !important;
|
|
23
|
+
height: auto !important;
|
|
24
|
+
transition: opacity .3s;
|
|
25
|
+
}
|
|
26
|
+
.ant-spin{
|
|
27
|
+
max-height: none !important;
|
|
28
|
+
}
|
|
29
|
+
.bi-table-empty{
|
|
30
|
+
height: 250px;
|
|
31
|
+
text-align: center;
|
|
32
|
+
width: 100%;
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
align-items: center;
|
|
36
|
+
background-image: url(https://wanxiaomeng-1255977238.file.myqcloud.com/bi-eleme/empty.png);
|
|
37
|
+
background-size: 240px auto;
|
|
38
|
+
background-repeat: no-repeat;
|
|
39
|
+
background-position: 50%;
|
|
40
|
+
opacity: .6;
|
|
41
|
+
transition: opacity .1s ease-in-out;
|
|
42
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PaginationProps, TableColumnsType, TableProps } from 'antd';
|
|
2
|
+
import type { ColumnType } from 'antd/es/table';
|
|
3
|
+
interface BiColumnExtra {
|
|
4
|
+
width?: number | string | (() => number);
|
|
5
|
+
minWidth?: number | string | (() => number);
|
|
6
|
+
noSummary?: boolean;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export type BiColumn = Omit<ColumnType<any>, 'width' | 'minWidth'> & BiColumnExtra;
|
|
10
|
+
export type BiColumns = TableColumnsType & Record<string, unknown>[];
|
|
11
|
+
export interface CustomerTableProps {
|
|
12
|
+
data: any[];
|
|
13
|
+
column: BiColumns;
|
|
14
|
+
pagination?: PaginationProps;
|
|
15
|
+
stickyTop?: number;
|
|
16
|
+
headerPopperType?: string;
|
|
17
|
+
showSummary?: boolean;
|
|
18
|
+
sumText?: string;
|
|
19
|
+
summaryMethod?: (data: any[]) => Record<string, any>;
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
export type BiTableProps = CustomerTableProps & TableProps;
|
|
24
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const useHeaderPopper: (moduleName?: string) => {
|
|
2
|
+
popperData: Record<string, unknown>[];
|
|
3
|
+
editEnabled: boolean;
|
|
4
|
+
findPopperData: (prop: string) => Record<string, unknown> | undefined;
|
|
5
|
+
savePopperData: (params: any) => Promise<unknown>;
|
|
6
|
+
delPopperItem: (id: string) => Promise<void>;
|
|
7
|
+
reload: () => Promise<void>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import request from "../../utils/request/index.js";
|
|
3
|
+
import { getEnv, getSystem } from "../../utils/tools.js";
|
|
4
|
+
const useHeaderPopper = (moduleName)=>{
|
|
5
|
+
const [popperData, setPopperData] = useState([]);
|
|
6
|
+
const [editEnabled, setEditEnabled] = useState(true);
|
|
7
|
+
const system = getSystem() || '';
|
|
8
|
+
const $BiEnv = getEnv() || '';
|
|
9
|
+
const getPopperList = useCallback(async ()=>{
|
|
10
|
+
if (!moduleName) return;
|
|
11
|
+
{
|
|
12
|
+
const res = await request({
|
|
13
|
+
env: $BiEnv,
|
|
14
|
+
system: 'zq',
|
|
15
|
+
api: '/common/table_head/list',
|
|
16
|
+
data: {
|
|
17
|
+
module: moduleName
|
|
18
|
+
},
|
|
19
|
+
headers: {
|
|
20
|
+
System: system,
|
|
21
|
+
Authkey: ''
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
if (1 === res.status_code) {
|
|
25
|
+
setEditEnabled(res.data.super);
|
|
26
|
+
setPopperData(res.data.data || []);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}, [
|
|
30
|
+
moduleName,
|
|
31
|
+
$BiEnv,
|
|
32
|
+
system
|
|
33
|
+
]);
|
|
34
|
+
useEffect(()=>{
|
|
35
|
+
if (moduleName) getPopperList();
|
|
36
|
+
}, [
|
|
37
|
+
getPopperList
|
|
38
|
+
]);
|
|
39
|
+
const savePopperData = useCallback(async (params)=>new Promise((resolve, reject)=>{
|
|
40
|
+
if (!editEnabled) return void resolve(true);
|
|
41
|
+
const obj = {
|
|
42
|
+
module: moduleName,
|
|
43
|
+
prop: params.prop,
|
|
44
|
+
label: '',
|
|
45
|
+
content: params.content,
|
|
46
|
+
imgs: params.imgs || []
|
|
47
|
+
};
|
|
48
|
+
if (params.id) obj.id = params.id;
|
|
49
|
+
const mockItem = {
|
|
50
|
+
update_time: '2025-12-22 19:37:36',
|
|
51
|
+
...obj
|
|
52
|
+
};
|
|
53
|
+
console.log(mockItem, '保存的数据');
|
|
54
|
+
setPopperData((prev)=>[
|
|
55
|
+
...prev.filter((item)=>item.prop !== params.prop),
|
|
56
|
+
mockItem
|
|
57
|
+
]);
|
|
58
|
+
resolve(true);
|
|
59
|
+
}), [
|
|
60
|
+
editEnabled,
|
|
61
|
+
moduleName,
|
|
62
|
+
$BiEnv,
|
|
63
|
+
system
|
|
64
|
+
]);
|
|
65
|
+
const delPopperItem = useCallback(async (id)=>{
|
|
66
|
+
await request({
|
|
67
|
+
env: $BiEnv,
|
|
68
|
+
system: 'zq',
|
|
69
|
+
api: '/common/table_head/del',
|
|
70
|
+
data: {
|
|
71
|
+
id
|
|
72
|
+
},
|
|
73
|
+
headers: {
|
|
74
|
+
System: system,
|
|
75
|
+
Authkey: ''
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}, [
|
|
79
|
+
$BiEnv,
|
|
80
|
+
system,
|
|
81
|
+
getPopperList
|
|
82
|
+
]);
|
|
83
|
+
const findPopperData = useCallback((prop)=>popperData.find((item)=>item.prop === prop), [
|
|
84
|
+
popperData
|
|
85
|
+
]);
|
|
86
|
+
return {
|
|
87
|
+
popperData,
|
|
88
|
+
editEnabled,
|
|
89
|
+
findPopperData,
|
|
90
|
+
savePopperData,
|
|
91
|
+
delPopperItem,
|
|
92
|
+
reload: getPopperList
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export { useHeaderPopper };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import 'react-quill-new/dist/quill.snow.css';
|
|
2
|
+
export interface TableHeaderEditBoxMethods {
|
|
3
|
+
show: (prop: string) => void;
|
|
4
|
+
}
|
|
5
|
+
declare const EditBox: import("react").ForwardRefExoticComponent<import("react").RefAttributes<TableHeaderEditBoxMethods>>;
|
|
6
|
+
export default EditBox;
|