ソースを参照

提交一下

1
mo 2 年 前
コミット
62ad5fc142

+ 0 - 0
src/views/teamDetail/components/courseTransModals/tranCourseList.vue


+ 91 - 50
src/views/teamDetail/components/courseTransModals/transClass.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-dialog
-      title="选择学员"
+      title="创建班级"
       append-to-body
       width="800px"
       :visible.sync="transClassVisible"
@@ -18,9 +18,13 @@
           </p>
         </el-alert>
         <el-form :model="form" ref="form">
-          <div class="classWrap" v-for="(item,index) in form.classList" :key="index">
+          <div
+            class="classWrap"
+            v-for="(item, index) in form.classList"
+            :key="index"
+          >
             <h2 class="classTitle">
-              <span>线上基础技能班{{index+1}}</span>
+              <span>线上基础技能班{{ index + 1 }}</span>
               <i
                 @click="remove(index)"
                 v-if="form.classList.length > 1"
@@ -72,7 +76,6 @@
                     v-model="item.subjectIdList"
                     style="width: 100% !important"
                     clearable
-                    multiple
                     collapse-tags
                     filterable
                     placeholder="请选择声部"
@@ -132,17 +135,36 @@
                     </p>
                   </template>
                   <div class="studentTitle">
-                    <p>已选择<span style="color:red;">{{item.studentList.length}}</span>名</p>
-                  <el-button type="text" @click="chioseStudent(index)">选择学员 >></el-button>
+                    <p>
+                      已选择<span style="color: red">{{
+                        item.studentList.length
+                      }}</span
+                      >名
+                    </p>
+                    <el-button type="text" @click="chioseStudent(index)"
+                      >选择学员 >></el-button
+                    >
                   </div>
-
                 </el-form-item>
               </el-col>
             </el-row>
           </div>
           <el-button class="addButton" @click="addClass">添加+</el-button>
         </el-form>
-        <transStudent ref="transStudent" @close="()=>{showStudentVisible = false}" @submit="setStudent" v-if="showStudentVisible" :soundList="soundList" :studentList="studentList" :activeListStudent="activeListStudent" activeType='HIGH_ONLINE'/>
+        <transStudent
+          ref="transStudent"
+          @close="
+            () => {
+              showStudentVisible = false;
+            }
+          "
+          @submit="setStudent"
+          v-if="showStudentVisible"
+          :soundList="soundList"
+          :studentList="studentList"
+          :activeListStudent="activeListStudent"
+          activeType="HIGH_ONLINE"
+        />
       </div>
       <div slot="footer" class="dialog-footer">
         <el-button @click="transClassVisible = false">取 消</el-button>
@@ -154,44 +176,46 @@
 <script>
 import { getCourseScheduleConvert } from "../../api";
 import { findSound, getTeacher } from "@/api/buildTeam";
-import transStudent from './transStudent'
+import transStudent from "./transStudent";
 export default {
-  props:{
-    students:{
-      type:Array,
-      default:[]
-    }
+  props: {
+    students: {
+      type: Array,
+      default: [],
+    },
   },
   data() {
     return {
       transClassVisible: false,
-      getStudentList:[],
+      getStudentList: [],
       form: {
-        classList: [{
-        expectStudentNum: 6,
-        groupType: "MUSIC",
-        musicGroupId: this.$route.query.id,
-        name: "",
-        studentList: [],
-        coreTeacher: '',
-        type: "HIGH_ONLINE",
-      }],
+        classList: [
+          {
+            expectStudentNum: 6,
+            groupType: "MUSIC",
+            musicGroupId: this.$route.query.id,
+            name: "",
+            studentList: [],
+            coreTeacher: "",
+            type: "HIGH_ONLINE",
+          },
+        ],
       },
       soundList: [],
       teacherList: [],
       teamid: "",
       organId: "",
-      showStudentVisible:false,
-      activeStudentIndex:0,
-      activeListStudent:[],
-      studentList:[]
+      showStudentVisible: false,
+      activeStudentIndex: 0,
+      activeListStudent: [],
+      studentList: [],
     };
   },
-  components:{
-    transStudent
+  components: {
+    transStudent,
   },
   mounted() {
-    this.init()
+    this.init();
   },
   methods: {
     async openDialog() {
@@ -200,12 +224,10 @@ export default {
     },
     getList() {},
     gotoNext() {
-      this.$refs.form.validate(flag=>{
-
-      })
+      this.$refs.form.validate((flag) => {});
     },
     remove(index) {
-      this.form.classList.splice(index,1)
+      this.form.classList.splice(index, 1);
     },
     init() {
       this.teamid = this.$route.query.id;
@@ -232,34 +254,53 @@ export default {
         musicGroupId: this.$route.query.id,
         name: "",
         studentList: [],
-        coreTeacher: '',
+        coreTeacher: "",
         type: "HIGH_ONLINE",
       });
     },
-    setStudent(student){
-      console.log(this.activeStudentIndex)
-      this.form.classList[this.activeStudentIndex].studentList =[...student] ;
+    setStudent(student) {
+      this.form.classList[this.activeStudentIndex].studentList = [...student];
       // 提交完的学生
     },
-    chioseStudent(index){
+    chioseStudent(index) {
       this.activeStudentIndex = index;
-      this.activeListStudent =this.students.filter(item=>{
-        return this.form?.classList[index]?.studentList.indexOf(item.useId) != -1
-      })
-      this.studentList =this.students;
+      this.activeListStudent = [];
+      this.students.forEach((item) => {
+        if (
+          this.form?.classList[index]?.studentList.indexOf(item.userId) != -1
+        ) {
+          this.activeListStudent.push(item);
+        }
+      });
+      console.log(this.waitStudentList, this.waitStudentList.length);
+      this.studentList = this.waitStudentList;
       this.showStudentVisible = true;
 
-      this.$nextTick(()=>{
-        console.log( this.$refs.transStudent)
-        this.$refs.transStudent.openDialog()
-      })
-
-    }
+      this.$nextTick(() => {
+        console.log(this.$refs.transStudent);
+        this.$refs.transStudent.openDialog();
+      });
+    },
   },
   computed: {
     chioseCourse() {
       return this.activeCourseList;
     },
+    waitStudentList() {
+      let chioseIdList = [];
+      this.form.classList.forEach((classes) => {
+        classes.studentList.forEach((stu) => {
+          chioseIdList.push(stu);
+        });
+      });
+      console.log(chioseIdList)
+      let arr = this.students.filter((item) => {
+        console.log(chioseIdList.indexOf(item.userId) != -1)
+        return chioseIdList.indexOf(item.userId) == -1;
+
+      });
+      return arr;
+    },
   },
 };
 </script>