123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <template>
- <div id="index">
- <list-frame title="学生管理" @query="search" :total="total" :needFilter="false" @add="$router.push({ path: '/student/detail' })">
- <data-table :fields="fields" :data="list" :opera="opera" @edit="toEdit" @delete="toDelete"></data-table>
- </list-frame>
- </div>
- </template>
- <script>
- import listFrame from '@frame/layout/admin/list-frame';
- import dataTable from '@frame/components/data-table';
- import { createNamespacedHelpers } from 'vuex';
- const { mapActions } = createNamespacedHelpers('student');
- export default {
- metaInfo: { title: '学生管理' },
- name: 'index',
- props: {},
- components: {
- listFrame,
- dataTable,
- },
- data: () => ({
- opera: [
- {
- label: '编辑',
- icon: 'el-icon-edit',
- method: 'edit',
- },
- {
- label: '删除',
- icon: 'el-icon-delete',
- method: 'delete',
- confirm: true,
- },
- ],
- fields: [
- { label: '姓名', prop: 'name' },
- {
- label: '性别',
- prop: 'gender',
- format: item => {
- return item === '1' ? '男' : '女';
- },
- },
- { label: '民族', prop: 'nation' },
- { label: '身份证号', prop: 'id_number' },
- { label: '学校', prop: 'school_name' },
- { label: '院系', prop: 'yard' },
- { label: '专业', prop: 'major' },
- { label: '入学年份', prop: 'entry_year' },
- { label: '毕业年份', prop: 'finish_year' },
- { label: '在校曾担任何种职务', prop: 'school_job' },
- { label: '手机号', prop: 'phone' },
- { label: 'QQ号', prop: 'qq' },
- { label: '邮箱', prop: 'email' },
- { label: '家庭所在地', prop: 'family_place' },
- {
- label: '家庭是否困难',
- prop: 'family_is_hard',
- format: item => {
- return item === '1' ? '是' : '否';
- },
- },
- {
- label: '是否获得过助学金',
- prop: 'have_grant',
- format: item => {
- return item === '1' ? '是' : '否';
- },
- },
- { label: '职务', prop: 'job' },
- { label: '期', prop: 'term' },
- { label: '批次', prop: 'batch' },
- { label: '班级', prop: 'class' },
- {
- label: '是否优秀',
- prop: 'is_fine',
- format: item => {
- return item === '1' ? '是' : '否';
- },
- },
- ],
- list: [],
- total: 0,
- }),
- created() {
- this.search();
- },
- computed: {},
- methods: {
- ...mapActions(['query', 'delete']),
- async search({ skip = 0, limit = 15, ...info } = {}) {
- const res = await this.query({ skip, limit, ...info });
- if (this.$checkRes(res)) {
- this.$set(this, `list`, res.data);
- this.$set(this, `total`, res.total);
- }
- },
- toEdit({ data }) {
- this.$router.push({ path: '/student/detail', query: { id: data.id } });
- },
- async toDelete({ data }) {
- const res = await this.delete(data.id);
- this.$checkRes(res, '删除成功', '删除失败');
- this.search();
- },
- },
- };
- </script>
- <style lang="less" scoped></style>
|