优化考勤

This commit is contained in:
wuxw 2025-10-23 12:25:21 +08:00
parent 7d596bb511
commit ecb5361a08
5 changed files with 78 additions and 31 deletions

View File

@ -54,6 +54,13 @@ export default {
},
methods: {
open(details) {
details.forEach(item => {
if(item.specCd === '1001'){
item.specName = this.$t('staffAttendance.work')
}else{
item.specName = this.$t('staffAttendance.offWork')
}
})
this.details = details || []
this.form = {
detailId: '',

View File

@ -45,10 +45,13 @@ export default {
scheduleId: this.scheduleId,
staffs: this.staffs
}
await saveScheduleClassesStaff(params)
this.$message.success(this.$t('common.operationSuccess'))
const {code,msg} = await saveScheduleClassesStaff(params)
if(code === 0){
this.$emit('success')
this.visible = false
}else{
this.$message.error(msg)
}
} catch (error) {
this.$message.error(this.$t('common.saveError'))
}

View File

@ -214,7 +214,7 @@
<!-- Approvers -->
<div v-show="addContractInfo.audit == '1001'">
<purchase-approvers ref="purchaseApprovers" :flow-type="50005" @notify3="handleNotify"></purchase-approvers>
<purchase-approvers ref="purchaseApprovers" flow-type="50005" @notify3="handleNotify"></purchase-approvers>
</div>
<!-- Buttons -->

View File

@ -228,11 +228,9 @@ export default {
pagePath: 'monthAttendance'
}
await exportMonthAttendance(params)
this.$message.success(this.$t('common.operationSuccess'))
this.$router.push('/pages/property/downloadTempFile?tab=下载中心')
} catch (error) {
this.$message.error(this.$t('monthAttendance.exportError'))
} finally {
this.loading = false
}
},

View File

@ -38,32 +38,34 @@
<el-card class="box-card">
<div class="attendance-grid">
<el-row :gutter="20">
<el-col v-for="index in staffAttendanceManageInfo.maxDay" :key="index" :span="4" class="attendance-day"
<el-col v-for="index in staffAttendanceManageInfo.maxDay" :key="index" :span="4" class="attendance-day "
:style="{ backgroundColor: getBgColor(index) }">
<div class="day-header">
{{ staffAttendanceManageInfo.curYear }}-{{ staffAttendanceManageInfo.curMonth }}-{{ index }}
</div>
<div v-if="getDayAttendance(index) && getDayAttendance(index).state !== '30000'" class="replenish-btn"
@click="replenishCheckIn(index)">
{{ $t('staffAttendance.replenish') }}
</div>
<div v-for="(item, detailIndex) in getAttendanceDetail(index)" :key="detailIndex"
class="attendance-detail">
<div v-if="item.rest">{{ item.rest }}</div>
<div v-else>
{{ item.specCd === '1001' ? $t('staffAttendance.work') : $t('staffAttendance.offWork') }}
<span v-if="item.state !== '10000'">{{ formatTime(item.checkTime) }}</span>
<span v-else> - </span>
<span>({{ item.stateName }})</span>
<div class="labeling-strip">
<div class="day-header">
{{ staffAttendanceManageInfo.curYear }}-{{ staffAttendanceManageInfo.curMonth }}-{{ index }}
</div>
</div>
<div class="log-link">
<el-link type="primary" @click="checkInLog(index)">
{{ $t('staffAttendance.log') }}
</el-link>
<div v-if="getDayAttendance(index) && getDayAttendance(index).state !== '30000'" class="strip"
@click="replenishCheckIn(index)">
<span> {{ $t('staffAttendance.replenish') }}</span>
</div>
<div v-for="(item, detailIndex) in getAttendanceDetail(index)" :key="detailIndex"
class="attendance-detail">
<div v-if="item.rest">{{ item.rest }}</div>
<div v-else>
{{ item.specCd === '1001' ? $t('staffAttendance.work') : $t('staffAttendance.offWork') }}
<span v-if="item.state !== '10000'">{{ formatTime(item.checkTime) }}</span>
<span v-else> - </span>
<span>({{ item.stateName }})</span>
</div>
</div>
<div class="log-link">
<el-link type="primary" @click="checkInLog(index)">
{{ $t('staffAttendance.log') }}
</el-link>
</div>
</div>
</el-col>
</el-row>
@ -76,7 +78,7 @@
<choose-org-tree ref="chooseOrgTree" @switchOrg="handleSwitchOrg"></choose-org-tree>
<staff-attendance-detail ref="staffAttendanceDetail"></staff-attendance-detail>
<staff-attendance-replenish-check-in ref="staffAttendanceReplenishCheckIn"></staff-attendance-replenish-check-in>
<staff-attendance-replenish-check-in ref="staffAttendanceReplenishCheckIn" @success="loadStaffAttendances"></staff-attendance-replenish-check-in>
</div>
</template>
@ -177,6 +179,7 @@ export default {
const { data } = await queryAttendanceClassesTask(params)
this.staffAttendanceManageInfo.attendances = data || []
console.log(this.staffAttendanceManageInfo.attendances)
} catch (error) {
console.error('Failed to load staff attendances:', error)
}
@ -199,8 +202,12 @@ export default {
getDayAttendance(day) {
if (!this.staffAttendanceManageInfo.attendances) return null
const attendance = this.staffAttendanceManageInfo.attendances.find(item => item.taskDay == day)
return this.staffAttendanceManageInfo.attendances.find(item => item.taskDay === day) || null
if (!attendance) {
return null
}
return attendance
},
getAttendanceDetail(day) {
@ -306,11 +313,39 @@ export default {
}
.attendance-grid {
.attendance-day {
padding: 10px;
margin-bottom: 20px;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
height: 120px;
.labeling-strip {
position: relative;
.strip {
position: absolute;
top: 0;
right: 0;
background-color: #409eff;
color: #fff;
padding: 4px 8px;
font-size: 12px;
border-radius: 0 4px 0 4px;
cursor: pointer;
z-index: 1;
&:hover {
background-color: #66b1ff;
}
span {
white-space: nowrap;
}
}
}
.day-header {
font-weight: bold;
@ -318,6 +353,10 @@ export default {
text-align: center;
}
.replenish-btn {
color: #409eff;
cursor: pointer;