


import { request, METHOD, } from '@/utils/request'

//新增菜单
export async function setMenuItem(data) {
    return request("/kztMenu/save", METHOD.POST, data)
}
//获取菜单树
export async function getMenuList(data) {
    return request("/kztMenu/queryKZTMenuList", METHOD.POST, data)
}
//删除菜单
export async function delMenuItem(data) {
    return request("/kztMenu/delete", METHOD.POST, data)
}
//获取角色列表
export async function getRoleList(data) {
    return request("/kztRole/findPage", METHOD.POST, data)
}

//角色关联菜单
export async function roleRelationMenu(data) {
    return request("/kztRole/saveRoleMenus", METHOD.POST, data)
}
//新增角色
export async function setRoleItem(data) {
    return request("/kztRole/save", METHOD.POST, data)
}
//根据角色筛选菜单
export async function roleFindMenus(data) {
    return request("/kztRole/findMenuIds", METHOD.GET, data)
}
//删除角色
export async function deleteRoleItem(data) {
    return request("/kztRole/delete", METHOD.POST, data)
}
//查询授权部门用户、
export async function getDeptList(data) {
    return request("/kztRole/queryPageByParam", METHOD.POST, data)
}
//获取所有角色信息
export async function getRoleAll(data) {
    return request("/kztRole/findAll", METHOD.GET, data)
}
//用户配置角色
export async function roleSetUser(data) {
    return request("/kztRole/saveUserRoleKzt", METHOD.POST, data)
}
//获取数据权限字典
export async function getAuthModule(data) {
    return request("/dict/findByLable?lable=" + data, METHOD.GET)
}




//根据用户id查询菜单树
export async function findMenuListByUserId(data) {
    return request("/kztMenu/findMenuListByUserId?userId=" + data.userId, METHOD.GET,)
}

//数据权限模块
//获取用户列表信息
export async function getUserList(data) {
    return request("/user/findBackUserList", METHOD.POST, data)
}
//用户添加机构树权限
export async function UserSetDeptAuth(data) {
    return request("/kztUserDept/update", METHOD.PUT, data)
}
//获取单个用户信息
export async function getUserItem(data) {
    return request("/kztUserDept/getByUserId", METHOD.GET, data)
}


//接口访问权限配置
//接口访问权限列表
export async function getAuthList(data) {
    return request("/kztDataPermission/queryPage", METHOD.POST, data)
}

//菜单添加权限
export async function setMenuAuth(data) {
    return request("/kztDataPermission/saveOrUpdate", METHOD.POST, data)
}
//菜单权限查询
export async function getMenuAuthItem(data) {
    return request("/kztDataPermission/findById?id=" + data.id, METHOD.GET,)
}

//菜单权限清空
export async function removeMenuAuth(data) {
    return request("/kztDataPermission/delete?id=" + data.id, METHOD.GET,)
}
//获取数据权限代理人及渠道列表
export async function getAgentOrChannel(data) {
    return request("/kztUserDept/findChannelAgent", METHOD.POST, data)
}


//批量给角色添加功能权限
export async function saveBatchRoleMenus(data) {
    return request("/kztRole/saveBatchRoleMenus", METHOD.POST, data)
}
//批量给用户添加角色权限
export async function saveBatchRoleUsers(data) {
    return request("/kztRole/saveBatchUserRoleKzt", METHOD.POST, data)
}










export default {
    setMenuItem,
    getMenuList,
    delMenuItem,
    getRoleList,
    setRoleItem,
    roleRelationMenu,
    roleFindMenus,
    deleteRoleItem,
    getDeptList,
    getRoleAll,
    roleSetUser,
    getAuthModule,
    setMenuAuth,
    getMenuAuthItem,
    getAuthList,
    removeMenuAuth,
    findMenuListByUserId,
    getUserList,
    UserSetDeptAuth,
    getUserItem,
    getAgentOrChannel,
    saveBatchRoleMenus,
    saveBatchRoleUsers


}
