From 4a77a525bc98b03aebc226a809fa14397b9ed3c2 Mon Sep 17 00:00:00 2001 From: 86156 <823267011@qq.com> Date: Mon, 30 Dec 2024 18:11:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E6=B7=BB=E5=8A=A0=E8=AF=B7?= =?UTF-8?q?=E5=81=87=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SysOaAttendanceServiceImpl.java | 29 +- ruoyi-ui/src/views/oa/attendance/index.vue | 622 ++++++++++-------- 2 files changed, 349 insertions(+), 302 deletions(-) diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SysOaAttendanceServiceImpl.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SysOaAttendanceServiceImpl.java index 2191c9b..f7a648b 100644 --- a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SysOaAttendanceServiceImpl.java +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/SysOaAttendanceServiceImpl.java @@ -98,7 +98,7 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService { List sysOaAttendanceVos = this.queryList(sysOaAttendanceBo); SysOaAttendance add = BeanUtil.toBean(bo, SysOaAttendance.class); validEntityBeforeSave(add); - if (sysOaAttendanceVos.size()<=0){ + if (sysOaAttendanceVos.isEmpty()){ boolean flag = baseMapper.insert(add) > 0; if (flag) { bo.setId(add.getId()); @@ -164,31 +164,6 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService { Calendar calendar = Calendar.getInstance(); calendar.setTime(firstDay); result.setTotal(calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); -// for (Long userId : userIds) { -// SysUserVo sysUser = BeanUtil.toBean(sysUserService.selectUserById(userId), SysUserVo.class); -// SysOaAttendanceVo sysOaAttendanceVo = new SysOaAttendanceVo(); -// sysOaAttendanceVo.setUserId(sysUser.getUserId()); -// LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); -// -// // 查询当月记录 -// lqw.eq(SysOaAttendance::getUserId, userId) -// .ge(SysOaAttendance::getCreateTime,) -// .le(SysOaAttendance::getCreateTime,LocalDate.of(year,month,localDate.lengthOfMonth())); -// List sysOaAttendanceVos = baseMapper.selectVoList(lqw); -// -// List projectVos = new ArrayList<>(); -// for (SysOaAttendanceVo oaAttendanceVo : sysOaAttendanceVos) { -// // 当projectId等于0时代表 当前为出差状态 -// if(oaAttendanceVo.getProjectId()!=0){ -// SysOaProjectVo sysOaProjectVo = projectService.queryById(oaAttendanceVo.getProjectId()); -// oaAttendanceVo.setColor(sysOaProjectVo.getColor()); -// projectVos.add(sysOaProjectVo); -// } -// } -// sysUser.setProjects(projectVos); -// sysUser.setAttendances(sysOaAttendanceVos); -// sysUserVos.add(sysUser); -// } // 优化查询 return TableDataInfo.build(result); } @@ -232,7 +207,7 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService { for (SysOaAttendanceVo oaAttendanceVo : sysOaAttendanceVos) { // 出差问题解决 - if (oaAttendanceVo.getProjectId()!=0){ + if (oaAttendanceVo.getProjectId()!=0 && oaAttendanceVo.getProjectId()!=1){ SysOaProjectVo sysOaProjectVo = projectService.queryById(oaAttendanceVo.getProjectId()); oaAttendanceVo.setColor(sysOaProjectVo.getColor()); oaAttendanceVo.setSysOaProjectVo(sysOaProjectVo); diff --git a/ruoyi-ui/src/views/oa/attendance/index.vue b/ruoyi-ui/src/views/oa/attendance/index.vue index 22b178d..83edca2 100644 --- a/ruoyi-ui/src/views/oa/attendance/index.vue +++ b/ruoyi-ui/src/views/oa/attendance/index.vue @@ -1,289 +1,312 @@ @@ -361,10 +384,12 @@ export default { selectAll: true, calcResult: [], calcResultItem: {}, + activeIndex: '1', calcResultUser: {}, calcResultAttendances: [], calcResultProject: {}, - projects: [] + projects: [], + fullscreenLoading:false, } }, @@ -389,8 +414,28 @@ export default { } }, + watch: { + activeIndex(newVal) { + if (newVal === '2') { // 数据分析 Tab + this.$nextTick(() => { + this.$refs.barChart && this.$refs.barChart.resize(); + }); + } + } + }, + methods: { + // // tag切换方法 + // handleClickTab(tag,event){ + // if (tag.index===1){ + // this.$nextTick(() => { + // console.log("1284u0") + // this.$refs.barChart && this.$refs.barChart.resize(); // 假设你的 BarChart 组件提供了 resize 方法 + // }); + // } + // }, + // 获取单元格的样式 getCellStyle(user, dayIndex) { const attendanceIndex = user.attendances.findIndex( @@ -450,6 +495,30 @@ export default { } }, + toFree() { + if (!this.selectAll) { + this.form = { + projectId: 1, + userId: this.selectUser.userId, + attendanceDay: this.selectIndex, + } + addOaAttendance(this.form).then(res => { + this.getList() + this.selectUser = this.selectArrayIndex >= this.userList.length - 1 ? this.selectUser : this.userList[this.selectArrayIndex + 1] + + }) + } else { + this.form = { + projectId: 1, + attendanceDay: this.selectIndex, + } + // 集体赋予状态 + addBatchOaAttendance(this.form).then(res => { + this.getList() + }) + } + }, + // 删除签到 removeAttendance() { if (!this.selectAll) { @@ -477,9 +546,11 @@ export default { // 计算 calcWork() { + this.fullscreenLoading = true; workCalc(this.date).then(res => { this.calcResult = res.data; this.calcFlag = true; + this.fullscreenLoading = false; }) }, @@ -681,7 +752,8 @@ export default { margin-right: 8px; border-radius: 3px; } -.text{ + +.text { width: 70%; overflow: hidden; text-overflow: ellipsis;