fix(management): fix bug
This commit is contained in:
@@ -9,7 +9,6 @@ import {
|
|||||||
} 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 {
|
import {
|
||||||
Text,
|
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Button,
|
Button,
|
||||||
Collapse,
|
Collapse,
|
||||||
@@ -19,20 +18,21 @@ import {
|
|||||||
Select,
|
Select,
|
||||||
SimpleGrid,
|
SimpleGrid,
|
||||||
Stack,
|
Stack,
|
||||||
|
Text,
|
||||||
TextInput,
|
TextInput,
|
||||||
} from "@mantine/core"
|
} from "@mantine/core"
|
||||||
import { notifications } from "@mantine/notifications"
|
import { notifications } from "@mantine/notifications"
|
||||||
import { DataTable, DataTableColumn } from "mantine-datatable"
|
|
||||||
import { useRouter, useSearchParams } from "next/navigation"
|
|
||||||
import { useCallback, useEffect, useMemo, useState } from "react"
|
|
||||||
import TaskStatusTag from "./components/TaskStatusTag"
|
|
||||||
import { runCommand } from "./util"
|
|
||||||
import {
|
import {
|
||||||
IconChevronDown,
|
IconChevronDown,
|
||||||
IconChevronUp,
|
IconChevronUp,
|
||||||
IconRefresh,
|
IconRefresh,
|
||||||
IconSearch,
|
IconSearch,
|
||||||
} from "@tabler/icons-react"
|
} from "@tabler/icons-react"
|
||||||
|
import { DataTable, DataTableColumn } from "mantine-datatable"
|
||||||
|
import { useRouter, useSearchParams } from "next/navigation"
|
||||||
|
import { useCallback, useEffect, useMemo, useState } from "react"
|
||||||
|
import TaskStatusTag from "./components/TaskStatusTag"
|
||||||
|
import { runCommand } from "./util"
|
||||||
|
|
||||||
function createInitialFilters() {
|
function createInitialFilters() {
|
||||||
return {
|
return {
|
||||||
@@ -51,6 +51,7 @@ export default function OwnTaskTableContainer(props: {
|
|||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
const { info, userEnums } = props
|
const { info, userEnums } = props
|
||||||
|
|
||||||
const urlParams = useSearchParams()
|
const urlParams = useSearchParams()
|
||||||
const id = urlParams.get("id")
|
const id = urlParams.get("id")
|
||||||
const type = urlParams.get("type")
|
const type = urlParams.get("type")
|
||||||
@@ -183,7 +184,7 @@ export default function OwnTaskTableContainer(props: {
|
|||||||
width: 100,
|
width: 100,
|
||||||
render: (record) => (
|
render: (record) => (
|
||||||
<Button
|
<Button
|
||||||
variant="subtle"
|
variant="transparent"
|
||||||
size="xs"
|
size="xs"
|
||||||
style={{ paddingLeft: 6, paddingRight: 6 }}
|
style={{ paddingLeft: 6, paddingRight: 6 }}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
@@ -192,7 +193,7 @@ export default function OwnTaskTableContainer(props: {
|
|||||||
: `/management/project/detail?id=${projectId}`
|
: `/management/project/detail?id=${projectId}`
|
||||||
setBackProps(backUrl, "own")
|
setBackProps(backUrl, "own")
|
||||||
|
|
||||||
if (info && [4, 5, 6].includes(info.label_type)) {
|
if (info && [4, 5, 6, 7].includes(info.label_type)) {
|
||||||
router.push(
|
router.push(
|
||||||
`/label?project_id=${projectId}&task_id=${record.id}`
|
`/label?project_id=${projectId}&task_id=${record.id}`
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,7 +3,10 @@
|
|||||||
import { ProjectDetail } from "@/components/label/api/project/typing"
|
import { ProjectDetail } from "@/components/label/api/project/typing"
|
||||||
import { getTaskList, taskRelease } from "@/components/label/api/task"
|
import { getTaskList, taskRelease } from "@/components/label/api/task"
|
||||||
import { Task } from "@/components/label/api/task/typing"
|
import { Task } from "@/components/label/api/task/typing"
|
||||||
import { usePermissionStore } from "@/components/label/store/auth"
|
import {
|
||||||
|
useBackUrlStore,
|
||||||
|
usePermissionStore,
|
||||||
|
} from "@/components/label/store/auth"
|
||||||
import {
|
import {
|
||||||
TaskStatusEnum,
|
TaskStatusEnum,
|
||||||
TaskStatusOpts,
|
TaskStatusOpts,
|
||||||
@@ -31,13 +34,14 @@ import {
|
|||||||
IconSearch,
|
IconSearch,
|
||||||
} from "@tabler/icons-react"
|
} from "@tabler/icons-react"
|
||||||
import { DataTable, DataTableColumn } from "mantine-datatable"
|
import { DataTable, DataTableColumn } from "mantine-datatable"
|
||||||
import { 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 * as XLSX from "xlsx-js-style"
|
import * as XLSX from "xlsx-js-style"
|
||||||
import DispatchModal from "./components/DispatchModal"
|
import DispatchModal from "./components/DispatchModal"
|
||||||
import ReleaseModal from "./components/ReleaseModal"
|
import ReleaseModal from "./components/ReleaseModal"
|
||||||
import TaskStatusTag from "./components/TaskStatusTag"
|
import TaskStatusTag from "./components/TaskStatusTag"
|
||||||
import WorkflowModal from "./components/WorkflowModal"
|
import WorkflowModal from "./components/WorkflowModal"
|
||||||
|
import { runCommand } from "./util"
|
||||||
|
|
||||||
interface FilterFormRecord {
|
interface FilterFormRecord {
|
||||||
search_id: string
|
search_id: string
|
||||||
@@ -125,9 +129,17 @@ export default function TaskTableContainer(props: {
|
|||||||
|
|
||||||
const urlParams = useSearchParams()
|
const urlParams = useSearchParams()
|
||||||
const id = urlParams.get("id")
|
const id = urlParams.get("id")
|
||||||
|
const type = urlParams.get("type")
|
||||||
|
|
||||||
const projectId =
|
const projectId =
|
||||||
typeof id === "string" && !isNaN(Number(id)) ? Number(id) : -1
|
typeof id === "string" && !isNaN(Number(id)) ? Number(id) : -1
|
||||||
|
|
||||||
|
const user_name = usePermissionStore((s) => s.user_name)
|
||||||
|
const user_password = usePermissionStore((s) => s.user_password)
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const { setBackProps } = useBackUrlStore()
|
||||||
|
|
||||||
const [total, setTotal] = useState(0)
|
const [total, setTotal] = useState(0)
|
||||||
|
|
||||||
const [pageNumber, setPageNumber] = useState(1)
|
const [pageNumber, setPageNumber] = useState(1)
|
||||||
@@ -434,7 +446,37 @@ export default function TaskTableContainer(props: {
|
|||||||
|
|
||||||
const columns = useMemo(() => {
|
const columns = useMemo(() => {
|
||||||
const cols: DataTableColumn<Task.DataProps>[] = [
|
const cols: DataTableColumn<Task.DataProps>[] = [
|
||||||
{ accessor: "id", title: "任务ID", width: 90 },
|
{
|
||||||
|
accessor: "id",
|
||||||
|
title: "任务ID",
|
||||||
|
width: 90,
|
||||||
|
render: (record) => (
|
||||||
|
<Button
|
||||||
|
variant="transparent"
|
||||||
|
size="xs"
|
||||||
|
style={{ paddingLeft: 6, paddingRight: 6 }}
|
||||||
|
onClick={async () => {
|
||||||
|
const backUrl = type
|
||||||
|
? `/management/project/detail?id=${projectId}&type=${type}`
|
||||||
|
: `/management/project/detail?id=${projectId}`
|
||||||
|
setBackProps(backUrl, "own")
|
||||||
|
|
||||||
|
if (info && [4, 5, 6, 7].includes(info.label_type)) {
|
||||||
|
router.push(
|
||||||
|
`/label?project_id=${projectId}&task_id=${record.id}`
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
await runCommand(
|
||||||
|
String(record.id),
|
||||||
|
user_name ?? "",
|
||||||
|
user_password ?? ""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
{record.id}
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
accessor: "label_status",
|
accessor: "label_status",
|
||||||
title: "状态",
|
title: "状态",
|
||||||
@@ -706,7 +748,7 @@ export default function TaskTableContainer(props: {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
return cols
|
return cols
|
||||||
}, [])
|
}, [info, projectId, router, setBackProps, type, user_name, user_password])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -24,17 +24,14 @@ 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 {
|
import { IconCaretDownFilled, IconChevronDown } from "@tabler/icons-react"
|
||||||
IconCaretDownFilled,
|
|
||||||
IconChevronDown,
|
|
||||||
IconCornerRightUp,
|
|
||||||
} from "@tabler/icons-react"
|
|
||||||
import dayjs from "dayjs"
|
import dayjs from "dayjs"
|
||||||
import duration from "dayjs/plugin/duration"
|
import duration from "dayjs/plugin/duration"
|
||||||
import {
|
import {
|
||||||
BadgeInfoIcon,
|
BadgeInfoIcon,
|
||||||
Baseline,
|
Baseline,
|
||||||
ChevronDownIcon,
|
ChevronDownIcon,
|
||||||
|
ChevronLeftIcon,
|
||||||
CirclePlus,
|
CirclePlus,
|
||||||
ClipboardList,
|
ClipboardList,
|
||||||
Cloud,
|
Cloud,
|
||||||
@@ -1540,12 +1537,12 @@ const TopTools = (
|
|||||||
px="md"
|
px="md"
|
||||||
flex={1}
|
flex={1}
|
||||||
style={{ justifyContent: "flex-start" }}>
|
style={{ justifyContent: "flex-start" }}>
|
||||||
{/* <ActionIcon
|
<ActionIcon
|
||||||
variant="transparent"
|
variant="transparent"
|
||||||
c="dark"
|
c="dark"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (isView) {
|
if (isView) {
|
||||||
const url = backUrl || "/project/info"
|
const url = backUrl || "/management/project/all"
|
||||||
// handleBackup("auto_backup");
|
// handleBackup("auto_backup");
|
||||||
router.push(url)
|
router.push(url)
|
||||||
// 重置图片比例及选中标注对象
|
// 重置图片比例及选中标注对象
|
||||||
@@ -1556,8 +1553,8 @@ const TopTools = (
|
|||||||
}
|
}
|
||||||
}}>
|
}}>
|
||||||
<ChevronLeftIcon style={{ width: 24, height: 24 }} />
|
<ChevronLeftIcon style={{ width: 24, height: 24 }} />
|
||||||
</ActionIcon> */}
|
</ActionIcon>
|
||||||
<ActionIcon
|
{/* <ActionIcon
|
||||||
variant="transparent"
|
variant="transparent"
|
||||||
c="var(--mantine-color-text)"
|
c="var(--mantine-color-text)"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -1565,7 +1562,7 @@ const TopTools = (
|
|||||||
window.open(url, "_blank")
|
window.open(url, "_blank")
|
||||||
}}>
|
}}>
|
||||||
<IconCornerRightUp size={22} />
|
<IconCornerRightUp size={22} />
|
||||||
</ActionIcon>
|
</ActionIcon> */}
|
||||||
<HoverCard width={280} shadow="md">
|
<HoverCard width={280} shadow="md">
|
||||||
<HoverCard.Target>
|
<HoverCard.Target>
|
||||||
<Flex align="center" style={{ maxWidth: 390 }}>
|
<Flex align="center" style={{ maxWidth: 390 }}>
|
||||||
|
|||||||
Reference in New Issue
Block a user