|
@@ -0,0 +1,173 @@
|
|
|
+<template>
|
|
|
+ <div class="clazz-manage">
|
|
|
+ <div class="part-box part-box-filter part-box-flex">
|
|
|
+ <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
|
|
|
+ <template v-if="checkPrivilege('condition', 'condition')">
|
|
|
+ <el-form-item label="班级名称:">
|
|
|
+ <el-input
|
|
|
+ style="width: 142px;"
|
|
|
+ v-model.trim="filter.queryParams"
|
|
|
+ placeholder="班级名称"
|
|
|
+ clearable
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button
|
|
|
+ v-if="checkPrivilege('button', 'select')"
|
|
|
+ type="primary"
|
|
|
+ @click="toPage(1)"
|
|
|
+ >查询</el-button
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div class="part-box-action">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ icon="el-icon-download"
|
|
|
+ v-if="checkPrivilege('button', 'Import')"
|
|
|
+ ><a :href="downloadUrl" :download="dfilename">模板下载</a></el-button
|
|
|
+ >
|
|
|
+ <upload-button
|
|
|
+ v-if="checkPrivilege('button', 'Import')"
|
|
|
+ btn-icon="el-icon-circle-plus-outline"
|
|
|
+ btn-content="批量导入"
|
|
|
+ btn-type="success"
|
|
|
+ :upload-url="uploadUrl"
|
|
|
+ :format="['xls', 'xlsx']"
|
|
|
+ @upload-error="uplaodError"
|
|
|
+ @upload-success="uploadSuccess"
|
|
|
+ >
|
|
|
+ </upload-button>
|
|
|
+ <el-button
|
|
|
+ v-if="checkPrivilege('button', 'add')"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-circle-plus-outline"
|
|
|
+ @click="toAdd"
|
|
|
+ >新增班级</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="part-box part-box-pad">
|
|
|
+ <el-table ref="TableList" :data="dataList">
|
|
|
+ <el-table-column prop="clazzName" label="班级名称"></el-table-column>
|
|
|
+ <el-table-column prop="campusName" label="所属校区"></el-table-column>
|
|
|
+ <el-table-column prop="createTime" label="创建日期">
|
|
|
+ <span slot-scope="scope">{{
|
|
|
+ scope.row.createTime | timestampFilter
|
|
|
+ }}</span>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="120px">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ v-if="checkPrivilege('link', 'edit')"
|
|
|
+ class="btn-primary"
|
|
|
+ type="text"
|
|
|
+ @click="toEdit(scope.row)"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ v-if="checkPrivilege('link', 'delete')"
|
|
|
+ class="btn-danger"
|
|
|
+ type="text"
|
|
|
+ @click="toDelete(scope.row)"
|
|
|
+ >删除</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-clazz
|
|
|
+ :instance="curRow"
|
|
|
+ @modified="getList"
|
|
|
+ ref="ModifyClazz"
|
|
|
+ ></modify-clazz>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { clazzListQuery, deleteClazz } from "../api";
|
|
|
+import ModifyClazz from "../components/ModifyClazz";
|
|
|
+import UploadButton from "../../../components/UploadButton";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "clazz-manage",
|
|
|
+ components: { ModifyClazz, UploadButton },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ filter: {
|
|
|
+ queryParams: ""
|
|
|
+ },
|
|
|
+ current: 1,
|
|
|
+ size: this.GLOBAL.pageSize,
|
|
|
+ total: 0,
|
|
|
+ dataList: [],
|
|
|
+ curRow: {},
|
|
|
+ // import
|
|
|
+ uploadUrl: "/api/admin/basic/clazz/data_import",
|
|
|
+ downloadUrl: "/temps/classTemplate.xlsx",
|
|
|
+ dfilename: "班级导入模板.xlsx"
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getList() {
|
|
|
+ if (!this.checkPrivilege("list", "list")) return;
|
|
|
+
|
|
|
+ const datas = {
|
|
|
+ ...this.filter,
|
|
|
+ pageNumber: this.current,
|
|
|
+ pageSize: this.size
|
|
|
+ };
|
|
|
+ const data = await clazzListQuery(datas);
|
|
|
+ this.dataList = data.records;
|
|
|
+ this.total = data.total;
|
|
|
+ },
|
|
|
+ toPage(page) {
|
|
|
+ this.current = page;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ toAdd() {
|
|
|
+ this.curRow = {};
|
|
|
+ this.$refs.ModifyClazz.open();
|
|
|
+ },
|
|
|
+ toEdit(row) {
|
|
|
+ this.curRow = row;
|
|
|
+ this.$refs.ModifyClazz.open();
|
|
|
+ },
|
|
|
+ toDelete(row) {
|
|
|
+ this.$confirm(`确定要删除班级【${row.clazzName}】吗?`, "提示", {
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ await deleteClazz([row.id]);
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+ this.deletePageLastItem();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ // import
|
|
|
+ uplaodError(errorData) {
|
|
|
+ this.$notify.error({ title: "错误提示", message: errorData.message });
|
|
|
+ },
|
|
|
+ uploadSuccess() {
|
|
|
+ this.$message.success("文件上传成功,后台正在导入!");
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|