Browse Source

建班和加学生分开

1
mo 4 years ago
parent
commit
7811997ce9

+ 7 - 5
src/views/teamDetail/components/modals/select-student.vue

@@ -67,7 +67,7 @@
           </el-form-item>
         </el-col>
         <el-col :span="10" :offset="showName ? 4 : 0">
-          <el-form-item label="声部" style="margin-right: 0;">
+          <el-form-item label="声部" style="margin-right: 0;" >
             <el-select
               v-model="sound"
               style="width: 100%"
@@ -88,6 +88,7 @@
         </el-col>
       </el-row>
       <el-transfer
+      v-if="!showName"
         filterable
         :titles="['所有学员', '已选学员']"
         filter-placeholder="请输入学生姓名"
@@ -204,9 +205,9 @@ export default {
       if (!this.isOnlyChangeUser && this.activeType == 'HIGH_ONLINE' && (this.seleched.length < 3 || this.seleched.length > 5)) {
         return this.$message.error('线上技能班必须为3-5人')
       }
-      if (this.seleched.length < 1 && !this.isStudentRemove) {
-        return this.$message.error('请至少选择一名学生')
-      }
+      // if (this.seleched.length < 1 && !this.isStudentRemove) {
+      //   return this.$message.error('请至少选择一名学生')
+      // }
       if (this.activeType == 'MUSIC_NETWORK' && this.seleched.length > 1) {
         return this.$message.error('乐团网管课仅可添加一名学生')
       }
@@ -225,7 +226,8 @@ export default {
           } else {
             this.$listeners.submited({
               seleched: this.seleched,
-              ...this.form
+              ...this.form,
+              soundList:this.sound
             })
           }
         }

+ 47 - 1
src/views/teamDetail/components/resetClass.vue

@@ -858,11 +858,49 @@ export default {
         },
       ];
     },
+    getClassDate(data) {
+      return {
+        type: this.activeType,
+        name: data?.name,
+        musicGroupId: this.teamid,
+        subjectIdList:
+          data?.soundList.length > 0 ? data?.soundList.join(",") : null,
+        teacherMapperList: formatClassGroupTeacherMapperList(
+          data.coreTeacher,
+          data.assistant
+        ),
+        groupType: "MUSIC",
+      };
+    },
     async submitClass(data) {
       const list = this.getSubmitData(data, { onlyCreateClassGroup: true });
+      let obj = this.getClassDate(data);
+      if (this.activeType == "MUSIC_NETWORK") {
+        try {
+          await revisionAddClassGroup(list);
+          this.$message.success("提交成功");
+          this.studentVisible = false;
+          this.getList();
+        } catch (error) {
+          console.log(error);
+        }
+      } else {
+        createClass(obj).then((res) => {
+          if (res.code == 200) {
+            this.studentVisible = false;
+            this.$message.success("提交成功");
+            this.getList();
+          }
+        });
+      }
+
+      return;
+      console.log(data);
       try {
         if (this.classType == 1) {
           // 0新建班级 2 3 4新增班级修改
+          console.log(list, "submitClass,临时班");
+          return;
           await revisionClassGroup(list);
           this.$message.success("提交成功");
         } else if (
@@ -870,6 +908,8 @@ export default {
           this.classType == 3 ||
           this.classType == 4
         ) {
+          console.log(list, "submitClass");
+          return;
           await revisionAddClassGroup(list);
           this.$message.success("提交成功");
         }
@@ -1069,7 +1109,8 @@ export default {
       this.isSearch = false;
       this.activeType = row.type;
       this.activeChioseSound = null;
-      this.isStudentRemove = row.currentClassTimes == row.totalClassTimes ? true : false // 上课时长是否没有
+      this.isStudentRemove =
+        row.currentClassTimes == row.totalClassTimes ? true : false; // 上课时长是否没有
       // 根据单机班id 查询声部班内的所有学生
       getClassAllStudent({ classGroupId: row.id }).then((res) => {
         if (res.code == 200) {
@@ -1394,6 +1435,8 @@ export default {
           };
           if (type == 1) {
             // 新增临时班级
+            console.log(obj, "submitTemporary");
+            return;
             revisionClassGroup(obj).then((res) => {
               if (res.code == 200) {
                 // 提示修改成功
@@ -1406,6 +1449,9 @@ export default {
           } else if (type == 2) {
             (obj.subjectId = this.teacherForm.sound),
               (obj.expectStudentNum = this.teacherForm.expectStudentNum);
+            console.log(obj, "submitTemporary");
+            return;
+            let data = {};
             // 新增声部班
             revisionAddClassGroup(obj).then((res) => {
               if (res.code == 200) {