Merge branch 'zh' into 'main'
Zh See merge request prism/lable/labelimage!11
This commit is contained in:
@@ -8,6 +8,14 @@ import {
|
|||||||
usePermissionStore,
|
usePermissionStore,
|
||||||
} from "@/components/label/store/auth"
|
} from "@/components/label/store/auth"
|
||||||
import { OwnTaskStatusOpts } from "@/components/label/utils/constants"
|
import { OwnTaskStatusOpts } from "@/components/label/utils/constants"
|
||||||
|
import {
|
||||||
|
SettingContentPanel,
|
||||||
|
SettingDataTable,
|
||||||
|
SettingFilterActions,
|
||||||
|
SettingFilterPanel,
|
||||||
|
SettingHeaderActions,
|
||||||
|
SettingListHeader,
|
||||||
|
} from "@/components/setting/PageSurface"
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Collapse,
|
Collapse,
|
||||||
@@ -28,14 +36,6 @@ import {
|
|||||||
import { DataTableColumn } from "mantine-datatable"
|
import { DataTableColumn } from "mantine-datatable"
|
||||||
import { useRouter, useSearchParams } from "next/navigation"
|
import { useRouter, useSearchParams } from "next/navigation"
|
||||||
import { useCallback, useEffect, useMemo, useState } from "react"
|
import { useCallback, useEffect, useMemo, useState } from "react"
|
||||||
import {
|
|
||||||
SettingContentPanel,
|
|
||||||
SettingDataTable,
|
|
||||||
SettingFilterActions,
|
|
||||||
SettingFilterPanel,
|
|
||||||
SettingHeaderActions,
|
|
||||||
SettingListHeader,
|
|
||||||
} from "@/components/setting/PageSurface"
|
|
||||||
import TaskStatusTag from "./components/TaskStatusTag"
|
import TaskStatusTag from "./components/TaskStatusTag"
|
||||||
|
|
||||||
function createInitialFilters() {
|
function createInitialFilters() {
|
||||||
@@ -231,7 +231,7 @@ export default function OwnTaskTableContainer(props: {
|
|||||||
{
|
{
|
||||||
accessor: "label_status",
|
accessor: "label_status",
|
||||||
title: "状态",
|
title: "状态",
|
||||||
width: 120,
|
width: 150,
|
||||||
render: (record) => (
|
render: (record) => (
|
||||||
<TaskStatusTag
|
<TaskStatusTag
|
||||||
status={record.label_status}
|
status={record.label_status}
|
||||||
|
|||||||
@@ -658,7 +658,7 @@ export default function TaskTableContainer(props: {
|
|||||||
{
|
{
|
||||||
accessor: "label_status",
|
accessor: "label_status",
|
||||||
title: "状态",
|
title: "状态",
|
||||||
width: 110,
|
width: 150,
|
||||||
render: (record) => (
|
render: (record) => (
|
||||||
<TaskStatusTag
|
<TaskStatusTag
|
||||||
status={record.label_status}
|
status={record.label_status}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
} from "@mantine/core"
|
} from "@mantine/core"
|
||||||
import { useForm } from "@mantine/form"
|
import { useForm } from "@mantine/form"
|
||||||
import { notifications } from "@mantine/notifications"
|
import { notifications } from "@mantine/notifications"
|
||||||
|
import { useEffect } from "react"
|
||||||
import { selectedDataProps } from "../TaskTableContainer"
|
import { selectedDataProps } from "../TaskTableContainer"
|
||||||
import { dispatchOpts } from "./config"
|
import { dispatchOpts } from "./config"
|
||||||
|
|
||||||
@@ -33,9 +34,33 @@ export default function DispatchModal(props: {
|
|||||||
task_status_dst: "",
|
task_status_dst: "",
|
||||||
uid_dst: "",
|
uid_dst: "",
|
||||||
},
|
},
|
||||||
|
validate: {
|
||||||
|
task_status_dst: (value) => (!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 taskStatusSrc = dispatchData?.status ?? 0
|
||||||
|
const taskStatusSrcLabel = dispatchOpts[taskStatusSrc]?.label ?? "-"
|
||||||
const dstOptions =
|
const dstOptions =
|
||||||
dispatchOpts[taskStatusSrc]?.opts?.map((o) => ({
|
dispatchOpts[taskStatusSrc]?.opts?.map((o) => ({
|
||||||
label: o.label,
|
label: o.label,
|
||||||
@@ -45,7 +70,10 @@ export default function DispatchModal(props: {
|
|||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
opened={opened}
|
opened={opened}
|
||||||
onClose={() => onCloseAction()}
|
onClose={() => {
|
||||||
|
resetFormState()
|
||||||
|
onCloseAction()
|
||||||
|
}}
|
||||||
title="调度任务"
|
title="调度任务"
|
||||||
centered
|
centered
|
||||||
size={520}>
|
size={520}>
|
||||||
@@ -100,6 +128,7 @@ export default function DispatchModal(props: {
|
|||||||
title: "操作成功",
|
title: "操作成功",
|
||||||
message: "已调度任务",
|
message: "已调度任务",
|
||||||
})
|
})
|
||||||
|
resetFormState()
|
||||||
onCloseAction(true)
|
onCloseAction(true)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
notifications.show({
|
notifications.show({
|
||||||
@@ -115,16 +144,19 @@ export default function DispatchModal(props: {
|
|||||||
{task_ids.map((item) => item.project_name).join("、") ?? "-"}
|
{task_ids.map((item) => item.project_name).join("、") ?? "-"}
|
||||||
</Text>
|
</Text>
|
||||||
<Text size="sm" c="dimmed">
|
<Text size="sm" c="dimmed">
|
||||||
(源状态:{taskStatusSrc})
|
(源状态:{taskStatusSrcLabel})
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
label="目标状态"
|
label="目标状态"
|
||||||
|
placeholder="请选择目标状态"
|
||||||
data={dstOptions}
|
data={dstOptions}
|
||||||
searchable
|
searchable
|
||||||
clearable
|
clearable
|
||||||
value={form.values.task_status_dst}
|
withAsterisk
|
||||||
|
value={form.values.task_status_dst || null}
|
||||||
onChange={(v) => form.setFieldValue("task_status_dst", v ?? "")}
|
onChange={(v) => form.setFieldValue("task_status_dst", v ?? "")}
|
||||||
|
error={form.errors.task_status_dst}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
@@ -132,7 +164,7 @@ export default function DispatchModal(props: {
|
|||||||
data={userOptions}
|
data={userOptions}
|
||||||
searchable
|
searchable
|
||||||
clearable
|
clearable
|
||||||
value={form.values.uid_dst}
|
value={form.values.uid_dst || null}
|
||||||
onChange={(v) => form.setFieldValue("uid_dst", v ?? "")}
|
onChange={(v) => form.setFieldValue("uid_dst", v ?? "")}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -145,7 +177,12 @@ export default function DispatchModal(props: {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Group justify="flex-end" gap="sm">
|
<Group justify="flex-end" gap="sm">
|
||||||
<Button variant="default" onClick={() => onCloseAction()}>
|
<Button
|
||||||
|
variant="default"
|
||||||
|
onClick={() => {
|
||||||
|
resetFormState()
|
||||||
|
onCloseAction()
|
||||||
|
}}>
|
||||||
取消
|
取消
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="submit">确定</Button>
|
<Button type="submit">确定</Button>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import React, {
|
|||||||
useImperativeHandle,
|
useImperativeHandle,
|
||||||
useRef,
|
useRef,
|
||||||
} from "react"
|
} from "react"
|
||||||
|
import { useTopToolsStore } from "../useTopToolsStore"
|
||||||
|
|
||||||
interface AssistShapeComponentProps {
|
interface AssistShapeComponentProps {
|
||||||
size: number
|
size: number
|
||||||
@@ -16,7 +17,9 @@ const AssistShapeComponent = (
|
|||||||
ref: React.Ref<unknown> | undefined
|
ref: React.Ref<unknown> | undefined
|
||||||
) => {
|
) => {
|
||||||
const { size } = props
|
const { size } = props
|
||||||
|
const scale = useTopToolsStore((state) => state.scale)
|
||||||
const canvasRef = useRef<HTMLCanvasElement>(null)
|
const canvasRef = useRef<HTMLCanvasElement>(null)
|
||||||
|
const lastPointerRef = useRef<{ x: number; y: number } | null>(null)
|
||||||
|
|
||||||
const drawAssistShape = useCallback(
|
const drawAssistShape = useCallback(
|
||||||
(centerX: number, centerY: number) => {
|
(centerX: number, centerY: number) => {
|
||||||
@@ -24,7 +27,7 @@ const AssistShapeComponent = (
|
|||||||
const ctx = canvas?.getContext("2d")
|
const ctx = canvas?.getContext("2d")
|
||||||
if (!canvas || !ctx) return
|
if (!canvas || !ctx) return
|
||||||
|
|
||||||
const radius = Math.max(1, size)
|
const radius = Math.max(1, size * scale)
|
||||||
const side = radius * 2
|
const side = radius * 2
|
||||||
const left = centerX - radius
|
const left = centerX - radius
|
||||||
const top = centerY - radius
|
const top = centerY - radius
|
||||||
@@ -38,7 +41,7 @@ const AssistShapeComponent = (
|
|||||||
ctx.arc(centerX, centerY, radius, 0, Math.PI * 2)
|
ctx.arc(centerX, centerY, radius, 0, Math.PI * 2)
|
||||||
ctx.stroke()
|
ctx.stroke()
|
||||||
},
|
},
|
||||||
[size]
|
[scale, size]
|
||||||
)
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -47,7 +50,11 @@ const AssistShapeComponent = (
|
|||||||
canvas.width = window.innerWidth
|
canvas.width = window.innerWidth
|
||||||
canvas.height = window.innerHeight
|
canvas.height = window.innerHeight
|
||||||
const rect = canvas.getBoundingClientRect()
|
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])
|
}, [drawAssistShape])
|
||||||
|
|
||||||
const updateAssistShape = (event: { clientX: number; clientY: number }) => {
|
const updateAssistShape = (event: { clientX: number; clientY: number }) => {
|
||||||
@@ -56,6 +63,7 @@ const AssistShapeComponent = (
|
|||||||
const rect = canvas.getBoundingClientRect()
|
const rect = canvas.getBoundingClientRect()
|
||||||
const centerX = event.clientX - rect.left
|
const centerX = event.clientX - rect.left
|
||||||
const centerY = event.clientY - rect.top
|
const centerY = event.clientY - rect.top
|
||||||
|
lastPointerRef.current = { x: centerX, y: centerY }
|
||||||
drawAssistShape(centerX, centerY)
|
drawAssistShape(centerX, centerY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ import {
|
|||||||
Paintbrush,
|
Paintbrush,
|
||||||
Pen,
|
Pen,
|
||||||
SquarePen,
|
SquarePen,
|
||||||
|
SquareDashedMousePointer,
|
||||||
Tag,
|
Tag,
|
||||||
Timer,
|
Timer,
|
||||||
} from "lucide-react"
|
} from "lucide-react"
|
||||||
@@ -2082,7 +2083,7 @@ const TopTools = (
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setAssistToolEnabled(!assistToolEnabled)
|
setAssistToolEnabled(!assistToolEnabled)
|
||||||
}}>
|
}}>
|
||||||
<Eclipse size={16} />
|
<SquareDashedMousePointer size={16} />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
<NumberInput
|
<NumberInput
|
||||||
value={assistToolSize}
|
value={assistToolSize}
|
||||||
|
|||||||
@@ -24,6 +24,15 @@ import {
|
|||||||
projectStatusOpts,
|
projectStatusOpts,
|
||||||
STATUS_CODE,
|
STATUS_CODE,
|
||||||
} from "@/components/label/utils/constants"
|
} from "@/components/label/utils/constants"
|
||||||
|
import {
|
||||||
|
SettingContentPanel,
|
||||||
|
SettingFilterActions,
|
||||||
|
SettingFilterPanel,
|
||||||
|
SettingHeaderActions,
|
||||||
|
SettingListHeader,
|
||||||
|
SettingPage,
|
||||||
|
SettingPanel,
|
||||||
|
} from "@/components/setting/PageSurface"
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Badge,
|
Badge,
|
||||||
@@ -46,15 +55,6 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
UnstyledButton,
|
UnstyledButton,
|
||||||
} from "@mantine/core"
|
} from "@mantine/core"
|
||||||
import {
|
|
||||||
SettingContentPanel,
|
|
||||||
SettingFilterActions,
|
|
||||||
SettingFilterPanel,
|
|
||||||
SettingHeaderActions,
|
|
||||||
SettingListHeader,
|
|
||||||
SettingPage,
|
|
||||||
SettingPanel,
|
|
||||||
} from "@/components/setting/PageSurface"
|
|
||||||
import { useForm } from "@mantine/form"
|
import { useForm } from "@mantine/form"
|
||||||
import { notifications } from "@mantine/notifications"
|
import { notifications } from "@mantine/notifications"
|
||||||
import {
|
import {
|
||||||
@@ -71,7 +71,6 @@ import {
|
|||||||
IconStar,
|
IconStar,
|
||||||
IconStarFilled,
|
IconStarFilled,
|
||||||
} from "@tabler/icons-react"
|
} from "@tabler/icons-react"
|
||||||
import dayjs from "dayjs"
|
|
||||||
import { User2 } from "lucide-react"
|
import { User2 } from "lucide-react"
|
||||||
import { useRouter } from "next/navigation"
|
import { useRouter } from "next/navigation"
|
||||||
import {
|
import {
|
||||||
@@ -190,8 +189,8 @@ export default function ProjectInfoPage({
|
|||||||
owner: "",
|
owner: "",
|
||||||
label_type: "",
|
label_type: "",
|
||||||
admin_user: [] as string[],
|
admin_user: [] as string[],
|
||||||
start_date: dayjs().subtract(6, "day").format("YYYY-MM-DD"),
|
start_date: "",
|
||||||
end_date: dayjs().format("YYYY-MM-DD"),
|
end_date: "",
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -395,8 +394,9 @@ export default function ProjectInfoPage({
|
|||||||
<Text
|
<Text
|
||||||
fw={700}
|
fw={700}
|
||||||
c={"brand"}
|
c={"brand"}
|
||||||
|
title={record.name}
|
||||||
style={{
|
style={{
|
||||||
maxWidth: "100%",
|
maxWidth: "100px",
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
textOverflow: "ellipsis",
|
textOverflow: "ellipsis",
|
||||||
whiteSpace: "nowrap",
|
whiteSpace: "nowrap",
|
||||||
@@ -649,8 +649,8 @@ export default function ProjectInfoPage({
|
|||||||
owner: "",
|
owner: "",
|
||||||
label_type: "",
|
label_type: "",
|
||||||
admin_user: [],
|
admin_user: [],
|
||||||
start_date: dayjs().subtract(6, "day").format("YYYY-MM-DD"),
|
start_date: "",
|
||||||
end_date: dayjs().format("YYYY-MM-DD"),
|
end_date: "",
|
||||||
}
|
}
|
||||||
setFilters(next)
|
setFilters(next)
|
||||||
setAppliedFilters(next)
|
setAppliedFilters(next)
|
||||||
|
|||||||
Reference in New Issue
Block a user