import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GradeInfoVO, GradeInfoForm, GradeInfoQuery } from '@/api/qms/gradeInfo/types';

/**
 * 查询品级信息列表
 * @param query
 * @returns {*}
 */

export const listGradeInfo = (query?: GradeInfoQuery): AxiosPromise<GradeInfoVO[]> => {
  return request({
    url: '/qms/gradeInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询品级信息详细
 * @param gradeId
 */
export const getGradeInfo = (gradeId: string | number): AxiosPromise<GradeInfoVO> => {
  return request({
    url: '/qms/gradeInfo/' + gradeId,
    method: 'get'
  });
};

/**
 * 新增品级信息
 * @param data
 */
export const addGradeInfo = (data: GradeInfoForm) => {
  return request({
    url: '/qms/gradeInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改品级信息
 * @param data
 */
export const updateGradeInfo = (data: GradeInfoForm) => {
  return request({
    url: '/qms/gradeInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除品级信息
 * @param gradeId
 */
export const delGradeInfo = (gradeId: string | number | Array<string | number>) => {
  return request({
    url: '/qms/gradeInfo/' + gradeId,
    method: 'delete'
  });
};


/**
 * 下拉框查询品级信息列表
 * @param query
 * @returns {*}
 */
export function getQcGradeInfoList (query) {
    return request({
        url: '/qms/gradeInfo/getQcGradeInfoList',
        method: 'get',
        params: query
    });
};
