import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { deviceTypeForm, deviceTypeQuery, deviceTypeVO } from './types';
/**
 * 查询设备类型
 * @param query
 */
export const deviceType = (query: deviceTypeQuery): AxiosPromise<deviceTypeVO[]> => {
  return request({
    url: '/api/deviceType',
    method: 'get',
    params: query
  });
};
// *********新增设备类型*************
export const addDeviceType = (data: any): AxiosPromise<deviceTypeVO[]> => {
  return request({
    url: '/api/deviceType/add',
    method: 'post',
    data: data,
     headers:{
      'Content-Type':'application/x-www-form-urlencoded;charset=UTF-8'
    }
  });
};

// 修改
export const updateDeviceType = (data: any): AxiosPromise<deviceTypeVO[]> => {
  return request({
    url: '/api/deviceType/update',
    method: 'put',
    headers:{
      'Content-Type':'application/x-www-form-urlencoded;charset=UTF-8'
    },
    data
  })
}
// 删除
export const deleteDeviceType = (ids: any): AxiosPromise<deviceTypeVO[]> => {
  return request({
    url: '/api/deviceType/delete',
    method: 'delete',
    
    data: ids
  })
}

export default { deviceType, addDeviceType, updateDeviceType, deleteDeviceType }

