/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2025-06-10 12:15:25
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2025-06-10 12:15:25
 * @FilePath: /pfmBackMana/src/pages/baseInfoMana/deptPersonnel/service.ts
 * @Description: 部门人员管理服务
 */

import { request } from 'umi';

// 获取部门树
export async function getDeptTree(params?: any) {
  return request('/api/dept/tree', {
    method: 'GET',
    params,
  });
}

// 获取部门详情
export async function getDeptDetail(id: string) {
  return request(`/api/dept/${id}`, {
    method: 'GET',
  });
}

// 获取部门人员列表
export async function getDeptPersonnel(params: any) {
  return request('/api/dept/personnel', {
    method: 'GET',
    params,
  });
}

// 添加部门人员
export async function addDeptPersonnel(data: any) {
  return request('/api/dept/personnel', {
    method: 'POST',
    data,
  });
}

// 删除部门人员
export async function deleteDeptPersonnel(id: string) {
  return request(`/api/dept/personnel/${id}`, {
    method: 'DELETE',
  });
}

// 设置部门负责人
export async function setDeptManager(data: any) {
  return request('/api/dept/manager', {
    method: 'POST',
    data,
  });
}

// 获取部门责任事项
export async function getDeptResponsibilities(params: any) {
  return request('/api/dept/responsibilities', {
    method: 'GET',
    params,
  });
}
