This commit is contained in:
2025-09-30 09:42:43 +08:00
parent 9719228d6d
commit c5ac27cdec
15 changed files with 222 additions and 139 deletions

View File

@@ -12,6 +12,7 @@ const RakutenDashboard = defineAsyncComponent(() => import('./components/rakuten
const AmazonDashboard = defineAsyncComponent(() => import('./components/amazon/AmazonDashboard.vue'))
const ZebraDashboard = defineAsyncComponent(() => import('./components/zebra/ZebraDashboard.vue'))
const UpdateDialog = defineAsyncComponent(() => import('./components/common/UpdateDialog.vue'))
const SettingsDialog = defineAsyncComponent(() => import('./components/common/SettingsDialog.vue'))
const dashboardsMap: Record<string, Component> = {
rakuten: RakutenDashboard,
@@ -48,6 +49,9 @@ const userPermissions = ref<string>('')
// 更新对话框状态
const showUpdateDialog = ref(false)
// 设置对话框状态
const showSettingsDialog = ref(false)
// 菜单配置 - 复刻ERP客户端格式
const menuConfig = [
{key: 'rakuten', name: 'Rakuten', index: 'rakuten', icon: 'R'},
@@ -69,8 +73,6 @@ function hasPermission(module: string) {
if (!permissions) {
return defaultModules.includes(module) // 没有权限信息时显示默认菜单
}
// 简化权限检查:直接检查模块名是否在权限字符串中
return permissions.includes(module)
}
@@ -132,6 +134,7 @@ function handleMenuSelect(key: string) {
async function handleLoginSuccess(data: { token: string; permissions?: string }) {
isAuthenticated.value = true
showAuthDialog.value = false
showRegDialog.value = false // 确保注册对话框也关闭
try {
// 保存token到本地数据库
@@ -209,11 +212,6 @@ function showRegisterDialog() {
showRegDialog.value = true
}
function handleRegisterSuccess() {
showRegDialog.value = false
showAuthDialog.value = true
}
function backToLogin() {
showRegDialog.value = false
showAuthDialog.value = true
@@ -362,6 +360,10 @@ async function openDeviceManager() {
await fetchDeviceData()
}
function openSettings() {
showSettingsDialog.value = true
}
async function fetchDeviceData() {
if (!currentUsername.value) {
ElMessage({
@@ -472,7 +474,8 @@ onUnmounted(() => {
@go-forward="goForward"
@reload="reloadPage"
@user-click="handleUserClick"
@open-device="openDeviceManager"/>
@open-device="openDeviceManager"
@open-settings="openSettings"/>
<div class="content-body">
<div
class="dashboard-home"
@@ -500,12 +503,15 @@ onUnmounted(() => {
<RegisterDialog
v-model="showRegDialog"
@register-success="handleRegisterSuccess"
@login-success="handleLoginSuccess"
@back-to-login="backToLogin"/>
<!-- 更新对话框 -->
<UpdateDialog v-model="showUpdateDialog" />
<!-- 设置对话框 -->
<SettingsDialog v-model="showSettingsDialog" />
<!-- 设备管理弹框 -->
<el-dialog
v-model="showDeviceDialog"