/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-03 16:31:27
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-07-21 17:21:40
 * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/service.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */



import { request } from 'umi';

//获取table列表数据

export type PubDicClassType = any


export const getData = (params?:any) => {
  return request('/performance/import/list', {
    method: 'GET',
    params:{...params}
  });
};


//新增表格数据
export type AddTableDataType = {
  //hospId:number;
  code:string;
  name:string;
  remark:string;
}
export const addData = (data:AddTableDataType) => {
  return request('/performance/dict/addDictType', {
    method: 'POST',
    data
  });
};



//编辑表格数据

export const editData = (data:PubDicClassType) => {
  return request('/performance/dict/editDictType', {
    method: 'POST',
    data
  });
};

//删除表格操作
export const delData = (id:string) => {
  return request('/performance/dict/deleteDictType', {
    method: 'POST',
    params:{id}
  });
};

//获取特殊导入数据表

export const getSpecialImportTable = () => {
  return request('/performance/dict/getDictDataList?current=1&pageSize=500&typeCode=SPECIAL_SHEET_MAP', {
    method: 'GET',
  });
};


//数据导入

export const tableDataImport = (data:any) => {
  return request('/performance/import', {
    method: 'POST',
    data
  });
};

//导入后的撤销/复原操作

export const afterImport = (id:number,type:'CANCEL'|'RECOVERY') => {
  if(type == 'CANCEL'){
    return request('/performance/import/removeImport', {
      method: 'POST',
      params:{id}
    });
  }
  if(type == 'RECOVERY'){
    return request('/performance/import/recoverImport', {
      method: 'POST',
      params:{id}
    });
  }
  
};









