|
@@ -10,14 +10,17 @@
|
|
|
"
|
|
|
>
|
|
|
<div class="pb_head top">
|
|
|
- <span>班级管理</span>
|
|
|
- <div class="student_button">
|
|
|
- <el-button type="primary" class="bgColor" @click="dialogVisible = true"
|
|
|
- >添加班级</el-button
|
|
|
- >
|
|
|
+ <span>班级管理</span>
|
|
|
+ <div class="student_button">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ class="bgColor"
|
|
|
+ @click="dialogVisible = true"
|
|
|
+ >添加班级</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="student_head">
|
|
|
+ <div class="student_head">
|
|
|
<div class="student_search">
|
|
|
<span>
|
|
|
<el-input
|
|
@@ -51,7 +54,7 @@
|
|
|
align="center"
|
|
|
>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
+ <el-table-column
|
|
|
prop="pnum"
|
|
|
label="人数"
|
|
|
min-width="40%"
|
|
@@ -60,6 +63,12 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" min-width="20%">
|
|
|
<template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="openUpdate(scope.row.id, scope.row.name)"
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
size="small"
|
|
@@ -104,6 +113,28 @@
|
|
|
<el-button type="primary" @click="insertClass">确 定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog
|
|
|
+ title="添加班级"
|
|
|
+ :visible.sync="dialogVisible1"
|
|
|
+ :append-to-body="true"
|
|
|
+ width="25%"
|
|
|
+ :before-close="handleClose"
|
|
|
+ class="dialog_diy"
|
|
|
+ >
|
|
|
+ <el-form>
|
|
|
+ <el-form-item label="班级名称" :label-width="formLabelWidth">
|
|
|
+ <el-input
|
|
|
+ v-model="className1"
|
|
|
+ auto-complete="off"
|
|
|
+ placeholder="请输入班级..."
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogVisible1 = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="updateClass">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -116,7 +147,10 @@ export default {
|
|
|
formLabelWidth: "100px",
|
|
|
sClassName: "",
|
|
|
className: "",
|
|
|
+ className1: "",
|
|
|
+ classid: "",
|
|
|
dialogVisible: false,
|
|
|
+ dialogVisible1: false,
|
|
|
tableData: [],
|
|
|
page: 1,
|
|
|
total: 0,
|
|
@@ -179,6 +213,11 @@ export default {
|
|
|
this.page = 1;
|
|
|
this.getClass();
|
|
|
},
|
|
|
+ openUpdate(id, n) {
|
|
|
+ this.classid = id;
|
|
|
+ this.className1 = n;
|
|
|
+ this.dialogVisible1 = true;
|
|
|
+ },
|
|
|
//新增班级
|
|
|
insertClass() {
|
|
|
let params = {
|
|
@@ -189,18 +228,59 @@ export default {
|
|
|
this.ajax
|
|
|
.get(this.$store.state.api + "insertClass", params)
|
|
|
.then((res) => {
|
|
|
+ if (res.data[0] && res.data[0][0].classname == 1) {
|
|
|
+ this.$message({
|
|
|
+ message: "不能与其他班级名称相同!",
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: "新增成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ this.dialogVisible = false;
|
|
|
+ this.sClassName = "";
|
|
|
+ this.getClass();
|
|
|
+ this.className = "";
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
this.$message({
|
|
|
- message: "新增成功",
|
|
|
- type: "success",
|
|
|
+ message: "新增失败",
|
|
|
+ type: "error",
|
|
|
});
|
|
|
- this.dialogVisible = false;
|
|
|
- this.sClassName = "";
|
|
|
- this.getClass();
|
|
|
- this.className = "";
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //修改班级
|
|
|
+ updateClass() {
|
|
|
+ let params = {
|
|
|
+ id: this.classid,
|
|
|
+ n: this.className1,
|
|
|
+ oid:this.oid,
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "updateClass", params)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data[0] && res.data[0][0].classname == 1) {
|
|
|
+ this.$message({
|
|
|
+ message: "不能与其他班级名称相同!",
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: "修改成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ this.dialogVisible1 = false;
|
|
|
+ this.getClass();
|
|
|
+ this.classid = "";
|
|
|
+ this.className1 = "";
|
|
|
+ }
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
this.$message({
|
|
|
- message: "新增失败",
|
|
|
+ message: "修改失败",
|
|
|
type: "error",
|
|
|
});
|
|
|
console.error(err);
|
|
@@ -345,7 +425,8 @@ export default {
|
|
|
.bgColor {
|
|
|
background: #2167bc;
|
|
|
}
|
|
|
-.student_table >>> .el-table,.student_table >>> .el-table__body-wrapper{
|
|
|
+.student_table >>> .el-table,
|
|
|
+.student_table >>> .el-table__body-wrapper {
|
|
|
height: auto !important;
|
|
|
}
|
|
|
</style>
|