win-chart 1.0.0

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.
Files changed (185) hide show
  1. package/.eslintrc.json +3 -0
  2. package/.prettierrc.json +5 -0
  3. package/README.md +0 -0
  4. package/localhost-key.pem +28 -0
  5. package/localhost.pem +25 -0
  6. package/package.json +65 -0
  7. package/rsbuild.config.ts +48 -0
  8. package/src/api/README.md +15 -0
  9. package/src/api/index.js +5 -0
  10. package/src/api/layout/index.js +32 -0
  11. package/src/api/request.ts +87 -0
  12. package/src/api/url-map/index.js +10 -0
  13. package/src/api/user/index.js +12 -0
  14. package/src/components/FilterContext.tsx +6 -0
  15. package/src/components/GlobalStyle.tsx +25 -0
  16. package/src/components/HalfScreenBrowser.tsx +95 -0
  17. package/src/components/ImgBox.tsx +19 -0
  18. package/src/components/JumpBtn.tsx +38 -0
  19. package/src/components/MCardWrapper.tsx +33 -0
  20. package/src/components/NoContent/index.tsx +85 -0
  21. package/src/components/ResponsiveReactGridLayout.tsx +218 -0
  22. package/src/components/SliderDecoration.tsx +27 -0
  23. package/src/components/VisionUserConfigContext.ts +6 -0
  24. package/src/components/WinMenu/README.md +11 -0
  25. package/src/components/WinMenu/WinHeader.tsx +5 -0
  26. package/src/components/WinMenu/components/ExtraBox.tsx +61 -0
  27. package/src/components/WinMenu/components/FullMenuBox.tsx +80 -0
  28. package/src/components/WinMenu/components/FullMenuContainer.tsx +50 -0
  29. package/src/components/WinMenu/components/FullMenuItem.tsx +128 -0
  30. package/src/components/WinMenu/components/LangSwitch.tsx +84 -0
  31. package/src/components/WinMenu/components/LogoBox.tsx +29 -0
  32. package/src/components/WinMenu/components/PinDialog.tsx +72 -0
  33. package/src/components/WinMenu/components/PinnedMenuBox.tsx +183 -0
  34. package/src/components/WinMenu/components/UserBox.tsx +83 -0
  35. package/src/components/WinMenu/hooks/useUserInfo.ts +21 -0
  36. package/src/components/WinMenu/hooks/useUserMenu.ts +35 -0
  37. package/src/components/WinMenu/index.tsx +100 -0
  38. package/src/components/WinMenu/services/WinService.ts +79 -0
  39. package/src/components/WinMenu/services/request.ts +53 -0
  40. package/src/components/WinMenu/utils/const.ts +80 -0
  41. package/src/components/WinMenu/utils/enum.ts +19 -0
  42. package/src/components/WinMenu/utils/interface.ts +61 -0
  43. package/src/components/WinMenu/utils/map.ts +39 -0
  44. package/src/components/WinMenu/utils/tool.ts +142 -0
  45. package/src/components/WinMenu/utils/type.ts +1 -0
  46. package/src/components/hover-view.tsx +48 -0
  47. package/src/components/icon.tsx +44 -0
  48. package/src/components/indicator-remark.tsx +25 -0
  49. package/src/components/none-content.tsx +93 -0
  50. package/src/components/panel-tab.tsx +150 -0
  51. package/src/components/panel-title-tab.tsx +60 -0
  52. package/src/components/win-card/components/ChartContent.tsx +47 -0
  53. package/src/components/win-card/components/Indicator.tsx +42 -0
  54. package/src/components/win-card/components/IndicatorArea.tsx +63 -0
  55. package/src/components/win-card/components/IndicatorInfo.tsx +78 -0
  56. package/src/components/win-card/components/MatterContent.tsx +121 -0
  57. package/src/components/win-card/components/MatterList.tsx +141 -0
  58. package/src/components/win-card/components/NoticeContent.tsx +73 -0
  59. package/src/components/win-card/components/NoticeList.tsx +68 -0
  60. package/src/components/win-card/components/SelectDecoration.tsx +34 -0
  61. package/src/components/win-card/components/WinRankContent.tsx +102 -0
  62. package/src/components/win-card/index.tsx +298 -0
  63. package/src/components/win-card/utils/interface.ts +12 -0
  64. package/src/components/win-card/utils/tool.ts +11 -0
  65. package/src/components/win-card-mobile/components/ChartContent.tsx +47 -0
  66. package/src/components/win-card-mobile/components/DualLineBar.tsx +61 -0
  67. package/src/components/win-card-mobile/components/Indicator.tsx +42 -0
  68. package/src/components/win-card-mobile/components/IndicatorArea.tsx +65 -0
  69. package/src/components/win-card-mobile/components/IndicatorInfo.tsx +83 -0
  70. package/src/components/win-card-mobile/components/SelectDecoration.tsx +28 -0
  71. package/src/components/win-card-mobile/index.tsx +235 -0
  72. package/src/components/win-card-mobile/utils/interface.ts +12 -0
  73. package/src/components/win-card-mobile/utils/tool.ts +9 -0
  74. package/src/components/win-chart/components/chart-wrapper.tsx +5 -0
  75. package/src/components/win-chart/index.tsx +59 -0
  76. package/src/components/win-chart/theme/win-dark.json +372 -0
  77. package/src/components/win-chart/theme/win-light.json +372 -0
  78. package/src/components/win-chart/utils/const.ts +37 -0
  79. package/src/components/win-chart/utils/getAreaSpec.ts +150 -0
  80. package/src/components/win-chart/utils/getBarSpec.ts +60 -0
  81. package/src/components/win-chart/utils/getChartOptions.ts +59 -0
  82. package/src/components/win-chart/utils/getColumnSpec.ts +112 -0
  83. package/src/components/win-chart/utils/getDualSpec.ts +79 -0
  84. package/src/components/win-chart/utils/getFunnelSpec.ts +70 -0
  85. package/src/components/win-chart/utils/getLineSpec.ts +53 -0
  86. package/src/components/win-chart/utils/getPieSpec.ts +124 -0
  87. package/src/components/win-chart/utils/getRadarSpec.ts +87 -0
  88. package/src/components/win-chart/utils/tool.ts +163 -0
  89. package/src/components/win-chart/utils/type.ts +96 -0
  90. package/src/components/win-icon/index.tsx +97 -0
  91. package/src/components/win-v/components/EmptyBox.tsx +9 -0
  92. package/src/components/win-v/components/VDialog.tsx +173 -0
  93. package/src/components/win-v/components/VDialogBtn.tsx +119 -0
  94. package/src/components/win-v/components/VDialogMsg.tsx +325 -0
  95. package/src/components/win-v/components/VInput.tsx +15 -0
  96. package/src/components/win-v/components/VRemindMsgList.tsx +303 -0
  97. package/src/components/win-v/components/VRobot.tsx +97 -0
  98. package/src/components/win-v/hooks/useVDialogCore.ts +102 -0
  99. package/src/components/win-v/hooks/useVDialogOperate.ts +132 -0
  100. package/src/components/win-v/hooks/useVDialogState.ts +52 -0
  101. package/src/components/win-v/hooks/useVRemindMsgShow.ts +15 -0
  102. package/src/components/win-v/index.tsx +205 -0
  103. package/src/components/win-wrappers/card-wrapper.tsx +103 -0
  104. package/src/components/win-wrappers/dot-wrapper.tsx +18 -0
  105. package/src/components/win-wrappers/iframe-wrapper.tsx +7 -0
  106. package/src/components/win-wrappers/request-wrapper.tsx +190 -0
  107. package/src/global.d.ts +53 -0
  108. package/src/hooks/useCardOptionList.ts +23 -0
  109. package/src/hooks/useCostFiltersDicList.ts +22 -0
  110. package/src/hooks/useFbiUrl.ts +22 -0
  111. package/src/hooks/useHalfScreenState.ts +50 -0
  112. package/src/hooks/useHasIntersected.ts +36 -0
  113. package/src/hooks/useIndicatorCardInfo.ts +26 -0
  114. package/src/hooks/useIndicatorCardQueryList.ts +22 -0
  115. package/src/hooks/useIndicatorClassifyList.ts +25 -0
  116. package/src/hooks/useIndicatorDetailsDateList.ts +22 -0
  117. package/src/hooks/useIndicatorDetailsInfo.ts +49 -0
  118. package/src/hooks/useIndicatorDetailsTrend.ts +25 -0
  119. package/src/hooks/useIndicatorDicList.ts +22 -0
  120. package/src/hooks/useIndicatorLabelList.ts +20 -0
  121. package/src/hooks/useIndicatorList.ts +24 -0
  122. package/src/hooks/useIndicatorRangeList.ts +20 -0
  123. package/src/hooks/useIndicatorTypeList.ts +20 -0
  124. package/src/hooks/useIndicatorUnitList.ts +21 -0
  125. package/src/hooks/useListenQuery.ts +29 -0
  126. package/src/hooks/useMobile.ts +58 -0
  127. package/src/hooks/useNotice.ts +42 -0
  128. package/src/hooks/useOrgLevelList.ts +23 -0
  129. package/src/hooks/usePageSelection.ts +121 -0
  130. package/src/hooks/usePageState.ts +22 -0
  131. package/src/hooks/usePendingList.ts +27 -0
  132. package/src/hooks/usePortalPageInfo.ts +43 -0
  133. package/src/hooks/useRefreshByLocationChange.ts +16 -0
  134. package/src/hooks/useReportIndicatorList.ts +21 -0
  135. package/src/hooks/useReportInfo.ts +45 -0
  136. package/src/hooks/useReportPersonList.ts +21 -0
  137. package/src/hooks/useScriptLoader.ts +22 -0
  138. package/src/hooks/useUnreadMsgList.ts +26 -0
  139. package/src/hooks/useUserAvatar.ts +23 -0
  140. package/src/hooks/useVReportInfo.ts +50 -0
  141. package/src/hooks/useVisionUserConfig.ts +25 -0
  142. package/src/hooks/useWorkbenchOptions.ts +63 -0
  143. package/src/index.tsx +20 -0
  144. package/src/services/CardService.ts +91 -0
  145. package/src/services/CommonService.ts +23 -0
  146. package/src/services/CostService.ts +56 -0
  147. package/src/services/DialogService.ts +74 -0
  148. package/src/services/IndicatorService.ts +406 -0
  149. package/src/services/PageService.ts +204 -0
  150. package/src/services/ReportService.ts +335 -0
  151. package/src/services/WorkbenchService.ts +411 -0
  152. package/src/styles/README.md +12 -0
  153. package/src/styles/index.scss +9 -0
  154. package/src/styles/mixins/index.scss +25 -0
  155. package/src/styles/next-cover.scss +4 -0
  156. package/src/styles/normalize.scss +27 -0
  157. package/src/styles/utilities/index.scss +5 -0
  158. package/src/styles/vars/index.scss +17 -0
  159. package/src/types/enum-workbench.ts +29 -0
  160. package/src/types/enum.ts +156 -0
  161. package/src/types/index.ts +19 -0
  162. package/src/types/indicator.ts +299 -0
  163. package/src/types/interface.ts +303 -0
  164. package/src/types/portal.ts +211 -0
  165. package/src/types/report.ts +28 -0
  166. package/src/types/type.ts +11 -0
  167. package/src/types/user.ts +28 -0
  168. package/src/utils/README.md +4 -0
  169. package/src/utils/arms.ts +59 -0
  170. package/src/utils/arr.ts +123 -0
  171. package/src/utils/const-workbench.ts +9 -0
  172. package/src/utils/const.ts +18 -0
  173. package/src/utils/index.ts +18 -0
  174. package/src/utils/init.ts +5 -0
  175. package/src/utils/map-workbench.ts +66 -0
  176. package/src/utils/map.ts +377 -0
  177. package/src/utils/number.ts +101 -0
  178. package/src/utils/page.ts +81 -0
  179. package/src/utils/str.ts +26 -0
  180. package/src/utils/tools.ts +44 -0
  181. package/src/utils/tree.ts +145 -0
  182. package/src/utils/url.ts +40 -0
  183. package/src/utils/util.ts +99 -0
  184. package/src/utils/workbench.ts +25 -0
  185. package/tsconfig.json +33 -0
