From 956289c2b729f643a528983b7ceb5103f32aff23 Mon Sep 17 00:00:00 2001 From: lohir <3399054449@qq.com> Date: 星期三, 16 十月 2024 09:26:29 +0800 Subject: [PATCH] bug --- src/views/class-management/ClassStaff.vue | 36 ++++++++++++++++++++++++++---------- 1 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/views/class-management/ClassStaff.vue b/src/views/class-management/ClassStaff.vue index 88caf31..8eea91e 100644 --- a/src/views/class-management/ClassStaff.vue +++ b/src/views/class-management/ClassStaff.vue @@ -68,7 +68,7 @@ class="block" style="display: flex; margin-top: 40px;" > - <pagination v-show="total>0" :total="total" :page.sync="searchForm.pageNum" + <pagination v-show="total>0" :total="total" :page.sync="searchForm.currentPage" :limit.sync="searchForm.pageSize" @pagination="page"/> </div> @@ -76,8 +76,10 @@ :title="studentTitle" :visible.sync="addOpen" width="700px" - :before-close="handleAddClose"> + :before-close="handleAddClose" + :close-on-click-modal="false"> <el-form :model="studentForm" :rules="studentRules" ref="studentForm" label-width="100px" class="demo-ruleForm"> + <el-form-item label="瀛﹀彿" prop="id" v-show="false"/> <el-form-item label="濮撳悕" prop="realName"> <el-input v-model="studentForm.realName"></el-input> </el-form-item> @@ -132,7 +134,14 @@ <script> // 寮曞叆褰堝嚭绐楀彛绲勪欢 import UserApi from '@/api/user' -import { updateClassesUser, getClassesUsers, deleteClassesUserById, addClassesUser, edit } from '@/api/classesUser' +import { + updateClassesUser, + getClassesUsers, + deleteClassesUserById, + addClassesUser, + edit, + editClassesUser +} from '@/api/classesUser' import Pagination from '@/components/Pagination' export default { @@ -140,6 +149,7 @@ data () { return { studentForm: { + id: null, realName: '', sex: 1, phone: '', @@ -168,7 +178,7 @@ searchForm: { studentName: '', pageSize: 10, - pageNum: 1, + currentPage: 1, classesId: null }, classes: { @@ -204,20 +214,24 @@ }, submitStudentForm () { this.$refs['studentForm'].validate((valid) => { + console.log(this.studentForm) if (valid) { this.studentForm.classesId = this.classes.id if (this.studentForm.id) { - edit(this.studentForm).then(res => { + editClassesUser(this.studentForm).then(res => { this.addOpen = false this.$message.success(res.data.message) this.page() + this.resetStudentForm() + }) + }else { + addClassesUser(this.studentForm).then(res => { + this.addOpen = false + this.$message.success(res.data.message) + this.page() + this.resetStudentForm() }) } - addClassesUser(this.studentForm).then(res => { - this.addOpen = false - this.$message.success(res.data.message) - this.page() - }) } }) }, @@ -265,6 +279,8 @@ this.searchForm.classesId = this.classes.id getClassesUsers(this.searchForm).then(res => { this.tableData = res.data.data + this.total = res.data.total + this.loading = false }) }, submitForm () { -- Gitblit v1.8.0