import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DynamicStandardVO, DynamicStandardForm, DynamicStandardQuery } from '@/api/qms/dynamicStandard/types';

/**
 * 查询动均质检标准维护列表
 * @param query
 * @returns {*}
 */

export const listDynamicStandard = (query?: DynamicStandardQuery): AxiosPromise<DynamicStandardVO[]> => {
  return request({
    url: '/qms/dynamicStandard/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询动均质检标准维护详细
 * @param standardId
 */
export const getDynamicStandard = (standardId: string | number): AxiosPromise<DynamicStandardVO> => {
  return request({
    url: '/qms/dynamicStandard/' + standardId,
    method: 'get'
  });
};

/**
 * 新增动均质检标准维护
 * @param data
 */
export const addDynamicStandard = (data: DynamicStandardForm) => {
  return request({
    url: '/qms/dynamicStandard',
    method: 'post',
    data: data
  });
};

/**
 * 修改动均质检标准维护
 * @param data
 */
export const updateDynamicStandard = (data: DynamicStandardForm) => {
  return request({
    url: '/qms/dynamicStandard',
    method: 'put',
    data: data
  });
};

/**
 * 删除动均质检标准维护
 * @param standardId
 */
export const delDynamicStandard = (standardId: string | number | Array<string | number>) => {
  return request({
    url: '/qms/dynamicStandard/' + standardId,
    method: 'delete'
  });
};


/**
 * 下拉框查询动均质检标准维护列表
 * @param query
 * @returns {*}
 */
export function getQcDynamicStandardList (query) {
    return request({
        url: '/qms/dynamicStandard/getQcDynamicStandardList',
        method: 'get',
        params: query
    });
};
