win-chart 1.0.1 → 1.0.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/build/js/index.js +1 -0
- package/package.json +5 -2
- package/.eslintrc.json +0 -3
- package/.prettierrc.json +0 -5
- package/localhost-key.pem +0 -28
- package/localhost.pem +0 -25
- package/rsbuild.config.ts +0 -48
- package/src/api/README.md +0 -15
- package/src/api/index.js +0 -5
- package/src/api/layout/index.js +0 -32
- package/src/api/request.ts +0 -87
- package/src/api/url-map/index.js +0 -10
- package/src/api/user/index.js +0 -12
- package/src/components/FilterContext.tsx +0 -6
- package/src/components/GlobalStyle.tsx +0 -25
- package/src/components/HalfScreenBrowser.tsx +0 -95
- package/src/components/ImgBox.tsx +0 -19
- package/src/components/JumpBtn.tsx +0 -38
- package/src/components/MCardWrapper.tsx +0 -33
- package/src/components/NoContent/index.tsx +0 -85
- package/src/components/ResponsiveReactGridLayout.tsx +0 -218
- package/src/components/SliderDecoration.tsx +0 -27
- package/src/components/VisionUserConfigContext.ts +0 -6
- package/src/components/WinMenu/README.md +0 -11
- package/src/components/WinMenu/WinHeader.tsx +0 -5
- package/src/components/WinMenu/components/ExtraBox.tsx +0 -61
- package/src/components/WinMenu/components/FullMenuBox.tsx +0 -80
- package/src/components/WinMenu/components/FullMenuContainer.tsx +0 -50
- package/src/components/WinMenu/components/FullMenuItem.tsx +0 -128
- package/src/components/WinMenu/components/LangSwitch.tsx +0 -84
- package/src/components/WinMenu/components/LogoBox.tsx +0 -29
- package/src/components/WinMenu/components/PinDialog.tsx +0 -72
- package/src/components/WinMenu/components/PinnedMenuBox.tsx +0 -183
- package/src/components/WinMenu/components/UserBox.tsx +0 -83
- package/src/components/WinMenu/hooks/useUserInfo.ts +0 -21
- package/src/components/WinMenu/hooks/useUserMenu.ts +0 -35
- package/src/components/WinMenu/index.tsx +0 -100
- package/src/components/WinMenu/services/WinService.ts +0 -79
- package/src/components/WinMenu/services/request.ts +0 -53
- package/src/components/WinMenu/utils/const.ts +0 -80
- package/src/components/WinMenu/utils/enum.ts +0 -19
- package/src/components/WinMenu/utils/interface.ts +0 -61
- package/src/components/WinMenu/utils/map.ts +0 -39
- package/src/components/WinMenu/utils/tool.ts +0 -142
- package/src/components/WinMenu/utils/type.ts +0 -1
- package/src/components/hover-view.tsx +0 -48
- package/src/components/icon.tsx +0 -44
- package/src/components/indicator-remark.tsx +0 -25
- package/src/components/none-content.tsx +0 -93
- package/src/components/panel-tab.tsx +0 -150
- package/src/components/panel-title-tab.tsx +0 -60
- package/src/components/win-card/components/ChartContent.tsx +0 -47
- package/src/components/win-card/components/Indicator.tsx +0 -42
- package/src/components/win-card/components/IndicatorArea.tsx +0 -63
- package/src/components/win-card/components/IndicatorInfo.tsx +0 -78
- package/src/components/win-card/components/MatterContent.tsx +0 -121
- package/src/components/win-card/components/MatterList.tsx +0 -141
- package/src/components/win-card/components/NoticeContent.tsx +0 -73
- package/src/components/win-card/components/NoticeList.tsx +0 -68
- package/src/components/win-card/components/SelectDecoration.tsx +0 -34
- package/src/components/win-card/components/WinRankContent.tsx +0 -102
- package/src/components/win-card/index.tsx +0 -298
- package/src/components/win-card/utils/interface.ts +0 -12
- package/src/components/win-card/utils/tool.ts +0 -11
- package/src/components/win-card-mobile/components/ChartContent.tsx +0 -47
- package/src/components/win-card-mobile/components/DualLineBar.tsx +0 -61
- package/src/components/win-card-mobile/components/Indicator.tsx +0 -42
- package/src/components/win-card-mobile/components/IndicatorArea.tsx +0 -65
- package/src/components/win-card-mobile/components/IndicatorInfo.tsx +0 -83
- package/src/components/win-card-mobile/components/SelectDecoration.tsx +0 -28
- package/src/components/win-card-mobile/index.tsx +0 -235
- package/src/components/win-card-mobile/utils/interface.ts +0 -12
- package/src/components/win-card-mobile/utils/tool.ts +0 -9
- package/src/components/win-chart/components/chart-wrapper.tsx +0 -5
- package/src/components/win-chart/index.tsx +0 -59
- package/src/components/win-chart/theme/win-dark.json +0 -372
- package/src/components/win-chart/theme/win-light.json +0 -372
- package/src/components/win-chart/utils/const.ts +0 -37
- package/src/components/win-chart/utils/getAreaSpec.ts +0 -150
- package/src/components/win-chart/utils/getBarSpec.ts +0 -60
- package/src/components/win-chart/utils/getChartOptions.ts +0 -59
- package/src/components/win-chart/utils/getColumnSpec.ts +0 -112
- package/src/components/win-chart/utils/getDualSpec.ts +0 -79
- package/src/components/win-chart/utils/getFunnelSpec.ts +0 -70
- package/src/components/win-chart/utils/getLineSpec.ts +0 -53
- package/src/components/win-chart/utils/getPieSpec.ts +0 -124
- package/src/components/win-chart/utils/getRadarSpec.ts +0 -87
- package/src/components/win-chart/utils/tool.ts +0 -163
- package/src/components/win-chart/utils/type.ts +0 -96
- package/src/components/win-icon/index.tsx +0 -97
- package/src/components/win-v/components/EmptyBox.tsx +0 -9
- package/src/components/win-v/components/VDialog.tsx +0 -173
- package/src/components/win-v/components/VDialogBtn.tsx +0 -119
- package/src/components/win-v/components/VDialogMsg.tsx +0 -325
- package/src/components/win-v/components/VInput.tsx +0 -15
- package/src/components/win-v/components/VRemindMsgList.tsx +0 -303
- package/src/components/win-v/components/VRobot.tsx +0 -97
- package/src/components/win-v/hooks/useVDialogCore.ts +0 -102
- package/src/components/win-v/hooks/useVDialogOperate.ts +0 -132
- package/src/components/win-v/hooks/useVDialogState.ts +0 -52
- package/src/components/win-v/hooks/useVRemindMsgShow.ts +0 -15
- package/src/components/win-v/index.tsx +0 -205
- package/src/components/win-wrappers/card-wrapper.tsx +0 -103
- package/src/components/win-wrappers/dot-wrapper.tsx +0 -18
- package/src/components/win-wrappers/iframe-wrapper.tsx +0 -7
- package/src/components/win-wrappers/request-wrapper.tsx +0 -190
- package/src/global.d.ts +0 -53
- package/src/hooks/useCardOptionList.ts +0 -23
- package/src/hooks/useCostFiltersDicList.ts +0 -22
- package/src/hooks/useFbiUrl.ts +0 -22
- package/src/hooks/useHalfScreenState.ts +0 -50
- package/src/hooks/useHasIntersected.ts +0 -36
- package/src/hooks/useIndicatorCardInfo.ts +0 -26
- package/src/hooks/useIndicatorCardQueryList.ts +0 -22
- package/src/hooks/useIndicatorClassifyList.ts +0 -25
- package/src/hooks/useIndicatorDetailsDateList.ts +0 -22
- package/src/hooks/useIndicatorDetailsInfo.ts +0 -49
- package/src/hooks/useIndicatorDetailsTrend.ts +0 -25
- package/src/hooks/useIndicatorDicList.ts +0 -22
- package/src/hooks/useIndicatorLabelList.ts +0 -20
- package/src/hooks/useIndicatorList.ts +0 -24
- package/src/hooks/useIndicatorRangeList.ts +0 -20
- package/src/hooks/useIndicatorTypeList.ts +0 -20
- package/src/hooks/useIndicatorUnitList.ts +0 -21
- package/src/hooks/useListenQuery.ts +0 -29
- package/src/hooks/useMobile.ts +0 -58
- package/src/hooks/useNotice.ts +0 -42
- package/src/hooks/useOrgLevelList.ts +0 -23
- package/src/hooks/usePageSelection.ts +0 -121
- package/src/hooks/usePageState.ts +0 -22
- package/src/hooks/usePendingList.ts +0 -27
- package/src/hooks/usePortalPageInfo.ts +0 -43
- package/src/hooks/useRefreshByLocationChange.ts +0 -16
- package/src/hooks/useReportIndicatorList.ts +0 -21
- package/src/hooks/useReportInfo.ts +0 -45
- package/src/hooks/useReportPersonList.ts +0 -21
- package/src/hooks/useScriptLoader.ts +0 -22
- package/src/hooks/useUnreadMsgList.ts +0 -26
- package/src/hooks/useUserAvatar.ts +0 -23
- package/src/hooks/useVReportInfo.ts +0 -50
- package/src/hooks/useVisionUserConfig.ts +0 -25
- package/src/hooks/useWorkbenchOptions.ts +0 -63
- package/src/index.tsx +0 -20
- package/src/services/CardService.ts +0 -91
- package/src/services/CommonService.ts +0 -23
- package/src/services/CostService.ts +0 -56
- package/src/services/DialogService.ts +0 -74
- package/src/services/IndicatorService.ts +0 -406
- package/src/services/PageService.ts +0 -204
- package/src/services/ReportService.ts +0 -335
- package/src/services/WorkbenchService.ts +0 -411
- package/src/styles/README.md +0 -12
- package/src/styles/index.scss +0 -9
- package/src/styles/mixins/index.scss +0 -25
- package/src/styles/next-cover.scss +0 -4
- package/src/styles/normalize.scss +0 -27
- package/src/styles/utilities/index.scss +0 -5
- package/src/styles/vars/index.scss +0 -17
- package/src/types/enum-workbench.ts +0 -29
- package/src/types/enum.ts +0 -156
- package/src/types/index.ts +0 -19
- package/src/types/indicator.ts +0 -299
- package/src/types/interface.ts +0 -303
- package/src/types/portal.ts +0 -211
- package/src/types/report.ts +0 -28
- package/src/types/type.ts +0 -11
- package/src/types/user.ts +0 -28
- package/src/utils/README.md +0 -4
- package/src/utils/arms.ts +0 -59
- package/src/utils/arr.ts +0 -123
- package/src/utils/const-workbench.ts +0 -9
- package/src/utils/const.ts +0 -18
- package/src/utils/index.ts +0 -18
- package/src/utils/init.ts +0 -5
- package/src/utils/map-workbench.ts +0 -66
- package/src/utils/map.ts +0 -377
- package/src/utils/number.ts +0 -101
- package/src/utils/page.ts +0 -81
- package/src/utils/str.ts +0 -26
- package/src/utils/tools.ts +0 -44
- package/src/utils/tree.ts +0 -145
- package/src/utils/url.ts +0 -40
- package/src/utils/util.ts +0 -99
- package/src/utils/workbench.ts +0 -25
- package/tsconfig.json +0 -33
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { IndicatorService } from '@/services/IndicatorService';
|
|
2
|
-
import { IListItem } from '@/types';
|
|
3
|
-
import { CnMessage } from '@cainiaofe/cn-ui';
|
|
4
|
-
import { useEffect, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
export const useIndicatorTypeList = () => {
|
|
7
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
try {
|
|
12
|
-
setState(await IndicatorService.getTypeList());
|
|
13
|
-
} catch (error) {
|
|
14
|
-
CnMessage.error(error.message);
|
|
15
|
-
}
|
|
16
|
-
})();
|
|
17
|
-
}, []);
|
|
18
|
-
|
|
19
|
-
return state;
|
|
20
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { IndicatorService } from 'src/services/IndicatorService';
|
|
2
|
-
import { IListItem } from '@/types';
|
|
3
|
-
import { CnMessage } from '@cainiaofe/cn-ui';
|
|
4
|
-
import { useEffect, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
export const useIndicatorUnitList = () => {
|
|
7
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
try {
|
|
12
|
-
const data = await IndicatorService.getUnitList();
|
|
13
|
-
setState(data);
|
|
14
|
-
} catch (error) {
|
|
15
|
-
CnMessage(error.message);
|
|
16
|
-
}
|
|
17
|
-
})();
|
|
18
|
-
}, []);
|
|
19
|
-
|
|
20
|
-
return state;
|
|
21
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
export const useListenQuery = () => {
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
// 监听地址参数的变化
|
|
6
|
-
const handleParamChange = () => {
|
|
7
|
-
// 获取当前页面的参数部分
|
|
8
|
-
const currentParams = window.location.search;
|
|
9
|
-
|
|
10
|
-
// 根据需要修改参数的值或者添加新的参数
|
|
11
|
-
const newParams = `${currentParams}¶m=value`;
|
|
12
|
-
|
|
13
|
-
// 重定向到修改后的地址并刷新页面
|
|
14
|
-
window.location.href =
|
|
15
|
-
window.location.origin + window.location.pathname + newParams;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// 在组件挂载时执行一次监听
|
|
19
|
-
handleParamChange();
|
|
20
|
-
|
|
21
|
-
// 监听地址参数的变化,并执行回调函数
|
|
22
|
-
window.addEventListener('popstate', handleParamChange);
|
|
23
|
-
|
|
24
|
-
// 在组件卸载时取消监听
|
|
25
|
-
return () => {
|
|
26
|
-
window.removeEventListener('popstate', handleParamChange);
|
|
27
|
-
};
|
|
28
|
-
}, []);
|
|
29
|
-
};
|
package/src/hooks/useMobile.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { isMobileDevice } from '@/utils';
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
import { atom, useRecoilValue, useSetRecoilState } from 'recoil';
|
|
4
|
-
|
|
5
|
-
const mobileState = atom({
|
|
6
|
-
key: 'mobile-state',
|
|
7
|
-
default: isMobileDevice(),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 获取 mobileState
|
|
12
|
-
* @returns 是否为移动端
|
|
13
|
-
*/
|
|
14
|
-
export const useMobileState = () => useRecoilValue(mobileState);
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* 监听屏幕大小变化,设置 mobileState
|
|
18
|
-
*/
|
|
19
|
-
export const useMobileStateControl = () => {
|
|
20
|
-
const setMobileState = useSetRecoilState(mobileState);
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
// 定义处理屏幕大小变化的函数
|
|
24
|
-
function handleResize() {
|
|
25
|
-
setMobileState(isMobileDevice());
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// 监听屏幕大小变化的事件
|
|
29
|
-
window.addEventListener('resize', handleResize);
|
|
30
|
-
|
|
31
|
-
// 返回一个清理函数,以在组件卸载时移除事件监听器
|
|
32
|
-
return () => window.removeEventListener('resize', handleResize);
|
|
33
|
-
}, [setMobileState]); // 空依赖数组确保事件监听器只被设置和清理一次
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* 在移动端设置 <meta> 标签
|
|
38
|
-
*/
|
|
39
|
-
export const useMobileSetting = () => {
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
// 创建 <meta> 元素
|
|
42
|
-
const meta = document.createElement('meta');
|
|
43
|
-
meta.setAttribute('name', 'viewport');
|
|
44
|
-
meta.setAttribute(
|
|
45
|
-
'content',
|
|
46
|
-
'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no',
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
// 插入 <meta> 元素到 <head> 中
|
|
50
|
-
document.head.appendChild(meta);
|
|
51
|
-
|
|
52
|
-
// 清理函数
|
|
53
|
-
return () => {
|
|
54
|
-
// 在组件卸载时移除 <meta> 元素
|
|
55
|
-
document.head.removeChild(meta);
|
|
56
|
-
};
|
|
57
|
-
}, []);
|
|
58
|
-
};
|
package/src/hooks/useNotice.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { INoticeInfo } from '@/types';
|
|
2
|
-
import { CnMessage } from '@cainiaofe/cn-ui-m';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { WorkbenchService } from 'src/services/WorkbenchService';
|
|
5
|
-
|
|
6
|
-
export const useNoticeInfo = (id?: number | string) => {
|
|
7
|
-
const [state, setState] = useState<Partial<INoticeInfo>>({});
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
if (id) {
|
|
12
|
-
try {
|
|
13
|
-
const data = await WorkbenchService.queryNoticeInfo(id);
|
|
14
|
-
setState(data);
|
|
15
|
-
} catch (error) {
|
|
16
|
-
CnMessage(error.message);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
})();
|
|
20
|
-
}, [id]);
|
|
21
|
-
|
|
22
|
-
return state;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const useNoticeBannerList = (init = true) => {
|
|
26
|
-
const [state, setState] = useState<INoticeInfo[]>([]);
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
(async () => {
|
|
30
|
-
if (init) {
|
|
31
|
-
try {
|
|
32
|
-
const data = await WorkbenchService.queryNoticeBannerList();
|
|
33
|
-
setState(data);
|
|
34
|
-
} catch (error) {
|
|
35
|
-
CnMessage(error.message);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
})();
|
|
39
|
-
}, [init]);
|
|
40
|
-
|
|
41
|
-
return state;
|
|
42
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { IndicatorService } from 'src/services/IndicatorService';
|
|
2
|
-
import { IListItem } from '@/types';
|
|
3
|
-
import { CnMessage } from '@cainiaofe/cn-ui';
|
|
4
|
-
import { useEffect, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
export const useOrgLevelList = (orgLevel?: string) => {
|
|
7
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
try {
|
|
12
|
-
if (orgLevel) {
|
|
13
|
-
const data = await IndicatorService.getOrgLevelList(orgLevel);
|
|
14
|
-
setState(data);
|
|
15
|
-
}
|
|
16
|
-
} catch (error) {
|
|
17
|
-
CnMessage(error.message);
|
|
18
|
-
}
|
|
19
|
-
})();
|
|
20
|
-
}, [orgLevel]);
|
|
21
|
-
|
|
22
|
-
return state;
|
|
23
|
-
};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { IListItem, IListItemDataSourceMap } from '@/types';
|
|
2
|
-
import { CnMessage } from '@cainiaofe/cn-ui';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { PageService } from '@/services/PageService';
|
|
5
|
-
import { filterComponentTypeList } from '@/utils';
|
|
6
|
-
|
|
7
|
-
export const usePageSelectionTypeList = () => {
|
|
8
|
-
const [state, setState] = useState<IListItem[]>(filterComponentTypeList);
|
|
9
|
-
|
|
10
|
-
// useEffect(() => {
|
|
11
|
-
// (async () => {
|
|
12
|
-
// try {
|
|
13
|
-
// const data = await PageService.getPageSelectionTypeList();
|
|
14
|
-
// setState(data);
|
|
15
|
-
// } catch (error) {
|
|
16
|
-
// CnMessage(error.message);
|
|
17
|
-
// }
|
|
18
|
-
// })();
|
|
19
|
-
// }, []);
|
|
20
|
-
|
|
21
|
-
return state;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const useStructedPropertyList = (instanceId?: string | number) => {
|
|
25
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
26
|
-
|
|
27
|
-
// useEffect(() => {
|
|
28
|
-
// (async () => {
|
|
29
|
-
// try {
|
|
30
|
-
// const data = await PageService.getStructedPropertyList(instanceId);
|
|
31
|
-
// setState(data);
|
|
32
|
-
// } catch (error) {
|
|
33
|
-
// CnMessage(error.message);
|
|
34
|
-
// }
|
|
35
|
-
// })();
|
|
36
|
-
// }, [instanceId]);
|
|
37
|
-
|
|
38
|
-
return state;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const useTimeSelectionTypeList = () => {
|
|
42
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
43
|
-
|
|
44
|
-
// useEffect(() => {
|
|
45
|
-
// (async () => {
|
|
46
|
-
// try {
|
|
47
|
-
// const data = await PageService.getTimeSelectionTypeList();
|
|
48
|
-
// setState(data);
|
|
49
|
-
// } catch (error) {
|
|
50
|
-
// CnMessage(error.message);
|
|
51
|
-
// }
|
|
52
|
-
// })();
|
|
53
|
-
// }, []);
|
|
54
|
-
|
|
55
|
-
return state;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const useStructedPropertyDataSource = (
|
|
59
|
-
structedPropertyCode?: string,
|
|
60
|
-
) => {
|
|
61
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
62
|
-
|
|
63
|
-
// useEffect(() => {
|
|
64
|
-
// (async () => {
|
|
65
|
-
// if (structedPropertyCode) {
|
|
66
|
-
// try {
|
|
67
|
-
// const data = await PageService.getStructedPropertyDataSource(structedPropertyCode);
|
|
68
|
-
// setState(data);
|
|
69
|
-
// } catch (error) {
|
|
70
|
-
// CnMessage(error.message);
|
|
71
|
-
// }
|
|
72
|
-
// }
|
|
73
|
-
// })();
|
|
74
|
-
// }, [structedPropertyCode]);
|
|
75
|
-
|
|
76
|
-
return state;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const useStructedPropertyDataSourceByCodeList = (
|
|
80
|
-
structedPropertyCodeList?: string[],
|
|
81
|
-
) => {
|
|
82
|
-
const [state, setState] = useState<IListItemDataSourceMap>({});
|
|
83
|
-
|
|
84
|
-
// useEffect(() => {
|
|
85
|
-
// (async () => {
|
|
86
|
-
// if (Array.isArray(structedPropertyCodeList)) {
|
|
87
|
-
// const dataMap: IListItemDataSourceMap = {};
|
|
88
|
-
// await Promise.all(
|
|
89
|
-
// structedPropertyCodeList.map(async (code) => {
|
|
90
|
-
// try {
|
|
91
|
-
// const data = await PageService.getStructedPropertyDataSource(code);
|
|
92
|
-
// dataMap[code] = data;
|
|
93
|
-
// } catch (error) {
|
|
94
|
-
// CnMessage(error.message);
|
|
95
|
-
// }
|
|
96
|
-
// }),
|
|
97
|
-
// );
|
|
98
|
-
// setState(dataMap);
|
|
99
|
-
// }
|
|
100
|
-
// })();
|
|
101
|
-
// }, [structedPropertyCodeList]);
|
|
102
|
-
|
|
103
|
-
return state;
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export const useShowPropertyList = () => {
|
|
107
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
108
|
-
|
|
109
|
-
// useEffect(() => {
|
|
110
|
-
// (async () => {
|
|
111
|
-
// try {
|
|
112
|
-
// const data = await PageService.getShowPropertyList();
|
|
113
|
-
// setState(data);
|
|
114
|
-
// } catch (error) {
|
|
115
|
-
// CnMessage(error.message);
|
|
116
|
-
// }
|
|
117
|
-
// })();
|
|
118
|
-
// }, []);
|
|
119
|
-
|
|
120
|
-
return state;
|
|
121
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
atom,
|
|
3
|
-
useRecoilState,
|
|
4
|
-
useRecoilValue,
|
|
5
|
-
useSetRecoilState,
|
|
6
|
-
} from 'recoil';
|
|
7
|
-
import { getSearchParams } from '@/utils';
|
|
8
|
-
import { PageType } from '../types';
|
|
9
|
-
|
|
10
|
-
const state = atom({
|
|
11
|
-
key: 'workbench-page-context-mobile',
|
|
12
|
-
default: {
|
|
13
|
-
pageType:
|
|
14
|
-
getSearchParams().tab === PageType.MY_APPROVAL
|
|
15
|
-
? PageType.MY_APPROVAL
|
|
16
|
-
: PageType.WORKBENCH,
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export const usePageState = () => useRecoilState(state);
|
|
21
|
-
export const usePageStateValue = () => useRecoilValue(state);
|
|
22
|
-
export const useSetPageState = () => useSetRecoilState(state);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { IMatterPendingInfo } from '@/types';
|
|
2
|
-
import { CnMessage } from '@cainiaofe/cn-ui-m';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { WorkbenchService } from 'src/services/WorkbenchService';
|
|
5
|
-
|
|
6
|
-
export const usePendingList = (init = true) => {
|
|
7
|
-
const [state, setState] = useState<IMatterPendingInfo[]>([
|
|
8
|
-
{ desc: '待我审批', count: '0', url: '' },
|
|
9
|
-
{ desc: '我的V信', count: '0', url: '' },
|
|
10
|
-
{ desc: '新鲜速递', count: '0', url: '' },
|
|
11
|
-
]);
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
(async () => {
|
|
15
|
-
if (init) {
|
|
16
|
-
try {
|
|
17
|
-
const data = await WorkbenchService.queryPendingList();
|
|
18
|
-
setState(data);
|
|
19
|
-
} catch (error) {
|
|
20
|
-
CnMessage(error.message);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
})();
|
|
24
|
-
}, [init]);
|
|
25
|
-
|
|
26
|
-
return state;
|
|
27
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { CnMessage } from '@cainiaofe/cn-ui';
|
|
2
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import { PageService } from 'src/services/PageService';
|
|
4
|
-
import { IPortalPageInfo } from 'src/types';
|
|
5
|
-
|
|
6
|
-
interface IRequestParams {
|
|
7
|
-
code?: string;
|
|
8
|
-
pageType?: string;
|
|
9
|
-
init?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const usePortalPageInfo = ({
|
|
13
|
-
pageType,
|
|
14
|
-
code,
|
|
15
|
-
init = true,
|
|
16
|
-
}: IRequestParams) => {
|
|
17
|
-
const [state, setState] = useState<Partial<IPortalPageInfo>>({});
|
|
18
|
-
|
|
19
|
-
const handleGetData = useCallback(async () => {
|
|
20
|
-
if (code || pageType) {
|
|
21
|
-
try {
|
|
22
|
-
const data = await PageService.queryIndicatorPageDetail(code, pageType);
|
|
23
|
-
|
|
24
|
-
if (data) {
|
|
25
|
-
setState(data);
|
|
26
|
-
}
|
|
27
|
-
} catch (error) {
|
|
28
|
-
CnMessage(error.message);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}, [code, pageType]);
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if (init) {
|
|
35
|
-
handleGetData();
|
|
36
|
-
}
|
|
37
|
-
}, [init, handleGetData]);
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
pageInfo: state,
|
|
41
|
-
refreshPageInfo: handleGetData,
|
|
42
|
-
};
|
|
43
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import { useLocation } from 'react-router-dom';
|
|
3
|
-
|
|
4
|
-
export const useRefreshByLocationChange = () => {
|
|
5
|
-
const [, setState] = useState<{}>({});
|
|
6
|
-
const location = useLocation();
|
|
7
|
-
const refreshRef = useRef(false);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (refreshRef.current) {
|
|
11
|
-
setState({});
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
refreshRef.current = true;
|
|
15
|
-
}, [location]);
|
|
16
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ReportService } from '@/services/ReportService';
|
|
2
|
-
import { IListItem } from '@/types';
|
|
3
|
-
import { CnMessage } from '@cainiaofe/cn-ui';
|
|
4
|
-
import { useEffect, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
export const useReportIndicatorList = () => {
|
|
7
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
try {
|
|
12
|
-
const data = await ReportService.getIndicatorList();
|
|
13
|
-
setState(data);
|
|
14
|
-
} catch (error) {
|
|
15
|
-
CnMessage(error.message);
|
|
16
|
-
}
|
|
17
|
-
})();
|
|
18
|
-
}, []);
|
|
19
|
-
|
|
20
|
-
return state;
|
|
21
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ReportService } from '@/services/ReportService';
|
|
2
|
-
import { IReportContentInfo, IReportTplInfo } from '@/types';
|
|
3
|
-
import { CnMessage } from '@cainiaofe/cn-ui-m';
|
|
4
|
-
import { useEffect, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
export const useReportTplInfo = (id?: number | string) => {
|
|
7
|
-
const [state, setState] = useState<Partial<IReportTplInfo>>({});
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
if (id) {
|
|
12
|
-
try {
|
|
13
|
-
const data = await ReportService.getTemplateDetails(id);
|
|
14
|
-
setState(data);
|
|
15
|
-
} catch (error) {
|
|
16
|
-
CnMessage(error.message);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
})();
|
|
20
|
-
}, [id]);
|
|
21
|
-
|
|
22
|
-
return state;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const useReportContentInfo = (
|
|
26
|
-
id?: number | string,
|
|
27
|
-
importType?: string,
|
|
28
|
-
) => {
|
|
29
|
-
const [state, setState] = useState<Partial<IReportContentInfo>>({});
|
|
30
|
-
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
(async () => {
|
|
33
|
-
if (id) {
|
|
34
|
-
try {
|
|
35
|
-
const data = await ReportService.getContentDetails(id, importType);
|
|
36
|
-
setState(data);
|
|
37
|
-
} catch (error) {
|
|
38
|
-
CnMessage(error.message);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
})();
|
|
42
|
-
}, [id, importType]);
|
|
43
|
-
|
|
44
|
-
return state;
|
|
45
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ReportService } from '@/services/ReportService';
|
|
2
|
-
import { IListItem } from '@/types';
|
|
3
|
-
import { CnMessage } from '@cainiaofe/cn-ui-m';
|
|
4
|
-
import { useEffect, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
export const useReportPersonList = () => {
|
|
7
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
try {
|
|
12
|
-
const data = await ReportService.getPersonList();
|
|
13
|
-
setState(data);
|
|
14
|
-
} catch (error) {
|
|
15
|
-
CnMessage(error.message);
|
|
16
|
-
}
|
|
17
|
-
})();
|
|
18
|
-
}, []);
|
|
19
|
-
|
|
20
|
-
return state;
|
|
21
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
export const useScriptLoader = (scriptUrl: string) => {
|
|
4
|
-
const [loaded, setLoaded] = useState(false);
|
|
5
|
-
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
if (document.querySelector(`script[src="${scriptUrl}"]`)) {
|
|
8
|
-
setLoaded(true);
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
const script = document.createElement('script');
|
|
12
|
-
script.src = scriptUrl;
|
|
13
|
-
script.async = true;
|
|
14
|
-
script.onload = () => setLoaded(true);
|
|
15
|
-
document.body.appendChild(script);
|
|
16
|
-
return () => {
|
|
17
|
-
document.body.removeChild(script);
|
|
18
|
-
};
|
|
19
|
-
}, [scriptUrl]);
|
|
20
|
-
|
|
21
|
-
return loaded;
|
|
22
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { IUnreadMsg } from '@/types';
|
|
2
|
-
import { CnMessage } from '@cainiaofe/cn-ui';
|
|
3
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
4
|
-
import { PageService } from 'src/services/PageService';
|
|
5
|
-
|
|
6
|
-
export const useUnreadMsgList = () => {
|
|
7
|
-
const [state, setState] = useState<IUnreadMsg[]>([]);
|
|
8
|
-
|
|
9
|
-
const getData = useCallback(async () => {
|
|
10
|
-
try {
|
|
11
|
-
const data = await PageService.queryUnreadMsg();
|
|
12
|
-
setState(data);
|
|
13
|
-
} catch (error) {
|
|
14
|
-
CnMessage(error.message);
|
|
15
|
-
}
|
|
16
|
-
}, []);
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
getData();
|
|
20
|
-
}, [getData]);
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
msgList: state,
|
|
24
|
-
handleRefreshMsgList: getData,
|
|
25
|
-
};
|
|
26
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { IUserAvatarInfo } from '@/types';
|
|
2
|
-
import { CnMessage } from '@cainiaofe/cn-ui-m';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { WorkbenchService } from 'src/services/WorkbenchService';
|
|
5
|
-
|
|
6
|
-
export const useUserAvatar = (init = true) => {
|
|
7
|
-
const [state, setState] = useState<IUserAvatarInfo>({});
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
if (init) {
|
|
12
|
-
try {
|
|
13
|
-
const data = await WorkbenchService.queryUserAvatar();
|
|
14
|
-
setState(data);
|
|
15
|
-
} catch (error) {
|
|
16
|
-
CnMessage(error.message);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
})();
|
|
20
|
-
}, [init]);
|
|
21
|
-
|
|
22
|
-
return state;
|
|
23
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { IMsgCountInfo, IVReportInfo } from '@/types';
|
|
2
|
-
import { CnMessage } from '@cainiaofe/cn-ui-m';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { WorkbenchService } from 'src/services/WorkbenchService';
|
|
5
|
-
|
|
6
|
-
export const useVReportInfo = () => {
|
|
7
|
-
const [state, setState] = useState<Partial<IVReportInfo> & IMsgCountInfo>({});
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
try {
|
|
12
|
-
const data = await WorkbenchService.queryVReportInfo();
|
|
13
|
-
const countData = await WorkbenchService.queryVReportMessageCount();
|
|
14
|
-
|
|
15
|
-
if (data && countData) {
|
|
16
|
-
setState({
|
|
17
|
-
...data,
|
|
18
|
-
...countData,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
} catch (error) {
|
|
22
|
-
CnMessage(error.message);
|
|
23
|
-
}
|
|
24
|
-
})();
|
|
25
|
-
}, []);
|
|
26
|
-
|
|
27
|
-
return state;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const useVReportMessageCount = (init = true) => {
|
|
31
|
-
const [state, setState] = useState<IMsgCountInfo>({
|
|
32
|
-
unreadCount: 0,
|
|
33
|
-
messageCount: 0,
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
(async () => {
|
|
38
|
-
if (init) {
|
|
39
|
-
try {
|
|
40
|
-
const data = await WorkbenchService.queryVReportMessageCount();
|
|
41
|
-
setState(data);
|
|
42
|
-
} catch (error) {
|
|
43
|
-
CnMessage(error.message);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
})();
|
|
47
|
-
}, [init]);
|
|
48
|
-
|
|
49
|
-
return state;
|
|
50
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IVisionUserConfig } from '@/types';
|
|
2
|
-
import { CnMessage } from '@cainiaofe/cn-ui';
|
|
3
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
4
|
-
import { PageService } from 'src/services/PageService';
|
|
5
|
-
|
|
6
|
-
export const useVisionUserConfig = () => {
|
|
7
|
-
const [state, setState] = useState<IVisionUserConfig>();
|
|
8
|
-
|
|
9
|
-
const handleGetData = useCallback(async () => {
|
|
10
|
-
try {
|
|
11
|
-
setState(await PageService.getVisionUserConfig());
|
|
12
|
-
} catch (error) {
|
|
13
|
-
CnMessage.error(error.message);
|
|
14
|
-
}
|
|
15
|
-
}, []);
|
|
16
|
-
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
handleGetData();
|
|
19
|
-
}, [handleGetData]);
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
data: state,
|
|
23
|
-
refresh: handleGetData,
|
|
24
|
-
};
|
|
25
|
-
};
|