import request from '@/utils/request'

// 查询部门列表
export function listDept (query) {
  return request({
    url: '/system/dept/list',
    method: 'get',
    params: query
  })
}

// 查询部门列表（排除节点）
export function listDeptExcludeChild (deptId) {
  return request({
    url: '/api/system/dept/list/exclude/' + deptId,
    method: 'get'
  })
}

// 查询部门详细
export function getDept (deptId) {
  return request({
    url: '/api/system/dept/get/' + deptId,
    method: 'get'
  })
}

// 查询部门下拉树结构
export function treeselect () {
  return request({
    url: 'api/system/dept/treeselect',
    method: 'get'
  })
}

// 查询部门下拉树结构
export function treeselectByDeptId (query) {
  return request({
    url: 'api/system/dept/treeselectByDeptId',
    method: 'get',
    params: query
  })
}

// 查询部门
export function listData (query) {
  return request({
    url: '/system/userDept/listData',
    method: 'get',
    params: query
  })
}

// 查询组织机构下拉树结构
export function treeselectByUser () {
  return request({
    url: '/system/dept/treeselectByUser',
    method: 'get'
  })
}
// 查询级联账套下拉
export function listByDeptId (query) {
  return request({
    url: '/finance/book/listByDeptId',
    method: 'get',
    params: query
  })
}

//视图预览 查询级联账套下拉
export function listByDeptIdAndBusinessKey (query) {
  return request({
    url: '/finance/book/listByDeptIdAndBusinessKey',
    method: 'get',
    params: query
  })
}



//提交部门权限
export function userDept (data) {
  return request({
    url: '/system/userDept/add',
    method: 'post',
    data: data
  })
}

// 根据角色ID查询部门树结构
export function roleDeptTreeselect (roleId) {
  return request({
    url: '/system/dept/roleDeptTreeselect/' + roleId,
    method: 'get'
  })
}

// 新增部门
export function addDept (data) {
  return request({
    url: '/system/dept/add',
    method: 'post',
    data: data
  })
}

// 修改部门
export function updateDept (data) {
  return request({
    url: '/system/dept/edit',
    method: 'post',
    data: data
  })
}


// 删除部门
export function delDept (deptId) {
  return request({
    url: '/system/dept/remove/' + deptId,
    method: 'get'
  })
}

// 切换账套
export function changeBook (query) {
  return request({
    url: '/system/user/changeBook',
    method: 'get',
    params: query
  })
}
// 切换部门
export function changeDept (query) {
  return request({
    url: '/system/user/changeDept',
    method: 'get',
    params: query
  })
}


//右上代办事项闹铃-通用级
export function noticeCount (businessOwnership) {
  return request({
    url: '/home/notice/count/' + businessOwnership,
    method: 'get'
  })
}

//右上 帮助中心
export function systemModel (query) {
  return request({
    url: '/home/system/model/' + query,
    method: 'get',
    // params: query
  })
}

//查询账套权限列表
export function systemBookList (query) {
  return request({
    url: '/system/book/list',
    method: 'get',
    params: query
  })
}

//提交账套权限
export function bookDept (data) {
  return request({
    url: '/system/book/add',
    method: 'post',
    data: data
  })
}

// 根据deptId查询所在区县
export function getCountyInfoByDeptId (deptId) {
  return request({
    url: '/system/dept/getCountyInfoByDeptId/' + deptId,
    method: 'get'
  })
}

// 根据deptId查询所在乡镇
export function getTownInfoByDeptId (deptId) {
  return request({
    url: '/system/dept/getTownInfoByDeptId/' + deptId,
    method: 'get'
  })
}

// 更新所有部门的坐标信息
export function coordinatesUpdate () {
  return request({
    url: '/system/dept/coordinatesUpdate',
    method: 'get'
  })
}

// 获取当前部门的信息
export function getCurrentDept () {
  return request({
    url: '/api/system/dept/get/current',
    method: 'get',
  })
}
