import request from '@/utils/request'
import { deepClone } from '@/utils/index'
import dayjs from 'dayjs'
// 查询考勤人员基本属性列表
export function listAttendanceWorker(query) {
  return request({
    url: '/project/attendanceWorker/list',
    method: 'get',
    params: query
  })
}

// 查询考勤人员基本属性列表
export function queryAttendanceWorker(query) {
  return request({
    url: '/project/attendanceWorker/query',
    method: 'get',
    params: query
  })
}
// 查询考勤人员基本属性列表
export function listJgwAttendanceWorker(query) {
  return request({
    url: '/project/attendanceWorker/listjgw',
    method: 'get',
    params: query
  })
}
// 查询考勤人员基本属性详细
export function getAttendanceWorker(id) {
  return request({
    url: '/project/attendanceWorker/' + id,
    method: 'get'
  })
}

// 新增考勤人员基本属性
export function addAttendanceWorker(data) {
  return request({
    url: '/project/attendanceWorker',
    method: 'post',
    data: data
  })
}

// 修改考勤人员基本属性
export function updateAttendanceWorker(data) {
  return request({
    url: '/project/attendanceWorker',
    method: 'put',
    data: data
  })
}

// 删除考勤人员基本属性
export function delAttendanceWorker(id) {
  return request({
    url: '/project/attendanceWorker/' + id,
    method: 'delete'
  })
}

export function queryAttendanceData(data){
  data=deepClone(data);
  if(data.createBy){
    data.createBy=dayjs(data.createBy).format("YYYY-MM-DD");
  }
  return request({
    url: `/project/attendanceWorker/queryAttendanceData?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    method: 'post',
    data:{
      ...data,
      index:((data.pageNum||1)-1)*data.pageSize,
      size:data.pageSize
    }
  })
}
