上传文件前代码保存
This commit is contained in:
@@ -141,6 +141,17 @@ public class SysOaAttendanceController extends BaseController {
|
||||
return toAjax(iSysOaAttendanceService.deleteWithValidByIds(Arrays.asList(ids), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除人员考勤
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@Log(title = "人员考勤", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/all/{day}")
|
||||
public R<Void> delOaAttendanceAll(@PathVariable Long day) {
|
||||
return toAjax(iSysOaAttendanceService.delOaAttendanceAll(day));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增人员考勤
|
||||
|
||||
@@ -17,4 +17,6 @@ import java.util.List;
|
||||
public interface SysOaAttendanceMapper extends BaseMapperPlus<SysOaAttendanceMapper, SysOaAttendance, SysOaAttendanceVo> {
|
||||
|
||||
List<SysOaAttendanceVo> selectVoListAndTime(@Param("userId") Long userId, @Param("firstDay") Date firstDay, @Param("lastDay") Date lastDay);
|
||||
|
||||
int delOaAttendanceAll(@Param("firstDay") Date firstDay, @Param("lastDay")Date lastDay,@Param("day")Long day);
|
||||
}
|
||||
|
||||
@@ -70,4 +70,10 @@ public interface ISysOaAttendanceService {
|
||||
*/
|
||||
List<LaborCostData> workerCalc(Date time);
|
||||
|
||||
/**
|
||||
* 删除当月某日所有人的签到记录
|
||||
* @param day 日期
|
||||
* @return
|
||||
*/
|
||||
int delOaAttendanceAll(Long day);
|
||||
}
|
||||
|
||||
@@ -197,21 +197,11 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService {
|
||||
*/
|
||||
@Override
|
||||
public List<LaborCostData> workerCalc(Date time) {
|
||||
|
||||
String firstDay = DateUtils.parseDateToStr("yyyy-MM-01", time);
|
||||
|
||||
String format = "yyyy-MM-";
|
||||
// 计算某月的天数
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(time);
|
||||
String dateLength = String.valueOf(calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
// 将字符串拼接
|
||||
format +=dateLength;
|
||||
String lastDay = DateUtils.parseDateToStr(format, time);
|
||||
// 查询所有的工人
|
||||
List<Long> userIds = sysUserRoleMapper.selectUserIdsByRoleId(1852970465740505090L);
|
||||
|
||||
|
||||
Date firstDay = getFirstDay(time);
|
||||
Date lastDay = getLastDay(time);
|
||||
List<LaborCostData> costDataList = new ArrayList<>();
|
||||
for (Long userId : userIds) {
|
||||
SysUserVo sysUser = BeanUtil.toBean(sysUserService.selectUserById(userId), SysUserVo.class);
|
||||
@@ -219,12 +209,10 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService {
|
||||
sysOaAttendanceVo.setUserId(sysUser.getUserId());
|
||||
|
||||
// 查询某月记录
|
||||
List<SysOaAttendanceVo> sysOaAttendanceVos = baseMapper.selectVoListAndTime(userId, DateUtils.parseDate(firstDay),DateUtils.parseDate(lastDay));
|
||||
|
||||
List<SysOaAttendanceVo> sysOaAttendanceVos = baseMapper.selectVoListAndTime(userId, firstDay,lastDay);
|
||||
List<SysOaProjectVo> projectVos = new ArrayList<>();
|
||||
|
||||
Double workTimes = 0.0;
|
||||
System.out.println(sysOaAttendanceVos);
|
||||
|
||||
for (SysOaAttendanceVo oaAttendanceVo : sysOaAttendanceVos) {
|
||||
SysOaProjectVo sysOaProjectVo = projectService.queryById(oaAttendanceVo.getProjectId());
|
||||
oaAttendanceVo.setColor(sysOaProjectVo.getColor());
|
||||
@@ -247,4 +235,33 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService {
|
||||
|
||||
return costDataList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除当月某日所有人的记录
|
||||
* @param day 日期
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int delOaAttendanceAll(Long day) {
|
||||
|
||||
Date now = new Date();
|
||||
return baseMapper.delOaAttendanceAll(getFirstDay(now),getLastDay(now),day);
|
||||
}
|
||||
|
||||
private Date getFirstDay(Date time){
|
||||
String firstDay = DateUtils.parseDateToStr("yyyy-MM-01", time);
|
||||
return DateUtils.parseDate(firstDay);
|
||||
}
|
||||
|
||||
private Date getLastDay(Date time){
|
||||
String format = "yyyy-MM-";
|
||||
// 计算某月的天数
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(time);
|
||||
String dateLength = String.valueOf(calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
// 将字符串拼接
|
||||
format +=dateLength;
|
||||
|
||||
return DateUtils.parseDate(DateUtils.parseDateToStr(format, time));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,10 +271,7 @@ public class SysOaOutWarehouseServiceImpl implements ISysOaOutWarehouseService {
|
||||
//其中一条
|
||||
sysOaOutWarehouses.forEach(sysOaOutWarehouse -> {
|
||||
//选出相对应的 库存表中那一条的数据
|
||||
LambdaQueryWrapper<SysOaWarehouse> lqw2 = Wrappers.lambdaQuery();
|
||||
lqw2.eq(SysOaWarehouse::getId, sysOaOutWarehouse.getWarehouseId());
|
||||
SysOaWarehouse warehouse = warehouseMapper.selectOne(lqw2);
|
||||
|
||||
SysOaWarehouse warehouse = warehouseMapper.selectVoByIdAndXml(sysOaOutWarehouse.getWarehouseId());
|
||||
// 恢复原本出库的数量
|
||||
warehouse.setInventory(warehouse.getInventory() + sysOaOutWarehouse.getAmount());
|
||||
warehouseMapper.updateById(warehouse);
|
||||
|
||||
@@ -45,5 +45,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
group by soa.project_id
|
||||
</select>
|
||||
|
||||
<delete id="delOaAttendanceAll">
|
||||
delete from sys_oa_attendance where
|
||||
attendance_day = #{day}
|
||||
and #{lastDay} > create_time
|
||||
and create_time > #{firstDay}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -70,3 +70,14 @@ export function delOaAttendance(id) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 删除人员考勤
|
||||
export function delOaAttendanceAll(id) {
|
||||
return request({
|
||||
url: '/oa/oaAttendance/all/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
<template>
|
||||
<div class="app-container" v-loading="loading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="14">
|
||||
签到表
|
||||
<el-col :span="16">
|
||||
|
||||
<el-header> 签到表</el-header>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="80"></th>
|
||||
<th v-for="(item,index) in dateLength" :class="selectHead===index+1?'selectBox':''" @click="selectMany(index+1)">
|
||||
<th v-for="(item,index) in dateLength" :class="selectHead===index+1?'selectBox':''"
|
||||
@click="selectMany(index+1)">
|
||||
{{ index + 1 }}
|
||||
</th>
|
||||
</tr>
|
||||
@@ -21,24 +23,26 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-col :span="8">
|
||||
|
||||
<div>
|
||||
|
||||
<el-header> 操作栏</el-header>
|
||||
<el-card class="box-card">
|
||||
<el-button @click="removeAttendance" type="danger" plain>取消操作</el-button>
|
||||
</el-card>
|
||||
<el-card class="box-card">
|
||||
<div slot="" class="">
|
||||
<span><i class="el-icon-s-order"></i> 项目列表</span>
|
||||
<!-- <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>-->
|
||||
</div>
|
||||
<div v-for="(item,index) in projectList" style="display: flex;justify-content: space-between">
|
||||
<el-button class="text" :style="{backgroundColor:item.color===''?'':item.color}" @click="signIn(item)">{{ item.projectName }}
|
||||
<el-button class="text" :style="{backgroundColor:item.color===''?'':item.color}" @click="signIn(item)">
|
||||
{{ item.projectName }}
|
||||
</el-button>
|
||||
<el-color-picker class="text" v-model="item.color" @change="changeItemColor(item)"></el-color-picker>
|
||||
<el-color-picker class="color-picker" v-model="item.color" @change="changeItemColor(item)"></el-color-picker>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
|
||||
|
||||
<el-card class="box-card">
|
||||
<div slot="" class="">
|
||||
<span><i class="el-icon-timer"></i>工作时长</span>
|
||||
@@ -67,6 +71,8 @@
|
||||
</el-select>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</el-col>
|
||||
@@ -120,7 +126,8 @@
|
||||
v-if="calcFlag"
|
||||
@click="handleCalc(scope.row)"
|
||||
v-hasPermi="['oa:oaWarehouse:edit']"
|
||||
>查看考勤结果</el-button>
|
||||
>查看考勤结果
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@@ -129,7 +136,8 @@
|
||||
icon="el-icon-edit"
|
||||
@click="handleCalc(scope.row)"
|
||||
v-hasPermi="['oa:oaWarehouse:edit']"
|
||||
>请选择日期计算</el-button>
|
||||
>请选择日期计算
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -155,7 +163,6 @@
|
||||
<h2>{{ date.getMonth() }} 月度工作签到情况</h2>
|
||||
|
||||
|
||||
|
||||
<el-descriptions class="margin-top" title="报告详情" :column="3" :size="size" border>
|
||||
<template slot="extra">
|
||||
<div>总工作时长(天):{{ calcResultItem.workTimes }}</div>
|
||||
@@ -205,8 +212,6 @@
|
||||
</el-table>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="footer">
|
||||
<p>© 2024 财务与签到报告 | 由公司财务部门生成</p>
|
||||
</div>
|
||||
@@ -226,7 +231,14 @@
|
||||
import {listWorker} from "@/api/system/user";
|
||||
import {listProject, updateProject} from "@/api/oa/project";
|
||||
import {listOaAttendance} from "@/api/oa/oaAttendance";
|
||||
import {addBatchOaAttendance, addOaAttendance, getDateLength, workCalc} from "../../../api/oa/oaAttendance";
|
||||
import {
|
||||
addBatchOaAttendance,
|
||||
addOaAttendance,
|
||||
delOaAttendance,
|
||||
getDateLength,
|
||||
workCalc,
|
||||
delOaAttendanceAll
|
||||
} from "../../../api/oa/oaAttendance";
|
||||
import item from "../../../layout/components/Sidebar/Item.vue";
|
||||
|
||||
export default {
|
||||
@@ -260,8 +272,7 @@ export default {
|
||||
status: undefined,
|
||||
deptId: undefined
|
||||
},
|
||||
calcUser:{
|
||||
},
|
||||
calcUser: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 50,
|
||||
@@ -299,19 +310,33 @@ export default {
|
||||
|
||||
methods: {
|
||||
|
||||
// 删除签到
|
||||
removeAttendance(){
|
||||
if (!this.selectAll){
|
||||
const attendanceId = this.selectUser.attendances.find(item=>item.attendanceDay===this.selectIndex).id
|
||||
delOaAttendance(attendanceId).then(res=>{
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
this.getList();
|
||||
})
|
||||
}else{
|
||||
delOaAttendanceAll(this.selectIndex).then(res=>{
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
this.getList();
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// 查看计算结果
|
||||
handleCalc(row) {
|
||||
this.showCalc = true;
|
||||
this.calcUser = row
|
||||
|
||||
this.calcResultItem = this.calcResult.filter(item => item.sysUser.userId === this.calcUser.userId)[0]
|
||||
this.calcResultAttendances = this.calcResultItem.attendances
|
||||
console.log(this.calcResultItem)
|
||||
},
|
||||
|
||||
// 计算
|
||||
calcWork() {
|
||||
|
||||
workCalc(this.date).then(res => {
|
||||
this.calcResult = res.data;
|
||||
this.calcFlag = true;
|
||||
@@ -352,8 +377,10 @@ export default {
|
||||
},
|
||||
|
||||
changeItemColor(item) {
|
||||
updateProject(item);
|
||||
updateProject(item).then(res=>{
|
||||
this.getList();
|
||||
})
|
||||
|
||||
},
|
||||
signIn(project) {
|
||||
// 一个签到
|
||||
@@ -378,9 +405,7 @@ export default {
|
||||
}
|
||||
addOaAttendance(this.form).then(res => {
|
||||
this.selectUser = this.selectArrayIndex >= this.userList.length - 1 ? this.selectUser : this.userList[this.selectArrayIndex + 1]
|
||||
|
||||
this.getList()
|
||||
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -434,7 +459,26 @@ table {
|
||||
|
||||
.text {
|
||||
font-size: 16px;
|
||||
width: 70%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
border-bottom: #cccccc 1px dashed;
|
||||
margin: 5px 0;
|
||||
}
|
||||
.color-picker{
|
||||
font-size: 16px;
|
||||
width: 30%;
|
||||
|
||||
|
||||
border-bottom: #cccccc 1px dashed;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.el-header, .el-footer {
|
||||
background-color: #f6f6f6;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
line-height: 60px;
|
||||
border-radius: 7px 7px 0 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -547,8 +547,7 @@ export default {
|
||||
this.loading = true;
|
||||
return delOaOutWarehouse(ids);
|
||||
}).then(() => {
|
||||
|
||||
this.handleSearch(this.searchItem);
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
|
||||
Reference in New Issue
Block a user