import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RimInfoVO, RimInfoForm, RimInfoQuery } from '@/api/qms/rimInfo/types';

/**
 * 查询轮辋信息列表
 * @param query
 * @returns {*}
 */

export const listRimInfo = (query?: RimInfoQuery): AxiosPromise<RimInfoVO[]> => {
  return request({
    url: '/qms/rimInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询轮辋信息详细
 * @param rimId
 */
export const getRimInfo = (rimId: string | number): AxiosPromise<RimInfoVO> => {
  return request({
    url: '/qms/rimInfo/' + rimId,
    method: 'get'
  });
};

/**
 * 新增轮辋信息
 * @param data
 */
export const addRimInfo = (data: RimInfoForm) => {
  return request({
    url: '/qms/rimInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改轮辋信息
 * @param data
 */
export const updateRimInfo = (data: RimInfoForm) => {
  return request({
    url: '/qms/rimInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除轮辋信息
 * @param rimId
 */
export const delRimInfo = (rimId: string | number | Array<string | number>) => {
  return request({
    url: '/qms/rimInfo/' + rimId,
    method: 'delete'
  });
};


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