fix(style): fix
This commit is contained in:
@@ -9,12 +9,9 @@ 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 {
|
||||||
ActionIcon,
|
|
||||||
Button,
|
Button,
|
||||||
Collapse,
|
Collapse,
|
||||||
Flex,
|
|
||||||
Group,
|
Group,
|
||||||
Paper,
|
|
||||||
Select,
|
Select,
|
||||||
SimpleGrid,
|
SimpleGrid,
|
||||||
Stack,
|
Stack,
|
||||||
@@ -28,9 +25,17 @@ import {
|
|||||||
IconRefresh,
|
IconRefresh,
|
||||||
IconSearch,
|
IconSearch,
|
||||||
} from "@tabler/icons-react"
|
} from "@tabler/icons-react"
|
||||||
import { DataTable, 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() {
|
||||||
@@ -109,7 +114,6 @@ export default function OwnTaskTableContainer(props: {
|
|||||||
}
|
}
|
||||||
return next
|
return next
|
||||||
}, [
|
}, [
|
||||||
,
|
|
||||||
form.search_id,
|
form.search_id,
|
||||||
form.search_status,
|
form.search_status,
|
||||||
pageNumber,
|
pageNumber,
|
||||||
@@ -173,6 +177,24 @@ export default function OwnTaskTableContainer(props: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleSearch = () => {
|
||||||
|
setPageNumber(1)
|
||||||
|
setForm({ ...filters })
|
||||||
|
setQueryTrigger((v) => v + 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleReset = () => {
|
||||||
|
const next = createInitialFilters()
|
||||||
|
setFilters(next)
|
||||||
|
setForm(next)
|
||||||
|
setPageNumber(1)
|
||||||
|
setQueryTrigger((v) => v + 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleRefresh = () => {
|
||||||
|
setQueryTrigger((v) => v + 1)
|
||||||
|
}
|
||||||
|
|
||||||
const columns = useMemo(() => {
|
const columns = useMemo(() => {
|
||||||
const cols: DataTableColumn<Task.DataProps>[] = [
|
const cols: DataTableColumn<Task.DataProps>[] = [
|
||||||
{
|
{
|
||||||
@@ -267,12 +289,11 @@ export default function OwnTaskTableContainer(props: {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack gap="sm" style={{ flex: 1, minHeight: 0 }}>
|
<Stack gap="sm" style={{ flex: 1, minHeight: 0 }}>
|
||||||
<Paper withBorder p="sm" radius="sm">
|
<SettingFilterPanel>
|
||||||
<Group justify="space-between" wrap="wrap" gap="sm">
|
<Group justify="space-between" wrap="wrap" gap="sm">
|
||||||
<Group gap="xs">
|
<Group gap="xs">
|
||||||
<Text fw={700}>我的任务</Text>
|
<Text fw={700}>筛选条件</Text>
|
||||||
<Button
|
<Button
|
||||||
size="xs"
|
|
||||||
variant="transparent"
|
variant="transparent"
|
||||||
rightSection={
|
rightSection={
|
||||||
searchExpanded ? (
|
searchExpanded ? (
|
||||||
@@ -285,43 +306,20 @@ export default function OwnTaskTableContainer(props: {
|
|||||||
{searchExpanded ? "收起筛选" : "展开筛选"}
|
{searchExpanded ? "收起筛选" : "展开筛选"}
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
<Group gap="xs">
|
|
||||||
<Button
|
|
||||||
size="xs"
|
|
||||||
radius={"xs"}
|
|
||||||
variant="default"
|
|
||||||
leftSection={<IconRefresh size={16} />}
|
|
||||||
onClick={() => {
|
|
||||||
const next = createInitialFilters()
|
|
||||||
setFilters(next)
|
|
||||||
setForm(next)
|
|
||||||
setPageNumber(1)
|
|
||||||
}}>
|
|
||||||
重置
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
size="xs"
|
|
||||||
radius={"xs"}
|
|
||||||
leftSection={<IconSearch size={16} />}
|
|
||||||
onClick={() => {
|
|
||||||
setPageNumber(1)
|
|
||||||
setForm({ ...filters })
|
|
||||||
}}>
|
|
||||||
查询
|
|
||||||
</Button>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
<Collapse
|
<Collapse
|
||||||
in={searchExpanded}
|
in={searchExpanded}
|
||||||
transitionDuration={250}
|
transitionDuration={250}
|
||||||
transitionTimingFunction="ease"
|
transitionTimingFunction="ease"
|
||||||
animateOpacity>
|
animateOpacity>
|
||||||
<Stack gap="sm" mt="sm">
|
<Stack gap="md" mt="md">
|
||||||
<SimpleGrid cols={{ base: 1, sm: 2, md: 3, lg: 4 }} spacing="sm">
|
<SimpleGrid
|
||||||
|
cols={{ base: 1, sm: 2, md: 3, lg: 4 }}
|
||||||
|
spacing="md"
|
||||||
|
verticalSpacing="md">
|
||||||
<TextInput
|
<TextInput
|
||||||
size="xs"
|
|
||||||
radius="xs"
|
|
||||||
label="任务ID"
|
label="任务ID"
|
||||||
|
placeholder="请输入任务 ID"
|
||||||
value={filters.search_id}
|
value={filters.search_id}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
@@ -332,8 +330,6 @@ export default function OwnTaskTableContainer(props: {
|
|||||||
style={{ width: 160 }}
|
style={{ width: 160 }}
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
size="xs"
|
|
||||||
radius="xs"
|
|
||||||
label="状态"
|
label="状态"
|
||||||
data={Object.entries(OwnTaskStatusOpts).map(
|
data={Object.entries(OwnTaskStatusOpts).map(
|
||||||
([value, label]) => ({
|
([value, label]) => ({
|
||||||
@@ -346,60 +342,70 @@ export default function OwnTaskTableContainer(props: {
|
|||||||
setFilters((s) => ({ ...s, search_status: v ?? "0" }))
|
setFilters((s) => ({ ...s, search_status: v ?? "0" }))
|
||||||
}
|
}
|
||||||
allowDeselect={false}
|
allowDeselect={false}
|
||||||
style={{ width: 160 }}
|
|
||||||
/>
|
/>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
</Paper>
|
<SettingFilterActions>
|
||||||
|
<Button
|
||||||
|
variant="default"
|
||||||
|
leftSection={<IconRefresh size={16} />}
|
||||||
|
onClick={handleReset}>
|
||||||
|
重置
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
leftSection={<IconSearch size={16} />}
|
||||||
|
onClick={handleSearch}
|
||||||
|
loading={loading}>
|
||||||
|
查询
|
||||||
|
</Button>
|
||||||
|
</SettingFilterActions>
|
||||||
|
</SettingFilterPanel>
|
||||||
|
|
||||||
<Paper
|
<SettingContentPanel
|
||||||
withBorder
|
|
||||||
p="md"
|
|
||||||
radius="sm"
|
|
||||||
style={{
|
style={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
minHeight: 0,
|
minHeight: 0,
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
}}>
|
}}>
|
||||||
<Stack gap={12} align="stretch" style={{ flex: 1, minHeight: 0 }}>
|
<Stack gap="sm" align="stretch" style={{ flex: 1, minHeight: 0 }}>
|
||||||
<Flex justify={"space-between"} align="center" w="100%">
|
<SettingListHeader
|
||||||
<Flex gap={12}>
|
title="我的任务"
|
||||||
<Button
|
count={`${total} 条`}
|
||||||
size="xs"
|
actions={
|
||||||
radius="xs"
|
<SettingHeaderActions>
|
||||||
variant="default"
|
<Button
|
||||||
disabled={!isLabel}
|
variant="default"
|
||||||
onClick={() => handleAcquireTask(1)}>
|
leftSection={<IconRefresh size={16} />}
|
||||||
领取标注
|
onClick={handleRefresh}
|
||||||
</Button>
|
loading={loading}>
|
||||||
<Button
|
刷新
|
||||||
size="xs"
|
</Button>
|
||||||
radius="xs"
|
<Button
|
||||||
variant="default"
|
variant="default"
|
||||||
disabled={!isReview1}
|
disabled={!isLabel}
|
||||||
onClick={() => handleAcquireTask(2)}>
|
onClick={() => handleAcquireTask(1)}>
|
||||||
领取审核
|
领取标注
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
size="xs"
|
variant="default"
|
||||||
radius="xs"
|
disabled={!isReview1}
|
||||||
variant="default"
|
onClick={() => handleAcquireTask(2)}>
|
||||||
disabled={!isReview2}
|
领取审核
|
||||||
onClick={() => handleAcquireTask(3)}>
|
</Button>
|
||||||
领取复审
|
<Button
|
||||||
</Button>
|
variant="default"
|
||||||
</Flex>
|
disabled={!isReview2}
|
||||||
<ActionIcon onClick={load} variant="transparent">
|
onClick={() => handleAcquireTask(3)}>
|
||||||
<IconRefresh size={16} />
|
领取复审
|
||||||
</ActionIcon>
|
</Button>
|
||||||
</Flex>
|
</SettingHeaderActions>
|
||||||
<DataTable<Task.DataProps>
|
}
|
||||||
|
/>
|
||||||
|
<SettingDataTable<Task.DataProps>
|
||||||
width="100%"
|
width="100%"
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%", flex: 1 }}
|
||||||
withTableBorder
|
|
||||||
withRowBorders
|
|
||||||
pinFirstColumn
|
pinFirstColumn
|
||||||
pinLastColumn
|
pinLastColumn
|
||||||
scrollAreaProps={{ type: "auto" }}
|
scrollAreaProps={{ type: "auto" }}
|
||||||
@@ -415,11 +421,9 @@ export default function OwnTaskTableContainer(props: {
|
|||||||
setPageNumber(1)
|
setPageNumber(1)
|
||||||
}}
|
}}
|
||||||
recordsPerPageOptions={[10, 15, 20]}
|
recordsPerPageOptions={[10, 15, 20]}
|
||||||
noRecordsText="暂无数据"
|
|
||||||
recordsPerPageLabel="当前页数"
|
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Paper>
|
</SettingContentPanel>
|
||||||
</Stack>
|
</Stack>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,13 +12,19 @@ import {
|
|||||||
TaskStatusOpts,
|
TaskStatusOpts,
|
||||||
} from "@/components/label/utils/constants"
|
} from "@/components/label/utils/constants"
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
SettingContentPanel,
|
||||||
|
SettingDataTable,
|
||||||
|
SettingFilterActions,
|
||||||
|
SettingFilterPanel,
|
||||||
|
SettingHeaderActions,
|
||||||
|
SettingListHeader,
|
||||||
|
} from "@/components/setting/PageSurface"
|
||||||
|
import {
|
||||||
Button,
|
Button,
|
||||||
Collapse,
|
Collapse,
|
||||||
Flex,
|
Flex,
|
||||||
Group,
|
Group,
|
||||||
MultiSelect,
|
MultiSelect,
|
||||||
Paper,
|
|
||||||
Select,
|
Select,
|
||||||
SimpleGrid,
|
SimpleGrid,
|
||||||
Stack,
|
Stack,
|
||||||
@@ -35,7 +41,7 @@ import {
|
|||||||
} from "@tabler/icons-react"
|
} 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 { DataTable, 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 * as XLSX from "xlsx-js-style"
|
import * as XLSX from "xlsx-js-style"
|
||||||
@@ -125,7 +131,6 @@ export default function TaskTableContainer(props: {
|
|||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
const { info, userEnums } = props
|
const { info, userEnums } = props
|
||||||
false && console.log(info)
|
|
||||||
|
|
||||||
const { user_id } = usePermissionStore()
|
const { user_id } = usePermissionStore()
|
||||||
|
|
||||||
@@ -444,6 +449,24 @@ export default function TaskTableContainer(props: {
|
|||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleSearch = () => {
|
||||||
|
setPageNumber(1)
|
||||||
|
setForm({ ...filters })
|
||||||
|
setQueryTrigger((v) => v + 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleReset = () => {
|
||||||
|
const next = createInitialFilters()
|
||||||
|
setFilters(next)
|
||||||
|
setForm(next)
|
||||||
|
setPageNumber(1)
|
||||||
|
setQueryTrigger((v) => v + 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleRefresh = () => {
|
||||||
|
setQueryTrigger((v) => v + 1)
|
||||||
|
}
|
||||||
|
|
||||||
const getTime = (time: number) => {
|
const getTime = (time: number) => {
|
||||||
return dayjs.duration(time, "seconds").format("HH:mm:ss")
|
return dayjs.duration(time, "seconds").format("HH:mm:ss")
|
||||||
}
|
}
|
||||||
@@ -775,12 +798,11 @@ export default function TaskTableContainer(props: {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack gap="sm" style={{ flex: 1, minHeight: 0 }}>
|
<Stack gap="sm" style={{ flex: 1, minHeight: 0 }}>
|
||||||
<Paper withBorder p="sm" radius="sm">
|
<SettingFilterPanel>
|
||||||
<Group justify="space-between" wrap="wrap" gap="sm">
|
<Group justify="space-between" wrap="wrap" gap="sm">
|
||||||
<Group gap="xs">
|
<Group gap="xs">
|
||||||
<Text fw={700}>任务列表</Text>
|
<Text fw={700}>筛选条件</Text>
|
||||||
<Button
|
<Button
|
||||||
size="xs"
|
|
||||||
variant="transparent"
|
variant="transparent"
|
||||||
rightSection={
|
rightSection={
|
||||||
searchExpanded ? (
|
searchExpanded ? (
|
||||||
@@ -793,43 +815,20 @@ export default function TaskTableContainer(props: {
|
|||||||
{searchExpanded ? "收起筛选" : "展开筛选"}
|
{searchExpanded ? "收起筛选" : "展开筛选"}
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
<Group gap="xs">
|
|
||||||
<Button
|
|
||||||
size="xs"
|
|
||||||
radius={"xs"}
|
|
||||||
variant="default"
|
|
||||||
leftSection={<IconRefresh size={16} />}
|
|
||||||
onClick={() => {
|
|
||||||
const next = createInitialFilters()
|
|
||||||
setFilters(next)
|
|
||||||
setForm(next)
|
|
||||||
setPageNumber(1)
|
|
||||||
}}>
|
|
||||||
重置
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
size="xs"
|
|
||||||
radius={"xs"}
|
|
||||||
leftSection={<IconSearch size={16} />}
|
|
||||||
onClick={() => {
|
|
||||||
setPageNumber(1)
|
|
||||||
setForm({ ...filters })
|
|
||||||
}}>
|
|
||||||
查询
|
|
||||||
</Button>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
<Collapse
|
<Collapse
|
||||||
in={searchExpanded}
|
in={searchExpanded}
|
||||||
transitionDuration={250}
|
transitionDuration={250}
|
||||||
transitionTimingFunction="ease"
|
transitionTimingFunction="ease"
|
||||||
animateOpacity>
|
animateOpacity>
|
||||||
<Stack gap="sm" mt="sm">
|
<Stack gap="md" mt="md">
|
||||||
<SimpleGrid cols={{ base: 1, sm: 2, md: 3, lg: 4 }} spacing="sm">
|
<SimpleGrid
|
||||||
|
cols={{ base: 1, sm: 2, md: 3, lg: 4 }}
|
||||||
|
spacing="md"
|
||||||
|
verticalSpacing="md">
|
||||||
<TextInput
|
<TextInput
|
||||||
size="xs"
|
|
||||||
radius="xs"
|
|
||||||
label="任务ID"
|
label="任务ID"
|
||||||
|
placeholder="请输入任务 ID"
|
||||||
value={filters.search_id}
|
value={filters.search_id}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
setFilters((s) => ({
|
setFilters((s) => ({
|
||||||
@@ -839,8 +838,6 @@ export default function TaskTableContainer(props: {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
size="xs"
|
|
||||||
radius="xs"
|
|
||||||
label="任务状态"
|
label="任务状态"
|
||||||
data={Object.entries(TaskStatusOpts).map(
|
data={Object.entries(TaskStatusOpts).map(
|
||||||
([value, label]) => ({
|
([value, label]) => ({
|
||||||
@@ -855,8 +852,6 @@ export default function TaskTableContainer(props: {
|
|||||||
allowDeselect={false}
|
allowDeselect={false}
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
size="xs"
|
|
||||||
radius="xs"
|
|
||||||
label="是否返工"
|
label="是否返工"
|
||||||
data={[
|
data={[
|
||||||
{ label: "全部", value: "" },
|
{ label: "全部", value: "" },
|
||||||
@@ -871,8 +866,6 @@ export default function TaskTableContainer(props: {
|
|||||||
/>
|
/>
|
||||||
<MultiSelect
|
<MultiSelect
|
||||||
label="当前负责人"
|
label="当前负责人"
|
||||||
size="xs"
|
|
||||||
radius="xs"
|
|
||||||
data={Array.from(userEnums.allEnum.entries()).map(
|
data={Array.from(userEnums.allEnum.entries()).map(
|
||||||
([x, y]) => ({ label: y, value: x.toString() })
|
([x, y]) => ({ label: y, value: x.toString() })
|
||||||
)}
|
)}
|
||||||
@@ -885,8 +878,6 @@ export default function TaskTableContainer(props: {
|
|||||||
/>
|
/>
|
||||||
<MultiSelect
|
<MultiSelect
|
||||||
label="标注员"
|
label="标注员"
|
||||||
size="xs"
|
|
||||||
radius="xs"
|
|
||||||
data={Array.from(userEnums.labelEnum.entries()).map(
|
data={Array.from(userEnums.labelEnum.entries()).map(
|
||||||
([x, y]) => ({ label: y, value: x.toString() })
|
([x, y]) => ({ label: y, value: x.toString() })
|
||||||
)}
|
)}
|
||||||
@@ -897,8 +888,6 @@ export default function TaskTableContainer(props: {
|
|||||||
/>
|
/>
|
||||||
<MultiSelect
|
<MultiSelect
|
||||||
label="审核员"
|
label="审核员"
|
||||||
size="xs"
|
|
||||||
radius="xs"
|
|
||||||
data={Array.from(userEnums.review1Enum.entries()).map(
|
data={Array.from(userEnums.review1Enum.entries()).map(
|
||||||
([x, y]) => ({ label: y, value: x.toString() })
|
([x, y]) => ({ label: y, value: x.toString() })
|
||||||
)}
|
)}
|
||||||
@@ -911,8 +900,6 @@ export default function TaskTableContainer(props: {
|
|||||||
/>
|
/>
|
||||||
<MultiSelect
|
<MultiSelect
|
||||||
label="复审员"
|
label="复审员"
|
||||||
size="xs"
|
|
||||||
radius="xs"
|
|
||||||
data={Array.from(userEnums.review2Enum.entries()).map(
|
data={Array.from(userEnums.review2Enum.entries()).map(
|
||||||
([x, y]) => ({ label: y, value: x.toString() })
|
([x, y]) => ({ label: y, value: x.toString() })
|
||||||
)}
|
)}
|
||||||
@@ -926,54 +913,69 @@ export default function TaskTableContainer(props: {
|
|||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
</Paper>
|
<SettingFilterActions>
|
||||||
<Paper
|
<Button
|
||||||
withBorder
|
variant="default"
|
||||||
p="md"
|
leftSection={<IconRefresh size={16} />}
|
||||||
radius="sm"
|
onClick={handleReset}>
|
||||||
|
重置
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
leftSection={<IconSearch size={16} />}
|
||||||
|
onClick={handleSearch}
|
||||||
|
loading={loading}>
|
||||||
|
查询
|
||||||
|
</Button>
|
||||||
|
</SettingFilterActions>
|
||||||
|
</SettingFilterPanel>
|
||||||
|
<SettingContentPanel
|
||||||
style={{
|
style={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
minHeight: 0,
|
minHeight: 0,
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
}}>
|
}}>
|
||||||
<Stack gap={12} align="stretch" style={{ flex: 1, minHeight: 0 }}>
|
<Stack gap="sm" align="stretch" style={{ flex: 1, minHeight: 0 }}>
|
||||||
<Flex justify={"space-between"} align="center" w="100%">
|
<SettingListHeader
|
||||||
<Flex gap={12}>
|
title="任务列表"
|
||||||
<Button
|
count={
|
||||||
size="xs"
|
selectedRecords.length
|
||||||
radius="xs"
|
? `${total} 条 / 已选 ${selectedRecords.length}`
|
||||||
variant="outline"
|
: `${total} 条`
|
||||||
disabled={!selectedRecords.length}
|
}
|
||||||
onClick={handleExport}>
|
actions={
|
||||||
下载选中项
|
<SettingHeaderActions>
|
||||||
</Button>
|
<Button
|
||||||
<Button
|
variant="default"
|
||||||
size="xs"
|
leftSection={<IconRefresh size={16} />}
|
||||||
radius="xs"
|
onClick={handleRefresh}
|
||||||
variant="outline"
|
loading={loading}>
|
||||||
disabled={!selectedRecords.length}
|
刷新
|
||||||
onClick={clickDispatchTask}>
|
</Button>
|
||||||
调度选中项
|
<Button
|
||||||
</Button>
|
variant="default"
|
||||||
<Button
|
disabled={!selectedRecords.length}
|
||||||
size="xs"
|
onClick={handleExport}>
|
||||||
radius="xs"
|
下载选中项
|
||||||
variant="outline"
|
</Button>
|
||||||
disabled={!selectedRecords.length}
|
<Button
|
||||||
onClick={clickReleaseTask}>
|
variant="default"
|
||||||
释放选中项
|
disabled={!selectedRecords.length}
|
||||||
</Button>
|
onClick={clickDispatchTask}>
|
||||||
</Flex>
|
调度选中项
|
||||||
<ActionIcon onClick={load} variant="transparent">
|
</Button>
|
||||||
<IconRefresh size={16} />
|
<Button
|
||||||
</ActionIcon>
|
variant="default"
|
||||||
</Flex>
|
disabled={!selectedRecords.length}
|
||||||
<DataTable<Task.DataProps>
|
onClick={clickReleaseTask}>
|
||||||
|
释放选中项
|
||||||
|
</Button>
|
||||||
|
</SettingHeaderActions>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<SettingDataTable<Task.DataProps>
|
||||||
width="100%"
|
width="100%"
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%", flex: 1 }}
|
||||||
withTableBorder
|
|
||||||
withRowBorders
|
|
||||||
pinFirstColumn
|
pinFirstColumn
|
||||||
pinLastColumn
|
pinLastColumn
|
||||||
scrollAreaProps={{ type: "auto" }}
|
scrollAreaProps={{ type: "auto" }}
|
||||||
@@ -991,11 +993,9 @@ export default function TaskTableContainer(props: {
|
|||||||
selectedRecords={selectedRecords}
|
selectedRecords={selectedRecords}
|
||||||
onSelectedRecordsChange={setSelectedRecords}
|
onSelectedRecordsChange={setSelectedRecords}
|
||||||
recordsPerPageOptions={[10, 15, 20]}
|
recordsPerPageOptions={[10, 15, 20]}
|
||||||
noRecordsText="暂无数据"
|
|
||||||
recordsPerPageLabel="当前页数"
|
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Paper>
|
</SettingContentPanel>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<WorkflowModal
|
<WorkflowModal
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ import {
|
|||||||
selectModeMap,
|
selectModeMap,
|
||||||
staticsColor,
|
staticsColor,
|
||||||
} from "@/components/label/utils/constants"
|
} from "@/components/label/utils/constants"
|
||||||
|
import { SettingDataTable } from "@/components/setting/PageSurface"
|
||||||
import { Badge, Button, Group, Modal, Paper, Stack, Text } from "@mantine/core"
|
import { Badge, Button, Group, Modal, Paper, Stack, Text } from "@mantine/core"
|
||||||
import { DataTable, DataTableColumn } from "mantine-datatable"
|
import { DataTableColumn } from "mantine-datatable"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
|
|
||||||
type DetailRow = ProjectDetail.SubAttributesDescribe
|
type DetailRow = ProjectDetail.SubAttributesDescribe
|
||||||
@@ -188,9 +189,7 @@ export default function LabelSchemeContainer(props: {
|
|||||||
}}>
|
}}>
|
||||||
<Stack gap="sm">
|
<Stack gap="sm">
|
||||||
<Text fw={700}>标注方案</Text>
|
<Text fw={700}>标注方案</Text>
|
||||||
<DataTable<ProjectDetail.LabelSchemaList>
|
<SettingDataTable<ProjectDetail.LabelSchemaList>
|
||||||
withTableBorder
|
|
||||||
withRowBorders
|
|
||||||
idAccessor="category_id"
|
idAccessor="category_id"
|
||||||
records={schemas}
|
records={schemas}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
@@ -209,9 +208,7 @@ export default function LabelSchemeContainer(props: {
|
|||||||
title="子属性描述"
|
title="子属性描述"
|
||||||
centered
|
centered
|
||||||
size="70%">
|
size="70%">
|
||||||
<DataTable<DetailRow>
|
<SettingDataTable<DetailRow>
|
||||||
withTableBorder
|
|
||||||
withRowBorders
|
|
||||||
records={detailRows}
|
records={detailRows}
|
||||||
columns={detailColumns}
|
columns={detailColumns}
|
||||||
noRecordsText="暂无数据"
|
noRecordsText="暂无数据"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { projectConfig } from "@/components/label/api/project"
|
import { projectConfig } from "@/components/label/api/project"
|
||||||
import { ProjectDetail } from "@/components/label/api/project/typing"
|
import { ProjectDetail } from "@/components/label/api/project/typing"
|
||||||
import { usePermissionStore } from "@/components/label/store/auth"
|
import { usePermissionStore } from "@/components/label/store/auth"
|
||||||
|
import { SettingDataTable } from "@/components/setting/PageSurface"
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Badge,
|
Badge,
|
||||||
@@ -18,7 +19,7 @@ import { modals } from "@mantine/modals"
|
|||||||
import { notifications } from "@mantine/notifications"
|
import { notifications } from "@mantine/notifications"
|
||||||
import { IconPlus, IconTrash } from "@tabler/icons-react"
|
import { IconPlus, IconTrash } from "@tabler/icons-react"
|
||||||
import dayjs from "dayjs"
|
import dayjs from "dayjs"
|
||||||
import { DataTable, DataTableColumn } from "mantine-datatable"
|
import { DataTableColumn } from "mantine-datatable"
|
||||||
import { useMemo, useState } from "react"
|
import { useMemo, useState } from "react"
|
||||||
|
|
||||||
type RulePayload = {
|
type RulePayload = {
|
||||||
@@ -221,9 +222,7 @@ export default function NoteRulesTable(props: {
|
|||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
<DataTable<RuleRow>
|
<SettingDataTable<RuleRow>
|
||||||
withTableBorder
|
|
||||||
withRowBorders
|
|
||||||
records={rows}
|
records={rows}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
noRecordsText="暂无规则"
|
noRecordsText="暂无规则"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { projectConfig } from "@/components/label/api/project"
|
import { projectConfig } from "@/components/label/api/project"
|
||||||
import { Project, ProjectDetail } from "@/components/label/api/project/typing"
|
import { Project, ProjectDetail } from "@/components/label/api/project/typing"
|
||||||
|
import { SettingDataTable } from "@/components/setting/PageSurface"
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
Badge,
|
Badge,
|
||||||
@@ -22,7 +23,7 @@ import {
|
|||||||
import { modals } from "@mantine/modals"
|
import { modals } from "@mantine/modals"
|
||||||
import { notifications } from "@mantine/notifications"
|
import { notifications } from "@mantine/notifications"
|
||||||
import { IconEdit, IconPlus, IconX } from "@tabler/icons-react"
|
import { IconEdit, IconPlus, IconX } from "@tabler/icons-react"
|
||||||
import { DataTable, DataTableColumn } from "mantine-datatable"
|
import { DataTableColumn } from "mantine-datatable"
|
||||||
import { ReactNode, useEffect, useMemo, useState } from "react"
|
import { ReactNode, useEffect, useMemo, useState } from "react"
|
||||||
import StageUserModal from "./StageUserModal"
|
import StageUserModal from "./StageUserModal"
|
||||||
import {
|
import {
|
||||||
@@ -1429,9 +1430,7 @@ export default function TaskStageTabsContainer(props: {
|
|||||||
批量操作
|
批量操作
|
||||||
</Button>
|
</Button>
|
||||||
</Group>
|
</Group>
|
||||||
<DataTable<StageUserRow>
|
<SettingDataTable<StageUserRow>
|
||||||
withTableBorder
|
|
||||||
withRowBorders
|
|
||||||
records={rows}
|
records={rows}
|
||||||
columns={userColumns(stage)}
|
columns={userColumns(stage)}
|
||||||
noRecordsText="暂无人员"
|
noRecordsText="暂无人员"
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { getTaskWorkFlow } from "@/components/label/api/task"
|
import { getTaskWorkFlow } from "@/components/label/api/task"
|
||||||
|
import { SettingDataTable } from "@/components/setting/PageSurface"
|
||||||
import { Button, Group, Modal, ScrollArea, Stack, Text } from "@mantine/core"
|
import { Button, Group, Modal, ScrollArea, Stack, Text } from "@mantine/core"
|
||||||
import { notifications } from "@mantine/notifications"
|
import { notifications } from "@mantine/notifications"
|
||||||
import { DataTable, DataTableColumn } from "mantine-datatable"
|
import { DataTableColumn } from "mantine-datatable"
|
||||||
import { useEffect, useMemo, useState } from "react"
|
import { useEffect, useMemo, useState } from "react"
|
||||||
import TaskStatusTag from "./TaskStatusTag"
|
import TaskStatusTag from "./TaskStatusTag"
|
||||||
|
|
||||||
@@ -139,15 +140,13 @@ export default function WorkflowModal(props: {
|
|||||||
size={720}>
|
size={720}>
|
||||||
<Stack gap="sm">
|
<Stack gap="sm">
|
||||||
<ScrollArea h={360} type="auto">
|
<ScrollArea h={360} type="auto">
|
||||||
<DataTable<WorkflowRow>
|
<SettingDataTable<WorkflowRow>
|
||||||
withTableBorder
|
|
||||||
withRowBorders
|
|
||||||
pinLastColumn
|
pinLastColumn
|
||||||
|
fetching={loading}
|
||||||
idAccessor="__rowId"
|
idAccessor="__rowId"
|
||||||
records={rows}
|
records={rows}
|
||||||
width={Math.max(columns.length * 140, 640)}
|
width={Math.max(columns.length * 140, 640)}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
noRecordsText={loading ? "加载中..." : "暂无数据"}
|
|
||||||
minHeight={220}
|
minHeight={220}
|
||||||
/>
|
/>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
|
|||||||
@@ -7,13 +7,16 @@ import {
|
|||||||
Breadcrumbs,
|
Breadcrumbs,
|
||||||
Flex,
|
Flex,
|
||||||
Group,
|
Group,
|
||||||
Paper,
|
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
UnstyledButton,
|
UnstyledButton,
|
||||||
} from "@mantine/core"
|
} from "@mantine/core"
|
||||||
import { useRouter, useSearchParams } from "next/navigation"
|
import { useRouter, useSearchParams } from "next/navigation"
|
||||||
import { useEffect, useMemo, useState } from "react"
|
import { useEffect, useMemo, useState } from "react"
|
||||||
|
import {
|
||||||
|
SettingFilterPanel,
|
||||||
|
SettingPage,
|
||||||
|
} from "@/components/setting/PageSurface"
|
||||||
import InfoSettingContainer from "./InfoSettingContainer"
|
import InfoSettingContainer from "./InfoSettingContainer"
|
||||||
import OwnTaskTableContainer from "./OwnTaskTableContainer"
|
import OwnTaskTableContainer from "./OwnTaskTableContainer"
|
||||||
import TaskBoardContainer from "./TaskBoardContainer"
|
import TaskBoardContainer from "./TaskBoardContainer"
|
||||||
@@ -193,15 +196,15 @@ export default function CollectionDetailPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack w="100%" h="calc(100vh - 56px)" p="md" gap="md">
|
<SettingPage>
|
||||||
<Paper withBorder p="md" radius="sm">
|
<SettingFilterPanel>
|
||||||
<Group justify="space-between" wrap="wrap" gap="sm">
|
<Group justify="space-between" wrap="wrap" gap="sm">
|
||||||
<Flex gap="sm" w="100%" justify="space-between">
|
<Flex gap="sm" w="100%" justify="space-between">
|
||||||
<Breadcrumbs separator=">">{breadcrumbsItems}</Breadcrumbs>
|
<Breadcrumbs separator=">">{breadcrumbsItems}</Breadcrumbs>
|
||||||
{DetailMenuItems()}
|
{DetailMenuItems()}
|
||||||
</Flex>
|
</Flex>
|
||||||
</Group>
|
</Group>
|
||||||
</Paper>
|
</SettingFilterPanel>
|
||||||
|
|
||||||
<Stack style={{ flex: 1, minHeight: 0 }} gap="md">
|
<Stack style={{ flex: 1, minHeight: 0 }} gap="md">
|
||||||
{selectKey === "own" ? (
|
{selectKey === "own" ? (
|
||||||
@@ -219,6 +222,6 @@ export default function CollectionDetailPage() {
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</SettingPage>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
128
components/setting/PageSurface.module.css
Normal file
128
components/setting/PageSurface.module.css
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
.page {
|
||||||
|
width: 100%;
|
||||||
|
height: calc(100vh - 56px);
|
||||||
|
padding: 16px;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel {
|
||||||
|
border-color: #e6ebf2;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: #ffffff;
|
||||||
|
box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.filterPanel {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filterPanel :global(.mantine-InputWrapper-label) {
|
||||||
|
color: #1f2329;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 22px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filterPanel :global(.mantine-Input-input),
|
||||||
|
.filterPanel :global(.mantine-Select-input),
|
||||||
|
.filterPanel :global(.mantine-NumberInput-input),
|
||||||
|
.filterPanel :global(.mantine-PillsInput-input),
|
||||||
|
.filterPanel :global(.mantine-Textarea-input) {
|
||||||
|
min-height: 36px;
|
||||||
|
border-color: #d0d5dd;
|
||||||
|
background: #ffffff;
|
||||||
|
color: #31373d;
|
||||||
|
font-size: 14px;
|
||||||
|
box-shadow: none;
|
||||||
|
transition:
|
||||||
|
border-color 0.15s ease,
|
||||||
|
box-shadow 0.15s ease,
|
||||||
|
background-color 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filterPanel :global(.mantine-Textarea-input) {
|
||||||
|
min-height: 96px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filterPanel :global(.mantine-Input-input::placeholder),
|
||||||
|
.filterPanel :global(.mantine-Select-input::placeholder),
|
||||||
|
.filterPanel :global(.mantine-NumberInput-input::placeholder),
|
||||||
|
.filterPanel :global(.mantine-PillsInput-input::placeholder),
|
||||||
|
.filterPanel :global(.mantine-Textarea-input::placeholder) {
|
||||||
|
color: #98a2b3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filterPanel :global(.mantine-Input-input:focus),
|
||||||
|
.filterPanel :global(.mantine-Select-input:focus),
|
||||||
|
.filterPanel :global(.mantine-NumberInput-input:focus),
|
||||||
|
.filterPanel :global(.mantine-PillsInput-input:focus-within),
|
||||||
|
.filterPanel :global(.mantine-Textarea-input:focus) {
|
||||||
|
border-color: #69c0ff;
|
||||||
|
box-shadow: 0 0 0 3px rgba(105, 192, 255, 0.14);
|
||||||
|
}
|
||||||
|
|
||||||
|
.filterPanel :global(.mantine-Button-root[data-variant="transparent"]) {
|
||||||
|
color: #168de8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filterPanel :global(.mantine-Button-root:not([data-variant="transparent"])),
|
||||||
|
.headerActions :global(.mantine-Button-root) {
|
||||||
|
min-height: 36px;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding-inline: 14px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filterPanel :global(.mantine-ActionIcon-root),
|
||||||
|
.headerActions :global(.mantine-ActionIcon-root) {
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filterPanel :global(.mantine-Pill-root) {
|
||||||
|
background: #eef7ff;
|
||||||
|
color: #168de8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentPanel {
|
||||||
|
border-color: #e6ebf2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filterActions,
|
||||||
|
.headerActions {
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.listHeader {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sectionHeader {
|
||||||
|
padding-bottom: 12px;
|
||||||
|
border-bottom: 1px solid #eef2f6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sectionEyebrow {
|
||||||
|
color: #168de8;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 18px;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sectionTitle {
|
||||||
|
color: #1f2329;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sectionDescription {
|
||||||
|
color: #667085;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
312
components/setting/PageSurface.tsx
Normal file
312
components/setting/PageSurface.tsx
Normal file
@@ -0,0 +1,312 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import {
|
||||||
|
Badge,
|
||||||
|
Group,
|
||||||
|
Paper,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
type GroupProps,
|
||||||
|
type PaperProps,
|
||||||
|
type StackProps,
|
||||||
|
} from "@mantine/core"
|
||||||
|
import type { PropsWithChildren, ReactNode } from "react"
|
||||||
|
import {
|
||||||
|
DataTable,
|
||||||
|
type DataTableDefaultColumnProps,
|
||||||
|
type DataTableProps,
|
||||||
|
} from "mantine-datatable"
|
||||||
|
import classes from "./PageSurface.module.css"
|
||||||
|
|
||||||
|
function mergeClassName(...classNames: Array<string | undefined>) {
|
||||||
|
return classNames.filter(Boolean).join(" ")
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SettingPage({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: PropsWithChildren<StackProps>) {
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
w="100%"
|
||||||
|
h="calc(100vh - 56px)"
|
||||||
|
p="md"
|
||||||
|
gap="md"
|
||||||
|
className={mergeClassName(classes.page, className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SettingPanel({
|
||||||
|
className,
|
||||||
|
withBorder = true,
|
||||||
|
radius = "lg",
|
||||||
|
p = "md",
|
||||||
|
shadow = "xs",
|
||||||
|
...props
|
||||||
|
}: PropsWithChildren<PaperProps>) {
|
||||||
|
return (
|
||||||
|
<Paper
|
||||||
|
withBorder={withBorder}
|
||||||
|
radius={radius}
|
||||||
|
p={p}
|
||||||
|
shadow={shadow}
|
||||||
|
className={mergeClassName(classes.panel, className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SettingFilterPanel({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: PropsWithChildren<PaperProps>) {
|
||||||
|
return (
|
||||||
|
<SettingPanel
|
||||||
|
className={mergeClassName(classes.filterPanel, className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SettingContentPanel({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: PropsWithChildren<PaperProps>) {
|
||||||
|
return (
|
||||||
|
<SettingPanel
|
||||||
|
className={mergeClassName(classes.contentPanel, className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
type SettingSectionHeaderProps = GroupProps & {
|
||||||
|
eyebrow?: string
|
||||||
|
title: ReactNode
|
||||||
|
description?: ReactNode
|
||||||
|
actions?: ReactNode
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SettingSectionHeader({
|
||||||
|
eyebrow,
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
actions,
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: SettingSectionHeaderProps) {
|
||||||
|
return (
|
||||||
|
<Group
|
||||||
|
justify="space-between"
|
||||||
|
align="flex-start"
|
||||||
|
gap="sm"
|
||||||
|
wrap="wrap"
|
||||||
|
className={mergeClassName(classes.sectionHeader, className)}
|
||||||
|
{...props}>
|
||||||
|
<Stack gap={2}>
|
||||||
|
{eyebrow ? (
|
||||||
|
<Text className={classes.sectionEyebrow}>{eyebrow}</Text>
|
||||||
|
) : null}
|
||||||
|
<Text className={classes.sectionTitle}>{title}</Text>
|
||||||
|
{description ? (
|
||||||
|
<Text className={classes.sectionDescription}>{description}</Text>
|
||||||
|
) : null}
|
||||||
|
</Stack>
|
||||||
|
{actions}
|
||||||
|
</Group>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
type SettingListHeaderProps = {
|
||||||
|
title: ReactNode
|
||||||
|
count?: ReactNode
|
||||||
|
actions?: ReactNode
|
||||||
|
className?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SettingListHeader({
|
||||||
|
title,
|
||||||
|
count,
|
||||||
|
actions,
|
||||||
|
className,
|
||||||
|
}: SettingListHeaderProps) {
|
||||||
|
return (
|
||||||
|
<Group
|
||||||
|
justify="space-between"
|
||||||
|
align="center"
|
||||||
|
wrap="wrap"
|
||||||
|
gap="sm"
|
||||||
|
className={mergeClassName(classes.listHeader, className)}>
|
||||||
|
<Group gap="xs">
|
||||||
|
<Text fw={700}>{title}</Text>
|
||||||
|
{count !== undefined ? (
|
||||||
|
<Badge variant="light" color="gray">
|
||||||
|
{count}
|
||||||
|
</Badge>
|
||||||
|
) : null}
|
||||||
|
</Group>
|
||||||
|
{actions}
|
||||||
|
</Group>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SettingHeaderActions({
|
||||||
|
className,
|
||||||
|
gap = "sm",
|
||||||
|
...props
|
||||||
|
}: PropsWithChildren<GroupProps>) {
|
||||||
|
return (
|
||||||
|
<Group
|
||||||
|
gap={gap}
|
||||||
|
wrap="wrap"
|
||||||
|
className={mergeClassName(classes.headerActions, className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SettingFilterActions({
|
||||||
|
className,
|
||||||
|
gap = "sm",
|
||||||
|
justify = "flex-end",
|
||||||
|
mt = "md",
|
||||||
|
...props
|
||||||
|
}: PropsWithChildren<GroupProps>) {
|
||||||
|
return (
|
||||||
|
<Group
|
||||||
|
justify={justify}
|
||||||
|
gap={gap}
|
||||||
|
wrap="wrap"
|
||||||
|
mt={mt}
|
||||||
|
className={mergeClassName(classes.filterActions, className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const settingDataTableStyles = {
|
||||||
|
header: {
|
||||||
|
backgroundColor: "#F8F9FB",
|
||||||
|
borderBottom: "1px solid #EEF2F6",
|
||||||
|
color: "#56606A",
|
||||||
|
fontSize: "14px",
|
||||||
|
},
|
||||||
|
root: {
|
||||||
|
height: "100%",
|
||||||
|
fontSize: "14px",
|
||||||
|
color: "#31373D",
|
||||||
|
borderBottom: "1px solid #E8EDF3",
|
||||||
|
borderRadius: 10,
|
||||||
|
overflow: "hidden",
|
||||||
|
backgroundColor: "#FFFFFF",
|
||||||
|
},
|
||||||
|
pagination: {
|
||||||
|
padding: "14px 16px 18px",
|
||||||
|
},
|
||||||
|
} as const
|
||||||
|
|
||||||
|
const settingDataTableDefaultColumnProps: DataTableDefaultColumnProps<
|
||||||
|
Record<string, unknown>
|
||||||
|
> = {
|
||||||
|
titleStyle: {
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
fontWeight: 600,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SettingDataTable<T = Record<string, unknown>>(
|
||||||
|
props: DataTableProps<T>
|
||||||
|
) {
|
||||||
|
const {
|
||||||
|
styles,
|
||||||
|
defaultColumnProps,
|
||||||
|
withTableBorder,
|
||||||
|
withRowBorders,
|
||||||
|
striped,
|
||||||
|
highlightOnHover,
|
||||||
|
loaderBackgroundBlur,
|
||||||
|
loadingText,
|
||||||
|
noRecordsText,
|
||||||
|
minHeight,
|
||||||
|
page,
|
||||||
|
onPageChange,
|
||||||
|
totalRecords,
|
||||||
|
recordsPerPage,
|
||||||
|
recordsPerPageLabel,
|
||||||
|
paginationText,
|
||||||
|
...rest
|
||||||
|
} = props
|
||||||
|
|
||||||
|
const paginationProps =
|
||||||
|
page !== undefined &&
|
||||||
|
onPageChange !== undefined &&
|
||||||
|
recordsPerPage !== undefined
|
||||||
|
? {
|
||||||
|
page,
|
||||||
|
onPageChange,
|
||||||
|
totalRecords,
|
||||||
|
recordsPerPage,
|
||||||
|
loadingText: loadingText ?? "正在加载数据...",
|
||||||
|
recordsPerPageLabel: recordsPerPageLabel ?? "每页条数",
|
||||||
|
paginationText:
|
||||||
|
paginationText ??
|
||||||
|
(({
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
totalRecords,
|
||||||
|
}: {
|
||||||
|
from: number
|
||||||
|
to: number
|
||||||
|
totalRecords: number
|
||||||
|
}) => `${from}-${to} / ${totalRecords}`),
|
||||||
|
}
|
||||||
|
: {}
|
||||||
|
|
||||||
|
const tableProps = {
|
||||||
|
withTableBorder: withTableBorder ?? true,
|
||||||
|
withRowBorders: withRowBorders ?? true,
|
||||||
|
striped: striped ?? true,
|
||||||
|
highlightOnHover: highlightOnHover ?? true,
|
||||||
|
defaultColumnProps:
|
||||||
|
defaultColumnProps ??
|
||||||
|
(settingDataTableDefaultColumnProps as DataTableDefaultColumnProps<T>),
|
||||||
|
loaderBackgroundBlur: loaderBackgroundBlur ?? 1,
|
||||||
|
noRecordsText: noRecordsText ?? "暂无数据",
|
||||||
|
minHeight: minHeight ?? 360,
|
||||||
|
styles: styles
|
||||||
|
? { ...settingDataTableStyles, ...styles }
|
||||||
|
: settingDataTableStyles,
|
||||||
|
...paginationProps,
|
||||||
|
...rest,
|
||||||
|
} as DataTableProps<T>
|
||||||
|
|
||||||
|
return <DataTable {...tableProps} />
|
||||||
|
}
|
||||||
|
|
||||||
|
export const settingTabsStyles = {
|
||||||
|
list: {
|
||||||
|
padding: 4,
|
||||||
|
backgroundColor: "#F8F9FB",
|
||||||
|
border: "1px solid #EEF2F6",
|
||||||
|
borderRadius: 10,
|
||||||
|
gap: 8,
|
||||||
|
},
|
||||||
|
tab: {
|
||||||
|
minHeight: 36,
|
||||||
|
borderRadius: 8,
|
||||||
|
color: "#56606A",
|
||||||
|
fontWeight: 600,
|
||||||
|
"&[data-active]": {
|
||||||
|
backgroundColor: "#FFFFFF",
|
||||||
|
color: "#1F2329",
|
||||||
|
boxShadow: "0 6px 18px rgba(15, 23, 42, 0.08)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
panel: {
|
||||||
|
flex: 1,
|
||||||
|
minHeight: 0,
|
||||||
|
paddingTop: 16,
|
||||||
|
},
|
||||||
|
} as const
|
||||||
Reference in New Issue
Block a user