import request from '@/assets/js/utils/request'
import { getToken } from '@/assets/js/utils/auth'

// 审核项目
export function auditTBPurchaseMain(data) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/auditTBPurchaseMain',
    method: 'post',
    data
  })
}

// 获取代理机构列表
export function getAgentDepartList(data) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getAgentDepartList',
    method: 'post',
    data
  })
}

// 获取竞价项目规则
export function getBiddingRules(projectId) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getBiddingRules/' + projectId,
    method: 'get'
  })
}

// 获取采购公告信息
export function getBulletin(projectId) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getBulletin/' + projectId,
    method: 'get'
  })
}

// 获取采购人信息
export function getBuyer() {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getBuyer',
    method: 'post'
  })
}

// 获取标书下载令牌
export function getDownLoadProcfileToken(purchaseId) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getDownLoadProcfileToken/' + purchaseId,
    method: 'get'
  })
}

// 获取询价项目规则
export function getEnquiryRules(projectId) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getEnquiryRules/' + projectId,
    method: 'get'
  })
}

// 制作通用文件基本信息获取
export function getGeneralFileInfo(data) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getGeneralFileInfo',
    method: 'post',
    data
  })
}

// 获取邀请函信息
export function getInvitation(projectId) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getInvitation/' + projectId,
    method: 'get'
  })
}

// 获取采购项目列表
export function getList(data) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getList',
    method: 'post',
    data
  })
}

// 获取项目跟踪节点
export function getProcessNode(projectId) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getProcessNode/' + projectId,
    method: 'get'
  })
}

// 获取采购文件信息
export function getProcfile(projectId) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getProcfile/' + projectId,
    method: 'get'
  })
}

// 标书下载页面基本信息
export function getProcfileStatus(purchaseId) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getProcfileStatus/' + purchaseId,
    method: 'get'
  })
}

// 获取省
export function getProvince() {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getProvince',
    method: 'post',
    data: {
      token: getToken()
    }
  })
}

// 获取新建项目的编号
export function getPurchaseCode() {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getPurchaseCode',
    method: 'post'
  })
}

// 获取下级地址
export function getSubByPid(id, territoryLevel) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getSubByPid',
    method: 'post',
    data: {
      id: id,
      territoryLevel: territoryLevel
    }
  })
}

// 获取采购项目详情
export function getSublist(projectId) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getSublist/' + projectId,
    method: 'get'
  })
}

// 获取供应商列表
export function getSupplierList(data) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/getSupplierList',
    method: 'post',
    data
  })
}

// 保存竞价项目规则信息
export function saveBiddingRules(data) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/saveBiddingRules',
    method: 'post',
    data
  })
}

// 保存采购公告
export function saveBulletin(data) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/saveBulletin',
    method: 'post',
    data
  })
}

// 保存询价项目规则信息
export function saveEnquiryRules(data) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/saveEnquiryRules',
    method: 'post',
    data
  })
}

// 保存邀请函
export function saveInvitation(data) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/saveInvitation',
    method: 'post',
    data
  })
}

// 保存采购文件
export function saveProcfile(data) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/saveProcfile',
    method: 'post',
    data
  })
}

// 保存采购项目信息
export function savePurchase(data) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/savePurchase',
    method: 'post',
    data
  })
}

// 保存物料信息
export function savePurchaseItem(data) {
  return request({
    url: '/bidprocurement/procurement/tBPurchaseMain/savePurchaseItem',
    method: 'post',
    data
  })
}
