Browse Source

Merge branch '03/23resetCourse' into test

Xiao_Mo 4 years ago
parent
commit
3b2ea5f4ad

+ 19 - 4
src/views/teamDetail/components/modals/classroom-setting-item.vue

@@ -15,7 +15,9 @@
         <template slot-scope="scope">
           <div>
             <el-form-item
-              :prop="'classs.' + type + '.cycle.' + scope.$index + '.coreTeacher'"
+              :prop="
+                'classs.' + type + '.cycle.' + scope.$index + '.coreTeacher'
+              "
               label-width="88px"
               :rules="[{ required: true, message: '请选择主教老师' }]"
             >
@@ -25,7 +27,7 @@
                 clearable
                 filterable
               >
-              <!--     @change="changecoreTeacher" -->
+                <!--     @change="changecoreTeacher" -->
                 <el-option
                   v-for="(item, index) in teacherList"
                   :key="index"
@@ -40,7 +42,10 @@
               v-if="
                 activeType != 'HIGH' &&
                 activeType != 'HIGH_ONLINE' &&
-                activeType != 'MUSIC_NETWORK'
+                activeType != 'MUSIC_NETWORK' &&
+                type != 'HIGH' &&
+                type != 'HIGH_ONLINE' &&
+                type != 'MUSIC_NETWORK'
               "
             >
               <!-- <remote-search :commit="'setTeachers'" v-model="form.assistant"  :multiple='true'/> -->
