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

/** 获取表格数据 */
export const getSysLoginLogListApi = (data: any) => {
  return request.postJson({ url: '/system/spi/system/SysLoginLog/SysLoginLogQueryPage', data });
};

/** 批量删除 */
export const delSysLoginLogListApi = (list: string[] | number[]): Promise<IResponse> => {
  const _list = list.map(v => {
    return {
      pkid: v,
    };
  });
  return request.postJson({
    url: '/system/spi/system/SysLoginLog/SysLoginLogBatchDelete',
    data: {
      list: _list,
    },
  });
};

/** 删除 */
export const delSysLoginLogApi = (pkid: string | number): Promise<IResponse> => {
  return request.postJson({ url: '/system/spi/system/SysLoginLog/SysLoginLogDelete', data: { pkid } });
};

/** 保存 */
export const saveSysLoginLogApi = (data: Partial<TableData>): Promise<IResponse> => {
  return request.postJson({ url: '/system/spi/system/SysLoginLog/SysLoginLogSave', data });
};

/** 查询单条数据 */
export const querySysLoginLogApi = (pkid: string | number): Promise<IResponse> => {
  return request.postJson({ url: '/system/spi/system/SysLoginLog/SysLoginLogQueryOne', data: { pkid } });
};

/** 导入 */
export const importExcelApiUrl = '/system/sui/system/SysLoginLog/SysLoginLogImportExcel';

/** 导出 */
export const exportExcelApi = (data: any) => {
  return request.doExport({ url: '/system/sdi/system/SysLoginLog/SysLoginLogExportXls', data });
};
