AnalyzeView.vue 12 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537
<script setup lang="ts">
/**
 * AnalyzeView - 分析模式
 * 三引擎并行分析、Forum协作研判
 */
import { ref } from 'vue'
import { DataAnalysis, ChatDotRound, Refresh, VideoPlay } from '@element-plus/icons-vue'

// Mock data
const engineStatus = ref([
  { name: 'Query', status: 'running', progress: 75, description: '深度搜索与信息检索' },
  { name: 'Media', status: 'completed', progress: 100, description: '多模态内容分析' },
  { name: 'Insight', status: 'pending', progress: 0, description: '情感分析与数据洞察' },
  { name: 'Forum', status: 'idle', progress: 0, description: '多Agent协作研判' }
])

const forumMessages = ref([
  { sender: 'Query Agent', content: '已检索到127条相关讨论,建议重点关注情感分歧点。', time: '13:42' },
  { sender: 'Media Agent', content: '视频内容分析完成,正向情感占比68%,需注意负面舆情触发因素。', time: '13:41' },
  { sender: 'Insight Agent', content: '等待Query和Media结果汇总,将进行深度情感分析。', time: '13:40' }
])

const insights = ref([
  { label: '正向情感', value: '68%', trend: '+5%', tone: 'success' },
  { label: '中性情感', value: '22%', trend: '-2%', tone: 'muted' },
  { label: '负向情感', value: '10%', trend: '-3%', tone: 'danger' }
])

function getStatusLabel(status: string) {
  switch (status) {
    case 'running': return '运行中'
    case 'completed': return '已完成'
    case 'pending': return '等待中'
    default: return '空闲'
  }
}

function getEngineStatusClass(status: string) {
  switch (status) {
    case 'running': return 'chip-warning'
    case 'completed': return 'chip-success'
    case 'pending': return 'chip-info'
    default: return 'chip-muted'
  }
}
</script>

<template>
  <div class="analyze-view stagger">
    <!-- Page Header -->
    <header class="view-header">
      <div class="view-header__left">
        <h2 class="view-title">智能分析中心</h2>
        <p class="view-desc">多引擎并行协作,深度研判舆情走向</p>
      </div>
      <div class="view-header__actions">
        <button class="btn btn-ghost">
          <el-icon><Refresh /></el-icon>
          刷新状态
        </button>
        <button class="btn btn-primary">
          <el-icon><VideoPlay /></el-icon>
          启动分析
        </button>
      </div>
    </header>

    <!-- Engine Status Grid -->
    <div class="engine-grid">
      <div 
        v-for="engine in engineStatus" 
        :key="engine.name"
        class="engine-card"
        :class="`engine-card--${engine.status}`"
      >
        <div class="engine-card__header">
          <div class="engine-card__info">
            <span class="engine-card__name">{{ engine.name }}</span>
            <span class="chip" :class="getEngineStatusClass(engine.status)">
              {{ getStatusLabel(engine.status) }}
            </span>
          </div>
          <el-icon class="engine-card__icon" :size="24">
            <DataAnalysis />
          </el-icon>
        </div>
        <p class="engine-card__desc">{{ engine.description }}</p>
        <div v-if="engine.progress > 0" class="engine-card__progress">
          <div class="progress-track">
            <div class="progress-fill" :style="{ width: `${engine.progress}%` }" />
          </div>
          <span class="progress-label">{{ engine.progress }}%</span>
        </div>
      </div>
    </div>

    <!-- Main Content -->
    <div class="content-grid">
      <!-- Forum Discussion -->
      <section class="card forum-card">
        <div class="card-header">
          <h3 class="card-title">
            <el-icon><ChatDotRound /></el-icon>
            Forum 协作讨论
          </h3>
        </div>
        <div class="card-body forum-messages">
          <div 
            v-for="(msg, idx) in forumMessages" 
            :key="idx"
            class="forum-message"
          >
            <div class="forum-message__header">
              <span class="forum-message__sender">{{ msg.sender }}</span>
              <span class="forum-message__time">{{ msg.time }}</span>
            </div>
            <p class="forum-message__content">{{ msg.content }}</p>
          </div>
        </div>
      </section>

      <!-- Quick Insights -->
      <section class="card insights-card">
        <div class="card-header">
          <h3 class="card-title">实时洞察</h3>
        </div>
        <div class="card-body">
          <div class="insights-list">
            <div 
              v-for="insight in insights" 
              :key="insight.label"
              class="insight-item"
            >
              <div class="insight-item__info">
                <span class="insight-item__label">{{ insight.label }}</span>
                <span class="insight-item__value">{{ insight.value }}</span>
              </div>
              <span class="insight-item__trend" :class="`trend--${insight.tone}`">
                {{ insight.trend }}
              </span>
            </div>
          </div>
          
          <div class="emotion-chart">
            <div class="emotion-bar">
              <div class="emotion-segment emotion-segment--positive" style="width: 68%" />
              <div class="emotion-segment emotion-segment--neutral" style="width: 22%" />
              <div class="emotion-segment emotion-segment--negative" style="width: 10%" />
            </div>
          </div>
        </div>
      </section>
    </div>

    <!-- Action Buttons -->
    <div class="action-bar">
      <button class="btn btn-accent">
        <el-icon><DataAnalysis /></el-icon>
        生成分析报告
      </button>
      <button class="btn btn-ghost">
        导出原始数据
      </button>
    </div>
  </div>
