'use client' import React, {CSSProperties} from "react"; import {Draggable, Droppable} from "react-beautiful-dnd"; import {ConfigProvider, Tooltip} from "antd"; import {DataType} from "@/lib/definitions"; import './index.modules.css' import dayjs from "dayjs"; import {getTaskState, taskPriorityList} from "@/lib/task/project/data"; import 'react-virtualized/styles.css'; import RightOption from "@/ui/task/RightOption"; import {CopyOutlined} from "@ant-design/icons"; interface DroppableTableProps { tableCode: string, taskList: DataType[], refreshDate?: () => void, } export const DroppableTable = React.memo((props: DroppableTableProps) => { const stateName = React.useMemo(() => { switch (props.tableCode) { case '0': return '不紧急不重要'; case '1': return '紧急不重要'; case '2': return '不紧急重要'; case '3': return '紧急重要'; default: return ''; } }, [props.tableCode]); const getItemStyle = React.useCallback((isDragging: boolean, draggableStyle: any): CSSProperties => ({ userSelect: "none", background: isDragging ? "lightgreen" : "white", position: 'relative', zIndex: isDragging ? 2147483647 : 'auto', ...draggableStyle, borderBottom: '1px solid #f0f0f0', boxSizing: 'border-box', verticalAlign: 'middle', textAlign: 'center', borderColor:taskPriorityList.find((item) => item.code === props.tableCode)?.color }), []); const getListStyle = React.useCallback((isDraggingOver: boolean) => ({ background: isDraggingOver ? "lightblue" : "white", height: 'calc((100vh - 42px)/2)', width: '50vw' }), []); const headerStyle = React.useMemo(() => ({ backgroundColor: taskPriorityList.find((item) => item.code === props.tableCode)?.color, height: '55px', // borderBottom: '1px solid #f0f0f0', fontWeight: 'bold' }), [props.tableCode]); return ( {(provided, snapshot) => (
{/* 表头 */}
{stateName}
任务描述
任务状态
期望时间
{/* 虚拟列表主体 */}
{props.taskList.map((record, index) => { return {(provided, snapshot) => (
{record.name}
{record.description}
{getTaskState(record.state) ? getTaskState(record.state).name : ""}
起: {record.expectedStartTime ? dayjs(record.expectedStartTime).format("YYYY-MM-DD HH:mm") : ""}
止: {record.expectedEndTime ? dayjs(record.expectedEndTime).format("YYYY-MM-DD HH:mm") : ""}
}> )} })}
{provided.placeholder} )}
) });