From 46f46f667b3e4d31440095e36e2f537f3ba85ddc Mon Sep 17 00:00:00 2001 From: zjy <3161362058@qq.com> Date: Thu, 17 Oct 2024 17:00:25 +0800 Subject: [PATCH 1/5] fix:workorder overflow issue --- .../detail/components/AppBaseInfo.tsx | 4 ++-- .../src/pages/workorder/detail/index.tsx | 1 + .../workorder/src/pages/workorders/index.tsx | 19 +++++++++++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/frontend/providers/workorder/src/pages/workorder/detail/components/AppBaseInfo.tsx b/frontend/providers/workorder/src/pages/workorder/detail/components/AppBaseInfo.tsx index 9d11d1acb96..465f58060e3 100644 --- a/frontend/providers/workorder/src/pages/workorder/detail/components/AppBaseInfo.tsx +++ b/frontend/providers/workorder/src/pages/workorder/detail/components/AppBaseInfo.tsx @@ -126,8 +126,8 @@ const AppBaseInfo = ({ app }: { app: WorkOrderDB }) => { {t('Description')} - - {app?.description} + + {app?.description} diff --git a/frontend/providers/workorder/src/pages/workorder/detail/index.tsx b/frontend/providers/workorder/src/pages/workorder/detail/index.tsx index 714dcf3eced..f886a8e28bc 100644 --- a/frontend/providers/workorder/src/pages/workorder/detail/index.tsx +++ b/frontend/providers/workorder/src/pages/workorder/detail/index.tsx @@ -96,6 +96,7 @@ export default function OrderDetail({ orderId }: { orderId: string }) { border={'1px solid #DEE0E2'} borderRadius={'md'} flexDirection={'column'} + overflow={'hidden'} > {workOrderDetail && workOrderDetail.dialogs?.length ? ( { + const queryPage = Number(router.query.page); + return !isNaN(queryPage) && queryPage > 0 ? queryPage : 1; + }); + const [pageSize, setPageSize] = useState(10); const [orderStatus, setOrderStatus] = useState( (router.query?.status as WorkOrderStatus) || WorkOrderStatus.All ); @@ -169,9 +172,17 @@ function Home() { {!!data?.totalCount && ( { + router.push({ + query: { + ...router.query, + page: page.toString() + } + }); + setPage(page); + }} /> )} From 1bcd571291020edd68fe649d2bc1f921880817ac Mon Sep 17 00:00:00 2001 From: zjy <3161362058@qq.com> Date: Thu, 17 Oct 2024 17:44:27 +0800 Subject: [PATCH 2/5] feat paste upload file --- .../detail/components/AppMainInfo.tsx | 24 +++++++++++++++++-- .../workorder/detail/components/Header.tsx | 3 ++- .../workorder/src/pages/workorders/index.tsx | 2 +- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/frontend/providers/workorder/src/pages/workorder/detail/components/AppMainInfo.tsx b/frontend/providers/workorder/src/pages/workorder/detail/components/AppMainInfo.tsx index 5516700fa9a..4dcdbcf978e 100644 --- a/frontend/providers/workorder/src/pages/workorder/detail/components/AppMainInfo.tsx +++ b/frontend/providers/workorder/src/pages/workorder/detail/components/AppMainInfo.tsx @@ -23,7 +23,7 @@ import { import { fetchEventSource } from '@fortaine/fetch-event-source'; import { throttle } from 'lodash'; import { useTranslation } from 'next-i18next'; -import { useEffect, useLayoutEffect, useRef, useState } from 'react'; +import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'; const statusAnimation = keyframes` 0% { @@ -331,6 +331,25 @@ const AppMainInfo = ({ } }, [app?.dialogs, isManuallyHandled]); + const handlePaste = useCallback(async (e: React.ClipboardEvent) => { + const items = e.clipboardData.items; + const files: File[] = []; + + for (let i = 0; i < items.length; i++) { + if (items[i].type.indexOf('image') !== -1) { + const blob = items[i].getAsFile(); + if (blob) { + files.push(blob); + } + } + } + + if (files.length > 0) { + e.preventDefault(); + await uploadFiles(files); + } + }, []); + return ( <> @@ -449,6 +468,7 @@ const AppMainInfo = ({ } border={'1px solid #EAEBF0'} flexDirection={'column'} + onPaste={handlePaste} > {uploadedFiles && ( @@ -517,7 +537,7 @@ const AppMainInfo = ({