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,377 @@
1
+ import { WinChartType } from 'src/components/win-chart';
2
+ import {
3
+ IListItem,
4
+ MatterType,
5
+ WinCardChartType,
6
+ WinCardType,
7
+ } from 'src/types';
8
+
9
+ /**
10
+ * 时间范围列表
11
+ */
12
+ export const timeRangeList = [
13
+ { label: '天', value: 'DAY' },
14
+ { label: '月', value: 'MONTH' },
15
+ { label: '季度', value: 'QUARTER' },
16
+ { label: '年', value: 'YEAR' },
17
+ { label: '财季', value: 'FQUARTER' },
18
+ { label: '财年', value: 'FYEAR' },
19
+ { label: '周_列日', value: 'WEEK_LIEGE' },
20
+ { label: '月底及最新', value: 'MONTH_LATEST' },
21
+ { label: '季度底及最新', value: 'QUARTER_LATEST' },
22
+ ];
23
+
24
+ /**
25
+ * 结构化属性
26
+ */
27
+ export const orgLevelList = [
28
+ { label: '维度项', value: 'LEVEL_1' },
29
+ { label: '业务线', value: 'LEVEL_2' },
30
+ { label: '区域', value: 'LEVEL_3' },
31
+ { label: '项目', value: 'LEVEL_4' },
32
+ { label: '园区', value: 'LEVEL_5' },
33
+ ];
34
+
35
+ /**
36
+ * 结构化属性
37
+ */
38
+ export const labelFieldList = [
39
+ // { label: '地网级指标', value: 'LEVEL_1' },
40
+ // { label: '业务线指标', value: 'LEVEL_2' },
41
+ // { label: '区区域级指标', value: 'LEVEL_3' },
42
+ // { label: '项目级指标', value: 'LEVEL_4' },
43
+ // { label: '园区级指标', value: 'LEVEL_5' },
44
+ { label: '指标项', value: 'label' },
45
+ { label: '日期', value: 'date' },
46
+ ];
47
+
48
+ /**
49
+ * 卡片状态列表
50
+ */
51
+ export const cardStatusList = [
52
+ { label: '启用', value: 'ONLINE' },
53
+ { label: '禁用', value: 'OFFLINE' },
54
+ ];
55
+
56
+ /**
57
+ * 单位列表
58
+ */
59
+ export const unitList = [
60
+ { label: '平米', value: 'smeter' },
61
+ { label: '元', value: 'yuan' },
62
+ { label: '%', value: 'percent' },
63
+ { label: '个', value: 'number' },
64
+ { label: '分', value: 'score' },
65
+ { label: '万元', value: 'wan_yuan' },
66
+ { label: '百万', value: 'million' },
67
+ { label: '亿元', value: 'billion' },
68
+ { label: '万方', value: 'wan_square' },
69
+ ];
70
+
71
+ /**
72
+ * 卡片模版列表
73
+ */
74
+ export const chartTypeList = [
75
+ {
76
+ label: '',
77
+ value: WinCardChartType.INDICATOR,
78
+ },
79
+ ];
80
+
81
+ export const searchResTypeMap = new Map<
82
+ string,
83
+ { label: string; logo?: string }
84
+ >()
85
+ .set('ALL', {
86
+ label: '全部',
87
+ })
88
+ .set('CARD', {
89
+ label: '卡片',
90
+ })
91
+ .set('MENU', {
92
+ label: '菜单',
93
+ })
94
+ .set('REPORT', {
95
+ label: '报表',
96
+ })
97
+ .set('CONTRACT', {
98
+ label: '招商合同',
99
+ })
100
+ .set('BUSINESS_APPLY', {
101
+ label: '商务条件申请',
102
+ })
103
+ .set('SECURITY', {
104
+ label: '安全隐患',
105
+ })
106
+ .set('RISK', {
107
+ label: '风险',
108
+ })
109
+ .set('PARK_REFORM', {
110
+ label: '园区改造',
111
+ });
112
+
113
+ export const matterTitleList = [
114
+ { label: '待办清单', value: MatterType.PENDING },
115
+ { label: '我发出的', value: MatterType.CREATE },
116
+ { label: '已办事项', value: MatterType.COMPLETE },
117
+ ];
118
+
119
+ export const showTypeList = [
120
+ { label: '菜鸟', value: 'CN' },
121
+ { label: 'WLCC', value: 'wlcc' },
122
+ ];
123
+
124
+ export const rentTypeList = [
125
+ { label: '综合', value: '综合' },
126
+ { label: '仓', value: '仓' },
127
+ { label: '配', value: '配' },
128
+ ];
129
+
130
+ /**
131
+ * 卡片类型
132
+ */
133
+ export const indicatorChartTypeList = [
134
+ {
135
+ label: '单指标卡片',
136
+ value: WinCardChartType.INDICATOR,
137
+ },
138
+ {
139
+ label: '指标趋势卡片',
140
+ value: WinCardChartType.INDICATOR_AREA,
141
+ },
142
+ {
143
+ label: '面积图卡片',
144
+ value: WinCardChartType.AREA_CHART,
145
+ },
146
+ {
147
+ label: '折线图卡片',
148
+ value: WinCardChartType.LINE_CHART,
149
+ },
150
+ {
151
+ label: '双轴图卡片',
152
+ value: WinCardChartType.DUAL_LINE_BAR_CHART,
153
+ },
154
+ {
155
+ label: '柱状图卡片',
156
+ value: WinCardChartType.COLUMN_CHART,
157
+ },
158
+ {
159
+ label: '堆叠柱状图卡片',
160
+ value: WinCardChartType.STACK_COLUMN_CHART,
161
+ },
162
+ {
163
+ label: '条形图卡片',
164
+ value: WinCardChartType.BAR_CHART,
165
+ },
166
+ {
167
+ label: '漏斗图卡片',
168
+ value: WinCardChartType.FUNNEL_CHART,
169
+ },
170
+ {
171
+ label: '饼图卡片',
172
+ value: WinCardChartType.PIE_CHART,
173
+ },
174
+ {
175
+ label: '饼图卡片(指标项展示)',
176
+ value: WinCardChartType.PIE_CHART_RESERVE,
177
+ },
178
+ {
179
+ label: '环图卡片',
180
+ value: WinCardChartType.CYCLE_CHART,
181
+ },
182
+ {
183
+ label: '雷达图卡片',
184
+ value: WinCardChartType.RADAR_CHART,
185
+ },
186
+ {
187
+ label: '雷达图卡片(指标项展示)',
188
+ value: WinCardChartType.RADAR_CHART_RESERVE,
189
+ },
190
+ ];
191
+
192
+ /**
193
+ * 卡片类别信息映射
194
+ */
195
+ export const winCardChartTypeMap = new Map<
196
+ WinCardChartType,
197
+ {
198
+ templateUrl: string;
199
+ type: WinCardType;
200
+ sizeList: IListItem[];
201
+ winChartType?: WinChartType;
202
+ }
203
+ >();
204
+
205
+ winCardChartTypeMap.set(WinCardChartType.CUSTOM_CARD, {
206
+ templateUrl:
207
+ 'https://img.alicdn.com/imgextra/i3/O1CN011Bi11a1YzaZCM32a3_!!6000000003130-2-tps-1376-800.png',
208
+ type: 'Custom',
209
+ sizeList: [
210
+ { label: '1行 × 1列', value: '1,1' },
211
+ { label: '1行 × 2列', value: '1,2' },
212
+ { label: '2行 × 1列', value: '2,1' },
213
+ { label: '2行 × 2列', value: '2,2' },
214
+ { label: '2行 × 4列', value: '2,4' },
215
+ { label: '4行 × 4列', value: '4,4' },
216
+ ],
217
+ });
218
+
219
+ winCardChartTypeMap.set(WinCardChartType.DUAL_LINE_BAR_CHART, {
220
+ templateUrl:
221
+ 'https://img.alicdn.com/imgextra/i1/O1CN01oW8CLa1lrsvlcyBHV_!!6000000004873-2-tps-680-560.png',
222
+ type: 'Chart',
223
+ sizeList: [
224
+ { label: '2行 × 2列', value: '2,2' },
225
+ { label: '2行 × 4列', value: '2,4' },
226
+ { label: '2行 × 6列', value: '2,6' },
227
+ ],
228
+ });
229
+
230
+ winCardChartTypeMap.set(WinCardChartType.INDICATOR, {
231
+ templateUrl:
232
+ 'https://img.alicdn.com/imgextra/i4/O1CN01FnE5KR1EV5typW3ya_!!6000000000356-2-tps-332-272.png',
233
+ type: 'Indicator',
234
+ sizeList: [{ label: '1行 × 1列', value: '1,1' }],
235
+ });
236
+
237
+ winCardChartTypeMap.set(WinCardChartType.INDICATOR_AREA, {
238
+ templateUrl:
239
+ 'https://img.alicdn.com/imgextra/i3/O1CN01IiUDn81hQctefyf11_!!6000000004272-2-tps-680-272.png',
240
+ type: 'IndicatorChart',
241
+ sizeList: [{ label: '1行 × 2列', value: '1,2' }],
242
+ });
243
+
244
+ winCardChartTypeMap.set(WinCardChartType.AREA_CHART, {
245
+ templateUrl:
246
+ 'https://img.alicdn.com/imgextra/i2/O1CN01I6IkaB1iE5fcXcIXU_!!6000000004380-2-tps-680-560.png',
247
+ type: 'Chart',
248
+ sizeList: [
249
+ { label: '2行 × 2列', value: '2,2' },
250
+ { label: '2行 × 4列', value: '2,4' },
251
+ ],
252
+ winChartType: WinChartType.AREA,
253
+ });
254
+
255
+ winCardChartTypeMap.set(WinCardChartType.LINE_CHART, {
256
+ templateUrl:
257
+ 'https://img.alicdn.com/imgextra/i2/O1CN0181hNue1nRRIIpXPUf_!!6000000005086-2-tps-1376-560.png',
258
+ type: 'Chart',
259
+ sizeList: [
260
+ { label: '2行 × 2列', value: '2,2' },
261
+ { label: '2行 × 4列', value: '2,4' },
262
+ { label: '2行 × 6列', value: '2,6' },
263
+ ],
264
+ winChartType: WinChartType.LINE,
265
+ });
266
+
267
+ winCardChartTypeMap.set(WinCardChartType.COLUMN_CHART, {
268
+ templateUrl:
269
+ 'https://img.alicdn.com/imgextra/i4/O1CN01iIxIfy1jYWxlzTSGb_!!6000000004560-2-tps-680-560.png',
270
+ type: 'Chart',
271
+ sizeList: [
272
+ { label: '2行 × 2列', value: '2,2' },
273
+ { label: '2行 × 4列', value: '2,4' },
274
+ { label: '2行 × 6列', value: '2,6' },
275
+ ],
276
+ });
277
+
278
+ winCardChartTypeMap.set(WinCardChartType.STACK_COLUMN_CHART, {
279
+ templateUrl:
280
+ 'https://img.alicdn.com/imgextra/i3/O1CN01G9tHC81ImHE4RVLbC_!!6000000000935-2-tps-680-560.png',
281
+ type: 'Chart',
282
+ sizeList: [
283
+ { label: '2行 × 2列', value: '2,2' },
284
+ { label: '2行 × 4列', value: '2,4' },
285
+ { label: '2行 × 6列', value: '2,6' },
286
+ ],
287
+ });
288
+
289
+ winCardChartTypeMap.set(WinCardChartType.BAR_CHART, {
290
+ templateUrl:
291
+ 'https://img.alicdn.com/imgextra/i1/O1CN01fS4z2F1lBI66teufq_!!6000000004780-2-tps-680-560.png',
292
+ type: 'Chart',
293
+ sizeList: [
294
+ { label: '2行 × 2列', value: '2,2' },
295
+ { label: '2行 × 4列', value: '2,4' },
296
+ ],
297
+ });
298
+
299
+ winCardChartTypeMap.set(WinCardChartType.PIE_CHART, {
300
+ templateUrl:
301
+ 'https://img.alicdn.com/imgextra/i4/O1CN01aG0pam21xPZ0KAldD_!!6000000007051-2-tps-680-560.png',
302
+ type: 'Chart',
303
+ sizeList: [{ label: '2行 × 2列', value: '2,2' }],
304
+ });
305
+
306
+ winCardChartTypeMap.set(WinCardChartType.PIE_CHART_RESERVE, {
307
+ templateUrl:
308
+ 'https://img.alicdn.com/imgextra/i4/O1CN01aG0pam21xPZ0KAldD_!!6000000007051-2-tps-680-560.png',
309
+ type: 'Chart',
310
+ sizeList: [{ label: '2行 × 2列', value: '2,2' }],
311
+ });
312
+
313
+ winCardChartTypeMap.set(WinCardChartType.CYCLE_CHART, {
314
+ templateUrl:
315
+ 'https://img.alicdn.com/imgextra/i2/O1CN01ZkptA11f6M8UT8XGw_!!6000000003957-2-tps-680-560.png',
316
+ type: 'Chart',
317
+ sizeList: [{ label: '2行 × 2列', value: '2,2' }],
318
+ });
319
+
320
+ winCardChartTypeMap.set(WinCardChartType.FUNNEL_CHART, {
321
+ templateUrl:
322
+ 'https://img.alicdn.com/imgextra/i1/O1CN01Cmqcqi1HWsHscvuPN_!!6000000000766-2-tps-680-560.png',
323
+ type: 'Chart',
324
+ sizeList: [{ label: '2行 × 2列', value: '2,2' }],
325
+ });
326
+
327
+ winCardChartTypeMap.set(WinCardChartType.RADAR_CHART, {
328
+ templateUrl:
329
+ 'https://img.alicdn.com/imgextra/i2/O1CN01Pk7XU01hztOlrBMQe_!!6000000004349-2-tps-680-560.png',
330
+ type: 'Chart',
331
+ sizeList: [{ label: '2行 × 2列', value: '2,2' }],
332
+ });
333
+
334
+ winCardChartTypeMap.set(WinCardChartType.RADAR_CHART_RESERVE, {
335
+ templateUrl:
336
+ 'https://img.alicdn.com/imgextra/i2/O1CN01Pk7XU01hztOlrBMQe_!!6000000004349-2-tps-680-560.png',
337
+ type: 'Chart',
338
+ sizeList: [{ label: '2行 × 2列', value: '2,2' }],
339
+ });
340
+
341
+ export const sortList = [
342
+ { label: '升序', value: 'asc' },
343
+ { label: '降序', value: 'desc' },
344
+ ];
345
+
346
+ export const msgBizTypeMap = new Map<
347
+ string,
348
+ { iconType: string; color: string }
349
+ >()
350
+ .set('INDICATOR_CENTER', {
351
+ iconType: 'icon-zhibiaozhongxin1',
352
+ color: '#347FFF',
353
+ })
354
+ .set('NEWS_NOTICE', {
355
+ iconType: 'icon-xinxiansudi1',
356
+ color: '#00C267',
357
+ })
358
+ .set('EARTH_SCREEN', {
359
+ iconType: 'icon-xinxiansudi1',
360
+ color: '#00C267',
361
+ })
362
+ .set('GOOD_HABITS', {
363
+ iconType: 'icon-v-function',
364
+ color: '#347FFF',
365
+ })
366
+ .set('OPERATE_SCORE', {
367
+ iconType: 'icon-jingyingpaihang',
368
+ color: '#FFA101',
369
+ })
370
+ .set('QUARTERLY_SCORE', {
371
+ iconType: 'icon-jidupingfen',
372
+ color: '#FFA101',
373
+ })
374
+ .set('RISK', {
375
+ iconType: 'icon-fengxiandapan1',
376
+ color: '#F15451',
377
+ });
@@ -0,0 +1,101 @@
1
+ import { format } from 'd3';
2
+
3
+ /**
4
+ * 数值转换(除,默认除 10000)
5
+ * @param number
6
+ * @param num
7
+ * @returns
8
+ */
9
+ export const divide = (number: number, num = 10000) =>
10
+ Number((number / num).toFixed(2));
11
+
12
+ /**
13
+ * 根据单位转换数值
14
+ * @param value
15
+ * @param unit
16
+ * @param withUnit
17
+ * @returns
18
+ */
19
+ export const convertValueWithUnit = (value?: number | null, unit?: string) => {
20
+ if (value === undefined || value === null) {
21
+ return '-';
22
+ }
23
+
24
+ if (unit && ['万元', '万'].includes(unit)) {
25
+ return divide(value, 10000);
26
+ }
27
+
28
+ if (unit === '%') {
29
+ return divide(value, 0.01);
30
+ }
31
+
32
+ return value;
33
+ };
34
+
35
+ interface IChartMeta {
36
+ [p: string]: {
37
+ unit?: string;
38
+ alias?: string;
39
+ formatter?(value: number): string;
40
+ };
41
+ }
42
+
43
+ export const handleMeta = (meta: IChartMeta) => {
44
+ // eslint-disable-next-line no-restricted-syntax, guard-for-in
45
+ for (const key in meta) {
46
+ if (meta[key].unit === '%') {
47
+ // meta[key] = {
48
+ // ...meta,
49
+ // formatter: (value: number) => `${convertValueWithUnit(value, '%')}%`,
50
+ // };
51
+ meta[key].formatter = (value: number) =>
52
+ `${convertValueWithUnit(value, '%')}%`;
53
+ }
54
+
55
+ if (meta[key].unit && ['万元', '万'].includes(meta[key].unit!)) {
56
+ // meta[key] = {
57
+ // ...meta,
58
+ // formatter: (value: number) => `${convertValueWithUnit(value, '万元')}万元`,
59
+ // };
60
+ meta[key].formatter = (value: number) =>
61
+ `${convertValueWithUnit(value, '万元')}${meta[key].unit}`;
62
+ }
63
+ }
64
+
65
+ return meta;
66
+ };
67
+
68
+ /**
69
+ * 数据转百分比
70
+ * @param value
71
+ * @param num
72
+ */
73
+ export const handleToPercent = (value: unknown, num = 2) =>
74
+ typeof value === 'number' ? `${Number((value * 100).toFixed(num))}%` : '-%';
75
+
76
+ /**
77
+ * 打点分割,保留两位小数
78
+ * @param data
79
+ * @param num 保留小数位数
80
+ * @returns
81
+ */
82
+ export const handleNumberShowStr = (data: any, num = 2) => {
83
+ if (!data) {
84
+ return data;
85
+ }
86
+
87
+ const fix = format(`,.${num}f`);
88
+ return fix(Number(data));
89
+ };
90
+
91
+ /**
92
+ * 转换成数字,保留两位小数
93
+ * @param data
94
+ * @param num 保留小数数位
95
+ * @returns
96
+ */
97
+ export const handleNumber = (data: any, num = 2) => {
98
+ const fix = format(`.${num}f`);
99
+
100
+ return Number(fix(Number(data)));
101
+ };
@@ -0,0 +1,81 @@
1
+ import { RESPONSIVE_BREAKPOINT } from './const';
2
+ import { getSearchParams } from './url';
3
+
4
+ /**
5
+ * 像素转 vw
6
+ * @param px
7
+ * @returns
8
+ */
9
+ export const vw = (px = 0) => {
10
+ return `${(px / 1440) * 100}vw`;
11
+ };
12
+
13
+ /**
14
+ * 像素转 vh
15
+ * @param px
16
+ * @returns
17
+ */
18
+ export const vh = (px = 0) => {
19
+ return `${(px / 900) * 100}vh`;
20
+ };
21
+
22
+ /**
23
+ * 移动设备(根据页面宽度判定 main)
24
+ * @returns
25
+ */
26
+ export function isMobileDevice() {
27
+ const match = window.matchMedia(`(max-width: ${RESPONSIVE_BREAKPOINT})`);
28
+ return match.matches;
29
+ }
30
+
31
+ /**
32
+ * 移动设备(根据设备判定)
33
+ * @returns
34
+ */
35
+ export function isMobileDeviceByDevice() {
36
+ const match = window.matchMedia('(pointer:coarse)');
37
+ if (match && match.matches) {
38
+ return true;
39
+ }
40
+ return false;
41
+ }
42
+
43
+ /**
44
+ * 错误页面
45
+ * @returns
46
+ */
47
+ export const isErrorPage = () => {
48
+ return window.location.href.includes('/loginContextError');
49
+ };
50
+
51
+ /**
52
+ * 移动页面
53
+ * @returns
54
+ */
55
+ export function isMobilePage() {
56
+ if (window.location.href.includes('/h5')) {
57
+ return true;
58
+ }
59
+
60
+ return isMobileDevice();
61
+ }
62
+
63
+ /**
64
+ * 中转,空页面
65
+ * @returns
66
+ */
67
+ const isEmptyPage = () => {
68
+ return window.location.href.includes('/empty');
69
+ };
70
+
71
+ export const isHideNav = () => {
72
+ if (isMobilePage() || isErrorPage() || isEmptyPage()) {
73
+ return true;
74
+ }
75
+
76
+ if (getSearchParams()?.hideNav) {
77
+ return true;
78
+ }
79
+
80
+ return false;
81
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * 获取一个随机字符串
3
+ * @param num
4
+ * @returns
5
+ */
6
+ export const getRadomStr = (num = 4) =>
7
+ Math.random()
8
+ .toString(36)
9
+ .slice(2, 2 + num);
10
+
11
+ /**
12
+ * 判断是否是JSON字符串
13
+ * @param str
14
+ * @returns
15
+ */
16
+ export function isJsonString(str?: string): boolean {
17
+ if (!str) return false;
18
+
19
+ try {
20
+ JSON.parse(str);
21
+ } catch (e) {
22
+ return false;
23
+ }
24
+
25
+ return true;
26
+ }
@@ -0,0 +1,44 @@
1
+ import dayjs from 'dayjs';
2
+
3
+ export const env = globalThis.location.hostname.includes('test')
4
+ ? 'test'
5
+ : globalThis.location.hostname.includes('pre')
6
+ ? 'pre'
7
+ : 'pro';
8
+
9
+ export const apiBaseUrl = () => {
10
+ return {
11
+ test: 'https://cn-x-gateway.cainiao.test/vision/dwork-data',
12
+ pre: 'https://pre-cn-x-gateway.cainiao.com/vision/dwork-data',
13
+ pro: 'https://cn-x-gateway.cainiao.com/vision/dwork-data',
14
+ }[env];
15
+ };
16
+
17
+ export const bossBucOrigin = (() => {
18
+ return {
19
+ test: 'https://dwork-cnstr-staff.cainiao.test',
20
+ pre: 'https://pre-boss.cainiao-inc.com',
21
+ pro: 'https://boss.cainiao-inc.com',
22
+ }[env];
23
+ })();
24
+
25
+ export const bossCaiNiaoOrigin = (() => {
26
+ return {
27
+ test: 'https://dwork-cnstr-cp.cainiao.test',
28
+ pre: 'https://pre-cnstr.cainiao.com',
29
+ pro: 'https://boss.cainiao.com',
30
+ }[env];
31
+ })();
32
+
33
+ export const getBossOrigin = (isInside?: boolean) =>
34
+ isInside ? bossBucOrigin : bossCaiNiaoOrigin;
35
+
36
+ export const visionMocklayURL = apiBaseUrl();
37
+
38
+ export const getInDays = (time?: number) => {
39
+ if (!time) {
40
+ return '1001';
41
+ }
42
+
43
+ return dayjs().diff(time, 'day') + 1;
44
+ };