import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
  SamplePrescriptionVO,
  SamplePrescriptionForm,
  SamplePrescriptionQuery
} from '@/api/mes/samplePrescription/types';

/**
 * 查询示方书维护列表
 * @param query
 * @returns {*}
 */

export const listSamplePrescription = (query?: SamplePrescriptionQuery): AxiosPromise<SamplePrescriptionVO[]> => {
  return request({
    url: '/mes/samplePrescription/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询示方书维护详细
 * @param sampleId
 */
export const getSamplePrescription = (sampleId: string | number): AxiosPromise<SamplePrescriptionVO> => {
  return request({
    url: '/mes/samplePrescription/' + sampleId,
    method: 'get'
  });
};

/**
 * 新增示方书维护
 * @param data
 */
export const addSamplePrescription = (data: SamplePrescriptionForm) => {
  return request({
    url: '/mes/samplePrescription',
    method: 'post',
    data: data
  });
};

/**
 * 修改示方书维护
 * @param data
 */
export const updateSamplePrescription = (data: SamplePrescriptionForm) => {
  return request({
    url: '/mes/samplePrescription',
    method: 'put',
    data: data
  });
};

/**
 * 删除示方书维护
 * @param sampleId
 */
export const delSamplePrescription = (sampleId: string | number | Array<string | number>) => {
  return request({
    url: '/mes/samplePrescription/' + sampleId,
    method: 'delete'
  });
};


/**
 * 下拉框查询示方书维护列表
 * @param query
 * @returns {*}
 */
export function getProdSamplePrescriptionList(query) {
  return request({
    url: '/mes/samplePrescription/getProdSamplePrescriptionList',
    method: 'get',
    params: query
  });
};
