Просмотр исходного кода

Merge branch '03/23resetCourse' into test

wolyshaw 4 лет назад
Родитель
Сommit
e2c97dced9

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/index.html


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/static/css/chunk-4b30b3d5.040d52bc.css


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/static/css/chunk-5959964b.41925c33.css


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/static/css/chunk-731212d2.d096f67c.css


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/static/css/chunk-7eaac516.cba53b68.css


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/static/css/chunk-ba295c5c.4c07d1ea.css


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/static/js/app.cb105751.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/static/js/chunk-4b30b3d5.d9a29126.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/static/js/chunk-5959964b.5ad92105.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/static/js/chunk-731212d2.50218369.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/static/js/chunk-7eaac516.dd1e657f.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/static/js/chunk-ba295c5c.f5837c93.js


+ 1 - 1
src/views/resetTeaming/modals/subject-preview.vue

@@ -1,7 +1,7 @@
 <template>
     <div style="background: #F3F4F8;">
         <div class="noticeInfo">
-			<h2>缴费说明</h2>
+			<h2>注册说明</h2>
             1、您注册时所选择的乐团声部,即为乐团录取最终确认的声部,请您务必仔细填写;<br />
 			2、为避免因部分已注册家长放弃名额导致乐团声部失衡,系统设定各声部限额放大20%比例开放注册,系统自动按照完全完成注册的先后顺序确认录取名单,因此,超员后有可能出现无法注册的情况,请您理解。如果其他声部仍有名额,在您孩子的身体条件适合该乐器的前提下,我们将优先予以调配。
 		</div>

+ 146 - 0
src/views/teamDetail/components/modals/classroom-preview.vue

