diff --git a/src/views/process/evection/index.vue b/src/views/process/evection/index.vue index 349d319..b08c6df 100644 --- a/src/views/process/evection/index.vue +++ b/src/views/process/evection/index.vue @@ -538,17 +538,25 @@ export default { // 开始日期选择限制 startPickerOptions: { disabledDate: (v) => { + const today = new Date() + today.setHours(0, 0, 0, 0) if (this.form.leaveEndDate) { - return v.getTime() > new Date(this.form.leaveEndDate).getTime() + const end = new Date(this.form.leaveEndDate); + end.setHours(0, 0, 0, 0); + return v.getTime() > end.getTime() || v.getTime() < today.getTime(); } + return v.getTime() < today.getTime() }, }, // 结束日期选择限制 endPickerOptions: { disabledDate: (v) => { + const today = new Date() + today.setHours(0, 0, 0, 0) if (this.form.leaveStartDate) { return v.getTime() < new Date(this.form.leaveStartDate).getTime() - 86400000; // - 86400000是否包括当天 } + return v.getTime() < today.getTime() }, }, daysNumber:"", diff --git a/src/views/process/leaveReporting/index.vue b/src/views/process/leaveReporting/index.vue index 249b9eb..c20c1bd 100644 --- a/src/views/process/leaveReporting/index.vue +++ b/src/views/process/leaveReporting/index.vue @@ -491,17 +491,25 @@ export default { // 开始日期选择限制 startPickerOptions: { disabledDate: (v) => { + const today = new Date() + today.setHours(0, 0, 0, 0) if (this.form.leaveEndDate) { - return v.getTime() > new Date(this.form.leaveEndDate).getTime() + const end = new Date(this.form.leaveEndDate); + end.setHours(0, 0, 0, 0); + return v.getTime() > end.getTime() || v.getTime() < today.getTime(); } + return v.getTime() < today.getTime() }, }, // 结束日期选择限制 endPickerOptions: { disabledDate: (v) => { + const today = new Date() + today.setHours(0, 0, 0, 0) if (this.form.leaveStartDate) { return v.getTime() < new Date(this.form.leaveStartDate).getTime() - 86400000; // - 86400000是否包括当天 } + return v.getTime() < today.getTime() }, }, daysNumber:"", diff --git a/src/views/process/outApply/index.vue b/src/views/process/outApply/index.vue index 9a44727..04f3d7a 100644 --- a/src/views/process/outApply/index.vue +++ b/src/views/process/outApply/index.vue @@ -398,17 +398,27 @@ export default { // 开始日期选择限制 startPickerOptions: { disabledDate: (v) => { + const today = new Date() + today.setHours(0, 0, 0, 0) + if (this.form.leaveEndDate) { - return v.getTime() > new Date(this.form.leaveEndDate).getTime() + const end = new Date(this.form.leaveEndDate); + end.setHours(0, 0, 0, 0); + + return v.getTime() > end.getTime() || v.getTime() < today.getTime(); } + return v.getTime() < today.getTime() }, }, // 结束日期选择限制 endPickerOptions: { disabledDate: (v) => { + const today = new Date() + today.setHours(0, 0, 0, 0) if (this.form.leaveStartDate) { return v.getTime() < new Date(this.form.leaveStartDate).getTime() - 86400000; // - 86400000是否包括当天 } + return v.getTime() < today.getTime() }, }, daysNumber: "", diff --git a/src/views/process/restApply/index.vue b/src/views/process/restApply/index.vue index 012a07c..c366201 100644 --- a/src/views/process/restApply/index.vue +++ b/src/views/process/restApply/index.vue @@ -1,605 +1,644 @@ + + + + + + + + + + + + + - + }, + created() { + this.getList() + this.getUserLists() + }, + methods: { + async handleDateChange() { + if (this.form.leaveStartDate && this.form.leaveEndDate) { + //添加默认值 + this.form.leaveStartInterval = 1 + this.form.leaveEndInterval = 2 + + await this.daysBetween(this.form.leaveStartDate, this.form.leaveEndDate) + console.log(this.daysNumber) + this.form.leaveDuration = this.daysNumber + } + }, + async daysBetween(date1, date2) { + var data = { + 'leaveStartDate': date1, + 'leaveEndDate': date2 + } + await getDaysDate(data).then(response => { + this.daysNumber = response.data.date + }) + }, + /** 查询列表 */ + getList() { + this.loading = true + listHoliday(this.queryParams).then(response => { + this.tableList = response.rows + this.total = response.total + this.loading = false + } + ) + }, + getUserLists() { + const Id = this.$store.state.user.id + getUserList(Id).then(response => { + this.userList = response.data.data + console.log('userList', this.userList) + }) + }, + // 取消按钮 + cancel() { + this.open = false + this.reset() + }, + // 表单重置 + reset() { + this.form = { + userId: this.userInfo.id, + userName: this.userInfo.name, + orgId: undefined, + leaveStartDate: undefined, + leaveStartInterval: undefined, + leaveEndDate: undefined, + leaveEndInterval: undefined, + leaveDuration: undefined, + leaveType: '轮休', + examineStatus: '0', + isAgree: '0', + hostUserId: [], + leaveReason: undefined + } + this.resetForm('form') + }, + /** 搜索按钮操作 */ + handleQuery() { + this.queryParams.pageNum = 1 + this.getList() + }, + /** 重置按钮操作 */ + resetQuery() { + this.dateRange = [] + this.resetForm('queryForm') + this.handleQuery() + }, + /** 新增按钮操作 */ + handleAdd() { + console.log(this.userInfo) + console.log(this.orgList) + this.reset() + const Id = this.$store.state.user.id + getPostName(Id).then(response => { + this.form.postName = response.data.postName + this.open = true + this.isView = false + this.title = '新增' + }) + }, + // 多选框选中数据 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.Id) + this.single = selection.length != 1 + this.multiple = !selection.length + }, + /** 修改按钮操作 */ + handleUpdate(row) { + this.reset() + const Id = row.id + const userId = this.$store.state.user.id + let postName + getPostName(userId).then(response => { + postName = response.data.postName + return getHoliday(Id) + }).then(holidayResponse => { + // 更新表单的 holiday 信息 + this.form = holidayResponse.data + console.log(this.form) + + // 转换 hostUserId 字段为整数数组 + if (this.form.hostUserId == null) { + this.$set(this.form, 'hostUserId', 0) + } else { + let numArr = this.form.hostUserId.split(',') + let num = numArr.map(item => parseInt(item)) // 使用 map 简化代码 + this.$set(this.form, 'hostUserId', num) + } + this.$set(this.form, 'postName', postName) + // 更新视图状态 + this.open = true + this.isView = false + this.title = '编辑' + }) + }, + handleView(row) { + this.reset() + const Id = row.id + const userId = this.$store.state.user.id + let postName + getPostName(userId).then(response => { + postName = response.data.postName + return getHoliday(Id) + }).then(holidayResponse => { + // 更新表单的 holiday 信息 + this.form = holidayResponse.data + console.log(this.form) + + // 转换 hostUserId 字段为整数数组 + if (this.form.hostUserId == null) { + this.$set(this.form, 'hostUserId', 0) + } else { + let numArr = this.form.hostUserId.split(',') + let num = numArr.map(item => parseInt(item)) // 使用 map 简化代码 + this.$set(this.form, 'hostUserId', num) + } + this.$set(this.form, 'postName', postName) + // 更新视图状态 + this.open = true + this.isView = true + this.title = '查看' + }) + }, + //选择部门 + changDept(e) { + console.log(e) + this.orgList.forEach(item => { + if (item.id == e) { + this.form.orgName = item.name + } + }) + }, + /** 提交按钮 */ + submitForm: function() { + console.log(this.form) + this.$refs['form'].validate(valid => { + if (valid) { + console.log(this.form) + var list = this.form.hostUserId.join(',') + + // 将字符串分割成数组 + const userIdArray = list.split(',') + // 检查数组中是否同时存在0和其他非0的值 + const containsZero = userIdArray.includes('0') + const containsOtherValues = userIdArray.some(id => id !== '0') + if (containsZero && containsOtherValues) { + this.$modal.msgError('选择’/‘后不能在选择其他人员') + return + } + + this.form.hostUserId = list + if (this.form.id != undefined) { + this.form.examineStatus = 0 + updateHoliday(this.form).then(response => { + this.$modal.msgSuccess('修改成功') + this.open = false + this.getList() + }) + } else { + addHoliday(this.form).then(response => { + this.$modal.msgSuccess('新增成功') + this.open = false + this.getList() + }) + } + } + }) + }, + handleBack(row) { + var that = this + this.$modal.confirm('是否确认撤回该申请?').then(function() { + let param = { + id: row.id, + examineStatus: '3' + } + changeHolidayStatus(param).then(response => { + that.getList() + this.$modal.msgSuccess('撤回成功') + }) + }) + }, + /** 删除按钮操作 */ + handleDelete(row) { + const Ids = row.id + this.$modal.confirm('是否确认删除该申请?').then(function() { + return delHoliday(Ids) + }).then(() => { + this.getList() + this.$modal.msgSuccess('删除成功') + }).catch(() => { + }) + }, + /** 导出按钮操作 */ + handleExport() { + this.queryParams.exportType = '查询' + exportHoliday(this.queryParams).then(res => { + this.downloadFile({ + fileName: `轮休_${new Date().getTime()}.xlsx`, + fileData: res, + fileType: 'application/vnd.ms-excel;charset=utf-8' + }) + }) + } + + } +} + diff --git a/src/views/process/workReport/index.vue b/src/views/process/workReport/index.vue index e181888..99ba30f 100644 --- a/src/views/process/workReport/index.vue +++ b/src/views/process/workReport/index.vue @@ -56,7 +56,7 @@ @@ -588,7 +588,7 @@ export default { this.title = "轮休人员"; } else if (type==='临时外出'){ this.title = "临时外出人员"; - } else if (type==='出差报备'){ + } else if (type==='出差'){ this.title = "出差人员"; } else if (type==='请假'){ this.title = "请假人数"; @@ -619,7 +619,7 @@ export default { }); }, handleRowClick(row) { - if (this.searchConditions.type==='出差报备'){ + if (this.searchConditions.type==='出差'){ getEvection(row.uuId).then(response => { this.form = response.data; let num = [];