import{av as N,aw as B}from"./index.17037962789732.js";import"./index.170379627897319.js";import"./index.170379627897327.js";import g from"./TopCard.17037962789736.js";import I from"./Card.17037962789732.js";import{a as p}from"./comm.1703796278973.js";import{h as i}from"./home.17037962789733.js";import{b as f}from"./system.1703796278973.js";import{e as A}from"./encodeQuery.1703796278973.js";import{t as J}from"./utils.1703796278973.js";import{h as F}from"./moment.1703796278973.js";import{d as q,k as r,r as E,o as Q,c as R,a as s,b as a,u as e}from"./vue.1703796278973.js";import{_ as S}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./index.170379627897333.js";import"./index.170379627897336.js";import"./index.170379627897317.js";import"./index.170379627897322.js";import"./index.170379627897323.js";import"./index.170379627897315.js";import"./index.1703796278973301.js";import"./index.1703796278973314.js";import"./index.170379627897332.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./permission.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";const _={agg:()=>f.get("/media/record/file/agg"),aggPlaying:()=>f.get("/media/channel/playing/agg"),getPlayCount:v=>f.post("/dashboard/_multi",v)},V=q({__name:"index",setup(v){const d=r([]),y=r(0);(()=>{i.deviceCount({}).then(t=>{y.value=t.result}),i.deviceCount(A({terms:{state:"online"}})).then(t=>{d.value[0]={title:"在线",value:t.result,status:"success"}}),i.deviceCount(A({terms:{state:"offline"}})).then(t=>{d.value[1]={title:"离线",value:t.result,status:"error"}})})();const h=r([]),b=r(0);(()=>{i.channelCount({}).then(t=>{b.value=t.result}),i.channelCount({terms:[{column:"status",value:"online"}]}).then(t=>{h.value[0]={title:"在线",value:t.result,status:"success"}}),i.channelCount({terms:[{column:"status$not",value:"online"}]}).then(t=>{h.value[1]={title:"离线",value:t.result,status:"error"}})})();const C=r([]),D=r(0);(()=>{_.agg().then(t=>{D.value=t.result.total,C.value=[{title:"总时长",value:J(t.result.duration),status:""}]})})();const M=r([]),x=r(0);(()=>{_.aggPlaying().then(t=>{x.value=t.result.playingTotal,M.value=[{title:"播放人数",value:t.result.playerTotal,status:""}]})})();const P=r([]),k=async t=>{let u="1h",o=12;const n=t.time.end-t.time.start,c=60*60*1e3,m=c*24,w=m*30,Y=365*m;n<=m?o=Math.abs(Math.ceil(n/c)):n>m&&n=Y&&(o=Math.abs(Math.floor(n/w)),u="1M"),_.getPlayCount([{dashboard:"media_stream",object:"play_count",measurement:"quantity",dimension:"agg",group:"playCount",params:{time:u,from:F(Number(t.time.start)).format("YYYY-MM-DD HH:mm:ss"),to:F(Number(t.time.end)).format("YYYY-MM-DD HH:mm:ss"),limit:o}}]).then(H=>{let T=[];H.result.sort((l,j)=>j.data.timestamp-l.data.timestamp).forEach(l=>{T.push({group:l.group,...l.data})}),P.value=T.map(l=>({x:l.timeString,value:l.value}))})};return(t,u)=>{const o=N,n=B,c=E("page-container");return Q(),R(c,null,{default:s(()=>[a(n,{gutter:24},{default:s(()=>[a(o,{span:6},{default:s(()=>[a(g,{title:"设备数量",img:e(p)("/media/dashboard-1.png"),footer:e(d),value:e(y)},null,8,["img","footer","value"])]),_:1}),a(o,{span:6},{default:s(()=>[a(g,{title:"通道数量",img:e(p)("/media/dashboard-2.png"),footer:e(h),value:e(b)},null,8,["img","footer","value"])]),_:1}),a(o,{span:6},{default:s(()=>[a(g,{title:"录像数量",img:e(p)("/media/dashboard-3.png"),footer:e(C),value:e(D)},null,8,["img","footer","value"])]),_:1}),a(o,{span:6},{default:s(()=>[a(g,{title:"播放中数量",tooltip:"当前正在播放的通道数量之和",img:e(p)("/media/dashboard-4.png"),footer:e(M),value:e(x)},null,8,["img","footer","value"])]),_:1}),a(o,{span:24,class:"dash-board-bottom"},{default:s(()=>[a(I,{title:"播放数量(人次)",chartData:e(P),onChange:k},null,8,["chartData"])]),_:1})]),_:1})]),_:1})}}});const Tt=S(V,[["__scopeId","data-v-437b0088"]]);export{Tt as default};