import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DmsPlanLubeDetailVO, DmsPlanLubeDetailForm, DmsPlanLubeDetailQuery } from '@/api/dms/dmsPlanLubeDetail/types';

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

export const listDmsPlanLubeDetail = (query?: DmsPlanLubeDetailQuery): AxiosPromise<DmsPlanLubeDetailVO[]> => {
  return request({
    url: '/dms/dmsPlanLubeDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询润滑计划明细详细
 * @param planLubeDetailId
 */
export const getDmsPlanLubeDetail = (planLubeDetailId: string | number): AxiosPromise<DmsPlanLubeDetailVO> => {
  return request({
    url: '/dms/dmsPlanLubeDetail/' + planLubeDetailId,
    method: 'get'
  });
};

/**
 * 新增润滑计划明细
 * @param data
 */
export const addDmsPlanLubeDetail = (data: DmsPlanLubeDetailForm) => {
  return request({
    url: '/dms/dmsPlanLubeDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改润滑计划明细
 * @param data
 */
export const updateDmsPlanLubeDetail = (data: DmsPlanLubeDetailForm) => {
  return request({
    url: '/dms/dmsPlanLubeDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除润滑计划明细
 * @param planLubeDetailId
 */
export const delDmsPlanLubeDetail = (planLubeDetailId: string | number | Array<string | number>) => {
  return request({
    url: '/dms/dmsPlanLubeDetail/' + planLubeDetailId,
    method: 'delete'
  });
};


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