|
@@ -0,0 +1,136 @@
|
|
|
+import type { CreateCrudOptionsProps, CreateCrudOptionsRet } from '@fast-crud/fast-crud';
|
|
|
+import { dict } from '@fast-crud/fast-crud';
|
|
|
+import { addAttendance, updateAttendance, getStudentList } from './api';
|
|
|
+
|
|
|
+function curd({ context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
|
|
+ return {
|
|
|
+ crudOptions: {
|
|
|
+ search: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ pagination: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ request: {
|
|
|
+ pageRequest: async ({ page }) => {
|
|
|
+ const { data } = await getStudentList(context?.route.query.scheduleId ?? 0);
|
|
|
+ return { records: data, total: 0, currentPage: page.offset, pageSize: page.limit };
|
|
|
+ },
|
|
|
+ addRequest: ({ form }) => {
|
|
|
+ return addAttendance(form);
|
|
|
+ },
|
|
|
+ editRequest: ({ form }) => {
|
|
|
+ updateAttendance(form);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toolbar: {
|
|
|
+ show: true
|
|
|
+ },
|
|
|
+ actionbar: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ rowHandle: {
|
|
|
+ buttons: {
|
|
|
+ remove: {
|
|
|
+ show: false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ columns: {
|
|
|
+ scheduleId: {
|
|
|
+ title: '排课ID',
|
|
|
+ type: 'text',
|
|
|
+ column: {
|
|
|
+ show: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ checkinDate: {
|
|
|
+ title: '签到日期',
|
|
|
+ type: 'easDateTime',
|
|
|
+ sortable: true,
|
|
|
+ column: {
|
|
|
+ width: 180
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 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,
|
|
|
+ width: 180
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 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,
|
|
|
+ width: 180
|
|
|
+ }
|
|
|
+ },
|
|
|
+ studentName: {
|
|
|
+ title: '学生姓名',
|
|
|
+ type: 'text',
|
|
|
+ sortable: true,
|
|
|
+ width: 100
|
|
|
+ },
|
|
|
+ studentNumber: {
|
|
|
+ title: '学生学号',
|
|
|
+ type: 'text',
|
|
|
+ sortable: true,
|
|
|
+ column: {
|
|
|
+ width: 280
|
|
|
+ }
|
|
|
+ },
|
|
|
+ createUid: {
|
|
|
+ title: '录入用户',
|
|
|
+ type: 'text',
|
|
|
+ sortable: true,
|
|
|
+ width: 60,
|
|
|
+ form: {
|
|
|
+ show: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ createTime: {
|
|
|
+ title: '创建时间',
|
|
|
+ type: 'easDateTime',
|
|
|
+ sortable: true,
|
|
|
+ width: 100,
|
|
|
+ form: {
|
|
|
+ show: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ modifyTime: {
|
|
|
+ title: '修改时间',
|
|
|
+ type: 'easDateTime',
|
|
|
+ sortable: true,
|
|
|
+ width: 100,
|
|
|
+ form: {
|
|
|
+ show: false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+}
|
|
|
+export default curd;
|