import request from '@/assets/js/utils/request'
// 获取【组件封装】品目树组织机构/采购单位
export function getOrganizationTree(data) {
  return request({
    url: '/bidprocurement/common-user/user/organization/getOrganizationTree',
    method: 'post',
    data
  })
}
// 获取【组件封装】品目树组织机构/采购单位
export function getBuyersList(data) {
  return request({
    url: '/bidprocurement/common-user/user/organization/getBuyersList',
    method: 'post',
    data
  })
}
// 获取【组件封装】品目树组织机构搜索
export function getOrganizationTreeBySearch(data) {
  return request({
    url: '/bidprocurement/common-user/user/organization/getOrganizationTreeBySearch',
    method: 'post',
    data
  })
}
// 组织结构-懒加载
export function initOrganizationTree(parentId) {
  return request({
    url:
      '/bidprocurement/common-user/user/organization/initOrganizationTree?parentId=' + parentId,
    method: 'get'
  })
}

// 统一社会信用代码-重复校验
export function checkDepartInfo(data) {
  return request({
    url: '/bidprocurement/common-user/user/depart/checkDepartInfo',
    method: 'post',
    data
  })
}

// 查询所属二级公司树结构
export function selectSecondaryLevelCompany(data) {
  return request({
    url: '/bidprocurement/common-user/user/organization/selectSecondaryLevelCompany',
    method: 'post',
    data
  })
}

/* ===============================招标人信息库==================================================*/
// 根据角色获取用户列表(招标人信息库)
export function queryUserListByRoleName(data) {
  return request({
    url: '/bidprocurement/common-user/user/depart/queryUserListByRoleName',
    method: 'post',
    data
  })
}

// 获取招标人详情(招标人信息库)
export function queryUserInfoById(departId) {
  return request({
    url: '/bidprocurement/common-user/user/depart/queryUserInfoById?departId=' + departId,
    method: 'post'
  })
}

// 根据机构id获取联系人信息
export function queryLinkerListByDepartId(departId) {
  return request({
    url: '/bidprocurement/common-user/user/CommonUserDepartLinkerController/queryLinkerListByDepartId?departId=' + departId,
    method: 'post'
  })
}

// 新增或修改联系人信息
export function saveOrUpdateLinkerInfo(data) {
  return request({
    url: '/bidprocurement/common-user/user/CommonUserDepartLinkerController/saveOrUpdateLinkerInfo',
    method: 'post',
    data
  })
}
// 删除联系人
export function deleteLinkerInfoById(linkerId) {
  return request({
    url: '/bidprocurement/common-user/user/CommonUserDepartLinkerController/deleteLinkerInfoById?linkerId=' + linkerId,
    method: 'post'
  })
}

/* ===============================招标人代表库==================================================*/
// 获取招标人代表信息列表
export function queryRepresentListPage(data) {
  return request({
    url: '/bidprocurement/common-user/user/tenderRepresentController/queryRepresentListPage',
    method: 'post',
    data
  })
}
// 添加或修改招标代表人信息
export function saveOrUpdateRepresentInfo(data) {
  return request({
    url: '/bidprocurement/common-user/user/tenderRepresentController/saveOrUpdateRepresentInfo',
    method: 'post',
    data
  })
}
// 根据id获取招标人代表详情
export function queryRepresentInfoById(representId) {
  return request({
    url: '/bidprocurement/common-user/user/tenderRepresentController/queryRepresentInfoById?representId=' + representId,
    method: 'post'
  })
}

// 根据id删除招标人代表信息
export function deleteRepresentInfoById(representId) {
  return request({
    url: '/bidprocurement/common-user//user/tenderRepresentController/deleteRepresentInfoById?representId=' + representId,
    method: 'post'
  })
}
// 招标人代表创建用户
export function createAccountToRepresent(data) {
  return request({
    url: '/bidprocurement/common-user//user/tenderRepresentController/createAccountToRepresent',
    method: 'post',
    data
  })
}

