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

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

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

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

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

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

/** 同步导入 */
export const importExcelApiUrl = '/LargeCaseReview/sui/LargeCaseReview/LargeCaseReview/LargeCaseReviewImportExcel';

/** 异步导入 */
export const importExcelAsyncApiUrl = '/LargeCaseReview/sui/LargeCaseReview/LargeCaseReview/LargeCaseReviewImportAsyncExcel';

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

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

