From c87c4fe5aa3987d61b10d57208232a94eec83d7c Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 04 六月 2024 11:58:18 +0800
Subject: [PATCH] 班级学员管理

---
 src/views/Manage/ClassManagement/ClassStaff.vue |  161 +++++++++++++++++++++++++++--------------------------
 1 files changed, 81 insertions(+), 80 deletions(-)

diff --git a/src/views/Manage/ClassManagement/ClassStaff.vue b/src/views/Manage/ClassManagement/ClassStaff.vue
index b6849c8..655fbcf 100644
--- a/src/views/Manage/ClassManagement/ClassStaff.vue
+++ b/src/views/Manage/ClassManagement/ClassStaff.vue
@@ -8,6 +8,7 @@
           <!-- 鐝骇鍚嶇О -->
           <div style="padding-bottom:20px; border-bottom: 3px solid #409EFF;margin-bottom: 20px;">
             <span>{{title}}</span>
+            <el-button @click="open = true" type="primary" size="small">鏂板瀛﹀憳</el-button>
           </div>
           <!-- 琛ㄦ牸 -->
           <el-table
@@ -62,14 +63,8 @@
             class="block"
             style="display: flex; margin-top: 40px;"
           >
-            <el-pagination
-              style="margin:auto"
-              background
-              :page-size="10"
-              layout="prev, pager, next, jumper"
-              :total="100"
-            >
-            </el-pagination>
+            <pagination v-show="total>0" :total="total" :page.sync="searchForm.pageNum" :limit.sync="searchForm.pageSize"
+                        @pagination="page"/>
           </div>
         </div>
       </div>
@@ -79,11 +74,38 @@
       ref="popUp"
       @children="parentGoods"
     />
+
+    <el-dialog
+      title="瀛﹀憳绠$悊"
+      :visible.sync="open"
+      width="900px"
+      :before-close="handleClose">
+      <el-transfer
+        filterable
+        :filter-method="filterMethod"
+        filter-placeholder="瀛﹀憳濮撳悕"
+        :titles="['瀛︾敓鍒楄〃', '褰撳墠瀛︾敓']"
+        :button-texts="['閫�鍑虹彮绾�', '鍔犲叆鐝骇']"
+        :props="{
+          key: 'id',
+          label: 'realName'
+        }"
+        v-model="classes.studentList"
+        :data="studentList">
+      </el-transfer>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="handleClose">鍙� 娑�</el-button>
+        <el-button type="primary" @click="submitForm">淇� 瀛�</el-button>
+      </span>
+    </el-dialog>
+
   </div>
 </template>
 <script>
 // 寮曞叆褰堝嚭绐楀彛绲勪欢
 import PopUp from "../../../components/PopUp/Question.vue";
+import UserApi from "@/api/user";
+import { updateClassesUser, getClassesUsers } from "@/api/classesUser";
 export default {
   // 娉ㄥ唽
   components: {
@@ -91,6 +113,19 @@
   },
   data() {
     return {
+      total: 0,
+      studentList: [],
+      searchForm: {
+        realName: "",
+        pageSize: 10,
+        pageNum: 1,
+        classesId: null
+      },
+      classes: {
+        id: null,
+        studentList: []
+      },
+      open: false,
       // 鐝骇鍚嶇О
       title: "19绾ц蒋浠跺洓鐝�",
       formLabelAlign: {
@@ -99,78 +134,6 @@
         region: "",
       },
       tableData: [
-        {
-          id: 1,
-          name: "寮犱笁",
-          sex: "鐢�",
-          phone: "12345678977",
-          // 鏄惁涓婄嚎
-          condition: "宸蹭笂绾�",
-        },
-        {
-          id: 1,
-          name: "鏉庡洓",
-          sex: "濂�",
-          phone: "12345678977",
-          // 鏄惁涓婄嚎
-          condition: "宸蹭笂绾�",
-        },
-        {
-          id: 1,
-          name: "鐜嬩簲",
-          sex: "鐢�",
-          phone: "12345678977",
-          // 鏄惁涓婄嚎
-          condition: "鏈笂绾�",
-        },
-        {
-          id: 1,
-          name: "寮犱笁",
-          sex: "鐢�",
-          phone: "12345678977",
-          // 鏄惁涓婄嚎
-          condition: "宸蹭笂绾�",
-        },
-        {
-          id: 1,
-          name: "鏉庡洓",
-          sex: "濂�",
-          phone: "12345678977",
-          // 鏄惁涓婄嚎
-          condition: "宸蹭笂绾�",
-        },
-        {
-          id: 1,
-          name: "鐜嬩簲",
-          sex: "鐢�",
-          phone: "12345678977",
-          // 鏄惁涓婄嚎
-          condition: "鏈笂绾�",
-        },
-        {
-          id: 1,
-          name: "寮犱笁",
-          sex: "鐢�",
-          phone: "12345678977",
-          // 鏄惁涓婄嚎
-          condition: "宸蹭笂绾�",
-        },
-        {
-          id: 1,
-          name: "鏉庡洓",
-          sex: "濂�",
-          phone: "12345678977",
-          // 鏄惁涓婄嚎
-          condition: "宸蹭笂绾�",
-        },
-        {
-          id: 1,
-          name: "鐜嬩簲",
-          sex: "鐢�",
-          phone: "12345678977",
-          // 鏄惁涓婄嚎
-          condition: "鏈笂绾�",
-        },
         {
           id: 1,
           name: "鐜嬩簲",
@@ -182,7 +145,45 @@
       ],
     };
   },
+  mounted() {
+    this.classes.id = this.$route.query.classesId;
+    this.page()
+    this.getClassesCurrentUserList(this.classes.id)
+    this.getStudentList()
+  },
   methods: {
+    getClassesCurrentUserList(classesId) {
+      let param = {
+        classesId: classesId
+      }
+      UserApi.getClassesCurrentUserList(param).then(res => {
+        this.classes.studentList = res.data
+      })
+    },
+    getStudentList() {
+      UserApi.studentList().then(res => {
+        this.studentList = res.data;
+      })
+    },
+    // 鑾峰彇褰撳墠鐝骇瀛﹀憳鍒嗛〉
+    page() {
+      this.searchForm.classesId = this.classes.id
+      getClassesUsers(this.searchForm).then(res => {
+        this.tableData = res.data.data
+      })
+    },
+    submitForm() {
+      updateClassesUser(this.classes).then(res => {
+        this.$message.success(res.data.message)
+        this.classesStudentPage();
+      })
+    },
+    handleClose() {
+
+    },
+    filterMethod(query, item) {
+      return item.realName.indexOf(query) > -1;
+    },
     // 杩斿洖涓婁竴涓〉闈�
     goBack() {
       this.$router.back();

--
Gitblit v1.8.0