4.23
This commit is contained in:
+2
-2
@@ -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
|
||||
+18
-12
@@ -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}`,
|
||||
})
|
||||
}
|
||||
+80
-10
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
@@ -34,17 +34,32 @@ const navTo = (url, skip = 'navigateTo') =>{
|
||||
});
|
||||
}
|
||||
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)
|
||||
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)
|
||||
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.$setNavigationBar = setNavigationBar
|
||||
Vue.prototype.$login = login
|
||||
|
||||
@@ -3,11 +3,7 @@
|
||||
<!-- 月份选择 -->
|
||||
<view class="month-selector" @click="showDatePicker">
|
||||
<view class="combination">
|
||||
<text class="current-month"
|
||||
>{{ selectedYear }}年{{
|
||||
selectedMonth < 10 ? "0" + selectedMonth : selectedMonth
|
||||
}}月</text
|
||||
>
|
||||
<text class="current-month">{{ selectedYear }}年{{ selectedMonth < 10 ? '0' + selectedMonth : selectedMonth }}月</text>
|
||||
<image class="arrow" src="/static/arr.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<text class="month-text">月度</text>
|
||||
@@ -19,23 +15,31 @@
|
||||
<view class="stat-grid">
|
||||
<view class="stat-item">
|
||||
<text class="label">迟到</text>
|
||||
<text class="value red-text">4次</text>
|
||||
<text class="value red-text">{{ attendanceData.late }}次</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="label">严重迟到</text>
|
||||
<text class="value red-text">3次</text>
|
||||
<text class="value red-text">{{ attendanceData.seriousLate }}次</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="label">旷工迟到</text>
|
||||
<text class="value">0次</text>
|
||||
<text class="label">旷工</text>
|
||||
<text class="value">{{ attendanceData.absenteeism }}次</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="label">早退</text>
|
||||
<text class="value red-text">1天</text>
|
||||
<text class="value red-text">{{ attendanceData.early }}次</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="label">未打卡</text>
|
||||
<text class="value red-text">2次</text>
|
||||
<text class="value red-text">{{ attendanceData.absenceCount }}次</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<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>
|
||||
@@ -46,27 +50,35 @@
|
||||
<view class="stat-grid">
|
||||
<view class="stat-item">
|
||||
<text class="label">事假</text>
|
||||
<text class="value red-text">4次</text>
|
||||
<text class="value red-text">{{ attendanceData.personalLeave }}小时</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="label">病假</text>
|
||||
<text class="value red-text">3次</text>
|
||||
<text class="value red-text">{{ attendanceData.sickLeave }}天</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="label">婚假</text>
|
||||
<text class="value">0次</text>
|
||||
<text class="value">{{ attendanceData.marriageLeave }}天</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="label">产假</text>
|
||||
<text class="value red-text">1天</text>
|
||||
<text class="value red-text">{{ attendanceData.maternityLeave }}天</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="label">陪产假</text>
|
||||
<text class="value red-text">2次</text>
|
||||
<text class="value red-text">{{ attendanceData.paternityLeave }}天</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="label">丧假</text>
|
||||
<text class="value red-text">2次</text>
|
||||
<text class="value red-text">{{ attendanceData.bereavementLeave }}天</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<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>
|
||||
@@ -77,20 +89,20 @@
|
||||
<view class="stat-grid">
|
||||
<view class="stat-item">
|
||||
<text class="label">节假日加班</text>
|
||||
<text class="value red-text">4次</text>
|
||||
<text class="value red-text">{{ attendanceData.holidayOvertime }}小时</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="label">休息日加班</text>
|
||||
<text class="value red-text">3次</text>
|
||||
<text class="value red-text">{{ attendanceData.restdayOvertime }}小时</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="label">工作日加班</text>
|
||||
<text class="value">0次</text>
|
||||
<text class="value">{{ attendanceData.workdayOvertime }}小时</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<!-- <view class="stat-item">
|
||||
<text class="label">调休</text>
|
||||
<text class="value red-text">1天</text>
|
||||
</view>
|
||||
<text class="value red-text">1小时</text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -114,19 +126,11 @@
|
||||
<!-- 日期选择模态框 -->
|
||||
<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="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 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>
|
||||
@@ -135,31 +139,22 @@
|
||||
|
||||
<!-- 月份选择 -->
|
||||
<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 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
|
||||
>
|
||||
<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 class="modal-footer" v-if="currentStep === 'month'"><view class="back-btn" @click="backToYearSelect">返回年份选择</view></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getPerformanceAttendanceApi } from '@/api/create.js';
|
||||
export default {
|
||||
data() {
|
||||
const currentDate = new Date();
|
||||
@@ -168,51 +163,103 @@ export default {
|
||||
showModal: false,
|
||||
currentYear,
|
||||
selectedYear: currentYear,
|
||||
selectedMonth: currentDate.getMonth() + 1,
|
||||
selectedMonth: currentDate.getMonth(),
|
||||
months: Array.from({ length: 12 }, (_, i) => i + 1),
|
||||
currentStep: "year", // 'year' 或 'month'
|
||||
currentStep: 'year', // 'year' 或 'month'
|
||||
tempSelectedYear: currentYear,
|
||||
tempSelectedMonth: currentDate.getMonth() + 1,
|
||||
availableYears: Array.from({ length: 7 }, (_, i) => currentYear - 3 + i),
|
||||
attendanceData: {
|
||||
// 迟到
|
||||
late: ' ',
|
||||
// 严重迟到
|
||||
seriousLate: ' ',
|
||||
// 旷工
|
||||
absenteeism: ' ',
|
||||
// 早退
|
||||
early: ' ',
|
||||
// 未打卡
|
||||
absenceCount: ' ',
|
||||
// 未签到签退
|
||||
missedCount: ' ',
|
||||
// 未提交日志
|
||||
missingLogCount: ' ',
|
||||
|
||||
// 事假
|
||||
personalLeave: ' ',
|
||||
// 病假
|
||||
sickLeave: ' ',
|
||||
|
||||
// 婚假
|
||||
marriageLeave: ' ',
|
||||
|
||||
// 产假
|
||||
maternityLeave: ' ',
|
||||
// 陪产假
|
||||
paternityLeave: ' ',
|
||||
// 丧假
|
||||
bereavementLeave: ' ',
|
||||
// 年休假
|
||||
annualLeave: ' ',
|
||||
// 年休假(管理岗)
|
||||
managementAnnualLeave: ' ',
|
||||
// 节假日加班
|
||||
holidayOvertime: ' ',
|
||||
// 休息日加班
|
||||
restdayOvertime: ' ',
|
||||
// 工作日加班
|
||||
workdayOvertime: ' '
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.$setNavigationBar("考勤管理");
|
||||
this.getPerformanceAttendance();
|
||||
this.$setNavigationBar('考勤管理');
|
||||
},
|
||||
methods: {
|
||||
showDatePicker() {
|
||||
this.showModal = true;
|
||||
this.currentStep = "year";
|
||||
this.currentStep = 'year';
|
||||
this.tempSelectedYear = this.selectedYear;
|
||||
this.tempSelectedMonth = this.selectedMonth;
|
||||
},
|
||||
closeDatePicker() {
|
||||
this.showModal = false;
|
||||
this.currentStep = "year";
|
||||
this.currentStep = 'year';
|
||||
},
|
||||
selectYear(year) {
|
||||
this.tempSelectedYear = year;
|
||||
this.currentStep = "month";
|
||||
this.currentStep = 'month';
|
||||
},
|
||||
selectMonth(month) {
|
||||
this.tempSelectedMonth = month;
|
||||
this.selectedYear = this.tempSelectedYear;
|
||||
this.selectedMonth = month;
|
||||
this.showModal = false;
|
||||
this.currentStep = "year";
|
||||
this.$emit("dateSelected", {
|
||||
this.currentStep = 'year';
|
||||
this.$emit('dateSelected', {
|
||||
year: this.selectedYear,
|
||||
month: this.selectedMonth,
|
||||
month: this.selectedMonth
|
||||
});
|
||||
console.log("选择月份触发");
|
||||
this.getPerformanceAttendance()
|
||||
},
|
||||
backToYearSelect() {
|
||||
this.currentStep = "year";
|
||||
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>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<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>
|
||||
<text class="title">{{ thisYear }}年{{ thisMonth }}月考勤统计</text>
|
||||
<view class="combination" @click="viewDetails">
|
||||
<text class="detail">查看详情</text>
|
||||
<image class="icon" src="/static/arr.png" mode="aspectFit"></image>
|
||||
@@ -71,24 +71,35 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
data() {
|
||||
const currentDate = new Date();
|
||||
const currentYear = currentDate.getFullYear();
|
||||
return {
|
||||
// 今年
|
||||
thisYear:'',
|
||||
// 今月
|
||||
thisMonth:'',
|
||||
showModal: false,
|
||||
currentYear,
|
||||
selectedYear: currentYear,
|
||||
selectedMonth: currentDate.getMonth() + 1,
|
||||
selectedMonth: currentDate.getMonth(),
|
||||
months: Array.from({ length: 12 }, (_, i) => i + 1),
|
||||
currentStep: 'year',
|
||||
tempSelectedYear: currentYear,
|
||||
tempSelectedMonth: currentDate.getMonth() + 1,
|
||||
tempSelectedMonth: currentDate.getMonth(),
|
||||
availableYears: Array.from({ length: 7 }, (_, i) => currentYear - 3 + i)
|
||||
};
|
||||
},
|
||||
created() {
|
||||
async created() {
|
||||
this.thisYear = this.selectedYear
|
||||
this.thisMonth = this.selectedMonth
|
||||
this.$setNavigationBar('人资系统');
|
||||
if (uni.getStorageSync('token')) {
|
||||
} else {
|
||||
let a = await this.$login();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showDatePicker() {
|
||||
@@ -126,7 +137,8 @@ export default {
|
||||
},
|
||||
viewSalaryDetails(){
|
||||
this.$navTo('/pages/salaryDetails/salaryDetails');
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user