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

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

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

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

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

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

/** 同步导入 */
export const importExcelApiUrl = '/ScoreLevelAdjust/sui/ScoreLevelAdjust/ScoreLevelAdjust/ScoreLevelAdjustImportExcel';

/** 异步导入 */
export const importExcelAsyncApiUrl = '/ScoreLevelAdjust/sui/ScoreLevelAdjust/ScoreLevelAdjust/ScoreLevelAdjustImportAsyncExcel';

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

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

