import { MyButtons, MyColumns, MyPageContainer, MyProTableProps, } from '@/common'; import { Selects } from '@/components/Select'; import { Apis } from '@/gen/Apis'; import { AttendanceSchedulesStatusEnum } from '@/gen/Enums'; import { ProTable } from '@ant-design/pro-components'; import { useNavigate } from '@umijs/max'; import { Space, Tooltip } from 'antd'; import Update from './modals/Update'; export default function Index({ title = '排班管理' }) { const navigate = useNavigate(); return ( MyProTableProps.request( { ...params, status: AttendanceSchedulesStatusEnum.Active.value }, sort, Apis.Attendance.AttendanceSchedules.List, ) } headerTitle="排班信息" toolBarRender={() => [ { navigate('/attendance/attendance_schedules/pages/create'); }} title="批量排班 / 批量调整" />, ]} columns={[ // MyColumns.ID({ // search: false, // }), Selects?.AssetProjects({ title: '选择项目', key: 'asset_projects_id', hidden: true, }), { title: '排班日期', dataIndex: 'schedule_date', valueType: 'date', }, { title: '关联项目', dataIndex: ['asset_project', 'name'], // search: { // transform: (value) => { // return { project_name: value }; // }, // }, search: false, }, { title: '员工', dataIndex: ['company_employee', 'name'], search: { transform: (value) => { return { employee_name: value }; }, }, }, { title: '班次', dataIndex: ['attendance_shift', 'name'], search: false, }, { title: '时段要求', dataIndex: 'shift_periods', search: false, render: (_, item: any) => { const periods = item?.shift_periods || []; const periodTexts = periods.map((res: any) => { return `时段${ res?.period_order }: ${res?.work_start_time?.substring( 0, 5, )}-${res?.work_end_time?.substring(0, 5)}`; }); const allPeriodsText = periodTexts.join(' '); return ( (
{text}
)) || '' } >
{allPeriodsText}
); }, }, // MyColumns.EnumTag({ // title: '状态', // dataIndex: 'status', // valueEnum: AttendanceSchedulesStatusEnum, // }), { title: '排班人', dataIndex: ['created_employee', 'name'], search: false, }, // MyColumns.CreatedAt(), MyColumns.Option({ render: (_, item: any, index, action) => ( Apis.Attendance.AttendanceSchedules.Cancel({ id: item.id, }).then(() => action?.reload()) } /> ), }), ]} />
); }