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

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

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

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

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

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

/** 同步导入 */
export const importExcelApiUrl = '/whiteListVerify/sui/whiteListVerify/WhiteListVerify/WhiteListVerifyImportExcel';

/** 异步导入 */
export const importExcelAsyncApiUrl = '/whiteListVerify/sui/whiteListVerify/WhiteListVerify/WhiteListVerifyImportAsyncExcel';

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

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

