123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- import { BasicColumn, FormSchema } from '/@/components/Table';
- import { requestMagicApi } from '/@/api/magicApi';
- import { Switch } from 'ant-design-vue';
- import { h } from 'vue';
- import { useMessage } from '/@/hooks/web/useMessage';
- import { postStudentReportRecordSign } from '/@/services/apis/StudentReportRecordController';
- import { getDataOption } from '/@/api/system/dic';
- export const stateOptions = [
- { label: '草稿', value: 0 },
- { label: '进行中', value: 1 },
- { label: '已结束', value: 2 },
- ];
- export const tableColumns: BasicColumn[] = [
- {
- title: '年级',
- dataIndex: 'gradeName',
- align: 'left',
- width: 100,
- },
- {
- title: '班级',
- dataIndex: 'className',
- align: 'left',
- width: 120,
- },
- {
- title: '班主任',
- dataIndex: 'teacherName',
- align: 'left',
- width: 100,
- },
- {
- title: '学生姓名',
- dataIndex: 'name',
- align: 'left',
- width: 100,
- },
- {
- title: '性别',
- dataIndex: 'gender',
- align: 'left',
- width: 80,
- },
- {
- title: '身份证号',
- dataIndex: 'credentialNumber',
- align: 'left',
- width: 120,
- },
- {
- title: '手机号',
- dataIndex: 'mobile',
- align: 'left',
- width: 120,
- },
- {
- title: '家长联系电话',
- dataIndex: 'parentMobile',
- align: 'left',
- width: 120,
- },
- {
- title: '学生来源',
- dataIndex: 'studentTypeCn',
- align: 'left',
- },
- {
- title: '就读方式',
- dataIndex: 'stduyStatusCn',
- align: 'left',
- width: 80,
- },
- {
- title: '学籍状态',
- dataIndex: 'archivesStatusCn',
- align: 'left',
- width: 80,
- },
- {
- title: '报到状态',
- dataIndex: 'isReport',
- slots: 'isReport',
- customRender: ({ record }) => {
- if (!Reflect.has(record, 'pendingStatus')) {
- record.pendingStatus = false;
- }
- return h(Switch, {
- checked: record.isReport === 1,
- // checkedChildren: '报到',
- // unCheckedChildren: '未报到',
- loading: record.pendingStatus,
- onChange(checked: boolean) {
- record.pendingStatus = true;
- const newStatus = checked ? 1 : 0;
- const { createMessage } = useMessage();
- postStudentReportRecordSign({ id: record.id })
- .then(() => {
- record.isReport = newStatus;
- record.reportTime = checked ? new Date() : null;
- createMessage.success('已成功修改状态');
- })
- .catch(() => {
- createMessage.error('修改状态失败');
- })
- .finally(() => {
- record.pendingStatus = false;
- });
- },
- });
- },
- width: 80,
- },
- {
- title: '报到日期',
- dataIndex: 'reportTime',
- align: 'left',
- width: 170,
- },
- ];
- export const searchFormSchema: FormSchema[] = [
- {
- field: 'className',
- label: '班级',
- component: 'Input',
- colProps: { span: 8 },
- },
- {
- field: 'name',
- label: '学生姓名',
- component: 'Input',
- colProps: { span: 8 },
- },
- {
- field: 'credentialNumber',
- label: '身份证号',
- component: 'Input',
- colProps: { span: 8 },
- },
- {
- field: 'studentType',
- label: '学生来源',
- component: 'ApiSelect',
- colProps: { span: 8 },
- componentProps: {
- getPopupContainer: () => document.body,
- api: getDataOption,
- params: { code: 'student_type' },
- },
- },
- {
- field: 'stduyStatus',
- label: '就读方式',
- component: 'ApiSelect',
- colProps: { span: 8 },
- componentProps: {
- api: getDataOption,
- params: { code: 'stduy_status' },
- getPopupContainer: () => document.body,
- },
- },
- {
- field: 'archivesStatus',
- label: '学籍状态',
- component: 'ApiSelect',
- colProps: { span: 8 },
- componentProps: {
- api: getDataOption,
- params: { code: 'archives_status' },
- getPopupContainer: () => document.body,
- },
- },
- {
- field: 'isReport',
- label: '报到状态',
- component: 'Select',
- colProps: { span: 8 },
- componentProps: {
- getPopupContainer: () => document.body,
- options: [
- { label: '未报到', value: 0 },
- { label: '已报到', value: 1 },
- ],
- },
- },
- {
- field: '[reportTimeStart,reportTimeEnd]',
- label: '报到日期',
- component: 'RangePicker',
- colProps: { span: 8 },
- componentProps: {
- getPopupContainer: () => document.body,
- placeholder: ['开始时间', '结束时间'],
- format: 'YYYY-MM-DD',
- showTime: false,
- },
- },
- {
- field: 'gradeId',
- label: '年级',
- component: 'ApiSelect',
- componentProps: {
- getPopupContainer: () => document.body,
- api: requestMagicApi,
- params: { url: 'baseData/grade/option' },
- },
- colProps: { span: 8 },
- },
- ];
- export const formSchema: FormSchema[] = [
- {
- label: '计划名称',
- field: 'name',
- component: 'Input',
- required: true,
- colProps: { span: 24 },
- },
- {
- field: 'semesterId',
- label: '学期',
- component: 'ApiSelect',
- componentProps: {
- getPopupContainer: () => document.body,
- api: requestMagicApi,
- params: { url: 'baseData/semester/option' },
- },
- required: true,
- colProps: { span: 24 },
- },
- {
- label: '报到时间',
- field: 'dateTime',
- component: 'RangePicker',
- colProps: { span: 24 },
- required: true,
- componentProps: {
- getPopupContainer: () => document.body,
- placeholder: ['开始时间', '结束时间'],
- format: 'YYYY-MM-DD HH:mm:ss',
- showTime: { format: 'HH:mm:ss' },
- },
- },
- {
- label: '就读修改时间',
- field: 'date',
- component: 'RangePicker',
- colProps: { span: 24 },
- required: true,
- componentProps: {
- getPopupContainer: () => document.body,
- placeholder: ['开始时间', '结束时间'],
- format: 'YYYY-MM-DD',
- valueFormat: 'YYYY-MM-DD',
- showTime: false,
- },
- },
- {
- label: '参与班级',
- field: 'classIds',
- component: 'Input',
- required: true,
- colProps: { span: 24 },
- slot: 'classIds',
- },
- ];
|