</template>

<style scoped>
.analyze-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* View Header */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.view-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--primary);
  margin: 0;
  line-height: 1.2;
}

.view-desc {
  margin: var(--space-2) 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.view-header__actions {
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* Engine Grid */
.engine-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.engine-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  transition: all var(--duration-normal) var(--ease-out);
}

.engine-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.engine-card--running {
  border-color: var(--warning);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--warning-bg) 100%);
}

.engine-card--completed {
  border-color: var(--success);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--success-bg) 100%);
}

.engine-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.engine-card__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.engine-card__name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--primary);
}

.engine-card__icon {
  color: var(--text-muted);
}

.engine-card--running .engine-card__icon {
  color: var(--warning);
}

.engine-card--completed .engine-card__icon {
  color: var(--success);
}

.engine-card__desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.engine-card__progress {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.engine-card__progress .progress-track {
  flex: 1;
}

.progress-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--space-4);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--primary);
  margin: 0;
}

.card-body {
  padding: var(--space-4);
}

/* Forum Messages */
.forum-messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.forum-message {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.forum-message__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.forum-message__sender {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.forum-message__time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.forum-message__content {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
}

/* Insights */
.insights-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.insight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
}

.insight-item__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.insight-item__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.insight-item__value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--primary);
}

.insight-item__trend {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
}

.trend--success {
  color: var(--success);
}

.trend--danger {
  color: var(--danger);
}

.trend--muted {
  color: var(--text-muted);
}

/* Emotion Chart */
.emotion-chart {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.emotion-bar {
  display: flex;
  height: 12px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--border-subtle);
}

.emotion-segment {
  height: 100%;
}

.emotion-segment--positive {
  background: var(--success);
}

.emotion-segment--neutral {
  background: var(--text-muted);
}

.emotion-segment--negative {
  background: var(--danger);
}

/* Action Bar */
.action-bar {
  display: flex;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.chip-muted {
  background: var(--primary-muted);
  color: var(--text-muted);
}

.chip-success {
  background: var(--success-bg);
  color: var(--success);
}

.chip-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.chip-info {
  background: var(--info-bg);
  color: var(--info);
}

/* Progress */
.progress-track {
  height: 6px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary-light));
  border-radius: inherit;
  transition: width 0.6s var(--ease-out);
}

/* Responsive */
@media (max-width: 1200px) {
  .engine-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .view-header {
    flex-direction: column;
  }

  .engine-grid {
    grid-template-columns: 1fr;
  }

  .action-bar {
    flex-direction: column;
  }
}
</style>