win-chart 1.0.0 → 1.0.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/.vscode/settings.json +166 -0
- package/build/index.html +1 -0
- package/build/js/index.js +1 -0
- package/build/report-web.html +39 -0
- package/package.json +3 -1
- package/rsbuild.config.ts +5 -0
- package/tsconfig.json +1 -0
- 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
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { rgba } from 'polished';
|
|
2
|
-
import { css, styled } from 'styled-components';
|
|
3
|
-
|
|
4
|
-
export const DotWrapper = styled.span<{ checked?: boolean }>`
|
|
5
|
-
display: inline-block;
|
|
6
|
-
width: 6px;
|
|
7
|
-
height: 6px;
|
|
8
|
-
border-radius: 500px;
|
|
9
|
-
background-color: ${rgba('#828c9e', 0.5)};
|
|
10
|
-
transform: translateY(32px);
|
|
11
|
-
|
|
12
|
-
${({ checked }) =>
|
|
13
|
-
checked &&
|
|
14
|
-
css`
|
|
15
|
-
width: 18px;
|
|
16
|
-
background-color: #828c9e;
|
|
17
|
-
`}
|
|
18
|
-
`;
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { useHasIntersected } from '@/hooks/useHasIntersected';
|
|
2
|
-
import { IStyleProps } from '@/types';
|
|
3
|
-
import { ReactNode, useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { withoutAccessErrorCodeList } from 'src/api/request';
|
|
5
|
-
import { styled } from 'styled-components';
|
|
6
|
-
|
|
7
|
-
enum DataType {
|
|
8
|
-
NONE,
|
|
9
|
-
SUCCESS,
|
|
10
|
-
ERROR,
|
|
11
|
-
NO_ACCESS,
|
|
12
|
-
NO_DATA,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface IProps<T, L> extends IStyleProps {
|
|
16
|
-
initData?: boolean;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 返回默认值
|
|
20
|
-
*/
|
|
21
|
-
defaultValue?: T;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* 请求参数
|
|
25
|
-
*/
|
|
26
|
-
requestData?: L;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 获取数据异步函数
|
|
30
|
-
* @param data
|
|
31
|
-
* @param isInside
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
service: (data?: L, isInside?: boolean) => Promise<T>;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* 页面渲染回调
|
|
38
|
-
* @param data
|
|
39
|
-
* @returns
|
|
40
|
-
*/
|
|
41
|
-
children: (data: T) => ReactNode;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* 错误提示高度
|
|
45
|
-
*/
|
|
46
|
-
errorBoxHeight?: number | string;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
debounceWait?: number;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* 是否是内部员工登陆
|
|
55
|
-
*/
|
|
56
|
-
isInside?: boolean;
|
|
57
|
-
|
|
58
|
-
noEmptyBox?: boolean;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function RequestWrapper<T, L>({
|
|
62
|
-
initData = true,
|
|
63
|
-
defaultValue,
|
|
64
|
-
requestData,
|
|
65
|
-
service,
|
|
66
|
-
children,
|
|
67
|
-
errorBoxHeight,
|
|
68
|
-
debounceWait,
|
|
69
|
-
isInside,
|
|
70
|
-
noEmptyBox,
|
|
71
|
-
...args
|
|
72
|
-
}: IProps<T, L>) {
|
|
73
|
-
const [dataType, setDataType] = useState(DataType.NONE);
|
|
74
|
-
const [data, setData] = useState(defaultValue);
|
|
75
|
-
const requestDataStr = JSON.stringify(requestData);
|
|
76
|
-
const ref = useRef<HTMLDivElement>(null);
|
|
77
|
-
const shouldInit = useHasIntersected(ref);
|
|
78
|
-
|
|
79
|
-
const handleGetData = useCallback(async () => {
|
|
80
|
-
try {
|
|
81
|
-
setDataType(DataType.NONE);
|
|
82
|
-
setData(
|
|
83
|
-
await service(
|
|
84
|
-
{
|
|
85
|
-
...requestData,
|
|
86
|
-
requestId: undefined,
|
|
87
|
-
} as L,
|
|
88
|
-
isInside,
|
|
89
|
-
),
|
|
90
|
-
);
|
|
91
|
-
setDataType(DataType.SUCCESS);
|
|
92
|
-
} catch (error) {
|
|
93
|
-
if (withoutAccessErrorCodeList.includes(error.errorCode)) {
|
|
94
|
-
// 无权限
|
|
95
|
-
setDataType(DataType.NO_ACCESS);
|
|
96
|
-
} else {
|
|
97
|
-
setDataType(DataType.ERROR);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
|
-
}, [requestDataStr]);
|
|
102
|
-
|
|
103
|
-
useEffect(() => {
|
|
104
|
-
if (shouldInit && initData) {
|
|
105
|
-
handleGetData();
|
|
106
|
-
}
|
|
107
|
-
}, [shouldInit, initData, handleGetData]);
|
|
108
|
-
|
|
109
|
-
const { img, remark, btn } = dataTypeMap.get(dataType) ?? {};
|
|
110
|
-
|
|
111
|
-
return (
|
|
112
|
-
<DataBoxWrapper ref={ref} {...args}>
|
|
113
|
-
{dataType === DataType.SUCCESS && !!data && children(data)}
|
|
114
|
-
{!noEmptyBox &&
|
|
115
|
-
[DataType.ERROR, DataType.NO_ACCESS, DataType.NO_ACCESS].includes(
|
|
116
|
-
dataType,
|
|
117
|
-
) && (
|
|
118
|
-
<EmptyBox style={{ height: errorBoxHeight }}>
|
|
119
|
-
<img data-img src={img} alt="" />
|
|
120
|
-
<div data-msg>
|
|
121
|
-
<span data-remark>{remark}</span>
|
|
122
|
-
<span data-btn onClick={handleGetData}>
|
|
123
|
-
{btn}
|
|
124
|
-
</span>
|
|
125
|
-
</div>
|
|
126
|
-
</EmptyBox>
|
|
127
|
-
)}
|
|
128
|
-
</DataBoxWrapper>
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const DataBoxWrapper = styled.div`
|
|
133
|
-
width: 100%;
|
|
134
|
-
height: 100%;
|
|
135
|
-
|
|
136
|
-
&::-webkit-scrollbar {
|
|
137
|
-
display: none;
|
|
138
|
-
}
|
|
139
|
-
`;
|
|
140
|
-
|
|
141
|
-
const EmptyBox = styled.div`
|
|
142
|
-
width: 100%;
|
|
143
|
-
height: 60%;
|
|
144
|
-
display: flex;
|
|
145
|
-
flex-direction: column;
|
|
146
|
-
align-items: center;
|
|
147
|
-
margin: auto;
|
|
148
|
-
|
|
149
|
-
[data-img] {
|
|
150
|
-
width: 100%;
|
|
151
|
-
height: 50%;
|
|
152
|
-
margin-bottom: 12px;
|
|
153
|
-
object-fit: contain;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
[data-msg] {
|
|
157
|
-
font-size: 12px;
|
|
158
|
-
line-height: 1;
|
|
159
|
-
|
|
160
|
-
[data-remark] {
|
|
161
|
-
color: #6d7a90;
|
|
162
|
-
margin-right: 8px;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
[data-btn] {
|
|
166
|
-
color: #3379ff;
|
|
167
|
-
cursor: pointer;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
`;
|
|
171
|
-
|
|
172
|
-
const dataTypeMap = new Map<
|
|
173
|
-
DataType,
|
|
174
|
-
{ img?: string; remark?: string; btn?: string }
|
|
175
|
-
>()
|
|
176
|
-
.set(DataType.ERROR, {
|
|
177
|
-
img: 'https://img.alicdn.com/imgextra/i4/O1CN01vg4MQE1e6WfWTdtx4_!!6000000003822-55-tps-190-120.svg',
|
|
178
|
-
remark: '数据加载失败',
|
|
179
|
-
btn: '刷新一下~',
|
|
180
|
-
})
|
|
181
|
-
.set(DataType.NO_ACCESS, {
|
|
182
|
-
img: 'https://img.alicdn.com/imgextra/i1/O1CN01Iz7oDf1IqrBik7NYy_!!6000000000945-55-tps-190-120.svg',
|
|
183
|
-
remark: '你暂无权限',
|
|
184
|
-
btn: '',
|
|
185
|
-
})
|
|
186
|
-
.set(DataType.NO_DATA, {
|
|
187
|
-
img: 'https://img.alicdn.com/imgextra/i4/O1CN01g0QafV1rIyRHX6HA9_!!6000000005609-55-tps-190-120.svg',
|
|
188
|
-
remark: '暂无数据',
|
|
189
|
-
btn: '',
|
|
190
|
-
});
|
package/src/global.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/// <reference types="@rsbuild/core/types" />
|
|
2
|
-
|
|
3
|
-
declare module '*.module.css' {
|
|
4
|
-
const classes: { [key: string]: string };
|
|
5
|
-
export default classes;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
declare module '*.module.scss' {
|
|
9
|
-
const classes: { [key: string]: string };
|
|
10
|
-
export default classes;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare module '*.module.sass' {
|
|
14
|
-
const classes: { [key: string]: string };
|
|
15
|
-
export default classes;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
declare module '*.module.less' {
|
|
19
|
-
const classes: { [key: string]: string };
|
|
20
|
-
export default classes;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
declare module '*.module.styl' {
|
|
24
|
-
const classes: { [key: string]: string };
|
|
25
|
-
export default classes;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
declare module '@alife/dwork-cnstr-header';
|
|
29
|
-
|
|
30
|
-
interface Window {
|
|
31
|
-
MENU_LOAD: string;
|
|
32
|
-
MY_VISION_MENU_URL: string;
|
|
33
|
-
|
|
34
|
-
openHelpDrawer?: () => void;
|
|
35
|
-
|
|
36
|
-
vConsole: VConsole;
|
|
37
|
-
|
|
38
|
-
nextConePages: {
|
|
39
|
-
activePath: string;
|
|
40
|
-
title: string;
|
|
41
|
-
url: string[];
|
|
42
|
-
}[];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
module '@alife/micro-stark' {
|
|
46
|
-
export const isInIcestark: () => boolean;
|
|
47
|
-
export const getMountNode: () => Element;
|
|
48
|
-
export const registerAppEnter: (cb: () => unknown) => unknown;
|
|
49
|
-
export const registerAppLeave: (cb: () => unknown) => unknown;
|
|
50
|
-
export const getBasename: () => string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
declare module 'react/jsx-runtime';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { IListItem } from '@/types';
|
|
2
|
-
import { CnMessage } from '@cainiaofe/cn-ui';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { CardService } from 'src/services/CardService';
|
|
5
|
-
|
|
6
|
-
export const useCardOptionList = (id?: number) => {
|
|
7
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
try {
|
|
12
|
-
if (id) {
|
|
13
|
-
const data = await CardService.queryOptionList(id);
|
|
14
|
-
setState(data);
|
|
15
|
-
}
|
|
16
|
-
} catch (error) {
|
|
17
|
-
CnMessage(error.message);
|
|
18
|
-
}
|
|
19
|
-
})();
|
|
20
|
-
}, [id]);
|
|
21
|
-
|
|
22
|
-
return state;
|
|
23
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { CostService } from '@/services/CostService';
|
|
2
|
-
import { IListItem } from '@/types';
|
|
3
|
-
import { CnMessage } from '@cainiaofe/cn-ui';
|
|
4
|
-
import { useEffect, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
export const useCostFiltersDicList = (name: string, isInside = false) => {
|
|
7
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
if (name) {
|
|
12
|
-
try {
|
|
13
|
-
setState(await CostService.getDicList(name, isInside));
|
|
14
|
-
} catch (error) {
|
|
15
|
-
CnMessage.error(error.message);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
})();
|
|
19
|
-
}, [isInside, name]);
|
|
20
|
-
|
|
21
|
-
return state;
|
|
22
|
-
};
|
package/src/hooks/useFbiUrl.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { CommonService } from '@/services/CommonService';
|
|
2
|
-
import { CnMessage } from '@cainiaofe/cn-ui';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
|
|
5
|
-
export const useFbiUrl = (id?: string | number) => {
|
|
6
|
-
const [state, setState] = useState<string>();
|
|
7
|
-
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
(async () => {
|
|
10
|
-
try {
|
|
11
|
-
if (id) {
|
|
12
|
-
const data = await CommonService.getFbiUrl(id);
|
|
13
|
-
setState(data);
|
|
14
|
-
}
|
|
15
|
-
} catch (error) {
|
|
16
|
-
CnMessage.error(error.message);
|
|
17
|
-
}
|
|
18
|
-
})();
|
|
19
|
-
}, [id]);
|
|
20
|
-
|
|
21
|
-
return state;
|
|
22
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
import { useLocation } from 'react-router-dom';
|
|
3
|
-
import { atom, useRecoilValue, useSetRecoilState } from 'recoil';
|
|
4
|
-
|
|
5
|
-
const halfScreenState = atom<{
|
|
6
|
-
show: boolean;
|
|
7
|
-
src?: string;
|
|
8
|
-
title?: string;
|
|
9
|
-
}>({
|
|
10
|
-
key: 'half-screen-state',
|
|
11
|
-
default: {
|
|
12
|
-
show: false,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export const useHalfScreenStateValue = () => useRecoilValue(halfScreenState);
|
|
17
|
-
export const useSetHalfScreenState = () => useSetRecoilState(halfScreenState);
|
|
18
|
-
|
|
19
|
-
export const useHalfScreenDispatch = () => {
|
|
20
|
-
const setState = useSetRecoilState(halfScreenState);
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
setState,
|
|
24
|
-
close: () => {
|
|
25
|
-
setState(() => ({
|
|
26
|
-
src: undefined,
|
|
27
|
-
title: undefined,
|
|
28
|
-
show: false,
|
|
29
|
-
}));
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const useAutoCloseHalfScreen = () => {
|
|
35
|
-
const setState = useSetRecoilState(halfScreenState);
|
|
36
|
-
const location = useLocation();
|
|
37
|
-
const refreshRef = useRef(false);
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (refreshRef.current) {
|
|
41
|
-
setState(() => ({
|
|
42
|
-
src: undefined,
|
|
43
|
-
title: undefined,
|
|
44
|
-
show: false,
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
refreshRef.current = true;
|
|
49
|
-
}, [location, setState]);
|
|
50
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect, RefObject } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 元素是否进入视口过
|
|
5
|
-
* @param ref
|
|
6
|
-
* @param options
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
export const useHasIntersected = <T extends Element>(
|
|
10
|
-
ref: RefObject<T>, // 接受外部传入的 ref
|
|
11
|
-
options?: IntersectionObserverInit,
|
|
12
|
-
): boolean => {
|
|
13
|
-
const [hasIntersected, setHasIntersected] = useState(false);
|
|
14
|
-
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
// 确保传入的 ref.current 不为空
|
|
17
|
-
if (ref.current) {
|
|
18
|
-
const observer = new IntersectionObserver((entries) => {
|
|
19
|
-
// 当元素进入视口时,更新状态
|
|
20
|
-
if (entries[0].isIntersecting) {
|
|
21
|
-
setHasIntersected(true);
|
|
22
|
-
// 如果只想监听一次,可以在这里取消观察
|
|
23
|
-
observer.unobserve(ref.current!);
|
|
24
|
-
}
|
|
25
|
-
}, options);
|
|
26
|
-
|
|
27
|
-
observer.observe(ref.current);
|
|
28
|
-
|
|
29
|
-
return () => {
|
|
30
|
-
observer.disconnect();
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}, [ref, options]);
|
|
34
|
-
|
|
35
|
-
return hasIntersected;
|
|
36
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { IndicatorService } from 'src/services/IndicatorService';
|
|
2
|
-
import { IIndicatorCardConfig } from '@/types';
|
|
3
|
-
import { CnMessage } from '@cainiaofe/cn-ui';
|
|
4
|
-
import { useEffect, useState } from 'react';
|
|
5
|
-
import { INDICATOR_CONFIG_BASE_URL } from 'src/utils';
|
|
6
|
-
|
|
7
|
-
export const useIndicatorCardInfo = (id?: number) => {
|
|
8
|
-
const [state, setState] = useState<Partial<IIndicatorCardConfig>>({});
|
|
9
|
-
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
(async () => {
|
|
12
|
-
if (id) {
|
|
13
|
-
try {
|
|
14
|
-
const data = await IndicatorService.getConfigInfo({
|
|
15
|
-
url: `${INDICATOR_CONFIG_BASE_URL}?id=${id}`,
|
|
16
|
-
});
|
|
17
|
-
setState(data);
|
|
18
|
-
} catch (error) {
|
|
19
|
-
CnMessage(error.message);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
})();
|
|
23
|
-
}, [id]);
|
|
24
|
-
|
|
25
|
-
return state;
|
|
26
|
-
};
|
|
@@ -1,22 +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 useIndicatorCardQueryList = (id?: number | string) => {
|
|
7
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
if (id) {
|
|
12
|
-
try {
|
|
13
|
-
setState(await IndicatorService.getCardQueryList(id));
|
|
14
|
-
} catch (error) {
|
|
15
|
-
CnMessage.error(error.message);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
})();
|
|
19
|
-
}, [id]);
|
|
20
|
-
|
|
21
|
-
return state;
|
|
22
|
-
};
|
|
@@ -1,25 +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 useIndicatorClassifyList = (isFirstLevel?: boolean) => {
|
|
7
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
try {
|
|
12
|
-
const data = await IndicatorService.getClassifyList();
|
|
13
|
-
setState(
|
|
14
|
-
isFirstLevel
|
|
15
|
-
? data.map((item) => ({ label: item.label, value: item.value }))
|
|
16
|
-
: data,
|
|
17
|
-
);
|
|
18
|
-
} catch (error) {
|
|
19
|
-
CnMessage(error.message);
|
|
20
|
-
}
|
|
21
|
-
})();
|
|
22
|
-
}, [isFirstLevel]);
|
|
23
|
-
|
|
24
|
-
return state;
|
|
25
|
-
};
|
|
@@ -1,22 +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 useIndicatorDetailsDateList = (id?: number | string) => {
|
|
7
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
if (id) {
|
|
12
|
-
try {
|
|
13
|
-
setState(await IndicatorService.getDateList(id));
|
|
14
|
-
} catch (error) {
|
|
15
|
-
CnMessage.error(error.message);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
})();
|
|
19
|
-
}, [id]);
|
|
20
|
-
|
|
21
|
-
return state;
|
|
22
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { IndicatorService } from '@/services/IndicatorService';
|
|
2
|
-
import { IIndicatorDetailsInfo, IIndicatorInfoQuery } from '@/types';
|
|
3
|
-
import { CnMessage } from '@cainiaofe/cn-ui';
|
|
4
|
-
import { useEffect, useState } from 'react';
|
|
5
|
-
|
|
6
|
-
export const useIndicatorDetailsInfo = ({
|
|
7
|
-
subId,
|
|
8
|
-
name,
|
|
9
|
-
type,
|
|
10
|
-
indicatorDate,
|
|
11
|
-
originId,
|
|
12
|
-
}: IIndicatorInfoQuery) => {
|
|
13
|
-
const [state, setState] = useState<Partial<IIndicatorDetailsInfo>>({});
|
|
14
|
-
const [loading, setLoading] = useState(false);
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
(async () => {
|
|
18
|
-
if (subId && indicatorDate) {
|
|
19
|
-
try {
|
|
20
|
-
setLoading(true);
|
|
21
|
-
if (name && type) {
|
|
22
|
-
setState(
|
|
23
|
-
await IndicatorService.getDownDetails({
|
|
24
|
-
originId,
|
|
25
|
-
subId,
|
|
26
|
-
name,
|
|
27
|
-
type,
|
|
28
|
-
indicatorDate,
|
|
29
|
-
}),
|
|
30
|
-
);
|
|
31
|
-
} else {
|
|
32
|
-
setState(
|
|
33
|
-
await IndicatorService.getDetails({
|
|
34
|
-
subId,
|
|
35
|
-
indicatorDate,
|
|
36
|
-
}),
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
} catch (error) {
|
|
40
|
-
CnMessage.error(error.message);
|
|
41
|
-
} finally {
|
|
42
|
-
setLoading(false);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
})();
|
|
46
|
-
}, [subId, name, type, indicatorDate, originId]);
|
|
47
|
-
|
|
48
|
-
return { data: state, loading };
|
|
49
|
-
};
|
|
@@ -1,25 +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 useIndicatorDetailsTrend = (
|
|
7
|
-
id?: string | number,
|
|
8
|
-
name?: string,
|
|
9
|
-
) => {
|
|
10
|
-
const [state, setState] = useState<IListItem<number>[]>([]);
|
|
11
|
-
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
(async () => {
|
|
14
|
-
if (id && name) {
|
|
15
|
-
try {
|
|
16
|
-
setState(await IndicatorService.getDetailsTrend(id, name));
|
|
17
|
-
} catch (error) {
|
|
18
|
-
CnMessage.error(error.message);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
})();
|
|
22
|
-
}, [id, name]);
|
|
23
|
-
|
|
24
|
-
return state;
|
|
25
|
-
};
|
|
@@ -1,22 +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 useIndicatorDicList = (name: string) => {
|
|
7
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
if (name) {
|
|
12
|
-
try {
|
|
13
|
-
setState(await IndicatorService.getDicList(name));
|
|
14
|
-
} catch (error) {
|
|
15
|
-
CnMessage.error(error.message);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
})();
|
|
19
|
-
}, [name]);
|
|
20
|
-
|
|
21
|
-
return state;
|
|
22
|
-
};
|
|
@@ -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 useIndicatorLabelList = () => {
|
|
7
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
try {
|
|
12
|
-
setState(await IndicatorService.getLabelList());
|
|
13
|
-
} catch (error) {
|
|
14
|
-
CnMessage.error(error.message);
|
|
15
|
-
}
|
|
16
|
-
})();
|
|
17
|
-
}, []);
|
|
18
|
-
|
|
19
|
-
return state;
|
|
20
|
-
};
|
|
@@ -1,24 +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 useIndicatorList = (timeSpan?: string, orgLevel?: string) => {
|
|
7
|
-
const [state, setState] = useState<IListItem<number>[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
try {
|
|
12
|
-
const data = await IndicatorService.queryIndicatorList(
|
|
13
|
-
timeSpan,
|
|
14
|
-
orgLevel,
|
|
15
|
-
);
|
|
16
|
-
setState(data);
|
|
17
|
-
} catch (error) {
|
|
18
|
-
CnMessage(error.message);
|
|
19
|
-
}
|
|
20
|
-
})();
|
|
21
|
-
}, [orgLevel, timeSpan]);
|
|
22
|
-
|
|
23
|
-
return state;
|
|
24
|
-
};
|
|
@@ -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 useIndicatorRangeList = () => {
|
|
7
|
-
const [state, setState] = useState<IListItem[]>([]);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
try {
|
|
12
|
-
setState(await IndicatorService.getRangeList());
|
|
13
|
-
} catch (error) {
|
|
14
|
-
CnMessage.error(error.message);
|
|
15
|
-
}
|
|
16
|
-
})();
|
|
17
|
-
}, []);
|
|
18
|
-
|
|
19
|
-
return state;
|
|
20
|
-
};
|