// 测试用户专属权限是否生效
console.log('=== 测试用户专属权限 ===');

// 检查权限数据
const checkPermissions = () => {
    console.log('=== 检查当前权限数据 ===');
    
    // 检查用户store中的权限
    const userStore = useUserStore();
    console.log('用户store权限:', userStore.permissions);
    console.log('用户角色:', userStore.roles);
    
    // 检查权限store中的权限
    const permissionStore = usePermissionStore();
    console.log('权限store权限:', permissionStore.userPermission);
    
    // 检查是否是超级管理员
    const isSuperAdmin = userStore.permissions.includes('*:*:*') || userStore.roles.includes('admin');
    console.log('是否超级管理员:', isSuperAdmin);
    
    // 检查最终使用的权限
    const finalPermissions = permissionStore.userPermission && permissionStore.userPermission.length > 0 
        ? permissionStore.userPermission 
        : userStore.permissions;
    console.log('最终使用权限:', finalPermissions);
    
    return {
        userStorePermissions: userStore.permissions,
        permissionStorePermissions: permissionStore.userPermission,
        finalPermissions: finalPermissions,
        isSuperAdmin: isSuperAdmin
    };
};

// 导出检查函数
window.checkPermissions = checkPermissions;

console.log('权限检查函数已加载，请在控制台运行 checkPermissions() 来检查权限数据');
