/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-03 16:31:27
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2025-07-09 17:18:44
 * @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 QualitativeOptionItemType = {
  id: number;
  hiId: number;
  code: string;
  name: string;
  resultType: number;
  resultTypeName: string;
  defaultFlag: number;
  sort: number;
  delFlag: number;
  color: string;
};

export const getData = (params?: any) => {
  return request<{
    currPage: any;
    current: number;
    list: QualitativeOptionItemType[];
    pageSize: number;
    totalCount: number;
    totalPage: number;
  }>('/manager/setting/getResultConfigList', {
    method: 'GET',
    params: { ...params },
  });
};

//新增表格数据
export type AddTableDataType = {
  //hospId:number;
  hiId: string;
  code: string;
  name: string;
  resultType: string;
  defaultFlag: number;
  sort: number;
  delFlag: number;
  createUser: string;
  createTime: string;
  color: string;
};
export const addData = (data: AddTableDataType) => {
  return request('/manager/setting/addResultConfig', {
    method: 'POST',
    data,
  });
};

//编辑表格数据

export const editData = (data: QualitativeOptionItemType) => {
  return request('/manager/setting/editResultConfig', {
    method: 'POST',
    data,
  });
};

//删除表格操作
export const delData = (id: string) => {
  return request('/manager/setting/deleteResultConfig', {
    method: 'POST',
    params: { id },
  });
};
//获取颜色字典
export const getColorFromDic = (params: {
  dictType: string;
  systemId: number;
}) => {
  return request('/centerSys/sysdictdata/getDictByDictType', {
    method: 'GET',
    params: { ...params },
  });
};
