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

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

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

/** 删除 */
export const delSuspiciousPackageDownApi = (pkid?: string): Promise<IResponse> => {
  return request.postJson({ url: '/SuspiciousPackageDown/spi/SuspiciousPackageDown/SuspiciousPackageDown/SuspiciousPackageDownDelete', data: { pkid } });
};

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

/** 查询单条数据 */
export const querySuspiciousPackageDownApi = (pkid?: string): Promise<IResponse> => {
  return request.postJson({ url: '/SuspiciousPackageDown/spi/SuspiciousPackageDown/SuspiciousPackageDown/SuspiciousPackageDownQueryOne', data: { pkid } });
};

/** 同步导入 */
export const importExcelApiUrl = '/SuspiciousPackageDown/sui/SuspiciousPackageDown/SuspiciousPackageDown/SuspiciousPackageDownImportExcel';

/** 异步导入 */
export const importExcelAsyncApiUrl = '/SuspiciousPackageDown/sui/SuspiciousPackageDown/SuspiciousPackageDown/SuspiciousPackageDownImportAsyncExcel';

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

/** 获取某个字典 */
export const getCsckCheckType = ({ paramName, systemCode }): Promise<IResponse> => {
  return request.postJson({
    url: '/param/spi/param/systemparam',
    data: {
      paramName: paramName,
      systemCode: systemCode,
    },
  });
};

