Browse Source

Merge branch 'Nov16thResetMusic' into online

mo 4 years ago
parent
commit
363430742c

+ 1 - 0
src/api/buildTeam.js

@@ -1450,3 +1450,4 @@ export function getOrganCourseDurationSettings (data) {
   })
 }
 
+

+ 18 - 7
src/components/remote-search/index.vue

@@ -28,7 +28,7 @@ const placeholder = {
   setTeachers: "请选择老师",
   setEducations: "请选乐团主管",
 };
-import { throttle, slice } from "lodash";
+import { throttle, slice, uniqBy } from "lodash";
 import selects from "@/store/modules/selects";
 export default {
   name: "remote-search",
@@ -37,6 +37,7 @@ export default {
     return {
       options: [],
       list: [],
+      listById: {},
       loading: false,
       constant: this.number || 50,
       placeholder: placeholder[this.commit],
@@ -46,24 +47,28 @@ export default {
   },
   async mounted() {
     // this.getList();
+    this.getOptions()
 
   },
   methods: {
     async getList() {
       await this.$store.dispatch(this.commit);
       this.list = this.selects[this.enumer[this.commit]];
-
+      const data = {}
+      for (const item of this.list) {
+        data[item.userId] = item
+      }
+      this.listById = data
       this.options =
         this.list.length <= this.constant
           ? this.list
           : slice(this.list, 0, this.constant);
-      // this.getOptions();
     },
     remoteMethod(query) {
       // throttle
       throttle(this.getOptions, 800)(query);
     },
-    getOptions(query) {
+    async getOptions(query) {
       if (query) {
         let flag;
         this.options = this.list.filter((item) => {
@@ -77,7 +82,13 @@ export default {
           }
         });
       } else {
-          this.getList();
+          await this.getList()
+          const optionids = this.options.map(item => item.userId)
+          const valueItem = this.listById[this.value]
+          if (!optionids.includes(this.value) && valueItem) {
+            this.options.push(valueItem)
+            this.options = uniqBy(this.options, 'userId')
+          }
       }
     },
     changeValue(val) {
@@ -101,11 +112,11 @@ export default {
       handler(val) {
         if (this.multiple) {
           if (val?.length > 0 && this.isFirst) {
-            this.getOptions();
+           this.getOptions('')
           }
         } else {
           if (val && this.isFirst) {
-            this.getOptions();
+            this.getOptions('')
           }
         }
       },

+ 37 - 12
src/views/teamBuild/teamSeting/components/setClassV2.vue

@@ -303,7 +303,7 @@
       <selectStudent
         :activeListStudent="activeListStudent"
         :studentList="studentList"
-        :soundList="soundList"
+        :soundList="activeSoundList"
         :classGroupId="activeClass"
         :isOnlyChangeUser="true"
         :activeType="activeType"
@@ -819,6 +819,7 @@ export default {
       activeStudentList: [],
       classList: [],
       appoint: false,
+      activeSoundList:[]
     };
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -901,18 +902,14 @@ export default {
         return this.$message.error("班级人数必须为3-6人");
       }
       this.$refs["newClassForm"].validate((res) => {
+        // 判断基础技能班数量
+
         if (res) {
           let obj = {};
           obj.musicGroupId = this.teamid;
           obj.name = this.newClassForm.className;
           obj.type = this.newClassForm.type;
           obj.groupType = "MUSIC";
-          // if (this.newClassForm.memo.length > 0) {
-          //   obj.memo = this.newClassForm.memo.join(',')
-          // } else {
-          //   obj.memo = null
-          // }
-
           obj.expectStudentNum = this.newClassForm.expectStudentNum;
           obj.teacherMapperList = [];
           obj.teacherMapperList.push({
@@ -927,9 +924,10 @@ export default {
               obj.memo = this.newClassForm.memo.join(",");
             }
           } else {
+            // 线下基础技能班
             subjectIdList =
-              this.newClassForm.subjectIdList.length > 0
-                ? this.newClassForm.subjectIdList.join(",")
+              this.newClassForm.memo.length > 0
+                ? this.newClassForm.memo.join(",")
                 : null;
             for (let i in this.newClassForm.teaching) {
               obj.teacherMapperList.push({
@@ -937,12 +935,13 @@ export default {
                 teacherRole: "TEACHING",
               });
             }
-            obj.memo = null;
+            obj.memo = subjectIdList;
           }
           obj.subjectIdList = subjectIdList;
           createClass(obj).then((res) => {
             if (res.code == 200) {
               this.$message.success("创建成功");
+              this.resetClassFrom()
               this.getList();
               this.newClassVisible = false;
             }
@@ -950,6 +949,18 @@ export default {
         }
       });
     },
+    resetClassFrom() {
+      this.newClassForm = {
+        className: null,
+        type: null,
+        subjectIdList: [],
+        subjectId: "",
+        expectStudentNum: null,
+        bishop: null,
+        teaching: [],
+        memo: [],
+      };
+    },
     removeStudent(item) {
       removeStudents({
         classGroupId: this.activeClass,
@@ -1144,6 +1155,7 @@ export default {
         if (res.code == 200) {
           this.$message.success("创建成功");
           this.getList();
+          this.resetClassFrom()
           this.studentVisible = false;
           this.newClassVisible = false;
         }
@@ -1421,7 +1433,20 @@ export default {
           });
         }
       });
-      this.getNoClassStudent(row.type);
+      if( this.activeType == 'HIGH' || this.activeType=='HIGH_ONLINE'){
+        this.getNoClassStudent(row.type,row.memo);
+        let arr = row.memo.split(',')
+        console.log(arr)
+        this.activeSoundList = this.soundList.filter(sound=>{
+          return arr.indexOf(sound.id+'') != -1
+        })
+        console.log(this.activeSoundList)
+      }else{
+        this.activeSoundList = this.soundList
+        this.getNoClassStudent(row.type);
+          console.log(this.activeSoundList)
+      }
+
     },
     // 排课开始
     arrangeStart() {
@@ -1676,7 +1701,7 @@ export default {
             ) {
               // 要么选中长号  要么选中上低音号
               sound.disabled = false;
-            }else{
+            } else {
               sound.disabled = true;
             }
           });

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

@@ -81,7 +81,7 @@ export default {
       return uniqBy([...this.studentList, ...this.activeListStudent], 'userId')
         .filter(item => {
           if (this.sound.length) {
-            return this.sound.includes(item.subjectId) || this.seleched.includes(item.userId)
+            return this.sound.includes(item.actualSubjectId) || this.seleched.includes(item.userId)
           }
           return true
         })
@@ -132,12 +132,12 @@ export default {
     renderFunc(h, option) {
       return (
         <div class="line">
-          <el-tooltip class="item" effect="dark" placement="top">
+          <el-tooltip class="item" effect="dark" placement="top" open-delay={300}>
             <span slot="content">{option.name}</span>
             <span class="select-item">{option.name}</span>
           </el-tooltip>
           <span>{option.gender}</span>
-          <el-tooltip class="item" effect="dark" placement="top">
+          <el-tooltip class="item" effect="dark" placement="top" open-delay={300}>
             <span slot="content">{option.subjectName}</span>
             <span class="select-item">{option.subjectName}</span>
           </el-tooltip>

+ 78 - 46
src/views/teamDetail/components/resetClass.vue

@@ -183,7 +183,7 @@
       <selectStudent
         :activeListStudent="activeListStudent"
         :studentList="studentList"
-        :soundList="soundList"
+        :soundList="activeSoundList"
         :classGroupId="activeClass"
         :isOnlyChangeUser="isOnlyChangeUser"
         :activeType="activeType"
@@ -301,7 +301,7 @@
       <el-form
         :model="newClassForm"
         :inline="true"
-        label-width="100px"
+         label-width="120px"
         ref="newClassForm"
         class="newClassForm"
       >
@@ -344,19 +344,11 @@
             { required: true, message: '请选择主教老师', trigger: 'blur' },
           ]"
         >
-          <el-select
-            placeholder="请选择主教老师"
+         <remote-search
+            :commit="'setTeachers'"
             v-model="newClassForm.bishop"
-            clearable
-            filterable
-          >
-            <el-option
-              v-for="(item, index) in teacherList"
-              :label="item.realName"
-              :value="item.id"
-              :key="index"
-            ></el-option>
-          </el-select>
+          />
+
         </el-form-item>
         <el-form-item
           label="预计招生数"
@@ -378,27 +370,18 @@
           v-if="newClassForm.type != 'HIGH_ONLINE'"
           prop="teaching"
         >
-          <el-select
-            placeholder="请选择助教老师"
+             <remote-search
+            :commit="'setTeachers'"
             v-model="newClassForm.teaching"
             @change="setAssistant1"
-            clearable
-            multiple
-            filterable
-          >
-            <el-option
-              v-for="(item, index) in teacherList"
-              :label="item.realName"
-              :value="item.id"
-              :key="index"
-            ></el-option>
-          </el-select>
+            :multiple="true"
+          />
         </el-form-item>
         <el-form-item
           label="声部"
           prop="subjectIdList"
           :rules="[{ required: true, message: '请选择声部', trigger: 'blur' }]"
-          v-if="newClassForm.type == 'HIGH' || newClassForm.type == 'NORMAL'"
+          v-if=" newClassForm.type == 'NORMAL'"
           :key="'HIGH'"
         >
           <el-select v-model="newClassForm.subjectIdList" clearable multiple>
@@ -416,10 +399,11 @@
           :rules="[
             { required: true, message: '请选择可报名声部', trigger: 'blur' },
           ]"
-          v-if="newClassForm.type == 'HIGH_ONLINE'"
+          v-if="newClassForm.type == 'HIGH' || newClassForm.type == 'HIGH_ONLINE'"
         >
-          <el-select v-model.trim="newClassForm.memo" multiple clearable>
+          <el-select v-model.trim="newClassForm.memo" multiple clearable   @change="changeMemo">
             <el-option
+               :disabled="item.disabled || appoint"
               v-for="(item, index) in soundList"
               :key="index"
               :label="item.name"
@@ -428,7 +412,7 @@
           </el-select>
         </el-form-item>
         <el-form-item
-          label="声部"
+          label="网络教室声部"
           prop="subjectId"
           :rules="[
             { required: true, message: '请选择线上声部', trigger: 'blur' },
@@ -652,7 +636,9 @@ export default {
       courseTime: "",
       studentResetVisiable: false,
       courseTypesByType:null,
-      mergeList:[]
+      mergeList:[],
+      activeSoundList:[],
+      appoint:false
     };
   },
   created() {
@@ -902,7 +888,19 @@ export default {
           });
         }
       });
-      this.getNoClassStudent(row.type,null,row.id);
+      if( this.activeType == 'HIGH' || this.activeType=='HIGH_ONLINE'){
+        this.getNoClassStudent(row.type,row.memo);
+        let arr = row.memo.split(',')
+        console.log(arr)
+        this.activeSoundList = this.soundList.filter(sound=>{
+          return arr.indexOf(sound.id+'') != -1
+        })
+        console.log(this.activeSoundList)
+      }else{
+        this.activeSoundList = this.soundList
+        this.getNoClassStudent(row.type);
+          console.log(this.activeSoundList)
+      }
     },
     // 班级调整
     classAdjustment(row) {
@@ -997,10 +995,10 @@ export default {
         superFindClassGroups({ classGroupId: this.activeClass }).then((res) => {
           if (res.code == 200) {
             if (
-              this.activeListStudent.length + this.chioseStudent.length > 5 ||
+              this.activeListStudent.length + this.chioseStudent.length > 6 ||
               this.activeListStudent.length + this.chioseStudent.length < 3
             ) {
-              this.$message.error("线上技能班必须为3-5人");
+              this.$message.error("线上技能班必须为3-6人");
               return;
             } else {
               addStudents({
@@ -1082,10 +1080,10 @@ export default {
       }
       if (this.activeType == "HIGH_ONLINE") {
         if (
-          this.activeListStudent.length > 5 ||
+          this.activeListStudent.length > 6 ||
           this.activeListStudent.length < 3
         ) {
-          this.$message.error("线上技能班必须为3-5人");
+          this.$message.error("线上技能班必须为3-6人");
           return;
         }
         this.teacherForm.expectStudentNum = this.activeListStudent.length;
@@ -1252,11 +1250,6 @@ export default {
           obj.name = this.newClassForm.className;
           obj.type = this.newClassForm.type;
           obj.groupType = "MUSIC";
-          // if (this.newClassForm.memo.length > 0) {
-          //   obj.memo = this.newClassForm.memo.join(',')
-          // } else {
-          //   obj.memo = null
-          // }
 
           obj.expectStudentNum = this.newClassForm.expectStudentNum;
           obj.teacherMapperList = [];
@@ -1273,8 +1266,8 @@ export default {
             }
           } else {
             subjectIdList =
-              this.newClassForm.subjectIdList.length > 0
-                ? this.newClassForm.subjectIdList.join(",")
+              this.newClassForm.memo.length > 0
+                ? this.newClassForm.memo.join(",")
                 : null;
             for (let i in this.newClassForm.teaching) {
               obj.teacherMapperList.push({
@@ -1282,7 +1275,7 @@ export default {
                 teacherRole: "TEACHING",
               });
             }
-            obj.memo = null;
+            obj.memo = subjectIdList;
           }
           obj.subjectIdList = subjectIdList;
           createClass(obj).then((res) => {
@@ -1422,11 +1415,50 @@ export default {
     closeStudentReset() {
       this.studentResetVisiable = false;
     },
+        changeMemo(val) {
+      // 声部id
+      let flag = false;
+      if (val.length < 1) {
+        this.soundList.forEach((sound) => {
+          sound.disabled = false;
+          this.appoint = false;
+        });
+      } else {
+        this.soundList.forEach((sound) => {
+          if (sound.id == val[0]) {
+            if (
+              sound.name.indexOf("上低音号") > -1 ||
+              sound.name.indexOf("长号") > -1
+            ) {
+              // 要么选中长号  要么选中上低音号
+              sound.disabled = false;
+              flag = true;
+            } else {
+              sound.disabled = true;
+              this.appoint = true;
+            }
+          }
+        });
+        if (flag) {
+          this.soundList.forEach((sound) => {
+            if (
+              sound.name.indexOf("上低音号") > -1 ||
+              sound.name.indexOf("长号") > -1
+            ) {
+              // 要么选中长号  要么选中上低音号
+              sound.disabled = false;
+            } else {
+              sound.disabled = true;
+            }
+          });
+        }
+      }
+    },
   },
   watch: {
     "newClassForm.type"() {
       if (this.newClassForm.type === "HIGH_ONLINE") {
-        this.$set(this.newClassForm, "expectStudentNum", 5);
+        this.$set(this.newClassForm, "expectStudentNum", 6);
       }
     },
     infoVisible(val) {