import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsBaseOutsourcingInfoVO, DmsBaseOutsourcingInfoForm, DmsBaseOutsourcingInfoQuery } from '@/api/dms/dmsBaseOutsourcingInfo/types';

/**
 * 查询外协信息列表
 * @param query
 * @returns {*}
 */

export const listDmsBaseOutsourcingInfo = (query?: DmsBaseOutsourcingInfoQuery): AxiosPromise<DmsBaseOutsourcingInfoVO[]> => {
  return request({
    url: '/dms/dmsBaseOutsourcingInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询外协信息详细
 * @param outsourcingId
 */
export const getDmsBaseOutsourcingInfo = (outsourcingId: string | number): AxiosPromise<DmsBaseOutsourcingInfoVO> => {
  return request({
    url: '/dms/dmsBaseOutsourcingInfo/' + outsourcingId,
    method: 'get'
  });
};

/**
 * 新增外协信息
 * @param data
 */
export const addDmsBaseOutsourcingInfo = (data: DmsBaseOutsourcingInfoForm) => {
  return request({
    url: '/dms/dmsBaseOutsourcingInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改外协信息
 * @param data
 */
export const updateDmsBaseOutsourcingInfo = (data: DmsBaseOutsourcingInfoForm) => {
  return request({
    url: '/dms/dmsBaseOutsourcingInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除外协信息
 * @param outsourcingId
 */
export const delDmsBaseOutsourcingInfo = (outsourcingId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsBaseOutsourcingInfo/' + outsourcingId,
    method: 'delete'
  });
};


/**
 * 下拉框查询外协信息列表
 * @param query
 * @returns {*}
 */
export function getDmsBaseOutsourcingInfoList (query) {
    return request({
        url: '/dms/dmsBaseOutsourcingInfo/getDmsBaseOutsourcingInfoList',
        method: 'get',
        params: query
    });
};
