import request from '@/utils/request'
/*
 *权限管理--菜单、角色管理
 */

export function menuList(params) { //菜单查询
    return request({
        url: '/sys/menu/list',
        method: 'post',
        params: params
    })
}
export function menuAdd(params) { //菜单新增
    return request({
        url: '/sys/menu/add',
        method: 'post',
        params: params
    })
}
export function menuEdit(params) { //菜单管理-修改
    return request({
        url: '/sys/menu/edit',
        method: 'post',
        params: params
    })
}
export function menuRemove(params) { //菜单管理-删除
    return request({
        url: '/sys/menu/remove',
        method: 'post',
        params: params
    })
}

// 角色状态修改
export function changeRoleStatus(roleId, status) {
    const data = {
        roleId,
        status
    }
    return request({
        url: '/system/role/changeStatus',
        method: 'put',
        data: data
    })
}
















export function roleList(params) { //角色查询-分页
    return request({
        url: '/sys/role/list',
        method: 'post',
        params: params
    })
}
export function roleListAll(data) { //角色查询-全部
    return request({
        url: '/sys/role/listAll',
        method: 'post',
        data
    })
}


export function roleMenuTree(data) { //角色菜单修改时获取菜单结构树
    return request({
        url: '/sys/menu/roleMenuTreeselect/' + data,
        method: 'get',
    })
}

export function treeselect() { //角色权限新增时获取菜单结构树
    return request({
        url: '/sys/menu/treeselect',
        method: 'get',
    })
}

export function roleEdit(query) { //角色绑定的菜单信息 =》修改
    return request({
        url: '/sys/role/edit',
        method: 'put',
        data: query
    })
}

export function roleAdd(query) { //角色新增
    return request({
        url: '/sys/role/add',
        method: 'post',
        data: query
    })
}

export function roleRemove(params) { //角色 =》删除
    return request({
        url: '/sys/role/remove',
        method: 'post',
        params
    })
}










// 获取用户详细信息
export function getInfo0() {
    return request({
        url: '/getInfo',
        method: 'get'
    })
}

export function getInfo(data) {
    return request({
        url: '/menu/queryMenu',
        method: 'post',
        data
    })
}
export function logout() {
    return request({
        url: '/login/MloginOut',
        method: 'post',
    })
}

// 获取验证码
export function getCodeImg() { //captchaImage/ 后面的参数跟captchaType = math(生成需要计算的验证码）char(生成文字二维码)
    return request({
        url: '/captchaImage?captchaType=math',
        method: 'get',
        // params: query
    })
}