import axios from "@/utils/request";
import {getDeptListByUserOptimize} from "@/api/auth/authDept";

//获取数据
export function getBusTypeList(params) {
  return axios({
    url: "/udiwms/bussinessType/filter",
    method: "get",
    params: params
  });
}


export function getLocalJoinByUser(params) {
  return axios({
    url: "/udiwms/localBusType/filterJoinByUser",
    method: "get",
    params: params
  });
}

export function getLocalJoinByUserOptimize(params) {
  return axios({
    url: "/udiwms/localBusType/filterJoinByUserOptimize",
    method: "get",
    params: params
  });
}

export function getOrderDetailBusOptimize(params) {
  return axios({
    url: "/udiwms/orderDetail/busTypesOptimize",
    method: "get",
    params: params
  });
}


export function getOrderDetailBus(params) {
  return axios({
    url: "/udiwms/orderDetail/busTypes",
    method: "get",
    params: params
  });
}


export function insertBusType(data) {
  return axios({
    url: "/udiwms/bussinessType/insert",
    method: "post",
    data: data
  });
}

export function updateBusType(data) {
  return axios({
    url: "/udiwms/bussinessType/update",
    method: "post",
    data: data
  });
}

export function deleteBusType(data) {
  return axios({
    url: "/udiwms/bussinessType/delete",
    method: "post",
    data: data
  });
}

export function candidateBusType(params) {
  return axios({
    url: "/udiwms/bussinessType/candidateBusType",
    method: "get",
    params: params
  });
}

export function upload(data) {
  return axios({
    url: "/udiwms/bussinessType/file/upload",
    method: "post",
    data: data
  });
}

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

export function filterForThirdSys() {
  return axios({
    url: "/udiwms/bussinessType/filterForThirdSys",
    method: "get",
    params: null
  })
}

export function getBusTypeListByUser(params) {
  return axios({
    url: "/udiwms/localBusType/filterByUser",
    method: "get",
    params: params
  });
}

export function filterUnUse(params) {
  return axios({
    url: "/udiwms/localBusType/filterUnUse",
    method: "get",
    params: params
  });
}


export function findByInvUser(query) {
  return axios({
    url: "/udiwms/busType/findByInvUser",
    method: "get",
    params: query
  });
}


export function findChangeOrigin(query) {
  return axios({
    url: "/udiwms/busType/change/origin",
    method: "get",
    params: query
  });
}


export function findChangeTarget(query) {
  return axios({
    url: "/udiwms/busType/change/target",
    method: "get",
    params: query
  });
}


