/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-07 11:12:10
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-04-04 10:13:22
 * @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 { request } from 'umi';



//获取表格数据

export type UnitIndicTargetTableDataType = {
  id:number;
  
}

export const getUnitIndicTargetTableData = (params:{groupId:string,unitCode:string}) => {
    return request('/performance/managerIndicator/getGroupUnitList', {
      method: 'GET',
      params:{...params}
    });
};




//编辑表格数据

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


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


//获取单元分组
export const  getUnitGroupList= () => {
    return getManaIndexGroup()
};

//获取分组下的单元
export const getUnitUnderGroupById = (groupId:number) => {
  return request('/performance/managerIndicator/getGroupUnit', {
    method: 'GET',
    params:{groupId}
  });
};


//复制

export type CopyGroupUnitDataType = {
  unitInfos:{unitCode:string,unitName:string}[],
  value:{code:string,targetValue:string}[]
}

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