@@ -0,0 +1,146 @@
+<template>
+  <div>
+    <el-form inline>
+      <el-form-item label="主教老师:">{{coreTeacherName}}</el-form-item>
+      <el-form-item label="助教老师:" v-if="assistantName">{{assistantName}}</el-form-item>
+    </el-form>
+    <el-table
+      :header-cell-style="{background:'#EDEEF0',color:'#444'}"
+      :data="typelist"
+    >
+      <el-table-column
+        label="课程类型"
+        prop="name"
+      ></el-table-column>
+      <el-table-column
+        label="课时数"
+        prop="surplus"
+      ></el-table-column>
+      <el-table-column
+        label="总排课时长(分钟)"
+        prop="courseTotalMinuties"
+      ></el-table-column>
+      <el-table-column
+        label="剩余时长(分钟)"
+        prop="surplusTime"
+      ></el-table-column>
+    </el-table>
+    <div style="color: red;font-weight: bold;margin: 20px 0;">确认排课后剩余时长将被系统删除,不可排课</div>
+    <el-table
+      :header-cell-style="{background:'#EDEEF0',color:'#444'}"
+      :data="details"
+      max-height="300px"
+    >
+      <el-table-column
+        label="课程类型"
+        prop="type"
+      >
+        <span slot-scope="scope">{{courseTypeListByName[scope.row.type]}}</span>
+      </el-table-column>
+      <el-table-column
+        label="开始时间"
+        prop="startClassTime"
+      ></el-table-column>
+      <el-table-column
+        label="课程时长(分钟)"
+        key="time"
+      >
+        <span slot-scope="scope">{{getTimers(scope.row)}}</span>
+      </el-table-column>
+    </el-table>
+  </div>
+</template>
+
+<script>
+import { diffTimerFormMinute } from '@/utils/date'
+import dayjs from 'dayjs';
+export default {
+  props: {
+    types: {
+      type: Object,
+      default: {}
+    },
+    details: {
+      type: Array,
+      default: []
+    },
+    courseTypeListByName: {
+      type: Object,
+      default: {}
+    },
+    teacherList: {
+      type: Array,
+      default: []
+    },
+    cooperationList: {
+      type: Array,
+      default: []
+    },
+    coreTeacher: {
+      type: String
+    },
+    assistant: {
+      type: Array,
+      default: []
+    },
+  },
+  computed: {
+    coreTeacherName() {
+      let name = ''
+      for (const item of this.teacherList) {
+        if (this.coreTeacher == item.id) {
+          name = item.realName
+          break
+        }
+      }
+      return name
+    },
+    assistantName() {
+      let names = []
+      for (const item of this.cooperationList) {
+        if (this.assistant.includes(item.id)) {
+          names.push(item.realName)
+        }
+      }
+      return names.join(' ')
+    },
+    typelist() {
+      const list = []
+      for (const key in this.types) {
+        if (Object.hasOwnProperty.call(this.types, key)) {
+          const item = this.types[key];
+          let surplusTime = 0
+          let surplus = 0
+          for (const ke of item.cycle) {
+            surplus += parseFloat(ke.expectCourseNum)
+            surplusTime += (parseFloat(ke.expectCourseNum) * parseFloat(ke.time))
+          }
+          surplusTime = item.courseTotalMinuties - surplusTime
+          list.push({
+            name: this.courseTypeListByName[key],
+            cycles: item.cycle.length,
+            courseTotalMinuties: item.courseTotalMinuties,
+            surplus,
+            surplusTime
+          })
+        }
+      }
+      return list
+    }
+  },
+  mounted() {
+    console.log(this)
+  },
+  methods: {
+    getTimers (item) {
+      const time = diffTimerFormMinute(dayjs(item.classDate).format('YYYY-MM-DD'), dayjs(item.startClassTime).format('HH:mm'), dayjs(item.endClassTime).format('HH:mm'))
+      console.log(time, item)
+      return time
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+
+</style>

+ 290 - 116
src/views/teamDetail/components/modals/classroom-setting-item.vue

@@ -1,26 +1,6 @@
 <template>
   <div>
     <!-- <el-form-item
-      label="排课次数"
-      prop="courseTimes"
-    >
-      <el-input v-model="form.courseTimes" placeholder="请输入排课次数"/>
-    </el-form-item> -->
-    <el-form-item
-      label="排课起始时间"
-      label-width="112px"
-      :prop="'classs.' + type + '.courseTime'"
-      :rules="[{ required: true, message: '请选择排课起始时间' }]"
-    >
-      <el-date-picker v-model.trim="form.courseTime"
-        :picker-options="pickerOptions"
-        style="width:100%!important;"
-        type="date"
-        value-format="yyyy-MM-dd"
-        placeholder="选择日期">
-      </el-date-picker>
-    </el-form-item>
-    <el-form-item
       label="跳过节假日"
       :prop="'classs.' + type + '.holiday'"
       :rules="[{ required: true, message: '否跳过节假日' }]"
@@ -29,111 +9,212 @@
         <el-radio :label="true">是</el-radio>
         <el-radio :label="false">否</el-radio>
       </el-radio-group>
-    </el-form-item>
-    <el-table
-      v-if="form && form.cycle"
-      :data="form.cycle"
-    >
-      <el-table-column
-        prop="dayOfWeek"
-        label="循环周期"
-        width="160">
+    </el-form-item> -->
+    <el-table v-if="form && form.cycle" :data="form.cycle">
+      <el-table-column prop="time" label="课程时长(分)" width="160">
         <template slot-scope="scope">
           <el-form-item
+            :prop="'classs.' + type + '.cycle.' + scope.$index + '.time'"
+            :rules="[{ required: true, message: '请选择课程时长' }]"
             inline-message
-            :rules="[{ required: true, message: '请选择循环周期' }]"
-            :prop="'classs.' + type + '.cycle.' + scope.$index + '.dayOfWeek'"
           >
-            <el-select v-model.trim="scope.row.dayOfWeek"
-              style="width:100%!important"
-              placeholder="请选择循环周期"
+            <el-select
+              v-model.trim="scope.row.time"
+              style="width: 100% !important"
+              placeholder="请选择课程时长"
               clearable
-              filterable>
-              <el-option v-for="(item,index) in weekDateList"
+              :disabled="!!selectPrice"
+              @change="
+                (val) => {
+                  startTimeChange(scope, val);
+                }
+              "
+              filterable
+            >
+              <el-option
+                v-for="(item, index) in pricesArray"
                 :key="index"
-                :label="item.label"
-                :value="item.value">
+                :disabled="
+                  surplustime + (parseFloat(scope.row.time) || 0) < item
+                "
+                :label="item"
+                :value="item"
+              >
               </el-option>
             </el-select>
+            <!-- <el-input disabled v-model="scope.row.time" placeholder="请输入课程时长"/> -->
           </el-form-item>
         </template>
       </el-table-column>
-      <el-table-column
-        prop="time"
-        label="课程时长(分)"
-        width="160">
+      <el-table-column label="预计课时数" width="160">
         <template slot-scope="scope">
+          <!--   -->
           <el-form-item
-            :prop="'classs.' + type + '.cycle.' + scope.$index + '.time'"
-            :rules="[{ required: true, message: '请选择课程时长' }]"
-            inline-message>
-            <el-select v-model.trim="scope.row.time"
-              style="width:100%!important"
-              placeholder="请选择课程时长"
+            :prop="
+              'classs.' + type + '.cycle.' + scope.$index + '.expectCourseNum'
+            "
+            :rules="[
+              { required: true, message: '请输入预计课时数' },
+              { pattern: /^\+?[1-9]\d*$/, message: '请输入大于0的正整数' },
+            ]"
+            inline-message
+          >
+            <el-input
+              type="number"
+              v-model.trim="scope.row.expectCourseNum"
+              placeholder="请输入预计课数"
+              style="width: 130px !important"
+              @input="(val)=>{getUseTime(scope.row)}"
+            >
+            </el-input>
+          </el-form-item>
+        </template>
+      </el-table-column>
+      <el-table-column prop="dayOfWeek" label="循环周期" width="160">
+        <template slot-scope="scope">
+          <el-form-item
+            inline-message
+            :rules="[{ required: true, message: '请选择循环周期' }]"
+            :prop="'classs.' + type + '.cycle.' + scope.$index + '.dayOfWeek'"
+          >
+            <el-select
+              v-model.trim="scope.row.dayOfWeek"
+              style="width: 100% !important"
+              placeholder="请选择循环周期"
               clearable
-              :disabled="!!selectPrice"
-              @change="startTimeChange(scope.row)"
-              filterable>
-              <el-option v-for="(item,index) in pricesArray"
+              filterable
+              @change="(val)=>{getUseTime(scope.row)}"
+            >
+              <el-option
+                v-for="(item, index) in weekDateList"
                 :key="index"
-                :disabled="(surplustime + (parseFloat(scope.row.time) || 0)) < item"
-                :label="item"
-                :value="item">
+                :label="item.label"
+                :value="item.value"
+              >
               </el-option>
             </el-select>
-            <!-- <el-input disabled v-model="scope.row.time" placeholder="请输入课程时长"/> -->
           </el-form-item>
         </template>
       </el-table-column>
-      <el-table-column
-        prop="startClassTime"
-        label="开始时间"
-        width="160">
+
+      <el-table-column prop="startClassTime" label="开始时间" width="160">
         <template slot-scope="scope">
           <el-form-item
-            :prop="'classs.' + type + '.cycle.' + scope.$index + '.startClassTime'"
+            :prop="
+              'classs.' + type + '.cycle.' + scope.$index + '.startClassTime'
+            "
             :rules="[{ required: true, message: '请选择开始时间' }]"
-            inline-message>
-            <el-time-picker style="width: 100%!important;"
+            inline-message
+          >
+            <el-time-picker
+              style="width: 100% !important"
               v-model.trim="scope.row.startClassTime"
-              format='HH:mm'
-              value-format='HH:mm'
+              format="HH:mm"
+              value-format="HH:mm"
               placeholder="请选择时间"
-              @change="startTimeChange(scope.row)"
+              @change="timeChange(scope.row)"
               :picker-options="{
-                selectableRange: ['04:30:00 - 23:59:59']
-              }">
+                selectableRange: ['04:30:00 - 23:59:59'],
+              }"
+            >
+              <!--   @change="startTimeChange(scope.row)" -->
             </el-time-picker>
           </el-form-item>
         </template>
       </el-table-column>
