From 539cb5593e251a5182647a5ea55b5d0423351756 Mon Sep 17 00:00:00 2001 From: zhangheng Date: Tue, 14 Apr 2026 15:38:57 +0800 Subject: [PATCH 1/3] fix(tool): mousePointer --- .../label/components/AssistShapeComponent.tsx | 14 +++++++++++--- components/label/components/TopTools.tsx | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/components/label/components/AssistShapeComponent.tsx b/components/label/components/AssistShapeComponent.tsx index 514d09a..0316000 100644 --- a/components/label/components/AssistShapeComponent.tsx +++ b/components/label/components/AssistShapeComponent.tsx @@ -6,6 +6,7 @@ import React, { useImperativeHandle, useRef, } from "react" +import { useTopToolsStore } from "../useTopToolsStore" interface AssistShapeComponentProps { size: number @@ -16,7 +17,9 @@ const AssistShapeComponent = ( ref: React.Ref | undefined ) => { const { size } = props + const scale = useTopToolsStore((state) => state.scale) const canvasRef = useRef(null) + const lastPointerRef = useRef<{ x: number; y: number } | null>(null) const drawAssistShape = useCallback( (centerX: number, centerY: number) => { @@ -24,7 +27,7 @@ const AssistShapeComponent = ( const ctx = canvas?.getContext("2d") if (!canvas || !ctx) return - const radius = Math.max(1, size) + const radius = Math.max(1, size * scale) const side = radius * 2 const left = centerX - radius const top = centerY - radius @@ -38,7 +41,7 @@ const AssistShapeComponent = ( ctx.arc(centerX, centerY, radius, 0, Math.PI * 2) ctx.stroke() }, - [size] + [scale, size] ) useEffect(() => { @@ -47,7 +50,11 @@ const AssistShapeComponent = ( canvas.width = window.innerWidth canvas.height = window.innerHeight const rect = canvas.getBoundingClientRect() - drawAssistShape(rect.width / 2, rect.height / 2) + const center = lastPointerRef.current || { + x: rect.width / 2, + y: rect.height / 2, + } + drawAssistShape(center.x, center.y) }, [drawAssistShape]) const updateAssistShape = (event: { clientX: number; clientY: number }) => { @@ -56,6 +63,7 @@ const AssistShapeComponent = ( const rect = canvas.getBoundingClientRect() const centerX = event.clientX - rect.left const centerY = event.clientY - rect.top + lastPointerRef.current = { x: centerX, y: centerY } drawAssistShape(centerX, centerY) } diff --git a/components/label/components/TopTools.tsx b/components/label/components/TopTools.tsx index 445e7d7..ff47ff6 100644 --- a/components/label/components/TopTools.tsx +++ b/components/label/components/TopTools.tsx @@ -55,6 +55,7 @@ import { Paintbrush, Pen, SquarePen, + SquareDashedMousePointer, Tag, Timer, } from "lucide-react" @@ -2082,7 +2083,7 @@ const TopTools = ( onClick={() => { setAssistToolEnabled(!assistToolEnabled) }}> - + Date: Tue, 14 Apr 2026 16:35:45 +0800 Subject: [PATCH 2/3] fix(project): date --- components/project/index.tsx | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/components/project/index.tsx b/components/project/index.tsx index c175355..264b239 100644 --- a/components/project/index.tsx +++ b/components/project/index.tsx @@ -24,6 +24,15 @@ import { projectStatusOpts, STATUS_CODE, } from "@/components/label/utils/constants" +import { + SettingContentPanel, + SettingFilterActions, + SettingFilterPanel, + SettingHeaderActions, + SettingListHeader, + SettingPage, + SettingPanel, +} from "@/components/setting/PageSurface" import { ActionIcon, Badge, @@ -46,15 +55,6 @@ import { Tooltip, UnstyledButton, } from "@mantine/core" -import { - SettingContentPanel, - SettingFilterActions, - SettingFilterPanel, - SettingHeaderActions, - SettingListHeader, - SettingPage, - SettingPanel, -} from "@/components/setting/PageSurface" import { useForm } from "@mantine/form" import { notifications } from "@mantine/notifications" import { @@ -71,7 +71,6 @@ import { IconStar, IconStarFilled, } from "@tabler/icons-react" -import dayjs from "dayjs" import { User2 } from "lucide-react" import { useRouter } from "next/navigation" import { @@ -190,8 +189,8 @@ export default function ProjectInfoPage({ owner: "", label_type: "", admin_user: [] as string[], - start_date: dayjs().subtract(6, "day").format("YYYY-MM-DD"), - end_date: dayjs().format("YYYY-MM-DD"), + start_date: "", + end_date: "", } }) @@ -395,8 +394,9 @@ export default function ProjectInfoPage({ Date: Tue, 14 Apr 2026 17:14:49 +0800 Subject: [PATCH 3/3] fix(ones): bug --- app/project/detail/OwnTaskTableContainer.tsx | 18 +++---- app/project/detail/TaskTableContainer.tsx | 2 +- .../detail/components/DispatchModal.tsx | 47 +++++++++++++++++-- 3 files changed, 52 insertions(+), 15 deletions(-) diff --git a/app/project/detail/OwnTaskTableContainer.tsx b/app/project/detail/OwnTaskTableContainer.tsx index ccf6066..9844f91 100644 --- a/app/project/detail/OwnTaskTableContainer.tsx +++ b/app/project/detail/OwnTaskTableContainer.tsx @@ -8,6 +8,14 @@ import { usePermissionStore, } from "@/components/label/store/auth" import { OwnTaskStatusOpts } from "@/components/label/utils/constants" +import { + SettingContentPanel, + SettingDataTable, + SettingFilterActions, + SettingFilterPanel, + SettingHeaderActions, + SettingListHeader, +} from "@/components/setting/PageSurface" import { Button, Collapse, @@ -28,14 +36,6 @@ import { import { DataTableColumn } from "mantine-datatable" import { useRouter, useSearchParams } from "next/navigation" import { useCallback, useEffect, useMemo, useState } from "react" -import { - SettingContentPanel, - SettingDataTable, - SettingFilterActions, - SettingFilterPanel, - SettingHeaderActions, - SettingListHeader, -} from "@/components/setting/PageSurface" import TaskStatusTag from "./components/TaskStatusTag" function createInitialFilters() { @@ -231,7 +231,7 @@ export default function OwnTaskTableContainer(props: { { accessor: "label_status", title: "状态", - width: 120, + width: 150, render: (record) => ( ( (!value ? "必填" : null), + }, }) + const resetFormState = () => { + form.setValues({ + reject: false, + task_status_dst: "", + uid_dst: "", + }) + form.clearErrors() + form.resetDirty() + } + + useEffect(() => { + if (opened) { + resetFormState() + return + } + + resetFormState() + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [opened]) + const taskStatusSrc = dispatchData?.status ?? 0 + const taskStatusSrcLabel = dispatchOpts[taskStatusSrc]?.label ?? "-" const dstOptions = dispatchOpts[taskStatusSrc]?.opts?.map((o) => ({ label: o.label, @@ -45,7 +70,10 @@ export default function DispatchModal(props: { return ( onCloseAction()} + onClose={() => { + resetFormState() + onCloseAction() + }} title="调度任务" centered size={520}> @@ -100,6 +128,7 @@ export default function DispatchModal(props: { title: "操作成功", message: "已调度任务", }) + resetFormState() onCloseAction(true) } catch (e) { notifications.show({ @@ -115,16 +144,19 @@ export default function DispatchModal(props: { {task_ids.map((item) => item.project_name).join("、") ?? "-"} - (源状态:{taskStatusSrc}) + (源状态:{taskStatusSrcLabel}) form.setFieldValue("uid_dst", v ?? "")} /> @@ -145,7 +177,12 @@ export default function DispatchModal(props: { /> -