import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProdBaseProcessUserVO, ProdBaseProcessUserForm, ProdBaseProcessUserQuery } from '@/api/mes/prodBaseProcessUser/types';

/**
 * 查询工序关联人员列表
 * @param query
 * @returns {*}
 */

export const listProdBaseProcessUser = (query?: ProdBaseProcessUserQuery): AxiosPromise<ProdBaseProcessUserVO[]> => {
  return request({
    url: '/mes/prodBaseProcessUser/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工序关联人员详细
 * @param processId
 */
export const getProdBaseProcessUser = (processId: string | number): AxiosPromise<ProdBaseProcessUserVO> => {
  return request({
    url: '/mes/prodBaseProcessUser/' + processId,
    method: 'get'
  });
};

/**
 * 新增工序关联人员
 * @param data
 */
export const addProdBaseProcessUser = (data: ProdBaseProcessUserForm) => {
  return request({
    url: '/mes/prodBaseProcessUser',
    method: 'post',
    data: data
  });
};

/**
 * 修改工序关联人员
 * @param data
 */
export const updateProdBaseProcessUser = (data: ProdBaseProcessUserForm) => {
  return request({
    url: '/mes/prodBaseProcessUser',
    method: 'put',
    data: data
  });
};

/**
 * 删除工序关联人员
 * @param processId
 */
export const delProdBaseProcessUser = (processId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/prodBaseProcessUser/' + processId,
    method: 'delete'
  });
};


/**
 * 下拉框查询工序关联人员列表
 * @param query
 * @returns {*}
 */
export function getProdBaseProcessUserList (query) {
    return request({
        url: '/mes/prodBaseProcessUser/getProdBaseProcessUserList',
        method: 'get',
        params: query
    });
};
