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

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

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

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

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

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

/** 导入 */
export const importExcelApiUrl = '/irisquery/sui/irisquery/T11/T11ImpFileLoop';

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