diff --git a/src/api/project/attendance/echarts.ts b/src/api/project/attendance/echarts.ts new file mode 100644 index 0000000..407f23d --- /dev/null +++ b/src/api/project/attendance/echarts.ts @@ -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 + }); +}; diff --git a/src/api/project/attendance/index.ts b/src/api/project/attendance/index.ts new file mode 100644 index 0000000..cc38049 --- /dev/null +++ b/src/api/project/attendance/index.ts @@ -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 => { + return request({ + url: '/project/constructionUser/list/attendance/total', + method: 'get', + params: query + }); +}; + +/** + * 查询近两周考勤列表 + * @param query + * @returns {*} + */ + +export const listAttendanceTwoWeek = (query?: AttendanceTwoWeekQuery): AxiosPromise => { + return request({ + url: '/project/attendance/list/clockDate/twoWeek', + method: 'get', + params: query + }); +}; + +/** + * 查询施工人员月份考勤列表 + * @param query + * @returns {*} + */ + +export const listAttendanceMonth = (query?: AttendanceMonthQuery): AxiosPromise => { + return request({ + url: '/project/constructionUser/list/attendance/month', + method: 'get', + params: query + }); +}; + +/** + * 查询考勤详细 + * @param id + */ +export const getAttendance = (id: string | number): AxiosPromise => { + 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) => { + return request({ + url: '/project/attendance/' + id, + method: 'delete' + }); +}; diff --git a/src/api/project/attendance/types.ts b/src/api/project/attendance/types.ts new file mode 100644 index 0000000..530b464 --- /dev/null +++ b/src/api/project/attendance/types.ts @@ -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; +} diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 9b9379b..09b3a71 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -27,6 +27,8 @@ declare global { * 是否显示 */ visible: boolean; + details?: boolean; + id?: string | number; } declare interface UploadOption { diff --git a/src/views/project/attendance/index.vue b/src/views/project/attendance/index.vue new file mode 100644 index 0000000..953d48e --- /dev/null +++ b/src/views/project/attendance/index.vue @@ -0,0 +1,567 @@ + + + + +