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.
- package/.eslintrc.json +3 -0
- package/.prettierrc.json +5 -0
- package/README.md +0 -0
- package/localhost-key.pem +28 -0
- package/localhost.pem +25 -0
- package/package.json +65 -0
- package/rsbuild.config.ts +48 -0
- package/src/api/README.md +15 -0
- package/src/api/index.js +5 -0
- package/src/api/layout/index.js +32 -0
- package/src/api/request.ts +87 -0
- package/src/api/url-map/index.js +10 -0
- package/src/api/user/index.js +12 -0
- package/src/components/FilterContext.tsx +6 -0
- package/src/components/GlobalStyle.tsx +25 -0
- package/src/components/HalfScreenBrowser.tsx +95 -0
- package/src/components/ImgBox.tsx +19 -0
- package/src/components/JumpBtn.tsx +38 -0
- package/src/components/MCardWrapper.tsx +33 -0
- package/src/components/NoContent/index.tsx +85 -0
- package/src/components/ResponsiveReactGridLayout.tsx +218 -0
- package/src/components/SliderDecoration.tsx +27 -0
- package/src/components/VisionUserConfigContext.ts +6 -0
- package/src/components/WinMenu/README.md +11 -0
- package/src/components/WinMenu/WinHeader.tsx +5 -0
- package/src/components/WinMenu/components/ExtraBox.tsx +61 -0
- package/src/components/WinMenu/components/FullMenuBox.tsx +80 -0
- package/src/components/WinMenu/components/FullMenuContainer.tsx +50 -0
- package/src/components/WinMenu/components/FullMenuItem.tsx +128 -0
- package/src/components/WinMenu/components/LangSwitch.tsx +84 -0
- package/src/components/WinMenu/components/LogoBox.tsx +29 -0
- package/src/components/WinMenu/components/PinDialog.tsx +72 -0
- package/src/components/WinMenu/components/PinnedMenuBox.tsx +183 -0
- package/src/components/WinMenu/components/UserBox.tsx +83 -0
- package/src/components/WinMenu/hooks/useUserInfo.ts +21 -0
- package/src/components/WinMenu/hooks/useUserMenu.ts +35 -0
- package/src/components/WinMenu/index.tsx +100 -0
- package/src/components/WinMenu/services/WinService.ts +79 -0
- package/src/components/WinMenu/services/request.ts +53 -0
- package/src/components/WinMenu/utils/const.ts +80 -0
- package/src/components/WinMenu/utils/enum.ts +19 -0
- package/src/components/WinMenu/utils/interface.ts +61 -0
- package/src/components/WinMenu/utils/map.ts +39 -0
- package/src/components/WinMenu/utils/tool.ts +142 -0
- package/src/components/WinMenu/utils/type.ts +1 -0
- package/src/components/hover-view.tsx +48 -0
- package/src/components/icon.tsx +44 -0
- package/src/components/indicator-remark.tsx +25 -0
- package/src/components/none-content.tsx +93 -0
- package/src/components/panel-tab.tsx +150 -0
- package/src/components/panel-title-tab.tsx +60 -0
- package/src/components/win-card/components/ChartContent.tsx +47 -0
- package/src/components/win-card/components/Indicator.tsx +42 -0
- package/src/components/win-card/components/IndicatorArea.tsx +63 -0
- package/src/components/win-card/components/IndicatorInfo.tsx +78 -0
- package/src/components/win-card/components/MatterContent.tsx +121 -0
- package/src/components/win-card/components/MatterList.tsx +141 -0
- package/src/components/win-card/components/NoticeContent.tsx +73 -0
- package/src/components/win-card/components/NoticeList.tsx +68 -0
- package/src/components/win-card/components/SelectDecoration.tsx +34 -0
- package/src/components/win-card/components/WinRankContent.tsx +102 -0
- package/src/components/win-card/index.tsx +298 -0
- package/src/components/win-card/utils/interface.ts +12 -0
- package/src/components/win-card/utils/tool.ts +11 -0
- package/src/components/win-card-mobile/components/ChartContent.tsx +47 -0
- package/src/components/win-card-mobile/components/DualLineBar.tsx +61 -0
- package/src/components/win-card-mobile/components/Indicator.tsx +42 -0
- package/src/components/win-card-mobile/components/IndicatorArea.tsx +65 -0
- package/src/components/win-card-mobile/components/IndicatorInfo.tsx +83 -0
- package/src/components/win-card-mobile/components/SelectDecoration.tsx +28 -0
- package/src/components/win-card-mobile/index.tsx +235 -0
- package/src/components/win-card-mobile/utils/interface.ts +12 -0
- package/src/components/win-card-mobile/utils/tool.ts +9 -0
- package/src/components/win-chart/components/chart-wrapper.tsx +5 -0
- package/src/components/win-chart/index.tsx +59 -0
- package/src/components/win-chart/theme/win-dark.json +372 -0
- package/src/components/win-chart/theme/win-light.json +372 -0
- package/src/components/win-chart/utils/const.ts +37 -0
- package/src/components/win-chart/utils/getAreaSpec.ts +150 -0
- package/src/components/win-chart/utils/getBarSpec.ts +60 -0
- package/src/components/win-chart/utils/getChartOptions.ts +59 -0
- package/src/components/win-chart/utils/getColumnSpec.ts +112 -0
- package/src/components/win-chart/utils/getDualSpec.ts +79 -0
- package/src/components/win-chart/utils/getFunnelSpec.ts +70 -0
- package/src/components/win-chart/utils/getLineSpec.ts +53 -0
- package/src/components/win-chart/utils/getPieSpec.ts +124 -0
- package/src/components/win-chart/utils/getRadarSpec.ts +87 -0
- package/src/components/win-chart/utils/tool.ts +163 -0
- package/src/components/win-chart/utils/type.ts +96 -0
- package/src/components/win-icon/index.tsx +97 -0
- package/src/components/win-v/components/EmptyBox.tsx +9 -0
- package/src/components/win-v/components/VDialog.tsx +173 -0
- package/src/components/win-v/components/VDialogBtn.tsx +119 -0
- package/src/components/win-v/components/VDialogMsg.tsx +325 -0
- package/src/components/win-v/components/VInput.tsx +15 -0
- package/src/components/win-v/components/VRemindMsgList.tsx +303 -0
- package/src/components/win-v/components/VRobot.tsx +97 -0
- package/src/components/win-v/hooks/useVDialogCore.ts +102 -0
- package/src/components/win-v/hooks/useVDialogOperate.ts +132 -0
- package/src/components/win-v/hooks/useVDialogState.ts +52 -0
- package/src/components/win-v/hooks/useVRemindMsgShow.ts +15 -0
- package/src/components/win-v/index.tsx +205 -0
- package/src/components/win-wrappers/card-wrapper.tsx +103 -0
- package/src/components/win-wrappers/dot-wrapper.tsx +18 -0
- package/src/components/win-wrappers/iframe-wrapper.tsx +7 -0
- package/src/components/win-wrappers/request-wrapper.tsx +190 -0
- package/src/global.d.ts +53 -0
- package/src/hooks/useCardOptionList.ts +23 -0
- package/src/hooks/useCostFiltersDicList.ts +22 -0
- package/src/hooks/useFbiUrl.ts +22 -0
- package/src/hooks/useHalfScreenState.ts +50 -0
- package/src/hooks/useHasIntersected.ts +36 -0
- package/src/hooks/useIndicatorCardInfo.ts +26 -0
- package/src/hooks/useIndicatorCardQueryList.ts +22 -0
- package/src/hooks/useIndicatorClassifyList.ts +25 -0
- package/src/hooks/useIndicatorDetailsDateList.ts +22 -0
- package/src/hooks/useIndicatorDetailsInfo.ts +49 -0
- package/src/hooks/useIndicatorDetailsTrend.ts +25 -0
- package/src/hooks/useIndicatorDicList.ts +22 -0
- package/src/hooks/useIndicatorLabelList.ts +20 -0
- package/src/hooks/useIndicatorList.ts +24 -0
- package/src/hooks/useIndicatorRangeList.ts +20 -0
- package/src/hooks/useIndicatorTypeList.ts +20 -0
- package/src/hooks/useIndicatorUnitList.ts +21 -0
- package/src/hooks/useListenQuery.ts +29 -0
- package/src/hooks/useMobile.ts +58 -0
- package/src/hooks/useNotice.ts +42 -0
- package/src/hooks/useOrgLevelList.ts +23 -0
- package/src/hooks/usePageSelection.ts +121 -0
- package/src/hooks/usePageState.ts +22 -0
- package/src/hooks/usePendingList.ts +27 -0
- package/src/hooks/usePortalPageInfo.ts +43 -0
- package/src/hooks/useRefreshByLocationChange.ts +16 -0
- package/src/hooks/useReportIndicatorList.ts +21 -0
- package/src/hooks/useReportInfo.ts +45 -0
- package/src/hooks/useReportPersonList.ts +21 -0
- package/src/hooks/useScriptLoader.ts +22 -0
- package/src/hooks/useUnreadMsgList.ts +26 -0
- package/src/hooks/useUserAvatar.ts +23 -0
- package/src/hooks/useVReportInfo.ts +50 -0
- package/src/hooks/useVisionUserConfig.ts +25 -0
- package/src/hooks/useWorkbenchOptions.ts +63 -0
- package/src/index.tsx +20 -0
- package/src/services/CardService.ts +91 -0
- package/src/services/CommonService.ts +23 -0
- package/src/services/CostService.ts +56 -0
- package/src/services/DialogService.ts +74 -0
- package/src/services/IndicatorService.ts +406 -0
- package/src/services/PageService.ts +204 -0
- package/src/services/ReportService.ts +335 -0
- package/src/services/WorkbenchService.ts +411 -0
- package/src/styles/README.md +12 -0
- package/src/styles/index.scss +9 -0
- package/src/styles/mixins/index.scss +25 -0
- package/src/styles/next-cover.scss +4 -0
- package/src/styles/normalize.scss +27 -0
- package/src/styles/utilities/index.scss +5 -0
- package/src/styles/vars/index.scss +17 -0
- package/src/types/enum-workbench.ts +29 -0
- package/src/types/enum.ts +156 -0
- package/src/types/index.ts +19 -0
- package/src/types/indicator.ts +299 -0
- package/src/types/interface.ts +303 -0
- package/src/types/portal.ts +211 -0
- package/src/types/report.ts +28 -0
- package/src/types/type.ts +11 -0
- package/src/types/user.ts +28 -0
- package/src/utils/README.md +4 -0
- package/src/utils/arms.ts +59 -0
- package/src/utils/arr.ts +123 -0
- package/src/utils/const-workbench.ts +9 -0
- package/src/utils/const.ts +18 -0
- package/src/utils/index.ts +18 -0
- package/src/utils/init.ts +5 -0
- package/src/utils/map-workbench.ts +66 -0
- package/src/utils/map.ts +377 -0
- package/src/utils/number.ts +101 -0
- package/src/utils/page.ts +81 -0
- package/src/utils/str.ts +26 -0
- package/src/utils/tools.ts +44 -0
- package/src/utils/tree.ts +145 -0
- package/src/utils/url.ts +40 -0
- package/src/utils/util.ts +99 -0
- package/src/utils/workbench.ts +25 -0
- package/tsconfig.json +33 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { IIndicatorCardConfig } from './indicator';
|
|
2
|
+
import { ICardInfo, IListItem } from './interface';
|
|
3
|
+
import { WinCardStatus } from './type';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* portal 页未读消息
|
|
7
|
+
*/
|
|
8
|
+
export interface IUnreadMsg {
|
|
9
|
+
id: number;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 标题
|
|
13
|
+
*/
|
|
14
|
+
title: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 消息
|
|
18
|
+
*/
|
|
19
|
+
content: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 跳转链接
|
|
23
|
+
*/
|
|
24
|
+
url: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 消息中包含的指标实例ID
|
|
28
|
+
*/
|
|
29
|
+
instanceIds: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 消息状态:0 未读 / 1 已读,此处都是0
|
|
33
|
+
*/
|
|
34
|
+
messageStatus: number;
|
|
35
|
+
|
|
36
|
+
bizType1: string;
|
|
37
|
+
bizType2: string;
|
|
38
|
+
bizTypeDesc1: string;
|
|
39
|
+
bizTypeDesc2: string;
|
|
40
|
+
sendTime: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface IApprovalInfo {
|
|
44
|
+
title: string;
|
|
45
|
+
name: string;
|
|
46
|
+
time: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface IWidgetSearch {
|
|
50
|
+
needSubscribeInfo: boolean;
|
|
51
|
+
subscribePageCode: string;
|
|
52
|
+
subscribePageType?: string;
|
|
53
|
+
status?: WinCardStatus;
|
|
54
|
+
bizCode?: string;
|
|
55
|
+
typeGroup?: string;
|
|
56
|
+
fuzzyLike?: string;
|
|
57
|
+
filterMySubscription?: boolean;
|
|
58
|
+
colWidthList?: number[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface IMatterPendingInfo {
|
|
62
|
+
desc: string;
|
|
63
|
+
count: string;
|
|
64
|
+
url: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 公告、头条详情
|
|
69
|
+
*/
|
|
70
|
+
export interface INoticeInfo {
|
|
71
|
+
id: number;
|
|
72
|
+
gmtCreate: string;
|
|
73
|
+
gmtModified: string;
|
|
74
|
+
noticeTitle: string;
|
|
75
|
+
noticeContent: string;
|
|
76
|
+
noticeImage: string;
|
|
77
|
+
noticeImageUrl: string;
|
|
78
|
+
noticeStatus: number;
|
|
79
|
+
pv: number;
|
|
80
|
+
startTime: string;
|
|
81
|
+
endTime: string;
|
|
82
|
+
releaseTime: string;
|
|
83
|
+
remark: string;
|
|
84
|
+
creator: number;
|
|
85
|
+
creatorName: string;
|
|
86
|
+
operator: number;
|
|
87
|
+
operatorName: string;
|
|
88
|
+
seen: boolean;
|
|
89
|
+
noticeBannerUrl: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 排行榜
|
|
94
|
+
*/
|
|
95
|
+
export interface IRankInfo {
|
|
96
|
+
title: string;
|
|
97
|
+
list?: IListItem[];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 小 V 简报信息
|
|
102
|
+
*/
|
|
103
|
+
export interface IVReportInfo {
|
|
104
|
+
date: string;
|
|
105
|
+
|
|
106
|
+
year: number;
|
|
107
|
+
week: number;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 访问量
|
|
111
|
+
*/
|
|
112
|
+
pvCount: string;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 访问变化率
|
|
116
|
+
*/
|
|
117
|
+
pvRate: string;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 审批流程数
|
|
121
|
+
*/
|
|
122
|
+
processCount: string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 审批平均耗时
|
|
126
|
+
*/
|
|
127
|
+
processAvgSpent: string;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 指标数量
|
|
131
|
+
*/
|
|
132
|
+
authCount: string;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 指标订阅率
|
|
136
|
+
*/
|
|
137
|
+
subRate: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface IDialogMsgInfo {
|
|
141
|
+
id: number;
|
|
142
|
+
avatar?: string;
|
|
143
|
+
gmtCreate?: string;
|
|
144
|
+
gmtModified?: string;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 消息类型,text-文本消息、text_retry-文本消息带重试按钮、text_general-文本消息带通用按钮 text_multiply-指标变动提醒消息
|
|
148
|
+
*/
|
|
149
|
+
type?: 'text' | 'text_retry' | 'text_general' | 'text_multiply';
|
|
150
|
+
title?: string; // 标题
|
|
151
|
+
content?: string; // 内容
|
|
152
|
+
url?: string; // 链接
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 状态,0-未读/1-已读/2-已点赞
|
|
156
|
+
*/
|
|
157
|
+
status?: number;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* 发送人,0-小V
|
|
161
|
+
*/
|
|
162
|
+
sender?: string;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* 接收人,0-小V
|
|
166
|
+
*/
|
|
167
|
+
recipient?: string;
|
|
168
|
+
sendTime?: string;
|
|
169
|
+
readTime?: string;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface IMsgCountInfo {
|
|
173
|
+
messageCount?: number;
|
|
174
|
+
unreadCount?: number;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface IRelationPropertyInfo {
|
|
178
|
+
cardId: string;
|
|
179
|
+
cardName: string;
|
|
180
|
+
propertyName: string;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface ISelectionInfo {
|
|
184
|
+
name: string;
|
|
185
|
+
type: 'STRUCTURED_DROPDOWN' | 'TIME_SELECTION';
|
|
186
|
+
typeDesc: string;
|
|
187
|
+
structuredAttribute: string;
|
|
188
|
+
defaultValue: string;
|
|
189
|
+
values: IListItem[];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export type SelectionInfo = Partial<ISelectionInfo>;
|
|
193
|
+
|
|
194
|
+
export interface IConfigMap {
|
|
195
|
+
[p: string]: IIndicatorCardConfig;
|
|
196
|
+
}
|
|
197
|
+
export interface ICardGroupInfo {
|
|
198
|
+
code?: string;
|
|
199
|
+
pageType?: string;
|
|
200
|
+
groupCode?: string;
|
|
201
|
+
groupName?: string;
|
|
202
|
+
selections?: SelectionInfo[];
|
|
203
|
+
cardList?: ICardInfo[];
|
|
204
|
+
configMap?: IConfigMap;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface IStructedPropertyInfo {
|
|
208
|
+
structedPropertyCode?: string;
|
|
209
|
+
structedPropertyName?: string;
|
|
210
|
+
downValues?: IListItem[];
|
|
211
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IIndicatorInfo } from './indicator';
|
|
2
|
+
|
|
3
|
+
export type ReportTemplateType = 'WEEKLY' | 'DAILY' | 'OTHER';
|
|
4
|
+
|
|
5
|
+
export interface IReportTplInfo {
|
|
6
|
+
templateId: number;
|
|
7
|
+
templateName: string;
|
|
8
|
+
description: string;
|
|
9
|
+
templateType: ReportTemplateType;
|
|
10
|
+
viewRange: 'PUBLIC' | 'PERSONAL';
|
|
11
|
+
templateTypeDesc: string;
|
|
12
|
+
version: number;
|
|
13
|
+
view: boolean;
|
|
14
|
+
content: string;
|
|
15
|
+
personList: {
|
|
16
|
+
workNo: string;
|
|
17
|
+
name: string;
|
|
18
|
+
}[];
|
|
19
|
+
indicatorList: IIndicatorInfo[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface IReportContentInfo {
|
|
23
|
+
templateId: number;
|
|
24
|
+
title: string;
|
|
25
|
+
content: string;
|
|
26
|
+
indicatorResult: IIndicatorInfo[];
|
|
27
|
+
version: number;
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface User {
|
|
2
|
+
userName?: string;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
type MenuInfo = {
|
|
6
|
+
menuCode: string;
|
|
7
|
+
menuTitle: string;
|
|
8
|
+
funcAccessCode?: string;
|
|
9
|
+
menuType?: string;
|
|
10
|
+
menuUrl?: string;
|
|
11
|
+
parentMenuCode?: string;
|
|
12
|
+
parentMenuTitle?: string;
|
|
13
|
+
hasChild?: boolean;
|
|
14
|
+
nodeSequence?: number;
|
|
15
|
+
menuIcon?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
children?: IMenuInfo[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type IMenuInfo = {
|
|
21
|
+
[p in keyof MenuInfo]: MenuInfo[p] | null;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export interface IUserAvatarInfo {
|
|
25
|
+
href?: string;
|
|
26
|
+
url?: string;
|
|
27
|
+
nickName?: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// /**
|
|
2
|
+
// * 接入 arms 监控
|
|
3
|
+
// * arms 接入指南 https://yuque.antfin-inc.com/c-one/cli/arms
|
|
4
|
+
// */
|
|
5
|
+
// import { initTrace } from '@alife/cone-arms';
|
|
6
|
+
// import { getCnEnv } from '@alife/cn-env';
|
|
7
|
+
|
|
8
|
+
// const env = getCnEnv();
|
|
9
|
+
|
|
10
|
+
// // eslint-disable-next-line no-console
|
|
11
|
+
|
|
12
|
+
// // 初始化 arms
|
|
13
|
+
// const trace = initTrace({
|
|
14
|
+
// // 必填, arms 平台上申请的的 pid
|
|
15
|
+
// pid: 'cn_cone_next_3796',
|
|
16
|
+
|
|
17
|
+
// env, // 可选 prod | pre | daily | string
|
|
18
|
+
|
|
19
|
+
// // uid: '', // 请按业务场景实现 uid 的获取逻辑, 来确保 pv 统计的准确性
|
|
20
|
+
|
|
21
|
+
// // 多语言对应的 cookie key, 默认会从 cookie 的 lang/_lang/x-hng/hng/langs 等位置读取多语言
|
|
22
|
+
// // langKey: '',
|
|
23
|
+
|
|
24
|
+
// // pv 采集插件的配置
|
|
25
|
+
// pvPluginOptions: { autoPV: true, enableHistory: true },
|
|
26
|
+
|
|
27
|
+
// // 性能监控插件的配置
|
|
28
|
+
// // perfPluginOptions: {},
|
|
29
|
+
|
|
30
|
+
// // api 采集插件的配置
|
|
31
|
+
// // apiPluginOptions: {},
|
|
32
|
+
|
|
33
|
+
// // TraceSdk 更多参数请参考 IConfig
|
|
34
|
+
// // https://g.alipay.com/browse/@ali/trace-core@latest/types/types/core.type.ts
|
|
35
|
+
// // requiredFields: [],
|
|
36
|
+
// });
|
|
37
|
+
|
|
38
|
+
// /**
|
|
39
|
+
// * 如何新增自定义监控
|
|
40
|
+
// * - 去 [项目设置] - [监控管理] - [添加一个自定义监控]
|
|
41
|
+
// * - 然后将 [监控代码] 配置到 monitorCodeMap
|
|
42
|
+
// * - 参考项目里面其他调用 logCustomMonitor 的例子
|
|
43
|
+
// */
|
|
44
|
+
// const monitorCodeMap = {
|
|
45
|
+
// hello: 'monitor-code-hello',
|
|
46
|
+
// };
|
|
47
|
+
|
|
48
|
+
// /**
|
|
49
|
+
// * 上报自定义监控项 https://yuque.antfin-inc.com/ali_arms/lav0sg/vg17om#PMINJ
|
|
50
|
+
// * options 可以上报其他自定义字段, 比如说 { c1: '' }
|
|
51
|
+
// */
|
|
52
|
+
// function logCustomMonitor(code: any, options: any) {
|
|
53
|
+
// trace.logCustom({
|
|
54
|
+
// ...options,
|
|
55
|
+
// p1: code, // 此处填写控制台创建自定义监控项生成的code
|
|
56
|
+
// });
|
|
57
|
+
// }
|
|
58
|
+
|
|
59
|
+
// export { trace, monitorCodeMap, logCustomMonitor };
|
package/src/utils/arr.ts
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { IDialogMsgInfo } from '@/types';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import { getRadomStr } from './str';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 判断是否为一个有效数组(有值,并且长度大于 0)
|
|
7
|
+
* @param data
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export const checkEntityArr = (data: unknown) =>
|
|
11
|
+
Array.isArray(data) && data.length > 0;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 数组求和
|
|
15
|
+
* @param list
|
|
16
|
+
*/
|
|
17
|
+
export const arraySum = (list?: number[]) => {
|
|
18
|
+
if (Array.isArray(list) && list.length !== 0) {
|
|
19
|
+
return list.reduce((a, b) => {
|
|
20
|
+
const temp = Number(b);
|
|
21
|
+
return a + (!Object.is(temp, NaN) ? temp : 0);
|
|
22
|
+
}, 0);
|
|
23
|
+
}
|
|
24
|
+
return 0;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 数组去重
|
|
29
|
+
* @param list
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
export const arrayDeduplication = (list: any) => {
|
|
33
|
+
if (Array.isArray(list)) {
|
|
34
|
+
return [...new Set(list)];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return undefined;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
interface WithId {
|
|
41
|
+
id: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 合并数组
|
|
46
|
+
* @param array1
|
|
47
|
+
* @param array2
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
export function mergeAndDeduplicateArrays<T extends WithId>(
|
|
52
|
+
array1: T[],
|
|
53
|
+
array2: T[],
|
|
54
|
+
): T[] {
|
|
55
|
+
// 合并两个数组
|
|
56
|
+
const mergedArray: T[] = array1.concat(array2);
|
|
57
|
+
|
|
58
|
+
// 创建一个新的Map对象用于去重和过滤
|
|
59
|
+
const idToObjectMap: Map<number, T> = new Map();
|
|
60
|
+
|
|
61
|
+
// 遍历合并后的数组,使用Map来去重和过滤id小于0的对象
|
|
62
|
+
for (const item of mergedArray) {
|
|
63
|
+
if (item.id > 0) {
|
|
64
|
+
idToObjectMap.set(item.id, item);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 从Map对象获取去重和过滤后的对象数组,并按id升序排序
|
|
69
|
+
const deduplicatedAndSortedArray: T[] = Array.from(
|
|
70
|
+
idToObjectMap.values(),
|
|
71
|
+
).sort((a, b) => a.id - b.id);
|
|
72
|
+
|
|
73
|
+
return deduplicatedAndSortedArray;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface ITimeMarker {
|
|
77
|
+
id: string;
|
|
78
|
+
type: 'time-marker';
|
|
79
|
+
content: string; // 描述时间的字符串,例如 '5分钟前'
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function timeDifference(date1: dayjs.Dayjs, date2: dayjs.Dayjs): number {
|
|
83
|
+
return date1.diff(date2, 'minute'); // 返回分钟差
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function formatTimeAgo(time: dayjs.Dayjs): string {
|
|
87
|
+
const now = dayjs();
|
|
88
|
+
const diffMinutes = timeDifference(now, time);
|
|
89
|
+
if (diffMinutes < 1) {
|
|
90
|
+
return `刚刚`;
|
|
91
|
+
}
|
|
92
|
+
if (diffMinutes < 3) {
|
|
93
|
+
return `${Math.floor(diffMinutes)}分钟前`;
|
|
94
|
+
}
|
|
95
|
+
// 其他时间格式化逻辑
|
|
96
|
+
return time.format('YYYY.MM.DD HH:mm'); // 或者其他格式化方式
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function insertTimeMarkers(
|
|
100
|
+
dialogs: IDialogMsgInfo[],
|
|
101
|
+
): (IDialogMsgInfo | ITimeMarker)[] {
|
|
102
|
+
const newDialogs: (IDialogMsgInfo | ITimeMarker)[] = [];
|
|
103
|
+
let previousTime: dayjs.Dayjs | null = null;
|
|
104
|
+
|
|
105
|
+
for (const dialog of dialogs) {
|
|
106
|
+
const currentTime = dialog.sendTime ? dayjs(dialog.sendTime) : dayjs();
|
|
107
|
+
if (previousTime) {
|
|
108
|
+
const diffMinutes = timeDifference(currentTime, previousTime);
|
|
109
|
+
|
|
110
|
+
if (diffMinutes >= 1) {
|
|
111
|
+
newDialogs.push({
|
|
112
|
+
id: getRadomStr(),
|
|
113
|
+
type: 'time-marker',
|
|
114
|
+
content: formatTimeAgo(currentTime),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
newDialogs.push(dialog);
|
|
119
|
+
previousTime = currentTime;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return newDialogs;
|
|
123
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 查询卡片配置基路径
|
|
3
|
+
*/
|
|
4
|
+
export const INDICATOR_CONFIG_BASE_URL = '/workbench/widget/queryById';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 查询卡片数据基路径
|
|
8
|
+
*/
|
|
9
|
+
export const INDICATOR_DATA_BASE_URL = '/workbench/widget/data';
|
|
10
|
+
|
|
11
|
+
export const DATA_PAGE_BASE_URL = '/data';
|
|
12
|
+
|
|
13
|
+
export const NEXT_PAGE_BASE_NAME = '/cone/next';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 响应式断点
|
|
17
|
+
*/
|
|
18
|
+
export const RESPONSIVE_BREAKPOINT = '768px';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 导出所有的 utils, 这样外界使用的时候直接 `import { xxx } from 'src/utils';` 即可
|
|
3
|
+
*/
|
|
4
|
+
import './init';
|
|
5
|
+
|
|
6
|
+
export * from './const';
|
|
7
|
+
export * from './page';
|
|
8
|
+
export * from './str';
|
|
9
|
+
export * from './tools';
|
|
10
|
+
export * from './url';
|
|
11
|
+
export * from './util';
|
|
12
|
+
export * from './number';
|
|
13
|
+
export * from './map';
|
|
14
|
+
export * from './arr';
|
|
15
|
+
export * from './workbench';
|
|
16
|
+
export * from './const-workbench';
|
|
17
|
+
export * from './map-workbench';
|
|
18
|
+
export * from './tree';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ApprovalType, PageType } from '../types';
|
|
2
|
+
|
|
3
|
+
export const pageTypeMap = new Map<
|
|
4
|
+
PageType,
|
|
5
|
+
{
|
|
6
|
+
title: string;
|
|
7
|
+
tabName?: string;
|
|
8
|
+
iconKey: string;
|
|
9
|
+
iconKeyChecked: string;
|
|
10
|
+
iconUrl?: string;
|
|
11
|
+
}
|
|
12
|
+
>();
|
|
13
|
+
|
|
14
|
+
pageTypeMap.set(PageType.WORKBENCH, {
|
|
15
|
+
title: 'My Vision',
|
|
16
|
+
tabName: '工作台',
|
|
17
|
+
iconKey: 'icon-workbench',
|
|
18
|
+
iconKeyChecked: 'icon-workbench-checked',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
pageTypeMap.set(PageType.MY_APPROVAL, {
|
|
22
|
+
title: '我的审批',
|
|
23
|
+
tabName: '我的审批',
|
|
24
|
+
iconKey: 'icon-my-approval',
|
|
25
|
+
iconKeyChecked: 'icon-my-approval-checked',
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const approvalTabList = [
|
|
29
|
+
{ label: '待我审批', value: ApprovalType.PENDING },
|
|
30
|
+
{ label: '我已审批', value: ApprovalType.COMPLETE },
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
export const operations = [
|
|
34
|
+
{
|
|
35
|
+
label: '场景',
|
|
36
|
+
icon: 'icon-changjingweixuanzhong',
|
|
37
|
+
iconChecked: 'icon-changjingxuanzhong',
|
|
38
|
+
key: 1,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: '日志',
|
|
42
|
+
icon: 'icon-rizhiweixuanzhong',
|
|
43
|
+
iconChecked: 'icon-rizhixuanzhong',
|
|
44
|
+
key: 2,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: '订阅',
|
|
48
|
+
icon: 'icon-dingyueweixuanzhong',
|
|
49
|
+
iconChecked: 'icon-dingyuexuanzhong',
|
|
50
|
+
key: 3,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: '小V',
|
|
54
|
+
icon: 'icon-xiaovweixuanzhong',
|
|
55
|
+
iconChecked: 'icon-xiaovxuanzhong1',
|
|
56
|
+
key: 4,
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
export const filterComponentTypeList = [
|
|
61
|
+
{ label: '输入框', value: 'input' },
|
|
62
|
+
{ label: '日期选择', value: 'calendar' },
|
|
63
|
+
{ label: '结构化下拉', value: 'structured_select' },
|
|
64
|
+
{ label: '自定义下拉', value: 'custom_select' },
|
|
65
|
+
{ label: '横向选择', value: 'horizontal_select' },
|
|
66
|
+
];
|