/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-03 16:31:27
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-05-17 14:29:09
 * @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 IndicProjectTableItemDataType = {
  id: number;
  hospId: number;
  code: string;
  indicatorName: string;
  indicatorCode: string;
  indicatorType: number,
  indicatorTypeName: string,
  indicatorDefinition: string,
  orderPointValue: number,
  executePointValue: number,
  sql: string
}


export const getIndicProjectTableData = (params?: any) => {
  return request<{
    current: number;
    list: IndicProjectTableItemDataType[];
    pageSize: number;
    totalCount: number;
    totalPage: number;
  }>('/performance/item/getIndicator', {
    method: 'GET',
    params: { ...params }
  });
};

export const gainData = (params?: any) => {
  return request('/performance/item/auto', {
    method: 'GET',
    params: { ...params }
  });
};




//新增表格数据
export type AddTableDataType = {
  "indicatorName":string, //指标名称
  "indicatorType": number, //类型
  "indicatorDefinition":string, //定义
  "orderPointValue":number, //点值
  //"executePointValue":number, //执行点值
  "sql":string //sql
}
export const addData = (data: AddTableDataType) => {
  return request('/performance/item/addIndicator', {
    method: 'POST',
    data
  });
};



//编辑表格数据

export const editData = (data: AddTableDataType & { id: number }) => {
  return request('/performance/item/editIndicator', {
    method: 'POST',
    data
  });
};

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








