import axios from "@/utils/request";

export function devicePage(query) {
  return axios(
    {
      url: "/udi/device/info/page",
      method: "POST",
      data: query
    }
  )
}

export function detailByUserPage(query) {
  return axios(
    {
      url: "/udi/device/info/detailByUser/page",
      method: "POST",
      data: query
    }
  )
}
export function detailByDeptCodePage(query) {
  return axios(
    {
      url: "/udi/device/info/detailByDeptCode/page",
      method: "POST",
      data: query
    }
  )
}

export function deviceAllPage(query) {
  return axios(
    {
      url: "/udi/device/info/all/page",
      method: "POST",
      data: query
    }
  )
}

export function detailPage(query) {
    return axios(
        {
            url: "/udi/device/info/detail/page",
            method: "POST",
            data: query
        }
    )
}

export function deviceDetailInfo(query) {
    return axios(
        {
            url: "/udi/device/detailInfo/page",
            method: "POST",
            data: query
        }
    )
}

export function deviceLogs(deviceCode) {
  return axios(
    {
      url: `/udi/device/log/${deviceCode}`,
      method: "GET"
    }
  )
}

export function genDeviceCode(deviceCode) {
  return axios(
    {
      url: `/udi/device/code/gen`,
      method: "GET"
    }
  )
}

export function genDeviceQR(deviceCode) {
  return axios(
    {
      url: `/udi/device/genQR/${deviceCode}`,
      method: "GET"
    }
  )
}

export function printDevLabel(query) {
  return axios({
    url: "/udiwms/inv/deptDev/label/print",
    method: "post",
    data: query,
    headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
    responseType: 'arraybuffer',   //一定要设置响应类型，否则页面会是空白pdf
  });
}


export function updateOrderItem(data) {
  return axios(
    {
      url: "/udi/device/info/update",
      method: "POST",
      data: data
    }
  )
}

