import axios from "@/utils/request";
import request from "@/utils/request";

// import {BUSINESS_PRE, SYS_PRE} from "@/config/app";


export function listPage(query) {
  return axios({
    url: "/udiwms/sysWorkplace/page",
    method: "post",
    data: query
  });
}


export function addWorkplace(query) {
  return axios({
    url: "/udiwms/sysWorkplace/addWorkplace",
    method: "post",
    data: query
  });
}


export function updateWorkplace(query) {
  return axios({
    url: "/udiwms/sysWorkplace/updateWorkplace",
    method: "post",
    data: query
  });
}


export function deleteWorkplace(query) {
  return axios({
    url: "/udiwms/sysWorkplace/deleteWorkplace",
    method: "post",
    data: query
  });
}


export function createWorkplaceId(query) {
  return axios({
    url: "/udiwms/sysWorkplace/createWorkplaceId",
    method: "post",
    data: query
  });
}

export function filterWorkOptimize(query) {
  return axios({
    url: "/udiwms/sysWorkplace/page/filterOptimize",
    method: "get",
    params: query
  });
}


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



export function getWorkplaces(query) {
  return axios({
    url: "/udiwms/sysWorkplace/getWorkplaces",
    method: "get",
    data: query
  });
}



export function getUsers(query) {
  return axios({
    url: "/udiwms/sysWorkplace/getUsers",
    method: "post",
    data: query
  });
}

//绑定单据类型
export function bindBusType(query) {
  return axios({
    url: "/udiwms/sysWorkplace/workBindBusType",
    method: "post",
    data: query
  });
}


//绑定单据类型
export function switchWorkplaceStatus(query) {
  return axios({
    url: "/udiwms/sysWorkplace/switchWorkplaceStatus",
    method: "post",
    data: query
  });
}

