fix(admin): 删除用户审批功能并更新图标
This commit is contained in:
1 parent
55c6467d83
commit
07e83132c0
11 files changed
+141
-153
No files matched your search
@@ -1,15 +1,14 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/components/AdminNav.vue
|
||||
* 管理后台左侧导航,使用子路由跳转。
|
||||
* 依赖:admin-nav.store、modules 常量、vue-router。
|
||||
* 逻辑:报表/企微子菜单默认折叠;当前路由落在对应模块时自动展开以便看到激活项。
|
||||
* 绠$悊鍚庡彴宸︿晶瀵艰埅锛屼娇鐢ㄥ瓙璺敱璺宠浆銆?
|
||||
* 渚濊禆锛歛dmin-nav.store銆乵odules 甯搁噺銆乿ue-router銆?
|
||||
* 閫昏緫锛氭姤琛?浼佸井瀛愯彍鍗曢粯璁ゆ姌鍙狅紱褰撳墠璺敱钀藉湪瀵瑰簲妯″潡鏃惰嚜鍔ㄥ睍寮€浠ヤ究鐪嬪埌婵€娲婚」銆?
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import {
|
||||
LayoutDashboard, UserPlus, UserCog, Building, Bot, FileText,
|
||||
import { LayoutDashboard, UserCog, Building, Bot, FileText,
|
||||
Settings2, Megaphone, MessageCircleQuestion, Link2, Users, ShieldCheck, BarChart2, AppWindow,
|
||||
ScrollText, ExternalLink,
|
||||
} from 'lucide-vue-next';
|
||||
@@ -26,7 +25,6 @@ const navStore = useAdminNavStore();
|
||||
|
||||
const iconMap: Record<AdminModuleId, Component> = {
|
||||
dashboard: LayoutDashboard,
|
||||
approvals: UserPlus,
|
||||
users: UserCog,
|
||||
departments: Building,
|
||||
agents: Bot,
|
||||
@@ -83,7 +81,7 @@ const navigateReport = (table: string): void => {
|
||||
};
|
||||
|
||||
/**
|
||||
* 进入报表/企微模块时自动展开子菜单,避免当前页在折叠状态下不可见。
|
||||
* 杩涘叆鎶ヨ〃/浼佸井妯″潡鏃惰嚜鍔ㄥ睍寮€瀛愯彍鍗曪紝閬垮厤褰撳墠椤靛湪鎶樺彔鐘舵€佷笅涓嶅彲瑙併€?
|
||||
*/
|
||||
watch(
|
||||
isReportsActive,
|
||||
@@ -195,3 +193,4 @@ watch(
|
||||
</nav>
|
||||
</aside>
|
||||
</template>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/constants/modules.ts
|
||||
* 管理后台模块元数据,AdminNav 与子路由共用。
|
||||
* 绠$悊鍚庡彴妯″潡鍏冩暟鎹紝AdminNav 涓庡瓙璺敱鍏辩敤銆?
|
||||
*/
|
||||
|
||||
import type { AdminModuleId, AdminReportTableId } from '../types/admin.types';
|
||||
@@ -13,14 +13,13 @@ export interface AdminModuleMeta {
|
||||
configKey: keyof typeof import('@/config').config.admin.modules;
|
||||
}
|
||||
|
||||
/** 已独立拆分的模块(全部 admin 模块均已拆分) */
|
||||
/** 宸茬嫭绔嬫媶鍒嗙殑妯″潡锛堝叏閮?admin 妯″潡鍧囧凡鎷嗗垎锛?*/
|
||||
export const STANDALONE_ADMIN_MODULES = new Set<AdminModuleId>([
|
||||
'dashboard', 'agents', 'users', 'departments', 'approvals', 'announcements', 'questions', 'requests', 'permissions', 'schedules', 'knowledge_base', 'wecom', 'linked_services', 'platform_apps', 'procurement_contract', 'reports',
|
||||
'dashboard', 'agents', 'users', 'departments', 'announcements', 'questions', 'requests', 'permissions', 'schedules', 'knowledge_base', 'wecom', 'linked_services', 'platform_apps', 'procurement_contract', 'reports',
|
||||
]);
|
||||
|
||||
export const ADMIN_MODULE_METAS: AdminModuleMeta[] = [
|
||||
{ id: 'dashboard', routeName: 'AdminDashboard', path: 'dashboard', labelKey: 'admin.nav.dashboard', configKey: 'dashboard' },
|
||||
{ id: 'approvals', routeName: 'AdminApprovals', path: 'approvals', labelKey: 'admin.nav.approvals', configKey: 'approvals' },
|
||||
{ id: 'users', routeName: 'AdminUsers', path: 'users', labelKey: 'admin.nav.users', configKey: 'users' },
|
||||
{ id: 'departments', routeName: 'AdminDepartments', path: 'departments', labelKey: 'admin.nav.departments', configKey: 'departments' },
|
||||
{ id: 'agents', routeName: 'AdminAgents', path: 'agents', labelKey: 'admin.nav.agents', configKey: 'agents' },
|
||||
@@ -53,3 +52,4 @@ export const adminModulePath = (moduleId: AdminModuleId | string): string => {
|
||||
if (meta) return `/admin/${meta.path}`;
|
||||
return `/admin/${LEGACY_MODULE_QUERY_TO_PATH[moduleId] || moduleId}`;
|
||||
};
|
||||
|
||||
@@ -21,7 +21,6 @@ export const useAdminNavStore = defineStore('adminNav', () => {
|
||||
/** 企业微信子菜单:默认折叠 */
|
||||
const wecomExpanded = ref(false);
|
||||
/** 「用户审批」导航角标:pending 注册用户数 */
|
||||
const pendingApprovalsCount = ref(0);
|
||||
/** 「权限申请」导航角标:pending 权限申请数 */
|
||||
const pendingRequestsCount = ref(0);
|
||||
|
||||
@@ -34,13 +33,11 @@ export const useAdminNavStore = defineStore('adminNav', () => {
|
||||
sidebarCollapsed.value = !sidebarCollapsed.value;
|
||||
};
|
||||
|
||||
const setBadgeCounts = (approvals: number, requests: number): void => {
|
||||
pendingApprovalsCount.value = approvals;
|
||||
const setBadgeCounts = (_approvals: number, requests: number): void => {
|
||||
pendingRequestsCount.value = requests;
|
||||
};
|
||||
|
||||
const badgeForModule = (moduleId: AdminModuleId): number | undefined => {
|
||||
if (moduleId === 'approvals' && pendingApprovalsCount.value > 0) return pendingApprovalsCount.value;
|
||||
if (moduleId === 'requests' && pendingRequestsCount.value > 0) return pendingRequestsCount.value;
|
||||
return undefined;
|
||||
};
|
||||
@@ -66,7 +63,7 @@ export const useAdminNavStore = defineStore('adminNav', () => {
|
||||
badgesInFlight = (async () => {
|
||||
try {
|
||||
const data = await getAdminDashboardBadges();
|
||||
setBadgeCounts(data.pending_approvals, data.pending_requests);
|
||||
setBadgeCounts(0, data.pending_requests);
|
||||
badgesFetchedAt = Date.now();
|
||||
} catch {
|
||||
setBadgeCounts(0, 0);
|
||||
@@ -88,7 +85,6 @@ export const useAdminNavStore = defineStore('adminNav', () => {
|
||||
sidebarCollapsed,
|
||||
reportsExpanded,
|
||||
wecomExpanded,
|
||||
pendingApprovalsCount,
|
||||
pendingRequestsCount,
|
||||
toggleSidebar,
|
||||
setBadgeCounts,
|
||||
@@ -97,3 +93,4 @@ export const useAdminNavStore = defineStore('adminNav', () => {
|
||||
refreshBadges,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
/**
|
||||
/**
|
||||
* features/admin/types/admin.types.ts
|
||||
* 管理后台域公共类型。
|
||||
* 绠$悊鍚庡彴鍩熷叕鍏辩被鍨嬨€?
|
||||
*/
|
||||
|
||||
export type AdminModuleId =
|
||||
| 'dashboard'
|
||||
| 'approvals'
|
||||
| 'users'
|
||||
| 'departments'
|
||||
| 'agents'
|
||||
@@ -67,3 +66,4 @@ export interface AdminAnnouncementRow {
|
||||
content: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ export interface AdminDashboardSummary {
|
||||
|
||||
/** GET /api/admin/dashboard/badges — 侧栏「用户审批」「权限申请」角标 */
|
||||
export interface AdminDashboardBadges {
|
||||
pending_approvals: number;
|
||||
pending_requests: number;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user