考勤列表
This commit is contained in:
57
src/api/project/attendance/echarts.ts
Normal file
57
src/api/project/attendance/echarts.ts
Normal file
@ -0,0 +1,57 @@
|
||||
import * as echarts from 'echarts';
|
||||
const grid = {
|
||||
left: 100,
|
||||
right: 100,
|
||||
top: 30,
|
||||
bottom: 50
|
||||
};
|
||||
|
||||
const color = ['#91CC75', '#409EFF', '#fff'];
|
||||
const titleList = [
|
||||
{ name: '出勤人数', color: '#fff' },
|
||||
{ name: '半勤人数', color: '#fff' },
|
||||
{ name: '缺勤人数', color: '#000' }
|
||||
];
|
||||
|
||||
export const echartsConfig = (ref: any, list?: any) => {
|
||||
const commandstatsIntance = echarts.init(ref, 'macarons');
|
||||
const attendanceArray = list.map((item) => item.attendance);
|
||||
const halfAttendanceArray = list.map((item) => item.halfAttendance);
|
||||
const absenteeismArray = list.map((item) => item.absenteeism);
|
||||
|
||||
const rawData = [attendanceArray, halfAttendanceArray, absenteeismArray];
|
||||
//y轴数据
|
||||
const data = list.map((item) => item.clockDate);
|
||||
|
||||
const series: echarts.BarSeriesOption[] = titleList.map((item, sid) => {
|
||||
return {
|
||||
name: item.name,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
barWidth: '25',
|
||||
label: {
|
||||
show: true,
|
||||
color: item.color,
|
||||
fontSize: 10
|
||||
},
|
||||
data: rawData[sid]
|
||||
};
|
||||
});
|
||||
commandstatsIntance.setOption({
|
||||
legend: {
|
||||
selectedMode: false,
|
||||
right: 0
|
||||
},
|
||||
grid,
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
show: false
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data
|
||||
},
|
||||
series,
|
||||
color
|
||||
});
|
||||
};
|
99
src/api/project/attendance/index.ts
Normal file
99
src/api/project/attendance/index.ts
Normal file
@ -0,0 +1,99 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import {
|
||||
AttendanceVO,
|
||||
AttendanceForm,
|
||||
AttendanceQuery,
|
||||
AttendanceTwoWeekQuery,
|
||||
AttendanceTwoWeekVO,
|
||||
AttendanceMonthVO,
|
||||
AttendanceMonthQuery
|
||||
} from '@/api/project/attendance/types';
|
||||
|
||||
/**
|
||||
* 查询考勤列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listAttendance = (query?: AttendanceQuery): AxiosPromise<AttendanceVO[]> => {
|
||||
return request({
|
||||
url: '/project/constructionUser/list/attendance/total',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询近两周考勤列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listAttendanceTwoWeek = (query?: AttendanceTwoWeekQuery): AxiosPromise<AttendanceTwoWeekVO[]> => {
|
||||
return request({
|
||||
url: '/project/attendance/list/clockDate/twoWeek',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询施工人员月份考勤列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listAttendanceMonth = (query?: AttendanceMonthQuery): AxiosPromise<AttendanceMonthVO[]> => {
|
||||
return request({
|
||||
url: '/project/constructionUser/list/attendance/month',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询考勤详细
|
||||
* @param id
|
||||
*/
|
||||
export const getAttendance = (id: string | number): AxiosPromise<AttendanceVO> => {
|
||||
return request({
|
||||
url: '/project/attendance/' + id,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增考勤
|
||||
* @param data
|
||||
*/
|
||||
export const addAttendance = (data: AttendanceForm) => {
|
||||
return request({
|
||||
url: '/project/attendance',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改考勤
|
||||
* @param data
|
||||
*/
|
||||
export const updateAttendance = (data: AttendanceForm) => {
|
||||
return request({
|
||||
url: '/project/attendance',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除考勤
|
||||
* @param id
|
||||
*/
|
||||
export const delAttendance = (id: string | number | Array<string | number>) => {
|
||||
return request({
|
||||
url: '/project/attendance/' + id,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
203
src/api/project/attendance/types.ts
Normal file
203
src/api/project/attendance/types.ts
Normal file
@ -0,0 +1,203 @@
|
||||
export interface AttendanceVO {
|
||||
/**
|
||||
* 人员姓名
|
||||
*/
|
||||
userName: string;
|
||||
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 人员id
|
||||
*/
|
||||
|
||||
/**
|
||||
* 上班打卡时间
|
||||
*/
|
||||
onClockTime: string;
|
||||
|
||||
/**
|
||||
* 下班打卡时间
|
||||
*/
|
||||
offClockTime: string;
|
||||
|
||||
/**
|
||||
* 打卡日期
|
||||
*/
|
||||
clockDate: string;
|
||||
|
||||
/**
|
||||
* 1正常,2迟到,3早退,4缺勤,5补卡
|
||||
*/
|
||||
clockStatus: string;
|
||||
|
||||
/**
|
||||
* 上下班(1上班,2下班)
|
||||
*/
|
||||
commuter: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark: string;
|
||||
}
|
||||
|
||||
export interface AttendanceTwoWeekQuery {
|
||||
projectId?: string | number;
|
||||
}
|
||||
|
||||
export interface AttendanceMonthQuery {
|
||||
id: string | number;
|
||||
clockMonth?: string;
|
||||
}
|
||||
|
||||
export interface AttendanceMonthVO {
|
||||
id: string | number;
|
||||
clockDate: string;
|
||||
status: string;
|
||||
attendanceList: monthList[];
|
||||
}
|
||||
|
||||
interface monthList {
|
||||
commuter: string;
|
||||
clockTime: string;
|
||||
clockStatus: string;
|
||||
}
|
||||
|
||||
export interface AttendanceTwoWeekVO {
|
||||
/**
|
||||
* 出勤人数
|
||||
*/
|
||||
attendance: string;
|
||||
|
||||
/**
|
||||
* 半勤人数
|
||||
|
||||
*/
|
||||
halfAttendance: string;
|
||||
|
||||
/**
|
||||
* 打卡日期
|
||||
*/
|
||||
clockDate: string;
|
||||
|
||||
/**
|
||||
* 缺勤人数
|
||||
|
||||
*/
|
||||
absenteeism: string;
|
||||
}
|
||||
|
||||
export interface AttendanceForm extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 人员id
|
||||
*/
|
||||
userId?: string | number;
|
||||
typeOfWork?: string;
|
||||
teamId?: string;
|
||||
clockMonth?: string;
|
||||
|
||||
/**
|
||||
* 人脸照
|
||||
*/
|
||||
facePic?: string;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId?: string | number;
|
||||
|
||||
/**
|
||||
* 上班打卡时间
|
||||
*/
|
||||
onClockTime?: string;
|
||||
|
||||
/**
|
||||
* 下班打卡时间
|
||||
*/
|
||||
offClockTime?: string;
|
||||
|
||||
/**
|
||||
* 打卡日期
|
||||
*/
|
||||
clockDate?: string;
|
||||
|
||||
/**
|
||||
* 1正常,2迟到,3早退,4缺勤,5补卡
|
||||
*/
|
||||
clockStatus?: string;
|
||||
|
||||
/**
|
||||
* 代打人员id
|
||||
*/
|
||||
pinchUserId?: string | number;
|
||||
|
||||
/**
|
||||
* 多次打卡时间记录
|
||||
*/
|
||||
clockRecord?: string;
|
||||
|
||||
/**
|
||||
* 上下班(1上班,2下班)
|
||||
*/
|
||||
commuter?: string;
|
||||
|
||||
/**
|
||||
* 日薪
|
||||
*/
|
||||
dailyWage?: number;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
lng?: string;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
lat?: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
export interface AttendanceQuery extends PageQuery {
|
||||
/**
|
||||
* 人员姓名
|
||||
*/
|
||||
userName?: string;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
projectId?: string | number;
|
||||
typeOfWork?: string | number;
|
||||
teamId?: string | number;
|
||||
clockMonth?: string | number;
|
||||
|
||||
/**
|
||||
* 打卡日期
|
||||
*/
|
||||
clockDate?: string;
|
||||
|
||||
/**
|
||||
* 1正常,2迟到,3早退,4缺勤,5补卡
|
||||
*/
|
||||
clockStatus?: string;
|
||||
|
||||
/**
|
||||
* 上下班(1上班,2下班)
|
||||
*/
|
||||
commuter?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
Reference in New Issue
Block a user