import { defHttp } from '/@/utils/http/axios';

enum Api {
  list = '/dkgl/dsrwGeoJd/cityList',
  addList = '/dkgl/gDsrwGeo/geoCheckPagelist',
  save = '/dkgl/dsrwGeoJd/add',
  deleteOne = '/dkgl/dsrwGeoJd/delete',
  cityAudit = '/dkgl/dsrwGeoJd/cityAudit',
  citychecksubmit = '/dkgl/dsrwGeoJd/cityCheckSubmit',
  findZrzyjList = '/dkgl/dsrwGeoJdAudit/findZrzyjList',
  findStbmList = '/dkgl/dsrwGeoJdAudit/findStbmList',
  exportXls = '/dkgl/dsrwGeoJd/exportXls',
  downloadMdb = '/dkgl/dsrwGeoJd/downloadMdb',
  downloadGdb = '/dkgl/dsrwGeoJd/downloadGdb',
  cityZgbmCheck = '/dkgl/dsrwGeoJd/cityZgbmCheck', //市级审核校验
  checkSuccessDownLoad = '/dkgl/dsrwGeoJd/checkSuccessDownLoad', //文件检查结果下载
  fileCheck = '/dkgl/dsrwGeoJd/fileCheck', //文件检查
  findJdfj = '/dkgl/dsrwGeoJd/findJdfj', // 季度文件信息（生成时间等）
  reloadGenerated = '/dkgl/dsrwGeoJd/reloadGenerated', // 重新生成文件
}
/**
 * 下载mdb文件
 * @param params
 */
export const getDownloadMdb = (params) => defHttp.get({ url: Api.downloadMdb, params });
/**
 * 下载gdb文件接口
 * @param params
 */
export const getDownloadGdb = (params) => defHttp.get({ url: Api.downloadGdb, params });

/**
 * 导出api
 * @param params
 */
export const getExportUrl = Api.exportXls;

/**
 * 列表接口
 * @param params
 */
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
 * 添加列表接口
 * @param params
 */
export const addList = (params) => defHttp.get({ url: Api.addList, params });
/**
 * 审核历史列表接口
 * @param params
 */
export const findStbmList = (params) => defHttp.get({ url: Api.findStbmList, params });
/**
 * 审核列表接口
 * @param params
 */
export const findZrzyjList = (params) => defHttp.get({ url: Api.findZrzyjList, params });
/**
 * 审核校验接口
 * @param params
 */
export const cityZgbmCheck = (params) => defHttp.get({ url: Api.cityZgbmCheck, params });
/**
 * 文件检查
 * @param params
 */
export const fileCheck = (params) => defHttp.get({ url: Api.fileCheck, params });
/**
 * 检查结果下载
 * @param params
 */
export const checkSuccessDownLoad = (params) => defHttp.get({ url: Api.checkSuccessDownLoad, params });
/**
 * 查询季度文件信息（生成时间）
 */
export const findJdfj = (params) =>
  defHttp.get({ url: Api.findJdfj, params }, { successMessageMode: 'none' });
/**
 * 重新生成文件
 */
export const reloadGenerated = (params) =>
  defHttp.get({ url: Api.reloadGenerated, params }, { successMessageMode: 'none' });
/**
 * 删除单个
 * @param params
 * @param handleSuccess
 */
export const deleteOne = (params, handleSuccess) => {
  return defHttp.post({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
    handleSuccess();
  });
};
/**
 * 生态部门提交前校验
 * @param params
 */
export const cityCheckSubmit = (params) => {
  return defHttp.get({ url: Api.citychecksubmit + '?jd=' + params.jd });
};
/**
 * 审核
 * @param params
 */
export const saveCityAudit = (params) => {
  return defHttp.post({ url: Api.cityAudit, params });
};
/**
 * 保存或者更新
 * @param params*
 */
export const saveOrUpdate = (params) => {
  return defHttp.post({ url: Api.save, params });
};
