# 映三色项目管理系统 - 总管理员界面实现指南 ## 整体架构概述 基于 Angular 20.1.0 框架,为总管理员角色创建一个功能完整、视觉专业的后台管理界面。采用模块化设计,实现权限控制、数据看板、项目管理、人员管理等核心功能。 ## 页面布局架构 ### 1. 布局基础 - **三栏式响应式布局**:固定左侧导航 + 顶部操作栏 + 主内容区 - **主色调**:白色为主,深蓝色 (#165DFF) 为强调色,灰色系为辅助色 - **字体规范**:确保字体大小适中,主要内容文本不小于 14px - **间距规范**:采用 8px 网格系统,确保视觉一致性 ### 2. 左侧导航栏实现 ```typescript // admin-layout/admin-layout.ts import { Component } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterModule, RouterOutlet } from '@angular/router'; @Component({ selector: 'app-admin-layout', standalone: true, imports: [CommonModule, RouterModule, RouterOutlet], templateUrl: './admin-layout.html', styleUrl: './admin-layout.scss' }) export class AdminLayout { sidebarOpen = true; currentUser = { name: '超级管理员', avatar: 'https://picsum.photos/id/1/40/40' }; currentDate = new Date(); toggleSidebar() { this.sidebarOpen = !this.sidebarOpen; } } ``` ```html

系统管理后台

