import request from '@/utils/request'

// 查询项目管理列表
export function listProject(query) {
  return request({
    url: '/business/project/list',
    method: 'get',
    params: query
  })
}
export function listProjectNew(query) {
  return request({
    url: '/business/project/list-new',
    method: 'get',
    params: query
  })
}

// 查询项目管理列表
export function listProjectBoard(query) {
  return request({
    url: '/business/project/list-board',
    method: 'get',
    params: query
  })
}
export function listHistory(query) {
  return request({
    url: '/business/project/history/list',
    method: 'get',
    params: query
  })
}

export function getHistory(projectId, version) {
  return request({
    url: `/business/project/history/${projectId}/${version}`,
    method: 'get'
  })
}

// 查询项目管理列表 不分页
export function listAllProject(query) {
  return request({
    url: '/business/project/listAll',
    method: 'get',
    params: query
  })
}

// 查询关联项目
export function getRelatedProject() {
  return request({
    url: '/business/project/projectlist',
    method: 'get'
  })
}

// 查询关联项目
export function getRelatedProjectByProjectId(query) {
  return request({
    url: '/business/project/projectData',
    method: 'get',
    params: query
  })
}

// 查询关联项目
export function getRelatedProjectByQuery(query) {
  return request({
    url: '/business/project/projectDataQuery',
    method: 'get',
    params: query
  })
}

// 查询关联项目
export function getRelatedProjectByQueryPage(query) {
  return request({
    url: '/business/project/projectDataQueryPage',
    method: 'get',
    params: query
  })
}

// 查询项目管理详细
export function getProject(projectId) {
  return request({
    url: '/business/project/' + projectId,
    method: 'get'
  })
}
//查询当前代理商下的项目名称
export function getProjectName(agentId) {
  return request({
    url: '/business/project/getProjectName/' + agentId,
    method: 'get'
  })
}


// 新增项目管理
export function addProject(data) {
  return request({
    url: '/business/project',
    method: 'post',
    data: data
  })
}

// 修改项目管理
export function updateProject(data) {
  return request({
    url: '/business/project',
    method: 'put',
    data: data
  })
}

// 删除项目管理
export function delProject(projectId) {
  return request({
    url: '/business/project/' + projectId,
    method: 'delete'
  })
}

// 查询客户关联项目
export function selectProjectListByAccount(query) {
  return request({
    url: '/business/project/listByAccount',
    method: 'get',
    params: query
  })
}

// 设为标杆项目
export function setModel(data) {
  return request({
    url: '/business/project/setModel',
    method: 'put',
    data: data
  })
}

// 延期/丢单
export function delayLost(data) {
  return request({
    url: '/business/project/delayLost',
    method: 'put',
    data: data
  })
}

// 审批
export function approve(data) {
  return request({
    url: '/business/project/approve',
    method: 'put',
    data: data
  })
}

export function changeOwner(data) {
  return request({
    url: '/business/project/changeOwner',
    method: 'put',
    data: data
  })
}


// 查询当前用户可见国家下拉
export function getCountryList() {
  return request({
    url: '/business/project/countries',
    method: 'get'
  })
}
// 查询当前用户可见区域下拉
export function getAreaList() {
  return request({
    url: '/business/project/areas',
    method: 'get'
  })
}

// 查询【请填写功能名称】列表
export function listEquipment(query) {
  return request({
    url: '/business/equipment/list',
    method: 'get',
    params: query
  })
}
export function listEquipmentProject(query) {
  return request({
    url: '/business/equipment/list-project',
    method: 'get',
    params: query
  })
}

export function saveOrUpdateEquipment(data) {
  return request({
    url: '/business/equipment/saveOrUpdate',
    method: 'put',
    data: data
  })
}

