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

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

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

/** 删除 */
export const delServiceLogQueryApi = (serviceId: string | number): Promise<IResponse> => {
  return request.postJson({ url: '/irisquery/spi/irisquery/ServiceLogQuery/ServiceLogQueryDelete', data: { serviceId } });
};

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

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

/** 导入 */
export const importExcelApiUrl = '/irisquery/sui/irisquery/ServiceLogQuery/ServiceLogQueryImpFileLoop';

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