2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
import{y as R,p as u,o as _,c as f,w as e,a as t,L as w,b as a,d as p,j as $,$ as I,q as z,a0 as F,z as S,s as M,F as D,u as j,n as x,r as N,l as V,e as y,t as h,J as b,a1 as U,D as W,a2 as C,a3 as G,a4 as O,a5 as H,a6 as L,V as k,f as m,G as X,a7 as q,T as A}from"./index-dc96e1be.js";import{_ as B}from"./_plugin-vue_export-helper-c27b6911.js";const E={class:"d-flex align-start mb-6"},J={class:"ml-auto z-1"},Y={class:"text-h1 font-weight-medium"},K=a("span",{class:"text-subtitle-1 text-medium-emphasis text-white"},"消息总数",-1),Q={name:"TotalMessage",components:{},props:["stat"],watch:{stat:{handler:function(s,o){this.message_total=s.message_total},deep:!0}},data:()=>({message_total:0}),mounted(){}},Z=Object.assign(Q,{setup(s){const o=R([{title:"移除",icon:U}]);return(d,c)=>{const l=u("DotsIcon");return _(),f(b,{elevation:"0",class:"bg-secondary overflow-hidden bubble-shape bubble-secondary-shape"},{default:e(()=>[t(w,null,{default:e(()=>[a("div",E,[t(p,{icon:"",rounded:"sm",color:"darksecondary",variant:"flat"},{default:e(()=>[t($,{icon:"mdi-message"})]),_:1}),a("div",J,[t(I,{"close-on-content-click":!1},{activator:e(({props:r})=>[t(p,z({icon:"",rounded:"sm",color:"secondary",variant:"flat",size:"small"},r),{default:e(()=>[t(l,{"stroke-width":"1.5",width:"20"})]),_:2},1040)]),default:e(()=>[t(F,{rounded:"md",width:"150",class:"elevation-10"},{default:e(()=>[t(S,{density:"compact"},{default:e(()=>[(_(!0),M(D,null,j(o.value,(r,n)=>(_(),f(x,{key:n,value:n},{prepend:e(()=>[(_(),f(N(r.icon),{"stroke-width":"1.5",size:"20"}))]),default:e(()=>[t(V,{class:"ml-2"},{default:e(()=>[y(h(r.title),1)]),_:2},1024)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1})])]),a("h2",Y,h(d.message_total),1),K]),_:1})]),_:1})}}}),tt={class:"d-flex align-start mb-3"},et={class:"ml-auto z-1"},at={class:"text-h1 font-weight-medium"},st=a("span",{class:"text-subtitle-1 text-medium-emphasis text-white"},"会话总数",-1),ot={class:"text-h1 font-weight-medium"},lt=a("span",{class:"text-subtitle-1 text-medium-emphasis text-white"},"会话总数",-1),nt={name:"TotalSession",components:{},props:["stat"],watch:{stat:{handler:function(s,o){this.session_total=s.session_total},deep:!0}},data:()=>({session_total:0}),mounted(){}},it=Object.assign(nt,{setup(s){const o=W("1"),d=C(()=>({chart:{type:"bar",height:90,fontFamily:"inherit",foreColor:"#a1aab2",sparkline:{enabled:!0}},dataLabels:{enabled:!1},colors:["#fff"],fill:{type:"solid",opacity:1},stroke:{curve:"smooth",width:3},yaxis:{min:0,max:100},tooltip:{theme:"dark",fixed:{enabled:!1},x:{show:!1},y:{title:{formatter:()=>"会话总数"}},marker:{show:!1}}})),c={series:[{name:"series1",data:[45,66,41,89,25,44,9,54]}]},l=C(()=>({chart:{type:"bar",height:90,fontFamily:"inherit",foreColor:"#a1aab2",sparkline:{enabled:!0}},dataLabels:{enabled:!1},colors:["#fff"],fill:{type:"solid",opacity:1},stroke:{curve:"smooth",width:3},yaxis:{min:0,max:100},tooltip:{theme:"dark",fixed:{enabled:!1},x:{show:!1},y:{title:{formatter:()=>"会话总数"}},marker:{show:!1}}})),r={series:[{name:"series1",data:[35,44,9,54,45,66,41,69]}]};return(n,i)=>{const g=u("apexchart");return _(),f(b,{elevation:"0",class:"bg-primary overflow-hidden bubble-shape bubble-primary-shape"},{default:e(()=>[t(w,null,{default:e(()=>[a("div",tt,[t(p,{icon:"",rounded:"sm",color:"darkprimary",variant:"flat"},{default:e(()=>[t($,{icon:"mdi-account-multiple-outline"})]),_:1}),a("div",et,[t(G,{modelValue:o.value,"onUpdate:modelValue":i[0]||(i[0]=v=>o.value=v),class:"theme-tab",density:"compact",end:""},{default:e(()=>[t(O,{value:"1","hide-slider":"",color:"transparent"},{default:e(()=>[y("按日")]),_:1}),t(O,{value:"2","hide-slider":"",color:"transparent"},{default:e(()=>[y("按月")]),_:1})]),_:1},8,["modelValue"])])]),t(H,{modelValue:o.value,"onUpdate:modelValue":i[1]||(i[1]=v=>o.value=v),class:"z-1"},{default:e(()=>[t(L,{value:"1"},{default:e(()=>[t(k,null,{default:e(()=>[t(m,{cols:"6"},{default:e(()=>[a("h2",at,h(n.session_total),1),st]),_:1}),t(m,{cols:"6"},{default:e(()=>[t(g,{type:"line",height:"90",options:d.value,series:c.series},null,8,["options","series"])]),_:1})]),_:1})]),_:1}),t(L,{value:"2"},{default:e(()=>[t(k,null,{default:e(()=>[t(m,{cols:"6"},{default:e(()=>[a("h2",ot,h(n.session_total),1),lt]),_:1}),t(m,{cols:"6"},{default:e(()=>[t(g,{type:"line",height:"90",options:l.value,series:r.series},null,8,["options","series"])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})}}}),rt={name:"OnlineTime",components:{},props:["stat"],watch:{stat:{handler:function(s,o){this.memory=s.sys_perf.memory,this.runtime_str=s.sys_start_time;let d=new Date().getTime(),c=new Date(s.sys_start_time*1e3).getTime(),l=d-c,r=Math.floor(l/(24*3600*1e3)),n=l%(24*3600*1e3),i=Math.floor(n/(3600*1e3)),g=n%(3600*1e3),v=Math.floor(g/(60*1e3)),T=g%(60*1e3),P=Math.round(T/1e3);this.runtime_str=r+"天"+i+"小时"+v+"分"+P+"秒"},deep:!0}},data:()=>({_stat:{},memory:"Loading",runtime_str:"Loading"}),mounted(){}},dt={class:"d-flex align-center gap-3"},ct={class:"text-h4 font-weight-medium"},ut=a("span",{class:"text-subtitle-2 text-medium-emphasis text-white"},"运行时间",-1),mt={class:"d-flex align-center gap-3"},_t={class:"text-h4 font-weight-medium"},ht=a("span",{class:"text-subtitle-2 text-disabled font-weight-medium"},"占用内存",-1);function ft(s,o,d,c,l,r){return _(),M(D,null,[t(b,{elevation:"0",class:"bg-primary overflow-hidden bubble-shape-sm bubble-primary mb-6"},{default:e(()=>[t(w,{class:"pa-5"},{default:e(()=>[a("div",dt,[t(p,{color:"darkprimary",icon:"",rounded:"sm",variant:"flat"},{default:e(()=>[t($,{icon:"mdi-clock"})]),_:1}),a("div",null,[a("h4",ct,h(s.runtime_str),1),ut]),t(X),a("div",null,[t(p,{icon:"",rounded:"sm",variant:"plain"},{default:e(()=>[t($,{color:"black",icon:"mdi-stop",size:"32"})]),_:1})])])]),_:1})]),_:1}),t(b,{elevation:"0",class:"bubble-shape-sm overflow-hidden bubble-warning"},{default:e(()=>[t(w,{class:"pa-5"},{default:e(()=>[a("div",mt,[t(p,{color:"lightwarning",icon:"",rounded:"sm",variant:"flat"},{default:e(()=>[t($,{icon:"mdi-memory"})]),_:1}),a("div",null,[a("h4",_t,h(s.memory)+" MiB",1),ht])])]),_:1})]),_:1})],64)}const pt=B(rt,[["render",ft]]),bt=a("span",{class:"text-subtitle-2 text-disabled font-weight-bold"},"上行消息总趋势",-1),gt={class:"text-h3 mt-1"},vt={class:"mt-4"},yt={name:"MessageStat",components:{},props:["stat"],data:()=>({total_cnt:0,select:{state:"Today",abbr:"FL"},items:[{state:"过去 24 小时",abbr:"FL"},{state:"更多维度待开发喵!",abbr:"GA"}],chartOptions1:{chart:{type:"bar",height:400,fontFamily:"inherit",foreColor:"#a1aab2",stacked:!0},colors:["#1e88e5","#5e35b1","#ede7f6"],responsive:[{breakpoint:400,options:{legend:{position:"bottom",offsetX:-10,offsetY:0}}}],plotOptions:{bar:{horizontal:!1,columnWidth:"50%"}},xaxis:{type:"category",categories:[]},legend:{show:!0,fontFamily:"'Roboto', sans-serif",position:"bottom",offsetX:20,labels:{useSeriesColors:!1},markers:{width:16,height:16,radius:5},itemMargin:{horizontal:15,vertical:8}},fill:{type:"solid"},dataLabels:{enabled:!1},grid:{show:!0},tooltip:{theme:"dark"}},lineChart1:{series:[{name:"消息条数",data:[]}]}}),watch:{stat:{handler:function(s,o){let d=[],c=[];for(let l=0;l<s.message.length;l++){let r=new Date(s.message[l][0]*1e3),n=r.getHours(),i=r.getMinutes();i=i<10?"0"+i:i,d.push(n+":"+i),c.push(s.message[l][1]),this.total_cnt+=s.message[l][1]}this.$refs.rtchart.updateOptions({xaxis:{categories:d},series:[{data:c}]})},deep:!0}},mounted(){}},wt=Object.assign(yt,{setup(s){return(o,d)=>{const c=u("apexchart");return _(),f(b,{elevation:"0"},{default:e(()=>[t(b,{variant:"outlined"},{default:e(()=>[t(w,null,{default:e(()=>[t(k,null,{default:e(()=>[t(m,{cols:"12",sm:"9"},{default:e(()=>[bt,a("h3",gt,h(o.total_cnt),1)]),_:1}),t(m,{cols:"12",sm:"3"},{default:e(()=>[t(q,{color:"primary",variant:"outlined","hide-details":"",modelValue:o.select,"onUpdate:modelValue":d[0]||(d[0]=l=>o.select=l),items:o.items,"item-title":"state","item-value":"abbr",label:"Select","persistent-hint":"","return-object":"","single-line":""},null,8,["modelValue","items"])]),_:1})]),_:1}),a("div",vt,[t(c,{type:"bar",height:"280",options:o.chartOptions1,series:o.lineChart1.series,ref:"rtchart"},null,8,["options","series"])])]),_:1})]),_:1})]),_:1})}}}),xt={class:"d-flex align-center"},$t=a("h4",{class:"text-h4 mt-1"},"各平台上行消息数",-1),Vt={class:"ml-auto"},kt={class:"mt-4"},Tt={class:"d-inline-flex align-center justify-space-between w-100"},St={class:"text-subtitle-1 text-medium-emphasis font-weight-bold"},Ct={class:"ml-auto text-subtitle-1 text-medium-emphasis font-weight-bold"},Mt={class:"text-center mt-3"},Dt={name:"PlatformStat",components:{},props:["stat"],watch:{stat:{handler:function(s,o){this.platforms=s.platform},deep:!0}},data:()=>({platforms:[]}),mounted(){}},Ot=Object.assign(Dt,{setup(s){return C(()=>({chart:{type:"area",height:95,fontFamily:"inherit",foreColor:"#a1aab2",sparkline:{enabled:!0}},colors:["#5e35b1"],dataLabels:{enabled:!1},stroke:{curve:"smooth",width:1},tooltip:{theme:"dark",fixed:{enabled:!1},x:{show:!1},y:{title:{formatter:()=>"消息条数 "}},marker:{show:!1}}})),(o,d)=>{const c=u("DotsIcon"),l=u("perfect-scrollbar"),r=u("ChevronRightIcon");return _(),f(b,{elevation:"0"},{default:e(()=>[t(b,{variant:"outlined"},{default:e(()=>[t(w,null,{default:e(()=>[a("div",xt,[$t,a("div",Vt,[t(I,{transition:"slide-y-transition"},{activator:e(({props:n})=>[t(p,z({color:"primary",size:"small",icon:"",rounded:"sm",variant:"text"},n),{default:e(()=>[t(c,{"stroke-width":"1.5",width:"25"})]),_:2},1040)]),default:e(()=>[t(F,{rounded:"md",width:"150",class:"elevation-10"},{default:e(()=>[t(S,null,{default:e(()=>[t(x,{value:"1"},{default:e(()=>[t(V,null,{default:e(()=>[y("今天")]),_:1})]),_:1}),t(x,{value:"2"},{default:e(()=>[t(V,null,{default:e(()=>[y("今月")]),_:1})]),_:1}),t(x,{value:"3"},{default:e(()=>[t(V,null,{default:e(()=>[y("今年")]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})])]),a("div",kt,[t(l,{style:{height:"270px"}},{default:e(()=>[t(S,{lines:"two",class:"py-0"},{default:e(()=>[(_(!0),M(D,null,j(o.platforms,(n,i)=>(_(),f(x,{key:i,value:n,color:"secondary",rounded:"sm"},{default:e(()=>[a("div",Tt,[a("div",null,[a("h6",St,h(n.name),1)]),a("div",Ct,h(n.count)+" 条",1)])]),_:2},1032,["value"]))),128))]),_:1})]),_:1}),a("div",Mt,[t(p,{color:"primary",variant:"text"},{append:e(()=>[t(r,{"stroke-width":"1.5",width:"20"})]),default:e(()=>[y("详情 ")]),_:1})])])]),_:1})]),_:1})]),_:1})}}}),Lt={name:"DefaultDashboard",components:{TotalMessage:Z,TotalSession:it,OnlineTime:pt,MessageStat:wt,PlatformStat:Ot},data:()=>({stat:{}}),mounted(){A.get("/api/stats").then(s=>{console.log("stat",s.data.data),this.stat=s.data.data})}};function It(s,o,d,c,l,r){const n=u("TotalMessage"),i=u("TotalSession"),g=u("OnlineTime"),v=u("MessageStat"),T=u("PlatformStat");return _(),f(k,null,{default:e(()=>[t(m,{cols:"12",md:"4"},{default:e(()=>[t(n,{stat:s.stat},null,8,["stat"])]),_:1}),t(m,{cols:"12",md:"4"},{default:e(()=>[t(i,{stat:s.stat},null,8,["stat"])]),_:1}),t(m,{cols:"12",md:"4"},{default:e(()=>[t(g,{stat:s.stat},null,8,["stat"])]),_:1}),t(m,{cols:"12",lg:"8"},{default:e(()=>[t(v,{stat:s.stat},null,8,["stat"])]),_:1}),t(m,{cols:"12",lg:"4"},{default:e(()=>[t(T,{stat:s.stat},null,8,["stat"])]),_:1})]),_:1})}const jt=B(Lt,[["render",It]]);export{jt as default};
|