// 查询该用户已有的角色列表和用户列表
export function selectDepartListAndRoleListByUserId(accessToken) {
  return request({
    url: '/bidprocurement/common-user/user/user/selectDepartListAndRoleListByUserId',
    method: 'post',
    accessToken: accessToken// token
  })
}

// 切换角色部门
export function switchRoleDepart(params) {
  return request({
    url: '/bidprocurement/common-user/user/user/switchRoleDepart',
    method: 'post',
    data: params.data,
    accessToken: params.accessToken// token
  })
}
// 根据departId获取所属公司的所有下级部门信息
export function getDepartInfoListByDepartId(data) {
  return request({
    url: '/bidprocurement/common-user/user/organization/getDepartInfoListByDepartId',
    method: 'post',
    data
  })
}

// 网页配置初始化
export function initPlatformConfig() {
  return request({
    url: '/bidprocurement/common-user/user/platformConfig/initPlatformConfig',
    method: 'get'
  })
}
// -------------用户管理操作-供应商用户-----------
// 获取用户列表
export function listUserByDepartRoleNamePages(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/listUserByDepartRoleNamePages',
    method: 'post',
    data
  })
}
// 启用停用删除
export function updateUserById(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/updateUserById',
    method: 'post',
    data
  })
}
// 管理员批量修改重置用户密码
export function resetPasswodrForSupplier(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/resetPasswodrForSupplier',
    method: 'post',
    data
  })
}
// 保存发票
export function saveInvoice(data) {
  return request({
    url: '/bidprocurement/common-user/user/invoice/saveInvoice',
    method: 'post',
    data
  })
}
/* ===============================找回密码/修改密码==================================================*/

// 发送短信验证码 - 找回密码
export function sendAliyunRetrieveCipherCode(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/sendAliyunRetrieveCipherCode',
    method: 'post',
    data
  })
}
// 通过手机验证码找回密码
export function retrieveCipherCodeByPhoneCode(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/retrieveCipherCodeByPhoneCode',
    method: 'post',
    data
  })
}

/*
 * =======================扫码接口==============================
 * */
//  获取扫码状态
export function getSupplierQRCodeIsScaned(data) {
  return request({
    url: '/bidprocurement/common-user/appScanCode/getQRCodeIsScaned',
    method: 'post',
    async: false,
    data
  })
}
// 获取二维码登录信息（认证信息）
export function getSupplierQRCodeLoginInfo(data) {
  return request({
    url: '/bidprocurement/common-user/appScanCode/getQRCodeLoginInfo',
    method: 'post',
    async: false,
    data
  })
}
// 获取二维码登录信息（认证信息）
export function getSupplierQRCodeSignInfo(data) {
  return request({
    url: '/bidprocurement/common-user/appScanCode/getQRCodeSignInfo',
    method: 'post',
    async: false,
    data
  })
}

// 查询当前登录人角色所处单位是否为代理机构单位(用于是否可自建招标计划---华能)
export function selectIsCanSelfConstructionBiddingPlan(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/selectIsCanSelfConstructionBiddingPlan',
    method: 'post',
    async: false,
    data
  })
}
/* ===============================用户-个人信息==================================================*/
// 根据用户id查询用户
export function findUserByUserId(params) {
  return request({
    url: '/bidprocurement/common-user/user/user/findUserByUserId',
    method: 'post',
    params
  })
}
// 修改个人信息
export function updateCurrentUserByUserId(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/updateCurrentUserByUserId',
    method: 'post',
    data
  })
}
/* ===============================用户管理==================================================*/
// 用户管理-用户列表获取
export function fetchList(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/getUserList',
    method: 'post',
    data
  })
}
// 用户管理-用户添加
export function addUser(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/addUser',
    method: 'post',
    data
  })
}
// 用户管理-用户修改
export function updateUser(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/updateUser',
    method: 'post',
    data
  })
}
// 用户管理-用户修改
export function updateUserNew(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/updateUserNew',
    method: 'post',
    data
  })
}
// 用户删除
export function deleteUserByUserIdAdnRoleIdAndOrgId(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/deleteUserByUserIdAdnRoleIdAndOrgId',
    method: 'post',
    data
  })
}
// 用户管理-设置角色
export function setRole(data) {
  return request({
    url: '/bidprocurement/common-user/user/roleUser/setRole',
    method: 'post',
    data
  })
}
// 用户管理-冻结用户
export function frozenUser(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/frozenUser',
    method: 'post',
    data
  })
}
// 用户角色
export function useRoleList(data) {
  return request({
    url: '/bidprocurement/common-user/user/role/getRoleList',
    method: 'post',
    data
  })
}

