上传文件前代码保存

This commit is contained in:
2024-11-29 14:45:56 +08:00
parent d6b81d4559
commit b443c006a7
9 changed files with 234 additions and 141 deletions

View File

@@ -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));
}
/**
* 新增人员考勤

View File

@@ -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);
}

View File

@@ -70,4 +70,10 @@ public interface ISysOaAttendanceService {
*/
List<LaborCostData> workerCalc(Date time);
/**
* 删除当月某日所有人的签到记录
* @param day 日期
* @return
*/
int delOaAttendanceAll(Long day);
}

View File

@@ -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));
}
}

View File

@@ -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);

View File

@@ -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>

View File

@@ -70,3 +70,14 @@ export function delOaAttendance(id) {
method: 'delete'
})
}
// 删除人员考勤
export function delOaAttendanceAll(id) {
return request({
url: '/oa/oaAttendance/all/' + id,
method: 'delete'
})
}

View File

@@ -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>
@@ -15,77 +17,81 @@
<tbody>
<tr v-for="(item,index) in userList">
<td :class="(item.userId===selectUser.userId || selectAll)?'selectBox':''">{{ item.nickName }}</td>
<td v-for="(item2,index2) in dateLength" @click="selectAttendDay(item,index,index2+1)"
:style="{backgroundColor:(item.attendances.length>0 && item.attendances.findIndex(i=>i.attendanceDay === index2+1) >-1) ?item.attendances[item.attendances.findIndex(i=>i.attendanceDay === index2+1)].color:(index2+1===selectIndex&&(item.userId===selectUser.userId || selectAll)?'#f3ff52':'')}"></td>
<td v-for="(item2,index2) in dateLength" @click="selectAttendDay(item,index,index2+1)"
:style="{backgroundColor:(item.attendances.length>0 && item.attendances.findIndex(i=>i.attendanceDay === index2+1) >-1) ?item.attendances[item.attendances.findIndex(i=>i.attendanceDay === index2+1)].color:(index2+1===selectIndex&&(item.userId===selectUser.userId || selectAll)?'#f3ff52':'')}"></td>
</tr>
</tbody>
</table>
</el-col>
<el-col :span="5">
<el-col :span="8">
<div>
<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>-->
<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>
<el-color-picker class="color-picker" v-model="item.color" @change="changeItemColor(item)"></el-color-picker>
</div>
</el-card>
<el-card class="box-card">
<div slot="" class="">
<span><i class="el-icon-timer"></i>工作时长</span>
<div style="margin: 20px 0 ">
<el-radio-group v-model="timeFlag">
<el-radio :label="0">天计</el-radio>
<el-radio :label="1">小时计</el-radio>
</el-radio-group>
</div>
<el-select v-if="timeFlag===0" v-model="form.dayLength" placeholder="请选择工作时长">
<el-option
v-for="dict in dict.type.work_time_length"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
<el-select v-if="timeFlag===1" v-model="form.hour" placeholder="请选择工作时长">
<el-option
v-for="dict in dict.type.work_time_length_hour"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</div>
</el-card>
</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>
<el-color-picker class="text" 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>
<div style="margin: 20px 0 ">
<el-radio-group v-model="timeFlag">
<el-radio :label="0">天计</el-radio>
<el-radio :label="1">小时计</el-radio>
</el-radio-group>
</div>
<el-select v-if="timeFlag===0" v-model="form.dayLength" placeholder="请选择工作时长">
<el-option
v-for="dict in dict.type.work_time_length"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
<el-select v-if="timeFlag===1" v-model="form.hour" placeholder="请选择工作时长">
<el-option
v-for="dict in dict.type.work_time_length_hour"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</div>
</el-card>
</el-col>
</el-row>
<el-row :gutter="20" class="mb8">
<el-col :span="2">
<el-col :span="2">
<span class="demonstration">计算月份:</span>
</el-col>
<el-col :span="6">
<div class="block">
<el-date-picker
v-model="date"
type="month"
placeholder="选择日期">
</el-date-picker>
</div>
<div class="block">
<el-date-picker
v-model="date"
type="month"
placeholder="选择日期">
</el-date-picker>
</div>
</el-col>
<el-col :span="1.5">
@@ -93,7 +99,7 @@
</el-col>
</el-row>
<el-row :gutter="20" >
<el-row :gutter="20">
<el-table
:data="userList"
@@ -101,7 +107,7 @@
style="width: 60%">
<el-table-column
type="index"
type="index"
label="序号"
width="180">
</el-table-column>
@@ -112,7 +118,7 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope" >
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@@ -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>
@@ -140,46 +148,45 @@
title="计算结果"
:visible.sync="showCalc"
width="70%"
>
>
<div class="container">
<h1>员工个人财务与签到报告 - {{calcUser.nickName}}</h1>
<h1>员工个人财务与签到报告 - {{ calcUser.nickName }}</h1>
<!-- 员工基本信息 -->
<div class="employee-info">
<p><strong>员工姓名</strong> {{calcUser.nickName}}</p>
<p><strong>员工姓名</strong> {{ calcUser.nickName }}</p>
<p><strong>职位</strong> 员工</p>
</div>
<!-- 月度工作情况表格 -->
<h2>{{date.getMonth()}} 月度工作签到情况</h2>
<h2>{{ date.getMonth() }} 月度工作签到情况</h2>
<el-descriptions class="margin-top" title="报告详情" :column="3" :size="size" border>
<template slot="extra">
<div>总工作时长{{calcResultItem.workTimes}}</div>
<div>总工作时长{{ calcResultItem.workTimes }}</div>
</template>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-user"></i>
员工姓名
</template>
{{calcUser.nickName}}
{{ calcUser.nickName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-mobile-phone"></i>
人力成本
</template>
{{calcUser.laborCost}}
{{ calcUser.laborCost }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
当月估计()
</template>
{{calcUser.laborCost*calcResultItem.workTimes}}
{{ calcUser.laborCost * calcResultItem.workTimes }}
</el-descriptions-item>
</el-descriptions>
@@ -205,8 +212,6 @@
</el-table>
<div class="footer">
<p>© 2024 财务与签到报告 | 由公司财务部门生成</p>
</div>
@@ -226,12 +231,19 @@
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 {
name: "Project",
dicts: ['work_time_length','work_time_length_hour'],
dicts: ['work_time_length', 'work_time_length_hour'],
data() {
return {
// 选择索引
@@ -239,18 +251,18 @@ export default {
// 用户列表
userList: [],
// 计算结果
calcFlag:false,
calcFlag: false,
// 项目列表
projectList: [],
loading: true,
selectHead: new Date().getDate(),
// 当前月的天数
dateLength:31,
dateLength: 31,
// 计算提交月份
date:new Date(),
date: new Date(),
// 提交表单
form: {},
showCalc:false,
showCalc: false,
// 查询参数
userQueryParams: {
pageNum: 1,
@@ -260,19 +272,18 @@ export default {
status: undefined,
deptId: undefined
},
calcUser:{
},
queryParams:{
calcUser: {},
queryParams: {
pageNum: 1,
pageSize: 50,
},
selectArrayIndex:new Date().getDate(),
selectArrayIndex: new Date().getDate(),
timeFlag: 0,
// 项目查询参数
projectQueryParams: {
pageNum: 1,
pageSize: 10,
projectStatus:0,
projectStatus: 0,
projectName: undefined,
projectNum: undefined,
beginTime: undefined,
@@ -282,11 +293,11 @@ export default {
// 日期范围
dateRange: [],
selectAll: true,
calcResult:[],
calcResultItem:{},
calcResultUser:{},
calcResultAttendances:[],
calcResultProject:{},
calcResult: [],
calcResultItem: {},
calcResultUser: {},
calcResultAttendances: [],
calcResultProject: {},
}
},
mounted() {
@@ -299,32 +310,46 @@ 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){
handleCalc(row) {
this.showCalc = true;
this.calcUser = row
this.calcResultItem = this.calcResult.filter(item=>item.sysUser.userId===this.calcUser.userId)[0]
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=>{
calcWork() {
workCalc(this.date).then(res => {
this.calcResult = res.data;
this.calcFlag = true;
})
},
getDate(){
getDate() {
getDateLength().then(res => {
this.dateLength = res.data;
})
},
selectAttendDay(item,index, index2) {
selectAttendDay(item, index, index2) {
this.selectIndex = index2;
this.selectAll = false;
this.selectUser = item;
@@ -340,7 +365,7 @@ export default {
/** 查询用户列表 */
getList() {
this.loading = true;
listOaAttendance(this.queryParams).then(res=>{
listOaAttendance(this.queryParams).then(res => {
this.userList = res.data;
this.total = res.total;
});
@@ -352,46 +377,46 @@ export default {
},
changeItemColor(item) {
updateProject(item);
this.getList();
updateProject(item).then(res=>{
this.getList();
})
},
signIn(project){
signIn(project) {
// 一个签到
if (this.form.dayLength === undefined && this.timeFlag === 0) {
this.$message({ message: '请选择工作时长', type: 'warning' })
this.$message({message: '请选择工作时长', type: 'warning'})
return;
}
if (this.form.hour === undefined && this.timeFlag === 1) {
this.$message({ message: '请选择工作时长', type: 'warning' })
this.$message({message: '请选择工作时长', type: 'warning'})
return;
}
let time = this.timeFlag===0?this.form.dayLength:this.form.hour
let time = this.timeFlag === 0 ? this.form.dayLength : this.form.hour
if (!this.selectAll){
if (!this.selectAll) {
this.form = {
projectId:project.projectId,
userId:this.selectUser.userId,
attendanceDay:this.selectIndex,
dayLength: this.timeFlag===0?this.form.dayLength:undefined,
hour:this.timeFlag===1?this.form.hour:undefined
projectId: project.projectId,
userId: this.selectUser.userId,
attendanceDay: this.selectIndex,
dayLength: this.timeFlag === 0 ? this.form.dayLength : undefined,
hour: this.timeFlag === 1 ? this.form.hour : undefined
}
addOaAttendance(this.form).then(res=>{
this.selectUser = this.selectArrayIndex>=this.userList.length-1?this.selectUser:this.userList[this.selectArrayIndex+1]
addOaAttendance(this.form).then(res => {
this.selectUser = this.selectArrayIndex >= this.userList.length - 1 ? this.selectUser : this.userList[this.selectArrayIndex + 1]
this.getList()
})
}else{
} else {
this.form = {
projectId:project.projectId,
attendanceDay:this.selectIndex,
dayLength: this.timeFlag===0?this.form.dayLength:undefined,
hour:this.timeFlag===1?this.form.hour:undefined
projectId: project.projectId,
attendanceDay: this.selectIndex,
dayLength: this.timeFlag === 0 ? this.form.dayLength : undefined,
hour: this.timeFlag === 1 ? this.form.hour : undefined
}
// 集体赋予状态
addBatchOaAttendance(this.form).then(res=>{
addBatchOaAttendance(this.form).then(res => {
this.getList()
})
}
@@ -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>

View File

@@ -547,8 +547,7 @@ export default {
this.loading = true;
return delOaOutWarehouse(ids);
}).then(() => {
this.handleSearch(this.searchItem);
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {