mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-21 11:43:56 +00:00
feat/workorder (#3860)
* feat: workorder * pref: workorder button * chore: move workorder to common * chore: format code * pref: style
This commit is contained in:
@@ -41,6 +41,7 @@ export type FastGPTConfigFileType = {
|
||||
};
|
||||
|
||||
export type FastGPTFeConfigsType = {
|
||||
show_workorder?: boolean;
|
||||
show_emptyChat?: boolean;
|
||||
register_method?: ['email' | 'phone' | 'sync'];
|
||||
login_method?: ['email' | 'phone']; // Attention: login method is diffrent with oauth
|
||||
|
@@ -1,11 +1,11 @@
|
||||
// @ts-nocheck
|
||||
|
||||
export const iconPaths = {
|
||||
book: () => import('./icons/book.svg'),
|
||||
change: () => import('./icons/change.svg'),
|
||||
chatSend: () => import('./icons/chatSend.svg'),
|
||||
check: () => import('./icons/check.svg'),
|
||||
checkCircle: () => import('./icons/checkCircle.svg'),
|
||||
close: () => import('./icons/close.svg'),
|
||||
closeSolid: () => import('./icons/closeSolid.svg'),
|
||||
code: () => import('./icons/code.svg'),
|
||||
collectionLight: () => import('./icons/collectionLight.svg'),
|
||||
@@ -161,6 +161,7 @@ export const iconPaths = {
|
||||
'core/chat/chatLight': () => import('./icons/core/chat/chatLight.svg'),
|
||||
'core/chat/chatModelTag': () => import('./icons/core/chat/chatModelTag.svg'),
|
||||
'core/chat/chevronDown': () => import('./icons/core/chat/chevronDown.svg'),
|
||||
'core/chat/chevronLeft': () => import('./icons/core/chat/chevronLeft.svg'),
|
||||
'core/chat/chevronRight': () => import('./icons/core/chat/chevronRight.svg'),
|
||||
'core/chat/chevronSelector': () => import('./icons/core/chat/chevronSelector.svg'),
|
||||
'core/chat/chevronUp': () => import('./icons/core/chat/chevronUp.svg'),
|
||||
@@ -329,6 +330,7 @@ export const iconPaths = {
|
||||
edit: () => import('./icons/edit.svg'),
|
||||
empty: () => import('./icons/empty.svg'),
|
||||
export: () => import('./icons/export.svg'),
|
||||
feedback: () => import('./icons/feedback.svg'),
|
||||
'file/csv': () => import('./icons/file/csv.svg'),
|
||||
'file/fill/csv': () => import('./icons/file/fill/csv.svg'),
|
||||
'file/fill/doc': () => import('./icons/file/fill/doc.svg'),
|
||||
|
3
packages/web/components/common/Icon/icons/close.svg
Normal file
3
packages/web/components/common/Icon/icons/close.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.65613 2.84383C9.85139 3.0391 9.85139 3.35568 9.65613 3.55094L7.20708 5.99999L9.65617 8.44908C9.85143 8.64434 9.85143 8.96093 9.65617 9.15619C9.46091 9.35145 9.14433 9.35145 8.94906 9.15619L6.49997 6.7071L4.05088 9.15619C3.85562 9.35145 3.53904 9.35145 3.34377 9.15619C3.14851 8.96093 3.14851 8.64434 3.34377 8.44908L5.79286 5.99999L3.34382 3.55094C3.14855 3.35568 3.14855 3.0391 3.34382 2.84383C3.53908 2.64857 3.85566 2.64857 4.05092 2.84383L6.49997 5.29288L8.94902 2.84383C9.14428 2.64857 9.46087 2.64857 9.65613 2.84383Z" fill="#92A5C9"/>
|
||||
</svg>
|
After Width: | Height: | Size: 675 B |
@@ -0,0 +1,3 @@
|
||||
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.4714 3.52864C10.7317 3.78899 10.7317 4.2111 10.4714 4.47145L6.94277 8.00004L10.4714 11.5286C10.7317 11.789 10.7317 12.2111 10.4714 12.4714C10.211 12.7318 9.7889 12.7318 9.52855 12.4714L5.52855 8.47144C5.26821 8.21109 5.26821 7.78898 5.52855 7.52864L9.52855 3.52864C9.7889 3.26829 10.211 3.26829 10.4714 3.52864Z" fill="#92A5C9"/>
|
||||
</svg>
|
After Width: | Height: | Size: 464 B |
29
packages/web/components/common/Icon/icons/feedback.svg
Normal file
29
packages/web/components/common/Icon/icons/feedback.svg
Normal file
@@ -0,0 +1,29 @@
|
||||
<svg width="29" height="28" viewBox="0 0 29 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.49993 10.1261C8.49993 9.48174 9.02226 8.9594 9.6666 8.9594H14.3333C14.9776 8.9594 15.4999 9.48174 15.4999 10.1261C15.4999 10.7704 14.9776 11.2927 14.3333 11.2927H9.6666C9.02226 11.2927 8.49993 10.7704 8.49993 10.1261Z" fill="url(#paint0_linear_17422_2138)"/>
|
||||
<path d="M8.49993 14.7927C8.49993 14.1484 9.02226 13.6261 9.6666 13.6261H18.4041C19.0485 13.6261 19.5708 14.1484 19.5708 14.7927C19.5708 15.4371 19.0485 15.9594 18.4041 15.9594H9.6666C9.02226 15.9594 8.49993 15.4371 8.49993 14.7927Z" fill="url(#paint1_linear_17422_2138)"/>
|
||||
<path d="M17.6859 9.1641C17.3948 9.37757 17.2057 9.72212 17.2057 10.1108V11.2504C17.2057 11.2738 17.2247 11.2927 17.248 11.2927H18.3745C18.7286 11.2927 19.0462 11.1358 19.262 10.8878L25.8249 4.32494C26.2805 3.86933 26.2805 3.13063 25.8249 2.67502C25.3693 2.21941 24.6306 2.21941 24.175 2.67502L17.6859 9.1641Z" fill="url(#paint2_linear_17422_2138)"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.5122 3.45903C17.5122 2.81469 16.9899 2.29236 16.3456 2.29236H7.34644C5.41344 2.29236 3.84644 3.85936 3.84644 5.79236V22.1257C3.84644 24.0587 5.41344 25.6257 7.34644 25.6257H21.6535C23.5865 25.6257 25.1535 24.0587 25.1535 22.1257V12.1788C25.1535 11.5344 24.6311 11.0121 23.9868 11.0121C23.3425 11.0121 22.8201 11.5345 22.8201 12.1788V22.1257C22.8201 22.77 22.2978 23.2924 21.6535 23.2924H7.34644C6.7021 23.2924 6.17977 22.77 6.17977 22.1257V5.79236C6.17977 5.14803 6.7021 4.62569 7.34644 4.62569H16.3456C16.9899 4.62569 17.5122 4.10336 17.5122 3.45903Z" fill="url(#paint3_linear_17422_2138)"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_17422_2138" x1="15.0065" y1="3.04993" x2="15.0065" y2="24.8681" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#499DFF"/>
|
||||
<stop offset="0.432292" stop-color="#2770FF"/>
|
||||
<stop offset="1" stop-color="#6E80FF"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_17422_2138" x1="15.0065" y1="3.04993" x2="15.0065" y2="24.8681" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#499DFF"/>
|
||||
<stop offset="0.432292" stop-color="#2770FF"/>
|
||||
<stop offset="1" stop-color="#6E80FF"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint2_linear_17422_2138" x1="15.0065" y1="3.04993" x2="15.0065" y2="24.8681" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#499DFF"/>
|
||||
<stop offset="0.432292" stop-color="#2770FF"/>
|
||||
<stop offset="1" stop-color="#6E80FF"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint3_linear_17422_2138" x1="15.0065" y1="3.04993" x2="15.0065" y2="24.8681" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#499DFF"/>
|
||||
<stop offset="0.432292" stop-color="#2770FF"/>
|
||||
<stop offset="1" stop-color="#6E80FF"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
@@ -1283,5 +1283,6 @@
|
||||
"xx_search_result": "{{key}} 的搜索结果",
|
||||
"yes": "是",
|
||||
"yesterday": "昨天",
|
||||
"yesterday_detail_time": "昨天 {{time}}"
|
||||
"yesterday_detail_time": "昨天 {{time}}",
|
||||
"question_feedback": "问题反馈"
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@ import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
|
||||
const unAuthPage: { [key: string]: boolean } = {
|
||||
'/': true,
|
||||
|
@@ -14,6 +14,7 @@ import { useSystem } from '@fastgpt/web/hooks/useSystem';
|
||||
import { useDebounceEffect, useMount } from 'ahooks';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useToast } from '@fastgpt/web/hooks/useToast';
|
||||
import WorkorderButton from '../support/workorder/WorkorderButton';
|
||||
|
||||
const Navbar = dynamic(() => import('./navbar'));
|
||||
const NavbarPhone = dynamic(() => import('./navbarPhone'));
|
||||
@@ -121,6 +122,7 @@ const Layout = ({ children }: { children: JSX.Element }) => {
|
||||
<Auth>
|
||||
<Box h={'100%'} position={'fixed'} left={0} top={0} w={navbarWidth}>
|
||||
<Navbar unread={unread} />
|
||||
{feConfigs.show_workorder && <WorkorderButton />}
|
||||
</Box>
|
||||
<Box h={'100%'} ml={navbarWidth} overflow={'overlay'}>
|
||||
{children}
|
||||
|
@@ -0,0 +1,112 @@
|
||||
import { getWorkorderURL } from '@/web/common/workorder/api';
|
||||
import { Box, Flex } from '@chakra-ui/react';
|
||||
import Icon from '@fastgpt/web/components/common/Icon';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { useToggle } from 'ahooks';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
function WorkorderButton() {
|
||||
const [open, setOpen] = useToggle(true);
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { data, runAsync } = useRequest2(getWorkorderURL, {
|
||||
manual: true
|
||||
});
|
||||
|
||||
const onFeedback = async () => {
|
||||
await runAsync();
|
||||
if (data) {
|
||||
window.open(data.redirectUrl);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<>
|
||||
{open ? (
|
||||
<Flex
|
||||
position="fixed"
|
||||
bottom="20%"
|
||||
right="0"
|
||||
height="62px"
|
||||
width="58px"
|
||||
zIndex={100}
|
||||
boxShadow="0px 12px 32px -4px #00175633"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
direction="column"
|
||||
borderTopLeftRadius="8px"
|
||||
borderBottomLeftRadius="8px"
|
||||
border={'1px'}
|
||||
borderColor={'#DFE6F2'}
|
||||
>
|
||||
<Box
|
||||
zIndex={101}
|
||||
width="14px"
|
||||
height="14px"
|
||||
position="absolute"
|
||||
left="-6px"
|
||||
top="-6px"
|
||||
borderRadius="full"
|
||||
background="white"
|
||||
border="1px"
|
||||
borderColor={'myGray.25'}
|
||||
bgColor="myGray.25"
|
||||
_hover={{
|
||||
cursor: 'pointer',
|
||||
bgColor: 'myGray.100'
|
||||
}}
|
||||
onClick={() => setOpen.set(false)}
|
||||
>
|
||||
<Icon name="close" />
|
||||
</Box>
|
||||
<Flex
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
direction="column"
|
||||
bgColor="myGray.25"
|
||||
_hover={{
|
||||
cursor: 'pointer',
|
||||
bgColor: 'myGray.100'
|
||||
}}
|
||||
width="100%"
|
||||
height="100%"
|
||||
borderTopLeftRadius="8px"
|
||||
borderBottomLeftRadius="8px"
|
||||
onClick={onFeedback}
|
||||
>
|
||||
<Icon name="feedback" width="28px" height="28px" />
|
||||
<Box fontSize="11px" fontWeight="500">
|
||||
{t('common:question_feedback')}
|
||||
</Box>
|
||||
</Flex>
|
||||
</Flex>
|
||||
) : (
|
||||
<Flex
|
||||
position="fixed"
|
||||
bottom="20%"
|
||||
right="0"
|
||||
height="44px"
|
||||
width="19px"
|
||||
bgColor="myGray.25"
|
||||
borderTopLeftRadius="8px"
|
||||
borderBottomLeftRadius="8px"
|
||||
border={'1px'}
|
||||
borderColor={'#DFE6F2'}
|
||||
zIndex={100}
|
||||
boxShadow="0px 12px 32px -4px #00175633"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
direction="column"
|
||||
_hover={{
|
||||
cursor: 'pointer',
|
||||
bgColor: 'myGray.100'
|
||||
}}
|
||||
onClick={() => setOpen.set(true)}
|
||||
>
|
||||
<Icon name="core/chat/chevronLeft" width="16px" height="16px" />
|
||||
</Flex>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default WorkorderButton;
|
@@ -92,7 +92,7 @@ export const TeamModalContextProvider = ({ children }: { children: ReactNode })
|
||||
total: memberTotal,
|
||||
ScrollData: MemberScrollData
|
||||
} = useScrollPagination(getTeamMembers, {
|
||||
pageSize: 20,
|
||||
pageSize: 1000,
|
||||
params: {
|
||||
withLeaved: true
|
||||
}
|
||||
|
5
projects/app/src/web/common/workorder/api.ts
Normal file
5
projects/app/src/web/common/workorder/api.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { GET } from '@/web/common/api/request';
|
||||
export const getWorkorderURL = () =>
|
||||
GET<{
|
||||
redirectUrl: string;
|
||||
}>('/proApi/common/workorder/create');
|
Reference in New Issue
Block a user