import request from '@/assets/js/utils/request'
/*
 * 供应商模块 -供应商入库管理API接口
 * */

//  检查申报条件
export function checkDeclaration() {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/checkDeclaration',
    method: 'post'
  })
}
//  提交供应商入库申报,返回值为ids
export function submitDeclaration(data) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/submitDeclaration',
    method: 'post',
    data
  })
}
//  供应商入库列表
export function listDeclarationPages(data) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/listDeclarationPages',
    method: 'post',
    data
  })
}

// 供应商入库（批量）审核状态修改
export function updateAuditDeclarationInfo(data) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/updateAuditDeclarationInfo',
    method: 'post',
    data
  })
}

// 参与项目记录
export function listProjectRecords(data) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/projectRecordsInfo/getProjectRecordsList',
    method: 'post',
    data
  })
}

//  供应商申报记录列表
export function listSupplierSelfDeclarationPages(data) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/listSupplierSelfDeclarationPages',
    method: 'post',
    data
  })
}
//  供应商入库查询
export function queryDeclarationInfo(id) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/queryDeclarationInfo?id=' + id,
    method: 'post'
  })
}
//  删除供应商
export function removeDeclaration(data) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/removeDeclaration',
    method: 'post',
    data
  })
}
//  撤销申报
export function repealDeclaration(id) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/repealDeclaration?id=' + id,
    method: 'post'
  })
}
//  申报单位-字典
export function getDeclarationDictionaries() {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/getDeclarationDictionaries',
    method: 'post'
  })
}
//  获取供应商已申报单位ids
export function getDeclarationDepartIdsBySupplierId(departId) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/getDeclarationDepartIdsBySupplierId?departId=' + departId,
    method: 'post'
  })
}

/* ======================================供应商管理使用api====================*/
// 推荐/邀请供应商
export function listSupplierRepositoryPagesByAll(data) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/listSupplierRepositoryPagesByAll',
    method: 'post',
    data
  })
}

// 推荐/邀请供应商
export function listDeclarationAuditPages(data) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/listDeclarationAuditPages',
    method: 'post',
    data
  })
}
// 推荐/邀请供应商-选择供应商
export function getDeclarationByCommonQuerySupplier(data) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/getDeclarationByCommonQuerySupplier',
    method: 'post',
    data
  })
}
// 推荐/邀请供应商-提交供应商(添加)
export function submitDeclarationForInviteReferer(data) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/submitDeclarationForInviteReferer',
    method: 'post',
    data
  })
}

// 供应商资源库列表关联供货范围
export function listSupplierRepositoryPagesBySupply(data) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/listSupplierRepositoryPagesBySupply',
    method: 'post',
    data
  })
}

// 供应商资源库列表关联组织机构-供应商库-需要申报-不含下级机构
export function listSupplierRepositoryPagesByOrganization(data) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/listSupplierRepositoryPagesByOrganization',
    method: 'post',
    data
  })
}
// 供应商资源库列表关联组织机构-供应商库-需要申报-包含下级机构
export function listSupplierRepositoryPagesByOrganizationAll(data) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/listSupplierRepositoryPagesByOrganizationAll',
    method: 'post',
    data
  })
}
// 根据机构id查询合格供应商信息
export function listSupplierDeclarationInfoByDepartId(parentId) {
  return request({
    url: '/bidprocurement/common-supplier/supplier/declaration/listSupplierDeclarationInfoByDepartId?parentId=' + parentId,
    method: 'post'
  })
}
