import { requestClient } from '#/api/request';
import { commonExport } from '#/api/helper';

enum Api {
  querybaseApi = '/inspectionMain/main/list',
  baseApi = '/inspectionMain/main', // 新增检查
  exportApi = '/inspectionMain/main/export', // 导出检查
  addsubItemApi = '/inspectionSubItem/item', // 新增子项
  querysubItembaseApi = '/inspectionSubItem/item/list', // 查询子项列表
  editSubItemApi = '/inspectionSubItem/item', // 编辑子项
  deleteSubItemApi = '/inspectionSubItem/item', // 删除子项
  addTagApi = '/inspectionTag/tag', // 新增标签
  querytagbaseApi = '/inspectionTag/tag/list', // 查询标签列表    
  addinspectionItemApi = '/inspectionItem/item', // 新增检查项              
  queryinspectionItemApi = '/inspectionItem/item/list', // 查询检查项列表
  saveApi = '/inspectionMain/main/save', // 保存检查

}

// 查询检查表单列表
export function querybaseApilist(params?: any) {
  return requestClient.get(Api.querybaseApi, { params });
}
// 新增检查
export function addbaseApi(post: any) {
  return requestClient.post(Api.baseApi, post, {
    successMessageMode: 'message',
  });
}
// 编辑检查
export function editbaseApi(post: any) {
  return requestClient.put(Api.baseApi, post, {
    successMessageMode: 'message',
  });
}
// 删除检查
export function deletebaseApi(ids: number[]) {
  return requestClient.delete(`${Api.baseApi}/${ids}`, {
    successMessageMode: 'message',
  });
}
//导出
export function checkFormExport(data: any) {
  return commonExport(Api.exportApi, data);
}
//详情
export function detailsbaseApi(id: number) {
  return requestClient.get(`${Api.baseApi}/${id}`);
}
// 新增子项
export function addsubItemApi(post: any) {
  return requestClient.post(Api.addsubItemApi, post, {
    successMessageMode: 'message',
  });
}
//查询子项列表
export function querysubItembaseApilist(params?: any) {
  return requestClient.get(Api.querysubItembaseApi, { params });
}
//编辑子项
export function editSubItemApi(post: any) {
  return requestClient.put(Api.editSubItemApi, post,);
}
//删除子项
export function deleteSubItemApi(ids: any) {
  return requestClient.delete(`${Api.deleteSubItemApi}/${ids}`, {
    successMessageMode: 'message',
  });
}     
// 查询标签列表
export function querytagbaseApilist(params?: any) {
  return requestClient.get(Api.querytagbaseApi, { params });
}
// 新增标签
export function addTagApi(post: any) {
  return requestClient.post(Api.addTagApi, post, {
    successMessageMode: 'message',
  });
}
// 编辑标签
export function editTagApi(post: any) {
  return requestClient.put(Api.addTagApi, post, {
    successMessageMode: 'message',
  });
}
// 删除标签
export function deleteTagApi(ids: any) {
  return requestClient.delete(`${Api.addTagApi}/${ids}`, {
    successMessageMode: 'message',
  });
} 
// 新增检查项
export function addinspectionItemApi(post: any) {
  return requestClient.post(Api.addinspectionItemApi, post, {
    successMessageMode: 'message',
  });
}
// 查询检查项列表
export function queryinspectionItemApilist(params?: any) {
  return requestClient.get(Api.queryinspectionItemApi,  {params} );
}
// 编辑检查项
export function editinspectionItemApi(post: any) {
  return requestClient.put(Api.addinspectionItemApi, post, {
    successMessageMode: 'message',
  });
}
//删除检查项
export function deleteinspectionItemApi(ids: any) {
  return requestClient.delete(`${Api.addinspectionItemApi}/${ids}`, {
    successMessageMode: 'message',
  });
}  
//检查项列表
export function saveApi(post: any) {
  return requestClient.post(Api.saveApi, post, {
    successMessageMode: 'message',
  });
}
//油站执行人下拉框
// export function stationoperatorapi(params?: any) {
//   return requestClient.get(Api.stationoperatorapi, params);
// }
// 编辑任务模板
// export function editbaseApi(data: any) {
//   return requestClient.put(Api.editbaseApi, data, {
//     successMessageMode: 'message',
//   });
// }
// // 修改岗位
// export function updatePost(post: Post) {
//   return requestClient.put(Api.baseApi, post, {
//     successMessageMode: 'message',
//   });
// }
// // 删除岗位
// export function deletePost(postId: number[]) {
//   return requestClient.delete(`${Api.baseApi}/${postId.join(',')}`, {
//     successMessageMode: 'message',
//   });
// }
