|
@@ -0,0 +1,163 @@
|
|
|
+<template>
|
|
|
+ <div class="student-manage">
|
|
|
+ <div class="part-box part-box-filter part-box-flex">
|
|
|
+ <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
|
|
|
+ <el-form-item label="姓名/学号:">
|
|
|
+ <el-input
|
|
|
+ style="width: 142px;"
|
|
|
+ v-model.trim="filter.name"
|
|
|
+ placeholder="姓名/学号"
|
|
|
+ clearable
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" @click="toPage(1)"
|
|
|
+ >查询</el-button
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div class="part-box-action">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-circle-plus-outline"
|
|
|
+ @click="toAdd"
|
|
|
+ >新增学生</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ ><a :href="downloadUrl" :download="dfilename">模板下载</a></el-button
|
|
|
+ >
|
|
|
+ <upload-button
|
|
|
+ btn-icon="el-icon-upload"
|
|
|
+ btn-content="批量导入"
|
|
|
+ btn-type="primary"
|
|
|
+ :upload-url="uploadUrl"
|
|
|
+ :format="['xls', 'xlsx']"
|
|
|
+ @upload-error="uplaodError"
|
|
|
+ @upload-success="uploadSuccess"
|
|
|
+ style="margin: 0;"
|
|
|
+ >
|
|
|
+ </upload-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="part-box">
|
|
|
+ <el-table ref="TableList" :data="dataList" border stripe>
|
|
|
+ <el-table-column prop="name" label="姓名"></el-table-column>
|
|
|
+ <el-table-column prop="studentNo" label="学号"></el-table-column>
|
|
|
+ <el-table-column prop="phone" label="手机号"></el-table-column>
|
|
|
+ <el-table-column prop="campus" label="校区"></el-table-column>
|
|
|
+ <el-table-column prop="college" label="学院"></el-table-column>
|
|
|
+ <el-table-column prop="subject" label="专业"></el-table-column>
|
|
|
+ <el-table-column prop="className" label="班级"></el-table-column>
|
|
|
+ <el-table-column prop="status" label="状态"></el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" width="120px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ class="btn-table-icon"
|
|
|
+ type="text"
|
|
|
+ icon="icon icon-edit"
|
|
|
+ @click="toEdit(scope.row)"
|
|
|
+ title="编辑"
|
|
|
+ ></el-button>
|
|
|
+ <el-button
|
|
|
+ class="btn-table-icon"
|
|
|
+ type="text"
|
|
|
+ icon="icon icon-delete"
|
|
|
+ @click="toDelete(scope.row)"
|
|
|
+ title="禁用"
|
|
|
+ ></el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="part-page">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ layout="total,prev, pager, next"
|
|
|
+ :current-page="current"
|
|
|
+ :total="total"
|
|
|
+ :page-size="size"
|
|
|
+ @current-change="toPage"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <modify-student
|
|
|
+ :instance="curRow"
|
|
|
+ @modified="getList"
|
|
|
+ ref="ModifyStudent"
|
|
|
+ ></modify-student>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { studentListQuery, deleteStudent } from "../api";
|
|
|
+import ModifyStudent from "../components/ModifyStudent";
|
|
|
+import UploadButton from "../../../components/UploadButton";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "student-manage",
|
|
|
+ components: { ModifyStudent, UploadButton },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ filter: {
|
|
|
+ name: ""
|
|
|
+ },
|
|
|
+ current: 1,
|
|
|
+ size: this.GLOBAL.pageSize,
|
|
|
+ total: 0,
|
|
|
+ dataList: [],
|
|
|
+ // import
|
|
|
+ uploadUrl: "/api/admin/basic/course/import",
|
|
|
+ downloadUrl: "/temps/学生导入模板.xlsx",
|
|
|
+ dfilename: "学生导入模板.xlsx"
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getList() {
|
|
|
+ const datas = {
|
|
|
+ ...this.filter,
|
|
|
+ pageNumber: this.current,
|
|
|
+ pageSize: this.size
|
|
|
+ };
|
|
|
+ const data = await studentListQuery(datas);
|
|
|
+ this.dataList = data.records;
|
|
|
+ this.total = data.total;
|
|
|
+ },
|
|
|
+ toPage(page) {
|
|
|
+ this.current = page;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ toAdd() {
|
|
|
+ this.curRow = {};
|
|
|
+ this.$refs.ModifyStudent.open();
|
|
|
+ },
|
|
|
+ toEdit(row) {
|
|
|
+ this.curRow = row;
|
|
|
+ this.$refs.ModifyStudent.open();
|
|
|
+ },
|
|
|
+ toDelete(row) {
|
|
|
+ this.$confirm(`确定要删除学生【${row.name}】吗?`, "提示", {
|
|
|
+ cancelButtonClass: "el-button--danger is-plain",
|
|
|
+ confirmButtonClass: "el-button--primary",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ await deleteStudent(row.id);
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+ this.deletePageLastItem();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ // import
|
|
|
+ uplaodError(errorData) {
|
|
|
+ this.$notify.error({ title: "错误提示", message: errorData.message });
|
|
|
+ },
|
|
|
+ uploadSuccess() {
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|