Browse Source

08/23 13:45

111
mo 4 years ago
parent
commit
06b75207de

+ 57 - 0
src/utils/date.js

@@ -18,4 +18,61 @@ export function getCurrentMonthLast (date) {
   var nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1);
   var oneDay = 1000 * 60 * 60 * 24;
   return new Date(nextMonthFirstDay - oneDay);
+}
+
+export function getNowDateAndMonday (time) {
+  let timestamp = new Date(time.replace(/-/g, "/")).getTime();
+  let serverDate = new Date(time);
+  if (serverDate.getDay() == 0) {
+    timestamp -= 7 * 24 * 60 * 60 * 1000;
+  }
+  let mondayTime =
+    timestamp - (serverDate.getDay() - 1) * 24 * 60 * 60 * 1000;
+
+  let mondayData = new Date(mondayTime);
+  //年
+  let mondayY = mondayData.getFullYear();
+  //月
+  let mondayM =
+    mondayData.getMonth() + 1 < 10
+      ? "0" + (mondayData.getMonth() + 1)
+      : mondayData.getMonth() + 1;
+  //日
+  let mondayD =
+    mondayData.getDate() < 10
+      ? "0" + mondayData.getDate()
+      : mondayData.getDate();
+
+  let str = mondayY + "-" + mondayM + "-" + mondayD;
+  return str;
+}
+export function getNowDateAndSunday (time) {
+  let timestamp = new Date(time.replace(/-/g, "/")).getTime();
+  let serverDate = new Date(time);
+
+  let num = 7 - serverDate.getDay();
+  if (num == 7) {
+    num = 0;
+  }
+  let sundayTiem = timestamp + num * 24 * 60 * 60 * 1000;
+  let SundayData = new Date(sundayTiem);
+  //年
+  let tomorrowY = SundayData.getFullYear(); //月
+  let tomorrowM =
+    SundayData.getMonth() + 1 < 10
+      ? "0" + (SundayData.getMonth() + 1)
+      : SundayData.getMonth() + 1;
+  //日
+  let tomorrowD =
+    SundayData.getDate() < 10
+      ? "0" + SundayData.getDate()
+      : SundayData.getDate();
+  let str = tomorrowY + "-" + tomorrowM + "-" + tomorrowD;
+  return str;
+}
+
+export function getWeekDay (str) {
+  let week = new Date(str.replace(/-/g, "/")).getDay();
+  week === 0 ? week = 7 : week
+  return week
 }

+ 1 - 1
src/views/buildVip/index.vue

@@ -330,7 +330,7 @@
                           format="HH:mm"
                           value-format="HH:mm"
                           :picker-options="{
-                            selectableRange: '00:00:00 - 23:59:00'
+                            selectableRange: '04:00:00 - 23:59:00'
                           }"
                           placeholder="选择时间" />
         </el-form-item>

+ 13 - 613
src/views/teacherManager/teacherDetail/components/calendarList.vue

@@ -33,408 +33,31 @@
 
       </template>
     </el-calendar>
-    <div class="tableWrap"
-         v-if='tableList.length>0'>
-      <el-table :data="tableList"
-                :header-cell-style="{background:'#EDEEF0',color:'#444'}">
-        <el-table-column align="center"
-                         prop="organName"
-                         label="分部名称"></el-table-column>
-        <el-table-column align="center"
-                         width="130px"
-                         prop="musicGroupId"
-                         label="乐团/课程组编号"></el-table-column>
-        <el-table-column align="center"
-                         prop="id"
-                         label="课程编号"></el-table-column>
-        <el-table-column align="center"
-                         width="200px"
-                         label="时间">
-          <template slot-scope="scope">{{ scope.row.startClassTime ? scope.row.startClassTime.substr(0, 16) : '' }}-{{ scope.row.endClassTime ? scope.row.endClassTime.substr(11,5) : ''}}</template>
-        </el-table-column>
-        <!-- <el-table-column align="center" prop="groupName" label="乐团/VIP名"></el-table-column> -->
-        <!-- <el-table-column align="center" prop="classGroupName" label="班级名称"></el-table-column> -->
-        <el-table-column align="center"
-                         prop="studentId"
-                         label="学生ID">
-          <template slot-scope="scope">
-            <div v-if="scope.row.groupType != 'MUSIC'">{{scope.row.studentId}}</div>
-          </template>
-        </el-table-column>
-        <el-table-column align="center"
-                         prop="subjectName"
-                         label="声部"></el-table-column>
-        <el-table-column align="center"
-                         prop="name"
-                         label="课程名称"></el-table-column>
-        <el-table-column align="center"
-                         label="课程类型">
-          <template slot-scope="scope">
-            <div>{{ scope.row.type | coursesType}}</div>
-          </template>
-        </el-table-column>
-        <el-table-column align="center"
-                         label="教学模式">
-          <template slot-scope="scope">
-            <div>{{ scope.row.teachMode | teachMode}}</div>
-          </template>
-        </el-table-column>
-        <el-table-column align="center"
-                         prop="schoolName"
-                         label="教学点">
-          <template slot-scope="scope">
-            <div>{{scope.row.schoolName?scope.row.schoolName:'网络教室'}}</div>
-          </template>
-        </el-table-column>
-        <el-table-column align="center"
-                         prop="courseScheduleStatus"
-                         label="课程状态">
-          <template slot-scope="scope">
-            <div>{{ scope.row.status | coursesStatus }}</div>
-          </template>
-        </el-table-column>
-        <el-table-column align="center"
-                         label="操作"
-                         fixed="right"
-                         width="180px">
-          <template slot-scope="scope">
-            <!-- v-if="permission('teamCourseList/details')" -->
-            <div>
-              <el-button v-if="!scope.row.isSettlement && permission('courseSchedule/classStartDateAdjust')&&scope.row.groupType ==='MUSIC'"
-                         type="text"
-                         @click="resetClass(scope.row)">调整</el-button>
-              <el-button v-if="!scope.row.isSettlement && permission('courseSchedule/classStartDateAdjust')&&scope.row.groupType ==='VIP'"
-                         type="text"
-                         @click="resetClass(scope.row)">调整</el-button>
-              <el-button type="text"
-                         v-if="!scope.row.isSettlement && permission('courseSchedule/practiceCourseAdjust')&&scope.row.groupType==='PRACTICE'"
-                         @click="resetClass(scope.row)">调整</el-button>
-              <el-button type="text"
-                         v-if="scope.row.groupType==='PRACTICE'&&scope.row.status == 'NOT_START'&&scope.row.practiceGroup['type']!='TRIAL'&& permission('courseSchedule/practiceCourseTeacherAdjust')"
-                         @click="resetTeacher(scope.row)">更换老师</el-button>
-            </div>
-          </template>
-        </el-table-column>
-      </el-table>
-      <pagination :total="rules.total"
-                  :page.sync="rules.page"
-                  :limit.sync="rules.limit"
-                  :page-sizes="rules.page_size"
-                  @pagination="getList" />
-    </div>
-
-    <!-- 乐团调整 -->
-    <el-dialog title="课程调整"
-               destroy-on-close
-               width="400px"
-               :visible.sync="musicVisible">
-      <el-form :model="musicForm"
-               ref="musicFormref"
-               :rules="musicRules"
-               label-position="right"
-               label-width="80px;">
-        <el-form-item label="指导老师"
-                      prop="teacher">
-          <el-select v-model.trim="musicForm.teacher"
-                     style="width:220px!important"
-                     clearable
-                     filterable>
-            <el-option v-for="(item,index) in teacherList"
-                       :key="index"
-                       :value="item.id"
-                       :label="item.realName"></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="上课日期"
-                      prop="date">
-          <el-date-picker v-model.trim="musicForm.date"
-                          type="date"
-                          :picker-options="{
-                            firstDayOfWeek:1
-                          }"
-                          value-format="yyyy-MM-dd"
-                          placeholder="选择日期"></el-date-picker>
-        </el-form-item>
-        <el-form-item label="开始时间"
-                      prop="startTime">
-          <el-time-select placeholder="起始时间"
-                          v-model="startCourseTime"
-                          @change="changeStartTime"
-                          :picker-options="{
-                            start: '04:30',
-                            step: '00:05',
-                            end: '23:30'
-                            }"></el-time-select>
-        </el-form-item>
-        <el-form-item label="结束时间"
-                      prop="endTime">
-          <el-time-select placeholder="结束时间"
-                          v-model="endCourseTime"
-                          :picker-options="{
-                            start: '04:30',
-                            step: '00:05',
-                            end: '23:30',
-                            minTime: startCourseTime
-                          }"></el-time-select>
-        </el-form-item>
-      </el-form>
-      <div slot="footer"
-           class="dialog-footer">
-        <el-button @click="musicVisible = false">取 消</el-button>
-        <el-button type="primary"
-                   @click="submitResetClass">确 定</el-button>
-      </div>
-    </el-dialog>
-    <!-- vip调整 -->
-    <el-dialog title="课程调整"
-               destroy-on-close
-               width="400px"
-               :visible.sync="vipVisible">
-      <el-form :model="vipForm"
-               ref="vipFormref"
-               :rules="vipRules"
-               label-position="right"
-               label-width="80px;"
-               :inline="true">
-        <el-form-item label="上课日期"
-                      prop="date">
-          <el-date-picker v-model.trim="vipForm.date"
-                          style="width:200px!important;"
-                          type="date"
-                          :picker-options="{
-                              firstDayOfWeek:1
-                            }"
-                          value-format="yyyy-MM-dd"
-                          placeholder="选择日期"></el-date-picker>
-        </el-form-item>
-        <el-form-item label="开始时间"
-                      prop="startCourseTime"
-                      key="time2">
-          <el-time-select placeholder="起始时间"
-                          style="width:200px!important;"
-                          v-model="startCourseTime"
-                          :picker-options="{
-                            start: '04:30',
-                            step: '00:05',
-                            end: '23:30'
-                            }"></el-time-select>
-        </el-form-item>
-        <el-form-item label="课程类型"
-                      prop="courseType">
-          <el-select clearable
-                     v-model.trim="vipForm.teachMode">
-            <el-option label="线上课"
-                       value="ONLINE"></el-option>
-            <el-option label="线下课"
-                       value="OFFLINE"></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="教学地点"
-                      v-if="vipForm.teachMode == 'OFFLINE'"
-                      prop="schoolId">
-          <el-select key='school'
-                     v-model="vipForm.schoolId"
-                     filterable
-                     clearable>
-            <el-option v-for="(item,index) in schoolList"
-                       :key="index"
-                       :value="item.id"
-                       :label="item.name"></el-option>
-          </el-select>
-        </el-form-item>
-      </el-form>
-      <div slot="footer"
-           class="dialog-footer">
-        <el-button @click="vipVisible = false">取 消</el-button>
-        <el-button type="primary"
-                   @click="submitResetVipClass">确 定</el-button>
-      </div>
-    </el-dialog>
-    <!-- 网管课调整 -->
-    <el-dialog title="课程调整"
-               destroy-on-close
-               width="400px"
-               :visible.sync="practiceVisible">
-      <el-form :model="practiceForm"
-               ref="practiceFormref"
-               :rules="practiceRules"
-               label-position="right"
-               label-width="80px;"
-               :inline="true">
-        <el-form-item label="上课日期"
-                      prop="date"
-                      v-if="practiceForm.courseType != 'TRIAL'">
-          <el-date-picker v-model.trim="practiceForm.date"
-                          style="width:200px!important;"
-                          type="date"
-                          :picker-options="courseOption"
-                          value-format="yyyy-MM-dd"
-                          placeholder="选择日期"></el-date-picker>
-        </el-form-item>
-        <el-form-item label="上课日期"
-                      prop="date"
-                      v-else>
-          <el-date-picker v-model.trim="practiceForm.date"
-                          style="width:200px!important;"
-                          type="date"
-                          value-format="yyyy-MM-dd"
-                          :picker-options="{
-        firstDayOfWeek: 1
-    }"
-                          placeholder="选择日期"></el-date-picker>
-        </el-form-item>
-        <el-form-item label="开始时间"
-                      key="time1"
-                      prop="startCourseTime">
-          <el-time-select placeholder="起始时间"
-                          style="width:200px!important;"
-                          v-model="startCourseTime"
-                          :picker-options="{
-                            start: '07:00',
-                            step: '00:05',
-                            end: '23:00'
-                            }"></el-time-select>
-        </el-form-item>
-      </el-form>
-      <div slot="footer"
-           class="dialog-footer">
-        <el-button @click="practiceVisible = false">取 消</el-button>
-        <el-button type="primary"
-                   @click="submitPracticeResetClass">确 定</el-button>
-      </div>
-    </el-dialog>
-    <!-- 老师调整 -->
-    <el-dialog title="老师调整"
-               width="400px"
-               :visible.sync="teacherVisible">
-      <el-form :model="teacherForm"
-               ref="teacherForm"
-               :rules="teacherRules"
-               label-position="right"
-               label-width="80px;"
-               :inline="true">
-        <el-form-item label="指导老师">
-          <el-select v-model.trim="teacherForm.teacher"
-                     filterable
-                     clearable>
-            <el-option v-for="(item,index) in teacherList"
-                       :key="index"
-                       :value="item.id"
-                       :label="item.realName"></el-option>
-          </el-select>
-        </el-form-item>
-      </el-form>
-      <div slot="footer"
-           class="dialog-footer">
-        <el-button @click="teacherVisible = false">取 消</el-button>
-        <el-button type="primary"
-                   @click="subresetTeacher">确 定</el-button>
-      </div>
-    </el-dialog>
+    <resetList :startTimes="fomatValue"
+               @getCalendatList='getCalendatList' />
   </div>
 </template>
 <script>
