import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { QcInspectionMainVO, QcInspectionMainForm, QcInspectionMainQuery } from '@/api/qms/QcInspectionMain/types';

/**
 * 查询质检任务列表
 * @param query
 * @returns {*}
 */

export const listQcInspectionMain = (query?: QcInspectionMainQuery): AxiosPromise<QcInspectionMainVO[]> => {
  return request({
    url: '/qms/QcInspectionMain/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询质检任务详细
 * @param inspectionId
 */
export const getQcInspectionMain = (inspectionId: string | number): AxiosPromise<QcInspectionMainVO> => {
  return request({
    url: '/qms/QcInspectionMain/' + inspectionId,
    method: 'get'
  });
};

/**
 * 新增质检任务
 * @param data
 */
export const addQcInspectionMain = (data: QcInspectionMainForm) => {
  return request({
    url: '/qms/QcInspectionMain',
    method: 'post',
    data: data
  });
};

/**
 * 修改质检任务
 * @param data
 */
export const updateQcInspectionMain = (data: QcInspectionMainForm) => {
  return request({
    url: '/qms/QcInspectionMain',
    method: 'put',
    data: data
  });
};

/**
 * 删除质检任务
 * @param inspectionId
 */
export const delQcInspectionMain = (inspectionId: string | number | Array<string | number>) => {
  return request({
    url: '/qms/QcInspectionMain/' + inspectionId,
    method: 'delete'
  });
};


/**
 * 下拉框查询质检任务列表
 * @param query
 * @returns {*}
 */
export function getQcInspectionMainList (query) {
    return request({
        url: '/qms/QcInspectionMain/getQcInspectionMainList',
        method: 'get',
        params: query
    });
};
