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

//获取表格数据

export type ClolumnTableDataType = {
  id: number;
};

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

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

//新增报表

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

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

//新增表格数据

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

//编辑表格数据

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

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

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

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