Selaa lähdekoodia

提交测试

1
mo 4 vuotta sitten
vanhempi
commit
cb2cdce51c
1 muutettua tiedostoa jossa 57 lisäystä ja 52 poistoa
  1. 57 52
      src/views/teamDetail/components/modals/classroom-setting.vue

+ 57 - 52
src/views/teamDetail/components/modals/classroom-setting.vue

@@ -112,9 +112,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"
@@ -166,10 +166,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) {
@@ -215,7 +215,7 @@ export default {
   ],
   components: {
     courseItem,
-    'classrome-preview': classromePreview
+    "classrome-preview": classromePreview,
   },
   data() {
     return {
@@ -279,15 +279,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() {
@@ -298,20 +298,20 @@ export default {
       this.courseTypeListByName = courseTypeListByName;
     },
     async formatClasss() {
+      this.coreid = "";
+      this.assistant = [];
       if (this.detail) {
-        let coreid = "";
-        const assistant = [];
         const { classGroupTeacherMapperList } = this.detail;
         for (const item of classGroupTeacherMapperList || []) {
           if (item.teacherRole === "BISHOP") {
-            coreid = String(item.userId);
+            this.coreid = String(item.userId);
           }
           if (item.teacherRole === "TEACHING") {
-            assistant.push(item.userId);
+            this.assistant.push(item.userId);
           }
         }
-        this.$set(this.form, "coreTeacher", String(coreid));
-        this.$set(this.form, "assistant", assistant);
+        this.$set(this.form, "coreTeacher", String(this.coreid));
+        this.$set(this.form, "assistant", this.assistant);
       }
       const studentIds = this.detail
         ? undefined
@@ -351,6 +351,8 @@ export default {
             cycle: [
               {
                 time: this.selectPrices ? this.selectPrices[key] : undefined,
+                coreTeacher: this.coreid,
+                assistant: this.assistant,
               },
             ],
           };
@@ -373,11 +375,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;
           }
         }
       }
@@ -405,19 +409,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);
             }
@@ -425,11 +429,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;
@@ -440,8 +448,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("排课修改成功");
@@ -488,36 +496,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(){