2025-12-19 14:41:23 +08:00
|
|
|
<template>
|
|
|
|
|
<a-modal
|
|
|
|
|
v-model:open="visible"
|
2026-03-24 02:32:35 +08:00
|
|
|
:title="null"
|
2025-12-19 14:41:23 +08:00
|
|
|
width="90%"
|
2026-01-14 21:40:48 +08:00
|
|
|
:style="{ maxWidth: '980px', minWidth: '320px', top: '10%' }"
|
2025-12-19 14:41:23 +08:00
|
|
|
:footer="null"
|
2026-03-24 02:32:35 +08:00
|
|
|
:closable="false"
|
2025-12-19 14:41:23 +08:00
|
|
|
@cancel="handleClose"
|
|
|
|
|
class="settings-modal"
|
|
|
|
|
:destroyOnClose="true"
|
|
|
|
|
:bodyStyle="{ padding: 0 }"
|
|
|
|
|
>
|
|
|
|
|
<div class="settings-container">
|
2026-03-24 02:32:35 +08:00
|
|
|
<button class="settings-close-btn lucide-icon-btn" @click="handleClose" aria-label="关闭设置">
|
|
|
|
|
<X :size="16" />
|
|
|
|
|
</button>
|
|
|
|
|
|
2025-12-19 14:41:23 +08:00
|
|
|
<!-- 侧边栏 (Desktop) -->
|
2026-01-14 21:40:48 +08:00
|
|
|
<div class="settings-sider">
|
2025-12-19 14:41:23 +08:00
|
|
|
<div
|
|
|
|
|
class="sider-item"
|
|
|
|
|
:class="{ activesec: activeTab === 'base' }"
|
|
|
|
|
@click="activeTab = 'base'"
|
2026-03-24 02:32:35 +08:00
|
|
|
v-if="userStore.isAdmin"
|
2025-12-19 14:41:23 +08:00
|
|
|
>
|
2026-03-24 02:32:35 +08:00
|
|
|
<Settings class="icon" :size="18" />
|
2025-12-19 14:41:23 +08:00
|
|
|
<span>基本设置</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="sider-item"
|
|
|
|
|
:class="{ activesec: activeTab === 'model' }"
|
|
|
|
|
@click="activeTab = 'model'"
|
|
|
|
|
v-if="userStore.isSuperAdmin"
|
|
|
|
|
>
|
2026-03-24 02:32:35 +08:00
|
|
|
<SquareCode class="icon" :size="18" />
|
2025-12-19 14:41:23 +08:00
|
|
|
<span>模型配置</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="sider-item"
|
|
|
|
|
:class="{ activesec: activeTab === 'user' }"
|
|
|
|
|
@click="activeTab = 'user'"
|
|
|
|
|
v-if="userStore.isAdmin"
|
|
|
|
|
>
|
2026-03-24 02:32:35 +08:00
|
|
|
<User class="icon" :size="18" />
|
2025-12-19 14:41:23 +08:00
|
|
|
<span>用户管理</span>
|
|
|
|
|
</div>
|
2026-01-18 22:54:43 +08:00
|
|
|
<div
|
|
|
|
|
class="sider-item"
|
|
|
|
|
:class="{ activesec: activeTab === 'department' }"
|
|
|
|
|
@click="activeTab = 'department'"
|
|
|
|
|
v-if="userStore.isSuperAdmin"
|
|
|
|
|
>
|
2026-03-24 02:32:35 +08:00
|
|
|
<Users class="icon" :size="18" />
|
2026-01-18 22:54:43 +08:00
|
|
|
<span>部门管理</span>
|
|
|
|
|
</div>
|
2026-03-23 09:27:01 +08:00
|
|
|
<div
|
|
|
|
|
class="sider-item"
|
|
|
|
|
:class="{ activesec: activeTab === 'apikey' }"
|
|
|
|
|
@click="activeTab = 'apikey'"
|
|
|
|
|
v-if="userStore.isSuperAdmin"
|
|
|
|
|
>
|
2026-03-24 02:32:35 +08:00
|
|
|
<KeyIcon class="icon" :size="18" />
|
2026-03-23 09:27:01 +08:00
|
|
|
<span>API Key</span>
|
|
|
|
|
</div>
|
2025-12-19 14:41:23 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 顶部导航 (Mobile) -->
|
2026-01-14 21:40:48 +08:00
|
|
|
<div class="settings-mobile-nav">
|
2025-12-19 14:41:23 +08:00
|
|
|
<div
|
|
|
|
|
class="nav-item"
|
|
|
|
|
:class="{ active: activeTab === 'base' }"
|
|
|
|
|
@click="activeTab = 'base'"
|
2026-03-24 02:32:35 +08:00
|
|
|
v-if="userStore.isAdmin"
|
2025-12-19 14:41:23 +08:00
|
|
|
>
|
|
|
|
|
基本设置
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="nav-item"
|
|
|
|
|
:class="{ active: activeTab === 'model' }"
|
|
|
|
|
@click="activeTab = 'model'"
|
|
|
|
|
v-if="userStore.isSuperAdmin"
|
|
|
|
|
>
|
|
|
|
|
模型配置
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="nav-item"
|
|
|
|
|
:class="{ active: activeTab === 'user' }"
|
|
|
|
|
@click="activeTab = 'user'"
|
|
|
|
|
v-if="userStore.isAdmin"
|
|
|
|
|
>
|
|
|
|
|
用户管理
|
|
|
|
|
</div>
|
2026-01-18 22:54:43 +08:00
|
|
|
<div
|
|
|
|
|
class="nav-item"
|
|
|
|
|
:class="{ active: activeTab === 'department' }"
|
|
|
|
|
@click="activeTab = 'department'"
|
|
|
|
|
v-if="userStore.isSuperAdmin"
|
|
|
|
|
>
|
|
|
|
|
部门管理
|
|
|
|
|
</div>
|
2026-03-23 09:27:01 +08:00
|
|
|
<div
|
|
|
|
|
class="nav-item"
|
|
|
|
|
:class="{ active: activeTab === 'apikey' }"
|
|
|
|
|
@click="activeTab = 'apikey'"
|
|
|
|
|
v-if="userStore.isSuperAdmin"
|
|
|
|
|
>
|
|
|
|
|
API Key
|
|
|
|
|
</div>
|
2025-12-19 14:41:23 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 内容区域 -->
|
|
|
|
|
<div class="settings-content-wrapper">
|
|
|
|
|
<div class="settings-content">
|
2026-03-24 02:32:35 +08:00
|
|
|
<div v-show="activeTab === 'base'" v-if="userStore.isAdmin">
|
2025-12-19 14:41:23 +08:00
|
|
|
<BasicSettingsSection />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div v-show="activeTab === 'model'" v-if="userStore.isSuperAdmin">
|
|
|
|
|
<ModelProvidersComponent />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div v-show="activeTab === 'user'" v-if="userStore.isAdmin">
|
|
|
|
|
<UserManagementComponent />
|
|
|
|
|
</div>
|
2026-01-14 00:34:24 +08:00
|
|
|
|
2026-01-18 22:54:43 +08:00
|
|
|
<div v-show="activeTab === 'department'" v-if="userStore.isSuperAdmin">
|
|
|
|
|
<DepartmentManagementComponent />
|
|
|
|
|
</div>
|
2026-03-23 09:27:01 +08:00
|
|
|
|
|
|
|
|
<div v-show="activeTab === 'apikey'" v-if="userStore.isSuperAdmin">
|
|
|
|
|
<ApiKeyManagementComponent />
|
|
|
|
|
</div>
|
2025-12-19 14:41:23 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</a-modal>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-01-14 21:40:48 +08:00
|
|
|
import { ref, computed, watch } from 'vue'
|
2025-12-19 14:41:23 +08:00
|
|
|
import { useUserStore } from '@/stores/user'
|
2026-03-24 02:32:35 +08:00
|
|
|
import { Key as KeyIcon, Settings, SquareCode, User, Users, X } from 'lucide-vue-next'
|
2025-12-19 14:41:23 +08:00
|
|
|
import BasicSettingsSection from '@/components/BasicSettingsSection.vue'
|
|
|
|
|
import ModelProvidersComponent from '@/components/ModelProvidersComponent.vue'
|
|
|
|
|
import UserManagementComponent from '@/components/UserManagementComponent.vue'
|
2026-01-18 22:54:43 +08:00
|
|
|
import DepartmentManagementComponent from '@/components/DepartmentManagementComponent.vue'
|
2026-03-23 09:27:01 +08:00
|
|
|
import ApiKeyManagementComponent from '@/components/ApiKeyManagementComponent.vue'
|
2025-12-19 14:41:23 +08:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
visible: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['update:visible', 'close'])
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const activeTab = ref('base')
|
|
|
|
|
|
|
|
|
|
const visible = computed({
|
|
|
|
|
get: () => props.visible,
|
|
|
|
|
set: (value) => emit('update:visible', value)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const handleClose = () => {
|
|
|
|
|
emit('close')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 根据用户权限设置默认标签页
|
2026-01-15 06:01:34 +08:00
|
|
|
watch(
|
|
|
|
|
() => props.visible,
|
|
|
|
|
(newVal) => {
|
|
|
|
|
if (newVal) {
|
2026-03-24 02:32:35 +08:00
|
|
|
if (userStore.isAdmin) {
|
2026-01-15 06:01:34 +08:00
|
|
|
activeTab.value = 'base'
|
|
|
|
|
}
|
2025-12-19 14:41:23 +08:00
|
|
|
}
|
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
)
|
2025-12-19 14:41:23 +08:00
|
|
|
</script>
|
|
|
|
|
|
2026-01-02 15:46:55 +08:00
|
|
|
<style lang="less">
|
2026-03-24 02:32:35 +08:00
|
|
|
.settings-modal.ant-modal {
|
|
|
|
|
.ant-modal-content {
|
|
|
|
|
border-radius: 12px;
|
2025-12-19 14:41:23 +08:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
2026-03-24 02:32:35 +08:00
|
|
|
position: relative;
|
|
|
|
|
padding: 0;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ant-modal-body {
|
|
|
|
|
padding: 0;
|
2025-12-19 14:41:23 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.settings-container {
|
|
|
|
|
display: flex;
|
2026-03-24 02:32:35 +08:00
|
|
|
height: 70vh;
|
2025-12-19 14:41:23 +08:00
|
|
|
width: 100%;
|
2026-03-24 02:32:35 +08:00
|
|
|
position: relative;
|
2026-01-14 21:40:48 +08:00
|
|
|
|
2026-01-15 05:33:24 +08:00
|
|
|
@media (max-width: 900px) {
|
2026-01-14 21:40:48 +08:00
|
|
|
flex-direction: column;
|
2026-03-24 02:32:35 +08:00
|
|
|
height: auto;
|
|
|
|
|
min-height: 70vh;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.settings-close-btn {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 10px;
|
|
|
|
|
left: 14px;
|
|
|
|
|
width: 32px;
|
|
|
|
|
height: 32px;
|
|
|
|
|
border: none;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
background: var(--gray-50);
|
|
|
|
|
color: var(--gray-700);
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
z-index: 2;
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
background: var(--gray-200);
|
|
|
|
|
color: var(--gray-900);
|
2026-01-14 21:40:48 +08:00
|
|
|
}
|
2025-12-19 14:41:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Sidebar Styles - Matching SettingView.vue style */
|
|
|
|
|
.settings-sider {
|
2026-03-24 02:32:35 +08:00
|
|
|
width: 176px;
|
2025-12-19 14:41:23 +08:00
|
|
|
height: 100%;
|
2026-03-24 02:32:35 +08:00
|
|
|
padding: 52px 10px 12px;
|
2025-12-19 14:41:23 +08:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
flex-shrink: 0;
|
2026-03-24 02:32:35 +08:00
|
|
|
background: var(--gray-50);
|
|
|
|
|
border-right: 1px solid var(--gray-150);
|
2025-12-19 14:41:23 +08:00
|
|
|
|
2026-01-15 05:33:24 +08:00
|
|
|
@media (max-width: 900px) {
|
2026-01-14 21:40:48 +08:00
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-19 14:41:23 +08:00
|
|
|
.sider-item {
|
|
|
|
|
width: 100%;
|
2026-01-14 21:40:48 +08:00
|
|
|
padding: 6px 12px; /* Matches SettingView .sider > * */
|
2025-12-19 14:41:23 +08:00
|
|
|
cursor: pointer;
|
|
|
|
|
transition: all 0.1s; /* Matches SettingView */
|
|
|
|
|
text-align: left;
|
|
|
|
|
font-size: 15px; /* Matches SettingView */
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
color: var(--gray-700);
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 10px;
|
|
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
|
font-size: 14px; /* Slightly adjusted to align better, SettingView uses h() icon defaults */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
background: var(--gray-50);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.activesec {
|
2026-03-24 02:32:35 +08:00
|
|
|
background: var(--gray-150);
|
2025-12-19 14:41:23 +08:00
|
|
|
color: var(--main-700);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Content Area */
|
|
|
|
|
.settings-content-wrapper {
|
|
|
|
|
flex: 1;
|
|
|
|
|
height: 100%;
|
2026-03-24 02:32:35 +08:00
|
|
|
max-width: calc(100% - 176px);
|
|
|
|
|
min-width: 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
background: var(--gray-0);
|
|
|
|
|
padding: 0;
|
2026-01-15 05:33:24 +08:00
|
|
|
|
|
|
|
|
@media (max-width: 900px) {
|
|
|
|
|
max-width: 100%;
|
2026-03-24 02:32:35 +08:00
|
|
|
padding: 8px;
|
2026-01-15 05:33:24 +08:00
|
|
|
}
|
2025-12-19 14:41:23 +08:00
|
|
|
|
|
|
|
|
.settings-content {
|
2026-03-25 13:46:52 +08:00
|
|
|
padding: 16px 16px; /* Keep inner readability without outer panel padding */
|
2026-01-02 15:46:55 +08:00
|
|
|
// margin-bottom: 40px; /* Matches SettingView .setting margin-bottom */
|
|
|
|
|
overflow-y: scroll;
|
2026-03-24 02:32:35 +08:00
|
|
|
height: auto;
|
|
|
|
|
flex: 1;
|
|
|
|
|
min-height: 0;
|
|
|
|
|
|
|
|
|
|
.model-providers-section,
|
|
|
|
|
.user-management,
|
|
|
|
|
.department-management,
|
|
|
|
|
.apikey-management {
|
|
|
|
|
min-height: auto;
|
|
|
|
|
}
|
2026-01-14 21:40:48 +08:00
|
|
|
|
2026-03-24 02:32:35 +08:00
|
|
|
.header-section {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: flex-end;
|
|
|
|
|
gap: 16px;
|
|
|
|
|
margin-bottom: 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.header-content {
|
|
|
|
|
flex: 1;
|
|
|
|
|
min-width: 0;
|
2026-01-14 21:40:48 +08:00
|
|
|
}
|
2025-12-19 14:41:23 +08:00
|
|
|
|
2026-03-24 02:32:35 +08:00
|
|
|
.section-title {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: 500;
|
2025-12-19 14:41:23 +08:00
|
|
|
color: var(--gray-900);
|
2026-03-24 02:32:35 +08:00
|
|
|
line-height: 1.4;
|
2026-03-25 13:46:52 +08:00
|
|
|
margin: 12px 0 12px;
|
2025-12-19 14:41:23 +08:00
|
|
|
}
|
|
|
|
|
|
2026-03-24 02:32:35 +08:00
|
|
|
.section-description {
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
color: var(--gray-600);
|
|
|
|
|
line-height: 1.4;
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.section-subtitle {
|
|
|
|
|
margin: 0;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: var(--gray-900);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.add-btn {
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 6px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (max-width: 900px) {
|
|
|
|
|
height: auto;
|
|
|
|
|
padding: 10px 12px 12px;
|
|
|
|
|
}
|
2025-12-19 14:41:23 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Mobile Styles */
|
|
|
|
|
.settings-mobile-nav {
|
2026-01-14 21:40:48 +08:00
|
|
|
display: none;
|
2025-12-19 14:41:23 +08:00
|
|
|
overflow-x: auto;
|
|
|
|
|
border-bottom: 1px solid var(--gray-150);
|
|
|
|
|
background: var(--gray-0);
|
2026-01-14 21:40:48 +08:00
|
|
|
padding: 0;
|
2026-03-24 02:32:35 +08:00
|
|
|
padding-left: 42px;
|
2025-12-19 14:41:23 +08:00
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
2026-01-15 05:33:24 +08:00
|
|
|
@media (max-width: 900px) {
|
2026-01-14 21:40:48 +08:00
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-19 14:41:23 +08:00
|
|
|
.nav-item {
|
|
|
|
|
padding: 12px 16px;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
color: var(--gray-600);
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
border-bottom: 2px solid transparent;
|
|
|
|
|
transition: all 0.2s;
|
|
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
|
color: var(--main-color);
|
|
|
|
|
border-bottom-color: var(--main-color);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
</style>
|