import request from '@/utils/request'

// 创建资料库
export function createMaterialInfo(data) {
  return request({
    url: '/server/material-info/create',
    method: 'post',
    data: data
  })
}

// 更新资料库
export function updateMaterialInfo(data) {
  return request({
    url: '/server/material-info/update',
    method: 'post',
    data: data
  })
}

// 删除资料库
export function deleteMaterialInfo(id) {
  return request({
    url: '/server/material-info/delete?id=' + id,
    method: 'post'
  })
}

// 获得资料库
export function getMaterialInfo(id) {
  return request({
    url: '/server/material-info/get?id=' + id,
    method: 'get'
  })
}

// 获得资料库
export function getMaterialInfo2(id) {
  return request({
    url: '/server/material-info/get2?id=' + id,
    method: 'get'
  })
}

// 获得资料库分页
export function getMaterialInfoPage(params) {
  return request({
    url: '/server/material-info/page',
    method: 'get',
    params
  })
}
// 导出资料库 Excel
export function exportMaterialInfoExcel(params) {
  return request({
    url: '/server/material-info/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

export function getMaterialCategoryTree() {
  return request({
    url: '/server/material-info/tree',
    method: 'get'
  })
}

export function getUserList() {
  return request({
    url: '/server/material-info/userlist',
    method: 'get'
  })
}

export function deleteShareUsers(materialId) {
  return request({
    url: '/server/material-share-user/delete?id=' + materialId,
    method: 'get'
  })
}

export function saveShareUsers(data) {
  return request({
    url: '/server/material-share-user/create',
    method: 'post',
    data: data
  })
}

export function getShareUsers(materialId) {
  return request({
    url: '/server/material-share-user/get?id=' + materialId,
    method: 'get'
  })
}