@@ -268,7 +273,17 @@ for (const item of classTimeList) {
 }
 
 export default {
-  props: ["form", "type", "surplustime", "prices", "selectPrice", "holidays","teacherList","activeType",'cooperationList'],
+  props: [
+    "form",
+    "type",
+    "surplustime",
+    "prices",
+    "selectPrice",
+    "holidays",
+    "teacherList",
+    "activeType",
+    "cooperationList",
+  ],
   data() {
     return {
       classTimeListByType,

+ 53 - 48
src/views/teamDetail/components/modals/classroom-setting.vue

@@ -102,9 +102,9 @@
           <courseItem
             :surplustime="surplustime[key]"
             @setUserTime="setUserTime"
-             :teacherList="teacherList"
-             :activeType="activeType"
-              :cooperationList="cooperationList"
+            :teacherList="teacherList"
+            :activeType="activeType"
+            :cooperationList="cooperationList"
             :type="key"
             :form="item"
             :prices="prices"
@@ -156,10 +156,10 @@ import {
 import courseItem from "./classroom-setting-item";
 import { classTimeList } from "@/utils/searchArray";
 import MusicStore from "@/views/resetTeaming/store";
-import { sysConfigList } from '@/api/generalSettings'
+import { sysConfigList } from "@/api/generalSettings";
 import { queryByOrganIdAndCourseType } from "@/views/resetTeaming/api";
 import { isEmpty } from "lodash";
-import classromePreview from './classroom-preview'
+import classromePreview from "./classroom-preview";
 
 const classTimeListByType = {};
 for (const item of classTimeList) {
@@ -205,7 +205,7 @@ export default {
   ],
   components: {
     courseItem,
-    'classrome-preview': classromePreview
+    "classrome-preview": classromePreview,
   },
   data() {
     return {
@@ -269,15 +269,15 @@ export default {
     } catch (error) {}
     this.setCourseTypeListByName();
     this.formatClasss();
-    this.FetchHoliday()
+    this.FetchHoliday();
   },
   methods: {
     async FetchHoliday() {
       try {
         const res = await sysConfigList({
-          group: 'holiday'
-        })
-        this.holidays = JSON.parse(res.data[0].paranValue)
+          group: "holiday",
+        });
+        this.holidays = JSON.parse(res.data[0].paranValue);
       } catch (error) {}
     },
     setCourseTypeListByName() {
@@ -288,9 +288,9 @@ export default {
       this.courseTypeListByName = courseTypeListByName;
     },
     async formatClasss() {
+      let coreid = "";
+      const assistant = [];
       if (this.detail) {
-        let coreid = "";
-        const assistant = [];
         const { classGroupTeacherMapperList } = this.detail;
         for (const item of classGroupTeacherMapperList || []) {
           if (item.teacherRole === "BISHOP") {
@@ -341,6 +341,8 @@ export default {
             cycle: [
               {
                 time: this.selectPrices ? this.selectPrices[key] : undefined,
+                coreTeacher: coreid,
+                assistant: assistant,
               },
             ],
           };
@@ -363,11 +365,13 @@ export default {
       for (const key in this.musicCourseSettings) {
         if (Object.hasOwnProperty.call(this.musicCourseSettings, key)) {
           const allTime = this.musicCourseSettings[key];
-          const useTime = this.musicSurplus[key]
+          const useTime = this.musicSurplus[key];
 
           if (useTime > allTime) {
-            this.$message.error(this.courseTypeListByName[key] + ' 课程时长不足')
-            return
+            this.$message.error(
+              this.courseTypeListByName[key] + " 课程时长不足"
+            );
+            return;
           }
         }
       }
@@ -395,19 +399,19 @@ export default {
                 students: this.studentSubmitedData?.seleched,
                 courseTimes: item.cycle.length,
                 courseTimeDtoList: item.cycle.map((_) => ({
-                  classGroupTeacherMapperList:this.formatTeacher(_),
+                  classGroupTeacherMapperList: this.formatTeacher(_),
                   courseType: key,
                   dayOfWeek: _.dayOfWeek,
                   endClassTime: _.endClassTime,
                   startClassTime: _.startClassTime,
-                  startDate:_.startDate,
-                  endDate:_.endDate,
+                  startDate: _.startDate,
+                  endDate: _.endDate,
                   holiday: _.holiday,
-                  expectCourseNum:_.expectCourseNum
+                  expectCourseNum: _.expectCourseNum,
                 })),
-              }
-              if (type && typeof type === 'string') {
-                data[type] = true
+              };
+              if (type && typeof type === "string") {
+                data[type] = true;
               }
               list.push(data);
             }
@@ -415,11 +419,15 @@ export default {
           try {
             if (this.detail) {
               let result = await classGroupUpdate(list);
-              this.previewVisible = false
+              this.previewVisible = false;
               if (result.code == 207) {
-                await this.$confirm((result.msg || `当前课程课酬预计为0,是否继续`), "提示", {
-                  type: "warning",
-                })
+                await this.$confirm(
+                  result.msg || `当前课程课酬预计为0,是否继续`,
+                  "提示",
+                  {
+                    type: "warning",
+                  }
+                );
                 // obj.allowZeroSalary = true;
                 list.forEach((item) => {
                   item.allowZeroSalary = true;
@@ -430,8 +438,8 @@ export default {
                 return;
               }
               if (result.code == 206) {
-                this.previewVisible = true
-                this.previewList = result.data
+                this.previewVisible = true;
+                this.previewList = result.data;
                 return;
               }
               this.$message.success("排课修改成功");
@@ -478,36 +486,33 @@ export default {
       this.collapses = val;
     },
     changecoreTeacher(val) {},
-    updateMusicSurplus() {
-
-    },
+    updateMusicSurplus() {},
     setUserTime(time, type) {
       // console.log(time, type)
-      this.$set(this.musicSurplus, type, (time || 0))
+      this.$set(this.musicSurplus, type, time || 0);
       // console.log(this.musicSurplus)
-       this.$forceUpdate()
+      this.$forceUpdate();
       // this.$nextTick(res=>{
       //   this.musicSurplus[type] = time;
       //       console.log(this.musicSurplus[type])
       // })
-
     },
-    formatTeacher(row){
-      console.log(row)
-    let arr = []
-      if(row.coreTeacher){
-           let obj ={}
-        obj.teacherRole = 'BISHOP'
-        obj.userId = row.coreTeacher
-        arr.push(obj)
+    formatTeacher(row) {
+      console.log(row);
+      let arr = [];
+      if (row.coreTeacher) {
+        let obj = {};
+        obj.teacherRole = "BISHOP";
+        obj.userId = row.coreTeacher;
+        arr.push(obj);
       }
-      if(row.assistant?.length>0){
-        row.assistant.forEach(ass=>{
-          arr.push({teacherRole:'TEACHING',userId:ass})
-        })
+      if (row.assistant?.length > 0) {
+        row.assistant.forEach((ass) => {
+          arr.push({ teacherRole: "TEACHING", userId: ass });
+        });
       }
-      return arr
-    }
+      return arr;
+    },
   },
   // watch:{
   //   musicSurplus(){