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

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

/** 批量删除 */
export const delCsckCheckVesrionListApi = (list: string[] | number[]): Promise<IResponse> => {
  const _list = list.map(v => {
    return {
      sourceSystemCode,
      targetSystemCode,
      checkVersion: v,
    };
  });
  return request.postJson({
    url: '/csck/spi/csck/CsckCheckVesrion/CsckCheckVesrionBatchDelete',
    data: {
      list: _list,
    },
  });
};

/** 删除 */
export const delCsckCheckVesrionApi = (sourceSystemCode, targetSystemCode, checkVersion: string | number): Promise<IResponse> => {
  return request.postJson({ url: '/csck/spi/csck/CsckCheckVesrion/CsckCheckVesrionDelete', data: { sourceSystemCode, targetSystemCode, checkVersion } });
};

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

/** 查询单条数据 */
export const queryCsckCheckVesrionApi = (sourceSystemCode, targetSystemCode, checkVersion: string | number): Promise<IResponse> => {
  return request.postJson({ url: '/csck/spi/csck/CsckCheckVesrion/CsckCheckVesrionQueryOne', data: { sourceSystemCode, targetSystemCode, checkVersion } });
};

/** 导入 */
export const importExcelApiUrl = '/csck/sui/csck/CsckCheckVesrion/CsckCheckVesrionImportExcel';

/** 导出 */
export const exportExcelApi = (params: any) => {
  return request.doExport({ url: '/csck/sdi/csck/CsckCheckVesrion/CsckCheckVesrionExportXls', params });
};
