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

/** 获取表格数据 */
export const getTJcKdjgListApi = (data: any) => {
  return request.postJson({ url: '/irisquery/spi/irisquery/TJcKdjg/TJcKdjgQueryPage', data });
};

/** 批量删除 */
export const delTJcKdjgListApi = (list: string[] | number[]): Promise<IResponse> => {
  const _list = list.map(v => {
    return {
      id: v,
    };
  });
  return request.postJson({
    url: '/irisquery/spi/irisquery/TJcKdjg/TJcKdjgBatchDelete',
    data: {
      list: _list,
    },
  });
};

/** 删除 */
export const delTJcKdjgApi = (id: string | number): Promise<IResponse> => {
  return request.postJson({ url: '/irisquery/spi/irisquery/TJcKdjg/TJcKdjgDelete', data: { id } });
};

/** 保存 */
export const saveTJcKdjgApi = (data: Partial<TableData>): Promise<IResponse> => {
  return request.postJson({ url: '/irisquery/spi/irisquery/TJcKdjg/TJcKdjgSave', data });
};

/** 查询单条数据 */
export const queryTJcKdjgApi = (id: string | number): Promise<IResponse> => {
  return request.postJson({ url: '/irisquery/spi/irisquery/TJcKdjg/TJcKdjgQueryOne', data: { id } });
};

/** 导入 */
export const importExcelApiUrl = '/irisquery/sui/irisquery/TJcKdjg/TJcKdjgImpFileLoop';

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