import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsRecordLubeDetailVO, DmsRecordLubeDetailForm, DmsRecordLubeDetailQuery } from '@/api/dms/dmsRecordLubeDetail/types';

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

export const listDmsRecordLubeDetail = (query?: DmsRecordLubeDetailQuery): AxiosPromise<DmsRecordLubeDetailVO[]> => {
  return request({
    url: '/dms/dmsRecordLubeDetail/list',
    method: 'get',
    params: query
  });
};

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

/**
 * 新增润滑记录明细
 * @param data
 */
export const addDmsRecordLubeDetail = (data: DmsRecordLubeDetailForm) => {
  return request({
    url: '/dms/dmsRecordLubeDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改润滑记录明细
 * @param data
 */
export const updateDmsRecordLubeDetail = (data: DmsRecordLubeDetailForm) => {
  return request({
    url: '/dms/dmsRecordLubeDetail',
    method: 'put',
    data: data
  });
};

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


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