From d2c8a95723f696b8f9c3f34b35e969696c015c3b Mon Sep 17 00:00:00 2001
From: hezhidong <1531792767@qq.com>
Date: Wed, 23 Apr 2025 18:00:35 +0800
Subject: [PATCH] 4.23
---
api/baseUrl.js | 4 +-
api/create.js | 30 +-
api/index.js | 92 +-
main.js | 41 +-
.../attendanceManagement.vue | 879 +++++++++---------
pages/homePage/homePage.vue | 22 +-
6 files changed, 609 insertions(+), 459 deletions(-)
diff --git a/api/baseUrl.js b/api/baseUrl.js
index a98e357..7a694cf 100644
--- a/api/baseUrl.js
+++ b/api/baseUrl.js
@@ -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
\ No newline at end of file
diff --git a/api/create.js b/api/create.js
index 1cb6706..cccc390 100644
--- a/api/create.js
+++ b/api/create.js
@@ -1,25 +1,31 @@
/*首页*/
-import { request } from "./index.js";
+import { request, requestLogin } from "./index.js";
// 登录
-export function getToken(code){
- return request({
- method: "get",
- url: "/user/getToken",
+export function getToken(authCode){
+ return requestLogin({
+ method: "GET",
+ url: `/login?code=${authCode}`,
data: {
- code
},
Header1: {
}
})
}
-
-// 创建工单
-export function postCreatOrder(data){
+// 获取用户信息
+export function getUser(authCode){
return request({
- method: "post",
- url: "creatOrder/add",
- data
+ method: "get",
+ url: "/user",
+ data: {
+ },
})
}
+// 获取绩效考勤统计
+export function getPerformanceAttendanceApi(year,month){
+ return request({
+ method: "get",
+ url: `/performance/attendance/detail/${year}/${month}`,
+ })
+}
\ No newline at end of file
diff --git a/api/index.js b/api/index.js
index 4b1a765..dcec410 100644
--- a/api/index.js
+++ b/api/index.js
@@ -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
export function request ( optaions ) {
let { url, method, data, header1 } = 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 || {}
header1 = header1 || {
- Authorization: uni.getStorageSync('token')
+ Authorization: 'Bearer ' + uni.getStorageSync('token')
}
- // console.log(com.getCacheToken("userInfo").token)
return new Promise((reslove,reject)=>{
uni.request({
- url: baseUrl + url,
+ url: allUrl + url,
method,
header: header1,
data,
success: (res) => {
- if(res.data.code == 401 ){
- uni.showToast({ title: '登录已失效,请重新登录!', icon: 'none' });
+ if(res.data.errcode == 401 ){
+ uni.showToast({ title: '登录已失效,即将重新登录!', icon: 'none' });
uni.removeStorageSync('userInfo');
uni.removeStorageSync('token');
setTimeout(()=>{
- uni.navigateTo({ url: '/pages/user/login' });
+ uni.reLaunch({ url: '/pages/newHomePage/newHomePage' });
}, 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)
uni.showToast({ title: res.data.msg, icon: 'none', duration: 2000 });
}else {
@@ -41,4 +111,4 @@ export function request ( optaions ) {
}
})
})
-}
\ No newline at end of file
+}
diff --git a/main.js b/main.js
index 3cc0c5f..f9866a9 100644
--- a/main.js
+++ b/main.js
@@ -2,7 +2,7 @@ import App from './App'
import Inputli from './components/form/input-li.vue';
import Selectli from './components/form/select-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'
// #ifndef VUE3
@@ -33,23 +33,38 @@ const navTo = (url, skip = 'navigateTo') =>{
url
});
}
-const login = () =>{
- return new Promise((reslove,reject)=>{
+const login = () => {
+ // uni.showLoading({
+ // mask: true,
+ // title: '登录中...'
+ // })
+ return new Promise((reslove, reject) => {
uni.getAuthCode({
- success:(user)=>{
- console.log(user)
- getToken(user.authCode).then((res)=>{
- if(res){
- reslove(res.data)
- console.log(res.data)
+ success: (user) => {
+ getToken(user.authCode).then((res) => {
+ if (res.errcode == 0) {
+ uni.setStorageSync('token', res.result.token)
+ getUser().then(data => {
+ console.log(data)
+ uni.setStorageSync('user',data)
+ uni.hideLoading()
+ // uni.showToast({
+ // title: '登录成功',
+ // icon: 'success'
+ // })
+ })
+ reslove(res)
}
- }).catch(err =>{
- reject(err)
+ }).catch(err => {
+ uni.showToast({
+ title: '登录失败,服务器出错了',
+ icon: 'error'
+ })
})
},
})
})
-
+
}
// 提示框 点击确定进入resolve 取消进入reject
const showModel = (content) =>{
@@ -72,7 +87,7 @@ const showModel = (content) =>{
})
}
-Vue.prototype.$navTo = navTo // 页面跳转
+Vue.prototype.$navTo = navTo //
Vue.prototype.$msg = msg
Vue.prototype.$setNavigationBar = setNavigationBar
Vue.prototype.$login = login
diff --git a/pages/attendanceManagement/attendanceManagement.vue b/pages/attendanceManagement/attendanceManagement.vue
index a80c2c5..3b388c2 100644
--- a/pages/attendanceManagement/attendanceManagement.vue
+++ b/pages/attendanceManagement/attendanceManagement.vue
@@ -1,469 +1,516 @@
-
-
-
-
- {{ selectedYear }}年{{
- selectedMonth < 10 ? "0" + selectedMonth : selectedMonth
- }}月
-
-
- 月度
-
+
+
+
+
+ {{ selectedYear }}年{{ selectedMonth < 10 ? '0' + selectedMonth : selectedMonth }}月
+
+
+ 月度
+
-
-
- 打卡统计
-
-
- 迟到
- 4次
-
-
- 严重迟到
- 3次
-
-
- 旷工迟到
- 0次
-
-
- 早退
- 1天
-
-
- 未打卡
- 2次
-
-
-
+
+
+ 打卡统计
+
+
+ 迟到
+ {{ attendanceData.late }}次
+
+
+ 严重迟到
+ {{ attendanceData.seriousLate }}次
+
+
+ 旷工
+ {{ attendanceData.absenteeism }}次
+
+
+ 早退
+ {{ attendanceData.early }}次
+
+
+ 未打卡
+ {{ attendanceData.absenceCount }}次
+
+
+ 未签到签退
+ {{ attendanceData.missedCount }}次
+
+
+ 未提交日志
+ {{ attendanceData.missingLogCount }}次
+
+
+
-
-
- 请假统计
-
-
- 事假
- 4次
-
-
- 病假
- 3次
-
-
- 婚假
- 0次
-
-
- 产假
- 1天
-
-
- 陪产假
- 2次
-
-
- 丧假
- 2次
-
-
-
+
+
+ 请假统计
+
+
+ 事假
+ {{ attendanceData.personalLeave }}小时
+
+
+ 病假
+ {{ attendanceData.sickLeave }}天
+
+
+ 婚假
+ {{ attendanceData.marriageLeave }}天
+
+
+ 产假
+ {{ attendanceData.maternityLeave }}天
+
+
+ 陪产假
+ {{ attendanceData.paternityLeave }}天
+
+
+ 丧假
+ {{ attendanceData.bereavementLeave }}天
+
+
+ 年休假
+ {{ attendanceData.annualLeave }}天
+
+
+ 年休假(管理岗)
+ {{ attendanceData.managementAnnualLeave }}天
+
+
+
-
-
- 加班、调休统计
-
-
- 节假日加班
- 4次
-
-
- 休息日加班
- 3次
-
-
- 工作日加班
- 0次
-
-
+
+
+ 加班、调休统计
+
+
+ 节假日加班
+ {{ attendanceData.holidayOvertime }}小时
+
+
+ 休息日加班
+ {{ attendanceData.restdayOvertime }}小时
+
+
+ 工作日加班
+ {{ attendanceData.workdayOvertime }}小时
+
+
+
+
-
- 说明:请核实当月考勤记录,确认无误请签字确认
+
+ 说明:请核实当月考勤记录,确认无误请签字确认
-
+
-
-
- 员工签字
- /保留员工签字
-
+
+
+ 员工签字
+ /保留员工签字
+
-
-
+
+
-
- 签字确认
+
+ 签字确认
-
-
-
- {{
- currentStep === "year" ? "选择年份" : "选择月份"
- }}
+
+
+
+ {{ currentStep === 'year' ? '选择年份' : '选择月份' }}
-
-
-
-
- {{ year }}年
-
-
-
+
+
+
+
+ {{ year }}年
+
+
+
-
-
-
-
- {{ tempSelectedYear }}年{{ month < 10 ? "0" + month : month }}月
-
-
-
+
+
+
+
+ {{ tempSelectedYear }}年{{ month < 10 ? '0' + month : month }}月
+
+
+
-
-
-
-
-
+
+
+
+
+
diff --git a/pages/homePage/homePage.vue b/pages/homePage/homePage.vue
index d76e1a0..3540bb9 100644
--- a/pages/homePage/homePage.vue
+++ b/pages/homePage/homePage.vue
@@ -10,7 +10,7 @@
月度考勤
- {{ selectedYear }}年{{ selectedMonth < 10 ? '0' + selectedMonth : selectedMonth }}月考勤统计
+ {{ thisYear }}年{{ thisMonth }}月考勤统计
查看详情
@@ -71,24 +71,35 @@