/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-03-03 16:31:27
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-10-12 15:56:04
 * @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 FenyeTemplateItemType = {
  id: number;
  hiId: number;
  name: string;
  content: string;
  remark: string;
  createUserId: number;
  createUserName: string;
  date: string;
};

export const getData = (params?: any) => {
  return request('/manager/Employee/getEmployee', {
    method: 'GET',
    params: { ...params },
  });
};

//新增表格数据
export type AddTableDataType = {
  name: string;
  content: string;
  remark: string;
};
export const addData = (data: AddTableDataType) => {
  return request('/manager/setting/addPageTemplate', {
    method: 'POST',
    data,
  });
};

//编辑权限
export const editData = (data: {
  id: number;
  account: string;
  name: string;
  employeeId: number;
  permission: string;
}) => {
  return request('/manager/Employee/editEmployeePermission', {
    method: 'POST',
    data,
  });
};

//关联单位
export const bindUnitReq = (data: {
  employeeId: string;
  employeeName: string;
  departmentList: {
    code: string;
    name: string;
    isManager: number;
    isFunction: number;
  }[];
}) => {
  return request('/manager/Employee/editDepartment', {
    method: 'POST',
    data,
  });
};

//关联查核组
export const bindCheckGroupReq = (data: {
  employeeId: string;
  employeeName: string;
  groupList: {
    code: string;
    name: string;
    isManager: number;
  }[];
}) => {
  return request('/manager/Employee/editCheckGroup', {
    method: 'POST',
    data,
  });
};

//删除表格操作

export const delData = (id: string) => {
  return request('/manager/setting/deletePageTemplate', {
    method: 'POST',
    params: { id },
  });
};
