import request from '@/utils/request'
import qs from 'qs'
import { upcloud_base_wh_control } from "@/config/serviceSettings";


export const api = {
  queryList: upcloud_base_wh_control + '/datarelationWhSupplier/page',
  queryListUn: upcloud_base_wh_control + '/datarelationWhSupplier/unpage',

  queryItem: upcloud_base_wh_control + '/datarelationWhSupplier/info',
  addItem: upcloud_base_wh_control + '/datarelationWhSupplier/batchAdd',
  deleteList: upcloud_base_wh_control + '/datarelationWhSupplier/delete'
};

export function queryList(parameter) {
  return request({
    method: 'post',
    url: api.queryList,
    data: parameter,
  })
}

export function queryListUn(parameter) {
  return request({
    method: 'post',
    url: api.queryListUn,
    data: parameter,
  })
}

export function queryItem(parameter) {
  return request({
    method: 'post',
    url: api.queryItem,
    params: parameter,
  })
}

export function addItem(parameter) {
  return request({
    method: 'post',
    url: api.addItem,
    data: parameter,
  })
}

export function uploadItem(parameter) {
  return request({
    method: 'post',
    url: api.uploadItem,
    data: parameter,
  })
}

export function deleteList(parameter) {
  return request({
    method: 'post',
    url: api.deleteList,
    data: qs.stringify(parameter),
    headers: {
      'content-type': 'application/x-www-form-urlencoded'
    }
  })
}