/**
 * 班组管理页面 API
 */
import request from '@/utils/request'

/** 班组列表查询 */
export const queryCrewListApi = (data) => {
  return request.get('/base/tbTeam/list', {
    params: data
  })
}

/** 班组成员查询 */
export const queryCrewPersonApi = (data) => {
  return request.get('/base/tbPeople/list', {
    params: data
  })
}

/** 新增班组 */
export const addCrewApi = (data) => {
  return request.post('/base/tbTeam', data)
}

/** 修改人员 */
export const editCrewApi = (data) => {
  return request.put('/base/tbTeam', data)
}

/** 移出班组 */
export const removeCrewApi = (data) => {
  return request.post('/base/tbTeam/remove', data)
}

/** 删除班组 */
export const deleteCrewApi = (id) => {
  return request.delete(`/base/tbTeam/${id}`)
}

/** 安全帽查询 */
export const queryHatApi = (data) => {
  return request.get('/base/tbTeam/devList', {
    params: data
  })
}

/** 绑定安全帽 */
export const bindHatApi = (data) => {
  return request.post('/base/tbTeam/bind', data)
}

/** 解绑安全帽 */
export const unbindHatApi = (data) => {
  return request.post('/base/tbTeam/unbind', data)
}

/** 改版-班组长下拉查询 */
export const queryCrewSelApi = (id) => {
  return request.get(`/base/tbTeam/${id}`)
}

/** 班组长查询 isAll: 0 */
export const queryLeaderApi = (data) => {
  return request.get('/base/tbPeople/list', {
    params: data
  })
}

/** 成员查询 isAll: 0 */
export const queryIsAllApi = (data) => {
  return request.get('/base/tbPeople/list', {
    params: {
      isAll: 0,
      ...data
    }
  })
}

/** 工程查询 isAll: 0 */
export const queryProjApi = (data) => {
  return request.get('/base/tbProject/list', {
    params: data
  })
}
