import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RevisionInfoVO, RevisionInfoForm, RevisionInfoQuery } from '@/api/qms/revisionInfo/types';

/**
 * 查询改判原因信息列表
 * @param query
 * @returns {*}
 */

export const listRevisionInfo = (query?: RevisionInfoQuery): AxiosPromise<RevisionInfoVO[]> => {
  return request({
    url: '/qms/revisionInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询改判原因信息详细
 * @param revisionId
 */
export const getRevisionInfo = (revisionId: string | number): AxiosPromise<RevisionInfoVO> => {
  return request({
    url: '/qms/revisionInfo/' + revisionId,
    method: 'get'
  });
};

/**
 * 新增改判原因信息
 * @param data
 */
export const addRevisionInfo = (data: RevisionInfoForm) => {
  return request({
    url: '/qms/revisionInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改改判原因信息
 * @param data
 */
export const updateRevisionInfo = (data: RevisionInfoForm) => {
  return request({
    url: '/qms/revisionInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除改判原因信息
 * @param revisionId
 */
export const delRevisionInfo = (revisionId: string | number | Array<string | number>) => {
  return request({
    url: '/qms/revisionInfo/' + revisionId,
    method: 'delete'
  });
};


/**
 * 下拉框查询改判原因信息列表
 * @param query
 * @returns {*}
 */
export function getQcRevisionInfoList (query) {
    return request({
        url: '/qms/revisionInfo/getQcRevisionInfoList',
        method: 'get',
        params: query
    });
};