{{ currentDate.toLocaleDateString('zh-CN', { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' }) }}
用户头像 {{ currentUser.name }}

核心功能

总览看板 项目管理 设计师管理 客户管理 财务管理

系统设置

系统设置 系统日志 API集成管理
``` ## 模块实现指南 ### 1. 总览看板模块 ```typescript // admin/dashboard/dashboard.ts import { Component, OnInit, signal } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; import * as echarts from 'echarts'; import { AdminDashboardService } from './dashboard.service'; @Component({ selector: 'app-admin-dashboard', standalone: true, imports: [CommonModule, RouterModule], templateUrl: './dashboard.html', styleUrl: './dashboard.scss' }) export class AdminDashboard implements OnInit { // 统计数据 stats = { totalProjects: signal(128), activeProjects: signal(86), completedProjects: signal(42), totalDesigners: signal(24), totalCustomers: signal(356), totalRevenue: signal(1258000) }; constructor(private dashboardService: AdminDashboardService) {} ngOnInit(): void { this.loadDashboardData(); this.initCharts(); } loadDashboardData(): void { // 从服务加载数据 this.dashboardService.getDashboardStats().subscribe(data => { // 更新统计数据 }); } initCharts(): void { // 初始化项目趋势图 const projectChart = echarts.init(document.getElementById('projectTrendChart')!); projectChart.setOption({ title: { text: '项目数量趋势', left: 'center', textStyle: { fontSize: 16 } }, tooltip: { trigger: 'axis' }, xAxis: { type: 'category', data: ['1月', '2月', '3月', '4月', '5月', '6月'] }, yAxis: { type: 'value' }, series: [{ name: '新项目', type: 'line', data: [18, 25, 32, 28, 42, 38], lineStyle: { color: '#165DFF' }, itemStyle: { color: '#165DFF' } }, { name: '完成项目', type: 'line', data: [15, 20, 25, 22, 35, 30], lineStyle: { color: '#00B42A' }, itemStyle: { color: '#00B42A' } }] }); // 初始化收入统计图 const revenueChart = echarts.init(document.getElementById('revenueChart')!); revenueChart.setOption({ title: { text: '季度收入统计', left: 'center', textStyle: { fontSize: 16 } }, tooltip: { trigger: 'item' }, series: [{ name: '收入分布', type: 'pie', radius: '65%', data: [ { value: 350000, name: '第一季度' }, { value: 420000, name: '第二季度' }, { value: 488000, name: '第三季度' } ], emphasis: { itemStyle: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' } } }] }); // 响应窗口大小变化 window.addEventListener('resize', () => { projectChart.resize(); revenueChart.resize(); }); } } ``` ### 2. 项目管理模块 创建项目列表和项目详情组件,实现项目的创建、分配、编辑和关闭功能。 ### 3. 用户与角色管理模块 实现用户管理、角色管理和权限分配功能。 ### 4. 系统设置模块 实现全局设置、流程配置、报价规则等系统级配置功能。 ### 5. 系统日志模块 实现操作日志查询、筛选和导出功能。 ### 6. API集成管理模块 实现与第三方服务的接口配置功能。 ## 组件化设计 创建以下可复用组件: 1. **数据卡片组件** ```typescript // shared/components/stats-card/stats-card.ts import { Component, Input } from '@angular/core'; import { CommonModule } from '@angular/common'; @Component({ selector: 'app-stats-card', standalone: true, imports: [CommonModule], template: `
{{ value }}
{{ label }}
{{ trend }}
`, styles: [` /* 样式定义 */ `] }) export class StatsCard { @Input() value: string | number = 0; @Input() label: string = ''; @Input() trend: string = ''; @Input() trendType: 'positive' | 'negative' | 'neutral' = 'neutral'; @Input() iconColor: string = 'primary'; get trendClass() { return `stat-trend ${this.trendType}`; } } ``` 2. **表格组件、筛选组件、表单组件等 ## 状态管理与数据流 1. **使用 RxJS 管理数据流** ```typescript // admin/services/admin-dashboard.service.ts import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable, map } from 'rxjs'; import { DashboardStats } from '../models/admin.model'; @Injectable({ providedIn: 'root' }) export class AdminDashboardService { constructor(private http: HttpClient) {} getDashboardStats(): Observable { // 模拟API调用 return this.http.get('/api/admin/dashboard/stats') .pipe( map(response => { // 数据转换处理 return response; }) ); } } ``` ## 权限控制实现 创建角色守卫实现路由权限控制: ```typescript // guards/role.guard.ts import { inject } from '@angular/core'; import { CanActivateFn, Router } from '@angular/router'; import { AuthService } from '../services/auth.service'; export const roleGuard: CanActivateFn = (route, state) => { const authService = inject(AuthService); const router = inject(Router); const requiredRoles = route.data['roles'] as string[]; const userRoles = authService.getUserRoles(); // 检查用户是否有管理权限 const hasAccess = requiredRoles.some(role => userRoles.includes(role)); if (!hasAccess) { router.navigate(['/']); return false; } return true; }; ``` ## 路由配置 ```typescript // app.routes.ts import { Routes } from '@angular/router'; // ... 其他导入 import { AdminLayout } from './pages/admin/admin-layout/admin-layout'; import { AdminDashboard } from './pages/admin/dashboard/dashboard'; import { ProjectManagement } from './pages/admin/project-management/project-management'; import { UserManagement } from './pages/admin/user-management/user-management'; import { SystemSettings } from './pages/admin/system-settings/system-settings'; import { SystemLogs } from './pages/admin/system-logs/system-logs'; import { ApiIntegrations } from './pages/admin/api-integrations/api-integrations'; import { roleGuard } from './guards/role.guard'; export const routes: Routes = [ // ... 其他路由 // 管理员路由 { path: 'admin', component: AdminLayout, canActivate: [roleGuard], data: { roles: ['admin'] }, children: [ { path: '', redirectTo: 'dashboard', pathMatch: 'full' }, { path: 'dashboard', component: AdminDashboard, title: '总览看板' }, { path: 'project-management', component: ProjectManagement, title: '项目管理' }, { path: 'user-management', component: UserManagement, title: '用户与角色管理' }, { path: 'system-settings', component: SystemSettings, title: '系统设置' }, { path: 'logs', component: SystemLogs, title: '系统日志' }, { path: 'api-integrations', component: ApiIntegrations, title: 'API集成管理' } ] }, // 默认路由重定向 { path: '', redirectTo: '/customer-service/dashboard', pathMatch: 'full' }, { path: '**', redirectTo: '/customer-service/dashboard' } ]; ``` ## UI/UX 设计指南 1. **视觉层次**:通过卡片、阴影、边框创建清晰的视觉层次 2. **交互反馈**:为所有可点击元素添加悬停效果,操作结果提供明确反馈 3. **加载状态**:实现骨架屏或加载动画 4. **错误处理**:提供友好的错误提示和引导 5. **响应式设计**:确保在不同屏幕尺寸下的良好体验 ## 技术实现建议 1. **安装依赖**: ```bash # 安装 Angular Material npm install @angular/material @angular/cdk @angular/animations # 安装 ECharts 和 Angular 包装器 npm install echarts ngx-echarts # 安装 NgRx 用于状态管理 npm install @ngrx/store @ngrx/effects @ngrx/entity @ngrx/store-devtools ``` 2. **模块懒加载**:使用 `loadChildren` 实现模块懒加载优化性能 3. **国际化支持**:为管理界面添加多语言支持 4. **单元测试**:为核心组件和服务编写单元测试 5. **性能优化**:实现虚拟滚动、图片懒加载等性能优化措施 通过以上实现指南,可以创建一个功能完整、体验良好的总管理员界面,满足所有需求并确保代码质量和可维护性。