BAOLH
2026-09-17 a7f8b9e44ae8e5349bb7f80d799ad9fd3085ab0e
Merge branch 'wcd-2411-update' into wcd
1 files modified
55 ■■■■■ changed files
eladmin-web-master/src/views/attendance/attendanceLeave/index.vue 55 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/attendance/attendanceLeave/index.vue
@@ -508,33 +508,36 @@
      if (this.form.leaveType == null || this.form.leaveStartTime == null || this.form.leaveEndTime == null) {
        return
      }
      // 获取年假剩余时长
      crudAttendanceLeave.getYearTimeLength((this.form.userId == null ? 1 : this.form.userId), this.form.leaveStartTime.substring(0, 4)).then(res => {
        this.yearTimeLength = res
      })
      // 获取调休假剩余时长
      crudAttendanceLeave.getOverTimeLength((this.form.userId == null ? 1 : this.form.userId), this.form.leaveStartTime.substring(0, 7)).then(res => {
        this.overTimeLength = res
      })
      // 通过后台计算时长
      var data = JSON.stringify({
        'leaveType': this.form.leaveType,
        'leaveStartTime': this.form.leaveStartTime,
        'leaveEndTime': this.form.leaveEndTime
      })
      crudAttendanceLeave.calcTimeLength(data).then(res => {
        // 年假和计算的时长作比较
        if (this.form.leaveType === this.dictLeaveTypeAnnualLeave && this.yearTimeLength < res.leaveDuration) {
      Promise.all([
        // 获取年假剩余时长
        crudAttendanceLeave.getYearTimeLength((this.form.userId == null ? 1 : this.form.userId), this.form.leaveStartTime.substring(0, 4)).then(res => {
          this.yearTimeLength = res
        }),
        // 获取调休假剩余时长
        crudAttendanceLeave.getOverTimeLength((this.form.userId == null ? 1 : this.form.userId), this.form.leaveStartTime.substring(0, 7)).then(res => {
          this.overTimeLength = res
        })
      ]).then(() => {
        // 通过后台计算时长
        var data = JSON.stringify({
          'leaveType': this.form.leaveType,
          'leaveStartTime': this.form.leaveStartTime,
          'leaveEndTime': this.form.leaveEndTime
        })
        crudAttendanceLeave.calcTimeLength(data).then(res => {
          // 年假和计算的时长作比较
          if (this.form.leaveType === this.dictLeaveTypeAnnualLeave && this.yearTimeLength < res.leaveDuration) {
            this.form.leaveDuration = null
            this.crud.notify('年假剩余时间不足', CRUD.NOTIFICATION_TYPE.ERROR)
          } else if (this.form.leaveType === this.dictLeaveTypeReplace && this.overTimeLength < res.leaveDuration) {
            this.form.leaveDuration = null
            this.crud.notify('调休假剩余时间不足', CRUD.NOTIFICATION_TYPE.ERROR)
          } else {
            this.form.leaveDuration = res.leaveDuration
          }
        }).catch(() => {
          this.form.leaveDuration = null
          this.crud.notify('年假剩余时间不足', CRUD.NOTIFICATION_TYPE.ERROR)
        } else if (this.form.leaveType === this.dictLeaveTypeReplace && this.overTimeLength < res.leaveDuration) {
          this.form.leaveDuration = null
          this.crud.notify('调休假剩余时间不足', CRUD.NOTIFICATION_TYPE.ERROR)
        } else {
          this.form.leaveDuration = res.leaveDuration
        }
      }).catch(() => {
        this.form.leaveDuration = null
        })
      })
    },
    // 审批页面赋值