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,102 @@
1
+ import { CnBox } from '@cainiaofe/cn-ui';
2
+ import { Fragment } from 'react';
3
+ import { HoverView } from 'src/components/hover-view';
4
+ import { RequestWrapper } from 'src/components/win-wrappers/request-wrapper';
5
+ import { WorkbenchService } from 'src/services/WorkbenchService';
6
+ import { styled } from 'styled-components';
7
+
8
+ export const WinRankContent = () => {
9
+ return (
10
+ <RequestWrapper service={WorkbenchService.queryWinRankList}>
11
+ {(data) => {
12
+ return (
13
+ <Wrapper>
14
+ {data.map((item, index) => (
15
+ <div key={item.title}>
16
+ <div data-title>{item.title}</div>
17
+ <div data-content>
18
+ {item.list?.map((info, i) => {
19
+ const isTopFive = i < 5;
20
+ const getMarginStyle = () => {
21
+ if (i === 4) {
22
+ return {
23
+ marginBottom: 4,
24
+ };
25
+ }
26
+ };
27
+ return (
28
+ <Fragment key={info.label + info.children}>
29
+ {index === 0 ? (
30
+ <Mark style={getMarginStyle()}>
31
+ {isTopFive ? '❤️' : '💪'}
32
+ </Mark>
33
+ ) : (
34
+ <InfoDecoration
35
+ style={{
36
+ backgroundColor: isTopFive
37
+ ? 'rgba(250,107,105,0.1)'
38
+ : 'rgba(177,185,199,0.2)',
39
+ ...getMarginStyle(),
40
+ }}
41
+ >
42
+ <div data-label>
43
+ <HoverView content={info.label} />
44
+ </div>
45
+ <span>{info.value}</span>
46
+ </InfoDecoration>
47
+ )}
48
+ </Fragment>
49
+ );
50
+ })}
51
+ </div>
52
+ </div>
53
+ ))}
54
+ </Wrapper>
55
+ );
56
+ }}
57
+ </RequestWrapper>
58
+ );
59
+ };
60
+
61
+ const Wrapper = styled.div`
62
+ display: grid;
63
+ grid: auto-flow / 36px repeat(4, 1fr);
64
+ gap: 8px;
65
+ overflow: auto;
66
+
67
+ [data-title] {
68
+ font-weight: 500;
69
+ font-size: 12px;
70
+ color: #394252;
71
+ line-height: 1;
72
+ margin-bottom: 16px;
73
+ display: grid;
74
+ place-items: center;
75
+ }
76
+
77
+ [data-content] {
78
+ display: grid;
79
+ grid: auto-flow 24px / 1fr;
80
+ gap: 12px;
81
+ }
82
+ `;
83
+
84
+ const Mark = styled.div`
85
+ display: grid;
86
+ place-items: center;
87
+ `;
88
+
89
+ const InfoDecoration = styled(CnBox).attrs({
90
+ direction: 'row',
91
+ justify: 'space-between',
92
+ align: 'center',
93
+ })`
94
+ border-radius: 500px;
95
+ font-size: 12px;
96
+ color: #272f3d;
97
+ padding: 0 10px;
98
+
99
+ [data-label] {
100
+ width: 80px;
101
+ }
102
+ `;
@@ -0,0 +1,298 @@
1
+ import $i18n from 'panda-i18n';
2
+ import { IndicatorService } from 'src/services/IndicatorService';
3
+ import { IIndicatorCardConfig } from '@/types';
4
+ import { IndicatorArea } from './components/IndicatorArea';
5
+ import { RequestWrapper } from '../win-wrappers/request-wrapper';
6
+ import { CardTitleWrapper, CardWrapper } from '../win-wrappers/card-wrapper';
7
+ import { WinCardChartType } from 'src/types/enum';
8
+ import { INDICATOR_CONFIG_BASE_URL } from '../../utils/const';
9
+ import { MatterContent } from './components/MatterContent';
10
+ import { Indicator } from './components/Indicator';
11
+ import { ChartContent } from './components/ChartContent';
12
+ import { CnBox, CnDropdown, CnMenu, CnMenuItem, Icon } from '@cainiaofe/cn-ui';
13
+ import {
14
+ IndicatorSelectDecoration,
15
+ SelectDecoration,
16
+ } from './components/SelectDecoration';
17
+ import {
18
+ checkEntityArr,
19
+ getHandleOpenLink,
20
+ getListLabel,
21
+ unitList,
22
+ } from 'src/utils';
23
+ import { CSSProperties, useContext, useEffect, useRef, useState } from 'react';
24
+ import { HoverView } from '../hover-view';
25
+ import { useCardOptionList } from 'src/hooks/useCardOptionList';
26
+ import { VisionUserConfigContext } from '../VisionUserConfigContext';
27
+ import { WinChartType } from '../win-chart';
28
+ import { WinRankContent } from './components/WinRankContent';
29
+ import { useHasIntersected } from '@/hooks/useHasIntersected';
30
+
31
+ interface IProps {
32
+ id: number;
33
+ config?: IIndicatorCardConfig;
34
+ style?: CSSProperties;
35
+ }
36
+
37
+ export const WinCard = ({ id, config, style }: IProps) => {
38
+ if (config) {
39
+ return <ShowCard configData={config} style={style} />;
40
+ }
41
+
42
+ return (
43
+ <RequestWrapper
44
+ requestData={{ url: `${INDICATOR_CONFIG_BASE_URL}?id=${id}` }}
45
+ service={IndicatorService.getConfigInfo}
46
+ style={{
47
+ width: '100%',
48
+ height: '100%',
49
+ ...style,
50
+ }}
51
+ >
52
+ {(configData) => {
53
+ return (
54
+ <ShowCard
55
+ configData={configData}
56
+ style={{ height: configData.colHeight * 128 }}
57
+ />
58
+ );
59
+ }}
60
+ </RequestWrapper>
61
+ );
62
+ };
63
+
64
+ const ShowCard = ({
65
+ configData,
66
+ style,
67
+ }: {
68
+ configData: IIndicatorCardConfig;
69
+ style?: CSSProperties;
70
+ }) => {
71
+ const wrapperRef = useRef<HTMLDivElement>(null);
72
+ const hasIntersected = useHasIntersected(wrapperRef);
73
+ const orgLevelList = useCardOptionList(
74
+ hasIntersected && configData.commonConfig.orgLevel
75
+ ? configData.id
76
+ : undefined,
77
+ );
78
+ const [curOrgLevelValue, setCurOrgLevelValue] = useState<string>();
79
+ const isSingleIndicator = configData.chartType === WinCardChartType.INDICATOR;
80
+ const hasOrgLevel = !!configData.commonConfig.orgLevel;
81
+ const isCommonTitle = ![WinCardChartType.CUSTOM_CARD].includes(
82
+ configData.chartType,
83
+ );
84
+ const jumpUrl = configData.detailUrl;
85
+ const menuItems = [
86
+ ...(jumpUrl
87
+ ? [
88
+ <CnMenuItem key="jump" onClick={getHandleOpenLink(jumpUrl)}>
89
+ {$i18n.get({ id: 'ViewDetails', dm: '查看详情' })}
90
+ </CnMenuItem>,
91
+ ]
92
+ : []),
93
+ ];
94
+
95
+ const visionUserConfig = useContext(VisionUserConfigContext);
96
+ const hasInitOrgLevelRef = useRef(false);
97
+
98
+ useEffect(() => {
99
+ if (orgLevelList.length !== 0 && visionUserConfig) {
100
+ const configOrgLevelVal =
101
+ visionUserConfig[configData.commonConfig.orgLevel];
102
+ const valueInList = orgLevelList
103
+ .map((item) => item.value)
104
+ .includes(configOrgLevelVal);
105
+
106
+ if (!hasInitOrgLevelRef.current) {
107
+ // 第一次赋值
108
+ setCurOrgLevelValue(
109
+ valueInList ? configOrgLevelVal : orgLevelList[0].value,
110
+ );
111
+ hasInitOrgLevelRef.current = true;
112
+ } else {
113
+ // 用户配置切换赋值
114
+ if (valueInList) {
115
+ setCurOrgLevelValue(configOrgLevelVal);
116
+ }
117
+ }
118
+ }
119
+ }, [configData.commonConfig.orgLevel, orgLevelList, visionUserConfig]);
120
+
121
+ // 单位
122
+ const unit = getListLabel(unitList, configData.indicatorConfig[0]?.unit);
123
+
124
+ return (
125
+ <CardWrapper ref={wrapperRef} style={style}>
126
+ {isCommonTitle && (
127
+ <CnBox direction="row" justify="space-between" style={{ height: 20 }}>
128
+ <CardTitleWrapper
129
+ data-card-id={configData.id}
130
+ style={{
131
+ maxWidth: isSingleIndicator || !hasOrgLevel ? '80%' : '45%',
132
+ position: 'relative',
133
+ ...([
134
+ WinCardChartType.INDICATOR,
135
+ WinCardChartType.INDICATOR_AREA,
136
+ ].includes(configData.chartType) && {
137
+ fontSize: '12px',
138
+ fontWeight: 'normal',
139
+ }),
140
+ }}
141
+ >
142
+ <HoverView content={configData.name} />
143
+ </CardTitleWrapper>
144
+ <CnBox direction="row" align="center">
145
+ {hasOrgLevel && !isSingleIndicator && (
146
+ <SelectDecoration
147
+ value={curOrgLevelValue}
148
+ dataSource={orgLevelList}
149
+ onChange={setCurOrgLevelValue}
150
+ />
151
+ )}
152
+
153
+ {checkEntityArr(menuItems) && (
154
+ <div
155
+ style={{ transform: 'translate(8px, -4px) rotate(0.25turn)' }}
156
+ >
157
+ <CnDropdown
158
+ trigger={
159
+ <Icon type="ellipsis" style={{ cursor: 'pointer' }} />
160
+ }
161
+ >
162
+ <CnMenu style={{ width: 15 }}>{menuItems}</CnMenu>
163
+ </CnDropdown>
164
+ </div>
165
+ )}
166
+ </CnBox>
167
+ </CnBox>
168
+ )}
169
+
170
+ {getShowContent({
171
+ configData,
172
+ hasOrgLevel,
173
+ orgLevelVal: curOrgLevelValue,
174
+ unit,
175
+ })}
176
+ {isSingleIndicator && (
177
+ <CnBox spacing={8}>
178
+ {hasOrgLevel && (
179
+ <IndicatorSelectDecoration
180
+ value={curOrgLevelValue}
181
+ dataSource={orgLevelList}
182
+ onChange={setCurOrgLevelValue}
183
+ />
184
+ )}
185
+ </CnBox>
186
+ )}
187
+ </CardWrapper>
188
+ );
189
+ };
190
+
191
+ const getShowContent = ({
192
+ configData,
193
+ hasOrgLevel,
194
+ orgLevelVal,
195
+ unit,
196
+ }: {
197
+ configData: IIndicatorCardConfig;
198
+ orgLevelVal?: string;
199
+ unit?: string;
200
+ hasOrgLevel: boolean;
201
+ color?: string[];
202
+ }) => {
203
+ const data = {
204
+ configData,
205
+ orgLevelVal,
206
+ unit,
207
+ };
208
+
209
+ if (hasOrgLevel && !orgLevelVal) {
210
+ return null;
211
+ }
212
+
213
+ switch (configData.chartType) {
214
+ case WinCardChartType.INDICATOR:
215
+ return <Indicator {...data} />;
216
+
217
+ case WinCardChartType.INDICATOR_AREA:
218
+ return <IndicatorArea {...data} />;
219
+
220
+ case WinCardChartType.DUAL_LINE_BAR_CHART:
221
+ return (
222
+ <ChartContent winChartType={WinChartType.DUAL_LINE_BAR} {...data} />
223
+ );
224
+
225
+ case WinCardChartType.AREA_CHART:
226
+ return <ChartContent winChartType={WinChartType.AREA} {...data} />;
227
+
228
+ case WinCardChartType.LINE_CHART:
229
+ return <ChartContent winChartType={WinChartType.LINE} {...data} />;
230
+
231
+ case WinCardChartType.COLUMN_CHART:
232
+ return <ChartContent winChartType={WinChartType.COLUMN} {...data} />;
233
+
234
+ case WinCardChartType.STACK_COLUMN_CHART:
235
+ return (
236
+ <ChartContent winChartType={WinChartType.STACK_COLUMN} {...data} />
237
+ );
238
+
239
+ case WinCardChartType.FUNNEL_CHART:
240
+ return <ChartContent winChartType={WinChartType.FUNNEL} {...data} />;
241
+
242
+ case WinCardChartType.BAR_CHART:
243
+ return <ChartContent winChartType={WinChartType.BAR} {...data} />;
244
+
245
+ case WinCardChartType.PIE_CHART:
246
+ return <ChartContent winChartType={WinChartType.PIE} {...data} />;
247
+
248
+ case WinCardChartType.PIE_CHART_RESERVE:
249
+ return (
250
+ <ChartContent
251
+ reserveValueWithLabelType
252
+ winChartType={WinChartType.PIE}
253
+ {...data}
254
+ />
255
+ );
256
+
257
+ case WinCardChartType.CYCLE_CHART:
258
+ return <ChartContent winChartType={WinChartType.CYCLE} {...data} />;
259
+
260
+ case WinCardChartType.RADAR_CHART:
261
+ return <ChartContent winChartType={WinChartType.RADAR} {...data} />;
262
+
263
+ case WinCardChartType.RADAR_CHART_RESERVE:
264
+ return (
265
+ <ChartContent
266
+ reserveValueWithLabelType
267
+ winChartType={WinChartType.RADAR}
268
+ {...data}
269
+ />
270
+ );
271
+
272
+ case WinCardChartType.CUSTOM_CARD:
273
+ return getCustomCardContent(configData.name);
274
+
275
+ default:
276
+ return undefined;
277
+ }
278
+ };
279
+
280
+ const getCustomCardContent = (name: string) => {
281
+ switch (name) {
282
+ case 'WIN排行榜':
283
+ return <WinRankContent />;
284
+
285
+ case '工作台待办':
286
+ return <MatterContent />;
287
+
288
+ default:
289
+ return (
290
+ <div>
291
+ {$i18n.get({
292
+ id: 'TheCustomSliceWasNotFoundPleaseC_1572163781',
293
+ dm: '未找到该自定义该片,请检查名称是否正确',
294
+ })}
295
+ </div>
296
+ );
297
+ }
298
+ };
@@ -0,0 +1,12 @@
1
+ import { IIndicatorCardConfig } from '@/types';
2
+
3
+ export interface IContentProps {
4
+ color?: string[];
5
+ configData: IIndicatorCardConfig;
6
+ theme?: string;
7
+ orgLevelVal?: string;
8
+ unit?: string;
9
+ extraCondition?: {
10
+ [p: string]: string;
11
+ };
12
+ }
@@ -0,0 +1,11 @@
1
+ import $i18n from 'panda-i18n';
2
+
3
+ export const getExtraLabel = (subTitle?: number) => {
4
+ switch (subTitle) {
5
+ case 1:
6
+ return $i18n.get({ id: 'TERM.GoalGoals', dm: '目标' });
7
+
8
+ default:
9
+ return undefined;
10
+ }
11
+ };
@@ -0,0 +1,47 @@
1
+ import { IndicatorService } from 'src/services/IndicatorService';
2
+ import { INDICATOR_DATA_BASE_URL, handleAddQuery } from '@/utils';
3
+ import { IContentProps } from '../utils/interface';
4
+ import { RequestWrapper } from 'src/components/win-wrappers/request-wrapper';
5
+ import { WinChart, WinChartType } from 'src/components/win-chart';
6
+
7
+ interface IProps extends IContentProps {
8
+ winChartType: WinChartType;
9
+ reserveValueWithLabelType?: boolean;
10
+ }
11
+
12
+ export const ChartContent = ({
13
+ configData,
14
+ orgLevelVal,
15
+ winChartType,
16
+ reserveValueWithLabelType,
17
+ }: IProps) => {
18
+ return (
19
+ <RequestWrapper
20
+ requestData={{
21
+ url: handleAddQuery(INDICATOR_DATA_BASE_URL, {
22
+ id: configData.id,
23
+ dataAccVal: configData.dataAccCode,
24
+ orgLevelVal,
25
+ }),
26
+ }}
27
+ service={IndicatorService.getDataInfoList}
28
+ >
29
+ {(data) => {
30
+ return (
31
+ <WinChart
32
+ sort={configData.commonConfig.sort}
33
+ yStart={configData.commonConfig.yStart}
34
+ color={configData.commonConfig.color}
35
+ xAxisLabelLength={configData.commonConfig.xAxisLabelLength}
36
+ xAxisLabelRotate={configData.commonConfig.xAxisLabelRotate}
37
+ reserveValueWithLabelType={reserveValueWithLabelType}
38
+ data={data.list0}
39
+ extraData={data.list1}
40
+ chartType={winChartType}
41
+ style={{ height: 'calc(100% - 0.4rem)' }}
42
+ />
43
+ );
44
+ }}
45
+ </RequestWrapper>
46
+ );
47
+ };
@@ -0,0 +1,61 @@
1
+ import { IndicatorService } from 'src/services/IndicatorService';
2
+ import {
3
+ arrayDeduplication,
4
+ getListLabel,
5
+ handleAddQuery,
6
+ unitList,
7
+ } from '@/utils';
8
+ import { IContentProps } from '../utils/interface';
9
+ import { RequestWrapper } from 'src/components/win-wrappers/request-wrapper';
10
+ import { INDICATOR_DATA_BASE_URL } from '../../../utils/const';
11
+ import { WinChart, WinChartType } from 'src/components/win-chart';
12
+ import { UnitWrapper } from 'src/components/win-wrappers/card-wrapper';
13
+
14
+ export const DualLineBar = ({ configData, orgLevelVal }: IContentProps) => {
15
+ const units =
16
+ arrayDeduplication(configData.indicatorConfig.map((item) => item.unit)) ??
17
+ [];
18
+ const unit0 = getListLabel(unitList, units[0]);
19
+ const unit1 = getListLabel(unitList, units[1]);
20
+
21
+ return (
22
+ <RequestWrapper
23
+ requestData={{
24
+ url: handleAddQuery(INDICATOR_DATA_BASE_URL, {
25
+ id: configData.id,
26
+ dataAccVal: configData.dataAccCode,
27
+ orgLevelVal,
28
+ }),
29
+ }}
30
+ service={IndicatorService.getDataInfoList}
31
+ >
32
+ {(data) => {
33
+ return (
34
+ <div
35
+ style={{
36
+ height: '100%',
37
+ position: 'relative',
38
+ }}
39
+ >
40
+ <WinChart
41
+ chartType={WinChartType.DUAL_LINE_BAR}
42
+ data={data.list0 ?? []}
43
+ extraData={data.list1 ?? []}
44
+ />
45
+ {/* {!!unit0 && (
46
+ <UnitWrapper
47
+ style={{
48
+ position: 'absolute',
49
+ left: 0,
50
+ bottom: 14,
51
+ }}
52
+ >
53
+ ({unit0}, {unit1})
54
+ </UnitWrapper>
55
+ )} */}
56
+ </div>
57
+ );
58
+ }}
59
+ </RequestWrapper>
60
+ );
61
+ };
@@ -0,0 +1,42 @@
1
+ import { IndicatorService } from 'src/services/IndicatorService';
2
+ import { handleAddQuery, INDICATOR_DATA_BASE_URL } from '@/utils';
3
+ import { IContentProps } from '../utils/interface';
4
+ import { RequestWrapper } from 'src/components/win-wrappers/request-wrapper';
5
+ import { getExtraLabel } from '../utils/tool';
6
+ import { IndicatorInfo } from './IndicatorInfo';
7
+
8
+ export const Indicator = ({ configData, unit, orgLevelVal }: IContentProps) => {
9
+ return (
10
+ <RequestWrapper
11
+ errorBoxHeight={50}
12
+ noEmptyBox
13
+ requestData={{
14
+ url: handleAddQuery(INDICATOR_DATA_BASE_URL, {
15
+ id: configData.id,
16
+ dataAccVal: configData.dataAccCode,
17
+ orgLevelVal,
18
+ }),
19
+ }}
20
+ service={IndicatorService.getDataInfoList}
21
+ style={{
22
+ height: 'auto',
23
+ }}
24
+ >
25
+ {(data) => {
26
+ const curConfig = configData.indicatorConfig[0];
27
+ const subTitle = curConfig.extra?.subTitle;
28
+
29
+ return (
30
+ <IndicatorInfo
31
+ jumpUrl={`/#/h5/indicator-details?id=${curConfig.id}`}
32
+ label={configData.name}
33
+ unit={unit}
34
+ value={data.indicator?.value}
35
+ extraLabel={getExtraLabel(subTitle) ?? data.indicator?.date}
36
+ extraValue={data.indicator?.expected}
37
+ />
38
+ );
39
+ }}
40
+ </RequestWrapper>
41
+ );
42
+ };
@@ -0,0 +1,65 @@
1
+ import { IndicatorService } from 'src/services/IndicatorService';
2
+ import {
3
+ getListLabel,
4
+ handleAddQuery,
5
+ handleNumberShowStr,
6
+ unitList,
7
+ } from '@/utils';
8
+ import { IContentProps } from '../utils/interface';
9
+ import { RequestWrapper } from 'src/components/win-wrappers/request-wrapper';
10
+ import { INDICATOR_DATA_BASE_URL } from '../../../utils/const';
11
+ import { WinChart, WinChartType } from 'src/components/win-chart';
12
+ import { getExtraLabel } from '../utils/tool';
13
+ import { IndicatorInfo } from './IndicatorInfo';
14
+
15
+ export const IndicatorArea = ({ configData, orgLevelVal }: IContentProps) => {
16
+ return (
17
+ <RequestWrapper
18
+ errorBoxHeight={50}
19
+ requestData={{
20
+ url: handleAddQuery(INDICATOR_DATA_BASE_URL, {
21
+ id: configData.id,
22
+ dataAccVal: configData.dataAccCode,
23
+ orgLevelVal,
24
+ }),
25
+ }}
26
+ service={IndicatorService.getDataInfoList}
27
+ >
28
+ {(data) => {
29
+ const curConfig = configData.indicatorConfig[0];
30
+ const subTitle = curConfig.extra?.subTitle;
31
+
32
+ return (
33
+ <div
34
+ style={{
35
+ display: 'grid',
36
+ grid: 'auto-flow / 4fr 6fr',
37
+ gap: '0.24rem',
38
+ transform: 'translateY(0.08rem)',
39
+ }}
40
+ >
41
+ <IndicatorInfo
42
+ jumpUrl={`/#/h5/indicator-details?id=${curConfig.id}`}
43
+ label={configData.name}
44
+ unit={getListLabel(unitList, configData.indicatorConfig[0]?.unit)}
45
+ value={handleNumberShowStr(data.indicator?.value)}
46
+ extraLabel={getExtraLabel(subTitle) ?? data.indicator?.date}
47
+ extraValue={data.indicator?.expected}
48
+ style={{
49
+ transform: 'translateY(0.12rem)',
50
+ }}
51
+ />
52
+ <WinChart
53
+ color={configData.commonConfig.color}
54
+ data={data.list0 ?? []}
55
+ chartType={WinChartType.MINI_AREA}
56
+ style={{
57
+ height: '1.6rem',
58
+ }}
59
+ />
60
+ </div>
61
+ );
62
+ }}
63
+ </RequestWrapper>
64
+ );
65
+ };