mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
chore: team, orgs, search and so on (#3807)
* feat: clb search support username, memberName, contacts * feat: popup org names * feat: update team member table * feat: restore the member * feat: search user in team member table * feat: bind contact * feat: export members * feat: org tab could delete member * feat: org table search * feat: team notification account bind * feat: permission tab search * fix: wecom sso * chore(init): copy notificationAccount to user.contact * chore: adjust * fix: ts error * fix: useConfirm iconColor customization * pref: fe * fix: style * fix: fix team member manage * pref: enlarge team member pagesize * pref: initv4822 * fix: pageSize * pref: initscritpt
This commit is contained in:
@@ -2,18 +2,30 @@ import React from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useSelectFile } from '@/web/common/file/hooks/useSelectFile';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useRequest } from '@fastgpt/web/hooks/useRequest';
|
||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { Box, Button, Flex, Input, ModalBody, ModalFooter } from '@chakra-ui/react';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Flex,
|
||||
HStack,
|
||||
Input,
|
||||
ModalBody,
|
||||
ModalFooter,
|
||||
useDisclosure
|
||||
} from '@chakra-ui/react';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import Avatar from '@fastgpt/web/components/common/Avatar';
|
||||
import { postCreateTeam, putUpdateTeam } from '@/web/support/user/team/api';
|
||||
import { CreateTeamProps } from '@fastgpt/global/support/user/team/controller.d';
|
||||
import { DEFAULT_TEAM_AVATAR } from '@fastgpt/global/common/system/constants';
|
||||
import Icon from '@fastgpt/web/components/common/Icon';
|
||||
import dynamic from 'next/dynamic';
|
||||
const UpdateContact = dynamic(() => import('@/components/support/user/inform/UpdateContactModal'));
|
||||
|
||||
export type EditTeamFormDataType = CreateTeamProps & {
|
||||
id?: string;
|
||||
notificationAccount?: string;
|
||||
};
|
||||
|
||||
export const defaultForm = {
|
||||
@@ -31,12 +43,12 @@ function EditModal({
|
||||
onSuccess: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { toast } = useToast();
|
||||
|
||||
const { register, setValue, handleSubmit, watch } = useForm<CreateTeamProps>({
|
||||
defaultValues: defaultData
|
||||
});
|
||||
const avatar = watch('avatar');
|
||||
const notificationAccount = watch('notificationAccount');
|
||||
|
||||
const {
|
||||
File,
|
||||
@@ -74,6 +86,8 @@ function EditModal({
|
||||
errorToast: t('common:common.Update Failed')
|
||||
});
|
||||
|
||||
const { isOpen: isOpenContact, onClose: onCloseContact, onOpen: onOpenContact } = useDisclosure();
|
||||
|
||||
return (
|
||||
<MyModal
|
||||
isOpen
|
||||
@@ -84,7 +98,7 @@ function EditModal({
|
||||
>
|
||||
<ModalBody>
|
||||
<Box color={'myGray.800'} fontWeight={'bold'}>
|
||||
{t('user:team.Set Name')}
|
||||
{t('account_team:set_name_avatar')}
|
||||
</Box>
|
||||
<Flex mt={3} alignItems={'center'}>
|
||||
<MyTooltip label={t('common:common.Set Avatar')}>
|
||||
@@ -110,6 +124,38 @@ function EditModal({
|
||||
})}
|
||||
/>
|
||||
</Flex>
|
||||
<Box color={'myGray.800'} fontWeight={'bold'} mt={4}>
|
||||
{t('account_team:notification_recieve')}
|
||||
</Box>
|
||||
<HStack w="full" justifyContent={'space-between'}>
|
||||
{(() => {
|
||||
return notificationAccount ? (
|
||||
<Box width="full">{notificationAccount}</Box>
|
||||
) : (
|
||||
<HStack
|
||||
px="3"
|
||||
py="1"
|
||||
color="red.600"
|
||||
bgColor="red.50"
|
||||
borderRadius="md"
|
||||
fontSize={'sm'}
|
||||
width={'fit-content'}
|
||||
>
|
||||
<Icon name="common/info" w="1rem" />
|
||||
<Box width="fit-content">{t('account_info:please_bind_contact')}</Box>
|
||||
</HStack>
|
||||
);
|
||||
})()}
|
||||
<Button
|
||||
variant={'whiteBase'}
|
||||
leftIcon={<Icon name="common/setting" w="1rem" />}
|
||||
onClick={() => {
|
||||
onOpenContact();
|
||||
}}
|
||||
>
|
||||
{t('common:common.Setting')}
|
||||
</Button>
|
||||
</HStack>
|
||||
</ModalBody>
|
||||
|
||||
<ModalFooter>
|
||||
@@ -142,6 +188,14 @@ function EditModal({
|
||||
})
|
||||
}
|
||||
/>
|
||||
{isOpenContact && (
|
||||
<UpdateContact
|
||||
onClose={() => {
|
||||
onCloseContact();
|
||||
}}
|
||||
mode="notification_account"
|
||||
/>
|
||||
)}
|
||||
</MyModal>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user