import { SuperTable } from '@/components';
import NceeCourseCombController from '@/services/apis/NceeCourseCombController';
import { ActionType, PageContainer, ProColumns } from '@ant-design/pro-components';
import { useRef } from 'react';

/** 高中选科组合 */
const NceeCourseCombList: React.FC = () => {
    const actionRef = useRef<ActionType>();

    const columns: ProColumns<API.NceeCourseCombOutput>[] = [
        {
            title: 'ID',
            dataIndex: 'id',
            width: 80,
            align: 'center',
        },
        {
            title: '名称',
            dataIndex: 'name',
            width: 160,
            align: 'center',
        },
        {
            title: '简称',
            dataIndex: 'shortName',
            width: 96,
            align: 'center',
        },
        {
            title: '首选学科',
            dataIndex: ['firstCourse', 'name'],
            width: 96,
            align: 'center',
        },
        {
            title: '再选学科1',
            dataIndex: ['secondCourse', 'name'],
            width: 96,
            align: 'center',
        },
        {
            title: '再选学科2',
            dataIndex: ['thirdCourse', 'name'],
            width: 96,
            align: 'center',
        },
        {},
    ];

    return (
        <PageContainer title={false} childrenContentStyle={{ paddingTop: 0 }}>
            <SuperTable<API.NceeCourseCombOutput>
                headerTitle="高中选科组合列表"
                actionRef={actionRef}
                columns={columns}
                pagination={false}
                search={false}
                request={async () => {
                    const data = await NceeCourseCombController.getAllList();
                    return { data, success: true };
                }}
            />
        </PageContainer>
    );
};

export default NceeCourseCombList;
