/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-03 16:31:27
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2024-05-17 13:57:28
 * @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 const getResponsibilityCenterList = (params?: any) => {
  return request('/costAccount/responsibility/list', {
    method: 'GET',
    params: { ...params },
  });
};

//获取分摊层级列表无分页
export const getApportionmentLevelListNoPage = () => {
  return request('/costAccount/costsharelevel/list', {
    method: 'GET',
  });
};

//获取标准分摊层级
export const getStandardShareLevelReq = () => {
  return request('/costAccount/responsibility/getStandardShareLevel', {
    method: 'GET',
  });
};

//获取责任中心类型
export const getResponsibilityTypeReq = () => {
  return request('/costAccount/responsibility/getResponsibilityType', {
    method: 'GET',
  });
};

//新增
export type AddTableDataType = {
  code: string;
  name: string;
  description: string;
};

export const addData = (data: AddTableDataType) => {
  return request('/costAccount/responsibility/save', {
    method: 'POST',
    data,
  });
};

//编辑表格数据

export type TableRowEditType = {
  id: number;
} & AddTableDataType;

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

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