123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- import type { CreateCrudOptionsProps, CreateCrudOptionsRet } from '@fast-crud/fast-crud';
- import { dict } from '@fast-crud/fast-crud';
- import importStudent from '@/public/学员导入.xlsx';
- import { addRequest, delRequest, editRequest, pageRequest } from './api';
- function curd({ context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
- return {
- crudOptions: {
- container: {
- is: 'fs-layout-card'
- },
- request: {
- pageRequest: async ({ page, query }) => {
- const { total, data } = await pageRequest(page.offset + 1, page.limit, query);
- return { records: data, total, currentPage: page.offset, pageSize: page.limit };
- },
- addRequest: ({ form }) => {
- return addRequest(form);
- },
- editRequest: ({ form }) => {
- editRequest(form);
- },
- delRequest: ({ row }) => {
- return delRequest(row.id);
- }
- },
- toolbar: {
- show: true
- },
- actionbar: {
- show: true,
- buttons: {
- add: {
- text: '新增学员',
- title: '使用表单新增学员',
- circle: false,
- tooltip: {
- slots: {
- default() {
- return '使用表单新增学员';
- }
- }
- }
- },
- importAdd: {
- text: 'Excel文件导入',
- title: '上传Excel文件批量导入学员',
- icon: '',
- iconRight: '',
- circle: false,
- style: {},
- disabled: false,
- tooltip: {
- slots: {
- default() {
- return '上传Excel文件,支持xlsx 格式';
- }
- }
- },
- show: true,
- click: () => {
- context?.openModal();
- },
- order: 1
- },
- exportAdd: {
- text: '下载导入模板',
- circle: false,
- disabled: false,
- tooltip: {
- slots: {
- default() {
- return '下载导入学员的 Excel 模板';
- }
- }
- },
- show: true,
- click: () => {
- window.location.href = importStudent;
- },
- order: 1
- }
- }
- },
- columns: {
- id: {
- search: { show: false },
- form: { show: false },
- column: {
- show: false
- }
- },
- studentName: {
- title: '姓名',
- type: 'text',
- search: { show: true },
- column: {
- resizable: true,
- width: 60,
- align: 'center',
- fixed: 'left'
- }
- },
- phone: {
- title: '手机',
- type: 'text',
- search: { show: true },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- studentIdnumber: {
- title: '身份证号',
- type: 'text',
- search: { show: true },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- university: {
- title: '学校',
- type: 'text',
- search: { show: true },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- address: {
- title: '住址',
- type: 'text',
- search: { show: true },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- email: {
- title: '邮箱',
- type: 'text',
- search: { show: true },
- column: {
- resizable: true,
- align: 'center',
- fixed: 'left'
- }
- },
- birthdate: {
- title: '生日',
- type: 'easDate',
- search: { show: true },
- column: {
- resizable: true,
- align: 'center'
- }
- },
- studentNumber: {
- title: '学生档案号',
- type: 'text',
- search: { show: true },
- column: {
- resizable: true,
- align: 'center'
- },
- form: {
- show: false
- }
- },
- enrollmentDate: {
- title: '入学时间',
- type: 'easDate',
- search: { show: true },
- column: {
- resizable: true,
- width: 100
- }
- },
- graduationDate: {
- title: '毕业时间',
- type: 'easDate',
- search: { show: true },
- column: {
- resizable: true,
- width: 100
- }
- },
- graduation: {
- title: '是否结业',
- type: 'dict-select',
- dict: dict({
- data: [
- { value: 'Y', label: '已结业' },
- { value: 'N', label: '在学习' }
- ]
- }),
- column: {
- resizable: true,
- width: 40
- }
- },
- gender: {
- title: '性别',
- type: 'dict-select',
- dict: dict({
- data: [
- { value: 'M', label: '男' },
- { value: 'F', label: '女' }
- ]
- }),
- column: {
- resizable: true,
- width: 40
- }
- }
- }
- }
- };
- }
- export default curd;
|