This commit is contained in:
hezhidong
2025-04-23 18:00:35 +08:00
parent 44cba1950d
commit d2c8a95723
6 changed files with 609 additions and 459 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
const baseUrl = "http://192.168.31.166:8189" // 肖兴越开发环境
// const baseUrl = "http://192.168.31.166:8188" const baseUrl = "https://paystubs.vip.cpolar.top"
export default baseUrl export default baseUrl
+18 -12
View File
@@ -1,25 +1,31 @@
/*首页*/ /*首页*/
import { request } from "./index.js"; import { request, requestLogin } from "./index.js";
// 登录 // 登录
export function getToken(code){ export function getToken(authCode){
return request({ return requestLogin({
method: "get", method: "GET",
url: "/user/getToken", url: `/login?code=${authCode}`,
data: { data: {
code
}, },
Header1: { Header1: {
} }
}) })
} }
// 获取用户信息
// 创建工单 export function getUser(authCode){
export function postCreatOrder(data){
return request({ return request({
method: "post", method: "get",
url: "creatOrder/add", url: "/user",
data data: {
},
})
}
// 获取绩效考勤统计
export function getPerformanceAttendanceApi(year,month){
return request({
method: "get",
url: `/performance/attendance/detail/${year}/${month}`,
}) })
} }
+80 -10
View File
@@ -1,31 +1,101 @@
// const baseUrl = "https://pandamimi.lzyyj.com/prod-api";
// const baseUrl = "http://192.168.31.121:9221";
import baseUrl from "./baseUrl.js" import allUrl from "./baseUrl.js"
// const baseUrl = bootUrl // const baseUrl = bootUrl
export function request ( optaions ) { export function request ( optaions ) {
let { url, method, data, header1 } = optaions let { url, method, data, header1 } = optaions
method = method || "GET" method = method || "GET"
data = data || {} data = data || {}
let newData = {}
for( let key in data){
if( data[key] !== null && data[key] !== ''){
newData[key] = data[key]
}
}
data = newData || {}
header1 = header1 || { header1 = header1 || {
Authorization: uni.getStorageSync('token') Authorization: 'Bearer ' + uni.getStorageSync('token')
} }
// console.log(com.getCacheToken("userInfo").token)
return new Promise((reslove,reject)=>{ return new Promise((reslove,reject)=>{
uni.request({ uni.request({
url: baseUrl + url, url: allUrl + url,
method, method,
header: header1, header: header1,
data, data,
success: (res) => { success: (res) => {
if(res.data.code == 401 ){ if(res.data.errcode == 401 ){
uni.showToast({ title: '登录已失效,重新登录!', icon: 'none' }); uni.showToast({ title: '登录已失效,即将重新登录!', icon: 'none' });
uni.removeStorageSync('userInfo'); uni.removeStorageSync('userInfo');
uni.removeStorageSync('token'); uni.removeStorageSync('token');
setTimeout(()=>{ setTimeout(()=>{
uni.navigateTo({ url: '/pages/user/login' }); uni.reLaunch({ url: '/pages/newHomePage/newHomePage' });
}, 1000); }, 1000);
}else if(res.data.code != 200){ }else if(res.data.errcode != 0){
console.log('不正确走的')
reject(res)
uni.showToast({ title: res.data.errmsg, icon: 'none', duration: 2000 });
}else {
reslove(res.data)
}
},
fail: (err) => {
console.log('请求失败',err)
uni.hideLoading()
if(err.statusCode == 401 ){
uni.showToast({ title: '登录已失效,即将重新登录!', icon: 'none' });
uni.removeStorageSync('userInfo');
uni.removeStorageSync('token');
setTimeout(()=>{
uni.reLaunch({ url: '/pages/newHomePage/newHomePage' });
}, 1000);
}
if(err.data.errcode == 401 ){
uni.showToast({ title: '登录已失效,即将重新登录!', icon: 'none' });
uni.removeStorageSync('userInfo');
uni.removeStorageSync('token');
setTimeout(()=>{
uni.reLaunch({ url: '/pages/newHomePage/newHomePage' });
}, 1000);
}else{
uni.showToast({ title: err.data.errmsg, icon: 'none' });
}
reject()
},
complete: () => {
setTimeout(()=>{
uni.hideLoading()
}, 2000)
}
})
})
}
export function requestLogin ( optaions ) {
let { url, method, data } = optaions
method = method || "GET"
data = data || {}
let newData = {}
for( let key in data){
if( data[key] !== null && data[key] !== ''){
newData[key] = data[key]
}
}
data = newData || {}
return new Promise((reslove,reject)=>{
uni.request({
url: allUrl + url,
method,
data,
success: (res) => {
if(res.statusCode == 401 ){
uni.showToast({ title: '登录已失效,即将返回首页!', icon: 'none' });
uni.removeStorageSync('userInfo');
uni.removeStorageSync('token');
setTimeout(()=>{
uni.reLaunch({ url: '/pages/newHomePage/newHomePage' });
}, 1000);
}else if(res.statusCode != 200){
reject(res) reject(res)
uni.showToast({ title: res.data.msg, icon: 'none', duration: 2000 }); uni.showToast({ title: res.data.msg, icon: 'none', duration: 2000 });
}else { }else {
+27 -12
View File
@@ -2,7 +2,7 @@ import App from './App'
import Inputli from './components/form/input-li.vue'; import Inputli from './components/form/input-li.vue';
import Selectli from './components/form/select-li.vue'; import Selectli from './components/form/select-li.vue';
import Dateli from './components/form/date-li.vue'; import Dateli from './components/form/date-li.vue';
import { getToken } from './api/create.js' import { getToken,getUser } from './api/create.js'
import { formatDate, calculator } from './com/index.js' import { formatDate, calculator } from './com/index.js'
// #ifndef VUE3 // #ifndef VUE3
@@ -33,18 +33,33 @@ const navTo = (url, skip = 'navigateTo') =>{
url url
}); });
} }
const login = () =>{ const login = () => {
return new Promise((reslove,reject)=>{ // uni.showLoading({
// mask: true,
// title: '登录中...'
// })
return new Promise((reslove, reject) => {
uni.getAuthCode({ uni.getAuthCode({
success:(user)=>{ success: (user) => {
console.log(user) getToken(user.authCode).then((res) => {
getToken(user.authCode).then((res)=>{ if (res.errcode == 0) {
if(res){ uni.setStorageSync('token', res.result.token)
reslove(res.data) getUser().then(data => {
console.log(res.data) console.log(data)
uni.setStorageSync('user',data)
uni.hideLoading()
// uni.showToast({
// title: '登录成功',
// icon: 'success'
// })
})
reslove(res)
} }
}).catch(err =>{ }).catch(err => {
reject(err) uni.showToast({
title: '登录失败,服务器出错了',
icon: 'error'
})
}) })
}, },
}) })
@@ -72,7 +87,7 @@ const showModel = (content) =>{
}) })
} }
Vue.prototype.$navTo = navTo // 页面跳转 Vue.prototype.$navTo = navTo //
Vue.prototype.$msg = msg Vue.prototype.$msg = msg
Vue.prototype.$setNavigationBar = setNavigationBar Vue.prototype.$setNavigationBar = setNavigationBar
Vue.prototype.$login = login Vue.prototype.$login = login
@@ -1,469 +1,516 @@
<template> <template>
<view class="attendance-page"> <view class="attendance-page">
<!-- 月份选择 --> <!-- 月份选择 -->
<view class="month-selector" @click="showDatePicker"> <view class="month-selector" @click="showDatePicker">
<view class="combination"> <view class="combination">
<text class="current-month" <text class="current-month">{{ selectedYear }}{{ selectedMonth < 10 ? '0' + selectedMonth : selectedMonth }}</text>
>{{ selectedYear }}{{ <image class="arrow" src="/static/arr.png" mode="aspectFit"></image>
selectedMonth < 10 ? "0" + selectedMonth : selectedMonth </view>
}}</text <text class="month-text">月度</text>
> </view>
<image class="arrow" src="/static/arr.png" mode="aspectFit"></image>
</view>
<text class="month-text">月度</text>
</view>
<!-- 打卡统计 --> <!-- 打卡统计 -->
<view class="stat-section"> <view class="stat-section">
<view class="section-title">打卡统计</view> <view class="section-title">打卡统计</view>
<view class="stat-grid"> <view class="stat-grid">
<view class="stat-item"> <view class="stat-item">
<text class="label">迟到</text> <text class="label">迟到</text>
<text class="value red-text">4</text> <text class="value red-text">{{ attendanceData.late }}</text>
</view> </view>
<view class="stat-item"> <view class="stat-item">
<text class="label">严重迟到</text> <text class="label">严重迟到</text>
<text class="value red-text">3</text> <text class="value red-text">{{ attendanceData.seriousLate }}</text>
</view> </view>
<view class="stat-item"> <view class="stat-item">
<text class="label">旷工迟到</text> <text class="label">旷工</text>
<text class="value">0</text> <text class="value">{{ attendanceData.absenteeism }}</text>
</view> </view>
<view class="stat-item"> <view class="stat-item">
<text class="label">早退</text> <text class="label">早退</text>
<text class="value red-text">1</text> <text class="value red-text">{{ attendanceData.early }}</text>
</view> </view>
<view class="stat-item"> <view class="stat-item">
<text class="label">未打卡</text> <text class="label">未打卡</text>
<text class="value red-text">2</text> <text class="value red-text">{{ attendanceData.absenceCount }}</text>
</view> </view>
</view> <view class="stat-item">
</view> <text class="label">未签到签退</text>
<text class="value red-text">{{ attendanceData.missedCount }}</text>
</view>
<view class="stat-item">
<text class="label">未提交日志</text>
<text class="value red-text">{{ attendanceData.missingLogCount }}</text>
</view>
</view>
</view>
<!-- 请假统计 --> <!-- 请假统计 -->
<view class="stat-section"> <view class="stat-section">
<view class="section-title">请假统计</view> <view class="section-title">请假统计</view>
<view class="stat-grid"> <view class="stat-grid">
<view class="stat-item"> <view class="stat-item">
<text class="label">事假</text> <text class="label">事假</text>
<text class="value red-text">4</text> <text class="value red-text">{{ attendanceData.personalLeave }}小时</text>
</view> </view>
<view class="stat-item"> <view class="stat-item">
<text class="label">病假</text> <text class="label">病假</text>
<text class="value red-text">3</text> <text class="value red-text">{{ attendanceData.sickLeave }}</text>
</view> </view>
<view class="stat-item"> <view class="stat-item">
<text class="label">婚假</text> <text class="label">婚假</text>
<text class="value">0</text> <text class="value">{{ attendanceData.marriageLeave }}</text>
</view> </view>
<view class="stat-item"> <view class="stat-item">
<text class="label">产假</text> <text class="label">产假</text>
<text class="value red-text">1</text> <text class="value red-text">{{ attendanceData.maternityLeave }}</text>
</view> </view>
<view class="stat-item"> <view class="stat-item">
<text class="label">陪产假</text> <text class="label">陪产假</text>
<text class="value red-text">2</text> <text class="value red-text">{{ attendanceData.paternityLeave }}</text>
</view> </view>
<view class="stat-item"> <view class="stat-item">
<text class="label">丧假</text> <text class="label">丧假</text>
<text class="value red-text">2</text> <text class="value red-text">{{ attendanceData.bereavementLeave }}</text>
</view> </view>
</view> <view class="stat-item">
</view> <text class="label">年休假</text>
<text class="value red-text">{{ attendanceData.annualLeave }}</text>
</view>
<view class="stat-item">
<text class="label">年休假(管理岗)</text>
<text class="value red-text">{{ attendanceData.managementAnnualLeave }}</text>
</view>
</view>
</view>
<!-- 加班调休统计 --> <!-- 加班调休统计 -->
<view class="stat-section"> <view class="stat-section">
<view class="section-title">加班调休统计</view> <view class="section-title">加班调休统计</view>
<view class="stat-grid"> <view class="stat-grid">
<view class="stat-item"> <view class="stat-item">
<text class="label">节假日加班</text> <text class="label">节假日加班</text>
<text class="value red-text">4</text> <text class="value red-text">{{ attendanceData.holidayOvertime }}小时</text>
</view> </view>
<view class="stat-item"> <view class="stat-item">
<text class="label">休息日加班</text> <text class="label">休息日加班</text>
<text class="value red-text">3</text> <text class="value red-text">{{ attendanceData.restdayOvertime }}小时</text>
</view> </view>
<view class="stat-item"> <view class="stat-item">
<text class="label">工作日加班</text> <text class="label">工作日加班</text>
<text class="value">0</text> <text class="value">{{ attendanceData.workdayOvertime }}小时</text>
</view> </view>
<view class="stat-item"> <!-- <view class="stat-item">
<text class="label">调休</text> <text class="label">调休</text>
<text class="value red-text">1</text> <text class="value red-text">1小时</text>
</view> </view> -->
</view> </view>
</view> </view>
<!-- 底部说明 --> <!-- 底部说明 -->
<view class="bottom-tips">说明请核实当月考勤记录确认无误请签字确认</view> <view class="bottom-tips">说明请核实当月考勤记录确认无误请签字确认</view>
<!-- 员工签字 --> <!-- 员工签字 -->
<view class="sign"> <view class="sign">
<view class="sign-tit"> <view class="sign-tit">
员工签字 员工签字
<text>/保留员工签字</text> <text>/保留员工签字</text>
</view> </view>
<view class="signatureVersion"></view> <view class="signatureVersion"></view>
</view> </view>
<!-- 签字确认按钮 --> <!-- 签字确认按钮 -->
<view class="confirm-btn" @click="goSignIt"><text>签字确认</text></view> <view class="confirm-btn" @click="goSignIt"><text>签字确认</text></view>
<!-- 日期选择模态框 --> <!-- 日期选择模态框 -->
<view class="date-picker-modal" v-if="showModal" @click.stop="closeDatePicker"> <view class="date-picker-modal" v-if="showModal" @click.stop="closeDatePicker">
<view class="modal-content" @click.stop> <view class="modal-content" @click.stop>
<view class="modal-title">{{ <view class="modal-title">{{ currentStep === 'year' ? '选择年份' : '选择月份' }}</view>
currentStep === "year" ? "选择年份" : "选择月份"
}}</view>
<!-- 年份选择 --> <!-- 年份选择 -->
<view class="year-grid" v-if="currentStep === 'year'"> <view class="year-grid" v-if="currentStep === 'year'">
<view <view v-for="year in availableYears" :key="year" class="year-item" :class="{ active: tempSelectedYear === year }" @click="selectYear(year)">
v-for="year in availableYears" <view class="year-circle">
:key="year" <text>{{ year }}</text>
class="year-item" </view>
:class="{ active: tempSelectedYear === year }" </view>
@click="selectYear(year)" </view>
>
<view class="year-circle">
<text>{{ year }}</text>
</view>
</view>
</view>
<!-- 月份选择 --> <!-- 月份选择 -->
<view class="month-grid" v-if="currentStep === 'month'"> <view class="month-grid" v-if="currentStep === 'month'">
<view <view v-for="month in months" :key="month" class="month-item" :class="{ active: tempSelectedMonth === month }" @click="selectMonth(month)">
v-for="month in months" <view class="month-circle">
:key="month" <text>{{ tempSelectedYear }}{{ month < 10 ? '0' + month : month }}</text>
class="month-item" </view>
:class="{ active: tempSelectedMonth === month }" </view>
@click="selectMonth(month)" </view>
>
<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="modal-footer" v-if="currentStep === 'month'"><view class="back-btn" @click="backToYearSelect">返回年份选择</view></view>
<view class="back-btn" @click="backToYearSelect">返回年份选择</view> </view>
</view> </view>
</view> </view>
</view>
</view>
</template> </template>
<script> <script>
import { getPerformanceAttendanceApi } from '@/api/create.js';
export default { export default {
data() { data() {
const currentDate = new Date(); const currentDate = new Date();
const currentYear = currentDate.getFullYear(); const currentYear = currentDate.getFullYear();
return { return {
showModal: false, showModal: false,
currentYear, currentYear,
selectedYear: currentYear, selectedYear: currentYear,
selectedMonth: currentDate.getMonth() + 1, selectedMonth: currentDate.getMonth(),
months: Array.from({ length: 12 }, (_, i) => i + 1), months: Array.from({ length: 12 }, (_, i) => i + 1),
currentStep: "year", // 'year' 或 'month' currentStep: 'year', // 'year' 或 'month'
tempSelectedYear: currentYear, tempSelectedYear: currentYear,
tempSelectedMonth: currentDate.getMonth() + 1, tempSelectedMonth: currentDate.getMonth() + 1,
availableYears: Array.from({ length: 7 }, (_, i) => currentYear - 3 + i), availableYears: Array.from({ length: 7 }, (_, i) => currentYear - 3 + i),
}; attendanceData: {
}, // 迟到
created() { late: ' ',
this.$setNavigationBar("考勤管理"); // 严重迟到
}, seriousLate: ' ',
methods: { // 旷工
showDatePicker() { absenteeism: ' ',
this.showModal = true; // 早退
this.currentStep = "year"; early: ' ',
this.tempSelectedYear = this.selectedYear; // 未打卡
this.tempSelectedMonth = this.selectedMonth; absenceCount: ' ',
}, // 未签到签退
closeDatePicker() { missedCount: ' ',
this.showModal = false; // 未提交日志
this.currentStep = "year"; missingLogCount: ' ',
},
selectYear(year) { // 事假
this.tempSelectedYear = year; personalLeave: ' ',
this.currentStep = "month"; // 病假
}, sickLeave: ' ',
selectMonth(month) {
this.tempSelectedMonth = month; // 婚假
this.selectedYear = this.tempSelectedYear; marriageLeave: ' ',
this.selectedMonth = month;
this.showModal = false; // 产假
this.currentStep = "year"; maternityLeave: ' ',
this.$emit("dateSelected", { // 陪产假
year: this.selectedYear, paternityLeave: ' ',
month: this.selectedMonth, // 丧假
}); bereavementLeave: ' ',
console.log("选择月份触发"); // 年休假
}, annualLeave: ' ',
backToYearSelect() { // 年休假(管理岗)
this.currentStep = "year"; managementAnnualLeave: ' ',
}, // 节假日加班
goSignIt(){ holidayOvertime: ' ',
this.$navTo('/pages/sign/sign'); // 休息日加班
restdayOvertime: ' ',
// 工作日加班
workdayOvertime: ' '
}
};
},
created() {
this.getPerformanceAttendance();
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
});
this.getPerformanceAttendance()
},
backToYearSelect() {
this.currentStep = 'year';
},
goSignIt() {
this.$navTo('/pages/sign/sign');
},
async getPerformanceAttendance() {
uni.showLoading({
mask: true,
title: '查询中...'
})
let res = await getPerformanceAttendanceApi(this.selectedYear, this.selectedMonth);
this.attendanceData = res.result;
uni.hideLoading();
}
} }
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.attendance-page { .attendance-page {
min-height: 100vh; min-height: 100vh;
background-color: #f8f9fa; background-color: #f8f9fa;
padding: 0 30rpx 0 30rpx; padding: 0 30rpx 0 30rpx;
.month-selector { .month-selector {
padding: 0 28rpx 0 10rpx; padding: 0 28rpx 0 10rpx;
display: flex; display: flex;
align-items: center; align-items: center;
margin: 40rpx 0; margin: 40rpx 0;
justify-content: space-between; justify-content: space-between;
.combination { .combination {
height: 40rpx; height: 40rpx;
line-height: 40rpx; line-height: 40rpx;
display: flex; display: flex;
align-content: center; align-content: center;
.current-month { .current-month {
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 28rpx; font-size: 28rpx;
color: #4b5563; color: #4b5563;
} }
.arrow { .arrow {
transform: rotate(90deg); transform: rotate(90deg);
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
} }
} }
.month-text { .month-text {
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 28rpx; font-size: 28rpx;
color: #2b5ce4; color: #2b5ce4;
} }
} }
.stat-section { .stat-section {
background: #fff; background: #fff;
border-radius: 12rpx; border-radius: 12rpx;
padding: 35rpx 40rpx; padding: 35rpx 40rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.section-title { .section-title {
font-size: 32rpx; font-size: 32rpx;
color: #111827; color: #111827;
} }
.stat-grid { .stat-grid {
margin-top: 40rpx; margin-top: 40rpx;
display: grid; display: grid;
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
gap: 40rpx 90rpx; gap: 40rpx 90rpx;
.stat-item { .stat-item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
.label { .label {
font-size: 28rpx; font-size: 28rpx;
color: #4b5563; color: #4b5563;
margin-bottom: 15rpx; margin-bottom: 15rpx;
} }
.value { .value {
font-size: 32rpx; font-size: 32rpx;
color: #666; color: #666;
&.red-text { &.red-text {
color: #ff4d4f; color: #ff4d4f;
} }
} }
} }
} }
} }
.bottom-tips { .bottom-tips {
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 24rpx;
color: #b9b9c2; color: #b9b9c2;
} }
.sign { .sign {
margin-top: 32rpx; margin-top: 32rpx;
margin-bottom: 180rpx; margin-bottom: 180rpx;
.sign-tit { .sign-tit {
margin-bottom: 32rpx; margin-bottom: 32rpx;
margin-left: 8rpx; margin-left: 8rpx;
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 700; font-weight: 700;
font-size: 28rpx; font-size: 28rpx;
color: #000000; color: #000000;
text { text {
padding-left: 16rpx; padding-left: 16rpx;
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 24rpx;
color: #b9b9c2; color: #b9b9c2;
} }
} }
.signatureVersion { .signatureVersion {
width: 690rpx; width: 690rpx;
height: 280rpx; height: 280rpx;
background: #ffffff; background: #ffffff;
border-radius: 20rpx; border-radius: 20rpx;
} }
} }
.confirm-btn { .confirm-btn {
position: fixed; position: fixed;
bottom: 45rpx; bottom: 45rpx;
left: 20rpx; left: 20rpx;
right: 20rpx; right: 20rpx;
height: 78rpx; height: 78rpx;
background: #ffffff; background: #ffffff;
border-radius: 20rpx; border-radius: 20rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400; font-weight: 400;
font-size: 30rpx; font-size: 30rpx;
color: #0078ff; color: #0078ff;
font-size: 32rpx; font-size: 32rpx;
border: 2rpx solid #0078ff; border: 2rpx solid #0078ff;
} }
.date-picker-modal { .date-picker-modal {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
z-index: 999; z-index: 999;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.modal-content { .modal-content {
width: 690rpx; width: 690rpx;
background: #ffffff; background: #ffffff;
border-radius: 20rpx; border-radius: 20rpx;
padding: 40rpx 30rpx; padding: 40rpx 30rpx;
.modal-title { .modal-title {
font-size: 32rpx; font-size: 32rpx;
color: #111827; color: #111827;
text-align: center; text-align: center;
margin-bottom: 40rpx; margin-bottom: 40rpx;
font-weight: 500; font-weight: 500;
} }
.year-grid { .year-grid {
display: grid; display: grid;
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
gap: 20rpx; gap: 20rpx;
padding: 0 20rpx; padding: 0 20rpx;
.year-item { .year-item {
height: 88rpx; height: 88rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.year-circle { .year-circle {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-radius: 8rpx; border-radius: 8rpx;
border: 2rpx solid #e5e7eb; border: 2rpx solid #e5e7eb;
text { text {
font-size: 28rpx; font-size: 28rpx;
color: #4b5563; color: #4b5563;
} }
} }
&.active { &.active {
.year-circle { .year-circle {
background: #eef2ff; background: #eef2ff;
border-color: #2b5ce4; border-color: #2b5ce4;
text { text {
color: #2b5ce4; color: #2b5ce4;
} }
} }
} }
} }
} }
.month-grid { .month-grid {
display: grid; display: grid;
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
gap: 20rpx; gap: 20rpx;
padding: 0 20rpx; padding: 0 20rpx;
.month-item { .month-item {
height: 88rpx; height: 88rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.month-circle { .month-circle {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-radius: 8rpx; border-radius: 8rpx;
border: 2rpx solid #e5e7eb; border: 2rpx solid #e5e7eb;
text { text {
font-size: 28rpx; font-size: 28rpx;
color: #4b5563; color: #4b5563;
} }
} }
&.active { &.active {
.month-circle { .month-circle {
background: #eef2ff; background: #eef2ff;
border-color: #2b5ce4; border-color: #2b5ce4;
text { text {
color: #2b5ce4; color: #2b5ce4;
} }
} }
} }
} }
} }
.modal-footer { .modal-footer {
margin-top: 30rpx; margin-top: 30rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
.back-btn { .back-btn {
padding: 20rpx 40rpx; padding: 20rpx 40rpx;
font-size: 28rpx; font-size: 28rpx;
color: #2b5ce4; color: #2b5ce4;
background: #eef2ff; background: #eef2ff;
border-radius: 8rpx; border-radius: 8rpx;
} }
} }
} }
} }
} }
</style> </style>
+17 -5
View File
@@ -10,7 +10,7 @@
<view class="right"><text class="blue-text">月度考勤</text></view> <view class="right"><text class="blue-text">月度考勤</text></view>
</view> </view>
<view class="section-content" style="display: flex; justify-content: space-between; align-items: center"> <view class="section-content" style="display: flex; justify-content: space-between; align-items: center">
<text class="title">{{ selectedYear }}{{ selectedMonth < 10 ? '0' + selectedMonth : selectedMonth }}月考勤统计</text> <text class="title">{{ thisYear }}{{ thisMonth }}月考勤统计</text>
<view class="combination" @click="viewDetails"> <view class="combination" @click="viewDetails">
<text class="detail">查看详情</text> <text class="detail">查看详情</text>
<image class="icon" src="/static/arr.png" mode="aspectFit"></image> <image class="icon" src="/static/arr.png" mode="aspectFit"></image>
@@ -71,24 +71,35 @@
</template> </template>
<script> <script>
export default { export default {
data() { data() {
const currentDate = new Date(); const currentDate = new Date();
const currentYear = currentDate.getFullYear(); const currentYear = currentDate.getFullYear();
return { return {
// 今年
thisYear:'',
// 今月
thisMonth:'',
showModal: false, showModal: false,
currentYear, currentYear,
selectedYear: currentYear, selectedYear: currentYear,
selectedMonth: currentDate.getMonth() + 1, selectedMonth: currentDate.getMonth(),
months: Array.from({ length: 12 }, (_, i) => i + 1), months: Array.from({ length: 12 }, (_, i) => i + 1),
currentStep: 'year', currentStep: 'year',
tempSelectedYear: currentYear, tempSelectedYear: currentYear,
tempSelectedMonth: currentDate.getMonth() + 1, tempSelectedMonth: currentDate.getMonth(),
availableYears: Array.from({ length: 7 }, (_, i) => currentYear - 3 + i) availableYears: Array.from({ length: 7 }, (_, i) => currentYear - 3 + i)
}; };
}, },
created() { async created() {
this.thisYear = this.selectedYear
this.thisMonth = this.selectedMonth
this.$setNavigationBar('人资系统'); this.$setNavigationBar('人资系统');
if (uni.getStorageSync('token')) {
} else {
let a = await this.$login();
}
}, },
methods: { methods: {
showDatePicker() { showDatePicker() {
@@ -126,7 +137,8 @@ export default {
}, },
viewSalaryDetails(){ viewSalaryDetails(){
this.$navTo('/pages/salaryDetails/salaryDetails'); this.$navTo('/pages/salaryDetails/salaryDetails');
} },
} }
}; };
</script> </script>