import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsRecordLubeVO, DmsRecordLubeForm, DmsRecordLubeQuery } from '@/api/dms/dmsRecordLube/types';

/**
 * 查询润滑记录列表
 * @param query
 * @returns {*}
 */

export const listDmsRecordLube = (query?: DmsRecordLubeQuery): AxiosPromise<DmsRecordLubeVO[]> => {
  return request({
    url: '/dms/dmsRecordLube/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询润滑记录详细
 * @param recordLubeId
 */
export const getDmsRecordLube = (recordLubeId: string | number): AxiosPromise<DmsRecordLubeVO> => {
  return request({
    url: '/dms/dmsRecordLube/' + recordLubeId,
    method: 'get'
  });
};

/**
 * 新增润滑记录
 * @param data
 */
export const addDmsRecordLube = (data: DmsRecordLubeForm) => {
  return request({
    url: '/dms/dmsRecordLube',
    method: 'post',
    data: data
  });
};

/**
 * 修改润滑记录
 * @param data
 */
export const updateDmsRecordLube = (data: DmsRecordLubeForm) => {
  return request({
    url: '/dms/dmsRecordLube',
    method: 'put',
    data: data
  });
};

/**
 * 删除润滑记录
 * @param recordLubeId
 */
export const delDmsRecordLube = (recordLubeId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsRecordLube/' + recordLubeId,
    method: 'delete'
  });
};


/**
 * 下拉框查询润滑记录列表
 * @param query
 * @returns {*}
 */
export function getDmsRecordLubeList (query) {
    return request({
        url: '/dms/dmsRecordLube/getDmsRecordLubeList',
        method: 'get',
        params: query
    });
};
