import request from '@/utils/request'

// 查询审批记录列表
export function listApproval(query) {
  return request({
    url: '/laboratory/approval/list',
    method: 'get',
    params: query
  })
}

// 查询个人安全准入办理列表
export function userAppRovallist(query) {
  return request({
    url: '/laboratory/approval/userAppRovallist',
    method: 'get',
    params: query
  })
}

// 通过实验室 查询对应的安全准入规则
export function securityBySubjectId(subjectId) {
  return request({
    url: '/laboratory/approval/querySecurityBySubjectId',
    method: 'post',
    data: {subjectId: subjectId}
  })
}

// 查询审批记录详细
export function getApproval(id) {
  return request({
    url: '/laboratory/approval/' + id,
    method: 'get'
  })
}

// 新增审批记录
export function addApproval(data) {
  return request({
    url: '/laboratory/approval',
    method: 'post',
    data: data
  })
}

// 修改审批记录
export function updateApproval(data) {
  return request({
    url: '/laboratory/approval',
    method: 'put',
    data: data
  })
}

// 删除审批记录
export function delApproval(id) {
  return request({
    url: '/laboratory/approval/' + id,
    method: 'delete'
  })
}


// 审批通过操作
export function submitApproval(data) {
  return request({
    url: '/laboratory/approval/appOperation',
    method: 'put',
    data: data
  })
}


// 审批不通过操作
export function failedApproval(data) {
  return request({
    url: '/laboratory/approval/failedOperation',
    method: 'put',
    data: data
  })
}

//** 2.3 **//

//查询申请记录列表
export function listapply(query) {
  return request({
    url: '/laboratory/apply/listapply',
    method: 'get',
    params: query
  })
}

// 删除审批记录
export function applyDelete(id) {
  return request({
    url: '/laboratory/apply/'+id,
    method: 'delete'
  })
}

//查询审批列表
export function applyApproval(query) {
  return request({
    url: '/laboratory/apply/approval',
    method: 'get',
    params: query
  })
}

//获取实验室当前准入配置
export function materialApply(query) {
  return request({
    url: '/laboratory/apply/materialApply',
    method: 'get',
    params: query
  })
}
//查询专业
export function majorListPower(query) {
  return request({
    url: '/system/major/listPower',
    method: 'get',
    params: query
  })
}
//根据名称查询导师
export function selectUserListByName(query) {
  return request({
    url: '/system/user/selectUserListByName',
    method: 'get',
    params: query
  })
}
//根据名称查询实验室
export function subjectList(query) {
  return request({
    url: '/laboratory/subject/list/listAdmin',
    method: 'get',
    params: query
  })
}

//安全准入提交接口
export function materialAdd(data) {
  return request({
    url: '/laboratory/apply/materialAdd',
    method: 'post',
    data: data
  })
}
//打包下载
export function downloadwBatch(data) {
  return request({
    url: '/laboratory/apply/downloadwBatch',
    method: 'post',
    data: data
  })
}

//安全准入修改接口
export function materialUpdate(data) {
  return request({
    url: '/laboratory/apply/materialUpdate',
    method: 'post',
    data: data
  })
}

//安全准入详情接口
export function getDetails(query) {
  return request({
    url: '/laboratory/apply/getDetails',
    method: 'get',
    params: query
  })
}

//安全准入审核列表接口
export function applyList(query) {
  return request({
    url: '/laboratory/apply/list',
    method: 'get',
    params: query
  })
}

//安全准入审批接口
export function laboratoryApply(data) {
  return request({
    url: '/laboratory/apply',
    method: 'put',
    data: data
  })
}

//获取实验室列表
export function subjectListAll(query) {
  return request({
    url: '/laboratory/subject/list/security',
    method: 'get',
    params: query
  })
}
