import { get, put, post, deletes } from '@/http/index'

// 查询机型机号列表
export const getAircraft = async (data) => {
  return await get('/als/aircraft/list', data)
}

// 新增机型机号
export const addAircraft = async (data) => {
  return await post('/als/aircraft', data)
}

// 修改机型机号
export const updateAircraft = async (data) => {
  return await put('/als/aircraft', data)
}

// 删除机型机号
export const removeAircraft = async (id) => {
  return await deletes('/als/aircraft/' + id)
}

//  获取机种和机型树
export const getAircaftTypeAndModelTree = async (data) => {
  return await get('/basicdata/aircaftCatalog/getAircaftTypeAndModelTree', data)
}
/**
 * @name 查询机型机号下拉树结构
 * @returns returns
 */
export const treeSelectApi = async () => {
  return await get('/als/aircraft/tree')
}

/**
 * @name 查询机型机号详细
 * @param id id
 * @returns returns
 */
export const getAircraftApi = (id) => {
  return http.get(`/als/aircraft/${id}`)
}
/**
 * @name 获取机型列表(不分页)
 * @param 
 * "aircaftTypeCode": "",//机种编号
  "aircaftTypeId": "",//机种id 
  "queryParam": ""//搜索条件：机型名称/机型编号
 * @returns returns
 */
export const getAircaftModelAll = async (data) => {
  return await post('/basicdata/aircaftModel/getAircaftModelAll', data)
}

/**
 * @name 获取飞机编目列表（不分页）
 * @param 
 *  "keyWord": "",//搜索条件字段:飞机编号/厂家/出厂编号
  "aircaftModelIdList": [ ]//选中的机型ID集合
 * @returns returns
 */
export const getAircaftCatalogAll = async (data) => {
  return await post('/basicdata/aircaftCatalog/getAircaftCatalogAll', data)
}

// 获取所有飞行任务（包含子任务）
export const getflyTaskAll = async (data) => {
  return await post('/carryingtask/flyTask/queryFlyTaskTree', data)
}
