#feature: add ip operation log & sql generator

This commit is contained in:
2025-12-25 14:25:57 +08:00
parent 79889e1040
commit 3bcbd0661f
21 changed files with 1751 additions and 21 deletions

View File

@@ -44,6 +44,30 @@
环境配置管理
</a>
<a
href="#"
@click.prevent="setActiveMenu('sql-generator')"
:class="[
'group flex items-center px-3 py-2 text-sm font-medium rounded-lg transition-colors duration-200',
activeMenu === 'sql-generator'
? 'bg-blue-50 text-blue-700 border-r-2 border-blue-700'
: 'text-gray-700 hover:bg-gray-50 hover:text-gray-900'
]"
>
<svg
:class="[
'mr-3 h-5 w-5 transition-colors duration-200',
activeMenu === 'sql-generator' ? 'text-blue-500' : 'text-gray-400 group-hover:text-gray-500'
]"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
生成SQL
</a>
<!-- JIRA 相关菜单项 -->
<a
@@ -214,6 +238,31 @@
</svg>
操作日志
</a>
<a
href="#"
@click.prevent="setActiveMenu('ip-mappings')"
v-if="isAdmin"
:class="[
'group flex items-center px-3 py-2 text-sm font-medium rounded-lg transition-colors duration-200',
activeMenu === 'ip-mappings'
? 'bg-blue-50 text-blue-700 border-r-2 border-blue-700'
: 'text-gray-700 hover:bg-gray-50 hover:text-gray-900'
]"
>
<svg
:class="[
'mr-3 h-5 w-5 transition-colors duration-200',
activeMenu === 'ip-mappings' ? 'text-blue-500' : 'text-gray-400 group-hover:text-gray-500'
]"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
</svg>
IP 用户映射
</a>
</div>
<!-- 底部信息 -->
@@ -244,6 +293,10 @@ export default {
pageTitle: {
type: String,
default: '环境配置管理'
},
isAdmin: {
type: Boolean,
default: false
}
},
data() {
@@ -251,6 +304,11 @@ export default {
activeMenu: 'env'
}
},
watch: {
isAdmin() {
this.setActiveMenuFromPath();
}
},
mounted() {
// 根据 URL 路径设置初始菜单
this.setActiveMenuFromPath();
@@ -263,6 +321,10 @@ export default {
},
methods: {
setActiveMenu(menu) {
if (menu === 'ip-mappings' && !this.isAdmin) {
return;
}
this.activeMenu = menu;
// 更新 URL 路径
const path = menu === 'env' ? '/' : `/${menu}`;
@@ -276,6 +338,8 @@ export default {
if (path === '/') {
menu = 'env';
} else if (path === '/sql-generator') {
menu = 'sql-generator';
} else if (path === '/weekly-report') {
menu = 'weekly-report';
} else if (path === '/worklog') {
@@ -290,6 +354,12 @@ export default {
menu = 'settings';
} else if (path === '/logs') {
menu = 'logs';
} else if (path === '/ip-mappings') {
menu = 'ip-mappings';
}
if (menu === 'ip-mappings' && !this.isAdmin) {
menu = 'env';
}
this.activeMenu = menu;
@@ -314,9 +384,5 @@ export default {
transform: translateX(-100%);
transition: transform 0.3s ease-in-out;
}
.admin-layout .fixed.w-64.open {
transform: translateX(0);
}
}
</style>