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

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

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

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

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

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

/** 导入 */
export const importExcelApiUrl = '/irisquery/sui/irisquery/TJcJyjg/TJcJyjgImpFileLoop';

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