You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
import request from '@/utils/request'
export function getSupplier() { return request({ url: 'api/supplier/dropdown-list', method: 'get' }) }
export function add(data) { const url = getUrl(data, 'add') return request({ url: url, method: 'post', data }) }
export function del(ids) { const data = { id: ids[0] } return request({ url: 'api/desecabinet/delete', method: 'post', data }) }
export function edit(data) { const url = getUrl(data, 'edit') return request({ url: url, method: 'put', data }) }
export function getDeviceType() { return request({ url: 'api/device/type', method: 'get' }) }
function getUrl(data, optTYpe) { let url = 'api/desecabinet/' if (data.deviceTypeId.name === '密集架') { url = 'api/desecabinet/' } else if (data.deviceTypeId.name === '回转柜') { url = 'api/rotarycabinet/' } else if (data.deviceTypeId.name === '摄像头') { url = 'api/camera/' } else if (data.deviceTypeId.name === '空调' || data.deviceTypeId.name === '桌面式RFID读写器' || data.deviceTypeId.name === '盘点机' || data.deviceTypeId.name === '恒湿机' || data.deviceTypeId.name === '漏水传感器' || data.deviceTypeId.name === '温湿度感应器' || data.deviceTypeId.name === '空气质量检测设备' || data.deviceTypeId.name === '漏水传感器') { url = 'api/insidedevices/' } else if (data.deviceTypeId.name === '通道门' || data.deviceTypeId.name === '手持式RFID读写器') { url = 'api/outsidedevices/' } if (optTYpe === 'add') { url += 'create' } else if (optTYpe === 'edit') { url += 'update' } return url }
export default { add, edit, del, getSupplier, getDeviceType }
|