From 1530f605190069e45b5e31a7ec2bf7a6dc691f39 Mon Sep 17 00:00:00 2001
From: QYF-GitLab1 <1940665526@qq.com>
Date: 星期四, 02 一月 2025 14:09:22 +0800
Subject: [PATCH] 1

---
 packageCourse/components/studentManage/index.js |  107 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 99 insertions(+), 8 deletions(-)

diff --git a/packageCourse/components/studentManage/index.js b/packageCourse/components/studentManage/index.js
index 51fc396..1aa437b 100644
--- a/packageCourse/components/studentManage/index.js
+++ b/packageCourse/components/studentManage/index.js
@@ -36,6 +36,7 @@
     }],
     isAll: false,
     isEnbled: false,
+    currentState: 'Normal',
     // 鍔犺浇鍙傛暟
     bottomLoading: false,
     isMoreData: false,
@@ -52,6 +53,38 @@
    * 缁勪欢鐨勬柟娉曞垪琛�
    */
   methods: {
+    changeHandle(e) {
+      const {
+        value
+      } = e.detail;
+      let cmsList = this.data.userList
+      this.setData({
+        userList: []
+      })
+      if (value) {
+        const data = cmsList.filter(item => item.appUser.name.indexOf(value) > -1);
+        this.setData({
+          userList: data
+        })
+      }
+      if (value == '') {
+        this.setData({
+          userList: [],
+        })
+        this.getStudentList()
+      }
+    },
+    // 褰撳墠鐘舵��
+    onTabsChange(e) {
+      this.setData({
+        currentState: e.detail.value,
+        userList: [],
+        isAll: false,
+        isEnbled: false
+      })
+      this.getStudentList()
+    },
+
     // 閫夋嫨瀛︾敓
     selectUser(e) {
       const {
@@ -59,13 +92,13 @@
       } = e.currentTarget.dataset
       let bool = false;
       let allBool = false;
-      const data = this.data.userList;
+      const data = [...this.data.userList];
       data[index].isCheck = !data[index].isCheck;
-      const list = data.filter(item => item.isCheck);
-      if (list.length === this.data.userList.length - 1) {
+      const list = data.filter(item => item.isCheck == true);
+      if (list.length === data.length) {
         allBool = true
       }
-      if (list.length > 1) {
+      if (list.length > 0) {
         bool = true
       }
       this.setData({
@@ -79,7 +112,9 @@
     selectAll(e) {
       const data = this.data.userList;
       data.forEach(item => {
-        item.isCheck = e.detail.checked
+        if (item.linkType != 'Creator') {
+          item.isCheck = e.detail.checked
+        }
       })
       this.setData({
         userList: data,
@@ -90,7 +125,7 @@
 
     // 鎵归噺閫氳繃
     updateStateNormalDatas() {
-      const dataUser = this.data.userList.filter((item) => item.isCheck = true)
+      const dataUser = this.data.userList.filter((item) => item.isCheck == true)
       const data = {
         groupId: this.properties.classId,
         requests: dataUser.map((item) => {
@@ -104,7 +139,10 @@
       }
       app.MG.identity.updateAppUserGroupLink(data).then((res) => {
         if (res) {
-          getStudentList()
+          this.setData({
+            userList: []
+          })
+          this.getStudentList()
         }
       })
     },
@@ -119,17 +157,65 @@
             return
           }
           if (res.confirm) {
-            const dataUser = this.data.userList.filter((item) => item.isCheck = true)
+            const dataUser = this.data.userList.filter((item) => item.isCheck == true)
             const data = {
               groupId: this.properties.classId,
               appUserIds: dataUser.map((item) => item.appUser.id)
             }
             app.MG.identity.removeAppUserFromGroup(data).then((res) => {
               if (res) {
+                this.setData({
+                  userList: []
+                })
                 this.getStudentList()
               }
             })
           }
+        }
+      })
+    },
+
+    // 鎵归噺鎷掔粷
+    updateStateRejectDatas() {
+      const dataUser = this.data.userList.filter((item) => item.isCheck == true)
+      const data = {
+        groupId: this.properties.classId,
+        requests: dataUser.map((item) => {
+          return {
+            linkId: item.linkId,
+            linkType: item.linkType,
+            state: 'Reject',
+            groupState: 'Normal'
+          }
+        })
+      }
+      app.MG.identity.updateAppUserGroupLink(data).then((res) => {
+        if (res) {
+          this.setData({
+            userList: []
+          })
+          this.getStudentList()
+        }
+      })
+    },
+
+    // 鏇存柊鐘舵�� 鎷掔粷
+    updateStateReject(e) {
+      const {
+        item
+      } = e.currentTarget.dataset
+      const data = {
+        groupId: this.properties.classId,
+        requests: [{
+          linkId: item.linkId,
+          linkType: item.linkType,
+          state: 'Reject',
+          groupState: 'Normal'
+        }]
+      }
+      app.MG.identity.updateAppUserGroupLink(data).then((res) => {
+        if (res) {
+          this.getStudentList()
         }
       })
     },
@@ -139,6 +225,11 @@
       const data = {
         start: (this.data.page - 1) * this.data.limit,
         size: this.data.limit,
+        filterList: [{
+          value: this.data.currentState,
+          field: "State",
+          subFilters: []
+        }],
         searchList: this.data.searchKey ? [{
           keywords: this.data.searchKey,
           field: 'Name',

--
Gitblit v1.9.1