import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { QcUnqualifiedRecordVO, QcUnqualifiedRecordForm, QcUnqualifiedRecordQuery } from '@/api/qms/qcUnqualifiedRecord/types';

/**
 * 查询不合格品评审记录列表
 * @param query
 * @returns {*}
 */

export const listQcUnqualifiedRecord = (query?: QcUnqualifiedRecordQuery): AxiosPromise<QcUnqualifiedRecordVO[]> => {
  return request({
    url: '/qms/qcUnqualifiedRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询不合格品评审记录详细
 * @param recordId
 */
export const getQcUnqualifiedRecord = (recordId: string | number): AxiosPromise<QcUnqualifiedRecordVO> => {
  return request({
    url: '/qms/qcUnqualifiedRecord/' + recordId,
    method: 'get'
  });
};

/**
 * 新增不合格品评审记录
 * @param data
 */
export const addQcUnqualifiedRecord = (data: QcUnqualifiedRecordForm) => {
  return request({
    url: '/qms/qcUnqualifiedRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改不合格品评审记录
 * @param data
 */
export const updateQcUnqualifiedRecord = (data: QcUnqualifiedRecordForm) => {
  return request({
    url: '/qms/qcUnqualifiedRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除不合格品评审记录
 * @param recordId
 */
export const delQcUnqualifiedRecord = (recordId: string | number | Array<string | number>) => {
  return request({
    url: '/qms/qcUnqualifiedRecord/' + recordId,
    method: 'delete'
  });
};


/**
 * 下拉框查询不合格品评审记录列表
 * @param query
 * @returns {*}
 */
export function getQcUnqualifiedRecordList (query) {
    return request({
        url: '/qms/qcUnqualifiedRecord/getQcUnqualifiedRecordList',
        method: 'get',
        params: query
    });
};
