From dc9f8e4f724ade3d29bdf0e4e68fd8c3c815bb77 Mon Sep 17 00:00:00 2001
From: lohir <3399054449@qq.com>
Date: 星期三, 16 十月 2024 09:57:55 +0800
Subject: [PATCH] bug

---
 src/views/class-management/ClassStaff.vue |   38 ++++++++++++++++++++++++++------------
 1 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/src/views/class-management/ClassStaff.vue b/src/views/class-management/ClassStaff.vue
index 047e4fa..c27b89a 100644
--- a/src/views/class-management/ClassStaff.vue
+++ b/src/views/class-management/ClassStaff.vue
@@ -59,8 +59,8 @@
         width="300px"
       >
         <template slot-scope="scope">
-          <el-button @click="handlerEditStudent(scope.row)" type="warning">缂栬緫</el-button>
-          <el-button @click="remove(scope.row.id)" type="danger">鍒犻櫎</el-button>
+          <el-button @click="handlerEditStudent(scope.row)" type="warning" size="small">缂栬緫</el-button>
+          <el-button @click="remove(scope.row.id)" type="danger" size="small">鍒犻櫎</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -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,7 +76,8 @@
       :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="realName">
           <el-input v-model="studentForm.realName"></el-input>
@@ -132,7 +133,13 @@
 <script>
 // 寮曞叆褰堝嚭绐楀彛绲勪欢
 import UserApi from '@/api/user'
-import { updateClassesUser, getClassesUsers, deleteClassesUserById, addClassesUser, edit } from '@/api/classesUser'
+import {
+  updateClassesUser,
+  getClassesUsers,
+  deleteClassesUserById,
+  addClassesUser,
+  editClassesUser
+} from '@/api/classesUser'
 import Pagination from '@/components/Pagination'
 
 export default {
@@ -140,6 +147,7 @@
   data () {
     return {
       studentForm: {
+        id: null,
         realName: '',
         sex: 1,
         phone: '',
@@ -168,7 +176,7 @@
       searchForm: {
         studentName: '',
         pageSize: 10,
-        pageNum: 1,
+        currentPage: 1,
         classesId: null
       },
       classes: {
@@ -204,20 +212,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 +277,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