/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-07 11:12:10
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-04-07 12:06:23
 * @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 const getReportColumn = () => {
  return request('/performance/report/getReport', {
    method: 'GET',
  });
};

//获取表格数据

export type  ClolumnTableDataType = {
  id:number;
  
}

export const getClolumnTableData = (params:{reportCode:string}) => {
    return request('/performance/report/getReportColumn', {
      method: 'GET',
      params:{...params}
    });
};


//新增报表


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


//编辑报表
export const editReport = (data:any) => {
  return request('/performance/report/editReport', {
    method: 'POST',
    data
  });
};






//编辑表格数据

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


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

//删除左侧报表
export const delLeftReportData = (id:number) => {
  return request('/performance/report/deleteReport', {
    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
  });
};


