/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-03 16:31:27
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-11-20 17:36:02
 * @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 { Key } from 'react';
import { request } from 'umi';

//获收入归集列表
export async function getIncomeCollectionList(params: any) {
  return request('/costAccount/costincomegroupset/list', {
    method: 'GET',
    params: { ...params },
  });
}

//获指定收入归集设置对应的会计科目
export const getIncomeCollectionListHasConnected = (params: any) => {
  return request('/costAccount/costincomegroupset/getIncomeAccountStatus', {
    method: 'GET',
    params: { ...params },
  });
};

//新增
export type AddTableDataType = {
  openDepartmentStatus: number;
  responsibilityCodes: string;
  startDepartmentProportion: number;
  startDepartmentStatus: number;
};

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

//编辑表格数据

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

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

//删除表格操作
export const delData = (ids: Key[]) => {
  return request(`/costAccount/costincomegroupset/delete`, {
    data: ids,
    method: 'POST',
  });
};

//收入归集设置添加会计科目
export const incomeCollectionListConnectAccountingSubject = (data: any) => {
  return request(`/costAccount/costincomegroupset/addIncomeAccount`, {
    data: data,
    method: 'POST',
  });
};
