import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ErpStaffVO, ErpStaffForm, ErpStaffQuery } from '@/api/erpData/erpStaff/types';

/**
 * 查询erp人员信息列表
 * @param query
 * @returns {*}
 */

export const listErpStaff = (query?: ErpStaffQuery): AxiosPromise<ErpStaffVO[]> => {
  return request({
    url: '/system/erpStaff/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询erp人员信息详细
 * @param staffId
 */
export const getErpStaff = (staffId: string | number): AxiosPromise<ErpStaffVO> => {
  return request({
    url: '/system/erpStaff/' + staffId,
    method: 'get'
  });
};

/**
 * 新增erp人员信息
 * @param data
 */
export const addErpStaff = (data: ErpStaffForm) => {
  return request({
    url: '/system/erpStaff',
    method: 'post',
    data: data
  });
};

/**
 * 修改erp人员信息
 * @param data
 */
export const updateErpStaff = (data: ErpStaffForm) => {
  return request({
    url: '/system/erpStaff',
    method: 'put',
    data: data
  });
};

/**
 * 删除erp人员信息
 * @param staffId
 */
export const delErpStaff = (staffId: string | number | Array<string | number>) => {
  return request({
    url: '/system/erpStaff/' + staffId,
    method: 'delete'
  });
};
