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

//  仓库列表  有分页
export const warehouseList = (params) => {
  const url = `/warehouse/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
          'module': encodeURIComponent('列表查询')
        }
  })
}

// 获取默认仓库
export const getDefaultWarehouse = (params) => {
  return axios({
    url: '/warehouse/getDefaultWithExt',
    data: params,
    method: 'get',
    headers:{
          'module': encodeURIComponent('获取默认仓库')
        }
  })
}
//  仓库列表  无分页 有权限
export const queryAuthWarehouse = (params) => {
  return axios({
    url: '/bizuser/queryAuthWarehouse',
    data: params,
    method: 'get'
  })
}
//  仓库列表  无分页
export const warehouseAllList = (params) => {
  const url = '/warehouse/queryList'
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  仓库仓位  级联数据
export const warehouseCascadeList = (params) => {
  const url = '/warehouse/queryListWithExt'
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
// 新增/编辑仓库
export const warehouseSave = params => {
  return axios({
    url: '/warehouse/save',
    data: params,
    method: 'post',
    headers:{
          'module': encodeURIComponent('新增/编辑')
        }
  })
}
// 删除仓库
export const warehouseDel = params => {
  return axios({
    url: `/warehouse/delete/${params.sn}`,
    data: {},
    method: 'get',
    headers:{
          'module': encodeURIComponent('删除')
        }
  })
}

//  仓位列表  有分页
export const warehouseLocList = (params) => {
  const url = `/warehouseLoc/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
              'module': encodeURIComponent('列表查询')
            }
  })
}
//  仓位列表  无分页
export const warehouseLocAllList = (params) => {
  const url = '/warehouseLoc/queryList'
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}

// 新增/编辑仓位
export const warehouseLocSave = params => {
  return axios({
    url: '/warehouseLoc/save',
    data: params,
    method: 'post',
    headers:{
              'module': encodeURIComponent('新增/编辑')
    }
  })
}

// 删除仓位
export const warehouseLocDel = params => {
  return axios({
    url: `/warehouseLoc/delete/${params.sn}`,
    data: {},
    method: 'get',
    headers:{
              'module': encodeURIComponent('删除')
            }
  })
}
