|
@@ -0,0 +1,82 @@
|
|
|
+<template>
|
|
|
+ <div id="index">
|
|
|
+ <list-frame :title="pageTitle" @query="search" :total="total" :needFilter="false" :needAdd="false" :returns="toReturns">
|
|
|
+ <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 { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: mapStu } = 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' },
|
|
|
+ { label: '身份证号', prop: 'id_number' },
|
|
|
+ { label: '联系电话', prop: 'phone' },
|
|
|
+ ],
|
|
|
+ list: [],
|
|
|
+ total: 0,
|
|
|
+ }),
|
|
|
+ created() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ termid() {
|
|
|
+ return this.$route.query.termid;
|
|
|
+ },
|
|
|
+ pageTitle() {
|
|
|
+ return `${this.$route.meta.title}`;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapStu(['query', 'delete']),
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ console.log('in function:');
|
|
|
+ const res = await this.query({ skip, limit, ...info, termid: this.termid, schid: this.user.code });
|
|
|
+ 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();
|
|
|
+ },
|
|
|
+ toReturns() {
|
|
|
+ window.history.back(-1);
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|