import request from '@/utils/request'

// 新增检查单记录
export function addChecklistRecord(data) {
  return request({
    url: '/check/checklist/add',
    method: 'post',
    data: data
  })
}

// 获取检查单列表
export function getChecklistList(params) {
  return request({
    url: '/check/checklist/list',
    method: 'get',
    params: params
  })
}

// 获取检查单详情
export function getChecklistDetail(id) {
  return request({
    url: `/check/checklist/detail/${id}`,
    method: 'get'
  })
}

// 更新检查单
export function updateChecklist(data) {
  return request({
    url: '/check/checklist/update',
    method: 'put',
    data: data
  })
}

// 删除检查单
export function deleteChecklist(id) {
  return request({
    url: `/check/checklist/delete/${id}`,
    method: 'delete'
  })
}

// 提交审批
export function submitApproval(data) {
  return request({
    url: '/check/checklist/submitApproval',
    method: 'post',
    data: data
  })
}

// 获取审批历史
export function getApprovalHistory(checklistId) {
  return request({
    url: `/check/checklist/approvalHistory/${checklistId}`,
    method: 'get'
  })
}

// 获取检查单统计
export function getChecklistStatistics(params) {
  return request({
    url: '/check/checklist/statistics',
    method: 'get',
    params: params
  })
}
//查询部门指定角色人员
export function getDeptRoleUser(deptId,data) {
  return request({
    url: `/system/dept/deptRole/${deptId}`,
    method: 'post',
    data: data
  })
}