// 用户管理-删除角色
export function delRole(data) {
  return request({
    url: '/bidprocurement/common-user/user/roleUser/delRole',
    method: 'post',
    data
  })
}
// 重置密码(管理员重置密码)
export function resetPasswordOfSystem(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/resetPasswordOfSystem',
    method: 'post',
    data
  })
}
/* ===============================？？？==================================================*/

// 重置密码(用户重置密码)
export function resetPasswordOfUser(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/resetPasswordOfUser',
    method: 'post',
    data
  })
}
// 根据用户id和机构id查询授权时已授权和未授权角色
export function findRoleList(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/findRoleList',
    method: 'post',
    data
  })
}
// 根据机构角色获取机构列表
export function getDepartListByDepartRoleName(data) {
  return request({
    url: '/bidprocurement/common-user/user/depart/getDepartListByDepartRoleName',
    method: 'post',
    data
  })
}

// 所属机构列表
export function getDepartList(data) {
  return request({
    url: '/bidprocurement/common-user/user/organization/getOrganizationList',
    method: 'post',
    data
  })
}

// 所属部门列表
export function getDepartmentList(data) {
  return request({
    url: '/bidprocurement/common-user/user/depart/getDepartmentList',
    method: 'post',
    data
  })
}

// 根据机构id查询该机构及以下的用户信息(角色编码不必传,传则查该角色用户)
export function selectDepartUserInfoListByDepartId(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/selectDepartUserInfoListByDepartId',
    method: 'post',
    data
  })
}

// 获取用户日志
export function getUserLogList(data) {
  return request({
    url: '/bidprocurement/common-user/user/userLog/getUserLogList',
    method: 'post',
    data
  })
}

export function getByUserIdInvoiceInfo(data) {
  return request({
    url: '/bidprocurement/common-user/user/invoice/getByUserIdInvoiceInfo?userId=' + data,
    method: 'get'
  })
}

export function savePurchaseInfo(data) {
  return request({
    url: '/bidprocurement/common-user/user/depart/savePurchaseInfo',
    method: 'post',
    data
  })
}
// 保存代理机构基本信息
export function saveAgencyInfo(data) {
  return request({
    url: '/bidprocurement/common-user/user/depart/saveAgencyInfo',
    method: 'post',
    data
  })
}

// 机构审核查询列表
export function getAuditList(data) {
  return request({
    url: '/bidprocurement/common-user/user/depart/getAuditList',
    method: 'post',
    data
  })
}
// 获取采购单位信息详情
export function getPurchaseInfo(data) {
  return request({
    url: '/bidprocurement/common-user/user/depart/getPurchaseInfo',
    method: 'post',
    data
  })
}
// 获取机构代理信息详情
export function getAgencyInfo(data) {
  return request({
    url: '/bidprocurement/common-user/user/depart/getAgencyInfo',
    method: 'post',
    data
  })
}
// 审核机构信息
export function auditAgencyInfo(data) {
  return request({
    url: '/bidprocurement/common-user/user/depart/auditAgencyInfo',
    method: 'post',
    data
  })
}
// 本单位账号管理-用户列表获取
export function singleStandardFetchList(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/getUserListCompany',
    method: 'post',
    data
  })
}
