/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-03 16:31:27
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2024-02-22 17:13:21
 * @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 type TableDataType = {
  id: number;
  hospId: number;
  shareParamCode: string;
  shareParamName: string;
  sourceType: string;
  sourceTypeName: string;
  sourceCode: string;
  sourceName: string;
};

export const getProjectShareParamsSetTableData = (params?: any) => {
  return request('/costAccount/setting/shareParamTypeMapList', {
    method: 'GET',
    params: { ...params },
  });
};

//新增
export type AddTableDataType = {
  shareParamCode: string;
  shareParamName: string;
  sourceType: string;
  // sourceTypeName:string,
  sourceCode: string;
  sourceName: string;
};

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

//编辑表格数据

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

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

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

//获取来源项目
export const getSourceItems = (type: string) => {
  return request('/costAccount/setting/getShareParamSourceItem', {
    method: 'GET',
    params: { type },
  });
};
