|  | @@ -7,7 +7,7 @@
 | 
	
		
			
				|  |  |              <div slot="content">不填时,默认不限制上课次数</div>
 | 
	
		
			
				|  |  |              <img :src="imageIcon" class="micon el-tooltip" style="width:8px height:8px" alt />
 | 
	
		
			
				|  |  |            </el-tooltip>
 | 
	
		
			
				|  |  | -          <el-input type="number" 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">
 | 
	
	
		
			
				|  | @@ -57,24 +57,24 @@
 | 
	
		
			
				|  |  |        </el-row>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  |      <el-dialog :visible.sync="timeVisible" width="600px" :before-close="closetimeVisible">
 | 
	
		
			
				|  |  | -      <el-form :inline="true" v-model="timeForm" ref="timeForm" >
 | 
	
		
			
				|  |  | -        <el-form-item label="开始时间" >
 | 
	
		
			
				|  |  | +      <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'
 | 
	
		
			
				|  |  | +            format="HH:mm"
 | 
	
		
			
				|  |  | +            value-format="HH:mm"
 | 
	
		
			
				|  |  |              :picker-options="{
 | 
	
		
			
				|  |  |                selectableRange:`00:00:00 - 23:59:00`
 | 
	
		
			
				|  |  |    }"
 | 
	
		
			
				|  |  |              placeholder="选择时间"
 | 
	
		
			
				|  |  |            ></el-time-picker>
 | 
	
		
			
				|  |  |          </el-form-item>
 | 
	
		
			
				|  |  | -        <el-form-item label="结束时间" >
 | 
	
		
			
				|  |  | +        <el-form-item label="结束时间">
 | 
	
		
			
				|  |  |            <el-time-picker
 | 
	
		
			
				|  |  |              v-model="endTime"
 | 
	
		
			
				|  |  | -            format='HH:mm'
 | 
	
		
			
				|  |  | -            value-format='HH:mm'
 | 
	
		
			
				|  |  | +            format="HH:mm"
 | 
	
		
			
				|  |  | +            value-format="HH:mm"
 | 
	
		
			
				|  |  |              :picker-options="{
 | 
	
		
			
				|  |  |                selectableRange:`${startTime ? startTime+':00' : '00:00:00'}-23:59:00`
 | 
	
		
			
				|  |  |    }"
 | 
	
	
		
			
				|  | @@ -146,7 +146,7 @@ export default {
 | 
	
		
			
				|  |  |        timeVisible: false,
 | 
	
		
			
				|  |  |        startTime: "",
 | 
	
		
			
				|  |  |        endTime: "",
 | 
	
		
			
				|  |  | -      timeForm:{}
 | 
	
		
			
				|  |  | +      timeForm: {}
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    created() {
 | 
	
	
		
			
				|  | @@ -214,12 +214,19 @@ export default {
 | 
	
		
			
				|  |  |          type: "warning"
 | 
	
		
			
				|  |  |        }).then(() => {
 | 
	
		
			
				|  |  |          // 处理数据
 | 
	
		
			
				|  |  | +        if (this.accompanyForm.count) {
 | 
	
		
			
				|  |  | +          let reg = /^\+?[1-9]\d*$/;
 | 
	
		
			
				|  |  | +          if (!reg.test(this.accompanyForm.count)) {
 | 
	
		
			
				|  |  | +            this.$message.error("每周可预约课次可以不填,或大于0的正整数");
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          let monday, tuesday, wednesday, thursday, friday, saturday, sunday;
 | 
	
		
			
				|  |  |          this.weekList.monday.isHoliday
 | 
	
		
			
				|  |  |            ? (monday = null)
 | 
	
		
			
				|  |  |            : (monday = this.weekList.monday.timeList);
 | 
	
		
			
				|  |  |          this.weekList.tuesday.isHoliday
 | 
	
		
			
				|  |  | -          ? (tuesday =  null)
 | 
	
		
			
				|  |  | +          ? (tuesday = null)
 | 
	
		
			
				|  |  |            : (tuesday = this.weekList.tuesday.timeList);
 | 
	
		
			
				|  |  |          this.weekList.wednesday.isHoliday
 | 
	
		
			
				|  |  |            ? (wednesday = null)
 | 
	
	
		
			
				|  | @@ -241,13 +248,19 @@ export default {
 | 
	
		
			
				|  |  |            userId: this.teacherId,
 | 
	
		
			
				|  |  |            id: this.accompanyId,
 | 
	
		
			
				|  |  |            totalTimes: this.accompanyForm.count,
 | 
	
		
			
				|  |  | -          monday:monday&&monday.length > 0?JSON.stringify(monday):null,
 | 
	
		
			
				|  |  | -          tuesday:tuesday&&tuesday.length > 0?JSON.stringify(tuesday):null,
 | 
	
		
			
				|  |  | -          wednesday:wednesday&&wednesday.length > 0?JSON.stringify(wednesday):null,
 | 
	
		
			
				|  |  | -          thursday:thursday&&thursday.length > 0?JSON.stringify(thursday):null,
 | 
	
		
			
				|  |  | -          friday:friday&&friday.length > 0?JSON.stringify(friday):null,
 | 
	
		
			
				|  |  | -          saturday:saturday&&saturday.length > 0?JSON.stringify(saturday):null,
 | 
	
		
			
				|  |  | -          sunday:sunday&&sunday.length > 0?JSON.stringify(sunday):null
 | 
	
		
			
				|  |  | +          monday: monday && monday.length > 0 ? JSON.stringify(monday) : null,
 | 
	
		
			
				|  |  | +          tuesday:
 | 
	
		
			
				|  |  | +            tuesday && tuesday.length > 0 ? JSON.stringify(tuesday) : null,
 | 
	
		
			
				|  |  | +          wednesday:
 | 
	
		
			
				|  |  | +            wednesday && wednesday.length > 0
 | 
	
		
			
				|  |  | +              ? JSON.stringify(wednesday)
 | 
	
		
			
				|  |  | +              : null,
 | 
	
		
			
				|  |  | +          thursday:
 | 
	
		
			
				|  |  | +            thursday && thursday.length > 0 ? JSON.stringify(thursday) : null,
 | 
	
		
			
				|  |  | +          friday: friday && friday.length > 0 ? JSON.stringify(friday) : null,
 | 
	
		
			
				|  |  | +          saturday:
 | 
	
		
			
				|  |  | +            saturday && saturday.length > 0 ? JSON.stringify(saturday) : null,
 | 
	
		
			
				|  |  | +          sunday: sunday && sunday.length > 0 ? JSON.stringify(sunday) : null
 | 
	
		
			
				|  |  |          }).then(res => {
 | 
	
		
			
				|  |  |            if (res.code == 200) {
 | 
	
		
			
				|  |  |              this.$message.success("保存成功");
 | 
	
	
		
			
				|  | @@ -261,7 +274,7 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      setHoliday(val) {
 | 
	
		
			
				|  |  |        // console.log(val)
 | 
	
		
			
				|  |  | -      
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |        val = parseInt(val);
 | 
	
		
			
				|  |  |        // console.log(val)
 | 
	
		
			
				|  |  |        let arr = [
 | 
	
	
		
			
				|  | @@ -302,41 +315,25 @@ export default {
 | 
	
		
			
				|  |  |        //   }
 | 
	
		
			
				|  |  |        // });
 | 
	
		
			
				|  |  |        // 判断是否在时间内   开始时间是否在时间段内  结束时间是否在时间段内
 | 
	
		
			
				|  |  | -      if(!this.startTime || !this.endTime){
 | 
	
		
			
				|  |  | -        this.$message.error('请填写开始时间或结束时间')
 | 
	
		
			
				|  |  | -        return
 | 
	
		
			
				|  |  | +      if (!this.startTime || !this.endTime) {
 | 
	
		
			
				|  |  | +        this.$message.error("请填写开始时间或结束时间");
 | 
	
		
			
				|  |  | +        return;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        // 开始时间必须不在所有时段内
 | 
	
		
			
				|  |  |        let isStartTime = this.activeItem.timeList.some(item => {
 | 
	
		
			
				|  |  | -        return this.timeIsrange(
 | 
	
		
			
				|  |  | -          item.startTime,
 | 
	
		
			
				|  |  | -          item.endTime,
 | 
	
		
			
				|  |  | -          this.startTime
 | 
	
		
			
				|  |  | -        );
 | 
	
		
			
				|  |  | +        return this.timeIsrange(item.startTime, item.endTime, this.startTime);
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |        // 结束时间必须不在所有时段内
 | 
	
		
			
				|  |  |        let isEndTime = this.activeItem.timeList.some(item => {
 | 
	
		
			
				|  |  | -        return this.timeIsrange(
 | 
	
		
			
				|  |  | -          item.startTime,
 | 
	
		
			
				|  |  | -          item.endTime,
 | 
	
		
			
				|  |  | -          this.endTime
 | 
	
		
			
				|  |  | -        );
 | 
	
		
			
				|  |  | +        return this.timeIsrange(item.startTime, item.endTime, this.endTime);
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |        // 所有时段的开始时间必须不在新增时段内
 | 
	
		
			
				|  |  |        let hasStartTime = this.activeItem.timeList.some(item => {
 | 
	
		
			
				|  |  | -        return this.timeIsrange(
 | 
	
		
			
				|  |  | -          this.startTime,
 | 
	
		
			
				|  |  | -          this.endTime,
 | 
	
		
			
				|  |  | -          item.startTime
 | 
	
		
			
				|  |  | -        );
 | 
	
		
			
				|  |  | +        return this.timeIsrange(this.startTime, this.endTime, item.startTime);
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |        // 所有时段的结束时间必须不在新增时段内
 | 
	
		
			
				|  |  | -         let hasEndtTime = this.activeItem.timeList.some(item => {
 | 
	
		
			
				|  |  | -        return this.timeIsrange(
 | 
	
		
			
				|  |  | -          this.startTime,
 | 
	
		
			
				|  |  | -          this.endTime,
 | 
	
		
			
				|  |  | -          item.endTime
 | 
	
		
			
				|  |  | -        );
 | 
	
		
			
				|  |  | +      let hasEndtTime = this.activeItem.timeList.some(item => {
 | 
	
		
			
				|  |  | +        return this.timeIsrange(this.startTime, this.endTime, item.endTime);
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |        // 开始时间
 | 
	
		
			
				|  |  |        if (isStartTime || isEndTime || hasStartTime || hasEndtTime) {
 | 
	
	
		
			
				|  | @@ -344,8 +341,8 @@ export default {
 | 
	
		
			
				|  |  |          return;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        this.activeItem.timeList.push({
 | 
	
		
			
				|  |  | -        startTime: this.startTime+':00',
 | 
	
		
			
				|  |  | -        endTime: this.endTime+':00'
 | 
	
		
			
				|  |  | +        startTime: this.startTime + ":00",
 | 
	
		
			
				|  |  | +        endTime: this.endTime + ":00"
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |        // 排序
 | 
	
		
			
				|  |  |        this.activeItem.timeList.sort((a, b) => {
 | 
	
	
		
			
				|  | @@ -361,7 +358,7 @@ export default {
 | 
	
		
			
				|  |  |          dateB.setMinutes(bmin);
 | 
	
		
			
				|  |  |          return dateA.getTime() - dateB.getTime();
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  | -   
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |        this.closetimeVisible();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      // 判断时间是否在时间段内
 | 
	
	
		
			
				|  | @@ -439,10 +436,10 @@ export default {
 | 
	
		
			
				|  |  |      changeStartTime() {
 | 
	
		
			
				|  |  |        this.endTime = "";
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    closetimeVisible(){
 | 
	
		
			
				|  |  | +    closetimeVisible() {
 | 
	
		
			
				|  |  |        this.startTime = null;
 | 
	
		
			
				|  |  |        this.endTime = null;
 | 
	
		
			
				|  |  | -      console.log(111)
 | 
	
		
			
				|  |  | +      console.log(111);
 | 
	
		
			
				|  |  |        this.timeVisible = false;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 |