import request from '@/utils/request'

// 查询商机基础信息列表
export function listBasic(query) {
  return request({
    url: '/mk/bo/basic/list',
    method: 'get',
    params: query
  })
}



// 查询商机基础信息详细
export function getBasic(id) {
  return request({
    url: '/mk/bo/basic/' + id,
    method: 'get'
  })
}



// 新增商机基础信息
export function addBasic(data) {
  return request({
    url: '/mk/bo/basic',
    method: 'post',
    data: data
  })
}



// 修改商机基础信息
export function updateBasic(data) {
  return request({
    url: '/mk/bo/basic',
    method: 'put',
    data: data
  })
}

// 修改商机流程信息
export function updateBasicFlow(data) {
  return request({
    url: '/mk/bo/flow',
    method: 'put',
    data: data
  })
}


// 删除商机基础信息
export function delBasic(id) {
  return request({
    url: '/mk/bo/basic/' + id,
    method: 'delete'
  })
}

//新增商机附件
export function insertAccessory(data) {
  return request({
    url: '/mk/bo/basic/upload',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 删除商机附件
export function delAccessory(boId,f,boType,fileId) {
  return request({
    url: '/mk/bo/basic/accessory?boId=' + boId + '&flag=' + f + '&id=1&boType=' + boType + '&fileId=' + fileId,
    method: 'delete'
  })
}

//流程下一步
export function changeNextStage(boId) {
  return request({
    url: '/mk/bo/basic/BoStage?boId=' + boId,
    method: 'put'
  })
}

//提交
export function submit(boId) {
  return request({
    url: '/mk/bo/basic/submit/' + boId,
    method: 'get'
  })
}

//赢单状态数据提交
export function updateWinningState(data) {
  return request({
    url: '/mk/bo/basic/WinningState',
    method: 'put',
    data: data
  })
}

//分配负责人
export function allocationParticipant(data) {
  return request({
    url: '/mk/bo/basic/allocationParticipant',
    method: 'put',
    data: data
  })
}
