import request from '@/config/axios';
import type { TableData } from './types';

/** 获取表格数据 */
export const getCsckDataCheckImportListApi = (data: any) => {
  return request.postJson({ url: '/csck/spi/csck/CsckDataCheckImport/CsckDataCheckImportQueryPage', data });
};

/** 批量删除 */
export const delCsckDataCheckImportListApi = (list: string[] | number[]): Promise<IResponse> => {
  const _list = list.map(v => {
    return {
      pkid: v,
    };
  });
  return request.postJson({
    url: '/csck/spi/csck/CsckDataCheckImport/CsckDataCheckImportBatchDelete',
    data: {
      list: _list,
    },
  });
};

/** 删除 */
export const delCsckDataCheckImportApi = (pkid: string | number): Promise<IResponse> => {
  return request.postJson({ url: '/csck/spi/csck/CsckDataCheckImport/CsckDataCheckImportDelete', data: { pkid } });
};

/** 保存 */
export const saveCsckDataCheckImportApi = (data: Partial<TableData>): Promise<IResponse> => {
  return request.postJson({ url: '/csck/spi/csck/CsckDataCheckImport/CsckDataCheckImportSave', data });
};

/** 查询单条数据 */
export const queryCsckDataCheckImportApi = (pkid: string | number): Promise<IResponse> => {
  return request.postJson({ url: '/csck/spi/csck/CsckDataCheckImport/CsckDataCheckImportQueryOne', data: { pkid } });
};

/** 导入 */
export const importExcelApiUrl = '/csck/sui/csck/CsckDataCheckImport/CsckDataCheckImportImportExcel';

/** 按系统组统计数量导出 */
export const exportExcelBySystemgroupApi = (data: any) => {
  return request.doExport({ url: '/csck/sdi/csck/CsckDataCheckResult/CsckDataCheckResultBySystemGroupExportXls', data });
};

/** 导出 */
export const exportExcelByRulepApi = (data: any) => {
  return request.doExport({ url: '/csck/sdi/csck/CsckDataCheckResult/CsckDataCheckResultByInspectionIssuesExportXls', data });
};
