签到添加请假按钮
This commit is contained in:
@@ -98,7 +98,7 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService {
|
|||||||
List<SysOaAttendanceVo> sysOaAttendanceVos = this.queryList(sysOaAttendanceBo);
|
List<SysOaAttendanceVo> sysOaAttendanceVos = this.queryList(sysOaAttendanceBo);
|
||||||
SysOaAttendance add = BeanUtil.toBean(bo, SysOaAttendance.class);
|
SysOaAttendance add = BeanUtil.toBean(bo, SysOaAttendance.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
if (sysOaAttendanceVos.size()<=0){
|
if (sysOaAttendanceVos.isEmpty()){
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
@@ -164,31 +164,6 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService {
|
|||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTime(firstDay);
|
calendar.setTime(firstDay);
|
||||||
result.setTotal(calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
|
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<SysOaAttendance> lqw = Wrappers.lambdaQuery();
|
|
||||||
//
|
|
||||||
// // 查询当月记录
|
|
||||||
// lqw.eq(SysOaAttendance::getUserId, userId)
|
|
||||||
// .ge(SysOaAttendance::getCreateTime,)
|
|
||||||
// .le(SysOaAttendance::getCreateTime,LocalDate.of(year,month,localDate.lengthOfMonth()));
|
|
||||||
// List<SysOaAttendanceVo> sysOaAttendanceVos = baseMapper.selectVoList(lqw);
|
|
||||||
//
|
|
||||||
// List<SysOaProjectVo> 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);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
@@ -232,7 +207,7 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService {
|
|||||||
for (SysOaAttendanceVo oaAttendanceVo : sysOaAttendanceVos) {
|
for (SysOaAttendanceVo oaAttendanceVo : sysOaAttendanceVos) {
|
||||||
|
|
||||||
// 出差问题解决
|
// 出差问题解决
|
||||||
if (oaAttendanceVo.getProjectId()!=0){
|
if (oaAttendanceVo.getProjectId()!=0 && oaAttendanceVo.getProjectId()!=1){
|
||||||
SysOaProjectVo sysOaProjectVo = projectService.queryById(oaAttendanceVo.getProjectId());
|
SysOaProjectVo sysOaProjectVo = projectService.queryById(oaAttendanceVo.getProjectId());
|
||||||
oaAttendanceVo.setColor(sysOaProjectVo.getColor());
|
oaAttendanceVo.setColor(sysOaProjectVo.getColor());
|
||||||
oaAttendanceVo.setSysOaProjectVo(sysOaProjectVo);
|
oaAttendanceVo.setSysOaProjectVo(sysOaProjectVo);
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container" v-loading="loading">
|
<div class="app-container" v-loading="loading">
|
||||||
|
|
||||||
|
|
||||||
|
<el-tabs v-model="activeIndex" @tab-click="handleClickTab">
|
||||||
|
<el-tab-pane label="人员签到表" name="1">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="16">
|
<el-col :span="16">
|
||||||
<el-header class="sign-in-header">
|
<el-header class="sign-in-header">
|
||||||
@@ -36,7 +40,8 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="(user, userIndex) in userList" :key="userIndex">
|
<tr v-for="(user, userIndex) in userList" :key="userIndex">
|
||||||
<td class="user-name" :style="{backgroundColor: user.userId===selectUser.userId&&!selectAll?'#e3f2fd':''}">
|
<td class="user-name"
|
||||||
|
:style="{backgroundColor: user.userId===selectUser.userId&&!selectAll?'#e3f2fd':''}">
|
||||||
{{ user.nickName }}
|
{{ user.nickName }}
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td
|
||||||
@@ -48,9 +53,9 @@
|
|||||||
{{
|
{{
|
||||||
user.attendances.length > 0 &&
|
user.attendances.length > 0 &&
|
||||||
user.attendances.findIndex(i => i.attendanceDay === dayIndex + 1) > -1 &&
|
user.attendances.findIndex(i => i.attendanceDay === dayIndex + 1) > -1 &&
|
||||||
user.attendances[user.attendances.findIndex(i => i.attendanceDay === dayIndex + 1)].projectId === 0
|
(user.attendances[user.attendances.findIndex(i => i.attendanceDay === dayIndex + 1)].projectId === 0 || user.attendances[user.attendances.findIndex(i => i.attendanceDay === dayIndex + 1)].projectId === 1)
|
||||||
? '出差'
|
? user.attendances[user.attendances.findIndex(i => i.attendanceDay === dayIndex + 1)].projectId === 0 ? '出差' : '请假' :
|
||||||
: ''
|
''
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -59,10 +64,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="legend">
|
<div class="legend">
|
||||||
<div class="legend-item">
|
<div class="legend-item">
|
||||||
<div class="legend-color" style="background-color: #fdf6e4;"></div> 出差
|
<div class="legend-color" style="background-color: #fdf6e4;"></div>
|
||||||
|
出差
|
||||||
</div>
|
</div>
|
||||||
<div class="legend-item">
|
<div class="legend-item">
|
||||||
<div class="legend-color" style="background-color: #f3ff52;"></div> 当前选中
|
<div class="legend-color" style="background-color: #f3ff52;"></div>
|
||||||
|
当前选中
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -70,7 +77,8 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<el-header class="header-title" style="display: flex;gap: 10px;flex-direction: column;justify-content: center">
|
<el-header class="header-title"
|
||||||
|
style="display: flex;gap: 10px;flex-direction: column;justify-content: center">
|
||||||
<div>
|
<div>
|
||||||
<i class="el-icon-edit header-icon"></i>
|
<i class="el-icon-edit header-icon"></i>
|
||||||
操作栏
|
操作栏
|
||||||
@@ -79,6 +87,7 @@
|
|||||||
<el-card class="box-card">
|
<el-card class="box-card">
|
||||||
<el-button @click="removeAttendance" type="danger" plain>取消操作</el-button>
|
<el-button @click="removeAttendance" type="danger" plain>取消操作</el-button>
|
||||||
<el-button @click="toTravel" type="warning" plain>出差</el-button>
|
<el-button @click="toTravel" type="warning" plain>出差</el-button>
|
||||||
|
<el-button @click="toFree" type="info" plain>请假</el-button>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card class="box-card">
|
<el-card class="box-card">
|
||||||
<div slot="" class="">
|
<div slot="" class="">
|
||||||
@@ -87,7 +96,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="height: 250px;overflow: auto">
|
<div style="height: 250px;overflow: auto">
|
||||||
<div v-for="(item,index) in sortedProjects" style="display: flex;justify-content: space-between;">
|
<div v-for="(item,index) in sortedProjects" style="display: flex;justify-content: space-between;">
|
||||||
<el-button class="text" :style="{backgroundColor:item.color===''?'':item.color}" @click="signIn(item)">
|
<el-button class="text" :style="{backgroundColor:item.color===''?'':item.color}"
|
||||||
|
@click="signIn(item)">
|
||||||
{{ item.projectName }}
|
{{ item.projectName }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-color-picker class="color-picker" v-model="item.color"
|
<el-color-picker class="color-picker" v-model="item.color"
|
||||||
@@ -129,6 +139,10 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="数据分析" name="2">
|
||||||
|
|
||||||
|
|
||||||
<el-row :gutter="20" class="mb8">
|
<el-row :gutter="20" class="mb8">
|
||||||
<el-col :span="2">
|
<el-col :span="2">
|
||||||
<span class="demonstration">计算月份:</span>
|
<span class="demonstration">计算月份:</span>
|
||||||
@@ -144,7 +158,10 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
|
|
||||||
<el-button @click="calcWork">计算</el-button>
|
<el-button @click="calcWork"
|
||||||
|
element-loading-text="正在计算,请稍等"
|
||||||
|
v-loading.fullscreen.lock="fullscreenLoading"
|
||||||
|
>计算</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
@@ -192,7 +209,7 @@
|
|||||||
</el-table>
|
</el-table>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<bar-chart :projectList="projects"></bar-chart>
|
<bar-chart :projectList="projects" ref="barChart"></bar-chart>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -238,7 +255,7 @@
|
|||||||
<el-descriptions-item>
|
<el-descriptions-item>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
|
|
||||||
当月估计(¥)
|
当月估计(未计算小时)(¥)
|
||||||
</template>
|
</template>
|
||||||
{{ calcUser.laborCost * calcResultItem.workTimes }}
|
{{ calcUser.laborCost * calcResultItem.workTimes }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
@@ -254,7 +271,10 @@
|
|||||||
label="项目名"
|
label="项目名"
|
||||||
width="180">
|
width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div>{{ scope.row.projectId === 0 ? '出差' : scope.row.projectName }}</div>
|
<div>{{
|
||||||
|
scope.row.projectId === 0 ? '出差' : scope.row.projectId === 1 ? '请假' : scope.row.projectName
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
@@ -284,6 +304,9 @@
|
|||||||
<el-button type="primary" @click="showCalc = false">关闭</el-button>
|
<el-button type="primary" @click="showCalc = false">关闭</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -361,10 +384,12 @@ export default {
|
|||||||
selectAll: true,
|
selectAll: true,
|
||||||
calcResult: [],
|
calcResult: [],
|
||||||
calcResultItem: {},
|
calcResultItem: {},
|
||||||
|
activeIndex: '1',
|
||||||
calcResultUser: {},
|
calcResultUser: {},
|
||||||
calcResultAttendances: [],
|
calcResultAttendances: [],
|
||||||
calcResultProject: {},
|
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: {
|
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) {
|
getCellStyle(user, dayIndex) {
|
||||||
const attendanceIndex = user.attendances.findIndex(
|
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() {
|
removeAttendance() {
|
||||||
if (!this.selectAll) {
|
if (!this.selectAll) {
|
||||||
@@ -477,9 +546,11 @@ export default {
|
|||||||
|
|
||||||
// 计算
|
// 计算
|
||||||
calcWork() {
|
calcWork() {
|
||||||
|
this.fullscreenLoading = true;
|
||||||
workCalc(this.date).then(res => {
|
workCalc(this.date).then(res => {
|
||||||
this.calcResult = res.data;
|
this.calcResult = res.data;
|
||||||
this.calcFlag = true;
|
this.calcFlag = true;
|
||||||
|
this.fullscreenLoading = false;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -681,7 +752,8 @@ export default {
|
|||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
.text{
|
|
||||||
|
.text {
|
||||||
width: 70%;
|
width: 70%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|||||||
Reference in New Issue
Block a user