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

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

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

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

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

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

/** 导入 */
export const importExcelApiUrl = '/irisquery/sui/irisquery/TCdLogData/TCdLogDataImpFileLoop';

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