oa初步完成

This commit is contained in:
2024-11-16 20:08:00 +08:00
parent 17ef95ebae
commit 76403c1cf8
35 changed files with 1157 additions and 93 deletions

View File

@@ -7,7 +7,7 @@
<thead>
<tr>
<th width="80"></th>
<th v-for="(item,index) in 31" :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,7 +15,7 @@
<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 31" @click="selectAttendDay(item,index,index2+1)"
<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>
@@ -72,6 +72,152 @@
</el-col>
</el-row>
<el-row :gutter="20" class="mb8">
<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>
</el-col>
<el-col :span="1.5">
<el-button @click="calcWork">计算</el-button>
</el-col>
</el-row>
<el-row :gutter="20" >
<el-table
:data="userList"
stripe
style="width: 60%">
<el-table-column
type="index"
label="序号"
width="180">
</el-table-column>
<el-table-column
prop="nickName"
label="员工姓名"
width="180">
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope" >
<el-button
size="mini"
type="text"
icon="el-icon-edit"
v-if="calcFlag"
@click="handleCalc(scope.row)"
v-hasPermi="['oa:oaWarehouse:edit']"
>查看考勤结果</el-button>
<el-button
size="mini"
type="text"
v-else
disabled
icon="el-icon-edit"
@click="handleCalc(scope.row)"
v-hasPermi="['oa:oaWarehouse:edit']"
>请选择日期计算</el-button>
</template>
</el-table-column>
</el-table>
</el-row>
<el-dialog
title="计算结果"
:visible.sync="showCalc"
width="70%"
>
<div class="container">
<h1>员工个人财务与签到报告 - {{calcUser.nickName}}</h1>
<!-- 员工基本信息 -->
<div class="employee-info">
<p><strong>员工姓名</strong> {{calcUser.nickName}}</p>
<p><strong>职位</strong> 员工</p>
</div>
<!-- 月度工作情况表格 -->
<h2>{{date.getMonth()}} 月度工作签到情况</h2>
<el-descriptions class="margin-top" title="报告详情" :column="3" :size="size" border>
<template slot="extra">
<div>总工作时长{{calcResultItem.workTimes}}</div>
</template>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-user"></i>
员工姓名
</template>
{{calcUser.nickName}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
<i class="el-icon-mobile-phone"></i>
人力成本
</template>
{{calcUser.laborCost}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
当月估计()
</template>
{{calcUser.laborCost*calcResultItem.workTimes}}
</el-descriptions-item>
</el-descriptions>
<el-table
:data="calcResultAttendances"
stripe
style="width: 100%">
<el-table-column
prop="projectName"
label="项目名"
width="180">
</el-table-column>
<el-table-column
prop="count"
label="签到(天)"
width="180">
</el-table-column>
<el-table-column
prop="workTimes"
label="工作时长(天)">
</el-table-column>
</el-table>
<div class="footer">
<p>© 2024 财务与签到报告 | 由公司财务部门生成</p>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="showCalc = false">关闭</el-button>
</span>
</el-dialog>
</div>
</template>
@@ -80,7 +226,8 @@
import {listWorker} from "@/api/system/user";
import {listProject, updateProject} from "@/api/oa/project";
import {listOaAttendance} from "@/api/oa/oaAttendance";
import {addBatchOaAttendance, addOaAttendance} from "../../../api/oa/oaAttendance";
import {addBatchOaAttendance, addOaAttendance, getDateLength, workCalc} from "../../../api/oa/oaAttendance";
import item from "../../../layout/components/Sidebar/Item.vue";
export default {
name: "Project",
@@ -91,12 +238,19 @@ export default {
selectIndex: new Date().getDate(),
// 用户列表
userList: [],
// 计算结果
calcFlag:false,
// 项目列表
projectList: [],
loading: true,
selectHead: new Date().getDate(),
// 当前月的天数
dateLength:31,
// 计算提交月份
date:new Date(),
// 提交表单
form: {},
showCalc:false,
// 查询参数
userQueryParams: {
pageNum: 1,
@@ -106,6 +260,8 @@ export default {
status: undefined,
deptId: undefined
},
calcUser:{
},
queryParams:{
pageNum: 1,
pageSize: 50,
@@ -116,6 +272,7 @@ export default {
projectQueryParams: {
pageNum: 1,
pageSize: 10,
projectStatus:0,
projectName: undefined,
projectNum: undefined,
beginTime: undefined,
@@ -125,17 +282,48 @@ export default {
// 日期范围
dateRange: [],
selectAll: true,
calcResult:[],
calcResultItem:{},
calcResultUser:{},
calcResultAttendances:[],
calcResultProject:{},
}
},
mounted() {
const day = new Date().getDate();
},
created() {
this.getDate();
this.getList();
},
methods: {
// 查看计算结果
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;
})
},
getDate(){
getDateLength().then(res => {
this.dateLength = res.data;
})
},
selectAttendDay(item,index, index2) {
this.selectIndex = index2;
this.selectAll = false;
@@ -153,7 +341,6 @@ export default {
getList() {
this.loading = true;
listOaAttendance(this.queryParams).then(res=>{
console.log(res.data)
this.userList = res.data;
this.total = res.total;
});