@zw-team/react-lib 1.0.5-beta.2 → 1.0.5-beta.3
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/dist/components/AccessReport/index.d.ts +7 -5
- package/dist/components/AccessReport/index.js +14 -2
- package/dist/components/ConfigProvider/ConfigProvider.js +15 -12
- package/dist/components/ConfigProvider/types.d.ts +1 -0
- package/dist/components/Log/src/Detail.js +6 -4
- package/dist/components/Log/src/Log.js +148 -99
- package/dist/components/Log/src/Log.scss +6 -1
- package/dist/components/Log/src/useLogTableColumns.d.ts +4 -1
- package/dist/components/Log/src/useLogTableColumns.js +19 -5
- package/dist/components/NavbarTool/NavbarTool.js +4 -4
- package/dist/components/NavbarTool/types.d.ts +2 -0
- package/dist/components/NoticeCenter/NoticeCenter.d.ts +1 -1
- package/dist/components/NoticeCenter/NoticeCenter.js +118 -73
- package/dist/components/NoticeCenter/noticeCenter.scss +10 -1
- package/dist/components/NoticeCenter/types.d.ts +1 -3
- package/dist/components/Table/useHeaderPopper.js +13 -5
- package/dist/hooks/useAccessReport.js +7 -1
- package/dist/utils/advisory.d.ts +2 -2
- package/dist/utils/advisory.js +7 -2
- package/dist/utils/request/index.js +7 -1
- package/package.json +1 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
interface AccessReportOptions {
|
|
2
|
+
system?: string;
|
|
3
|
+
authorization?: string;
|
|
4
|
+
env?: string;
|
|
5
|
+
mainOrigin?: string;
|
|
6
|
+
}
|
|
1
7
|
declare class AccessReport {
|
|
2
8
|
systemName: string;
|
|
3
9
|
authorization: string;
|
|
4
10
|
baseUrl: string;
|
|
5
|
-
constructor({ system, authorization, env }:
|
|
6
|
-
system?: string | undefined;
|
|
7
|
-
authorization?: string | undefined;
|
|
8
|
-
env?: string | undefined;
|
|
9
|
-
});
|
|
11
|
+
constructor({ system, authorization, env, mainOrigin, }: AccessReportOptions);
|
|
10
12
|
report(router: string, page: string | string[]): void;
|
|
11
13
|
loginReport(): void;
|
|
12
14
|
accessReportSavev(data: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import { getServiceURL } from "../../config/index.js";
|
|
2
2
|
import defaultRequest from "../../utils/request/defaultRequest.js";
|
|
3
|
+
function isAbsoluteUrl(url) {
|
|
4
|
+
return /^https?:\/\//i.test(url);
|
|
5
|
+
}
|
|
6
|
+
function joinUrl(origin, path) {
|
|
7
|
+
const normalizedOrigin = origin.replace(/\/$/, '');
|
|
8
|
+
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
|
|
9
|
+
return `${normalizedOrigin}${normalizedPath}`;
|
|
10
|
+
}
|
|
11
|
+
function resolveBaseUrl(baseUrl, mainOrigin) {
|
|
12
|
+
if (!mainOrigin || isAbsoluteUrl(baseUrl)) return baseUrl;
|
|
13
|
+
return joinUrl(mainOrigin, baseUrl);
|
|
14
|
+
}
|
|
3
15
|
class AccessReport_AccessReport {
|
|
4
16
|
systemName = '';
|
|
5
17
|
authorization = '';
|
|
6
18
|
baseUrl = 'https://zqapi.wozhangwan.com';
|
|
7
|
-
constructor({ system = '', authorization = '', env = 'production' }){
|
|
19
|
+
constructor({ system = '', authorization = '', env = 'production', mainOrigin }){
|
|
8
20
|
this.systemName = system;
|
|
9
21
|
this.authorization = authorization;
|
|
10
|
-
this.baseUrl = getServiceURL(void 0, env);
|
|
22
|
+
this.baseUrl = resolveBaseUrl(getServiceURL(void 0, env), mainOrigin);
|
|
11
23
|
}
|
|
12
24
|
report(router, page) {
|
|
13
25
|
const params = {
|
|
@@ -7,9 +7,20 @@ import { loadIcon, loadSvg } from "../../utils/svgIcon/index.js";
|
|
|
7
7
|
import AccessReport from "../AccessReport/index.js";
|
|
8
8
|
import { ConfigContext, defaultConfig } from "./ConfigContext.js";
|
|
9
9
|
const ConfigProvider_ConfigProvider_ConfigProvider = ({ children, antdConfig, ...restProps })=>{
|
|
10
|
-
const [contextValue, setContextValue] = useState({
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const [contextValue, setContextValue] = useState(()=>{
|
|
11
|
+
const initialValue = {
|
|
12
|
+
...defaultConfig.contextValue,
|
|
13
|
+
...restProps
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
...initialValue,
|
|
17
|
+
componentsKeys: Date.now(),
|
|
18
|
+
$AccessReport: new AccessReport({
|
|
19
|
+
system: initialValue.system,
|
|
20
|
+
env: initialValue.env || 'production',
|
|
21
|
+
mainOrigin: initialValue.mainOrigin
|
|
22
|
+
})
|
|
23
|
+
};
|
|
13
24
|
});
|
|
14
25
|
const updateConfig = useCallback((newConfig)=>{
|
|
15
26
|
setContextValue((prev)=>({
|
|
@@ -18,21 +29,13 @@ const ConfigProvider_ConfigProvider_ConfigProvider = ({ children, antdConfig, ..
|
|
|
18
29
|
}));
|
|
19
30
|
}, []);
|
|
20
31
|
const install = ()=>{
|
|
21
|
-
setContextValue((prev)=>({
|
|
22
|
-
...prev,
|
|
23
|
-
componentsKeys: Date.now(),
|
|
24
|
-
$AccessReport: new AccessReport({
|
|
25
|
-
system: prev.system,
|
|
26
|
-
env: prev.env || 'production'
|
|
27
|
-
})
|
|
28
|
-
}));
|
|
29
32
|
window.$BI = contextValue;
|
|
30
33
|
window.$AccessReport = contextValue.$AccessReport;
|
|
31
34
|
window.$BiEnv = contextValue.env;
|
|
32
35
|
window.$BiSystem = contextValue.system;
|
|
33
36
|
js_cookie.set('$BiEnv', contextValue.env);
|
|
34
37
|
js_cookie.set('$BiSystem', contextValue.system);
|
|
35
|
-
initProdEnvWarning(contextValue.env || 'production');
|
|
38
|
+
initProdEnvWarning(contextValue.env || 'production', contextValue.showProdEnvWarning);
|
|
36
39
|
loadSvg(contextValue.system, contextValue.env || 'production', contextValue.mainOrigin);
|
|
37
40
|
if (contextValue.needIcon) loadIcon(contextValue.env || 'production', (data)=>{
|
|
38
41
|
updateConfig({
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from "antd";
|
|
3
|
-
import { useState } from "react";
|
|
4
3
|
import { useBiLog } from "../../LogDialog/index.js";
|
|
5
4
|
import "./Detail.scss";
|
|
6
5
|
const arrowImg = 'https://wanxiaomeng-1255977238.file.myqcloud.com/bi-element-ui/Log/detail-arrow.png';
|
|
7
6
|
const LogDetail = (props)=>{
|
|
8
7
|
const { data = {} } = props;
|
|
9
|
-
const [dialogVisible, setDialogVisible] = useState(false);
|
|
10
|
-
const [dialogData, setDialogData] = useState({});
|
|
11
8
|
const { openRichText } = useBiLog();
|
|
9
|
+
const isRichText = (item)=>{
|
|
10
|
+
if ('rich_text' === item.type) return true;
|
|
11
|
+
const htmlReg = /<[a-z][\s\S]*>/i;
|
|
12
|
+
return htmlReg.test(item.new || '') || htmlReg.test(item.old || '');
|
|
13
|
+
};
|
|
12
14
|
const handleRichTextLog = (item)=>{
|
|
13
15
|
openRichText({
|
|
14
16
|
newContent: item.new,
|
|
@@ -31,7 +33,7 @@ const LogDetail = (props)=>{
|
|
|
31
33
|
":"
|
|
32
34
|
]
|
|
33
35
|
}),
|
|
34
|
-
|
|
36
|
+
isRichText(item) ? /*#__PURE__*/ jsx("div", {
|
|
35
37
|
className: "operates-info",
|
|
36
38
|
children: /*#__PURE__*/ jsx(Button, {
|
|
37
39
|
type: 'text',
|
|
@@ -1,57 +1,67 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Input, Select } from "antd";
|
|
3
3
|
import dayjs from "dayjs";
|
|
4
|
-
import { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from "react";
|
|
4
|
+
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { BiBlock } from "../../Block/index.js";
|
|
5
6
|
import { BiDatePicker } from "../../DatePicker/index.js";
|
|
6
7
|
import { BiForm } from "../../Form/index.js";
|
|
7
8
|
import { BiFormItem } from "../../FormItem/index.js";
|
|
8
9
|
import { BiTable } from "../../Table/index.js";
|
|
10
|
+
import { useConfig } from "../../ConfigProvider/ConfigContext.js";
|
|
11
|
+
import request from "../../../utils/request/index.js";
|
|
9
12
|
import { useLogTableColumns } from "./useLogTableColumns.js";
|
|
10
13
|
import "./Log.scss";
|
|
11
14
|
const BiLog = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
12
15
|
const { logId = '', logModel = '', BiLogDialog = false, ...restProps } = props;
|
|
16
|
+
const { contextValue } = useConfig();
|
|
17
|
+
const env = contextValue.env || 'production';
|
|
18
|
+
const system = contextValue.system;
|
|
19
|
+
const mainOrigin = contextValue.mainOrigin;
|
|
20
|
+
const drawerModel = Boolean(logId && logModel);
|
|
13
21
|
const [tableLoading, setTableLoading] = useState(false);
|
|
14
22
|
const [tableData, setTableData] = useState([]);
|
|
15
|
-
const [
|
|
23
|
+
const [loadingMore, setLoadingMore] = useState(false);
|
|
24
|
+
const [lastId, setLastId] = useState('');
|
|
25
|
+
const [lastItemId, setLastItemId] = useState('');
|
|
26
|
+
const [currentApi, setCurrentApi] = useState('/log/getSummary');
|
|
27
|
+
const [showHistoryBtn, setShowHistoryBtn] = useState(true);
|
|
16
28
|
const [tableColums, setTableColums] = useState([]);
|
|
29
|
+
const contentRef = useRef(null);
|
|
17
30
|
const [optionsList, setOptionsList] = useState({
|
|
18
31
|
model: [],
|
|
19
32
|
operate_name: []
|
|
20
33
|
});
|
|
21
34
|
const [formData, setFormData] = useState({
|
|
22
|
-
id: '',
|
|
23
|
-
model: [
|
|
35
|
+
id: drawerModel ? logId : '',
|
|
36
|
+
model: drawerModel ? [
|
|
37
|
+
logModel
|
|
38
|
+
] : [],
|
|
24
39
|
operate_name: [],
|
|
25
|
-
operate_time: []
|
|
26
|
-
|
|
40
|
+
operate_time: drawerModel ? [] : [
|
|
41
|
+
dayjs().subtract(24, 'hour').format('YYYY-MM-DD HH:mm:ss'),
|
|
42
|
+
dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
43
|
+
],
|
|
44
|
+
object_type: drawerModel ? 'id' : 'name',
|
|
27
45
|
operator: '',
|
|
28
|
-
|
|
29
|
-
limit: 50
|
|
46
|
+
limit: 500
|
|
30
47
|
});
|
|
31
|
-
const drawerModel = useMemo(()=>logId && logModel, [
|
|
32
|
-
logId,
|
|
33
|
-
logModel
|
|
34
|
-
]);
|
|
35
|
-
const total = useMemo(()=>pageCount * formData.limit, [
|
|
36
|
-
pageCount,
|
|
37
|
-
formData.limit
|
|
38
|
-
]);
|
|
39
48
|
const params = useMemo(()=>{
|
|
40
|
-
const { id, model, operate_name, operate_time, object_type, operator,
|
|
41
|
-
const [
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
const { id, model, operate_name, operate_time, object_type, operator, limit } = formData;
|
|
50
|
+
const [operateTimeStart = '', operateTimeEnd = ''] = operate_time || [];
|
|
51
|
+
const payload = {
|
|
52
|
+
system,
|
|
44
53
|
model: model.toString(),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
object_type,
|
|
54
|
+
operateName: operate_name.toString(),
|
|
55
|
+
operateTimeStart,
|
|
56
|
+
operateTimeEnd,
|
|
49
57
|
operator,
|
|
50
|
-
page,
|
|
51
58
|
limit
|
|
52
59
|
};
|
|
60
|
+
payload['id' === object_type ? 'objectId' : 'objectName'] = id;
|
|
61
|
+
return payload;
|
|
53
62
|
}, [
|
|
54
|
-
formData
|
|
63
|
+
formData,
|
|
64
|
+
system
|
|
55
65
|
]);
|
|
56
66
|
const handleChangeForm = (key, val)=>{
|
|
57
67
|
setFormData((prev)=>({
|
|
@@ -59,40 +69,86 @@ const BiLog = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
59
69
|
[key]: val
|
|
60
70
|
}));
|
|
61
71
|
};
|
|
62
|
-
const
|
|
72
|
+
const normalizeRows = (rows = [])=>rows.map((item)=>({
|
|
73
|
+
...item,
|
|
74
|
+
showLength: item.operates?.length > 3 ? 3 : 0
|
|
75
|
+
}));
|
|
76
|
+
const dataSearch = async ()=>{
|
|
63
77
|
setTableLoading(true);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
...payload
|
|
74
|
-
}
|
|
75
|
-
}).then((res)=>{
|
|
78
|
+
setCurrentApi('/log/getSummary');
|
|
79
|
+
try {
|
|
80
|
+
const res = await request({
|
|
81
|
+
env,
|
|
82
|
+
system: 'logcenter',
|
|
83
|
+
api: '/log/getSummary',
|
|
84
|
+
data: params,
|
|
85
|
+
mainOrigin
|
|
86
|
+
});
|
|
76
87
|
if (1 === res.status_code) {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
88
|
+
const rows = normalizeRows(res.data?.data);
|
|
89
|
+
setTableData(rows);
|
|
90
|
+
setLastId(res.data?.lastId || '');
|
|
91
|
+
setLastItemId(rows.at(-1)?.id || '');
|
|
92
|
+
if (!res.data?.lastId) {
|
|
93
|
+
setCurrentApi('/log/getHistorySummary');
|
|
94
|
+
setShowHistoryBtn(true);
|
|
95
|
+
}
|
|
83
96
|
}
|
|
97
|
+
} finally{
|
|
84
98
|
setTableLoading(false);
|
|
85
|
-
}
|
|
86
|
-
setTableLoading(false);
|
|
87
|
-
});
|
|
99
|
+
}
|
|
88
100
|
};
|
|
89
101
|
const clickSearch = ()=>{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
102
|
+
setLastId('');
|
|
103
|
+
setLastItemId('');
|
|
104
|
+
setCurrentApi('/log/getSummary');
|
|
105
|
+
setShowHistoryBtn(true);
|
|
106
|
+
dataSearch();
|
|
107
|
+
};
|
|
108
|
+
const loadNext = async ()=>{
|
|
109
|
+
setLoadingMore(true);
|
|
110
|
+
const lastRow = contentRef.current?.querySelector('tbody tr:last-child');
|
|
111
|
+
try {
|
|
112
|
+
const data = '/log/getSummary' === currentApi ? {
|
|
113
|
+
...params,
|
|
114
|
+
lastId
|
|
115
|
+
} : {
|
|
116
|
+
...params,
|
|
117
|
+
objectId: logId,
|
|
118
|
+
model: logModel,
|
|
119
|
+
lastId: lastId || lastItemId
|
|
120
|
+
};
|
|
121
|
+
const res = await request({
|
|
122
|
+
env,
|
|
123
|
+
system: 'logcenter',
|
|
124
|
+
api: currentApi,
|
|
125
|
+
data,
|
|
126
|
+
mainOrigin
|
|
127
|
+
});
|
|
128
|
+
if (1 === res.status_code && res.data) {
|
|
129
|
+
const rows = normalizeRows(res.data.data);
|
|
130
|
+
if (rows.length) {
|
|
131
|
+
setTableData((prev)=>[
|
|
132
|
+
...prev,
|
|
133
|
+
...rows
|
|
134
|
+
]);
|
|
135
|
+
setLastItemId(rows.at(-1)?.id || '');
|
|
136
|
+
requestAnimationFrame(()=>lastRow?.scrollIntoView({
|
|
137
|
+
block: 'end'
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
const nextLastId = res.data.lastId || '';
|
|
141
|
+
setLastId(nextLastId);
|
|
142
|
+
if ('/log/getSummary' !== currentApi || nextLastId) {
|
|
143
|
+
if ('/log/getHistorySummary' === currentApi) setShowHistoryBtn(Boolean(nextLastId));
|
|
144
|
+
} else {
|
|
145
|
+
setCurrentApi('/log/getHistorySummary');
|
|
146
|
+
setShowHistoryBtn(true);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
} finally{
|
|
150
|
+
setLoadingMore(false);
|
|
151
|
+
}
|
|
96
152
|
};
|
|
97
153
|
const reset = ()=>{
|
|
98
154
|
setFormData({
|
|
@@ -105,16 +161,12 @@ const BiLog = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
105
161
|
],
|
|
106
162
|
object_type: 'name',
|
|
107
163
|
operator: '',
|
|
108
|
-
|
|
109
|
-
limit: 50
|
|
164
|
+
limit: 500
|
|
110
165
|
});
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
page
|
|
116
|
-
}));
|
|
117
|
-
dataSearch(page);
|
|
166
|
+
setLastId('');
|
|
167
|
+
setLastItemId('');
|
|
168
|
+
setCurrentApi('/log/getSummary');
|
|
169
|
+
setShowHistoryBtn(true);
|
|
118
170
|
};
|
|
119
171
|
const fomartOperates = (row)=>{
|
|
120
172
|
try {
|
|
@@ -134,11 +186,16 @@ const BiLog = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
134
186
|
showLength: 0
|
|
135
187
|
} : item));
|
|
136
188
|
};
|
|
137
|
-
const { drawerTableColums, defaultTableColums } = useLogTableColumns(showMore, fomartOperates);
|
|
189
|
+
const { drawerTableColums, defaultTableColums } = useLogTableColumns(showMore, fomartOperates, optionsList.model);
|
|
138
190
|
const initOptions = ()=>{
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
191
|
+
request({
|
|
192
|
+
env,
|
|
193
|
+
system: 'logcenter',
|
|
194
|
+
api: '/systemlog/options',
|
|
195
|
+
data: {
|
|
196
|
+
system
|
|
197
|
+
},
|
|
198
|
+
mainOrigin
|
|
142
199
|
}).then((res)=>{
|
|
143
200
|
if (1 === res.status_code) setOptionsList({
|
|
144
201
|
model: res.data.model,
|
|
@@ -165,31 +222,15 @@ const BiLog = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
165
222
|
handlerOpen
|
|
166
223
|
}));
|
|
167
224
|
useEffect(()=>{
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
operate_time: [
|
|
171
|
-
dayjs().subtract(24, 'hour').format('YYYY-MM-DD HH:mm:ss'),
|
|
172
|
-
dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
173
|
-
]
|
|
174
|
-
}));
|
|
175
|
-
if (drawerModel) {
|
|
176
|
-
setFormData((prev)=>({
|
|
177
|
-
...prev,
|
|
178
|
-
id: logId,
|
|
179
|
-
model: [
|
|
180
|
-
logModel
|
|
181
|
-
],
|
|
182
|
-
object_type: 'id',
|
|
183
|
-
operate_time: []
|
|
184
|
-
}));
|
|
185
|
-
setTableColums(drawerTableColums);
|
|
186
|
-
} else {
|
|
225
|
+
if (drawerModel) setTableColums(drawerTableColums);
|
|
226
|
+
else {
|
|
187
227
|
setTableColums(defaultTableColums);
|
|
188
228
|
initOptions();
|
|
189
229
|
clickSearch();
|
|
190
230
|
}
|
|
191
231
|
}, []);
|
|
192
232
|
return /*#__PURE__*/ jsxs("div", {
|
|
233
|
+
ref: contentRef,
|
|
193
234
|
className: "content-outer bi-log-table",
|
|
194
235
|
children: [
|
|
195
236
|
!drawerModel && /*#__PURE__*/ jsx("div", {
|
|
@@ -314,19 +355,27 @@ const BiLog = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
314
355
|
})
|
|
315
356
|
})
|
|
316
357
|
}),
|
|
317
|
-
/*#__PURE__*/
|
|
318
|
-
className: "
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
358
|
+
/*#__PURE__*/ jsxs(BiBlock, {
|
|
359
|
+
className: "content-table",
|
|
360
|
+
children: [
|
|
361
|
+
/*#__PURE__*/ jsx(BiTable, {
|
|
362
|
+
className: "log-table",
|
|
363
|
+
loading: tableLoading,
|
|
364
|
+
data: tableData,
|
|
365
|
+
column: tableColums,
|
|
366
|
+
stickyTop: BiLogDialog ? 0 : 50,
|
|
367
|
+
pagination: false
|
|
368
|
+
}),
|
|
369
|
+
(lastId || showHistoryBtn) && /*#__PURE__*/ jsx("div", {
|
|
370
|
+
className: "log-history-btn",
|
|
371
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
372
|
+
type: "link",
|
|
373
|
+
loading: loadingMore,
|
|
374
|
+
onClick: loadNext,
|
|
375
|
+
children: '/log/getSummary' === currentApi ? '查询更多' : '查看历史'
|
|
376
|
+
})
|
|
377
|
+
})
|
|
378
|
+
]
|
|
330
379
|
})
|
|
331
380
|
]
|
|
332
381
|
});
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
width: 100%;
|
|
15
15
|
padding: 15px;
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
.log-history-btn {
|
|
19
|
+
padding: 12px 0;
|
|
20
|
+
text-align: center;
|
|
21
|
+
}
|
|
17
22
|
}
|
|
18
23
|
.log-table {
|
|
19
24
|
border-radius: 0;
|
|
@@ -47,4 +52,4 @@
|
|
|
47
52
|
background-image: linear-gradient(rgba($color: #fff, $alpha: 0), rgba($color: #fff, $alpha: 1), rgba($color: #fff, $alpha: 1));
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
|
-
}
|
|
55
|
+
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { BiColumns } from '../../Table';
|
|
2
|
-
export declare const useLogTableColumns: (showMoreFn: (row: any) => void, fomartOperates: (row: any) => any
|
|
2
|
+
export declare const useLogTableColumns: (showMoreFn: (row: any) => void, fomartOperates: (row: any) => any, modelOptions?: Array<{
|
|
3
|
+
id: string | number;
|
|
4
|
+
label: string;
|
|
5
|
+
}>) => Record<string, BiColumns>;
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Button } from "antd";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import Detail from "./Detail.js";
|
|
5
|
-
const useLogTableColumns = (showMoreFn, fomartOperates)=>{
|
|
5
|
+
const useLogTableColumns = (showMoreFn, fomartOperates, modelOptions = [])=>{
|
|
6
6
|
const drawerTableColums = useMemo(()=>[
|
|
7
7
|
{
|
|
8
8
|
dataIndex: 'operator',
|
|
@@ -52,9 +52,15 @@ const useLogTableColumns = (showMoreFn, fomartOperates)=>{
|
|
|
52
52
|
})
|
|
53
53
|
]
|
|
54
54
|
});
|
|
55
|
+
return /*#__PURE__*/ jsx(Detail, {
|
|
56
|
+
data: row
|
|
57
|
+
});
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
|
-
], [
|
|
60
|
+
], [
|
|
61
|
+
fomartOperates,
|
|
62
|
+
showMoreFn
|
|
63
|
+
]);
|
|
58
64
|
const defaultTableColums = useMemo(()=>[
|
|
59
65
|
{
|
|
60
66
|
dataIndex: 'operator',
|
|
@@ -79,9 +85,10 @@ const useLogTableColumns = (showMoreFn, fomartOperates)=>{
|
|
|
79
85
|
width: 80
|
|
80
86
|
},
|
|
81
87
|
{
|
|
82
|
-
dataIndex: '
|
|
88
|
+
dataIndex: 'model',
|
|
83
89
|
title: '模块',
|
|
84
|
-
width: 100
|
|
90
|
+
width: 100,
|
|
91
|
+
render: (value)=>modelOptions.find((item)=>item.id === value)?.label || '-'
|
|
85
92
|
},
|
|
86
93
|
{
|
|
87
94
|
dataIndex: 'objectName',
|
|
@@ -130,9 +137,16 @@ const useLogTableColumns = (showMoreFn, fomartOperates)=>{
|
|
|
130
137
|
})
|
|
131
138
|
]
|
|
132
139
|
});
|
|
140
|
+
return /*#__PURE__*/ jsx(Detail, {
|
|
141
|
+
data: row
|
|
142
|
+
});
|
|
133
143
|
}
|
|
134
144
|
}
|
|
135
|
-
], [
|
|
145
|
+
], [
|
|
146
|
+
fomartOperates,
|
|
147
|
+
modelOptions,
|
|
148
|
+
showMoreFn
|
|
149
|
+
]);
|
|
136
150
|
return {
|
|
137
151
|
drawerTableColums,
|
|
138
152
|
defaultTableColums
|
|
@@ -6,7 +6,7 @@ import components from "./components/index.js";
|
|
|
6
6
|
import "./index.css";
|
|
7
7
|
import { getEnv, getSystem } from "../../utils/tools.js";
|
|
8
8
|
const avatar = 'https://zqingalioss.wozhangwan.com/zhangqing-test/uploads/9211/2025-10-21/1761024983_4SdTSjcJK8.png';
|
|
9
|
-
const BiNavbarTool = ({ downloadCenter = true, noticeCenter = true, ...restProps })=>{
|
|
9
|
+
const BiNavbarTool = ({ downloadCenter = true, noticeCenter = true, systemLink = true, avatarNode, ...restProps })=>{
|
|
10
10
|
const system = getSystem() ?? '';
|
|
11
11
|
const env = getEnv() ?? '';
|
|
12
12
|
const wsRef = useRef(null);
|
|
@@ -127,15 +127,15 @@ const BiNavbarTool = ({ downloadCenter = true, noticeCenter = true, ...restProps
|
|
|
127
127
|
(downloadCenter || noticeCenter) && /*#__PURE__*/ jsx("div", {
|
|
128
128
|
className: "divider"
|
|
129
129
|
}),
|
|
130
|
-
/*#__PURE__*/ jsx(BiAvatar, {
|
|
130
|
+
avatarNode || /*#__PURE__*/ jsx(BiAvatar, {
|
|
131
131
|
...restProps,
|
|
132
132
|
image: restProps.avatar || avatar,
|
|
133
133
|
logout: restProps.logout
|
|
134
134
|
}),
|
|
135
|
-
/*#__PURE__*/ jsx("div", {
|
|
135
|
+
systemLink && /*#__PURE__*/ jsx("div", {
|
|
136
136
|
className: "divider"
|
|
137
137
|
}),
|
|
138
|
-
/*#__PURE__*/ jsx(BiSystemLink, {})
|
|
138
|
+
systemLink && /*#__PURE__*/ jsx(BiSystemLink, {})
|
|
139
139
|
]
|
|
140
140
|
});
|
|
141
141
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import './noticeCenter.scss';
|
|
2
2
|
import type { NoticeCenterProps } from './types';
|
|
3
|
-
declare const BiNoticeCenter:
|
|
3
|
+
declare const BiNoticeCenter: import("react").ForwardRefExoticComponent<NoticeCenterProps & import("react").RefAttributes<any>>;
|
|
4
4
|
export default BiNoticeCenter;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { BellOutlined } from "@ant-design/icons";
|
|
3
|
-
import { Badge, Button, Card, Drawer, Modal, Popover, Space } from "antd";
|
|
4
|
-
import { useState } from "react";
|
|
3
|
+
import { Badge, Button, Card, Drawer, Image, Modal, Popover, Space } from "antd";
|
|
4
|
+
import { forwardRef, useImperativeHandle, useRef, useState } from "react";
|
|
5
5
|
import react_infinite_scroller from "react-infinite-scroller";
|
|
6
6
|
import request from "../../utils/request/index.js";
|
|
7
7
|
import { diffTime } from "../../utils/time/index.js";
|
|
8
8
|
import { getEnv } from "../../utils/tools.js";
|
|
9
9
|
import "./noticeCenter.scss";
|
|
10
|
-
const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
10
|
+
const BiNoticeCenter = /*#__PURE__*/ forwardRef(({ headerHeight, system }, ref)=>{
|
|
11
11
|
const [detailData, setDetailData] = useState({
|
|
12
12
|
_id: {
|
|
13
13
|
oid: ''
|
|
@@ -36,6 +36,8 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
36
36
|
extra_id: ''
|
|
37
37
|
});
|
|
38
38
|
const [noMore, setNoMore] = useState(false);
|
|
39
|
+
const dialogSource = useRef('');
|
|
40
|
+
const [previewUrl, setPreviewUrl] = useState('');
|
|
39
41
|
const handleNoticeRead = async (msg_id)=>{
|
|
40
42
|
const res = await request({
|
|
41
43
|
env: getEnv(),
|
|
@@ -81,10 +83,12 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
81
83
|
user_name: item.user_name,
|
|
82
84
|
send_time: item.send_time,
|
|
83
85
|
extra_id: item.extra_id
|
|
84
|
-
}, true);
|
|
86
|
+
}, true, 'list');
|
|
85
87
|
handleNoticeRead(item._id.oid);
|
|
86
88
|
};
|
|
87
|
-
const popupNotice = (data, onlyRead = false)=>{
|
|
89
|
+
const popupNotice = (data, onlyRead = false, source = 'websocket')=>{
|
|
90
|
+
if ('external' === dialogSource.current && dialogVisible) return;
|
|
91
|
+
dialogSource.current = source;
|
|
88
92
|
setOpenNotice({
|
|
89
93
|
id: data.id,
|
|
90
94
|
title: data.title,
|
|
@@ -94,7 +98,19 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
94
98
|
extra_id: data.extra_id
|
|
95
99
|
});
|
|
96
100
|
setDialogVisible(true);
|
|
97
|
-
true !== onlyRead && noticePoped(
|
|
101
|
+
true !== onlyRead && noticePoped(data.id);
|
|
102
|
+
};
|
|
103
|
+
const openExternalNoticeDialog = (data)=>{
|
|
104
|
+
dialogSource.current = 'external';
|
|
105
|
+
setOpenNotice({
|
|
106
|
+
id: '',
|
|
107
|
+
title: data.title || '',
|
|
108
|
+
content: data.content || '',
|
|
109
|
+
user_name: data.user_name || '',
|
|
110
|
+
send_time: data.send_time || '',
|
|
111
|
+
extra_id: ''
|
|
112
|
+
});
|
|
113
|
+
setDialogVisible(true);
|
|
98
114
|
};
|
|
99
115
|
const noticePoped = async (msg_id)=>{
|
|
100
116
|
await request({
|
|
@@ -121,6 +137,11 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
121
137
|
const setUnreadNum = (unread_num)=>{
|
|
122
138
|
setBadgeNum(Number(unread_num));
|
|
123
139
|
};
|
|
140
|
+
useImperativeHandle(ref, ()=>({
|
|
141
|
+
setUnreadNum,
|
|
142
|
+
popupNotice,
|
|
143
|
+
openExternalNoticeDialog
|
|
144
|
+
}));
|
|
124
145
|
const fetchData = async ()=>{
|
|
125
146
|
try {
|
|
126
147
|
if (noMore) return;
|
|
@@ -174,7 +195,17 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
174
195
|
};
|
|
175
196
|
const noticeClose = (id)=>{
|
|
176
197
|
setDialogVisible(false);
|
|
177
|
-
|
|
198
|
+
const source = dialogSource.current;
|
|
199
|
+
dialogSource.current = '';
|
|
200
|
+
if (('websocket' === source || 'list' === source) && id) noticeRead(id);
|
|
201
|
+
};
|
|
202
|
+
const handleContentClick = (event)=>{
|
|
203
|
+
const target = event.target;
|
|
204
|
+
if ('IMG' === target.tagName) setPreviewUrl(target.src);
|
|
205
|
+
};
|
|
206
|
+
const handleContentMouseOver = (event)=>{
|
|
207
|
+
const target = event.target;
|
|
208
|
+
if ('IMG' === target.tagName) target.title = '点击预览';
|
|
178
209
|
};
|
|
179
210
|
const noticeRead = async (id)=>{
|
|
180
211
|
await request({
|
|
@@ -186,80 +217,94 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
186
217
|
}
|
|
187
218
|
});
|
|
188
219
|
};
|
|
189
|
-
const NoticeModal = /*#__PURE__*/
|
|
220
|
+
const NoticeModal = /*#__PURE__*/ jsxs(Modal, {
|
|
190
221
|
title: "提示",
|
|
191
222
|
open: dialogVisible,
|
|
192
223
|
width: 680,
|
|
193
|
-
onCancel: ()=>
|
|
224
|
+
onCancel: ()=>noticeClose(openNotice.extra_id),
|
|
194
225
|
style: {
|
|
195
226
|
top: '38px'
|
|
196
227
|
},
|
|
197
228
|
footer: null,
|
|
198
229
|
wrapClassName: "notice-open-dialog",
|
|
199
|
-
children:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}),
|
|
208
|
-
/*#__PURE__*/ jsxs("div", {
|
|
209
|
-
className: "notice-open-box",
|
|
210
|
-
children: [
|
|
211
|
-
/*#__PURE__*/ jsx("p", {
|
|
212
|
-
className: "notice-open-tile",
|
|
213
|
-
children: openNotice.title
|
|
214
|
-
}),
|
|
215
|
-
/*#__PURE__*/ jsx("div", {
|
|
216
|
-
className: "notice-open-box-scrollbar",
|
|
217
|
-
children: /*#__PURE__*/ jsxs("div", {
|
|
218
|
-
className: "notice-open-content",
|
|
219
|
-
children: [
|
|
220
|
-
/*#__PURE__*/ jsxs("div", {
|
|
221
|
-
className: "notice-open-content-info",
|
|
222
|
-
children: [
|
|
223
|
-
/*#__PURE__*/ jsxs("div", {
|
|
224
|
-
children: [
|
|
225
|
-
"产品负责人: ",
|
|
226
|
-
/*#__PURE__*/ jsx("span", {
|
|
227
|
-
children: openNotice.user_name || '-'
|
|
228
|
-
})
|
|
229
|
-
]
|
|
230
|
-
}),
|
|
231
|
-
/*#__PURE__*/ jsxs("div", {
|
|
232
|
-
children: [
|
|
233
|
-
"发送时间: ",
|
|
234
|
-
/*#__PURE__*/ jsx("span", {
|
|
235
|
-
children: openNotice.send_time
|
|
236
|
-
})
|
|
237
|
-
]
|
|
238
|
-
})
|
|
239
|
-
]
|
|
240
|
-
}),
|
|
241
|
-
/*#__PURE__*/ jsx("div", {
|
|
242
|
-
dangerouslySetInnerHTML: {
|
|
243
|
-
__html: openNotice.content
|
|
244
|
-
}
|
|
245
|
-
})
|
|
246
|
-
]
|
|
247
|
-
})
|
|
248
|
-
}),
|
|
249
|
-
/*#__PURE__*/ jsx("div", {
|
|
250
|
-
className: "notice-open-button",
|
|
251
|
-
children: /*#__PURE__*/ jsx(Button, {
|
|
252
|
-
type: "primary",
|
|
253
|
-
onClick: ()=>{
|
|
254
|
-
noticeClose(openNotice.extra_id);
|
|
255
|
-
},
|
|
256
|
-
children: "知道了"
|
|
257
|
-
})
|
|
230
|
+
children: [
|
|
231
|
+
/*#__PURE__*/ jsxs("div", {
|
|
232
|
+
className: "notice-open-container",
|
|
233
|
+
children: [
|
|
234
|
+
/*#__PURE__*/ jsx("div", {
|
|
235
|
+
className: "notice-bg",
|
|
236
|
+
children: /*#__PURE__*/ jsx("img", {
|
|
237
|
+
src: dialogImg
|
|
258
238
|
})
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
239
|
+
}),
|
|
240
|
+
/*#__PURE__*/ jsxs("div", {
|
|
241
|
+
className: "notice-open-box",
|
|
242
|
+
children: [
|
|
243
|
+
/*#__PURE__*/ jsx("p", {
|
|
244
|
+
className: "notice-open-tile",
|
|
245
|
+
children: openNotice.title
|
|
246
|
+
}),
|
|
247
|
+
/*#__PURE__*/ jsx("div", {
|
|
248
|
+
className: "notice-open-box-scrollbar",
|
|
249
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
250
|
+
className: "notice-open-content",
|
|
251
|
+
onClick: handleContentClick,
|
|
252
|
+
onMouseOver: handleContentMouseOver,
|
|
253
|
+
children: [
|
|
254
|
+
/*#__PURE__*/ jsxs("div", {
|
|
255
|
+
className: "notice-open-content-info",
|
|
256
|
+
children: [
|
|
257
|
+
/*#__PURE__*/ jsxs("div", {
|
|
258
|
+
children: [
|
|
259
|
+
"产品负责人: ",
|
|
260
|
+
/*#__PURE__*/ jsx("span", {
|
|
261
|
+
children: openNotice.user_name || '-'
|
|
262
|
+
})
|
|
263
|
+
]
|
|
264
|
+
}),
|
|
265
|
+
/*#__PURE__*/ jsxs("div", {
|
|
266
|
+
children: [
|
|
267
|
+
"发送时间: ",
|
|
268
|
+
/*#__PURE__*/ jsx("span", {
|
|
269
|
+
children: openNotice.send_time
|
|
270
|
+
})
|
|
271
|
+
]
|
|
272
|
+
})
|
|
273
|
+
]
|
|
274
|
+
}),
|
|
275
|
+
/*#__PURE__*/ jsx("div", {
|
|
276
|
+
dangerouslySetInnerHTML: {
|
|
277
|
+
__html: openNotice.content
|
|
278
|
+
}
|
|
279
|
+
})
|
|
280
|
+
]
|
|
281
|
+
})
|
|
282
|
+
}),
|
|
283
|
+
/*#__PURE__*/ jsx("div", {
|
|
284
|
+
className: "notice-open-button",
|
|
285
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
286
|
+
type: "primary",
|
|
287
|
+
onClick: ()=>{
|
|
288
|
+
noticeClose(openNotice.extra_id);
|
|
289
|
+
},
|
|
290
|
+
children: "知道了"
|
|
291
|
+
})
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
})
|
|
295
|
+
]
|
|
296
|
+
}),
|
|
297
|
+
/*#__PURE__*/ jsx(Image, {
|
|
298
|
+
src: previewUrl,
|
|
299
|
+
style: {
|
|
300
|
+
display: 'none'
|
|
301
|
+
},
|
|
302
|
+
preview: {
|
|
303
|
+
visible: Boolean(previewUrl),
|
|
304
|
+
onVisibleChange: (visible)=>!visible && setPreviewUrl('')
|
|
305
|
+
}
|
|
306
|
+
})
|
|
307
|
+
]
|
|
263
308
|
});
|
|
264
309
|
const prpoverContent = /*#__PURE__*/ jsx("div", {
|
|
265
310
|
className: "bi-notice-box",
|
|
@@ -421,6 +466,6 @@ const BiNoticeCenter = ({ headerHeight, system })=>{
|
|
|
421
466
|
NoticeDrawer
|
|
422
467
|
]
|
|
423
468
|
});
|
|
424
|
-
};
|
|
469
|
+
});
|
|
425
470
|
const NoticeCenter = BiNoticeCenter;
|
|
426
471
|
export { NoticeCenter as default };
|
|
@@ -176,7 +176,16 @@
|
|
|
176
176
|
color: #323335;
|
|
177
177
|
line-height: 30px;
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
.notice-open-content {
|
|
180
|
+
* {
|
|
181
|
+
line-height: normal;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
img {
|
|
185
|
+
max-width: 100%;
|
|
186
|
+
border-radius: 4px;
|
|
187
|
+
cursor: pointer;
|
|
188
|
+
}
|
|
180
189
|
font-size: 14px;
|
|
181
190
|
font-weight: 400;
|
|
182
191
|
color: #333333;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
2
|
import request from "../../utils/request/index.js";
|
|
3
3
|
import { getEnv, getSystem } from "../../utils/tools.js";
|
|
4
|
+
import { useConfig } from "../ConfigProvider/ConfigContext.js";
|
|
4
5
|
const useHeaderPopper = (moduleName)=>{
|
|
5
6
|
const [popperData, setPopperData] = useState([]);
|
|
6
7
|
const [editEnabled, setEditEnabled] = useState(false);
|
|
8
|
+
const { contextValue } = useConfig();
|
|
7
9
|
const system = getSystem() || '';
|
|
8
10
|
const $BiEnv = getEnv() || '';
|
|
11
|
+
const mainOrigin = contextValue.mainOrigin;
|
|
9
12
|
const getPopperList = useCallback(async ()=>{
|
|
10
13
|
if (!moduleName) return;
|
|
11
14
|
{
|
|
@@ -19,7 +22,8 @@ const useHeaderPopper = (moduleName)=>{
|
|
|
19
22
|
headers: {
|
|
20
23
|
System: system,
|
|
21
24
|
Authkey: ''
|
|
22
|
-
}
|
|
25
|
+
},
|
|
26
|
+
mainOrigin
|
|
23
27
|
});
|
|
24
28
|
if (1 === res.status_code) {
|
|
25
29
|
setEditEnabled(res.data.super);
|
|
@@ -29,7 +33,8 @@ const useHeaderPopper = (moduleName)=>{
|
|
|
29
33
|
}, [
|
|
30
34
|
moduleName,
|
|
31
35
|
$BiEnv,
|
|
32
|
-
system
|
|
36
|
+
system,
|
|
37
|
+
mainOrigin
|
|
33
38
|
]);
|
|
34
39
|
useEffect(()=>{
|
|
35
40
|
if (moduleName) getPopperList();
|
|
@@ -54,7 +59,8 @@ const useHeaderPopper = (moduleName)=>{
|
|
|
54
59
|
headers: {
|
|
55
60
|
System: system,
|
|
56
61
|
Authkey: ''
|
|
57
|
-
}
|
|
62
|
+
},
|
|
63
|
+
mainOrigin
|
|
58
64
|
});
|
|
59
65
|
if (1 === res.status_code) await getPopperList();
|
|
60
66
|
return res;
|
|
@@ -63,6 +69,7 @@ const useHeaderPopper = (moduleName)=>{
|
|
|
63
69
|
moduleName,
|
|
64
70
|
$BiEnv,
|
|
65
71
|
system,
|
|
72
|
+
mainOrigin,
|
|
66
73
|
getPopperList
|
|
67
74
|
]);
|
|
68
75
|
const delPopperItem = useCallback(async (id)=>{
|
|
@@ -76,12 +83,13 @@ const useHeaderPopper = (moduleName)=>{
|
|
|
76
83
|
headers: {
|
|
77
84
|
System: system,
|
|
78
85
|
Authkey: ''
|
|
79
|
-
}
|
|
86
|
+
},
|
|
87
|
+
mainOrigin
|
|
80
88
|
});
|
|
81
89
|
}, [
|
|
82
90
|
$BiEnv,
|
|
83
91
|
system,
|
|
84
|
-
|
|
92
|
+
mainOrigin
|
|
85
93
|
]);
|
|
86
94
|
const findPopperData = useCallback((prop)=>popperData.find((item)=>item.prop === prop), [
|
|
87
95
|
popperData
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
2
|
import { useConfig } from "../components/ConfigProvider/ConfigContext.js";
|
|
3
|
+
function getRuntimeAccessReport() {
|
|
4
|
+
if ('undefined' == typeof window) return;
|
|
5
|
+
const runtimeWindow = window;
|
|
6
|
+
return runtimeWindow.$AccessReport;
|
|
7
|
+
}
|
|
3
8
|
const useAccessReport_useAccessReport = ()=>{
|
|
4
9
|
const { contextValue } = useConfig();
|
|
5
10
|
const accessReport = useCallback((router, page)=>{
|
|
6
|
-
contextValue.$AccessReport
|
|
11
|
+
const report = contextValue.$AccessReport || getRuntimeAccessReport();
|
|
12
|
+
report?.report(router, page);
|
|
7
13
|
}, [
|
|
8
14
|
contextValue.$AccessReport
|
|
9
15
|
]);
|
package/dist/utils/advisory.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 根据环境和 cookie 判断是否需要显示正式环境警告,满足条件时自动创建悬浮提示
|
|
3
|
-
* 条件:zw-warning cookie === '1' 且 env 为 prod / production
|
|
3
|
+
* 条件:zw-warning cookie === '1' 且 env 为 prod / production
|
|
4
4
|
*/
|
|
5
|
-
export declare function initProdEnvWarning(env: string): void;
|
|
5
|
+
export declare function initProdEnvWarning(env: string, showProdEnvWarning?: boolean): void;
|
|
6
6
|
/**
|
|
7
7
|
* 创建正式环境悬浮提示框
|
|
8
8
|
* 带有打砖块式物理碰撞算法的悬浮提示,会在窗口内自由运动并反射
|
package/dist/utils/advisory.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import js_cookie from "js-cookie";
|
|
2
|
-
function initProdEnvWarning(env) {
|
|
2
|
+
function initProdEnvWarning(env, showProdEnvWarning = true) {
|
|
3
3
|
if ('undefined' == typeof window) return;
|
|
4
|
+
if (isWujieMicroApp()) return;
|
|
4
5
|
const isZwWarning = js_cookie.get('zw-warning') || '0';
|
|
5
|
-
if ('1' === isZwWarning && ('prod' === env || 'production' === env)) setTimeout(()=>{
|
|
6
|
+
if ('1' === isZwWarning && ('prod' === env || 'production' === env) && showProdEnvWarning) setTimeout(()=>{
|
|
6
7
|
const indicator = createProdEnvIndicator();
|
|
7
8
|
if (indicator) window.$BIProdIndicator = indicator;
|
|
8
9
|
}, 100);
|
|
9
10
|
}
|
|
11
|
+
function isWujieMicroApp() {
|
|
12
|
+
const runtimeWindow = window;
|
|
13
|
+
return Boolean(runtimeWindow.__POWERED_BY_WUJIE__ || runtimeWindow.$wujie);
|
|
14
|
+
}
|
|
10
15
|
function createProdEnvIndicator() {
|
|
11
16
|
if ('undefined' == typeof window) return;
|
|
12
17
|
if (document.getElementById('bi-prod-env-indicator')) return;
|
|
@@ -17,9 +17,15 @@ function resolveBaseUrl(baseUrl, mainOrigin) {
|
|
|
17
17
|
if (!mainOrigin || isAbsoluteUrl(baseUrl)) return baseUrl;
|
|
18
18
|
return joinUrl(mainOrigin, baseUrl);
|
|
19
19
|
}
|
|
20
|
+
function getRuntimeMainOrigin() {
|
|
21
|
+
if ('undefined' == typeof window) return;
|
|
22
|
+
const runtimeWindow = window;
|
|
23
|
+
return runtimeWindow.$BI?.mainOrigin;
|
|
24
|
+
}
|
|
20
25
|
function request(config) {
|
|
21
26
|
const { env = 'production', system, api, data = {}, headers = {}, mainOrigin } = config;
|
|
22
|
-
const
|
|
27
|
+
const resolvedMainOrigin = mainOrigin || getRuntimeMainOrigin();
|
|
28
|
+
const baseUrl = resolveBaseUrl(getServiceURL(void 0, env), resolvedMainOrigin);
|
|
23
29
|
if ("zq" === system) {
|
|
24
30
|
const defaultHeaders = {
|
|
25
31
|
Authkey: 'authtpe84dzfl3iq62'
|