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

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

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

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

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

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

/** 导入 */
export const importExcelApiUrl = '/irisquery/sui/irisquery/TCdColumnData/TCdColumnDataImpFileLoop';

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