import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { QcInspectionResultVO, QcInspectionResultForm, QcInspectionResultQuery } from '@/api/qms/qcInspectionResult/types';

/**
 * 查询质检结果子表列表
 * @param query
 * @returns {*}
 */

export const listQcInspectionResult = (query?: QcInspectionResultQuery): AxiosPromise<QcInspectionResultVO[]> => {
  return request({
    url: '/qms/qcInspectionResult/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询质检结果子表详细
 * @param resultId
 */
export const getQcInspectionResult = (resultId: string | number): AxiosPromise<QcInspectionResultVO> => {
  return request({
    url: '/qms/qcInspectionResult/' + resultId,
    method: 'get'
  });
};

/**
 * 新增质检结果子表
 * @param data
 */
export const addQcInspectionResult = (data: QcInspectionResultForm) => {
  return request({
    url: '/qms/qcInspectionResult',
    method: 'post',
    data: data
  });
};

/**
 * 修改质检结果子表
 * @param data
 */
export const updateQcInspectionResult = (data: QcInspectionResultForm) => {
  return request({
    url: '/qms/qcInspectionResult',
    method: 'put',
    data: data
  });
};

/**
 * 删除质检结果子表
 * @param resultId
 */
export const delQcInspectionResult = (resultId: string | number | Array<string | number>) => {
  return request({
    url: '/qms/qcInspectionResult/' + resultId,
    method: 'delete'
  });
};


/**
 * 下拉框查询质检结果子表列表
 * @param query
 * @returns {*}
 */
export function getQcInspectionResultList (query) {
    return request({
        url: '/qms/qcInspectionResult/getQcInspectionResultList',
        method: 'get',
        params: query
    });
};
