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;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-only {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab-button:hover {
|
.tab-button:hover {
|
||||||
color: #2c5282;
|
color: #2c5282;
|
||||||
background: #f7fafc;
|
background: #f7fafc;
|
||||||
|
|
@ -2235,11 +2231,8 @@
|
||||||
<!-- 标签页导航 -->
|
<!-- 标签页导航 -->
|
||||||
<div class="tabs-container">
|
<div class="tabs-container">
|
||||||
<ul class="tabs-nav" id="tabsNav">
|
<ul class="tabs-nav" id="tabsNav">
|
||||||
<li class="admin-only"><button class="tab-button active" data-tab="users-tab" onclick="switchTab('users-tab')">
|
<li><button class="tab-button active" data-tab="permits-tab" onclick="switchTab('permits-tab')">
|
||||||
<span>👥</span> 用户与系统管理
|
<span>📋</span> 许可事项管理
|
||||||
</button></li>
|
|
||||||
<li><button class="tab-button" data-tab="permits-tab" onclick="switchTab('permits-tab')">
|
|
||||||
<span>📋</span> 许可管理
|
|
||||||
</button></li>
|
</button></li>
|
||||||
<li><button class="tab-button" data-tab="checkpoints-tab" onclick="switchTab('checkpoints-tab')">
|
<li><button class="tab-button" data-tab="checkpoints-tab" onclick="switchTab('checkpoints-tab')">
|
||||||
<span>🔒</span> 检查点管理
|
<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">
|
<div id="permits-tab" class="tab-content active">
|
||||||
<h2 style="color: #333; margin-bottom: 20px; display: flex; align-items: center; gap: 10px;">
|
<h2 style="color: #333; margin-bottom: 20px; display: flex; align-items: center; gap: 10px;">
|
||||||
<span>📋</span> 许可事项管理
|
<span>📋</span> 许可事项管理
|
||||||
|
|
@ -5778,65 +5758,25 @@ document.getElementById('checkpointModal').addEventListener('click', function(e)
|
||||||
container.innerHTML = html;
|
container.innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据用户角色显示标签页
|
// 初始化标签页
|
||||||
function setupTabsByRole(userRole) {
|
function setupTabsByRole(userRole) {
|
||||||
const isSuperAdmin = userRole && userRole.toLowerCase() === 'admin';
|
|
||||||
const pageTitle = document.getElementById('pageTitle');
|
const pageTitle = document.getElementById('pageTitle');
|
||||||
|
|
||||||
// 更新页面标题
|
// 更新页面标题
|
||||||
if (isSuperAdmin) {
|
pageTitle.textContent = '🗃️ 管理员控制台';
|
||||||
pageTitle.textContent = '🗃️ 超级管理员控制台';
|
|
||||||
} else {
|
// 默认激活许可事项管理标签页
|
||||||
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');
|
goToStep(1);
|
||||||
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');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 触发文件上传
|
// 触发文件上传
|
||||||
|
|
@ -6116,22 +6056,14 @@ document.getElementById('checkpointModal').addEventListener('click', function(e)
|
||||||
// 页面加载时初始化
|
// 页面加载时初始化
|
||||||
window.addEventListener('DOMContentLoaded', async () => {
|
window.addEventListener('DOMContentLoaded', async () => {
|
||||||
const user = await fetchCurrentUser(true);
|
const user = await fetchCurrentUser(true);
|
||||||
// 根据用户角色设置标签页
|
// 初始化标签页
|
||||||
if (user) {
|
setupTabsByRole(user ? user.role : 'user');
|
||||||
setupTabsByRole(user.role);
|
|
||||||
}
|
|
||||||
// 检查URL参数中的tab
|
// 检查URL参数中的tab
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const tabParam = urlParams.get('tab');
|
const tabParam = urlParams.get('tab');
|
||||||
if (tabParam && document.getElementById(`${tabParam}-tab`)) {
|
if (tabParam && document.getElementById(`${tabParam}-tab`)) {
|
||||||
// 检查该标签页是否可见
|
switchTab(`${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`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化拖拽事件
|
// 初始化拖拽事件
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue