|
@@ -0,0 +1,110 @@
|
|
|
+<template>
|
|
|
+ <div class="course-manage">
|
|
|
+ <div class="part-box">
|
|
|
+ <div class="part-title">
|
|
|
+ <div class="part-title-infos">
|
|
|
+ <el-button type="primary" icon="icon icon-plus" @click="toAdd"
|
|
|
+ >新增科目</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-table ref="TableList" :data="courses" border stripe>
|
|
|
+ <el-table-column prop="courseName" label="科目名称"></el-table-column>
|
|
|
+ <el-table-column prop="courseCode" 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="prev, pager, next"
|
|
|
+ :current-page="current"
|
|
|
+ :total="total"
|
|
|
+ :page-size="size"
|
|
|
+ @current-change="toPage"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <modify-course
|
|
|
+ :instance="curCourse"
|
|
|
+ @modified="getList"
|
|
|
+ ref="ModifyCourse"
|
|
|
+ ></modify-course>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { courseListPage, deleteCourse } from "../api";
|
|
|
+import ModifyCourse from "../components/ModifyCourse";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "course-manage",
|
|
|
+ components: { ModifyCourse },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ filter: {},
|
|
|
+ current: 1,
|
|
|
+ size: this.GLOBAL.pageSize,
|
|
|
+ total: 0,
|
|
|
+ courses: [],
|
|
|
+ curCourse: {}
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getList() {
|
|
|
+ const datas = {
|
|
|
+ ...this.filter,
|
|
|
+ pageNumber: this.current,
|
|
|
+ pageSize: this.size
|
|
|
+ };
|
|
|
+ const data = await courseListPage(datas);
|
|
|
+ this.courses = data.records;
|
|
|
+ this.total = data.total;
|
|
|
+ },
|
|
|
+ toPage(page) {
|
|
|
+ this.current = page;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ toAdd() {
|
|
|
+ this.curCourse = {};
|
|
|
+ this.$refs.ModifyCourse.open();
|
|
|
+ },
|
|
|
+ toEdit(row) {
|
|
|
+ this.curCourse = row;
|
|
|
+ this.$refs.ModifyCourse.open();
|
|
|
+ },
|
|
|
+ toDelete(row) {
|
|
|
+ this.$confirm("确定要删除当前科目吗?", "提示", {
|
|
|
+ cancelButtonClass: "el-button--primary",
|
|
|
+ confirmButtonClass: "el-button--default-act",
|
|
|
+ type: "warning"
|
|
|
+ }).then(async () => {
|
|
|
+ await deleteCourse(row.id);
|
|
|
+ this.$message.success("删除成功!");
|
|
|
+ this.deletePageLastItem();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|