import type { CreateCrudOptionsRet } from '@fast-crud/fast-crud'; import { dict } from '@fast-crud/fast-crud'; import { queryClassStudent, submitGroupStudentUpdate, submitGroupStudentDelete } from './api'; function curd(): CreateCrudOptionsRet { return { crudOptions: { container: { is: 'fs-layout-card' }, pagination: { show: false }, request: { pageRequest: async ({ page, query }) => { query.groupId = 1; const { data } = await queryClassStudent(query); return { records: data, total: 0, currentPage: page.offset, pageSize: page.limit }; }, addRequest: () => {}, editRequest: ({ form }) => { return submitGroupStudentUpdate(form); }, delRequest: ({ row }) => { return submitGroupStudentDelete(Number(row.id)); } }, toolbar: { show: true }, actionbar: { show: false }, columns: { id: { title: 'ID', type: 'number', search: { show: false }, show: false }, studentId: { title: '学生ID', type: 'number', search: { show: true }, column: { editable: { disabled: true } } }, studentName: { title: '学生姓名', type: 'text', search: { show: true }, column: { editable: { disabled: false } } }, avatar: { title: '头像', type: 'image' }, studentNumber: { title: '学生学号', type: 'text', search: { show: true } }, managerName: { title: '班主任姓名', type: 'text' }, phone: { title: '手机号码', type: 'text', search: { show: true } }, email: { title: '电子邮箱', type: 'text', search: { show: true } }, gender: { title: '性别', type: 'dict-select', dict: dict({ data: [ { value: 'M', label: '男' }, { value: 'F', label: '女' } ] }), column: { resizable: true, width: 50 }, search: { show: true } }, enrollmentDate: { title: '入学日期', type: 'easDate' }, type: { title: '类别', type: 'dict-select', dict: dict({ data: [ { value: '正式', label: '正式' }, { value: '旁听', label: '旁听' }, { value: '留级', label: '留级' }, { value: '休学', label: '休学' }, { value: '暂停', label: '暂停' }, { value: '其他', label: '其他' } ] }), column: { resizable: true, width: 60 }, search: { show: true } }, admissionsName: { title: '招生负责人', type: 'text' } } } }; } export default curd;