123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- import { Component } from '@angular/core';
- import { CommonModule } from '@angular/common';
- import { RouterModule, Router } from '@angular/router';
- import { FormsModule } from '@angular/forms';
- interface Warning {
- id: string;
- type: 'violation' | 'anomaly' | 'complaint';
- title: string;
- area: string;
- time: string;
- level: 'high' | 'medium' | 'low';
- status: 'pending' | 'processing' | 'resolved';
- }
- interface AreaData {
- name: string;
- status: 'good' | 'warning' | 'critical';
- recycleVolume: number;
- accuracy: number;
- }
- @Component({
- selector: 'app-supervision-overview',
- standalone: true,
- imports: [CommonModule, RouterModule, FormsModule],
- templateUrl: './supervision-overview.html',
- styleUrl: './supervision-overview.scss'
- })
- export class SupervisionOverview {
- mapLayer: 'sites' | 'compliance' | 'policy' = 'sites';
- showWarningDetailModal = false;
- showAreaDetailModal = false;
- selectedWarning: Warning | null = null;
- selectedArea: AreaData | null = null;
-
- // 核心指标
- indicators = {
- todayRecycle: 45680,
- accuracyRate: 92.5,
- carbonReduction: 1250,
- trend: {
- recycle: '+12%',
- accuracy: '+2.5%',
- carbon: '+8%'
- }
- };
- // 区域数据
- areas: AreaData[] = [
- { name: '朝阳区', status: 'good', recycleVolume: 12500, accuracy: 95 },
- { name: '海淀区', status: 'warning', recycleVolume: 10200, accuracy: 88 },
- { name: '西城区', status: 'good', recycleVolume: 8900, accuracy: 93 },
- { name: '东城区', status: 'critical', recycleVolume: 7800, accuracy: 76 },
- { name: '丰台区', status: 'good', recycleVolume: 6280, accuracy: 91 }
- ];
- // 预警列表
- warnings: Warning[] = [
- {
- id: 'W001',
- type: 'violation',
- title: '某企业未按规定分类处理',
- area: '朝阳区',
- time: '10分钟前',
- level: 'high',
- status: 'pending'
- },
- {
- id: 'W002',
- type: 'anomaly',
- title: '海淀区回收量异常下降',
- area: '海淀区',
- time: '30分钟前',
- level: 'medium',
- status: 'processing'
- },
- {
- id: 'W003',
- type: 'complaint',
- title: '居民投诉回收点脏乱',
- area: '西城区',
- time: '1小时前',
- level: 'low',
- status: 'processing'
- },
- {
- id: 'W004',
- type: 'violation',
- title: '东城区企业超标排放',
- area: '东城区',
- time: '2小时前',
- level: 'high',
- status: 'pending'
- }
- ];
- get pendingWarnings(): number {
- return this.warnings.filter(w => w.status === 'pending').length;
- }
- get highLevelWarnings(): number {
- return this.warnings.filter(w => w.level === 'high').length;
- }
- switchMapLayer(layer: 'sites' | 'compliance' | 'policy'): void {
- this.mapLayer = layer;
- }
- getWarningIcon(type: string): string {
- const icons: {[key: string]: string} = {
- 'violation': 'fa-exclamation-circle',
- 'anomaly': 'fa-chart-line',
- 'complaint': 'fa-comment-alt'
- };
- return icons[type] || 'fa-bell';
- }
- getWarningTypeText(type: string): string {
- const types: {[key: string]: string} = {
- 'violation': '违规事件',
- 'anomaly': '异常波动',
- 'complaint': '公众投诉'
- };
- return types[type] || type;
- }
- getStatusText(status: string): string {
- const statusMap: {[key: string]: string} = {
- 'pending': '待处理',
- 'processing': '处理中',
- 'resolved': '已解决'
- };
- return statusMap[status] || status;
- }
- getLevelClass(level: string): string {
- return `level-${level}`;
- }
- getStatusClass(status: string): string {
- return `status-${status}`;
- }
- getAreaStatusClass(status: string): string {
- return `area-${status}`;
- }
- viewWarningDetail(warning: Warning): void {
- this.selectedWarning = warning;
- this.showWarningDetailModal = true;
- }
- closeWarningDetail(): void {
- this.showWarningDetailModal = false;
- this.selectedWarning = null;
- }
- viewAreaDetail(area: AreaData): void {
- this.selectedArea = area;
- this.showAreaDetailModal = true;
- }
- closeAreaDetail(): void {
- this.showAreaDetailModal = false;
- this.selectedArea = null;
- }
- handleWarning(warning: Warning): void {
- if (confirm(`确定要处理预警 "${warning.title}" 吗?`)) {
- warning.status = 'processing';
- alert('预警已标记为处理中');
- }
- }
- resolveWarning(warning: Warning): void {
- if (confirm(`确定要解决预警 "${warning.title}" 吗?`)) {
- warning.status = 'resolved';
- alert('预警已标记为已解决');
- }
- }
- goToAIAssistant(): void {
- this.router.navigate(['/government/ai-decision-assistant']);
- }
- constructor(private router: Router) {}
- }
|