guhongwei 4 years ago
parent
commit
e8a2ed5ef4
2 changed files with 43 additions and 47 deletions
  1. 30 46
      src/views/class/classStuList.vue
  2. 13 1
      src/views/class/info/headStuList.vue

+ 30 - 46
src/views/class/classStuList.vue

@@ -19,6 +19,8 @@
             @handleClose="handleClose"
             :classid="this.id"
             :schoolList="schoolList"
+            @affirm="affirm"
+            @cancel="cancel"
           ></headStuList>
         </el-col>
       </el-col>
@@ -51,51 +53,7 @@ export default {
     assignShow: false,
     assignForm: {},
     job_list: [],
-    job1: [
-      {
-        name: '班长',
-      },
-      {
-        name: '学委',
-      },
-      {
-        name: '普通学生',
-      },
-    ],
-    // job2: [
-    //   {
-    //     name: '班长',
-    //   },
-    //   {
-    //     name: '学委',
-    //   },
-    //   {
-    //     name: '普通学生',
-    //   },
-    // ],
-    // job3: [
-    //   {
-    //     name: '班长',
-    //   },
-    //   {
-    //     name: '学委',
-    //   },
-
-    //   {
-    //     name: '普通学生',
-    //   },
-    // ],
-    // job4: [
-    //   {
-    //     name: '班长',
-    //   },
-    //   {
-    //     name: '学委',
-    //   },
-    //   {
-    //     name: '普通学生',
-    //   },
-    // ],
+    job1: [{ name: '班长' }, { name: '学委' }, { name: '普通学生' }],
     // 学校
     schoolList: [],
   }),
@@ -121,7 +79,7 @@ export default {
   },
   methods: {
     ...mapStudent({ list: 'query', add: 'create', fet: 'fetch', updates: 'update' }),
-    ...mapGroup({ groupQuery: 'query' }),
+    ...mapGroup({ groupQuery: 'query', groupUpdate: 'update' }),
     ...school(['query']),
     // 查询学校
     async seachschool() {
@@ -206,6 +164,32 @@ export default {
     handleClose() {
       this.assignShow = false;
     },
+    //  确定小组
+    async affirm(data) {
+      data.status = '1';
+      const res = await this.groupUpdate(data);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '确定小组成功',
+          type: 'success',
+        });
+        this.searchInfo();
+        this.seachschool();
+      }
+    },
+    //  取消小组
+    async cancel(data) {
+      data.status = '0';
+      const res = await this.groupUpdate(data);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '取消小组确定成功',
+          type: 'success',
+        });
+        this.searchInfo();
+        this.seachschool();
+      }
+    },
   },
 };
 </script>

+ 13 - 1
src/views/class/info/headStuList.vue

@@ -4,7 +4,11 @@
       <el-col :span="24" class="info">
         <el-col v-for="item in groupStuList" :key="item.id">
           <el-col v-if="item.students.length > 0">
-            <van-divider content-position="left">{{ item.name }}</van-divider>
+            <van-divider content-position="left">
+              <span style="padding:0 10px;">{{ item.name }}</span>
+              <van-button type="primary" size="small" round style="margin:0 10px 0 0;" v-if="item.status == '0'" @click="affirm(item)">确认小组</van-button>
+              <van-button type="danger" size="small" round v-if="item.status == '1'" @click="cancel(item)">取消小组</van-button>
+            </van-divider>
             <el-col :span="11" class="list" v-for="i in item.students" :key="i.stuid" @click.native="clickAssign({ id: i.stuid })">
               <p class="name" :style="`font-size:${changeNum(i.stuname)}px`">{{ i.stuname }}</p>
               <p>{{ getGroupsch(i.stuid) || '暂无' }}</p>
@@ -144,6 +148,14 @@ export default {
         return 15;
       }
     },
+    // 确定小组
+    affirm(data) {
+      this.$emit('affirm', data);
+    },
+    // 取消小组
+    cancel(data) {
+      this.$emit('cancel', data);
+    },
   },
 };
 </script>