123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- import type { CreateCrudOptionsProps, CreateCrudOptionsRet } from '@fast-crud/fast-crud';
- import { dict } from '@fast-crud/fast-crud';
- import { updateAttendance, getStudentList } from './api';
- function curd({ context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- return {
- crudOptions: {
- container: {
- is: 'fs-layout-card'
- },
- search: {
- show: false
- },
- pagination: {
- show: false
- },
- request: {
- pageRequest: async ({ page, query }) => {
- const queryBody = {
- id: context?.route.query.scheduleId ?? 9999999
- };
- const { data } = await getStudentList(Object.assign(queryBody, query));
- return { records: data, total: 0, currentPage: page.offset, pageSize: page.limit };
- },
- addRequest: () => {
- return Promise.resolve();
- },
- editRequest: ({ form }) => {
- form.scheduleId = form.id;
- updateAttendance(form);
- }
- },
- toolbar: {
- show: true
- },
- actionbar: {
- show: false
- },
- rowHandle: {
- buttons: {
- remove: {
- show: false
- }
- }
- },
- columns: {
- startTime: {
- title: '上课时间',
- type: 'easDateTime',
- sortable: true,
- column: {
- width: 160
- }
- },
- endTime: {
- title: '下课时间',
- type: 'easDateTime',
- sortable: true,
- column: {
- width: 160
- }
- },
- id: {
- title: '排课ID',
- type: 'text',
- column: {
- show: false
- }
- },
- checkinDate: {
- title: '签到日期',
- type: 'easDateTime',
- sortable: true,
- column: {
- show: false
- }
- },
- morning: {
- title: '上午出勤状态',
- type: 'dict-select',
- dict: dict({
- data: [
- // a 表示正常出勤, b 表示迟到、早退, c 表示旷课, d 表示请假, e表示无效
- { value: 'a', label: '正常' },
- { value: 'b', label: '迟到/早退' },
- { value: 'c', label: '旷课' },
- { value: 'd', label: '请假' },
- { value: 'e', label: '无效' }
- ]
- }),
- column: {
- resizable: true
- }
- },
- afternoon: {
- title: '下午出勤状态',
- type: 'dict-select',
- dict: dict({
- data: [
- // a 表示正常出勤, b 表示迟到、早退, c 表示旷课, d 表示请假, e表示无效
- { value: 'a', label: '正常' },
- { value: 'b', label: '迟到/早退' },
- { value: 'c', label: '旷课' },
- { value: 'd', label: '请假' },
- { value: 'e', label: '无效' }
- ]
- }),
- column: {
- resizable: true
- }
- },
- studentName: {
- title: '学生姓名',
- type: 'text',
- sortable: true
- },
- type: {
- title: '类别',
- type: 'text',
- sortable: true,
- form: {
- show: false
- }
- },
- studentNumber: {
- title: '学生学号',
- type: 'text',
- sortable: true,
- column: {
- width: 280
- }
- },
- teacherName: {
- title: '授课老师',
- type: 'text',
- sortable: true,
- width: 60,
- search: {
- show: false
- },
- form: {
- show: false
- }
- },
- categoryName: {
- title: '类别',
- type: 'text',
- sortable: true,
- width: 100,
- form: {
- show: false
- }
- },
- subjectsName: {
- title: '系列',
- type: 'text',
- sortable: true,
- width: 100,
- form: {
- show: false
- }
- },
- roomName: {
- title: '教室',
- type: 'text',
- form: {
- show: false
- }
- }
- }
- }
- };
- }
- export default curd;
|