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:
@@ -4,34 +4,48 @@ import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { updateNotificationAccount } from '@/web/support/user/api';
|
||||
import { updateContact, updateNotificationAccount } from '@/web/support/user/api';
|
||||
import Icon from '@fastgpt/web/components/common/Icon';
|
||||
import { useSendCode } from '@/web/support/user/hooks/useSendCode';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
type FormType = {
|
||||
account: string;
|
||||
contact: string;
|
||||
verifyCode: string;
|
||||
};
|
||||
|
||||
const UpdateNotificationModal = ({ onClose }: { onClose: () => void }) => {
|
||||
const UpdateContactModal = ({
|
||||
onClose,
|
||||
mode
|
||||
}: {
|
||||
onClose: () => void;
|
||||
mode: 'contact' | 'notification_account';
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const { initUserInfo } = useUserStore();
|
||||
const { feConfigs } = useSystemStore();
|
||||
|
||||
const { register, handleSubmit, watch } = useForm<FormType>({
|
||||
defaultValues: {
|
||||
account: '',
|
||||
contact: '',
|
||||
verifyCode: ''
|
||||
}
|
||||
});
|
||||
const account = watch('account');
|
||||
|
||||
const account = watch('contact');
|
||||
const verifyCode = watch('verifyCode');
|
||||
|
||||
const { runAsync: onSubmit, loading: isLoading } = useRequest2(
|
||||
(data: FormType) => {
|
||||
return updateNotificationAccount(data);
|
||||
if (mode === 'contact') {
|
||||
return updateContact(data);
|
||||
} else {
|
||||
return updateNotificationAccount({
|
||||
account: data.contact,
|
||||
verifyCode: data.verifyCode
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
onSuccess() {
|
||||
@@ -62,7 +76,11 @@ const UpdateNotificationModal = ({ onClose }: { onClose: () => void }) => {
|
||||
isOpen
|
||||
iconSrc="common/settingLight"
|
||||
w={'32rem'}
|
||||
title={t('common:support.user.info.notification_receiving_hint')}
|
||||
title={
|
||||
mode === 'notification_account'
|
||||
? t('common:support.user.info.notification_receiving_hint')
|
||||
: t('account_info:contact')
|
||||
}
|
||||
>
|
||||
<ModalBody px={10}>
|
||||
<Flex flexDirection="column">
|
||||
@@ -75,7 +93,7 @@ const UpdateNotificationModal = ({ onClose }: { onClose: () => void }) => {
|
||||
<Input
|
||||
flex={1}
|
||||
bg={'myGray.50'}
|
||||
{...register('account', { required: true })}
|
||||
{...register('contact', { required: true })}
|
||||
placeholder={placeholder}
|
||||
></Input>
|
||||
</Flex>
|
||||
@@ -108,4 +126,4 @@ const UpdateNotificationModal = ({ onClose }: { onClose: () => void }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default UpdateNotificationModal;
|
||||
export default UpdateContactModal;
|
||||
@@ -0,0 +1,39 @@
|
||||
import { Box, Flex, VStack } from '@chakra-ui/react';
|
||||
import MyPopover from '@fastgpt/web/components/common/MyPopover';
|
||||
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
|
||||
import Tag from '@fastgpt/web/components/common/Tag';
|
||||
import React from 'react';
|
||||
|
||||
function OrgTags({ orgs, type = 'simple' }: { orgs: string[]; type?: 'simple' | 'tag' }) {
|
||||
return (
|
||||
<MyTooltip
|
||||
label={
|
||||
<VStack gap="1" alignItems={'start'}>
|
||||
{orgs.map((org, index) => (
|
||||
<Box key={index} fontSize="sm" fontWeight={400} color="myGray.500">
|
||||
{org.slice(1)}
|
||||
</Box>
|
||||
))}
|
||||
</VStack>
|
||||
}
|
||||
>
|
||||
{type === 'simple' ? (
|
||||
<Box fontSize="sm" fontWeight={400} w="full" color="myGray.500" whiteSpace={'nowrap'}>
|
||||
{orgs
|
||||
.map((org) => org.split('/').pop())
|
||||
.join(', ')
|
||||
.slice(0, 30)}
|
||||
{orgs.length > 1 && '...'}
|
||||
</Box>
|
||||
) : (
|
||||
<Flex direction="row" gap="1" p="2" alignItems={'start'} wrap={'wrap'}>
|
||||
{orgs.map((org, index) => (
|
||||
<Tag key={index}>{org.split('/').pop()}</Tag>
|
||||
))}
|
||||
</Flex>
|
||||
)}
|
||||
</MyTooltip>
|
||||
);
|
||||
}
|
||||
|
||||
export default OrgTags;
|
||||
Reference in New Issue
Block a user