import http from '@/api'
import { SmTaskSubVO, SmTaskSubForm, SmTaskSubQuery } from '@/api/interface/als/smTaskSub'
/**
 * @name 查询定检任务子列表
 * @param query 参数
 * @returns 返回列表
 */
export const listSmTaskSubApi = (query: SmTaskSubQuery) => {
  return http.get<SmTaskSubVO[]>('/als/smTaskSub/list', query, { loading: true })
}

/**
 * @name 查询定检任务子详细
 * @param id id
 * @returns returns
 */
export const getSmTaskSubApi = (id: string | number) => {
  return http.get<SmTaskSubVO>(`/als/smTaskSub/${id}`)
}

/**
 * @name 新增定检任务子
 * @param data data
 * @returns returns
 */
export const addSmTaskSubApi = (data: SmTaskSubForm) => {
  return http.post<any>('/als/smTaskSub', data, { loading: false })
}

/**
 * @name 修改定检任务子
 * @param data data
 * @returns returns
 */
export const updateSmTaskSubApi = (data: SmTaskSubForm) => {
  return http.put<any>('/als/smTaskSub', data, { loading: false })
}

/**
 * @name 删除定检任务子
 * @param id id
 * @returns returns
 */
export const delSmTaskSubApi = (id: string | number | Array<string | number>) => {
  return http.delete<any>(`/als/smTaskSub/${id}`)
}

/**
 * @name 下载模板
 * @returns returns
 */
export const importTemplateApi = () => {
  return http.downloadPost('/als/smTaskSub/importTemplate', {})
}

/**
 * @name 导入数据
 * @returns returns
 */
export const importSmTaskSubDataApi = (data: any) => {
  return http.post('/als/smTaskSub/importData', data)
}

/**
 * @name 导出数据
 * @returns returns
 */
export const exportSmTaskSubApi = (data: any) => {
  return http.post('/als/smTaskSub/export', data)
}
