import request from '@/utils/request'

// 查询文档列表
export function listDoc(query) {
  return request({
    url: '/project/doc/list',
    method: 'get',
    params: query
  })
}

// 查询文档详细
export function getDoc(docId) {
  return request({
    url: '/project/doc/' + docId,
    method: 'get'
  })
}

// 新增文档
export function addDoc(data) {
  return request({
    url: '/project/doc',
    method: 'post',
    data: data
  })
}

// 修改文档
export function updateDoc(data) {
  return request({
    url: '/project/doc',
    method: 'put',
    data: data
  })
}

// 删除文档
export function delDoc(docId) {
  return request({
    url: '/project/doc/' + docId,
    method: 'delete'
  })
}

// 上传文档
export function uploadDoc(data) {
  return request({
    url: '/project/doc/upload',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 下载文档
export function downloadDoc(docId) {
  return request({
    url: '/project/doc/download/' + docId,
    method: 'get',
    responseType: 'blob'
  })
}