import request from '@/utils/request'

export function getDocCateList(params) { return request({ url: '/slgc/doc-cate/list', method: 'get', params }) }
export function getDocCateTree() { return request({ url: '/slgc/doc-cate/tree', method: 'get' }) }
export function getDocCate(id) { return request({ url: '/slgc/doc-cate/' + id, method: 'get' }) }
export function addDocCate(data) { return request({ url: '/slgc/doc-cate', method: 'post', data }) }
export function updateDocCate(data) { return request({ url: '/slgc/doc-cate', method: 'put', data }) }
export function delDocCate(ids) { return request({ url: '/slgc/doc-cate/' + ids, method: 'delete' }) }

export function getDocFileList(params) { return request({ url: '/slgc/doc-file/list', method: 'get', params }) }
export function getDocFile(id) { return request({ url: '/slgc/doc-file/' + id, method: 'get' }) }
export function addDocFile(data) { return request({ url: '/slgc/doc-file', method: 'post', data }) }
export function updateDocFile(data) { return request({ url: '/slgc/doc-file', method: 'put', data }) }
export function delDocFile(ids) { return request({ url: '/slgc/doc-file/' + ids, method: 'delete' }) }
export function moveDocFile(data) {
  const params = new URLSearchParams()
  data.fileIds.split(',').forEach(id => params.append('fileIds', id))
  params.append('fileCate', data.fileCate)
  return request({ url: '/slgc/doc-file/move', method: 'post', params, paramsSerializer: params => params.toString() })
}
