ai-decision-assistant.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { Component } from '@angular/core';
  2. import { CommonModule } from '@angular/common';
  3. import { RouterModule } from '@angular/router';
  4. import { FormsModule } from '@angular/forms';
  5. @Component({
  6. selector: 'app-ai-decision-assistant',
  7. standalone: true,
  8. imports: [CommonModule, RouterModule, FormsModule],
  9. templateUrl: './ai-decision-assistant.html',
  10. styleUrl: './ai-decision-assistant.scss'
  11. })
  12. export class AIDecisionAssistant {
  13. activeTab: 'simulator' | 'qa' | 'compliance' | 'report' = 'simulator';
  14. question = '';
  15. subsidyAmount = 5000;
  16. timeRange = '3';
  17. simulationResult: {
  18. recycleIncrease: number;
  19. budgetCost: number;
  20. carbonReduction: number;
  21. participation: number;
  22. } | null = null;
  23. qaResult = '';
  24. complianceResults = [
  25. { company: '某环保企业', risk: 'high', pattern: '异常资金流向', suggestion: '加强监管' },
  26. { company: '绿色回收公司', risk: 'medium', pattern: '回收量波动', suggestion: '核查数据' }
  27. ];
  28. switchTab(tab: 'simulator' | 'qa' | 'compliance' | 'report'): void {
  29. this.activeTab = tab;
  30. }
  31. runSimulation(): void {
  32. this.simulationResult = {
  33. recycleIncrease: 25,
  34. budgetCost: this.subsidyAmount * 100,
  35. carbonReduction: 1500,
  36. participation: 89
  37. };
  38. }
  39. askQuestion(): void {
  40. if (this.question.trim()) {
  41. this.qaResult = `AI分析结果: ${this.question} - 朝阳区准确率最高达95%,海淀区为88%,建议加强海淀区培训力度。`;
  42. }
  43. }
  44. generateReport(): void {
  45. alert('正在生成综合分析报告...');
  46. }
  47. getRiskClass(risk: string): string {
  48. return `risk-${risk}`;
  49. }
  50. constructor() {}
  51. }