@@ -0,0 +1,63 @@
1
+ import { IListItem, IWorkbenchOptions } from '@/types';
2
+ import { CnMessage } from '@cainiaofe/cn-ui';
3
+ import { useEffect, useState } from 'react';
4
+ import {
5
+ atom,
6
+ useRecoilState,
7
+ useRecoilValue,
8
+ useSetRecoilState,
9
+ } from 'recoil';
10
+ import { WorkbenchService } from 'src/services/WorkbenchService';
11
+
12
+ const optionsState = atom<IWorkbenchOptions>({
13
+ key: 'workbench-options',
14
+ default: {
15
+ roleList: [],
16
+ pendingList: [],
17
+ noticeList: [],
18
+ },
19
+ });
20
+
21
+ export const useWorkbenchOptions = () => {
22
+ const [state, setState] = useRecoilState(optionsState);
23
+
24
+ useEffect(() => {
25
+ (async () => {
26
+ try {
27
+ const data = await WorkbenchService.getWorkbenchOptions();
28
+ setState(data);
29
+ } catch (error) {
30
+ CnMessage(error.message);
31
+ }
32
+ })();
33
+ }, [setState]);
34
+
35
+ return state;
36
+ };
37
+
38
+ export const useWorkbenchOptionsValue = () => useRecoilValue(optionsState);
39
+
40
+ const initState = atom({
41
+ key: 'has-init-workbench-role-code',
42
+ default: false,
43
+ });
44
+ export const useHasInitWorkbenchRoleCode = () => useRecoilValue(initState);
45
+ export const useSetHasInitWorkbenchRoleCode = () =>
46
+ useSetRecoilState(initState);
47
+
48
+ export const useWorkbenchRoleList = () => {
49
+ const [state, setState] = useState<IListItem[]>([]);
50
+
51
+ useEffect(() => {
52
+ (async () => {
53
+ try {
54
+ const data = await WorkbenchService.getWorkbenchRoleList();
55
+ setState(data);
56
+ } catch (error) {
57
+ CnMessage(error.message);
58
+ }
59
+ })();
60
+ }, []);
61
+
62
+ return state;
63
+ };
package/src/index.tsx ADDED
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import { WinChart } from './components/win-chart';
4
+ import { WinCard } from './components/win-card';
5
+
6
+ export { WinCard, WinChart };
7
+
8
+ // const App = () => {
9
+ // return (
10
+ // <div>
11
+ // <h1>Win Chart</h1>
12
+ // </div>
13
+ // );
14
+ // };
15
+
16
+ // ReactDOM.createRoot(document.getElementById('root')!).render(
17
+ // <React.StrictMode>
18
+ // <App />
19
+ // </React.StrictMode>,
20
+ // );
@@ -0,0 +1,91 @@
1
+ import { newRequest } from '@/api/request';
2
+ import { handleResult } from '@/utils';
3
+ import { IIndicatorCardConfig, IListItem } from 'src/types';
4
+
5
+ export class CardService {
6
+ /**
7
+ * 查询卡片配置
8
+ * @param request
9
+ * @returns
10
+ */
11
+ public static async getConfigInfo(id: number) {
12
+ const resp = handleResult(
13
+ await newRequest<IIndicatorCardConfig>({
14
+ url: `/workbench/widget/queryById?id=${id}`,
15
+ }),
16
+ );
17
+
18
+ return resp;
19
+ }
20
+
21
+ /**
22
+ * 新增卡片配置
23
+ * @param data
24
+ * @returns
25
+ */
26
+ public static async addConfigInfo(data: Partial<IIndicatorCardConfig>) {
27
+ const resp = handleResult(
28
+ await newRequest<Partial<IIndicatorCardConfig>>({
29
+ url: '/workbench/widget/save',
30
+ method: 'POST',
31
+ data,
32
+ }),
33
+ );
34
+
35
+ return resp;
36
+ }
37
+
38
+ /**
39
+ * 新增卡片配置
40
+ * @param data
41
+ * @returns
42
+ */
43
+ public static async updateConfigInfo(data: Partial<IIndicatorCardConfig>) {
44
+ const resp = handleResult(
45
+ await newRequest<Partial<IIndicatorCardConfig>>({
46
+ url: '/workbench/widget/save',
47
+ method: 'POST',
48
+ data,
49
+ }),
50
+ );
51
+
52
+ return resp;
53
+ }
54
+
55
+ /**
56
+ * 查询卡片下拉列表
57
+ * @param id
58
+ * @returns
59
+ */
60
+ public static async queryOptionList(id: number) {
61
+ const resp = handleResult(
62
+ await newRequest<IListItem[]>({
63
+ url: '/workbench/widget/option',
64
+ params: {
65
+ id,
66
+ },
67
+ }),
68
+ );
69
+
70
+ return resp;
71
+ }
72
+
73
+ /**
74
+ * 删除卡片
75
+ * @param id
76
+ * @returns
77
+ */
78
+ public static async delete(id: number) {
79
+ const resp = handleResult(
80
+ await newRequest<boolean>({
81
+ url: '/workbench/widget/delete',
82
+ method: 'GET',
83
+ params: {
84
+ id,
85
+ },
86
+ }),
87
+ );
88
+
89
+ return resp;
90
+ }
91
+ }
@@ -0,0 +1,23 @@
1
+ import { newRequest } from '@/api/request';
2
+ import { handleResult } from '@/utils';
3
+
4
+ export class CommonService {
5
+ /**
6
+ * 获取 FBI 地址
7
+ * @param id
8
+ * @returns
9
+ */
10
+ public static async getFbiUrl(id: number | string) {
11
+ // const resp = handleResult(
12
+ // await newRequest<{ reportId: number; url: string }>({
13
+ // url: `/inc/reportUrl/${id}`,
14
+ // }),
15
+ // );
16
+
17
+ const resp = await fetch(`/inc/reportUrl/${id}`).then<{
18
+ module?: { url: string; id: number };
19
+ }>((res) => res.json());
20
+
21
+ return resp.module?.url;
22
+ }
23
+ }
@@ -0,0 +1,56 @@
1
+ import { newRequest } from '@/api/request';
2
+ import { handleResult } from '@/utils';
3
+ import { IIndicatorCardConfig, IListItem } from 'src/types';
4
+ import { getBossOrigin } from '@/utils/tools';
5
+ export class CostService {
6
+ /**
7
+ * 获取成本力指数筛选条件数据源
8
+ * @returns
9
+ */
10
+ public static async getDicList(name: string, isInside: boolean) {
11
+ const resp = handleResult(
12
+ await newRequest<IListItem[]>({
13
+ url: `${getBossOrigin(isInside)}/cost/powerIndex/getSelectList`,
14
+ method: 'POST',
15
+ data: {
16
+ type: name,
17
+ },
18
+ }),
19
+ );
20
+
21
+ return resp;
22
+ }
23
+ /**
24
+ * 获取成本力指数数据
25
+ * @returns
26
+ */
27
+ public static async getIndexDataList(params: any, isInside: boolean) {
28
+ const resp = handleResult(
29
+ await newRequest<IListItem[]>({
30
+ url: `${getBossOrigin(isInside)}/cost/powerIndex/getIndexDataList`,
31
+ method: 'POST',
32
+ data: {
33
+ ...params,
34
+ },
35
+ }),
36
+ );
37
+
38
+ return resp;
39
+ }
40
+ public static async exportIndexData(params: any, isInside: boolean) {
41
+ const resp = handleResult(
42
+ await newRequest<IListItem[]>({
43
+ url: `${getBossOrigin(isInside)}/basic/excel/exportExcel`,
44
+ method: 'POST',
45
+ data: {
46
+ param: {
47
+ ...params,
48
+ },
49
+ type: 'cost-indexExportTemplate',
50
+ },
51
+ }),
52
+ );
53
+
54
+ return resp;
55
+ }
56
+ }
@@ -0,0 +1,74 @@
1
+ import { newRequest } from '@/api/request';
2
+ import { ICnQuery, ICnTableData, IDialogMsgInfo } from '@/types';
3
+ import { handleResult, objectToFormData } from '@/utils';
4
+
5
+ export class DialogService {
6
+ /**
7
+ * 获取列表
8
+ * @param data
9
+ * @returns
10
+ */
11
+ public static async queryList(data: ICnQuery) {
12
+ const resp = handleResult(
13
+ await newRequest<ICnTableData<IDialogMsgInfo>>({
14
+ url: '/dialog/query',
15
+ method: 'POST',
16
+ data: objectToFormData(data),
17
+ }),
18
+ );
19
+
20
+ return resp;
21
+ }
22
+
23
+ /**
24
+ * 发起对话
25
+ * @param content
26
+ */
27
+ public static async send(content: string | number) {
28
+ const resp = handleResult(
29
+ await newRequest<number>({
30
+ url: '/dialog/send',
31
+ method: 'POST',
32
+ data: objectToFormData({
33
+ content,
34
+ }),
35
+ }),
36
+ );
37
+
38
+ return resp;
39
+ }
40
+
41
+ /**
42
+ * 反馈
43
+ * @param content
44
+ */
45
+ public static async feedback(content: string | number) {
46
+ const resp = handleResult(
47
+ await newRequest<number>({
48
+ url: '/dialog/feedback',
49
+ method: 'GET',
50
+ params: {
51
+ content,
52
+ },
53
+ }),
54
+ );
55
+
56
+ return resp;
57
+ }
58
+
59
+ /**
60
+ * 更新对话
61
+ * @param data
62
+ */
63
+ public static async update(data: Partial<IDialogMsgInfo>) {
64
+ const resp = handleResult(
65
+ await newRequest<number>({
66
+ url: '/dialog/update',
67
+ method: 'GET',
68
+ params: data,
69
+ }),
70
+ );
71
+
72
+ return resp;
73
+ }
74
+ }