-      <el-table-column
-        prop="endClassTime"
-        label="结束时间"
-        width="160">
+      <el-table-column prop="endClassTime" label="结束时间" width="160">
         <template slot-scope="scope">
           <el-form-item
-            :prop="'classs.' + type + '.cycle.' + scope.$index + '.endClassTime'"
-            inline-message>
-            <el-time-picker style="width: 100%!important;"
+            :prop="
+              'classs.' + type + '.cycle.' + scope.$index + '.endClassTime'
+            "
+            inline-message
+          >
+            <el-time-picker
+              style="width: 100% !important"
               v-model.trim="scope.row.endClassTime"
-              format='HH:mm'
+              format="HH:mm"
               disabled
-              value-format='HH:mm'
+              value-format="HH:mm"
               placeholder="请选择时间"
               :picker-options="{
-                selectableRange: [scope.row.startClassTime + ':00 - 23:59:59']
-              }">
+                selectableRange: [scope.row.startClassTime + ':00 - 23:59:59'],
+              }"
+            >
             </el-time-picker>
           </el-form-item>
         </template>
       </el-table-column>
-      <el-table-column
-        prop="date"
-        label=""
-        >
+      <el-table-column label="排课起始时间" width="170">
         <template slot-scope="scope">
-          <i @click="remove(scope.$index)" v-if="form.cycle.length > 1" class="close-icon el-icon-circle-close"></i>
+          <el-form-item
+            inline-message
+            :prop="'classs.' + type + '.cycle.' + scope.$index + '.startDate'"
+            :rules="[{ required: true, message: '请选择排课起始时间' }]"
+          >
+            <el-date-picker
+              v-model.trim="scope.row.startDate"
+              :picker-options="pickerOptions"
+              style="width: 100% !important"
+              type="date"
+              value-format="yyyy-MM-dd"
+              placeholder="选择日期"
+              @change="
+                (val) => {
+                  changeStartDate(val, scope.row);
+                }
+              "
+            >
+            </el-date-picker>
+          </el-form-item>
+        </template>
+      </el-table-column>
+      <el-table-column label="排课结束时间" width="170">
+        <template slot-scope="scope">
+          <el-form-item
+            inline-message
+            :prop="'classs.' + type + '.cycle.' + scope.$index + '.endDate'"
+            :rules="[{ required: true, message: '请选择排课结束时间' }]"
+          >
+            <el-date-picker
+              v-model.trim="scope.row.endDate"
+              :disabled="true"
+              :picker-options="pickerOptions"
+              style="width: 100% !important"
+              type="date"
+              value-format="yyyy-MM-dd"
+              placeholder="选择日期"
+            >
+            </el-date-picker>
+          </el-form-item>
+        </template>
+      </el-table-column>
+      <el-table-column label="是否跳过节假日" width="160">
+        <template slot-scope="scope">
+          <el-form-item
+            :prop="'classs.' + type + '.cycle.' + scope.$index + '.holiday'"
+            :rules="[{ required: true, message: '请选择是否跳过节假日' }]"
+            inline-message
+          >
+            <el-select
+              v-model.trim="scope.row.holiday"
+              style="width: 100% !important"
+              placeholder="是否跳过节假日"
+              filterable
+            >
+              <el-option label="是" :value="true"></el-option>
+              <el-option label="否" :value="false"> </el-option>
+            </el-select>
+          </el-form-item>
+        </template>
+      </el-table-column>
+      <el-table-column prop="date" width="50px">
+        <template slot-scope="scope">
+          <i
+            @click="remove(scope.$index, scope)"
+            v-if="form.cycle.length > 1"
+            class="close-icon el-icon-circle-close"
+          ></i>
         </template>
       </el-table-column>
     </el-table>
