import request, { postBlob, getBlob, handleImport } from '@/utils/request'

export function websitStockList(data) {
  return request({
    url: `/websit/stock/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function websitStockListExport(data, name) {
  return postBlob({
    url: '/websit/stock/list/export',
    data,
    name
  })
}

export function websitStockImportM(data) {
  return handleImport('/websit/stock/importM', data.formdata, data.id || '')
}

export function websitStockAccList(data) {
  return request({
    url: `/websit/stock/acc/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function websitStockAccListExport(data, name) {
  return postBlob({
    url: '/websit/stock/acc/list/export',
    data,
    name
  })
}

// --------------------------------------------------------

export function websitStockListP(data) {
  return request({
    url: `/websit/stock/listP?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function websitStockListPExport(data, name) {
  return postBlob({
    url: '/websit/stock/listP/export',
    data,
    name
  })
}

export function websitStockImportP(data) {
  return handleImport('/websit/stock/importP', data.formdata, data.id || '')
}

export function websitStockAccListP(data) {
  return request({
    url: `/websit/stock/acc/listP?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function workerStockDel(data) {
  return request({
    url: '/worker/stock/del',
    method: 'post',
    data
  })
}

export function websitStockAccListPExport(data, name) {
  return postBlob({
    url: '/websit/stock/acc/listP/export',
    data,
    name
  })
}

// --------------------------------------------------------

export function workerStockList(data) {
  return request({
    url: `/worker/stock/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function workerStockListExport(data, name) {
  return postBlob({
    url: '/worker/stock/list/export',
    data,
    name
  })
}

export function workerStockImportM(data) {
  return handleImport('/worker/stock/importM', data.formdata, data.id || '')
}

export function workerStockAccList(data) {
  return request({
    url: `/worker/stock/acc/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function workerStockAccListExport(data, name) {
  return postBlob({
    url: '/worker/stock/acc/list/export',
    data,
    name
  })
}

// --------------------------------------------------------

export function workerStockListP(data) {
  return request({
    url: `/worker/stock/listP?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function workerStockListPExport(data, name) {
  return postBlob({
    url: '/worker/stock/listP/export',
    data,
    name
  })
}

export function workerStockImportP(data) {
  return handleImport('/worker/stock/importP', data.formdata, data.id || '')
}

export function workerStockAccListP(data) {
  return request({
    url: `/worker/stock/acc/listP?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function workerStockAccListPExport(data, name) {
  return postBlob({
    url: '/worker/stock/acc/listP/export',
    data,
    name
  })
}