-import { superFindCourseSchedules, getTeacher, resetCourse, practiceCourseAdjus, practiceCourseTeacherAdjust } from "@/api/buildTeam";
+import { superFindCourseSchedules } from "@/api/buildTeam";
 import { setDate, getCurrentMonthFirst, getCurrentMonthLast } from "@/utils/date"
 import { getTeachSchool } from "@/api/teacherManager";
-import pagination from "@/components/Pagination/index";
+import resetList from './resetComponent'
 import { permission } from "@/utils/directivePage";
 export default {
-  components: { pagination },
+  components: { resetList },
   data () {
     return {
-      startCourseTime: '',
-      endCourseTime: '',
       dataList: [],
       value: new Date(),
       teacherIdList: '',
       vipList: [],
       teamList: [],
-      newList: [],
-      tableList: [],
-      teacherList: [],
-      schoolList: [],
-      educationList: [],
-      startTime: '',
-      endTime: '',
-      rules: {
-        // 分页规则
-        limit: 10, // 限制显示条数
-        page: 1, // 当前页
-        total: 0, // 总条数
-        page_size: [10, 20, 40, 50] // 选择限制显示条数
-      },
-      musicVisible: false,
-      vipVisible: false,
-      practiceVisible: false,
-      musicForm: {
-        teacher: "",
-        assistant: "",
-        date: "",
-        id: "",
-        startTime: "",
-        endTime: "",
-        type: "",
-      },
-      musicRules: {
-        teacher: [
-          { required: true, message: "请选择主教老师名称", trigger: "blur" }
-        ],
-        date: [{ required: true, message: "请选择上课时间", trigger: "blur" }],
-      },
-      vipForm: {
-        date: "",
-        id: "",
-        schoolId: '',
-        teachMode: ""
-      },
-      vipRules: {
-        date: [{ required: true, message: "请选择上课时间", trigger: "blur" }],
-      },
-      practiceRules: {
-        date: [{ required: true, message: "请选择上课时间", trigger: "blur" }],
-      },
-
-      practiceForm: {
-        id: '',
-        date: '',
-        courseType: '',
-        coursesExpireDate: ''
-      },
-      courseOption: null,
-      pickerOptions: {
-        firstDayOfWeek: 1,
-        disabledDate (time) {
-          return time.getTime() + 86400000 <= new Date().getTime();
-        }
-      },
-      teacherForm: {
-        teacher: null,
-        courseScheduleId: null
-      },
-      teacherRules: {
-        teacher: [{ required: true, message: "请选择老师", trigger: "blur" }],
-        educationalTeacherId: [{ required: true, message: "请选择教务老师", trigger: "blur" }]
-      },
-      teacherVisible: false
+      newList: []
     }
   },
   mounted () {
-    this.courseOption = this.coursesDate();
+    this.teacherIdList = this.$route.query.teacherId
     this.getCalendatList()
-    getTeacher().then(res => {
-      if (res.code == 200) {
-        this.teacherList = res.data;
-      }
-    });
-    getTeachSchool({
-      userId: this.teacherIdList
-    }).then(res => {
-      if (res.code == 200) {
-        this.schoolList = res.data;
-      }
-    })
-
     this.$nextTick(() => {
       // 点击上个月
       let prevBtn1 = document.querySelector('.el-calendar__button-group .el-button-group>button:nth-child(1)');
@@ -463,17 +86,6 @@ export default {
   },
   methods: {
 
-    getList () {
-      superFindCourseSchedules({
-        teacherIdList: this.teacherIdList, page: this.rules.page,
-        rows: this.rules.limit, startTime: this.startTime, endTime: this.endTime
-      }).then(res => {
-        if (res.code == 200) {
-          this.tableList = res.data.rows
-          this.rules.total = res.data.total
-        }
-      })
-    },
     getCalendatList () {
       this.teacherIdList = this.$route.query.teacherId
       // 获取当前月第一天和最后一天
@@ -511,8 +123,6 @@ export default {
       if (scope.data.type === 'next-month' || scope.data.type === 'prev-month') {
         this.getCalendatList()
       }
-
-      this.getList()
     },
     reduceArray (array, str) {
       let hash = {}
@@ -525,231 +135,21 @@ export default {
     setCourseList (val) {
       this.startTime = setDate(val)
       this.endTime = setDate(val)
-      this.getList()
       this.getCalendatList()
-
     },
     permission (str, parent) {
       return permission(str, parent);
     },
-    resetClass (row) {
-
-      this.value = new Date(row.classDate.replace(/-/g, '/'))
-      switch (row.groupType) {
-        case 'MUSIC': {
-          this.$nextTick(() => {
-            this.musicForm.teacher = parseInt(row.actualTeacherId);
-            this.musicForm.date = row.classDate;
-            // this.startCourseTime = row.startClassTime.split(' ')[1].substring(0, 5);
-            let startClassTime = row.startClassTime.split(' ')[1].substring(0, 5)
-            this.$set(this, 'startCourseTime', startClassTime)
-            this.endCourseTime = row.endClassTime.split(' ')[1].substring(0, 5);
-            this.musicForm.id = row.id;
-            this.$forceUpdate()
-            this.musicVisible = true;
-
-          })
-          break
-        }
-        case 'VIP': {
-          this.$nextTick(() => {
-            this.vipForm.date = row.classDate;
-            this.vipForm.id = row.id;
-            this.vipForm.teachMode = row.teachMode
-            this.vipForm.schoolId = row.schoolId || ''
-            // this.startCourseTime = row.startClassTime.split(' ')[1].substring(0, 5);
-
-
-            let startClassTime = row.startClassTime.split(' ')[1].substring(0, 5)
-            this.startCourseTime = null;
-            this.$set(this, 'startCourseTime', startClassTime)
-            this.vipVisible = true;
-            this.$forceUpdate()
-          })
-          break
-        }
-        case 'PRACTICE': {
-          this.$nextTick(() => {
-            this.practiceForm.date = row.classDate;
-            // this.startCourseTime = row.startClassTime.split(' ')[1].substring(0, 5);
-            let startClassTime = row.startClassTime.split(' ')[1].substring(0, 5)
-            this.startCourseTime = null;
-            this.$set(this, 'startCourseTime', startClassTime)
-            console.log(this.startCourseTime)
-            this.practiceForm.id = row.id;
-            this.practiceForm.courseType = row.practiceGroup.type
-            this.practiceForm.coursesExpireDate = row.practiceGroup.coursesExpireDate
-
-            this.practiceVisible = true;
-            this.$forceUpdate()
-          })
-          break
-        }
-      }
+  },
+  computed: {
+    fomatValue () {
 
-    },
-    changeStartTime () {
-      this.endCourseTime = '';
-    },
-    submitResetClass () {
-      if (!this.startCourseTime || !this.endCourseTime) {
-        this.$message.error("请填写开始时间或结束时间");
-        return;
-      }
-      this.$refs['musicFormref'].validate(res => {
-        if (res) {
-          let obj = {
-            actualTeacherId: this.musicForm.teacher,
-            startClassTimeStr: this.startCourseTime,
-            endClassTimeStr: this.endCourseTime,
-            id: this.musicForm.id,
-            classDate: this.musicForm.date,
-          };
-          resetCourse(obj).then(res => {
-            if (res.code == 200) {
-              this.$message.success("修改成功");
-              console.log(this.value)
-              this.setCourseList(this.value)
-              this.musicVisible = false;
-            }
-          });
-        }
-      })
-    },
-    submitResetVipClass () {
-      if (!this.startTime) {
-        this.$message.error("请填写修改时间");
-        return;
-      }
-      let classTime = this.vipForm.date
-        ? new Date(this.vipForm.date)
-        : new Date();
-      let ymd =
-        classTime.getFullYear() +
-        "-" +
-        (classTime.getMonth() + 1) +
-        "-" +
-        classTime.getDate();
-      let tempStartTime = this.startCourseTime
-      if (this.startCourseTime.length <= 5) {
-        tempStartTime = tempStartTime + ":00";
-      }
-      let obj = {
-        startClassTime: ymd + " " + tempStartTime,
-        // startClassTimeStr: this.startTime,
-        id: this.vipForm.id,
-        classDate: this.vipForm.date,
-        schoolId: this.vipForm.schoolId || null,
-        teachMode: this.vipForm.teachMode || null
-      };
-      resetCourse(obj).then(res => {
-        if (res.code == 200) {
-          this.$message.success("修改成功");
-          this.vipVisible = false;
-          this.setCourseList(this.value)
-        } //else {
-        //   this.$message.error(res.msg)
-        // }
-      });
-    },
-    submitPracticeResetClass () {
-      if (!this.startCourseTime) {
-        this.$message.error("请填写修改时间");
-        return;
-      }
-      let obj = {
-        startClassTimeStr: this.startCourseTime,
-        id: this.practiceForm.id,
-        classDate: this.practiceForm.date
-      };
-      practiceCourseAdjus(obj).then(res => {
-        if (res.code == 200) {
-          this.$message.success("修改成功");
-          this.practiceVisible = false;
-          this.setCourseList(this.value)
-        } //else {
-        //     this.$message.error(res.msg)
-        //   }
-      });
-    },
-    coursesDate () {
-      let self = this;
-      return {
-        firstDayOfWeek: 1,
-        disabledDate: time => {
-          // if (self.leftForm.courseStart) {
-          // let date = new Date(self.leftForm.courseStart.replace(/-/, "/"));
-          // coursesExpireDate
-          let date = new Date(this.practiceForm.coursesExpireDate.replace(/-/, "/"));
-          return time.getTime() > date.getTime();
-          // }
-          // return;
-        }
-      };
-    },
-    resetTeacher (row) {
-      this.teacherForm.teacher = row.actualTeacherId;
-      this.teacherForm.courseScheduleId = row.id;
-      this.teacherVisible = true;
-    },
-    subresetTeacher () {
-      this.$refs.teacherForm.validate(some => {
-        if (some) {
-          // 修改单节课老师
-          practiceCourseTeacherAdjust({
-            courseScheduleId: this.teacherForm.courseScheduleId,
-            teacherId: this.teacherForm.teacher
-          }).then(res => {
-            if (res.code == 200) {
-              this.$message.success("修改成功");
-              this.teacherVisible = false;
-              this.setCourseList(this.value)
-            }
-          })
-        } else {
-          return;
-        }
-      });
+      return setDate(this.value)
     }
   },
   watch: {
-    musicVisible (val) {
-      if (!val) {
-        this.musicForm = {
-          teacher: "",
-          assistant: "",
-          date: "",
-          id: "",
-          type: "",
-        }
-        this.startCourseTime = ""
-        this.endCourseTime = ""
-        this.$refs['musicFormref'].resetFields()
-      }
-    },
-    vipVisible (val) {
-      if (!val) {
-        this.startCourseTime = ""
-        this.vipForm = {
-          date: "",
-          id: "",
-          schoolId: "",
-          teachMode: ""
-        }
-        this.$refs['vipFormref'].resetFields()
-      }
-    },
-    practiceVisible (val) {
-      if (!val) {
-        this.startCourseTime = ""
-        this.practiceForm = {
-          id: '',
-          date: '',
-          courseType: '',
-          coursesExpireDate: ''
-        }
-        this.$refs['practiceFormref'].resetFields()
-      }
+    value (val) {
+      console.log(setDate(val))
     }
   }
 }

+ 655 - 0
src/views/teacherManager/teacherDetail/components/resetComponent.vue

@@ -0,0 +1,655 @@
+<template>
+  <div>
+    <div class="tableWrap"
+         v-if='tableList.length>0'>
+      <el-table :data="tableList"
+                :header-cell-style="{background:'#EDEEF0',color:'#444'}">
+        <el-table-column align="center"
+                         prop="organName"
+                         label="分部名称"></el-table-column>
+        <el-table-column align="center"
+                         width="130px"
+                         prop="musicGroupId"
+                         label="乐团/课程组编号"></el-table-column>
+        <el-table-column align="center"
+                         prop="id"
+                         label="课程编号"></el-table-column>
+        <el-table-column align="center"
+                         width="200px"
+                         label="时间">
+          <template slot-scope="scope">{{ scope.row.startClassTime ? scope.row.startClassTime.substr(0, 16) : '' }}-{{ scope.row.endClassTime ? scope.row.endClassTime.substr(11,5) : ''}}</template>
+        </el-table-column>
+        <!-- <el-table-column align="center" prop="groupName" label="乐团/VIP名"></el-table-column> -->
+        <!-- <el-table-column align="center" prop="classGroupName" label="班级名称"></el-table-column> -->
+        <el-table-column align="center"
+                         prop="studentId"
+                         label="学生ID">
+          <template slot-scope="scope">
+            <div v-if="scope.row.groupType != 'MUSIC'">{{scope.row.studentId}}</div>
+          </template>
+        </el-table-column>
+        <el-table-column align="center"
+                         prop="subjectName"
+                         label="声部"></el-table-column>
+        <el-table-column align="center"
+                         prop="name"
+                         label="课程名称"></el-table-column>
+        <el-table-column align="center"
+                         label="课程类型">
+          <template slot-scope="scope">
+            <div>{{ scope.row.type | coursesType}}</div>
+          </template>
+        </el-table-column>
+        <el-table-column align="center"
+                         label="教学模式">
+          <template slot-scope="scope">
+            <div>{{ scope.row.teachMode | teachMode}}</div>
+          </template>
+        </el-table-column>
+        <el-table-column align="center"
+                         prop="schoolName"
+                         label="教学点">
+          <template slot-scope="scope">
+            <div>{{scope.row.schoolName?scope.row.schoolName:'网络教室'}}</div>
+          </template>
+        </el-table-column>
+        <el-table-column align="center"
+                         prop="courseScheduleStatus"
+                         label="课程状态">
+          <template slot-scope="scope">
+            <div>{{ scope.row.status | coursesStatus }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column align="center"
+                         label="操作"
+                         fixed="right"
+                         width="180px">
+          <template slot-scope="scope">
+            <!-- v-if="permission('teamCourseList/details')" -->
+            <div>
+              <el-button v-if="!scope.row.isSettlement && permission('courseSchedule/classStartDateAdjust')&&scope.row.groupType ==='MUSIC'"
+                         type="text"
+                         @click="resetClass(scope.row)">调整</el-button>
+              <el-button v-if="!scope.row.isSettlement && permission('courseSchedule/classStartDateAdjust')&&scope.row.groupType ==='VIP'"
+                         type="text"
+                         @click="resetClass(scope.row)">调整</el-button>
+              <el-button type="text"
+                         v-if="!scope.row.isSettlement && permission('courseSchedule/practiceCourseAdjust')&&scope.row.groupType==='PRACTICE'"
+                         @click="resetClass(scope.row)">调整</el-button>
+              <el-button type="text"
+                         v-if="scope.row.groupType==='PRACTICE'&&scope.row.status == 'NOT_START'&&scope.row.practiceGroup['type']!='TRIAL'&& permission('courseSchedule/practiceCourseTeacherAdjust')"
+                         @click="resetTeacher(scope.row)">更换老师</el-button>
+            </div>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination :total="rules.total"
+                  :page.sync="rules.page"
+                  :limit.sync="rules.limit"
+                  :page-sizes="rules.page_size"
+                  @pagination="getList" />
+    </div>
+
+    <!-- 乐团调整 -->
+    <el-dialog title="课程调整"
+               destroy-on-close
+               width="400px"
+               :visible.sync="musicVisible">
+      <el-form :model="musicForm"
+               ref="musicFormref"
+               :rules="musicRules"
+               label-position="right"
+               label-width="80px;">
+        <el-form-item label="指导老师"
+                      prop="teacher">
+          <el-select v-model.trim="musicForm.teacher"
+                     style="width:220px!important"
+                     clearable
+                     filterable>
+            <el-option v-for="(item,index) in teacherList"
+                       :key="index"
+                       :value="item.id"
+                       :label="item.realName"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="上课日期"
+                      prop="date">
+          <el-date-picker v-model.trim="musicForm.date"
+                          type="date"
+                          :picker-options="{
+                            firstDayOfWeek:1
+                          }"
+                          value-format="yyyy-MM-dd"
+                          placeholder="选择日期"></el-date-picker>
+        </el-form-item>
+        <el-form-item label="开始时间"
+                      prop="startTime">
+          <el-time-select placeholder="起始时间"
+                          v-model="startCourseTime"
+                          @change="changeStartTime"
+                          :picker-options="{
+                            start: '04:30',
+                            step: '00:05',
+                            end: '23:30'
+                            }"></el-time-select>
+        </el-form-item>
+        <el-form-item label="结束时间"
+                      prop="endTime">
+          <el-time-select placeholder="结束时间"
+                          v-model="endCourseTime"
+                          :picker-options="{
+                            start: '04:30',
+                            step: '00:05',
+                            end: '23:30',
+                            minTime: startCourseTime
+                          }"></el-time-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer"
+           class="dialog-footer">
+        <el-button @click="musicVisible = false">取 消</el-button>
+        <el-button type="primary"
+                   @click="submitResetClass">确 定</el-button>
+      </div>
+    </el-dialog>
+    <!-- vip调整 -->
+    <el-dialog title="课程调整"
+               destroy-on-close
+               width="400px"
+               :visible.sync="vipVisible">
+      <el-form :model="vipForm"
+               ref="vipFormref"
+               :rules="vipRules"
+               label-position="right"
+               label-width="80px;"
+               :inline="true">
+        <el-form-item label="上课日期"
+                      prop="date">
+          <el-date-picker v-model.trim="vipForm.date"
+                          style="width:200px!important;"
+                          type="date"
+                          :picker-options="{
+                              firstDayOfWeek:1
+                            }"
+                          value-format="yyyy-MM-dd"
+                          placeholder="选择日期"></el-date-picker>
+        </el-form-item>
+        <el-form-item label="开始时间"
+                      prop="startCourseTime"
+                      key="time2">
+          <el-time-select placeholder="起始时间"
+                          style="width:200px!important;"
+                          v-model="startCourseTime"
+                          :picker-options="{
+                            start: '04:30',
+                            step: '00:05',
+                            end: '23:30'
+                            }"></el-time-select>
+        </el-form-item>
+        <el-form-item label="课程类型"
+                      prop="courseType">
+          <el-select clearable
+                     v-model.trim="vipForm.teachMode">
+            <el-option label="线上课"
+                       value="ONLINE"></el-option>
+            <el-option label="线下课"
+                       value="OFFLINE"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="教学地点"
+                      v-if="vipForm.teachMode == 'OFFLINE'"
+                      prop="schoolId">
+          <el-select key='school'
+                     v-model="vipForm.schoolId"
+                     filterable
+                     clearable>
+            <el-option v-for="(item,index) in schoolList"
+                       :key="index"
+                       :value="item.id"
+                       :label="item.name"></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer"
+           class="dialog-footer">
+        <el-button @click="vipVisible = false">取 消</el-button>
+        <el-button type="primary"
+                   @click="submitResetVipClass">确 定</el-button>
+      </div>
+    </el-dialog>
+    <!-- 网管课调整 -->
+    <el-dialog title="课程调整"
+               destroy-on-close
+               width="400px"
+               :visible.sync="practiceVisible">
+      <el-form :model="practiceForm"
+               ref="practiceFormref"
+               :rules="practiceRules"
+               label-position="right"
+               label-width="80px;"
+               :inline="true">
+        <el-form-item label="上课日期"
+                      prop="date"
+                      v-if="practiceForm.courseType != 'TRIAL'">
+          <el-date-picker v-model.trim="practiceForm.date"
+                          style="width:200px!important;"
+                          type="date"
+                          :picker-options="courseOption"
+                          value-format="yyyy-MM-dd"
+                          placeholder="选择日期"></el-date-picker>
+        </el-form-item>
+        <el-form-item label="上课日期"
+                      prop="date"
+                      v-else>
+          <el-date-picker v-model.trim="practiceForm.date"
+                          style="width:200px!important;"
+                          type="date"
+                          value-format="yyyy-MM-dd"
+                          :picker-options="{
+                            firstDayOfWeek: 1
+                          }"
+                          placeholder="选择日期"></el-date-picker>
+        </el-form-item>
+        <el-form-item label="开始时间"
+                      key="time1"
+                      prop="startCourseTime">
+          <el-time-select placeholder="起始时间"
+                          style="width:200px!important;"
+                          v-model="startCourseTime"
+                          :picker-options="{
+                            start: '07:00',
+                            step: '00:05',
+                            end: '23:00'
+                            }"></el-time-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer"
+           class="dialog-footer">
+        <el-button @click="practiceVisible = false">取 消</el-button>
+        <el-button type="primary"
+                   @click="submitPracticeResetClass">确 定</el-button>
+      </div>
+    </el-dialog>
+    <!-- 老师调整 -->
+    <el-dialog title="老师调整"
+               width="400px"
+               :visible.sync="teacherVisible">
+      <el-form :model="teacherForm"
+               ref="teacherForm"
+               :rules="teacherRules"
+               label-position="right"
+               label-width="80px;"
+               :inline="true">
+        <el-form-item label="指导老师">
+          <el-select v-model.trim="teacherForm.teacher"
+                     filterable
+                     clearable>
+            <el-option v-for="(item,index) in teacherList"
+                       :key="index"
+                       :value="item.id"
+                       :label="item.realName"></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer"
+           class="dialog-footer">
+        <el-button @click="teacherVisible = false">取 消</el-button>
+        <el-button type="primary"
+                   @click="subresetTeacher">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import { superFindCourseSchedules, getTeacher, resetCourse, practiceCourseAdjus, practiceCourseTeacherAdjust } from "@/api/buildTeam";
+import { setDate, getCurrentMonthFirst, getCurrentMonthLast } from "@/utils/date"
+import { getTeachSchool } from "@/api/teacherManager";
+import pagination from "@/components/Pagination/index";
+import { permission } from "@/utils/directivePage";
+export default {
+  components: { pagination },
+  props: ['startTimes'],
+  data () {
+    return {
+      startCourseTime: '',
+      endCourseTime: '',
+      tableList: [],
+      teacherList: [],
+      schoolList: [],
+      educationList: [],
+      startTime: this.startTimes,
+      endTime: this.startTimes,
+      rules: {
+        // 分页规则
+        limit: 10, // 限制显示条数
+        page: 1, // 当前页
+        total: 0, // 总条数
+        page_size: [10, 20, 40, 50] // 选择限制显示条数
+      },
+      musicVisible: false,
+      vipVisible: false,
+      practiceVisible: false,
+      musicForm: {
+        teacher: "",
+        assistant: "",
+        date: "",
+        id: "",
+        startTime: "",
+        endTime: "",
+        type: "",
+      },
+      musicRules: {
+        teacher: [
+          { required: true, message: "请选择主教老师名称", trigger: "blur" }
+        ],
+        date: [{ required: true, message: "请选择上课时间", trigger: "blur" }],
+      },
+      vipForm: {
+        date: "",
+        id: "",
+        schoolId: '',
+        teachMode: ""
+      },
+      vipRules: {
+        date: [{ required: true, message: "请选择上课时间", trigger: "blur" }],
+      },
+      practiceRules: {
+        date: [{ required: true, message: "请选择上课时间", trigger: "blur" }],
+      },
+
+      practiceForm: {
+        id: '',
+        date: '',
+        courseType: '',
+        coursesExpireDate: ''
+      },
+      courseOption: null,
+      pickerOptions: {
+        firstDayOfWeek: 1,
+        disabledDate (time) {
+          return time.getTime() + 86400000 <= new Date().getTime();
+        }
+      },
+      teacherForm: {
+        teacher: null,
+        courseScheduleId: null
+      },
+      teacherRules: {
+        teacher: [{ required: true, message: "请选择老师", trigger: "blur" }],
+        educationalTeacherId: [{ required: true, message: "请选择教务老师", trigger: "blur" }]
+      },
+      teacherVisible: false
+    }
+  },
+  mounted () {
+    this.teacherIdList = this.$route.query.teacherId
+    this.getList()
+    this.courseOption = this.coursesDate();
+    // this.getCalendatList()
+    getTeacher().then(res => {
+      if (res.code == 200) {
+        this.teacherList = res.data;
+      }
+    });
+    getTeachSchool({
+      userId: this.teacherIdList
+    }).then(res => {
+      if (res.code == 200) {
+        this.schoolList = res.data;
+      }
+    })
+
+  },
+  methods: {
+    getList () {
+      if (!this.startTime || !this.endTime) return
+      superFindCourseSchedules({
+        teacherIdList: this.teacherIdList, page: this.rules.page,
+        rows: this.rules.limit, startTime: this.startTime, endTime: this.endTime
+      }).then(res => {
+        if (res.code == 200) {
+          this.tableList = res.data.rows
+          this.rules.total = res.data.total
+        }
+      })
+    },
+    setCourseList (val) {
+      this.startTime = setDate(val)
+      this.endTime = setDate(val)
+      this.$emit('getCalendatList')
+      this.getList()
+      // this.getCalendatList()
+    },
+    permission (str, parent) {
+      return permission(str, parent);
+    },
+    resetClass (row) {
+
+      this.value = new Date(row.classDate.replace(/-/g, '/'))
+      switch (row.groupType) {
+        case 'MUSIC': {
+          this.$nextTick(() => {
+            this.musicForm.teacher = parseInt(row.actualTeacherId);
+            this.musicForm.date = row.classDate;
+            // this.startCourseTime = row.startClassTime.split(' ')[1].substring(0, 5);
+            let startClassTime = row.startClassTime.split(' ')[1].substring(0, 5)
+            this.$set(this, 'startCourseTime', startClassTime)
+            this.endCourseTime = row.endClassTime.split(' ')[1].substring(0, 5);
+            this.musicForm.id = row.id;
+            this.$forceUpdate()
+            this.musicVisible = true;
+
+          })
+          break
+        }
+        case 'VIP': {
+          this.$nextTick(() => {
+            this.vipForm.date = row.classDate;
+            this.vipForm.id = row.id;
+            this.vipForm.teachMode = row.teachMode
+            this.vipForm.schoolId = row.schoolId || ''
+            // this.startCourseTime = row.startClassTime.split(' ')[1].substring(0, 5);
+
+
+            let startClassTime = row.startClassTime.split(' ')[1].substring(0, 5)
+            this.startCourseTime = null;
+            this.$set(this, 'startCourseTime', startClassTime)
+            this.vipVisible = true;
+            this.$forceUpdate()
+          })
+          break
+        }
+        case 'PRACTICE': {
+          this.$nextTick(() => {
+            this.practiceForm.date = row.classDate;
+            // this.startCourseTime = row.startClassTime.split(' ')[1].substring(0, 5);
+            let startClassTime = row.startClassTime.split(' ')[1].substring(0, 5)
+            this.startCourseTime = null;
+            this.$set(this, 'startCourseTime', startClassTime)
+            console.log(this.startCourseTime)
+            this.practiceForm.id = row.id;
+            this.practiceForm.courseType = row.practiceGroup.type
+            this.practiceForm.coursesExpireDate = row.practiceGroup.coursesExpireDate
+
+            this.practiceVisible = true;
+            this.$forceUpdate()
+          })
+          break
+        }
+      }
+
+    },
+    changeStartTime () {
+      this.endCourseTime = '';
+    },
+    submitResetClass () {
+      if (!this.startCourseTime || !this.endCourseTime) {
+        this.$message.error("请填写开始时间或结束时间");
+        return;
+      }
+      this.$refs['musicFormref'].validate(res => {
+        if (res) {
+          let obj = {
+            actualTeacherId: this.musicForm.teacher,
+            startClassTimeStr: this.startCourseTime,
+            endClassTimeStr: this.endCourseTime,
+            id: this.musicForm.id,
+            classDate: this.musicForm.date,
+          };
+          resetCourse(obj).then(res => {
+            if (res.code == 200) {
+              this.$message.success("修改成功");
+              console.log(this.value)
+              this.setCourseList(this.value)
+              this.musicVisible = false;
+            }
+          });
+        }
+      })
+    },
+    submitResetVipClass () {
+      if (!this.startTime) {
+        this.$message.error("请填写修改时间");
+        return;
+      }
+      let classTime = this.vipForm.date
+        ? new Date(this.vipForm.date)
+        : new Date();
+      let ymd =
+        classTime.getFullYear() +
+        "-" +
+        (classTime.getMonth() + 1) +
+        "-" +
+        classTime.getDate();
+      let tempStartTime = this.startCourseTime
+      if (this.startCourseTime.length <= 5) {
+        tempStartTime = tempStartTime + ":00";
+      }
+      let obj = {
+        startClassTime: ymd + " " + tempStartTime,
+        // startClassTimeStr: this.startTime,
+        id: this.vipForm.id,
+        classDate: this.vipForm.date,
+        schoolId: this.vipForm.schoolId || null,
+        teachMode: this.vipForm.teachMode || null
+      };
+      resetCourse(obj).then(res => {
+        if (res.code == 200) {
+          this.$message.success("修改成功");
+          this.vipVisible = false;
+          this.setCourseList(this.value)
+        } //else {
+        //   this.$message.error(res.msg)
+        // }
+      });
+    },
+    submitPracticeResetClass () {
+      if (!this.startCourseTime) {
+        this.$message.error("请填写修改时间");
+        return;
+      }
+      let obj = {
+        startClassTimeStr: this.startCourseTime,
+        id: this.practiceForm.id,
+        classDate: this.practiceForm.date
+      };
+      practiceCourseAdjus(obj).then(res => {
+        if (res.code == 200) {
+          this.$message.success("修改成功");
+          this.practiceVisible = false;
+          this.setCourseList(this.value)
+        } //else {
+        //     this.$message.error(res.msg)
+        //   }
+      });
+    },
+    coursesDate () {
+      let self = this;
+      return {
+        firstDayOfWeek: 1,
+        disabledDate: time => {
+          // if (self.leftForm.courseStart) {
+          // let date = new Date(self.leftForm.courseStart.replace(/-/, "/"));
+          // coursesExpireDate
+          let date = new Date(this.practiceForm.coursesExpireDate.replace(/-/, "/"));
+          return time.getTime() > date.getTime();
+          // }
+          // return;
+        }
+      };
+    },
+    resetTeacher (row) {
+      this.teacherForm.teacher = row.actualTeacherId;
+      this.teacherForm.courseScheduleId = row.id;
+      this.teacherVisible = true;
+    },
+    subresetTeacher () {
+      this.$refs.teacherForm.validate(some => {
+        if (some) {
+          // 修改单节课老师
+          practiceCourseTeacherAdjust({
+            courseScheduleId: this.teacherForm.courseScheduleId,
+            teacherId: this.teacherForm.teacher
+          }).then(res => {
+            if (res.code == 200) {
+              this.$message.success("修改成功");
+              this.teacherVisible = false;
+              this.setCourseList(this.value)
+            }
+          })
+        } else {
+          return;
+        }
+      });
+    }
+  },
+  watch: {
+    musicVisible (val) {
+      if (!val) {
+        this.musicForm = {
+          teacher: "",
+          assistant: "",
+          date: "",
+          id: "",
+          type: "",
+        }
+        this.startCourseTime = ""
+        this.endCourseTime = ""
+        this.$refs['musicFormref'].resetFields()
+      }
+    },
+    vipVisible (val) {
+      if (!val) {
+        this.startCourseTime = ""
+        this.vipForm = {
+          date: "",
+          id: "",
+          schoolId: "",
+          teachMode: ""
+        }
+        this.$refs['vipFormref'].resetFields()
+      }
+    },
+    practiceVisible (val) {
+      if (!val) {
+        this.startCourseTime = ""
+        this.practiceForm = {
+          id: '',
+          date: '',
+          courseType: '',
+          coursesExpireDate: ''
+        }
+        this.$refs['practiceFormref'].resetFields()
+      }
+    },
+    startTimes (val) {
+      this.startTime = val;
+      this.endTime = val;
+      this.getList()
+    }
+
+  }
+}
+</script>
+<style lang="scss">
+</style>

BIN
src/views/teacherManager/teacherDetail/components/weekUitl/weekTimer.png


+ 283 - 0
src/views/teacherManager/teacherDetail/components/weeklyCalendar.vue

@@ -0,0 +1,283 @@
+<template>
+  <div class="m-container">
+    <el-date-picker v-model="week"
+                    type="week"
+                    format="yyyy-MM 第 WW 周"
+                    placeholder="选择周"
+                    @change="changeWeek"
+                    :picker-options="{
+                      firstDayOfWeek:1
+                    }">
+    </el-date-picker>
+    <div class="timeWrap">
+      <div class="weekDotList">
+        <div class="weekDot"
+             @click="setWeekDotList(item,index)"
+             :class="index==active?'active':''"
+             v-for="(item,index) in weekList"
+             :key='index'>
+          <p class="week">{{item.week}}</p>
+          <p class="date">{{item.dateStr}}</p>
+        </div>
+      </div>
+      <div class="timer">
+        <div class="imgWrap">
+          <img :src="timerImg">
+          <div v-for="(item,index) in newList"
+               :key="index+'new'">
+            <el-popover placement="top"
+                        trigger="hover">
+              <p>课程名称:{{item.name}}</p>
+              <p>上课时间:{{item.startClassTime.split(' ')[1].substring(0,5)+'~'+item.endClassTime.split(' ')[1].substring(0,5)}}</p>
+              <div slot="reference"
+                   :style="item.style"
+                   class="newDot dot">网</div>
+            </el-popover>
+          </div>
+          <div v-for="(item,index) in vipList"
+               :key="index+'vip'">
+            <el-popover placement="top"
+                        trigger="hover">
+              <p>课程名称:{{item.name}}</p>
+              <p>上课时间:{{item.startClassTime.split(' ')[1].substring(0,5)+'~'+item.endClassTime.split(' ')[1].substring(0,5)}}</p>
+              <div slot="reference"
+                   :style="item.style"
+                   class="vipDot dot">vip</div>
+            </el-popover>
+          </div>
+          <div v-for="(item,index) in teamList"
+               :key="index+'team'">
+            <el-popover placement="top"
+                        trigger="hover">
+              <p>课程名称:{{item.name}}</p>
+              <p>上课时间:{{item.startClassTime.split(' ')[1].substring(0,5)+'~'+item.endClassTime.split(' ')[1].substring(0,5)}}</p>
+              <div slot="reference"
+                   :style="item.style"
+                   class="teamDot dot">乐</div>
+            </el-popover>
+          </div>
+
+        </div>
+      </div>
+    </div>
+    <resetList :startTimes="tableTime"
+               @getCalendatList='getCalendatList' />
+  </div>
+</template>
+<script>
+import { superFindCourseSchedules } from "@/api/buildTeam";
+import { setDate, getCurrentMonthFirst, getCurrentMonthLast, getNowDateAndSunday, getNowDateAndMonday, getWeekDay } from "@/utils/date"
+import resetList from './resetComponent'
+export default {
+  components: { resetList },
+  data () {
+    return {
+      timerImg: require('@/views/teacherManager/teacherDetail/components/weekUitl/weekTimer.png'),
+      active: -1,
+      week: new Date(),
+      weekList: [],
+      startTime: '',
+      endTime: '',
+      vipList: [],
+      teamList: [],
+      newList: [],
+      weekDay: [
+        "周一",
+        "周二",
+        "周三",
+        "周四",
+        "周五",
+        "周六",
+        "周日",
+      ],
+      tableTime: ''
+    }
+  },
+  mounted () {
+    this.getCalendatList()
+    this.setWeekList()
+  },
+  methods: {
+    setStartTimeAndEndTime (date) {
+      this.startTime = getNowDateAndMonday(setDate(date))
+      this.endTime = getNowDateAndSunday(setDate(date))
+    },
+    getCalendatList () {
+      this.teacherIdList = this.$route.query.teacherId
+      // 获取本周的周一和周日
+      this.setStartTimeAndEndTime(this.week)
+      superFindCourseSchedules({ teacherIdList: this.teacherIdList, rows: 9999, page: 1, startTime: this.startTime, endTime: this.endTime }).then(res => {
+        if (res.code === 200) {
+          this.dataList = res.data.rows
+          // 过滤数据
+          this.vipList = []
+          this.teamList = []
+          this.newList = []
+          for (let i in this.dataList) {
+            this.setCourseTime(this.dataList[i])
+            if (this.dataList[i].groupType === 'VIP') {
+              this.vipList.push(this.dataList[i])
+            }
+            if (this.dataList[i].groupType === 'MUSIC') {
+              this.teamList.push(this.dataList[i])
+            }
+            if (this.dataList[i].groupType === 'PRACTICE') {
+              this.newList.push(this.dataList[i])
+            }
+          }
+        }
+      })
+    },
+    setCourseTime (row) {
+      let startMinutes = this.getMinutes(row.startClassTime.split(' ')[1])
+      let endMinutes = this.getMinutes(row.endClassTime.split(' ')[1])
+      let width = (endMinutes - startMinutes) * 1.8
+      let left = startMinutes - 240 > 0 ? (startMinutes - 240) * 1.8 + 17 : 17
+      let top = getWeekDay(row.classDate) === 1 ? 40 : (getWeekDay(row.classDate) * 60) - 16
+      row.style = {
+        'width': width + 'px',
+        'top': top + 'px',
+        'left': left + 'px'
+      }
+    },
+    getMinutes (str) {
+      return parseInt(str.split(':')[0]) * 60 + parseInt(str.split(':')[1])
+    },
+    setWeekList () {
+
+      this.weekList = []
+      let startTime = new Date(this.startTime.replace(/-/g, "/"))
+      startTime.setTime(startTime.getTime() - 1000 * 60 * 60 * 24)
+      for (let i = 0; i < 7; i++) {
+        startTime.setTime(startTime.getTime() + 1000 * 60 * 60 * 24)
+        // startTime.setTime(startTime.getTime() - 1000 * 60 * 60 * 24)
+        this.weekList.push({
+          week: this.weekDay[i],
+          dateStr: startTime.getMonth() + 1 + '月' + startTime.getDate() + '日',
+          date: setDate(startTime)
+        })
+      }
+    },
+    setWeekDotList (item, index) {
+      this.active = index;
+      console.log(item)
+      console.log(item.date)
+      this.tableTime = item.date
+    },
+    changeWeek (val) {
+      this.week = val;
+      this.getCalendatList()
+      this.setWeekList()
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.timeWrap {
+  margin-top: 20px;
+  display: flex;
+  flex-direction: row;
+  justify-content: flex-start;
+  .timer {
+    width: 1478px;
+    overflow: auto;
+    position: relative;
+    .imgWrap {
+      width: 2194px;
+      position: relative;
+      z-index: 1;
+      img {
+        width: 2194px;
+        position: relative;
+        z-index: 1;
+      }
+      .dot {
+        -moz-user-select: none; /*火狐*/
+        -webkit-user-select: none; /*webkit浏览器*/
+        -ms-user-select: none; /*IE10*/
+        user-select: none;
+        cursor: pointer;
+        position: absolute;
+        min-width: 30px;
+        height: 25px;
+        color: #fff;
+        font-size: 14px;
+        line-height: 25px;
+        padding-left: 5px;
+        z-index: 10;
+        top: 40px;
+        right: 0;
+        border-radius: 3px;
+      }
+      .vipDot {
+        background: linear-gradient(
+          to left,
+          rgba(42, 174, 166, 0.75),
+          rgba(42, 174, 166, 1)
+        );
+      }
+      .newDot {
+        background: linear-gradient(
+          to left,
+          rgba(52, 177, 246, 0.75),
+          rgba(52, 177, 246, 1)
+        );
+      }
+      .teamDot {
+        background: linear-gradient(
+          to left,
+          rgba(90, 121, 246, 0.75),
+          rgba(90, 121, 246, 1)
+        );
+      }
+    }
+  }
+  .weekDotList {
+    margin: 24px 10px 0 0;
+    width: 70px;
+    display: flex;
+    flex-direction: column;
+    background-color: #fff;
+
+    .weekDot {
+      cursor: pointer;
+      -moz-user-select: none; /*火狐*/
+      -webkit-user-select: none; /*webkit浏览器*/
+      -ms-user-select: none; /*IE10*/
+      user-select: none;
+      width: 70px;
+      height: 60px;
+      background-color: #fff;
+      color: #fff;
+      padding: 10px 0 10px 10px;
+      border-radius: 5px;
+      color: #000;
+      p {
+        font-size: 12px;
+        line-height: 20px;
+      }
+      .week {
+        font-size: 12px;
+        color: #999;
+      }
+      .date {
+        font-size: 14px;
+        color: #333;
+      }
+    }
+    .weekDot.active {
+      background-color: rgba(19, 129, 122, 1);
+      color: #fff !important;
+      border-radius: 5px;
+      .week {
+        font-size: 12px;
+        color: #fff;
+      }
+      .date {
+        font-size: 14px;
+        color: #fff;
+      }
+    }
+  }
+}
+</style>

+ 9 - 1
src/views/teacherManager/teacherDetail/index.vue

@@ -64,6 +64,11 @@
                      name="10">
           <calendarList v-if="activeName == 10" />
         </el-tab-pane>
+        <el-tab-pane label="周历课表"
+                     v-if="permissionList.calendarList"
+                     name="11">
+          <weeklyCalendar v-if="activeName == 11" />
+        </el-tab-pane>
       </el-tabs>
     </div>
   </div>
@@ -81,6 +86,7 @@ import outCourseList from "@/views/teacherManager/teacherDetail/components/outCo
 import teacherNetwork from "@/views/teacherManager/teacherDetail/components/teacherNetwork";
 import serveStudentList from "@/views/teacherManager/teacherDetail/components/serveStudentList";
 import calendarList from '@/views/teacherManager/teacherDetail/components/calendarList'
+import weeklyCalendar from '@/views/teacherManager/teacherDetail/components/weeklyCalendar'
 import { permission } from "@/utils/directivePage";
 export default {
   components: {
@@ -95,7 +101,8 @@ export default {
     outCourseList,
     teacherNetwork,
     serveStudentList,
-    calendarList
+    calendarList,
+    weeklyCalendar
   },
   name: "teacherDetail",
   data () {
@@ -116,6 +123,7 @@ export default {
         teacherNetwork: permission("/teacherDetail/teacherNetwork"),
         serveStudentList: permission("/teacherDetail/serveStudentList"),
         calendarList: permission("/teacherDetail/calendarList"),
+        weeklyCalendar: permission("/teacherDetail/weeklyCalendar"),
       },
       Fsearch: null,
       Frules: null

+ 90 - 73
src/views/teacherManager/teacherOperation/components/accompanySet.vue

@@ -1,22 +1,37 @@
 <template>
   <div class="m-container">
     <div class="infoWrap">
-      <el-form :model="accompanyForm" :inline="true" label-position="left">
-        <el-form-item label="每周可预约课次" style="position: relative" label-width="130px">
-          <el-tooltip placement="top" popper-class="mTooltip">
+      <el-form :model="accompanyForm"
+               :inline="true"
+               label-position="left">
+        <el-form-item label="每周可预约课次"
+                      style="position: relative"
+                      label-width="130px">
+          <el-tooltip placement="top"
+                      popper-class="mTooltip">
             <div slot="content">不填时,默认不限制上课次数</div>
             <!-- <img :src="imageIcon" class="micon el-tooltip" style="width:8px height:8px" alt /> -->
-            <i class="el-icon-question micon el-tooltip" style="font-size: 18px; color: #F56C6C"></i>
+            <i class="el-icon-question micon el-tooltip"
+               style="font-size: 18px; color: #F56C6C"></i>
           </el-tooltip>
-          <el-input type="number" @mousewheel.native.prevent v-model.trim="accompanyForm.count"></el-input>
+          <el-input type="number"
+                    @mousewheel.native.prevent
+                    v-model.trim="accompanyForm.count"></el-input>
         </el-form-item>
         <el-form-item label="每周休息的周次">
-          <el-select v-model="accompanyForm.week" clearable @change="setHoliday">
-            <el-option label="周一" value="1" />
-            <el-option label="周二" value="2" />
-            <el-option label="周三" value="3" />
-            <el-option label="周四" value="4" />
-            <el-option label="周五" value="5" />
+          <el-select v-model="accompanyForm.week"
+                     clearable
+                     @change="setHoliday">
+            <el-option label="周一"
+                       value="1" />
+            <el-option label="周二"
+                       value="2" />
+            <el-option label="周三"
+                       value="3" />
+            <el-option label="周四"
+                       value="4" />
+            <el-option label="周五"
+                       value="5" />
           </el-select>
         </el-form-item>
         <!-- <el-form-item>
@@ -30,67 +45,69 @@
         <el-col :span="2">周次</el-col>
         <el-col :span="18">时间段</el-col>
       </el-row>
-      <el-row v-for="(item,i) in weekList" :key="i">
+      <el-row v-for="(item,i) in weekList"
+              :key="i">
         <el-col :span="2">{{item.name}}</el-col>
         <el-col :span="18">
-          <el-tag
-            v-for="(s,index) in item.timeList"
-            :key="index"
-            :type="item.isHoliday?'info':''"
-            effect="dark"
-            :closable="!item.isHoliday"
-            :disable-transitions="true"
-            @close="subjectDelete(item,index)"
-          >{{s.startTime.substring(0,s.startTime.length - 3)+'-'+s.endTime.substring(0,s.endTime.length - 3)}}</el-tag>
+          <el-tag v-for="(s,index) in item.timeList"
+                  :key="index"
+                  :type="item.isHoliday?'info':''"
+                  effect="dark"
+                  :closable="!item.isHoliday"
+                  :disable-transitions="true"
+                  @close="subjectDelete(item,index)">{{s.startTime.substring(0,s.startTime.length - 3)+'-'+s.endTime.substring(0,s.endTime.length - 3)}}</el-tag>
           <span style="display: inline-block;">
-            <el-button
-              v-if="!item.isHoliday"
-              key="tag"
-              type="primary"
-              style="background:#ececec;border:1px solid #ececec;color:#666"
-              size="mini"
-              round
-              icon="el-icon-plus"
-              @click="subjectAdd(item)"
-            >添加</el-button>
+            <el-button v-if="!item.isHoliday"
+                       key="tag"
+                       type="primary"
+                       style="background:#ececec;border:1px solid #ececec;color:#666"
+                       size="mini"
+                       round
+                       icon="el-icon-plus"
+                       @click="subjectAdd(item)">添加</el-button>
           </span>
         </el-col>
       </el-row>
     </div>
-    <el-dialog :visible.sync="timeVisible" width="600px" :before-close="closetimeVisible">
-      <el-form :inline="true" v-model="timeForm" ref="timeForm">
+    <el-dialog :visible.sync="timeVisible"
+               width="600px"
+               :before-close="closetimeVisible">
+      <el-form :inline="true"
+               v-model="timeForm"
+               ref="timeForm">
         <el-form-item label="开始时间">
-          <el-time-picker
-            v-model="startTime"
-            @change="changeStartTime"
-            format="HH:mm"
-            value-format="HH:mm"
-            :picker-options="{
-              selectableRange:`00:00:00 - 23:59:00`
+          <el-time-picker v-model="startTime"
+                          @change="changeStartTime"
+                          format="HH:mm"
+                          value-format="HH:mm"
+                          :picker-options="{
+              selectableRange:`04:00:00 - 23:59:00`
   }"
-            placeholder="选择时间"
-          ></el-time-picker>
+                          placeholder="选择时间"></el-time-picker>
         </el-form-item>
         <el-form-item label="结束时间">
-          <el-time-picker
-            v-model="endTime"
-            format="HH:mm"
-            value-format="HH:mm"
-            :picker-options="{
-              selectableRange:`${startTime ? startTime+':00' : '00:00:00'}-23:59:00`
+          <el-time-picker v-model="endTime"
+                          format="HH:mm"
+                          value-format="HH:mm"
+                          :picker-options="{
+              selectableRange:`${startTime ? startTime+':00' : '04:00:00'}-23:59:00`
   }"
-            placeholder="选择时间"
-          ></el-time-picker>
+                          placeholder="选择时间"></el-time-picker>
         </el-form-item>
       </el-form>
-      <div slot="footer" class="dialog-footer">
+      <div slot="footer"
+           class="dialog-footer">
         <el-button @click="timeVisible = false">取 消</el-button>
-        <el-button type="primary" @click="addTimerSub">确 定</el-button>
+        <el-button type="primary"
+                   @click="addTimerSub">确 定</el-button>
       </div>
     </el-dialog>
     <div class="btnWrap">
-      <div class="newBand" @click="submitOk" v-permission="'teacherFreeTime/updateSet'">确定</div>
-      <div class="newBand" @click="resetTime">重置</div>
+      <div class="newBand"
+           @click="submitOk"
+           v-permission="'teacherFreeTime/updateSet'">确定</div>
+      <div class="newBand"
+           @click="resetTime">重置</div>
     </div>
   </div>
 </template>
@@ -98,7 +115,7 @@
 import { teacherFreeTime, resetTeacherFreeTime } from "@/api/teacherManager";
 export default {
   props: ["teacherId"],
-  data() {
+  data () {
     return {
       accompanyForm: {
         count: null,
@@ -150,14 +167,14 @@ export default {
       timeForm: {}
     };
   },
-  created() {
+  created () {
     this.init();
   },
-  activated() {
+  activated () {
     this.init();
   },
   methods: {
-    init() {
+    init () {
       //  this.teacherId = this.$route.query.teacherId ;
       if (this.$route.query.search) {
         this.Fsearch = this.$route.query.search;
@@ -185,21 +202,21 @@ export default {
               : (this.weekList.tuesday.timeList = []);
             res.data.wednesday
               ? (this.weekList.wednesday.timeList = JSON.parse(
-                  res.data.wednesday
-                ))
+                res.data.wednesday
+              ))
               : (this.weekList.wednesday.timeList = []);
             res.data.thursday
               ? (this.weekList.thursday.timeList = JSON.parse(
-                  res.data.thursday
-                ))
+                res.data.thursday
+              ))
               : (this.weekList.thursday.timeList = []);
             res.data.friday
               ? (this.weekList.friday.timeList = JSON.parse(res.data.friday))
               : (this.weekList.friday.timeList = []);
             res.data.saturday
               ? (this.weekList.saturday.timeList = JSON.parse(
-                  res.data.saturday
-                ))
+                res.data.saturday
+              ))
               : (this.weekList.saturday.timeList = []);
             res.data.sunday
               ? (this.weekList.sunday.timeList = JSON.parse(res.data.sunday))
@@ -208,7 +225,7 @@ export default {
         });
       }
     },
-    submitOk() {
+    submitOk () {
       this.$confirm("确认保存设置?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
@@ -273,7 +290,7 @@ export default {
         });
       });
     },
-    setHoliday(val) {
+    setHoliday (val) {
       // console.log(val)
 
       val = parseInt(val);
@@ -295,7 +312,7 @@ export default {
       }
     },
     // 删除
-    subjectDelete(item, index) {
+    subjectDelete (item, index) {
       for (let date in this.weekList) {
         if (this.weekList[date].name == item.name) {
           this.weekList[date].timeList.splice(index, 1);
@@ -303,13 +320,13 @@ export default {
       }
     },
     // 添加
-    subjectAdd(item) {
+    subjectAdd (item) {
       this.activeItem = item;
       this.timeVisible = true;
       // console.log(item)
     },
     // 提交添加的时间
-    addTimerSub() {
+    addTimerSub () {
       // this.$refs["timeForm"].validate(res => {
       //   if (!res) {
       //     return;
@@ -363,7 +380,7 @@ export default {
       this.closetimeVisible();
     },
     // 判断时间是否在时间段内
-    timeIsrange(beginTime, endTime, nowTime) {
+    timeIsrange (beginTime, endTime, nowTime) {
       var strb = beginTime.split(":");
       if (strb.length != 2) {
         return false;
@@ -394,7 +411,7 @@ export default {
         return false;
       }
     },
-    resetTime() {
+    resetTime () {
       this.weekList = {
         monday: {
           timeList: [],
@@ -434,10 +451,10 @@ export default {
       };
       this.accompanyForm.week = null;
     },
-    changeStartTime() {
+    changeStartTime () {
       this.endTime = "";
     },
-    closetimeVisible() {
+    closetimeVisible () {
       this.startTime = null;
       this.endTime = null;
       console.log(111);

+ 3 - 3
src/views/vipClass/vipDetail/components/teacherRecord.vue

@@ -207,7 +207,7 @@
                           format='HH:mm'
                           value-format='HH:mm'
                           :picker-options="{
-                          selectableRange: '00:00:00 - 23:59:00'
+                          selectableRange: '04:00:00 - 23:59:00'
                             }"
                           placeholder="选择时间">
           </el-time-picker>
@@ -218,8 +218,8 @@
                           format='HH:mm'
                           value-format='HH:mm'
                           :picker-options="{
-                          selectableRange: '00:00:00 - 23:59:00'
-                            }"
+              selectableRange:`${maskForm.startTime ? maskForm.startTime+':00' : '04:00:00'}-23:59:00`
+  }"
                           placeholder="选择时间">
           </el-time-picker>
         </el-form-item>