Files
Migu2.0/MiGu.Server/wwwroot/assets/OpsCenterView-DSZVXypR.js
T

3 lines
45 KiB
JavaScript
Raw Normal View History

2026-06-08 18:18:48 +08:00
import{aN as he,bX as Ll,bp as nl,bs as i,aE as x,c8 as t,aG as V,bL as u,aF as K,c9 as ee,b$ as Ie,aa as Tl,aK as l,ab as El,aD as n,ad as Ke,aJ as s,r as Pe,bS as $,c4 as et,aP as lt,R as Ml,bI as $e,bD as me,bC as m,ay as te,X as W,Y as tt,t as ol,ak as ke,bo as at,N as nt,G as ot,O as st,S as it,E as sl,x as ut,ai as X,bE as oe,y as dt,v as Nl,u as il,c0 as tl,e as rt,bK as Je,b4 as de,c7 as we,br as ct,Q as mt,aQ as Ye,ac as ul,a9 as dl,a8 as vt,a4 as pt,Z as ft,c5 as Ze,aM as gt,ap as _t,p as bt,q as yt,bk as wt,bH as ht,aZ as kt,a_ as Fe,bR as Qe,aR as kl,L as Ct,ca as xt,F as $t,B as Vt,C as zt,aB as St,H as Lt,a1 as Tt,a0 as Et,bj as Cl,s as Mt,at as Nt,bA as xl,bW as Ut}from"./index-D5GfLbIx.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-l0sNRNKZ.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{w as Xe}from"./workspaceToolbar-abOZ7a24.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{n as $l,C as At,c as Rt,s as Vl,d as Dt,l as Bt}from"./ConfigPageBase-CgfsngDp.js";import{r as al,b as zl,e as Ot}from"./reflection-BwOBPyb9.js";import{f as Ft}from"./monitorConfigCache-DXn96T8F.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{P as Ul}from"./PermissionGuard-CR4qtxrh.js";import{er as It,cf as Kt,ce as Pt,cg as Gt,ch as Wt,ci as jt,cj as Ht,cd as qt,c9 as el}from"./install-D_iTbSFG.js";/* empty css *//* empty css */const Jt={class:"pb-header"},Yt={class:"pb-title"},Zt={class:"pb-actions"},Qt={key:0,class:"pb-dir"},Xt={class:"pb-name"},ea={class:"pb-name-text"},la={key:0,class:"pb-filename"},ta=he({__name:"PlaybackView",setup(w){const y=Ll(),f=m(!1),U=m(!1),S=m([]),b=m(""),E=m(!1),D=m(""),F=te(()=>{const v=D.value.trim().toLowerCase();return v?S.value.filter(r=>(r.displayName||"").toLowerCase().includes(v)||r.fileName.toLowerCase().includes(v)||(r.note||"").toLowerCase().includes(v)):S.value});function B(v){return v.displayName&&v.displayName.trim()?v.displayName.trim():v.fileName}function P(v){if(!v)return"-";const r=new Date(v);return Number.isNaN(r.getTime())?v:r.toLocaleString()}function Y(v){if(!v||v<0)return"-";const r=Math.round(v/1e3),j=Math.floor(r/3600),A=Math.floor(r%3600/60),h=r%60,c=d=>String(d).padStart(2,"0");return j>0?`${c(j)}:${c(A)}:${c(h)}`:`${c(A)}:${c(h)}`}function I(v){if(!v||v<0)return"-";if(v<1024)return`${v} B`;const r=v/1024;return r<1024?`${r<10?r.toFixed(1):r.toFixed(0)} KB`:`${(r/1024).toFixed(1)} MB`}async function g(){f.value=!0;try{const v=await Xe.getState();S.value=v.recording?.entries??[],b.value=v.recording?.recordingsDirectory??"",E.value=!!v.recording?.isPlaying}catch(v){S.value=[],W.error({message:v.message||"加载录像列表失败",grouping:!0})}finally{f.value=!1}}function _(v){y.push({path:"/admin/map-monitor",query:{playback:v.fileName}})}async function M(v){try{await tt.confirm(`确认删除录像「${B(v)}」?此操作不可恢复。`,"删除录像",{type:"warning",confirmButtonText:"删除",cancelButtonText:"取消"}),await Xe.deleteRecording(v.fileName),W.success("已删除"),await g()}catch(r){if(r==="cancel"||r==="close")return;W.error(`删除失败:${r.message}`)}}async function Z(){U.value=!0;try{await Xe.stopPlayback(),W.success("已停止回放"),await g()}catch(v){W.error(`停止回放失败:${v.message}`)}finally{U.value=!1}}return nl(g),(v,r)=>{const j=Ke,A=Ml,h=Pe,c=El,d=Tl,p=ol,R=Ie;return i(),x(p,{shadow:"never",class:"playback-card"},{header:t(()=>[
`).length:0);function ve(o){return o?o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/1024/1024).toFixed(2)} MB`:"0 B"}function se(o){const e=new Date(o);return Number.isNaN(e.getTime())?o:e.toLocaleString("zh-CN",{hour12:!1})}function Ve(o){const e=new Date(o);return Number.isNaN(e.getTime())?o:e.toLocaleTimeString("zh-CN",{hour12:!1})+"."+String(e.getMilliseconds()).padStart(3,"0")}function ze(o){const e=new Date(o).getTime();return Number.isNaN(e)?0:e}const Se=te(()=>{let o=S.value?.items??[];Y.value&&(o=o.filter(z=>z.tagged));const e=P.value.trim().toLowerCase();return e&&(o=o.filter(z=>z.content.toLowerCase().includes(e)||z.tag.toLowerCase().includes(e))),[...o].sort((z,N)=>ze(N.time)-ze(z.time))});function O({row:o}){return o.tagged?"tagged-row":""}async function J(){b.value=!0;try{S.value=await ce.liveDiagnosis(),D.value=""}catch(o){D.value=`实时诊断不可用${o.message}`}finally{b.value=!1,E.value=!1}}function C(){ae(),F.value&&y.value==="live"&&(I=window.setInterval(J,B.value*1e3))}function ae(){I&&(window.clearInterval(I),I=void 0)}we([F,B],C),we(y,o=>{o==="live"?(J(),C()):ae(),o==="analyze"&&Cl(fl)});const Al=te(()=>{const o=M.value?M.value.split("/"):[],e=[{label:"log",path:""}];let z="";for(const N of o)z=z?`${z}/${N}`:N,e.push({label:N,path:z});return e}),Rl=te(()=>{const o=g.value;if(!o)return[];const e=o.dirs.map(T=>({kind:"dir",name:T.name,rel:T.rel,mtime:T.mtime,bytes:0,fileCount:T.fileCount,isLog:!1,ext:""})),z=o.files.map(T=>({kind:"file",name:T.name,rel:T.rel,mtime:T.mtime,bytes:T.bytes,fileCount:0,isLog:T.isLog,ext:T.name.includes(".")?T.name.slice(T.name.lastIndexOf(".")):""}));let N=[...e,...z];const L=Z.value.trim().toLowerCase();return L&&(N=N.filter(T=>T.name.toLowerCase().includes(L))),N});async function Le(){_.value=!0;try{g.value=await ce.browse(M.value||void 0),M.value=g.value.path}catch(o){W.error(`浏览目录失败${o.message}`)}finally{_.value=!1}}function Te(o){M.value=o,Le()}function Dl(o){o.kind==="dir"?Te(o.rel):rl(o.rel)}function rl(o){A.value=o,j.value=!0,k.value="",H.value=!1,d.value=null,p.value="",h.value=o.toLowerCase().endsWith(".log")?"structured":"raw",Ee()}async function Ee(){c.value=!0;try{h.value==="structured"?d.value=await ce.entries({file:A.value,order:"desc",limit:1e3}):p.value=await ce.raw(A.value,R.value)}catch(o){h.value==="raw"?p.value=`读取失败${o.message}`:W.error(`解析失败${o.message}`)}finally{c.value=!1}}function Bl(){(h.value==="structured"&&!d.value||h.value==="raw"&&!p.value)&&Ee()}function cl(){h.value==="structured"?d.value=null:p.value="",Ee()}const ml=te(()=>{let o=d.value?.entries??[];H.value&&(o=o.filter(z=>z.tag));const e=k.value.trim().toLowerCase();return e&&(o=o.filter(z=>z.content.toLowerCase().includes(e)||z.tag.toLowerCase().includes(e))),o}),pe=m(""),Me=m(!1),Q=m(null),Ne=m("minute"),Ce=m(""),ne=m(""),Ue=m(""),Ge=m(null),We=m(null),je=m(null);let fe=null,ge=null,_e=null;const Ae=["#7c3aed","#3b82f6","#22c55e","#f59e0b","#ef4444","#06b6d4","#ec4899","#84cc16"];function ie(o,e){return typeof window>"u"?e:getComputedStyle(document.documentElement).getPropertyValue(o).trim()||e}function He(o){return o===""?"(滚动记录)":o}const Ol=te(()=>{const o=Q.value?.timeRange;return!o?.start||!o?.end?"—":`${se(o.start)} ~ ${se(o.end)}`});async function Re(){if(pe.value){Me.value=!0;try{Q.value=await ce.analyze({file:pe.value,granularity:Ne.value,tag:Ce.value||void 0,field:ne.value||void 0,keyword:Ue.value.trim()||void 0})}catch(o){W.error(`分析失败${o.message}`)}finally{Me.value=!1}}}function vl(o){j.value=!1,pe.value=o,Ce.value="",ne.value="",Ue.value="",y.value="analyze",Re()}function Fl(o){ne.value=ne.value===o?"":o}function pl(){y.value="files"}we([Ne,Ce,ne],()=>{pe.value&&Re()});function Il(){if(!Ge.value)return;const o=Q.value;fe?.dispose(),fe=el(Ge.value,void 0,{renderer:"canvas"});const e=ie("--mg-text-muted","#909399"),z=ie("--mg-divider","rgba(255,255,255,0.08)"),N=(o?.tags??[]).slice(0,12).slice().reverse();fe.setOption({backgroundColor:"transparent",grid:{left:8,right:28,top:10,bottom:6,cont