123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- import type { CreateCrudOptionsRet } from '@fast-crud/fast-crud';
- import { dict } from '@fast-crud/fast-crud';
- import { queryAttendance, queryClassAll, queryClassRoomList } from './api';
- function curd(): CreateCrudOptionsRet {
- return {
- crudOptions: {
- request: {
- pageRequest: async ({ page, query }) => {
- const { total, data } = await queryAttendance(page.offset + 1, page.limit, query);
- return { records: data, total, currentPage: page.offset, pageSize: page.limit };
- }
- },
- toolbar: {
- show: true
- },
- actionbar: {
- show: false
- },
- rowHandle: {
- show: false,
- buttons: {
- remove: {
- show: false
- },
- add: {
- show: false
- },
- edit: {
- show: false
- },
- view: {
- show: false
- }
- }
- },
- columns: {
- id: {
- title: '排课ID',
- type: 'text',
- search: {
- show: true
- },
- column: {
- show: true
- }
- },
- checkinDate: {
- title: '签到日期',
- type: 'text',
- search: {
- show: false
- },
- 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: '无效' }
- ]
- }),
- search: {
- show: false
- },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- 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: '无效' }
- ]
- }),
- search: {
- show: false
- },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- month: {
- title: '月份',
- type: 'text',
- search: {
- show: true
- },
- column: {
- resizable: true,
- width: 20,
- align: 'center',
- fixed: 'left'
- }
- },
- studentId: {
- title: '学生ID',
- type: 'text',
- search: {
- show: true
- },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- type: {
- title: '类型',
- type: 'text',
- search: {
- show: false
- },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- className: {
- title: '班级',
- search: {
- show: true
- },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- },
- type: 'dict-select',
- dict: dict({
- async getData() {
- const result = await queryClassAll();
- return result.data?.map(r => {
- return {
- label: r.name,
- value: r.id
- };
- }) as any[];
- }
- })
- },
- startTime: {
- title: '开始时间',
- type: 'easDateTime',
- search: {
- show: true
- },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- endTime: {
- title: '结束时间',
- type: 'easDateTime',
- search: {
- show: true
- },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- categoryName: {
- title: '类别名称',
- type: 'text',
- search: {
- show: false
- },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- subjectsName: {
- title: '科目名称',
- type: 'text',
- search: {
- show: false
- },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- studentName: {
- title: '姓名',
- type: 'text',
- search: {
- show: true
- },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- teacherName: {
- title: '教师姓名',
- type: 'text',
- search: {
- show: false
- },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- roomName: {
- search: {
- show: true
- },
- title: '教室',
- type: 'dict-select',
- dict: dict({
- async getData() {
- const result = await queryClassRoomList(1, 100, {});
- return result.data?.map(r => {
- return {
- label: r.name,
- value: r.id
- };
- }) as any[];
- }
- })
- }
- }
- }
- };
- }
- export default curd;
|