import { User, fileDownload, files, todoApi } from '@/api'
import request from '@/utils/require'

export function getKdListTreeNew() {
  return request({
    url: `${User}/org/getTreeDataOrganKudianGouXiao`,
    method: 'get',
  })
}

/* 获取列表数据 */
export function getListData(data, page) {
  return request({
    url: `${todoApi}/notice/pageLists/${page.page}/${page.size}`,
    method: 'post',
    data: data
  })
}
//查询详情 
export function detailInfo(id) {
  return request({
    url: `${todoApi}/notice/showNotice?id=${id}`,
    method: 'post',
  })
}
//新增
export function saveData(data) {
  return request({
    url: `${todoApi}/notice/addNotice`,
    method: 'post',
    data: data
  })
}
//接收
export function updateData(data) {
  return request({
    url: `${todoApi}/notice/receiceNotice?noticeId=${data.noticeId}&ckr=${data.ckr}&jsdwbm=${data.jsdwbm}`,
    method: 'post',
  })
}

//删除
export function deleteData(id) {
  return request({
    url: `${todoApi}/notice/deleteNotice?id=${id}`,
    method: 'post',
  })
}

export function showNoticeNum(dwbm) {
  return request({
    url: `${todoApi}/notice/showNoticeNum?dwbm=${dwbm}`,
    method: 'get',
  })
}

export function viewFile(fileId) {
  return request({
    url: `${fileDownload}?id=${fileId}`,
    method: 'GET',
    responseType: 'arraybuffer'
  })
}

export function viewFileData(fileId) {
  return request({
    url: `${files}/file/findById?id=${fileId}`,
    method: 'post',
  })
}

export function viewAllFileData(fileId) {
  return request({
    url: `${files}/file/findByAll/${fileId}`,
    method: 'get',
  })
}
