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

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

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

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

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

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

/** 导入 */
export const importExcelApiUrl = '/irisquery/sui/irisquery/TJcKdmx/TJcKdmxImpFileLoop';

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