Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
2af3cd83
authored
Apr 14, 2025
by
gggaaallleee
Committed by
GitHub
Apr 14, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Log (#4533)
* add log search * update log
parent
ea74c669
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
115 additions
and
9 deletions
+115
-9
projects/app/src/pageComponents/account/team/OperationLog/index.tsx
+108
-7
projects/app/src/web/support/user/team/operantionLog/api.ts
+7
-2
No files found.
projects/app/src/pageComponents/account/team/OperationLog/index.tsx
View file @
2af3cd83
...
@@ -8,12 +8,12 @@ import {
...
@@ -8,12 +8,12 @@ import {
Td
,
Td
,
Th
,
Th
,
Thead
,
Thead
,
Tr
Tr
,
HStack
}
from
'@chakra-ui/react'
;
}
from
'@chakra-ui/react'
;
import
{
useState
}
from
'react'
;
import
{
useState
,
useEffect
,
useMemo
}
from
'react'
;
import
{
useTranslation
}
from
'next-i18next'
;
import
{
useTranslation
}
from
'next-i18next'
;
import
MyBox
from
'@fastgpt/web/components/common/MyBox'
;
import
MyBox
from
'@fastgpt/web/components/common/MyBox'
;
import
SearchInput
from
'@fastgpt/web/components/common/Input/SearchInput'
;
import
{
useScrollPagination
}
from
'@fastgpt/web/hooks/useScrollPagination'
;
import
{
useScrollPagination
}
from
'@fastgpt/web/hooks/useScrollPagination'
;
import
{
getOperationLogs
}
from
'@/web/support/user/team/operantionLog/api'
;
import
{
getOperationLogs
}
from
'@/web/support/user/team/operantionLog/api'
;
import
{
TeamPermission
}
from
'@fastgpt/global/support/permission/user/controller'
;
import
{
TeamPermission
}
from
'@fastgpt/global/support/permission/user/controller'
;
...
@@ -21,28 +21,129 @@ import { operationLogI18nMap } from '@fastgpt/service/support/operationLog/const
...
@@ -21,28 +21,129 @@ import { operationLogI18nMap } from '@fastgpt/service/support/operationLog/const
import
{
OperationLogEventEnum
}
from
'@fastgpt/global/support/operationLog/constants'
;
import
{
OperationLogEventEnum
}
from
'@fastgpt/global/support/operationLog/constants'
;
import
{
formatTime2YMDHMS
}
from
'@fastgpt/global/common/string/time'
;
import
{
formatTime2YMDHMS
}
from
'@fastgpt/global/common/string/time'
;
import
UserBox
from
'@fastgpt/web/components/common/UserBox'
;
import
UserBox
from
'@fastgpt/web/components/common/UserBox'
;
import
MultipleSelect
,
{
useMultipleSelect
}
from
'@fastgpt/web/components/common/MySelect/MultipleSelect'
;
import
Avatar
from
'@fastgpt/web/components/common/Avatar'
;
import
{
getTeamMembers
}
from
'@/web/support/user/team/api'
;
function
OperationLogTable
({
Tabs
}:
{
Tabs
:
React
.
ReactNode
})
{
function
OperationLogTable
({
Tabs
}:
{
Tabs
:
React
.
ReactNode
})
{
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
const
[
searchParams
,
setSearchParams
]
=
useState
<
{
tmbIds
?:
string
[];
events
?:
OperationLogEventEnum
[];
}
>
({});
const
{
data
:
members
,
ScrollData
}
=
useScrollPagination
(
getTeamMembers
,
{});
const
tmbList
=
useMemo
(
()
=>
members
.
map
((
item
)
=>
({
label
:
(
<
HStack
spacing=
{
1
}
color=
{
'myGray.500'
}
>
<
Avatar
src=
{
item
.
avatar
}
w=
{
'1.2rem'
}
mr=
{
1
}
rounded=
{
'full'
}
/>
<
Box
>
{
item
.
memberName
}
</
Box
>
</
HStack
>
),
value
:
item
.
tmbId
})),
[
members
]
);
const
eventOptions
=
useMemo
(
()
=>
Object
.
values
(
OperationLogEventEnum
).
map
((
event
)
=>
({
label
:
t
(
operationLogI18nMap
[
event
].
typeLabel
),
value
:
event
})),
[
t
]
);
const
[
searchKey
,
setSearchKey
]
=
useState
<
string
>
(
''
);
const
{
const
{
data
:
operationLogs
=
[],
data
:
operationLogs
=
[],
isLoading
:
loadingLogs
,
isLoading
:
loadingLogs
,
ScrollData
:
LogScrollData
ScrollData
:
LogScrollData
}
=
useScrollPagination
(
getOperationLogs
,
{
}
=
useScrollPagination
(
getOperationLogs
,
{
pageSize
:
20
,
pageSize
:
20
,
refreshDeps
:
[
searchKey
],
throttleWait
:
500
,
throttleWait
:
500
,
debounceWait
:
200
debounceWait
:
200
,
refreshDeps
:
[
searchParams
],
params
:
searchParams
});
});
const
{
value
:
selectedTmbIds
,
setValue
:
setSelectedTmbIds
,
isSelectAll
:
isSelectAllTmb
,
setIsSelectAll
:
setIsSelectAllTmb
}
=
useMultipleSelect
<
string
>
(
tmbList
.
map
((
item
)
=>
item
.
value
),
true
);
const
{
value
:
selectedEvents
,
setValue
:
setSelectedEvents
,
isSelectAll
:
isSelectAllEvent
,
setIsSelectAll
:
setIsSelectAllEvent
}
=
useMultipleSelect
<
OperationLogEventEnum
>
(
eventOptions
.
map
((
item
)
=>
item
.
value
),
true
);
useEffect
(()
=>
{
setSearchParams
({
...(
isSelectAllTmb
?
{}
:
{
tmbIds
:
selectedTmbIds
.
length
>
0
?
selectedTmbIds
:
undefined
}),
...(
isSelectAllEvent
?
{}
:
{
events
:
selectedEvents
.
length
>
0
?
selectedEvents
:
undefined
})
});
},
[
selectedTmbIds
,
selectedEvents
,
isSelectAllTmb
,
isSelectAllEvent
]);
const
isLoading
=
loadingLogs
;
const
isLoading
=
loadingLogs
;
return
(
return
(
<>
<>
<
Flex
justify=
{
'
space-between'
}
align=
{
'center'
}
pb=
{
'1rem'
}
>
<
Flex
justify=
{
'
flex-start'
}
align=
{
'center'
}
pb=
{
'1rem'
}
gap=
{
2
}
wrap=
"wrap"
>
{
Tabs
}
{
Tabs
}
<
Flex
alignItems=
{
'center'
}
gap=
{
2
}
>
<
Box
fontSize=
{
'mini'
}
fontWeight=
{
'medium'
}
color=
{
'myGray.900'
}
>
{
t
(
'account_team:log_user'
)
}
</
Box
>
<
Box
>
<
MultipleSelect
<
string
>
list=
{
tmbList
}
value=
{
selectedTmbIds
}
onSelect=
{
(
val
)
=>
{
setSelectedTmbIds
(
val
as
string
[]);
}
}
itemWrap=
{
false
}
height=
{
'32px'
}
bg=
{
'myGray.50'
}
w=
{
'160px'
}
ScrollData=
{
ScrollData
}
isSelectAll=
{
isSelectAllTmb
}
setIsSelectAll=
{
setIsSelectAllTmb
}
/
>
</
Box
>
</
Flex
>
<
Flex
alignItems=
{
'center'
}
gap=
{
2
}
>
<
Box
fontSize=
{
'mini'
}
fontWeight=
{
'medium'
}
color=
{
'myGray.900'
}
>
{
t
(
'account_team:log_type'
)
}
</
Box
>
<
Box
>
<
MultipleSelect
list=
{
eventOptions
}
value=
{
selectedEvents
}
onSelect=
{
setSelectedEvents
}
isSelectAll=
{
isSelectAllEvent
}
setIsSelectAll=
{
setIsSelectAllEvent
}
itemWrap=
{
false
}
height=
{
'32px'
}
bg=
{
'myGray.50'
}
w=
{
'160px'
}
/>
</
Box
>
</
Flex
>
</
Flex
>
</
Flex
>
<
MyBox
isLoading=
{
isLoading
}
flex=
{
'1 0 0'
}
overflow=
{
'auto'
}
>
<
MyBox
isLoading=
{
isLoading
}
flex=
{
'1 0 0'
}
overflow=
{
'auto'
}
>
...
...
projects/app/src/web/support/user/team/operantionLog/api.ts
View file @
2af3cd83
import
{
GET
,
POST
,
PUT
}
from
'@/web/common/api/request'
;
import
{
GET
,
POST
,
PUT
}
from
'@/web/common/api/request'
;
import
type
{
PaginationProps
,
PaginationResponse
}
from
'@fastgpt/web/common/fetch/type'
;
import
type
{
PaginationProps
,
PaginationResponse
}
from
'@fastgpt/web/common/fetch/type'
;
import
type
{
OperationListItemType
}
from
'@fastgpt/global/support/operationLog/type'
;
import
type
{
OperationListItemType
}
from
'@fastgpt/global/support/operationLog/type'
;
import
{
OperationLogEventEnum
}
from
'@fastgpt/global/support/operationLog/constants'
;
export
const
getOperationLogs
=
(
props
:
PaginationProps
<
PaginationProps
>
)
=>
export
const
getOperationLogs
=
(
props
:
PaginationProps
&
{
tmbIds
?:
string
[];
events
?:
OperationLogEventEnum
[];
}
)
=>
POST
<
PaginationResponse
<
OperationListItemType
>>
(
POST
<
PaginationResponse
<
OperationListItemType
>>
(
`/proApi/support/user/team/operationLog/list`
,
`/proApi/support/user/team/operationLog/list`
,
props
props
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment