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