import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AfterSalesLaborCostsVO, AfterSalesLaborCostsForm, AfterSalesLaborCostsQuery } from '@/api/oa/erp/afterSalesLaborCosts/types';

/**
 * 查询售后人员费用明细列表
 * @param query
 * @returns {*}
 */

export const listAfterSalesLaborCosts = (query?: AfterSalesLaborCostsQuery): AxiosPromise<AfterSalesLaborCostsVO[]> => {
  return request({
    url: '/oa/erp/afterSalesLaborCosts/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询售后人员费用明细详细
 * @param laborCostsId
 */
export const getAfterSalesLaborCosts = (laborCostsId: string | number): AxiosPromise<AfterSalesLaborCostsVO> => {
  return request({
    url: '/oa/erp/afterSalesLaborCosts/' + laborCostsId,
    method: 'get'
  });
};

/**
 * 新增售后人员费用明细
 * @param data
 */
export const addAfterSalesLaborCosts = (data: AfterSalesLaborCostsForm) => {
  return request({
    url: '/oa/erp/afterSalesLaborCosts',
    method: 'post',
    data: data
  });
};

/**
 * 修改售后人员费用明细
 * @param data
 */
export const updateAfterSalesLaborCosts = (data: AfterSalesLaborCostsForm) => {
  return request({
    url: '/oa/erp/afterSalesLaborCosts',
    method: 'put',
    data: data
  });
};

/**
 * 删除售后人员费用明细
 * @param laborCostsId
 */
export const delAfterSalesLaborCosts = (laborCostsId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/erp/afterSalesLaborCosts/' + laborCostsId,
    method: 'delete'
  });
};

/**
 * 下拉框查询售后人员费用明细列表
 * @param query
 * @returns {*}
 */
export function getErpAfterSalesLaborCostsList (query) {
    return request({
        url: '/oa/erp/afterSalesLaborCosts/getErpAfterSalesLaborCostsList',
        method: 'get',
        params: query
    });
};
