import request from '@/utils/request'
import { downFile } from '@/utils/request'

/**
 * 端口分页查询
 * @param {查询条件} data
 */
export function listOdfPorts(query) {
  return request({
    url: 'business/OdfPorts/list',
    method: 'get',
    params: query,
  })
}
/**
 * 端口分页查询
 * @param {查询条件} data
 */
export function listOdfPortss(query) {
  return request({
    url: 'business/OdfPorts/lists',
    method: 'get',
    params: query,
  })
}
/**
 * 新增端口
 * @param data
 */
export function addOdfPorts(data) {
  return request({
    url: 'business/OdfPorts',
    method: 'post',
    data: data,
  })
}
/**
 * 修改端口
 * @param data
 */
export function updateOdfPorts(data) {
  return request({
    url: 'business/OdfPorts',
    method: 'PUT',
    data: data,
  })
}

/**
 * 修改端口
 * @param data
 */
export function updateOdfPortsStatus(id, status) {
  return request({
    url: 'business/OdfPorts/status/' + id + "/" + status,
    method: 'get',

  })
}
/**
 * 修改端口
 * @param data
 */
export function emptyOdfPorts(id) {
  return request({
    url: 'business/OdfPorts/empty/' + id,
    method: 'get',

  })
}
/**
 * 获取端口详情
 * @param {Id}
 */
export function getOdfPorts(id) {
  return request({
    url: 'business/OdfPorts/' + id,
    method: 'get'
  })
}

/**
 * 删除端口
 * @param {主键} pid
 */
export function delOdfPorts(pid) {
  return request({
    url: 'business/OdfPorts/delete/' + pid,
    method: 'POST'
  })
}

/**
 * 删除端口
 * @param {主键} pid
 */
export function deleteOdfPortsAll(data) {
  return request({
    url: 'business/OdfPorts/deleteAll',
    method: 'POST',
    data: data
  })
}

// 导出端口
export async function exportOdfPorts(query) {
  await downFile('business/OdfPorts/export', { ...query })
}
