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

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

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

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

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

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

/** 同步导入 */
export const importExcelApiUrl = '/SuspiciousCaseDeal/sui/SuspiciousCaseDeal/SuspiciousCaseDeal/SuspiciousCaseDealImportExcel';

/** 异步导入 */
export const importExcelAsyncApiUrl = '/SuspiciousCaseDeal/sui/SuspiciousCaseDeal/SuspiciousCaseDeal/SuspiciousCaseDealImportAsyncExcel';

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

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