@@ -142,37 +223,43 @@
       type="info"
       size="small"
       plain
-      :disabled="surplustime < ((selectPrice || 0) || Math.min(...pricesArray))"
+      :disabled="surplustime < (selectPrice || 0 || Math.min(...pricesArray))"
       @click="create"
-      style="margin-top: 10px;width: 100%;"
-    >添加循环</el-button>
+      style="margin-top: 10px; width: 100%"
+      >添加循环</el-button
+    >
   </div>
 </template>
 <script>
-import { diffTimerFormMinute, addTimerFormMinute } from '@/utils/date'
-import { classTimeList } from '@/utils/searchArray'
-import dayjs from 'dayjs'
+import { diffTimerFormMinute, addTimerFormMinute } from "@/utils/date";
+import { classTimeList } from "@/utils/searchArray";
+import dayjs from "dayjs";
 
-const classTimeListByType = {}
+const classTimeListByType = {};
 for (const item of classTimeList) {
-  classTimeListByType[item.value] = item.label
+  classTimeListByType[item.value] = item.label;
 }
 
 export default {
-  props: ['form', 'type', 'surplustime', 'prices', 'selectPrice'],
+  props: ["form", "type", "surplustime", "prices", "selectPrice"],
   data() {
     return {
       classTimeListByType,
-    }
+      useTime: 0,
+    };
+  },
+  mounted() {
+    // console.log("surplustime", this.surplustime);
+    console.log(this.form.cycle);
   },
   computed: {
     pickerOptions() {
       return {
         firstDayOfWeek: 1,
-        disabledDate (time) {
+        disabledDate(time) {
           return time.getTime() + 86400000 <= new Date().getTime();
-        }
-      }
+        },
+      };
     },
     weekDateList() {
       return [
@@ -182,39 +269,126 @@ export default {
         { value: "4", label: "星期四" },
         { value: "5", label: "星期五" },
         { value: "6", label: "星期六" },
-        { value: "7", label: "星期日" }
-      ]
+        { value: "7", label: "星期日" },
+      ];
     },
     pricesArray() {
-      return (this.prices[this.type] || '').split(',').filter(item => !!item)
-    }
+      return (this.prices[this.type] || "").split(",").filter((item) => !!item);
+    },
   },
   methods: {
+    updateUseTime() {
+      let time = 0
+        for (const item of this.form.cycle) {
+          time += (item.time || 0) * (item.expectCourseNum || 0)
+        }
+
+        this.$emit('setUserTime', time, this.type)
+    },
     create() {
-      const initVal = {}
+      if(this.surplustime<=this.useTime){
+        this.$message.error('已排课时长使用完毕,请修改预计课时数')
+        return
+      }
+      const initVal = {};
       if (this.selectPrice) {
-        initVal.time = this.selectPrice
+        initVal.time = this.selectPrice;
       }
-      this.form.cycle.push(initVal)
+      this.form.cycle.push(initVal);
+      this.updateUseTime()
     },
+
     remove(index) {
-      this.form.cycle.splice(index, 1)
+      this.form.cycle.splice(index, 1);
+      this.updateUseTime()
+    },
+    startTimeChange(item, val) {
+      if (item.row.time && item.row.startClassTime) {
+        let str = dayjs(new Date()).format("YYYY-MM-DD");
+        this.$set(
+          item,
+          "endClassTime",
+          addTimerFormMinute(str, item.row.startClassTime, item.row.time)
+        );
+      } else {
+        this.$set(item.row, "endClassTime", "");
+      }
+      if (val) {
+        this.$set(
+          item.row,
+          "expectCourseNum",
+          parseInt((this.surplustime - this.useTime) / val)
+        );
+        // this.surplusTime
+      } else {
+        this.$set(item.row, "expectCourseNum", 0);
+      }
+      this.getUseTime();
     },
-    startTimeChange(item) {
+    timeChange(item) {
       if (item.time && item.startClassTime) {
-        let str = dayjs(new Date()).format('YYYY-MM-DD')
-        this.$set(item, 'endClassTime', addTimerFormMinute(str, item.startClassTime, item.time))
+        let str = dayjs(new Date()).format("YYYY-MM-DD");
+        this.$set(
+          item,
+          "endClassTime",
+          addTimerFormMinute(str, item.startClassTime, item.time)
+        );
       } else {
-        this.$set(item, 'endClassTime', '')
+        this.$set(item, "endClassTime", "");
+      }
+      this.updateUseTime()
+    },
+    getUseTime(row) {
+      if(row){
+          this.$set(
+          row,
+          "startDate",
+          ''
+        );
+             this.$set(
+          row,
+          "endDate",
+          ''
+        );
       }
-    }
+      this.useTime = 0;
+      this.form.cycle.forEach((item) => {
+        this.useTime +=
+          (item.expectCourseNum ? parseInt(item.expectCourseNum) : 0) *
+          parseInt(item.time);
+      });
+      this.updateUseTime()
+    //  this.$emit('setUserTime', this.useTime, this.type)
+    },
+    changeStartDate(val, row) {
+      if (row.dayOfWeek && val&&row.expectCourseNum) {
+        let num;
+        let dayjs = this.$helpers.dayjs
+        let date = dayjs(val).toDate();
+        row.dayOfWeek - date.getDay() >= 0
+          ? (num = row.dayOfWeek - date.getDay())
+          : (num = row.dayOfWeek - date.getDay() + 7);
+          this.$set(
+          row,
+          "endDate",
+         dayjs(val).add(num+(row.expectCourseNum*7), 'day').format('YYYY-MM-DD')
+        );
+      }else{
+this.$set(
+          row,
+          "endDate",
+         ''
+        );
+      }
+      this.updateUseTime()
+    },
   },
