import request from '@/utils/request';

// 人员入场查询列表
export function listAdmissionRequest(query) {
  return request({
    url: '/project/admissionRequest/list',
    method: 'get',
    params: query,
  });
}

// 人员信息列表查询
export function listPersonnelInformation(query) {
  return request({
    url: '/project/admissionRequest/listPersonnelInformation',
    method: 'get',
    params: query,
  });
}

// 人员出场 列表查询
export function listEntranceOfPersonnel(query) {
  return request({
    url: '/project/admissionRequest/listEntranceOfPersonnel',
    method: 'get',
    params: query,
  });
}

// 新增
export function addAdmissionRequest(data) {
  return request({
    url: '/project/admissionRequest/addAdmissionRequest',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
}

/**
 * 施工人员修改
 * @param data
 * @returns {*}
 */
export function updateAdmissionRequest(data) {
  return request({
    url: '/project/admissionRequest/updateAdmissionRequest',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
}

//提交审批
export function submitApproval(param) {
  console.log(param)
  return request({
    url: '/flowable/business/submitApproval/',
    method: 'post',
    data:param
  });
}
export function submitMulApproval(param) {
  return request({
    url: '/flowable/business/submitMulApproval/',
    method: 'post',
    data:param
  });
}
export function submitMaterialApproval(param) {
  return request({
    url: '/flowable/business/submitMaterialApproval/',
    method: 'post',
    data:param
  });
}

//获取代办和已办数据
export function getTasks() {
  return request({
    url: '/flowable/task/getTasks',
    method: 'get',
  });
}

// 获取详情数据
export function getData(data) {
  return request({
    url: '/project/admissionRequest/getData',
    method: 'post',
    data: data,
  })
}

/**
 * 承包商或分包商入场资质申请提交
 * @param data
 * @returns {*}
 */
export function addEntranceRequest(data) {
  return request({
    url: '/project/admissionRequest/addEntranceRequest',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
}

/**
 * 根据id删除人员
 * @param id
 * @returns {*}
 */
export function delPerson(id) {
  return request({
    url: '/project/admissionRequest/delPerson/' + id,
    method: 'delete'
  })
}

/**
 * 根据id删除设备
 * @param id
 * @returns {*}
 */
export function delEquip(id) {
  return request({
    url: '/project/equip/delEquip/' + id,
    method: 'delete'
  })
}

/**
 * 人员出场
 * @param data
 * @returns {*}
 */
export function updatePersonOutReason(data) {
  console.log(data)
  return request({
    url: '/project/consApproval/updatePersonOutReason',
    method: 'post',
    data: data
  })
}

export function judgeIsFileComplete(data){
  return request({
    url: '/project/admissionRequest/judgeIsFileComplete',
    method: 'post',
    data: data
  })
}

