|
@@ -0,0 +1,185 @@
|
|
|
+<template>
|
|
|
+ <div class="college-manage">
|
|
|
+ <div class="part-box part-box-filter part-box-flex">
|
|
|
+ <el-form ref="FilterForm" label-position="left" label-width="90px" inline>
|
|
|
+ <template v-if="checkPrivilege('condition', 'condition')">
|
|
|
+ <el-form-item label="学院名称:">
|
|
|
+ <el-input
|
|
|
+ v-model.trim="filter.collegeName"
|
|
|
+ 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
|
|
|
+ v-if="checkPrivilege('button', 'delete')"
|
|
|
+ type="danger"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="toBatchDelete"
|
|
|
+ >批量删除</el-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"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ type="selection"
|
|
|
+ width="55"
|
|
|
+ align="center"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ type="index"
|
|
|
+ label="序号"
|
|
|
+ width="70"
|
|
|
+ :index="indexMethod"
|
|
|
+ ></el-table-column>
|
|
|
+ <el-table-column prop="collegeName" label="学院名称"></el-table-column>
|
|
|
+ <el-table-column prop="createTime" label="创建时间" width="170">
|
|
|
+ <span slot-scope="scope">{{
|
|
|
+ scope.row.createTime | timestampFilter
|
|
|
+ }}</span>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column class-name="action-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-college
|
|
|
+ :instance="curRow"
|
|
|
+ @modified="getList"
|
|
|
+ ref="ModifyCollege"
|
|
|
+ ></modify-college>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { collegeListQuery, deleteCollege } from "../api";
|
|
|
+import ModifyCollege from "../components/ModifyCollege";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "college-manage",
|
|
|
+ components: { ModifyCollege },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ filter: {
|
|
|
+ collegeName: ""
|
|
|
+ },
|
|
|
+ current: 1,
|
|
|
+ size: this.GLOBAL.pageSize,
|
|
|
+ total: 0,
|
|
|
+ dataList: [],
|
|
|
+ multipleSelection: [],
|
|
|
+ curRow: {}
|
|
|
+ };
|
|
|
+ },
|
|
|
+ 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 collegeListQuery(datas);
|
|
|
+ this.dataList = data.records;
|
|
|
+ this.total = data.total;
|
|
|
+ },
|
|
|
+ toPage(page) {
|
|
|
+ this.multipleSelection = [];
|
|
|
+ this.current = page;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ toAdd() {
|
|
|
+ this.curRow = {};
|
|
|
+ this.$refs.ModifyCollege.open();
|
|
|
+ },
|
|
|
+ toEdit(row) {
|
|
|
+ this.curRow = row;
|
|
|
+ this.$refs.ModifyCollege.open();
|
|
|
+ },
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.multipleSelection = val.map(item => item.id);
|
|
|
+ },
|
|
|
+ toBatchDelete() {
|
|
|
+ if (!this.multipleSelection.length) {
|
|
|
+ this.$message.error("请选择要删除的数据");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$confirm(`确定要删除选中的这些数据吗?`, "提示", {
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ await deleteCollege(this.multipleSelection);
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+ this.deletePageLastItem(this.multipleSelection.length);
|
|
|
+ this.multipleSelection = [];
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ toDelete(row) {
|
|
|
+ this.$confirm(`确定要删除学院【${row.collegeName}】吗?`, "提示", {
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ await deleteCollege([row.id]);
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+ this.deletePageLastItem();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|