Browse Source

「振动 CMS」按窗实时值: 窗口侧(当前时间窗/需关注/未见异常/窗口内报警工单条数) + CMS 侧(采集窗·时间范围/裁决分布/行动项/数据时点, 取 /api/vibcms); 移除门户写死的"TCM 六采集窗·320万记录·160万谱"(接口不提供记录/谱计数); 双窗对比验证通过

zhouyang.xie 6 ngày trước cách đây
mục cha
commit
58a72da41b

+ 26 - 8
app_frontEnd/web/src/lib/vib.ts

@@ -262,21 +262,39 @@ import { PORTAL_CMS_HTML } from './portalCms'
 /** ★P65 门户「振动·CMS」节 —— 作为并列子选项卡「振动 CMS」,并把门户里的**静态数字**换成
  *  **按当前时间窗实时算**的值(候选观察/全场来自 `d.fus.kpi`,当前窗来自 `d.win`),
  *  这样它和其余子选项卡一样受时间窗影响。 */
-export function portalCmsHtml(d: any): string {
+export function portalCmsHtml(d: any, cms: any): string {
   const fus = (d && d.fus) || {}
   const kpi = fus.kpi || {}
   const n = (v: any) => (typeof v === 'number' ? v : Number(v) || 0)
-  const alert = n(kpi['候选观察'] ?? kpi['定论'] ?? 0)
-  const total = n(kpi['全场'] ?? kpi['收录台'] ?? 0)
+  const alert = n(kpi['候选观察'])
+  const total = n(kpi['全场'] ?? kpi['收录台'])
   const okn = Math.max(total - alert, 0)
   const win = String((d && d.win) || '')
-  const end = String(fus['证据窗末'] || '').slice(0, 10)
+  // 窗口内报警工单条数(按窗,取 d.fus.事件.主轴.工单.总条数)
+  const ev = (((fus['事件'] || {})['主轴'] || {})['工单'] || {})
+  const tickets = n(ev['总条数'])
+  // CMS 侧(/api/vibcms):采集窗 / 时间范围 / 裁决分布 / 行动项 / 数据时点
+  const c = cms || {}
+  const grades = Array.isArray(c.grades) ? c.grades : []
+  const cnt = (g: string) => grades.filter((x: any) => String(x['综合'] || '') === g).length
+  const actions = Array.isArray(c.action) ? c.action.length : 0
+  const cmsWin = String(c['窗'] || '')
+  const cmsRange = String(c['时间范围'] || '').replace(/^\S+\s*/, '').slice(0, 60)
+  const cmsDate = String(c.date || '')
+  const chip = (cls: string, s: string) => '<span class="chip' + (cls ? ' ' + cls : '') + '">' + s + '</span>'
   let html = PORTAL_CMS_HTML
-  // 门户静态 chip → 按窗实时 chip(保持原有 class,样式不变)
+  // 移除门户里写死的静态数字句("TCM 六采集窗 · 320 万记录 · 160 万谱")——接口不提供记录/谱计数
+  html = html.replace(/<span class="chip[^"]*">TCM[^<]*<\/span>/, '')
+  // 门户原有的两个状态 chip → 按窗实时值
   html = html.replace(/(<span class="chip s al">)[^<]*/, '$1需关注 ' + alert + ' 台')
   html = html.replace(/(<span class="chip s gd">)[^<]*/, '$1未见异常 ' + okn + ' 台')
-  if (end) html = html.replace(/(<span class="chip ev">)[^<]*/, '$1证据窗末 ' + end)
-  // 追加"当前时间窗"chip —— 受时间窗影响的直接可见项
-  html = html.replace('</div>', '<span class="chip">当前时间窗 · ' + win + '</span></div>', 1)
+  const live = [
+    chip('', '当前时间窗 · ' + win),
+    chip('ev', '窗口内报警工单 · ' + tickets + ' 条'),
+    chip('', 'CMS 采集窗 ' + (cmsWin || '—') + (cmsRange ? ' · ' + cmsRange : '')),
+    chip('', 'CMS 裁决 · 优秀 ' + cnt('优秀') + ' / 良好 ' + cnt('良好') + ' / 报警 ' + cnt('报警')),
+    chip('', '行动项 ' + actions + ' 条' + (cmsDate ? ' · 数据时点 ' + cmsDate : '')),
+  ].join('')
+  html = html.replace('</div>', live + '</div>', 1)
   return html
 }

+ 1 - 1
app_frontEnd/web/src/views/Vibration.vue

@@ -39,7 +39,7 @@ const bodyHtml = computed(() => {
   if (sub.value === 'units') return unitsHtml(f, null)
   if (sub.value === 'events') return eventsHtml(f, props.d)
   if (sub.value === 'cms') return cmsHtml(cmsData.value)
-  if (sub.value === 'portal_cms') return portalCmsHtml(props.d)   // ★P65 门户「振动·CMS」(受时间窗影响)
+  if (sub.value === 'portal_cms') return portalCmsHtml(props.d, cmsData.value)   // ★P65 门户「振动·CMS」(受时间窗影响)
   return `<div class="panel mb"><p class="small muted">子视图「${t('fus.sub.' + sub.value)}」尚未迁移到 Vue(迁移中)。</p></div>`
 })
 </script>

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
release/web/assets/index-Ddmhc3Ij.js


+ 1 - 1
release/web/index.html

@@ -4,7 +4,7 @@
   <meta charset="utf-8" />
   <meta name="viewport" content="width=device-width, initial-scale=1" />
   <title>观澜 · 风电数据分析与决策支持</title>
-  <script type="module" crossorigin src="/web/assets/index-D5-fRyq9.js"></script>
+  <script type="module" crossorigin src="/web/assets/index-Ddmhc3Ij.js"></script>
   <link rel="stylesheet" crossorigin href="/web/assets/index-DFl-J_Hd.css">
 </head>
 <body>

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác