/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-07 11:12:10
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2024-03-21 11:16:06
 * @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 { Key } from 'react';
import { request } from 'umi';

//获取左侧报表数据

export const getLeftList = () => {
  return request('/costAccount/setting/getEmpCostType', {
    method: 'GET',
  });
};

//获取人事分类计算类型
export const getEmpCostTypeDict = () => {
  return request('/costAccount/setting/getEmpCostTypeDict', {
    method: 'GET',
  });
};

//获取表格数据

export type ClolumnTableDataType = {
  id: number;
};

export const getClolumnTableData = (params: { costTypeCode: string }) => {
  return request('/costAccount/setting/getEmpCostMap', {
    method: 'GET',
    params: { ...params },
  });
};

//获取可添加列表
export const getAddableTableData = (costType: string) => {
  return request('/costAccount/setting/getEmpInfo', {
    method: 'GET',
    params: { costType },
  });
};

//新增左侧列表

export const addLeftList = (data: any) => {
  return request('/costAccount/setting/addEmpCostType', {
    method: 'POST',
    data,
  });
};

//编辑左侧列表
export const editLeftList = (data: any) => {
  return request('/costAccount/setting/editEmpCostType', {
    method: 'POST',
    data,
  });
};

//新增表格数据

export const addReportTbaleData = (data: any) => {
  return request('/costAccount/setting/addEmpCostMap', {
    method: 'POST',
    data,
  });
};

//更新人员信息
export const updateEmpInfo = () => {
  return request('/costAccount/setting/updateEmpMap', {
    method: 'POST',
  });
};

//编辑表格数据

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

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

//删除左侧报表
export const delLeftReportData = (id: number) => {
  return request('/costAccount/setting/deleteEmpCostType', {
    method: 'POST',
    params: { id },
  });
};

//批量删除表格数据
export const batchDelTableData = (ids: Key[]) => {
  return request('/costAccount/setting/batchDeleteEmpCostMap', {
    method: 'POST',
    data: [...ids],
  });
};

//导入数据
export const importDataPost = (data: any) => {
  return request('/costAccount//setting/importEmpType', {
    method: 'POST',
    data,
  });
};

//按人员分类生成数据
export const generateTableData = () => {
  return request('/costAccount//setting/generateEmpType', {
    method: 'POST',
  });
};