-}
+};
 </script>
 <style lang="less" scoped>
-  /deep/ .close-icon{
-    cursor: pointer;
-    font-size: 16px;
-    margin-bottom: 24px;
-  }
+/deep/ .close-icon {
+  cursor: pointer;
+  font-size: 16px;
+  margin-bottom: 24px;
+}
 </style>

+ 93 - 22
src/views/teamDetail/components/modals/classroom-setting.vue

@@ -93,11 +93,15 @@
           <template #title>
             <p class="title">
               {{ courseTypeListByName[key] }},
-              <span>可排课时长{{ musicCourseSettings[key] }}分钟</span>
+              <span>可排课时长:{{ musicCourseSettings[key] }}分钟</span>
+              <span style="color: #333"
+                >已排课时长:{{ musicSurplus[key] }}分钟</span
+              >
             </p>
           </template>
           <courseItem
             :surplustime="surplustime[key]"
+            @setUserTime="setUserTime"
             :type="key"
             :form="item"
             :prices="prices"
@@ -112,6 +116,28 @@
         >确 定</el-button
       >
     </div>
+    <el-dialog
+      title="班级预览"
+      :visible.sync="previewVisible"
+      append-to-body
+      width="650px"
+    >
+      <classrome-preview
+        :types="form.classs"
+        :details="previewList"
+        :courseTypeListByName="courseTypeListByName"
+        :teacherList="teacherList"
+        :cooperationList="cooperationList"
+        :coreTeacher="form.coreTeacher"
+        :assistant="form.assistant"
+      />
+      <div slot="footer" class="dialog-footer" v-if="classType != 5">
+        <el-button @click="previewVisible = false">取 消</el-button>
+        <el-button type="primary" @click="submit('confirmGenerate')"
+          >确 定</el-button
+        >
+      </div>
+    </el-dialog>
   </div>
 </template>
 <script>
