Browse Source

feat: Update dependencies and enhance AI operations assistant module with new features and UI improvements

徐福静0235668 11 hours ago
parent
commit
5e28e5a10f

+ 2 - 1
angular.json

@@ -34,7 +34,8 @@
             ],
             "styles": [
               "src/styles.scss"
-            ]
+            ],
+            "externalDependencies": []
           },
           "configurations": {
             "production": {

File diff suppressed because it is too large
+ 1718 - 1525
package-lock.json


+ 45 - 1
package.json

@@ -22,22 +22,66 @@
   },
   "private": true,
   "dependencies": {
+    "@amap/amap-jsapi-loader": "^1.0.1",
+    "@angular/animations": "^20.3.1",
     "@angular/common": "^20.3.0",
     "@angular/compiler": "^20.3.0",
     "@angular/core": "^20.3.0",
     "@angular/forms": "^20.3.0",
+    "@angular/material": "^20.2.9",
     "@angular/platform-browser": "^20.3.0",
     "@angular/router": "^20.3.0",
+    "@awesome-cordova-plugins/core": "^6.8.0",
+    "@awesome-cordova-plugins/diagnostic": "^8.1.0",
+    "@awesome-cordova-plugins/media-capture": "^8.1.0",
+    "@babylonjs/core": "^8.31.3",
+    "@babylonjs/loaders": "^8.31.3",
+    "@capacitor/camera": "^7.0.2",
+    "@capacitor/clipboard": "^7.0.2",
+    "@capacitor/core": "^7.4.3",
+    "@capacitor/filesystem": "^7.1.4",
+    "@codemirror/lang-javascript": "^6.2.4",
+    "@codemirror/state": "^6.5.2",
+    "@codemirror/view": "^6.38.6",
     "@fortawesome/fontawesome-free": "^7.0.1",
+    "@ionic/angular": "^8.7.6",
+    "@langchain/core": "^0.3.78",
     "chart.js": "^4.5.0",
+    "codemirror": "^6.0.2",
+    "esdk-obs-browserjs": "^3.25.6",
     "fmode-ng": "^0.0.209",
+    "highlight.js": "^11.11.1",
+    "ionicons": "^8.0.13",
+    "jquery": "^3.7.1",
+    "markdown-it": "^14.1.0",
+    "markdown-it-abbr": "^2.0.0",
+    "markdown-it-deflist": "^3.0.0",
+    "markdown-it-footnote": "^4.0.0",
+    "markdown-it-ins": "^4.0.0",
+    "markdown-it-mark": "^4.0.0",
+    "markdown-it-ruby": "^1.1.2",
+    "markdown-it-sub": "^2.0.0",
+    "markdown-it-sup": "^2.0.0",
+    "mathjax-full": "^3.2.2",
+    "ng-qrcode": "^20.0.0",
+    "ng-zorro-antd": "^20.3.1",
+    "pako": "^2.1.0",
+    "plantuml-encoder": "^1.4.0",
+    "plupload": "^2.3.9",
+    "qiniu-js": "^3.4.3",
+    "quill": "^2.0.3",
+    "recorder-core": "^1.3.25011100",
     "rxjs": "~7.8.0",
+    "spark-md5": "^3.0.2",
+    "swiper": "^12.0.2",
     "tslib": "^2.3.0",
+    "uuid": "^13.0.0",
     "zone.js": "~0.15.0"
   },
   "devDependencies": {
+    "@angular-devkit/build-angular": "^20.3.6",
     "@angular/build": "^20.3.2",
-    "@angular/cli": "^20.3.2",
+    "@angular/cli": "^20.3.6",
     "@angular/compiler-cli": "^20.3.0",
     "@types/jasmine": "~5.1.0",
     "jasmine-core": "~5.9.0",

+ 4 - 3
src/app/app.config.ts

@@ -1,12 +1,13 @@
-import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZoneChangeDetection } from '@angular/core';
+import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
 import { provideRouter } from '@angular/router';
+import { provideAnimations } from '@angular/platform-browser/animations';
 
 import { routes } from './app.routes';
 
 export const appConfig: ApplicationConfig = {
   providers: [
-    provideBrowserGlobalErrorListeners(),
     provideZoneChangeDetection({ eventCoalescing: true }),
-    provideRouter(routes)
+    provideRouter(routes),
+    provideAnimations()
   ]
 };

+ 3 - 3
src/app/app.routes.ts

@@ -25,11 +25,11 @@ export const routes: Routes = [
     // canActivate: [authGuard]
   },
   
-  // G端政府用户路由 - 需要认证
+  // G端政府用户路由 - 临时移除认证守卫用于测试
   {
     path: 'government',
-    loadChildren: () => import('./government/government-module').then(m => m.GovernmentModule),
-    canActivate: [authGuard]
+    loadChildren: () => import('./government/government-module').then(m => m.GovernmentModule)
+    // canActivate: [authGuard] // 临时注释掉用于测试
   },
   
   // 404页面

+ 7 - 3
src/app/app.ts

@@ -1,13 +1,17 @@
-import { Component, signal } from '@angular/core';
+import { Component, signal, OnInit } from '@angular/core';
 import { RouterOutlet } from '@angular/router';
 import { FmodeParse } from 'fmode-ng'
-FmodeParse.initialize('dev');
+
 @Component({
   selector: 'app-root',
   imports: [RouterOutlet],
   templateUrl: './app.html',
   styleUrl: './app.scss'
 })
-export class App {
+export class App implements OnInit {
   protected readonly title = signal('recycle-app');
+  
+  ngOnInit() {
+    FmodeParse.initialize('dev');
+  }
 }

+ 5 - 2
src/app/auth/auth-module.ts

@@ -2,13 +2,16 @@ import { NgModule } from '@angular/core';
 import { CommonModule } from '@angular/common';
 
 import { AuthRoutingModule } from './auth-routing-module';
-
+import { LoginComponent } from './login/login';
+import { Register } from './register/register';
 
 @NgModule({
   declarations: [],
   imports: [
     CommonModule,
-    AuthRoutingModule
+    AuthRoutingModule,
+    LoginComponent,
+    Register
   ]
 })
 export class AuthModule { }

+ 122 - 0
src/app/business/ai-operations-assistant/README.md

@@ -0,0 +1,122 @@
+# 🤖 AI运营助手模块
+
+## 📍 访问路径
+
+```
+http://localhost:4200/business/ai-operations-assistant
+```
+
+或
+
+```
+http://localhost:4200/business/ai-assistant
+```
+
+## ✨ 功能特性
+
+### 1. 智能对话模块 💬
+- **快捷问题卡片**:6个预设问题,一键提问
+- **文字输入**:支持自由输入问题
+- **语音输入**:点击麦克风按钮,3秒录音后自动转文字
+- **文件上传**:支持PDF、Word、Excel、图片等多种格式
+- **AI智能回复**:根据关键词匹配专业回答
+- **建议按钮**:AI回复后显示相关操作建议
+
+### 2. 智能洞察模块 💡
+- **价格波动预警**:实时监控市场价格变化
+- **设备维护提醒**:预测性维护建议
+- **运营效率优化**:智能分析并提供优化方案
+- **一键跳转**:直接跳转到相关业务页面
+
+### 3. 政策推荐模块 🎁
+- **政策匹配**:根据企业情况推荐适合的补贴政策
+- **详细信息**:补贴金额、申请截止、申请条件
+- **在线申请**:一键准备申请材料
+- **状态跟踪**:显示申请状态(可申请/已申请/已过期)
+
+## 🎯 支持的问题类型
+
+### 数据分析
+- "本月哪个品类利润最高?"
+- "查看本月收入趋势"
+
+### 趋势预测
+- "预测下周的回收量"
+
+### 设备监控
+- "分析3号设备的运行效率"
+
+### 预警管理
+- "显示所有未处理预警"
+
+### 人员管理
+- "优化人员调度建议"
+
+### 订单分配
+- "将XX小区所有订单分配给张三"
+
+### 政策咨询
+- "查询可申请的补贴政策"
+
+## 🎨 设计特点
+
+- **绿色渐变主题**:环保色调,符合回收行业特性
+- **流畅动画**:消息滑入、按钮悬浮、录音脉冲等
+- **响应式布局**:适配桌面端和移动端
+- **高级感UI**:卡片阴影、渐变背景、圆角设计
+- **清晰的信息层级**:模块分明,操作直观
+
+## 🚀 使用流程
+
+### 场景1:数据分析
+1. 进入AI助手页面
+2. 点击"本月哪个品类利润最高?"
+3. 查看AI分析结果
+4. 点击"查看详细报表"查看更多
+
+### 场景2:设备监控
+1. 切换到"智能洞察"标签
+2. 查看设备维护提醒
+3. 点击"查看详情"跳转到设备管理
+
+### 场景3:政策申请
+1. 切换到"政策推荐"标签
+2. 浏览可申请的补贴政策
+3. 点击"查看详情"了解申请流程
+4. 点击"立即申请"开始申请
+
+### 场景4:语音+文件
+1. 点击🎤录音按钮
+2. 系统录音3秒
+3. 自动转换为文字
+4. 点击📎上传相关文件
+5. 发送消息给AI分析
+
+## 💡 技术实现
+
+- **Angular 20+** 独立组件
+- **TypeScript** 类型安全
+- **SCSS** 模块化样式
+- **响应式设计** 移动端适配
+- **动画效果** CSS3动画
+
+## 📝 注意事项
+
+1. 当前为前端模拟,未连接真实AI服务
+2. 语音功能3秒后自动停止,实际需集成语音识别API
+3. 文件上传仅前端处理,需后端API支持
+4. AI回复内容为模拟数据,实际需对接业务系统
+
+## 🔗 相关页面
+
+- Dashboard: `/business/dashboard`
+- 数据报表: `/business/data-reports`
+- 设备管理: `/business/device-management`
+- 订单管理: `/business/order-management`
+
+---
+
+**开发时间**: 2025-10-16  
+**版本**: v1.0.0  
+**状态**: ✅ 完成
+

+ 303 - 4
src/app/business/ai-operations-assistant/ai-operations-assistant.html

@@ -1,6 +1,305 @@
-<div class="ai-operations-assistant-container">
+<div class="ai-assistant-container">
+  <!-- 头部 -->
   <div class="assistant-header">
-    <h1>AI运营助手</h1>
+    <div class="header-left">
+      <button class="back-btn" routerLink="/business/dashboard" title="返回Dashboard">
+        <span class="back-icon">←</span>
+        <span class="back-text">返回</span>
+      </button>
+      <div class="icon-wrapper">
+        <span class="robot-icon">🤖</span>
+      </div>
+      <div class="header-info">
+        <h1>AI运营助手</h1>
+        <p class="subtitle">智能分析 · 精准预测 · 高效决策</p>
+      </div>
+    </div>
+    <div class="header-actions">
+      <button class="icon-btn" (click)="clearChat()" title="清空对话">
+        <span>🗑️</span>
+      </button>
+    </div>
   </div>
-  <!-- 页面内容已清理,保留基本结构 -->
-</div>
+
+  <!-- 模块切换标签 -->
+  <div class="module-tabs">
+    <button 
+      class="tab-btn" 
+      [class.active]="activeModule === 'chat'"
+      (click)="switchModule('chat')">
+      <span class="tab-icon">💬</span>
+      <span class="tab-label">智能对话</span>
+    </button>
+    <button 
+      class="tab-btn" 
+      [class.active]="activeModule === 'insights'"
+      (click)="switchModule('insights')">
+      <span class="tab-icon">💡</span>
+      <span class="tab-label">智能洞察</span>
+    </button>
+    <button 
+      class="tab-btn" 
+      [class.active]="activeModule === 'policies'"
+      (click)="switchModule('policies')">
+      <span class="tab-icon">🎁</span>
+      <span class="tab-label">政策推荐</span>
+    </button>
+  </div>
+
+  <!-- 主内容区域 -->
+  <div class="assistant-content">
+    
+    <!-- 智能对话模块 -->
+    <div class="chat-module" *ngIf="activeModule === 'chat'">
+      <!-- 快捷问题 -->
+      <div class="quick-questions" *ngIf="messages.length <= 1">
+        <h3 class="section-title">
+          <span class="title-icon">⚡</span>
+          快速开始
+        </h3>
+        <div class="questions-grid">
+          <button 
+            class="question-card" 
+            *ngFor="let q of quickQuestions"
+            (click)="askQuickQuestion(q.text)">
+            <span class="question-icon">{{q.icon}}</span>
+            <span class="question-text">{{q.text}}</span>
+            <span class="question-category">{{q.category}}</span>
+          </button>
+        </div>
+      </div>
+
+      <!-- 消息列表 -->
+      <div class="messages-container" #messageContainer>
+        <div 
+          class="message" 
+          *ngFor="let msg of messages"
+          [class.user-message]="msg.sender === 'user'"
+          [class.ai-message]="msg.sender === 'ai'">
+          
+          <!-- AI消息 -->
+          <div class="message-wrapper" *ngIf="msg.sender === 'ai'">
+            <div class="avatar ai-avatar">
+              <span>🤖</span>
+            </div>
+            <div class="message-content">
+              <div class="message-bubble">
+                <div class="message-text" [innerHTML]="msg.content | nl2br"></div>
+              </div>
+              <!-- AI建议按钮 -->
+              <div class="suggestions" *ngIf="msg.suggestions && msg.suggestions.length > 0">
+                <button 
+                  class="suggestion-btn" 
+                  *ngFor="let suggestion of msg.suggestions"
+                  (click)="clickSuggestion(suggestion)">
+                  {{suggestion}}
+                </button>
+              </div>
+              <div class="message-time">{{msg.timestamp | date:'HH:mm'}}</div>
+            </div>
+          </div>
+
+          <!-- 用户消息 -->
+          <div class="message-wrapper" *ngIf="msg.sender === 'user'">
+            <div class="message-content">
+              <div class="message-bubble">
+                <div class="message-text">{{msg.content}}</div>
+                <!-- 附件 -->
+                <div class="attachments" *ngIf="msg.attachments && msg.attachments.length > 0">
+                  <div class="attachment-item" *ngFor="let file of msg.attachments">
+                    <span class="file-icon">{{getFileIcon(file.type)}}</span>
+                    <div class="file-info">
+                      <div class="file-name">{{file.name}}</div>
+                      <div class="file-size">{{formatFileSize(file.size)}}</div>
+                    </div>
+                  </div>
+                </div>
+              </div>
+              <div class="message-time">{{msg.timestamp | date:'HH:mm'}}</div>
+            </div>
+            <div class="avatar user-avatar">
+              <span>👤</span>
+            </div>
+          </div>
+        </div>
+
+        <!-- 打字指示器 -->
+        <div class="message ai-message" *ngIf="isTyping">
+          <div class="message-wrapper">
+            <div class="avatar ai-avatar">
+              <span>🤖</span>
+            </div>
+            <div class="message-content">
+              <div class="message-bubble">
+                <div class="typing-indicator">
+                  <span></span>
+                  <span></span>
+                  <span></span>
+                </div>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+
+      <!-- 输入区域 -->
+      <div class="input-area">
+        <!-- 附件预览 -->
+        <div class="attached-files" *ngIf="attachedFiles.length > 0">
+          <div class="file-preview" *ngFor="let file of attachedFiles; let i = index">
+            <span class="file-icon">{{getFileIcon(file.type)}}</span>
+            <div class="file-info">
+              <div class="file-name">{{file.name}}</div>
+              <div class="file-size">{{formatFileSize(file.size)}}</div>
+            </div>
+            <button class="remove-file" (click)="removeFile(i)">❌</button>
+          </div>
+        </div>
+
+        <!-- 输入框 -->
+        <div class="input-wrapper">
+          <button class="action-btn" (click)="triggerFileUpload()" title="上传附件">
+            <span>📎</span>
+          </button>
+          <input 
+            type="file" 
+            #fileInput 
+            (change)="onFileSelected($event)" 
+            multiple 
+            style="display: none;"
+            accept=".pdf,.doc,.docx,.xls,.xlsx,.png,.jpg,.jpeg">
+          
+          <input 
+            type="text" 
+            class="message-input" 
+            [(ngModel)]="userInput"
+            (keyup.enter)="sendMessage()"
+            placeholder="输入您的问题,或点击快捷问题开始对话..."
+            [disabled]="isRecording">
+          
+          <button 
+            class="action-btn voice-btn" 
+            [class.recording]="isRecording"
+            (click)="isRecording ? stopRecording() : startRecording()"
+            title="语音输入">
+            <span *ngIf="!isRecording">🎤</span>
+            <span *ngIf="isRecording" class="recording-indicator">
+              <span class="pulse"></span>
+              {{recordingTime}}s
+            </span>
+          </button>
+          
+          <button 
+            class="send-btn" 
+            (click)="sendMessage()"
+            [disabled]="!userInput.trim() && attachedFiles.length === 0">
+            <span>发送</span>
+            <span class="send-icon">📤</span>
+          </button>
+        </div>
+      </div>
+    </div>
+
+    <!-- 智能洞察模块 -->
+    <div class="insights-module" *ngIf="activeModule === 'insights'">
+      <div class="module-header">
+        <h2>
+          <span class="header-icon">💡</span>
+          智能洞察
+        </h2>
+        <p class="header-desc">基于数据分析的智能预警与优化建议</p>
+      </div>
+
+      <div class="insights-grid">
+        <div 
+          class="insight-card" 
+          *ngFor="let insight of insights"
+          [class.warning]="insight.type === 'warning'"
+          [class.info]="insight.type === 'info'"
+          [class.success]="insight.type === 'success'">
+          <div class="insight-header">
+            <span class="insight-icon">{{insight.icon}}</span>
+            <span class="insight-type">{{insight.type === 'warning' ? '预警' : insight.type === 'info' ? '提醒' : '建议'}}</span>
+          </div>
+          <h3 class="insight-title">{{insight.title}}</h3>
+          <p class="insight-description">{{insight.description}}</p>
+          <div class="insight-actions">
+            <button class="insight-btn primary" (click)="handleInsightAction(insight)">
+              查看详情
+            </button>
+          </div>
+        </div>
+      </div>
+
+      <div class="insights-footer">
+        <button class="consult-btn" (click)="switchModule('chat')">
+          <span>🤖</span>
+          向AI咨询更多建议
+        </button>
+      </div>
+    </div>
+
+    <!-- 政策推荐模块 -->
+    <div class="policies-module" *ngIf="activeModule === 'policies'">
+      <div class="module-header">
+        <h2>
+          <span class="header-icon">🎁</span>
+          政策推荐
+        </h2>
+        <p class="header-desc">为您匹配适合的补贴政策和资金支持</p>
+      </div>
+
+      <div class="policies-grid">
+        <div class="policy-card" *ngFor="let policy of policies">
+          <div class="policy-header">
+            <h3 class="policy-title">{{policy.title}}</h3>
+            <span class="policy-status" [ngClass]="getPolicyStatusClass(policy.status)">
+              {{getPolicyStatusText(policy.status)}}
+            </span>
+          </div>
+          <p class="policy-description">{{policy.description}}</p>
+          
+          <div class="policy-details">
+            <div class="detail-item">
+              <span class="detail-label">💰 补贴金额</span>
+              <span class="detail-value">{{policy.amount}}</span>
+            </div>
+            <div class="detail-item">
+              <span class="detail-label">⏰ 申请截止</span>
+              <span class="detail-value">{{policy.deadline}}</span>
+            </div>
+          </div>
+
+          <div class="policy-requirements">
+            <div class="requirements-title">申请条件:</div>
+            <ul class="requirements-list">
+              <li *ngFor="let req of policy.requirements">{{req}}</li>
+            </ul>
+          </div>
+
+          <div class="policy-actions">
+            <button class="policy-btn secondary" (click)="viewPolicyDetails(policy)">
+              <span>ℹ️</span>
+              查看详情
+            </button>
+            <button 
+              class="policy-btn primary" 
+              (click)="applyPolicy(policy)"
+              [disabled]="policy.status !== 'available'">
+              <span>✅</span>
+              {{policy.status === 'available' ? '立即申请' : '已申请'}}
+            </button>
+          </div>
+        </div>
+      </div>
+
+      <div class="policies-footer">
+        <button class="consult-btn" (click)="switchModule('chat')">
+          <span>💬</span>
+          咨询更多政策信息
+        </button>
+      </div>
+    </div>
+
+  </div>
+</div>

+ 1058 - 0
src/app/business/ai-operations-assistant/ai-operations-assistant.scss

@@ -0,0 +1,1058 @@
+.ai-assistant-container {
+  min-height: 100vh;
+  background: linear-gradient(135deg, #f5f7fa 0%, #e8f5e9 100%);
+  padding: 20px;
+  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
+}
+
+// 头部样式
+.assistant-header {
+  background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
+  padding: 24px 32px;
+  border-radius: 16px;
+  box-shadow: 0 4px 20px rgba(76, 175, 80, 0.3);
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 24px;
+
+  .header-left {
+    display: flex;
+    align-items: center;
+    gap: 16px;
+  }
+
+  .back-btn {
+    display: flex;
+    align-items: center;
+    gap: 8px;
+    padding: 10px 20px;
+    background: rgba(255, 255, 255, 0.2);
+    border: 2px solid rgba(255, 255, 255, 0.3);
+    border-radius: 24px;
+    color: white;
+    font-size: 15px;
+    font-weight: 600;
+    cursor: pointer;
+    transition: all 0.3s ease;
+    backdrop-filter: blur(10px);
+    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
+
+    .back-icon {
+      font-size: 20px;
+      font-weight: bold;
+      transition: transform 0.3s ease;
+    }
+
+    .back-text {
+      letter-spacing: 0.5px;
+    }
+
+    &:hover {
+      background: rgba(255, 255, 255, 0.3);
+      border-color: rgba(255, 255, 255, 0.5);
+      transform: translateX(-4px);
+      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
+
+      .back-icon {
+        transform: translateX(-3px);
+      }
+    }
+
+    &:active {
+      transform: translateX(-2px) scale(0.98);
+    }
+  }
+
+  .icon-wrapper {
+    width: 56px;
+    height: 56px;
+    background: rgba(255, 255, 255, 0.2);
+    border-radius: 50%;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    backdrop-filter: blur(10px);
+  }
+
+  .robot-icon {
+    font-size: 32px;
+    animation: float 3s ease-in-out infinite;
+  }
+
+  .header-info {
+    h1 {
+      margin: 0;
+      color: white;
+      font-size: 28px;
+      font-weight: 600;
+      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+    }
+
+    .subtitle {
+      margin: 4px 0 0 0;
+      color: rgba(255, 255, 255, 0.9);
+      font-size: 14px;
+    }
+  }
+
+  .header-actions {
+    .icon-btn {
+      width: 40px;
+      height: 40px;
+      background: rgba(255, 255, 255, 0.2);
+      border: none;
+      border-radius: 50%;
+      cursor: pointer;
+      font-size: 20px;
+      transition: all 0.3s;
+      backdrop-filter: blur(10px);
+
+      &:hover {
+        background: rgba(255, 255, 255, 0.3);
+        transform: scale(1.1);
+      }
+    }
+  }
+}
+
+// 模块切换标签
+.module-tabs {
+  display: flex;
+  gap: 12px;
+  margin-bottom: 24px;
+  background: white;
+  padding: 8px;
+  border-radius: 12px;
+  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
+
+  .tab-btn {
+    flex: 1;
+    padding: 12px 20px;
+    background: transparent;
+    border: none;
+    border-radius: 8px;
+    cursor: pointer;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    gap: 8px;
+    font-size: 15px;
+    font-weight: 500;
+    color: #666;
+    transition: all 0.3s;
+
+    .tab-icon {
+      font-size: 20px;
+    }
+
+    &:hover {
+      background: #f5f5f5;
+    }
+
+    &.active {
+      background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
+      color: white;
+      box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
+    }
+  }
+}
+
+// 主内容区域
+.assistant-content {
+  background: white;
+  border-radius: 16px;
+  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
+  overflow: hidden;
+}
+
+// ========== 智能对话模块 ==========
+.chat-module {
+  display: flex;
+  flex-direction: column;
+  height: calc(100vh - 280px);
+}
+
+// 快捷问题
+.quick-questions {
+  padding: 24px;
+  border-bottom: 1px solid #f0f0f0;
+
+  .section-title {
+    display: flex;
+    align-items: center;
+    gap: 8px;
+    margin: 0 0 16px 0;
+    font-size: 18px;
+    font-weight: 600;
+    color: #333;
+
+    .title-icon {
+      font-size: 24px;
+    }
+  }
+
+  .questions-grid {
+    display: grid;
+    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
+    gap: 12px;
+  }
+
+  .question-card {
+    background: linear-gradient(135deg, #f8f9fa 0%, #e8f5e9 100%);
+    border: 2px solid transparent;
+    border-radius: 12px;
+    padding: 16px;
+    cursor: pointer;
+    transition: all 0.3s;
+    display: flex;
+    flex-direction: column;
+    align-items: flex-start;
+    gap: 8px;
+    text-align: left;
+
+    .question-icon {
+      font-size: 24px;
+    }
+
+    .question-text {
+      font-size: 14px;
+      font-weight: 500;
+      color: #333;
+      line-height: 1.4;
+    }
+
+    .question-category {
+      font-size: 12px;
+      color: #4CAF50;
+      background: rgba(76, 175, 80, 0.1);
+      padding: 2px 8px;
+      border-radius: 4px;
+    }
+
+    &:hover {
+      border-color: #4CAF50;
+      box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
+      transform: translateY(-2px);
+    }
+  }
+}
+
+// 消息容器
+.messages-container {
+  flex: 1;
+  overflow-y: auto;
+  padding: 24px;
+  background: #fafafa;
+
+  &::-webkit-scrollbar {
+    width: 6px;
+  }
+
+  &::-webkit-scrollbar-thumb {
+    background: #ccc;
+    border-radius: 3px;
+  }
+}
+
+// 消息样式
+.message {
+  margin-bottom: 20px;
+  animation: slideIn 0.3s ease-out;
+
+  .message-wrapper {
+    display: flex;
+    gap: 12px;
+    max-width: 80%;
+  }
+
+  &.ai-message .message-wrapper {
+    justify-content: flex-start;
+  }
+
+  &.user-message .message-wrapper {
+    justify-content: flex-end;
+    margin-left: auto;
+  }
+
+  .avatar {
+    width: 40px;
+    height: 40px;
+    border-radius: 50%;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    font-size: 20px;
+    flex-shrink: 0;
+
+    &.ai-avatar {
+      background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
+    }
+
+    &.user-avatar {
+      background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
+    }
+  }
+
+  .message-content {
+    flex: 1;
+    display: flex;
+    flex-direction: column;
+    gap: 8px;
+  }
+
+  .message-bubble {
+    padding: 12px 16px;
+    border-radius: 12px;
+    word-wrap: break-word;
+  }
+
+  &.ai-message .message-bubble {
+    background: white;
+    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
+  }
+
+  &.user-message .message-bubble {
+    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
+    color: white;
+  }
+
+  .message-text {
+    line-height: 1.6;
+    white-space: pre-wrap;
+  }
+
+  .message-time {
+    font-size: 12px;
+    color: #999;
+    padding: 0 4px;
+  }
+
+  // 建议按钮
+  .suggestions {
+    display: flex;
+    flex-wrap: wrap;
+    gap: 8px;
+  }
+
+  .suggestion-btn {
+    padding: 6px 12px;
+    background: white;
+    border: 1px solid #4CAF50;
+    border-radius: 16px;
+    color: #4CAF50;
+    font-size: 13px;
+    cursor: pointer;
+    transition: all 0.3s;
+
+    &:hover {
+      background: #4CAF50;
+      color: white;
+      transform: scale(1.05);
+    }
+  }
+
+  // 附件
+  .attachments {
+    margin-top: 8px;
+    display: flex;
+    flex-direction: column;
+    gap: 8px;
+  }
+
+  .attachment-item {
+    display: flex;
+    align-items: center;
+    gap: 8px;
+    padding: 8px;
+    background: rgba(255, 255, 255, 0.2);
+    border-radius: 8px;
+
+    .file-icon {
+      font-size: 24px;
+    }
+
+    .file-info {
+      flex: 1;
+      .file-name {
+        font-size: 13px;
+        font-weight: 500;
+      }
+      .file-size {
+        font-size: 11px;
+        opacity: 0.8;
+      }
+    }
+  }
+}
+
+// 打字指示器
+.typing-indicator {
+  display: flex;
+  gap: 4px;
+  padding: 4px 0;
+
+  span {
+    width: 8px;
+    height: 8px;
+    background: #4CAF50;
+    border-radius: 50%;
+    animation: bounce 1.4s infinite;
+
+    &:nth-child(2) {
+      animation-delay: 0.2s;
+    }
+
+    &:nth-child(3) {
+      animation-delay: 0.4s;
+    }
+  }
+}
+
+// 输入区域
+.input-area {
+  border-top: 1px solid #f0f0f0;
+  padding: 16px 24px;
+  background: white;
+
+  .attached-files {
+    margin-bottom: 12px;
+    display: flex;
+    flex-wrap: wrap;
+    gap: 8px;
+  }
+
+  .file-preview {
+    display: flex;
+    align-items: center;
+    gap: 8px;
+    padding: 8px 12px;
+    background: #f5f5f5;
+    border-radius: 8px;
+    font-size: 13px;
+
+    .file-icon {
+      font-size: 20px;
+    }
+
+    .file-info {
+      flex: 1;
+      .file-name {
+        font-weight: 500;
+        color: #333;
+      }
+      .file-size {
+        font-size: 11px;
+        color: #999;
+      }
+    }
+
+    .remove-file {
+      background: none;
+      border: none;
+      cursor: pointer;
+      font-size: 14px;
+      opacity: 0.6;
+      transition: opacity 0.3s;
+
+      &:hover {
+        opacity: 1;
+      }
+    }
+  }
+
+  .input-wrapper {
+    display: flex;
+    align-items: center;
+    gap: 12px;
+  }
+
+  .action-btn {
+    width: 40px;
+    height: 40px;
+    background: #f5f5f5;
+    border: none;
+    border-radius: 50%;
+    cursor: pointer;
+    font-size: 20px;
+    transition: all 0.3s;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+
+    &:hover {
+      background: #e0e0e0;
+      transform: scale(1.1);
+    }
+
+    &.voice-btn.recording {
+      background: #f44336;
+      animation: pulse 1s infinite;
+
+      .recording-indicator {
+        display: flex;
+        align-items: center;
+        gap: 4px;
+        color: white;
+        font-size: 12px;
+        font-weight: 600;
+
+        .pulse {
+          width: 8px;
+          height: 8px;
+          background: white;
+          border-radius: 50%;
+          animation: pulse 1s infinite;
+        }
+      }
+    }
+  }
+
+  .message-input {
+    flex: 1;
+    padding: 12px 16px;
+    border: 2px solid #e0e0e0;
+    border-radius: 24px;
+    font-size: 14px;
+    outline: none;
+    transition: border-color 0.3s;
+
+    &:focus {
+      border-color: #4CAF50;
+    }
+
+    &:disabled {
+      background: #f5f5f5;
+      cursor: not-allowed;
+    }
+  }
+
+  .send-btn {
+    padding: 10px 24px;
+    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
+    color: white;
+    border: none;
+    border-radius: 24px;
+    font-size: 14px;
+    font-weight: 600;
+    cursor: pointer;
+    display: flex;
+    align-items: center;
+    gap: 8px;
+    transition: all 0.3s;
+
+    &:hover:not(:disabled) {
+      box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
+      transform: translateY(-2px);
+    }
+
+    &:disabled {
+      opacity: 0.5;
+      cursor: not-allowed;
+    }
+
+    .send-icon {
+      font-size: 16px;
+    }
+  }
+}
+
+// ========== 智能洞察模块 ==========
+.insights-module {
+  padding: 32px;
+
+  .module-header {
+    margin-bottom: 32px;
+    text-align: center;
+
+    h2 {
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      gap: 12px;
+      margin: 0 0 8px 0;
+      font-size: 28px;
+      color: #333;
+
+      .header-icon {
+        font-size: 32px;
+      }
+    }
+
+    .header-desc {
+      margin: 0;
+      color: #666;
+      font-size: 14px;
+    }
+  }
+
+  .insights-grid {
+    display: grid;
+    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
+    gap: 20px;
+    margin-bottom: 32px;
+  }
+
+  .insight-card {
+    background: white;
+    border: 2px solid #e0e0e0;
+    border-radius: 16px;
+    padding: 24px;
+    transition: all 0.3s;
+
+    &.warning {
+      border-color: #FF9800;
+      background: linear-gradient(135deg, #fff3e0 0%, #ffffff 100%);
+    }
+
+    &.info {
+      border-color: #2196F3;
+      background: linear-gradient(135deg, #e3f2fd 0%, #ffffff 100%);
+    }
+
+    &.success {
+      border-color: #4CAF50;
+      background: linear-gradient(135deg, #e8f5e9 0%, #ffffff 100%);
+    }
+
+    &:hover {
+      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
+      transform: translateY(-4px);
+    }
+
+    .insight-header {
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      margin-bottom: 12px;
+
+      .insight-icon {
+        font-size: 32px;
+      }
+
+      .insight-type {
+        padding: 4px 12px;
+        border-radius: 12px;
+        font-size: 12px;
+        font-weight: 600;
+      }
+    }
+
+    &.warning .insight-type {
+      background: #FF9800;
+      color: white;
+    }
+
+    &.info .insight-type {
+      background: #2196F3;
+      color: white;
+    }
+
+    &.success .insight-type {
+      background: #4CAF50;
+      color: white;
+    }
+
+    .insight-title {
+      margin: 0 0 12px 0;
+      font-size: 20px;
+      font-weight: 600;
+      color: #333;
+    }
+
+    .insight-description {
+      margin: 0 0 20px 0;
+      color: #666;
+      line-height: 1.6;
+    }
+
+    .insight-actions {
+      display: flex;
+      gap: 12px;
+    }
+
+    .insight-btn {
+      flex: 1;
+      padding: 10px 20px;
+      border: none;
+      border-radius: 8px;
+      font-size: 14px;
+      font-weight: 600;
+      cursor: pointer;
+      transition: all 0.3s;
+
+      &.primary {
+        background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
+        color: white;
+
+        &:hover {
+          box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
+          transform: translateY(-2px);
+        }
+      }
+    }
+  }
+
+  .insights-footer {
+    text-align: center;
+  }
+
+  .consult-btn {
+    padding: 14px 32px;
+    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
+    color: white;
+    border: none;
+    border-radius: 24px;
+    font-size: 15px;
+    font-weight: 600;
+    cursor: pointer;
+    display: inline-flex;
+    align-items: center;
+    gap: 8px;
+    transition: all 0.3s;
+
+    span {
+      font-size: 20px;
+    }
+
+    &:hover {
+      box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
+      transform: translateY(-2px);
+    }
+  }
+}
+
+// ========== 政策推荐模块 ==========
+.policies-module {
+  padding: 32px;
+
+  .module-header {
+    margin-bottom: 32px;
+    text-align: center;
+
+    h2 {
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      gap: 12px;
+      margin: 0 0 8px 0;
+      font-size: 28px;
+      color: #333;
+
+      .header-icon {
+        font-size: 32px;
+      }
+    }
+
+    .header-desc {
+      margin: 0;
+      color: #666;
+      font-size: 14px;
+    }
+  }
+
+  .policies-grid {
+    display: grid;
+    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
+    gap: 24px;
+    margin-bottom: 32px;
+  }
+
+  .policy-card {
+    background: white;
+    border: 2px solid #e0e0e0;
+    border-radius: 16px;
+    padding: 28px;
+    transition: all 0.3s;
+
+    &:hover {
+      border-color: #4CAF50;
+      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
+      transform: translateY(-4px);
+    }
+
+    .policy-header {
+      display: flex;
+      justify-content: space-between;
+      align-items: flex-start;
+      margin-bottom: 16px;
+
+      .policy-title {
+        margin: 0;
+        font-size: 22px;
+        font-weight: 600;
+        color: #333;
+        flex: 1;
+      }
+
+      .policy-status {
+        padding: 6px 14px;
+        border-radius: 16px;
+        font-size: 13px;
+        font-weight: 600;
+        white-space: nowrap;
+        margin-left: 12px;
+
+        &.status-available {
+          background: #4CAF50;
+          color: white;
+        }
+
+        &.status-applied {
+          background: #2196F3;
+          color: white;
+        }
+
+        &.status-expired {
+          background: #9E9E9E;
+          color: white;
+        }
+      }
+    }
+
+    .policy-description {
+      margin: 0 0 20px 0;
+      color: #666;
+      line-height: 1.6;
+      font-size: 14px;
+    }
+
+    .policy-details {
+      display: grid;
+      grid-template-columns: 1fr 1fr;
+      gap: 16px;
+      margin-bottom: 20px;
+      padding: 16px;
+      background: #f8f9fa;
+      border-radius: 12px;
+
+      .detail-item {
+        display: flex;
+        flex-direction: column;
+        gap: 4px;
+
+        .detail-label {
+          font-size: 13px;
+          color: #666;
+        }
+
+        .detail-value {
+          font-size: 16px;
+          font-weight: 600;
+          color: #333;
+        }
+      }
+    }
+
+    .policy-requirements {
+      margin-bottom: 20px;
+      padding: 16px;
+      background: #e8f5e9;
+      border-radius: 12px;
+
+      .requirements-title {
+        font-size: 14px;
+        font-weight: 600;
+        color: #2E7D32;
+        margin-bottom: 8px;
+      }
+
+      .requirements-list {
+        margin: 0;
+        padding-left: 20px;
+
+        li {
+          color: #666;
+          font-size: 13px;
+          line-height: 1.8;
+        }
+      }
+    }
+
+    .policy-actions {
+      display: flex;
+      gap: 12px;
+    }
+
+    .policy-btn {
+      flex: 1;
+      padding: 12px 20px;
+      border: none;
+      border-radius: 8px;
+      font-size: 14px;
+      font-weight: 600;
+      cursor: pointer;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      gap: 6px;
+      transition: all 0.3s;
+
+      span {
+        font-size: 16px;
+      }
+
+      &.primary {
+        background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
+        color: white;
+
+        &:hover:not(:disabled) {
+          box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
+          transform: translateY(-2px);
+        }
+
+        &:disabled {
+          opacity: 0.6;
+          cursor: not-allowed;
+        }
+      }
+
+      &.secondary {
+        background: white;
+        border: 2px solid #4CAF50;
+        color: #4CAF50;
+
+        &:hover {
+          background: #f1f8f4;
+        }
+      }
+    }
+  }
+
+  .policies-footer {
+    text-align: center;
+  }
+
+  .consult-btn {
+    padding: 14px 32px;
+    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
+    color: white;
+    border: none;
+    border-radius: 24px;
+    font-size: 15px;
+    font-weight: 600;
+    cursor: pointer;
+    display: inline-flex;
+    align-items: center;
+    gap: 8px;
+    transition: all 0.3s;
+
+    span {
+      font-size: 20px;
+    }
+
+    &:hover {
+      box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
+      transform: translateY(-2px);
+    }
+  }
+}
+
+// ========== 动画 ==========
+@keyframes slideIn {
+  from {
+    opacity: 0;
+    transform: translateY(20px);
+  }
+  to {
+    opacity: 1;
+    transform: translateY(0);
+  }
+}
+
+@keyframes float {
+  0%, 100% {
+    transform: translateY(0);
+  }
+  50% {
+    transform: translateY(-10px);
+  }
+}
+
+@keyframes bounce {
+  0%, 60%, 100% {
+    transform: translateY(0);
+  }
+  30% {
+    transform: translateY(-10px);
+  }
+}
+
+@keyframes pulse {
+  0%, 100% {
+    opacity: 1;
+    transform: scale(1);
+  }
+  50% {
+    opacity: 0.7;
+    transform: scale(0.95);
+  }
+}
+
+// ========== 响应式 ==========
+@media (max-width: 768px) {
+  .ai-assistant-container {
+    padding: 12px;
+  }
+
+  .assistant-header {
+    padding: 16px 20px;
+
+    .icon-wrapper {
+      width: 48px;
+      height: 48px;
+    }
+
+    .robot-icon {
+      font-size: 24px;
+    }
+
+    .header-info h1 {
+      font-size: 20px;
+    }
+
+    .subtitle {
+      font-size: 12px;
+    }
+  }
+
+  .assistant-header {
+    .back-btn {
+      padding: 8px 16px;
+      font-size: 14px;
+
+      .back-text {
+        display: none;
+      }
+
+      .back-icon {
+        font-size: 18px;
+      }
+    }
+  }
+
+  .module-tabs {
+    .tab-btn {
+      padding: 10px 12px;
+      font-size: 13px;
+
+      .tab-label {
+        display: none;
+      }
+    }
+  }
+
+  .quick-questions .questions-grid {
+    grid-template-columns: repeat(2, 1fr);
+  }
+
+  .insights-grid,
+  .policies-grid {
+    grid-template-columns: 1fr;
+  }
+
+  .message .message-wrapper {
+    max-width: 90%;
+  }
+}
+

+ 358 - 5
src/app/business/ai-operations-assistant/ai-operations-assistant.ts

@@ -1,14 +1,367 @@
-import { Component } from '@angular/core';
+import { Component, OnInit, ViewChild, ElementRef, Pipe, PipeTransform } from '@angular/core';
 import { CommonModule } from '@angular/common';
-import { RouterModule } from '@angular/router';
+import { RouterModule, Router } from '@angular/router';
+import { FormsModule } from '@angular/forms';
+import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
+
+// 换行符转HTML管道
+@Pipe({
+  name: 'nl2br',
+  standalone: true
+})
+export class Nl2brPipe implements PipeTransform {
+  constructor(private sanitizer: DomSanitizer) {}
+
+  transform(value: string): SafeHtml {
+    if (!value) return '';
+    const html = value.replace(/\n/g, '<br>');
+    return this.sanitizer.bypassSecurityTrustHtml(html);
+  }
+}
+
+interface Message {
+  id: string;
+  content: string;
+  sender: 'user' | 'ai';
+  timestamp: Date;
+  attachments?: FileAttachment[];
+  suggestions?: string[];
+}
+
+interface FileAttachment {
+  name: string;
+  size: number;
+  type: string;
+  url?: string;
+}
+
+interface QuickQuestion {
+  icon: string;
+  text: string;
+  category: string;
+}
+
+interface Insight {
+  id: string;
+  title: string;
+  description: string;
+  type: 'warning' | 'info' | 'success';
+  icon: string;
+  action?: string;
+  route?: string;
+}
+
+interface Policy {
+  id: string;
+  title: string;
+  description: string;
+  amount: string;
+  deadline: string;
+  status: 'available' | 'applied' | 'expired';
+  requirements: string[];
+}
 
 @Component({
   selector: 'app-ai-operations-assistant',
   standalone: true,
-  imports: [CommonModule, RouterModule],
+  imports: [CommonModule, RouterModule, FormsModule, Nl2brPipe],
   templateUrl: './ai-operations-assistant.html',
   styleUrl: './ai-operations-assistant.scss'
 })
-export class AiOperationsAssistant {
-  constructor() {}
+export class AiOperationsAssistant implements OnInit {
+  @ViewChild('messageContainer') messageContainer!: ElementRef;
+  @ViewChild('fileInput') fileInput!: ElementRef;
+
+  // 当前激活的模块
+  activeModule: 'chat' | 'insights' | 'policies' = 'chat';
+
+  // 聊天相关
+  messages: Message[] = [];
+  userInput = '';
+  isTyping = false;
+  isRecording = false;
+  recordingTime = 0;
+  recordingInterval: any;
+
+  // 文件上传
+  attachedFiles: FileAttachment[] = [];
+
+  // 快捷问题
+  quickQuestions: QuickQuestion[] = [
+    { icon: '📊', text: '本月哪个品类利润最高?', category: '数据分析' },
+    { icon: '📈', text: '预测下周的回收量', category: '趋势预测' },
+    { icon: '⚙️', text: '分析3号设备的运行效率', category: '设备监控' },
+    { icon: '💰', text: '查看本月收入趋势', category: '财务分析' },
+    { icon: '🚨', text: '显示所有未处理预警', category: '预警管理' },
+    { icon: '👥', text: '优化人员调度建议', category: '人员管理' }
+  ];
+
+  // 智能洞察
+  insights: Insight[] = [
+    {
+      id: '1',
+      title: '价格波动预警',
+      description: '塑料回收价格上涨15%,建议调整收购策略',
+      type: 'warning',
+      icon: '⚠️',
+      route: '/business/data-reports'
+    },
+    {
+      id: '2',
+      title: '设备维护提醒',
+      description: '3号设备运行156小时,建议本周末进行保养',
+      type: 'info',
+      icon: 'ℹ️',
+      route: '/business/device-management'
+    },
+    {
+      id: '3',
+      title: '运营效率优化',
+      description: '优化回收路线可节省20%运输成本',
+      type: 'success',
+      icon: '✅',
+      action: 'optimize-route'
+    }
+  ];
+
+  // 政策推荐
+  policies: Policy[] = [
+    {
+      id: '1',
+      title: '绿色回收企业补贴',
+      description: '符合条件的回收企业可申请政府补贴,用于设备升级和运营支持',
+      amount: '¥50,000 - ¥200,000',
+      deadline: '2025年12月31日',
+      status: 'available',
+      requirements: ['年回收量≥500吨', '环保资质齐全', '无违规记录']
+    },
+    {
+      id: '2',
+      title: '智能化改造专项资金',
+      description: '支持企业进行智能化、数字化改造的专项资金',
+      amount: '¥100,000 - ¥500,000',
+      deadline: '2025年11月30日',
+      status: 'available',
+      requirements: ['投资额≥50万', '技术方案审核通过', '3年内完成改造']
+    }
+  ];
+
+  constructor(private router: Router) {}
+
+  ngOnInit() {
+    // 初始化欢迎消息
+    this.addAIMessage(
+      '您好!我是您的AI运营助手。我可以帮您分析数据、预测趋势、优化运营,还能推荐适合的政策补贴。有什么我可以帮您的吗?',
+      ['查看数据分析', '预测回收量', '设备效率分析', '政策推荐']
+    );
+  }
+
+  // 切换模块
+  switchModule(module: 'chat' | 'insights' | 'policies') {
+    this.activeModule = module;
+  }
+
+  // 发送消息
+  sendMessage() {
+    if (!this.userInput.trim() && this.attachedFiles.length === 0) return;
+
+    const message: Message = {
+      id: Date.now().toString(),
+      content: this.userInput,
+      sender: 'user',
+      timestamp: new Date(),
+      attachments: this.attachedFiles.length > 0 ? [...this.attachedFiles] : undefined
+    };
+
+    this.messages.push(message);
+    this.userInput = '';
+    this.attachedFiles = [];
+
+    // 滚动到底部
+    setTimeout(() => this.scrollToBottom(), 100);
+
+    // AI回复
+    this.isTyping = true;
+    setTimeout(() => {
+      this.generateAIResponse(message.content);
+      this.isTyping = false;
+    }, 1500);
+  }
+
+  // 生成AI回复
+  generateAIResponse(userMessage: string) {
+    let response = '';
+    let suggestions: string[] = [];
+
+    // 根据关键词匹配回复
+    if (userMessage.includes('利润') || userMessage.includes('品类')) {
+      response = `📊 **本月品类利润分析**\n\n根据数据分析,纸类回收利润最高:\n\n• 纸类:¥45,820(占比38%)↑12%\n• 塑料:¥32,150(占比28%)↑8%\n• 金属:¥28,900(占比25%)↓3%\n• 玻璃:¥10,600(占比9%)→0%\n\n**建议**:加大纸类回收力度,优化塑料回收渠道。`;
+      suggestions = ['查看详细报表', '导出数据', '设置提醒'];
+    } else if (userMessage.includes('预测') || userMessage.includes('回收量')) {
+      response = `📈 **下周回收量预测**\n\n基于历史数据和AI算法预测:\n\n• 预计总量:2,850kg\n• 环比增长:+12.5%\n• 置信度:89%\n\n**详细预测**:\n周一:380kg | 周二:420kg | 周三:390kg\n周四:450kg | 周五:410kg | 周六:420kg | 周日:380kg\n\n**影响因素**:季节性上升、节假日效应`;
+      suggestions = ['查看预测详情', '调整人员安排', '优化路线'];
+    } else if (userMessage.includes('设备') || userMessage.includes('效率')) {
+      response = `⚙️ **3号设备效率分析**\n\n• 运行状态:良好 ✅\n• 处理效率:92.5%(高于平均8%)\n• 运行时长:156小时\n• 故障率:0.8%(低)\n\n**维护建议**:\n1. 本周末安排常规保养\n2. 更换磨损部件(预计费用¥800)\n3. 优化运行参数可提升5%效率`;
+      suggestions = ['查看设备详情', '安排维护', '查看历史记录'];
+    } else if (userMessage.includes('收入') || userMessage.includes('趋势')) {
+      response = `💰 **本月收入趋势分析**\n\n• 总收入:¥156,470\n• 环比增长:+18.5%\n• 日均收入:¥5,216\n\n**收入构成**:\n• 回收业务:¥98,200(63%)\n• 加工服务:¥42,150(27%)\n• 其他收入:¥16,120(10%)\n\n**趋势**:持续上升,预计下月可突破¥18万`;
+      suggestions = ['查看详细账单', '导出财务报表', '设置收入目标'];
+    } else if (userMessage.includes('预警') || userMessage.includes('警告')) {
+      response = `🚨 **未处理预警列表**\n\n1. **高优先级**\n   • 塑料价格异常波动(+15%)\n   • 3号设备需要保养\n\n2. **中优先级**\n   • 库存即将满载(85%)\n   • 人员调度不均衡\n\n3. **低优先级**\n   • 本周订单量下降5%\n\n**建议**:优先处理高优先级预警`;
+      suggestions = ['查看预警详情', '一键处理', '设置预警规则'];
+    } else if (userMessage.includes('人员') || userMessage.includes('调度')) {
+      response = `👥 **人员调度优化建议**\n\n**当前状况**:\n• 总人员:28人\n• 平均利用率:76%\n• 高峰时段:周三、周五\n\n**优化方案**:\n1. 周三增加2名人员(+8%效率)\n2. 周一减少1名人员(节省¥300/天)\n3. 调整班次时间(提升15%覆盖率)\n\n**预期效果**:月节省成本¥4,500,效率提升12%`;
+      suggestions = ['应用优化方案', '查看人员详情', '调整排班'];
+    } else if (userMessage.includes('分配') || userMessage.includes('订单')) {
+      response = `✅ **订单分配完成**\n\n已将XX小区的所有订单分配给张三:\n\n• 订单数量:15个\n• 预计完成时间:2天\n• 路线已优化\n\n张三将在30分钟内收到通知。`;
+      suggestions = ['查看订单详情', '调整分配', '通知客户'];
+    } else if (userMessage.includes('补贴') || userMessage.includes('政策')) {
+      response = `🎁 **可申请的补贴政策**\n\n根据您的企业情况,推荐以下政策:\n\n1. **绿色回收企业补贴**\n   金额:¥50,000 - ¥200,000\n   匹配度:95%\n\n2. **智能化改造专项资金**\n   金额:¥100,000 - ¥500,000\n   匹配度:88%\n\n**申请流程**:准备材料 → 在线提交 → 审核 → 发放`;
+      suggestions = ['查看政策详情', '开始申请', '咨询客服'];
+    } else {
+      response = `我理解您的问题了。让我为您分析一下...\n\n${userMessage}\n\n如果您需要更详细的信息,可以:\n• 查看数据报表\n• 咨询具体业务\n• 查看相关政策\n\n还有什么我可以帮您的吗?`;
+      suggestions = ['数据分析', '设备监控', '政策推荐'];
+    }
+
+    this.addAIMessage(response, suggestions);
+  }
+
+  // 添加AI消息
+  addAIMessage(content: string, suggestions?: string[]) {
+    const message: Message = {
+      id: Date.now().toString(),
+      content,
+      sender: 'ai',
+      timestamp: new Date(),
+      suggestions
+    };
+    this.messages.push(message);
+    setTimeout(() => this.scrollToBottom(), 100);
+  }
+
+  // 点击快捷问题
+  askQuickQuestion(question: string) {
+    this.userInput = question;
+    this.sendMessage();
+  }
+
+  // 点击建议按钮
+  clickSuggestion(suggestion: string) {
+    this.userInput = suggestion;
+    this.sendMessage();
+  }
+
+  // 语音输入
+  startRecording() {
+    this.isRecording = true;
+    this.recordingTime = 0;
+
+    // 模拟录音计时
+    this.recordingInterval = setInterval(() => {
+      this.recordingTime++;
+      if (this.recordingTime >= 3) {
+        this.stopRecording();
+      }
+    }, 1000);
+  }
+
+  stopRecording() {
+    this.isRecording = false;
+    clearInterval(this.recordingInterval);
+
+    // 模拟语音转文字
+    setTimeout(() => {
+      this.userInput = '本月哪个品类利润最高?';
+    }, 500);
+  }
+
+  // 文件上传
+  triggerFileUpload() {
+    this.fileInput.nativeElement.click();
+  }
+
+  onFileSelected(event: any) {
+    const files = event.target.files;
+    for (let file of files) {
+      const attachment: FileAttachment = {
+        name: file.name,
+        size: file.size,
+        type: file.type
+      };
+      this.attachedFiles.push(attachment);
+    }
+  }
+
+  removeFile(index: number) {
+    this.attachedFiles.splice(index, 1);
+  }
+
+  getFileIcon(type: string): string {
+    if (type.includes('pdf')) return '📄';
+    if (type.includes('word') || type.includes('document')) return '📝';
+    if (type.includes('excel') || type.includes('spreadsheet')) return '📊';
+    if (type.includes('image')) return '🖼️';
+    return '📎';
+  }
+
+  formatFileSize(bytes: number): string {
+    if (bytes < 1024) return bytes + ' B';
+    if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';
+    return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
+  }
+
+  // 滚动到底部
+  scrollToBottom() {
+    if (this.messageContainer) {
+      const element = this.messageContainer.nativeElement;
+      element.scrollTop = element.scrollHeight;
+    }
+  }
+
+  // 清空对话
+  clearChat() {
+    this.messages = [];
+    this.ngOnInit();
+  }
+
+  // 洞察操作
+  handleInsightAction(insight: Insight) {
+    if (insight.route) {
+      this.router.navigate([insight.route]);
+    } else if (insight.action === 'optimize-route') {
+      this.activeModule = 'chat';
+      this.userInput = '如何优化回收路线?';
+      this.sendMessage();
+    }
+  }
+
+  // 政策操作
+  viewPolicyDetails(policy: Policy) {
+    this.activeModule = 'chat';
+    this.userInput = `请详细介绍${policy.title}的申请流程`;
+    this.sendMessage();
+  }
+
+  applyPolicy(policy: Policy) {
+    if (policy.status === 'available') {
+      policy.status = 'applied';
+      this.addAIMessage(
+        `✅ 已为您准备申请材料,请查收:\n\n1. 企业营业执照\n2. 环保资质证明\n3. 近一年财务报表\n4. 回收量统计表\n\n材料准备完成后,可在政务平台提交申请。`,
+        ['下载申请表', '查看进度', '咨询客服']
+      );
+    }
+  }
+
+  getPolicyStatusText(status: string): string {
+    const statusMap: any = {
+      'available': '可申请',
+      'applied': '已申请',
+      'expired': '已过期'
+    };
+    return statusMap[status] || status;
+  }
+
+  getPolicyStatusClass(status: string): string {
+    return `status-${status}`;
+  }
 }

+ 13 - 2
src/app/business/business-module.ts

@@ -2,13 +2,24 @@ import { NgModule } from '@angular/core';
 import { CommonModule } from '@angular/common';
 
 import { BusinessRoutingModule } from './business-routing-module';
-
+import { Dashboard } from './dashboard/dashboard';
+import { OrderManagement } from './order-management/order-management';
+import { DeviceManagement } from './device-management/device-management';
+import { DataReports } from './data-reports/data-reports';
+import { AiOperationsAssistant } from './ai-operations-assistant/ai-operations-assistant';
+import { EnterpriseCenter } from './enterprise-center/enterprise-center';
 
 @NgModule({
   declarations: [],
   imports: [
     CommonModule,
-    BusinessRoutingModule
+    BusinessRoutingModule,
+    Dashboard,
+    OrderManagement,
+    DeviceManagement,
+    DataReports,
+    AiOperationsAssistant,
+    EnterpriseCenter
   ]
 })
 export class BusinessModule { }

+ 29 - 1
src/app/consumer/consumer-module.ts

@@ -10,6 +10,20 @@ import { PointsMall } from './points-mall/points-mall';
 import { EcoKnowledge } from './eco-knowledge/eco-knowledge';
 import { AiAssistant } from './ai-assistant/ai-assistant';
 import { Profile } from './profile/profile';
+import { NotificationsComponent } from './home/notifications/notifications';
+import { ArRecognitionComponent } from './home/ar-recognition/ar-recognition';
+import { DropPointsComponent } from './home/drop-points/drop-points';
+import { CollectorsComponent } from './home/collectors/collectors';
+import { ActivitiesComponent } from './home/activities/activities';
+import { AddressesComponent } from './profile/addresses/addresses';
+import { OrdersComponent } from './profile/orders/orders';
+import { FavoritesComponent } from './profile/favorites/favorites';
+import { SettingsComponent } from './profile/settings/settings';
+import { InviteFriendsComponent } from './profile/invite-friends/invite-friends';
+import { CustomerServiceComponent } from './profile/customer-service/customer-service';
+import { AboutUsPage } from './profile/about-us/about-us';
+import { UserAgreementPage } from './profile/user-agreement/user-agreement';
+import { PrivacyPolicyPage } from './profile/privacy-policy/privacy-policy';
 
 @NgModule({
   declarations: [
@@ -24,7 +38,21 @@ import { Profile } from './profile/profile';
     PointsMall,
     EcoKnowledge,
     AiAssistant,
-    Profile
+    Profile,
+    NotificationsComponent,
+    ArRecognitionComponent,
+    DropPointsComponent,
+    CollectorsComponent,
+    ActivitiesComponent,
+    AddressesComponent,
+    OrdersComponent,
+    FavoritesComponent,
+    SettingsComponent,
+    InviteFriendsComponent,
+    CustomerServiceComponent,
+    AboutUsPage,
+    UserAgreementPage,
+    PrivacyPolicyPage
   ]
 })
 export class ConsumerModule { }

+ 11 - 2
src/app/government/government-module.ts

@@ -2,13 +2,22 @@ import { NgModule } from '@angular/core';
 import { CommonModule } from '@angular/common';
 
 import { GovernmentRoutingModule } from './government-routing-module';
-
+import { SupervisionOverview } from './supervision-overview/supervision-overview';
+import { SubsidyManagement } from './subsidy-management/subsidy-management';
+import { IndustryAnalysis } from './industry-analysis/industry-analysis';
+import { AIDecisionAssistant } from './ai-decision-assistant/ai-decision-assistant';
+import { GovernmentCenter } from './government-center/government-center';
 
 @NgModule({
   declarations: [],
   imports: [
     CommonModule,
-    GovernmentRoutingModule
+    GovernmentRoutingModule,
+    SupervisionOverview,
+    SubsidyManagement,
+    IndustryAnalysis,
+    AIDecisionAssistant,
+    GovernmentCenter
   ]
 })
 export class GovernmentModule { }

Some files were not shown because too many files changed in this diff