|  | @@ -113,6 +113,7 @@
 | 
	
		
			
				|  |  |                :rules="[
 | 
	
		
			
				|  |  |                  { required: true, message: '请输入预计课时数' },
 | 
	
		
			
				|  |  |                  { pattern: /^\+?[1-9]\d*$/, message: '请输入大于0的正整数' },
 | 
	
		
			
				|  |  | +                { validator: validateNum },
 | 
	
		
			
				|  |  |                ]"
 | 
	
		
			
				|  |  |                inline-message
 | 
	
		
			
				|  |  |              >
 | 
	
	
		
			
				|  | @@ -217,7 +218,7 @@
 | 
	
		
			
				|  |  |              <el-form-item
 | 
	
		
			
				|  |  |                inline-message
 | 
	
		
			
				|  |  |                :prop="'classs.' + type + '.cycle.' + scope.$index + '.startDate'"
 | 
	
		
			
				|  |  | -              :rules="[{ required: true, message: '请选择排课起始时间' }]"
 | 
	
		
			
				|  |  | +              :rules="[{ required: true, message: '请选择排课起始日期' }]"
 | 
	
		
			
				|  |  |              >
 | 
	
		
			
				|  |  |                <el-date-picker
 | 
	
		
			
				|  |  |                  v-model.trim="scope.row.startDate"
 | 
	
	
		
			
				|  | @@ -225,7 +226,7 @@
 | 
	
		
			
				|  |  |                  style="width: 180px !important"
 | 
	
		
			
				|  |  |                  type="date"
 | 
	
		
			
				|  |  |                  value-format="yyyy-MM-dd"
 | 
	
		
			
				|  |  | -                placeholder="选择日期"
 | 
	
		
			
				|  |  | +                placeholder="排课起始日期"
 | 
	
		
			
				|  |  |                  @change="
 | 
	
		
			
				|  |  |                    (val) => {
 | 
	
		
			
				|  |  |                      changeStartDate(val, scope.row);
 | 
	
	
		
			
				|  | @@ -238,7 +239,7 @@
 | 
	
		
			
				|  |  |                inline-message
 | 
	
		
			
				|  |  |                :prop="'classs.' + type + '.cycle.' + scope.$index + '.endDate'"
 | 
	
		
			
				|  |  |                :rules="[
 | 
	
		
			
				|  |  | -                { required: true, message: '请选择排课结束时间' },
 | 
	
		
			
				|  |  | +                { required: true, message: '请选择排课结束日期' },
 | 
	
		
			
				|  |  |                  { required: true, trigger: 'change', validator: validatePass },
 | 
	
		
			
				|  |  |                ]"
 | 
	
		
			
				|  |  |              >
 | 
	
	
		
			
				|  | @@ -249,7 +250,7 @@
 | 
	
		
			
				|  |  |                  style="width: 180px !important"
 | 
	
		
			
				|  |  |                  type="date"
 | 
	
		
			
				|  |  |                  value-format="yyyy-MM-dd"
 | 
	
		
			
				|  |  | -                placeholder="选择日期"
 | 
	
		
			
				|  |  | +                placeholder="排课结束日期"
 | 
	
		
			
				|  |  |                >
 | 
	
		
			
				|  |  |                </el-date-picker>
 | 
	
		
			
				|  |  |              </el-form-item>
 | 
	
	
		
			
				|  | @@ -299,21 +300,33 @@ export default {
 | 
	
		
			
				|  |  |      "coreid",
 | 
	
		
			
				|  |  |      "assistant",
 | 
	
		
			
				|  |  |      "endSchoolTerm",
 | 
	
		
			
				|  |  | +    "startCourseDate",
 | 
	
		
			
				|  |  |    ],
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  |      const validatePass = (rule, value, callback) => {
 | 
	
		
			
				|  |  |        // console.log(this.endSchoolTerm, "结束", value);
 | 
	
		
			
				|  |  |        let timer = dayjs(this.endSchoolTerm).valueOf() - dayjs(value).valueOf();
 | 
	
		
			
				|  |  | -      if (this.endSchoolTerm&&timer < 0) {
 | 
	
		
			
				|  |  | +      if (this.endSchoolTerm && timer < 0) {
 | 
	
		
			
				|  |  |          callback(new Error(`结束时间不能超过${this.endSchoolTerm}`));
 | 
	
		
			
				|  |  |        } else {
 | 
	
		
			
				|  |  |          callback();
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    const validateNum = (rule, value, callback) => {
 | 
	
		
			
				|  |  | +      // validUsername
 | 
	
		
			
				|  |  | +      if (this.surplustime < 0) {
 | 
	
		
			
				|  |  | +        callback(new Error("排课时长超过规则限制"));
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        callback();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  |      return {
 | 
	
		
			
				|  |  |        classTimeListByType,
 | 
	
		
			
				|  |  |        useTime: 0,
 | 
	
		
			
				|  |  |        validatePass,
 | 
	
		
			
				|  |  | +      validateNum,
 | 
	
		
			
				|  |  | +      pickerOptions: this.getPickerOptions(),
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    mounted() {
 | 
	
	
		
			
				|  | @@ -328,14 +341,6 @@ export default {
 | 
	
		
			
				|  |  |      // console.log(this.form.cycle);
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    computed: {
 | 
	
		
			
				|  |  | -    pickerOptions() {
 | 
	
		
			
				|  |  | -      return {
 | 
	
		
			
				|  |  | -        firstDayOfWeek: 1,
 | 
	
		
			
				|  |  | -        disabledDate(time) {
 | 
	
		
			
				|  |  | -          return time.getTime() + 86400000 <= new Date().getTime();
 | 
	
		
			
				|  |  | -        },
 | 
	
		
			
				|  |  | -      };
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  |      weekDateList() {
 | 
	
		
			
				|  |  |        return [
 | 
	
		
			
				|  |  |          { value: "1", label: "星期一" },
 | 
	
	
		
			
				|  | @@ -361,7 +366,6 @@ export default {
 | 
	
		
			
				|  |  |        this.$emit("setUserTime", time, this.type);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      create() {
 | 
	
		
			
				|  |  | -      console.log(this.surplustime);
 | 
	
		
			
				|  |  |        if (this.endSchoolTerm) {
 | 
	
		
			
				|  |  |          if (this.surplustime <= 0) {
 | 
	
		
			
				|  |  |            this.$message.error("已排课时长使用完毕,请修改预计课时数");
 | 
	
	
		
			
				|  | @@ -402,10 +406,10 @@ export default {
 | 
	
		
			
				|  |  |          let activeTime = val * Math.max(item.row.expectCourseNum || 0, 0);
 | 
	
		
			
				|  |  |          console.log("activeTime", activeTime);
 | 
	
		
			
				|  |  |          if (this.endSchoolTerm) {
 | 
	
		
			
				|  |  | -           this.$set(
 | 
	
		
			
				|  |  | +          this.$set(
 | 
	
		
			
				|  |  |              item.row,
 | 
	
		
			
				|  |  |              "expectCourseNum",
 | 
	
		
			
				|  |  | -            parseInt((this.surplustime+ activeTime) / val)
 | 
	
		
			
				|  |  | +            parseInt((this.surplustime + activeTime) / val)
 | 
	
		
			
				|  |  |            );
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |            this.$set(
 | 
	
	
		
			
				|  | @@ -445,6 +449,7 @@ export default {
 | 
	
		
			
				|  |  |            (item.expectCourseNum ? parseInt(item.expectCourseNum) : 0) *
 | 
	
		
			
				|  |  |            parseInt(item.time);
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |        this.updateUseTime();
 | 
	
		
			
				|  |  |        //  this.$emit('setUserTime', this.useTime, this.type)
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -530,6 +535,26 @@ export default {
 | 
	
		
			
				|  |  |        this.updateEndTime(row);
 | 
	
		
			
				|  |  |        this.updateUseTime();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    getPickerOptions() {
 | 
	
		
			
				|  |  | +      let that = this
 | 
	
		
			
				|  |  | +      return {
 | 
	
		
			
				|  |  | +        firstDayOfWeek: 1,
 | 
	
		
			
				|  |  | +        disabledDate(time) {
 | 
	
		
			
				|  |  | +            console.log()
 | 
	
		
			
				|  |  | +            if(that.startCourseDate){
 | 
	
		
			
				|  |  | +              // 对比时间
 | 
	
		
			
				|  |  | +            let startTime =  dayjs(that.startCourseDate).valueOf()
 | 
	
		
			
				|  |  | +            let nowDate = new Date().getTime()
 | 
	
		
			
				|  |  | +            let lastTime
 | 
	
		
			
				|  |  | +             startTime -nowDate>0?lastTime = startTime:lastTime = nowDate
 | 
	
		
			
				|  |  | +             return time.getTime() + 86400000 <= lastTime;
 | 
	
		
			
				|  |  | +            }else{
 | 
	
		
			
				|  |  | +               return time.getTime() + 86400000 <= new Date().getTime();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +      };
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  </script>
 |