@@ -128,6 +154,7 @@ import { classTimeList } from "@/utils/searchArray";
 import MusicStore from "@/views/resetTeaming/store";
 import { queryByOrganIdAndCourseType } from "@/views/resetTeaming/api";
 import { isEmpty } from "lodash";
+import classromePreview from './classroom-preview'
 
 const classTimeListByType = {};
 for (const item of classTimeList) {
@@ -173,6 +200,7 @@ export default {
   ],
   components: {
     courseItem,
+    'classrome-preview': classromePreview
   },
   data() {
     return {
@@ -188,6 +216,9 @@ export default {
       courseTypeListByName: {},
       classTimeListByType,
       musicCourseSettings: {},
+      musicSurplus: {},
+      previewVisible: false,
+      previewList: [],
     };
   },
   watch: {
@@ -207,7 +238,8 @@ export default {
       for (const key in this.form.classs) {
         if (this.form.classs.hasOwnProperty(key)) {
           const item = this.form.classs[key];
-          _[key] = item.courseTotalMinuties - plusNum(item.cycle, "time");
+          // - plusNum(item.cycle, "time");
+          _[key] = item.courseTotalMinuties;
         }
       }
       return _;
@@ -282,7 +314,9 @@ export default {
       // console.log(res);
       if (Object.keys(res).length <= 0) return;
       this.musicCourseSettings = res.data;
-
+      for (let key in this.musicCourseSettings) {
+        this.musicSurplus[key] = 0;
+      }
       const classs = {};
       for (const item of this.courseTypeList) {
         const key = item.value;
@@ -310,14 +344,25 @@ export default {
       }
       this.$set(this.form, "classs", clas);
     },
-    submit() {
+    submit(type) {
+      for (const key in this.musicCourseSettings) {
+        if (Object.hasOwnProperty.call(this.musicCourseSettings, key)) {
+          const allTime = this.musicCourseSettings[key];
+          const useTime = this.musicSurplus[key]
+
+          if (useTime > allTime) {
+            this.$message.error(this.courseTypeListByName[key] + ' 课程时长不足')
+            return
+          }
+        }
+      }
       this.$refs.form.validate(async (valid) => {
         if (valid) {
           const list = [];
           for (const key in this.form.classs) {
             if (this.form.classs.hasOwnProperty(key)) {
               const item = this.form.classs[key];
-              list.push({
+              const data = {
                 type: this.detail ? undefined : this.activeType,
                 courseType: key,
                 classGroupName:
@@ -335,35 +380,42 @@ export default {
                 students: this.studentSubmitedData?.seleched,
                 courseTimes: item.cycle.length,
                 courseTimeDtoList: item.cycle.map((_) => ({
+
                   courseType: key,
                   dayOfWeek: _.dayOfWeek,
                   endClassTime: _.endClassTime,
                   startClassTime: _.startClassTime,
+                  startDate:_.startDate,
+                  endDate:_.endDate,
+                  expectCourseNum:_.expectCourseNum
                 })),
-              });
+              }
+              if (type && typeof type === 'string') {
+                data[type] = true
+              }
+              list.push(data);
             }
           }
           try {
             if (this.detail) {
               let result = await classGroupUpdate(list);
-              if (result.code == 206) {
-                this.$confirm(`当前课程课酬预计为0,是否继续`, "提示", {
-                  confirmButtonText: "确定",
-                  cancelButtonText: "取消",
+              this.previewVisible = false
+              if (result.code == 207) {
+                await this.$confirm((result.msg || `当前课程课酬预计为0,是否继续`), "提示", {
                   type: "warning",
                 })
-                  .then(async () => {
-                    // obj.allowZeroSalary = true;
-                    list.forEach((item) => {
-                      item.allowZeroSalary = true;
-                    });
-                    await classGroupUpdate(list);
-                    this.$listeners.submited();
-                    this.$listeners.close();
-                  })
-                  .catch(() => {
-                    return;
-                  });
+                // obj.allowZeroSalary = true;
+                list.forEach((item) => {
+                  item.allowZeroSalary = true;
+                });
+                await classGroupUpdate(list);
+                this.$listeners.submited();
+                this.$listeners.close();
+                return;
+              }
+              if (result.code == 206) {
+                this.previewVisible = true
+                this.previewList = result.data
                 return;
               }
               this.$message.success("排课修改成功");
@@ -410,7 +462,26 @@ export default {
       this.collapses = val;
     },
     changecoreTeacher(val) {},
+    updateMusicSurplus() {
+
+    },
+    setUserTime(time, type) {
+      console.log(time, type)
+      this.$set(this.musicSurplus, type, (time || 0))
+      console.log(this.musicSurplus)
+       this.$forceUpdate()
+      // this.$nextTick(res=>{
+      //   this.musicSurplus[type] = time;
+      //       console.log(this.musicSurplus[type])
+      // })
+
+    },
   },
+  // watch:{
+  //   musicSurplus(){
+  //     deep
+  //   }
+  // }
 };
 </script>
 <style lang="less" scoped>

+ 2 - 2
src/views/teamDetail/components/resetClass.vue

@@ -230,8 +230,8 @@
     </el-dialog>
     <!-- 老师以及课程设置 -->
     <el-dialog
-      title="班级设置"
-      width="950px"
+      title="班级排课"
+      width="1400px"
       :visible.sync="infoVisible"
       :modal-append-to-body="false"
     >

Некоторые файлы не были показаны из-за большого количества измененных файлов