feat: remove user management feature and set permits as default tab
- Remove "用户与系统管理" tab and its content from db_admin page - Delete admin-only CSS styles and role-based logic - Set "许可事项管理" as the default active tab - Simplify setupTabsByRole function to remove role checks - Update DOMContentLoaded handler to use simplified logic Now users accessing /db_admin will directly see the permits management interface by default.
This commit is contained in:
parent
7844965afa
commit
f115a31cdd
|
|
@ -81,10 +81,6 @@
|
|||
gap: 8px;
|
||||
}
|
||||
|
||||
.admin-only {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab-button:hover {
|
||||
color: #2c5282;
|
||||
background: #f7fafc;
|
||||
|
|
@ -2235,11 +2231,8 @@
|
|||
<!-- 标签页导航 -->
|
||||
<div class="tabs-container">
|
||||
<ul class="tabs-nav" id="tabsNav">
|
||||
<li class="admin-only"><button class="tab-button active" data-tab="users-tab" onclick="switchTab('users-tab')">
|
||||
<span>👥</span> 用户与系统管理
|
||||
</button></li>
|
||||
<li><button class="tab-button" data-tab="permits-tab" onclick="switchTab('permits-tab')">
|
||||
<span>📋</span> 许可管理
|
||||
<li><button class="tab-button active" data-tab="permits-tab" onclick="switchTab('permits-tab')">
|
||||
<span>📋</span> 许可事项管理
|
||||
</button></li>
|
||||
<li><button class="tab-button" data-tab="checkpoints-tab" onclick="switchTab('checkpoints-tab')">
|
||||
<span>🔒</span> 检查点管理
|
||||
|
|
@ -2255,20 +2248,7 @@
|
|||
|
||||
<!-- 标签页内容区域 -->
|
||||
|
||||
<!-- 用户与系统管理标签页 -->
|
||||
<div id="users-tab" class="tab-content admin-only active">
|
||||
<h2 style="color: #333; margin-bottom: 20px; display: flex; align-items: center; gap: 10px;">
|
||||
<span>👥</span> 用户与系统管理
|
||||
</h2>
|
||||
<p style="color: #666; margin-bottom: 20px;">管理系统用户、服务部门、主题列表和模板。支持用户添加/密码修改、服务部门管理、主题增删改、模板更新等操作。</p>
|
||||
<div style="background: white; border-radius: 8px; padding: 20px; border: 1px solid #e0e0e0;">
|
||||
<iframe src="/fs-ai-asistant/api/workflow/lawrisk/admin/super"
|
||||
style="width: 100%; min-height: 800px; border: none;"
|
||||
id="usersFrame"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 许可管理标签页 -->
|
||||
<!-- 许可事项管理标签页 -->
|
||||
<div id="permits-tab" class="tab-content active">
|
||||
<h2 style="color: #333; margin-bottom: 20px; display: flex; align-items: center; gap: 10px;">
|
||||
<span>📋</span> 许可事项管理
|
||||
|
|
@ -5778,65 +5758,25 @@ document.getElementById('checkpointModal').addEventListener('click', function(e)
|
|||
container.innerHTML = html;
|
||||
}
|
||||
|
||||
// 根据用户角色显示标签页
|
||||
// 初始化标签页
|
||||
function setupTabsByRole(userRole) {
|
||||
const isSuperAdmin = userRole && userRole.toLowerCase() === 'admin';
|
||||
const pageTitle = document.getElementById('pageTitle');
|
||||
|
||||
// 更新页面标题
|
||||
if (isSuperAdmin) {
|
||||
pageTitle.textContent = '🗃️ 超级管理员控制台';
|
||||
} else {
|
||||
pageTitle.textContent = '🗃️ 管理员控制台';
|
||||
pageTitle.textContent = '🗃️ 管理员控制台';
|
||||
|
||||
// 默认激活许可事项管理标签页
|
||||
const permitsTab = document.getElementById('permits-tab');
|
||||
const permitsButton = document.querySelector('[data-tab="permits-tab"]');
|
||||
if (permitsTab) {
|
||||
permitsTab.classList.add('active');
|
||||
}
|
||||
if (permitsButton) {
|
||||
permitsButton.classList.add('active');
|
||||
}
|
||||
|
||||
// 显示或隐藏超级管理员专用功能
|
||||
const adminOnlyElements = document.querySelectorAll('.admin-only');
|
||||
adminOnlyElements.forEach(element => {
|
||||
if (isSuperAdmin) {
|
||||
element.style.display = '';
|
||||
} else {
|
||||
element.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
// 如果不是超级管理员,默认激活许可管理标签页
|
||||
if (!isSuperAdmin) {
|
||||
// 隐藏所有标签页
|
||||
const allTabContents = document.querySelectorAll('.tab-content');
|
||||
allTabContents.forEach(content => {
|
||||
content.classList.remove('active');
|
||||
});
|
||||
|
||||
// 移除所有标签按钮的激活状态
|
||||
const allTabButtons = document.querySelectorAll('.tab-button');
|
||||
allTabButtons.forEach(button => {
|
||||
button.classList.remove('active');
|
||||
});
|
||||
|
||||
// 激活许可管理标签页
|
||||
const permitsTab = document.getElementById('permits-tab');
|
||||
const permitsButton = document.querySelector('[data-tab="permits-tab"]');
|
||||
if (permitsTab) {
|
||||
permitsTab.classList.add('active');
|
||||
}
|
||||
if (permitsButton) {
|
||||
permitsButton.classList.add('active');
|
||||
}
|
||||
|
||||
// 加载许可数据
|
||||
goToStep(1);
|
||||
} else {
|
||||
// 超级管理员默认激活用户管理标签页
|
||||
const usersTab = document.getElementById('users-tab');
|
||||
const usersButton = document.querySelector('[data-tab="users-tab"]');
|
||||
if (usersTab) {
|
||||
usersTab.classList.add('active');
|
||||
}
|
||||
if (usersButton) {
|
||||
usersButton.classList.add('active');
|
||||
}
|
||||
}
|
||||
// 加载许可数据
|
||||
goToStep(1);
|
||||
}
|
||||
|
||||
// 触发文件上传
|
||||
|
|
@ -6116,22 +6056,14 @@ document.getElementById('checkpointModal').addEventListener('click', function(e)
|
|||
// 页面加载时初始化
|
||||
window.addEventListener('DOMContentLoaded', async () => {
|
||||
const user = await fetchCurrentUser(true);
|
||||
// 根据用户角色设置标签页
|
||||
if (user) {
|
||||
setupTabsByRole(user.role);
|
||||
}
|
||||
// 初始化标签页
|
||||
setupTabsByRole(user ? user.role : 'user');
|
||||
|
||||
// 检查URL参数中的tab
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const tabParam = urlParams.get('tab');
|
||||
if (tabParam && document.getElementById(`${tabParam}-tab`)) {
|
||||
// 检查该标签页是否可见
|
||||
const tabElement = document.getElementById(`${tabParam}-tab`);
|
||||
if (tabElement && (tabElement.style.display !== 'none' && !tabElement.classList.contains('admin-only'))) {
|
||||
switchTab(`${tabParam}-tab`);
|
||||
} else if (tabElement && tabElement.classList.contains('admin-only') && user && user.role.toLowerCase() === 'admin') {
|
||||
// 如果是超级管理员且标签是admin-only,允许切换
|
||||
switchTab(`${tabParam}-tab`);
|
||||
}
|
||||
switchTab(`${tabParam}-tab`);
|
||||
}
|
||||
|
||||
// 初始化拖拽事件
|
||||
|
|
|
|||
Loading…
Reference in New Issue