/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-03 16:31:27
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-06-13 10:17:31
 * @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 IndcGroupWeightItemTableRowType = {
  id:number;
  hospId:number;
  groupCode:string;
  groupName:string;
  unitInfoVos:any[];
  indicatorWeights:any[]
}


export const getData = (params?:any) => {
  return request<IndcGroupWeightItemTableRowType[]>('/performance/managerIndicator/groupList', {
    method: 'GET',
    params:{...params}
  });
};


//新增表格数据
export type AddTableDataType = {
  groupName:string;
  depiction:string;
}

export const addData = (data:AddTableDataType) => {
  return request('/performance/managerIndicator/groupAdd', {
    method: 'POST',
    data
  });
};



//编辑表格数据

export type EditTableDataType = {
    id:number
}&AddTableDataType

export const editData = (data:EditTableDataType) => {
  return request('/performance/managerIndicator/groupEdit', {
    method: 'POST',
    data
  });
};

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


//新增指标分组

export const addIndicGroup = (data:{id:number,indicatorWeights:[]}) => {
  return request('/performance/managerIndicator/addGroupWeight', {
    method: 'POST',
    data
  });
};


//获取所有单元，除去以选中的

export const getAllUnit = (groupId?:number) => {
  return request('/performance/managerIndicator/groupUnitList', {
    method: 'GET',
    params:{groupId}
  });
};


//分组添加单元

export const addUnitForGroup = (data:{id:number,unitInfoVos:any[]}) => {
  return request('/performance/managerIndicator/addGroupUnit', {
    method: 'POST',
    data
  });
};










