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




import { getManaIndexGroup } from '@/pages/budgetMana/monthlyDataCheck/service';
import { Key } from 'react';
import { request } from 'umi';


//获取左侧医疗组
export const getMedicalGroup = () => {
  return request('/performance/secondGroup/list', {
    method: 'GET',
  });
};

//获取表格数据
export const getEmpTableDataFromMedicalGroup = (params:{secondGroupCode:string;itemName?:string;unitName?:string},type:1|2) => {
    if(type == 1){
      return request('/performance/secondGroup/secondUnitList', {
        method: 'GET',
        params:{...params}
      });
    }
    if(type == 2){
      return request('/performance/secondGroup/secondItemList', {
        method: 'GET',
        params:{...params}
      });
    }
    
};


//新增医疗组
export const addMedicalGroup = (data:any) => {
  return request('/performance/secondGroup/add', {
    method: 'POST',
    data
  });
};


//编辑医疗组
export const editMedicalGroup = (data:any) => {
  return request('/performance/secondGroup/edit', {
    method: 'POST',
    data
  });
};


//删除左侧数据
export const delLeftReportData = (id:number) => {
  return request('/performance/secondGroup/delete', {
    method: 'POST',
    params:{id}
  });
};



//分组添加核算单元

type AddMedicalGroupEmpDataType = {secondGroupCode:string,unitCodeList:Key[]}
export const addMedicalGroupEmp = (data:AddMedicalGroupEmpDataType) => {
  return request('/performance/secondGroup/unitAdd', {
    method: 'POST',
    data
  });
};



//编辑表格数据

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






//删除表格操作
export const delTableData = (ids:number[]) => {
    return request('/performance/secondGroup/unitRemove', {
      method: 'POST',
      data:[...ids]
    });
};


//获取核算单元列表

export const getAllUnitList = (params:{secondGroupCode:string}) => {
  return request('/performance/secondGroup/unitList', {
    method: 'GET',
    params
  });
};

//添加分组项目列表

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

//编辑分组项目列表

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


//批量删除二次分配项目

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



