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

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

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

/** 删除 */
export const delCsckCheckRuleApi = (pkid: string | number): Promise<IResponse> => {
  return request.postJson({ url: '/csck/spi/csck/CsckCheckRule/CsckCheckRuleDelete', data: { pkid } });
};

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

/** 查询单条数据 */
export const queryCsckCheckRuleApi = (pkid: string | number): Promise<IResponse> => {
  return request.postJson({ url: '/csck/spi/csck/CsckCheckRule/CsckCheckRuleQueryOne', data: { pkid } });
};
/** 测试单条规则 */
export const testCsckCheckRuleApi = (pkid: string | number): Promise<IResponse> => {
  return request.postJson({ url: '/csck/spi/csck/CsckCheckRule/CsckTestCheckRule', data: { pkid } });
};



/** 导入 */
export const importExcelApiUrl = '/csck/sui/csck/CsckCheckRule/CsckCheckRuleImportExcel';

/** 导出 */
export const exportExcelApi = (data: any) => {
  return request.doExport({ url: '/csck/sdi/csck/CsckCheckRule/CsckCheckRuleExportXls', data });
};
/** 获取某个字典 */
export const getCsckCheckType = ({ paramName, systemCode }): Promise<IResponse> => {
  return request.postJson({
    url: '/param/spi/param/systemparam',
    data: {
      paramName: paramName,
      systemCode: systemCode,
    },
  });
};
