4.18
This commit is contained in:
@@ -0,0 +1,331 @@
|
||||
<template>
|
||||
<view class="home-page">
|
||||
<!-- 考勤管理部分 -->
|
||||
<view class="section attendance">
|
||||
<view class="section-header">
|
||||
<view class="left">
|
||||
<image class="icon" src="/static/WorkAtt.png" mode="aspectFit"></image>
|
||||
<text>考勤管理</text>
|
||||
</view>
|
||||
<view class="right"><text class="blue-text">月度考勤</text></view>
|
||||
</view>
|
||||
<view class="section-content" style="display: flex; justify-content: space-between; align-items: center">
|
||||
<text class="title">{{ selectedYear }}年{{ selectedMonth < 10 ? '0' + selectedMonth : selectedMonth }}月考勤统计</text>
|
||||
<view class="combination" @click="viewDetails">
|
||||
<text class="detail">查看详情</text>
|
||||
<image class="icon" src="/static/arr.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 工资条部分 -->
|
||||
<view class="section salary">
|
||||
<view class="section-header">
|
||||
<view class="left">
|
||||
<image class="icon" src="/static/money.png" mode="aspectFit"></image>
|
||||
<text>工资条</text>
|
||||
</view>
|
||||
<view class="right" @click="showDatePicker">
|
||||
<text>{{ selectedYear }}年{{ selectedMonth < 10 ? '0' + selectedMonth : selectedMonth }}月</text>
|
||||
<image class="arrow" src="/static/arr.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="section-content">
|
||||
<text class="title">{{ selectedYear }}年{{ selectedMonth < 10 ? '0' + selectedMonth : selectedMonth }}月工资条</text>
|
||||
<view class="warning">
|
||||
<text class="warning-icon">⚠</text>
|
||||
<text class="watext">工资表为系统自动生成,如有疑问请联系财务部门</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="view-details" @click="viewSalaryDetails"><text>查看明细</text></view>
|
||||
</view>
|
||||
|
||||
<!-- 日期选择模态框 -->
|
||||
<view class="date-picker-modal" v-if="showModal" @click.stop="closeDatePicker">
|
||||
<view class="modal-content" @click.stop>
|
||||
<view class="modal-title">{{ currentStep === 'year' ? '选择年份' : '选择月份' }}</view>
|
||||
|
||||
<!-- 年份选择 -->
|
||||
<view class="year-grid" v-if="currentStep === 'year'">
|
||||
<view v-for="year in availableYears" :key="year" class="year-item" :class="{ active: tempSelectedYear === year }" @click="selectYear(year)">
|
||||
<view class="year-circle">
|
||||
<text>{{ year }}年</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 月份选择 -->
|
||||
<view class="month-grid" v-if="currentStep === 'month'">
|
||||
<view v-for="month in months" :key="month" class="month-item" :class="{ active: tempSelectedMonth === month }" @click="selectMonth(month)">
|
||||
<view class="month-circle">
|
||||
<text>{{ tempSelectedYear }}年{{ month < 10 ? '0' + month : month }}月</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="modal-footer" v-if="currentStep === 'month'"><view class="back-btn" @click="backToYearSelect">返回年份选择</view></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
const currentDate = new Date();
|
||||
const currentYear = currentDate.getFullYear();
|
||||
return {
|
||||
showModal: false,
|
||||
currentYear,
|
||||
selectedYear: currentYear,
|
||||
selectedMonth: currentDate.getMonth() + 1,
|
||||
months: Array.from({ length: 12 }, (_, i) => i + 1),
|
||||
currentStep: 'year',
|
||||
tempSelectedYear: currentYear,
|
||||
tempSelectedMonth: currentDate.getMonth() + 1,
|
||||
availableYears: Array.from({ length: 7 }, (_, i) => currentYear - 3 + i)
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.$setNavigationBar('人资系统');
|
||||
},
|
||||
methods: {
|
||||
showDatePicker() {
|
||||
this.showModal = true;
|
||||
this.currentStep = 'year';
|
||||
this.tempSelectedYear = this.selectedYear;
|
||||
this.tempSelectedMonth = this.selectedMonth;
|
||||
},
|
||||
closeDatePicker() {
|
||||
this.showModal = false;
|
||||
this.currentStep = 'year';
|
||||
},
|
||||
selectYear(year) {
|
||||
this.tempSelectedYear = year;
|
||||
this.currentStep = 'month';
|
||||
},
|
||||
selectMonth(month) {
|
||||
this.tempSelectedMonth = month;
|
||||
this.selectedYear = this.tempSelectedYear;
|
||||
this.selectedMonth = month;
|
||||
this.showModal = false;
|
||||
this.currentStep = 'year';
|
||||
this.$emit('dateSelected', {
|
||||
year: this.selectedYear,
|
||||
month: this.selectedMonth
|
||||
});
|
||||
console.log('选择月份触发');
|
||||
},
|
||||
backToYearSelect() {
|
||||
this.currentStep = 'year';
|
||||
},
|
||||
|
||||
viewDetails() {
|
||||
this.$navTo('/pages/attendanceManagement/attendanceManagement');
|
||||
},
|
||||
viewSalaryDetails(){
|
||||
this.$navTo('/pages/salaryDetails/salaryDetails');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.home-page {
|
||||
overflow: hidden;
|
||||
min-height: 100vh;
|
||||
background-color: #f8f9fa;
|
||||
padding: 0 30rpx;
|
||||
.section {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
margin-top: 24rpx;
|
||||
padding: 30rpx;
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
text {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 36rpx;
|
||||
color: #111827;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #666;
|
||||
font-size: 28rpx;
|
||||
.blue-text {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #2b5ce4;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
transform: rotate(90deg);
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.section-content {
|
||||
margin-top: 35rpx;
|
||||
.title {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 30rpx;
|
||||
color: #4b5563;
|
||||
}
|
||||
.combination {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.detail {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 28rpx;
|
||||
color: #4b5563;
|
||||
}
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.warning {
|
||||
margin-top: 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #ff6b01;
|
||||
font-size: 28rpx;
|
||||
|
||||
.warning-icon {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.watext {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #b9b9c2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.view-details {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
margin-top: 42rpx;
|
||||
height: 78rpx;
|
||||
background: #0078ff;
|
||||
border-radius: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.date-picker-modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
z-index: 999;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.modal-content {
|
||||
width: 690rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
padding: 40rpx 30rpx;
|
||||
|
||||
.modal-title {
|
||||
font-size: 32rpx;
|
||||
color: #111827;
|
||||
text-align: center;
|
||||
margin-bottom: 40rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.year-grid,
|
||||
.month-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 20rpx;
|
||||
padding: 0 20rpx;
|
||||
|
||||
.year-item,
|
||||
.month-item {
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.year-circle,
|
||||
.month-circle {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 8rpx;
|
||||
border: 2rpx solid #e5e7eb;
|
||||
|
||||
text {
|
||||
font-size: 28rpx;
|
||||
color: #4b5563;
|
||||
}
|
||||
}
|
||||
|
||||
&.active {
|
||||
.year-circle,
|
||||
.month-circle {
|
||||
background: #eef2ff;
|
||||
border-color: #2b5ce4;
|
||||
|
||||
text {
|
||||
color: #2b5ce4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
margin-top: 30rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
.back-btn {
|
||||
padding: 20rpx 40rpx;
|
||||
font-size: 28rpx;
|
||||
color: #2b5ce4;
|
||||
background: #eef2ff;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user