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

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

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

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

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

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

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

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