import{u as I}from"./app-803627bb.js";import{d as _,as as w,p as S,n as B,bj as U,U as z,P as C,o as E,c as F,bk as O}from"./index-4789ca0a.js";import{c as D,a as p}from"./fun-3edebd8d.js";const H=_({__name:"Pie",props:{unit:{},size:{},percent:{},Enable:{},Used:{},Used_time:{}},setup(h){const u=h,{isDark:g}=w(),m=S(()=>g.value?"dark":"light"),l=B(null),{setOptions:f,getInstance:v,resize:x}=U(l,{theme:m});return f({tooltip:{trigger:"item"},legend:{icon:"circle",right:!0},series:[{name:"流量统计",type:"pie",top:"20%",radius:"80%",center:["50%","50%"],color:["#e6a23c","#53a7ff","#f56c6c"],data:[{value:0,name:"已使用"},{value:0,name:"未使用"},{value:0,name:"提醒值"}],emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]},{name:"click",callback:i=>{}},{type:"zrender",name:"click",callback:i=>{}}),z(()=>I().getSidebarStatus,()=>{O(600).then(()=>x())}),C(()=>{let i,a,o,n,{unit:c,size:r,percent:s,Enable:y,Used:b,Used_time:k}=u;if(y=="0")return;c=="data"?(n=b,r=D(r).toString(),i=(parseInt(r)*.02).toString(),a=(parseInt(r)*(parseInt(s)/100)).toString(),o=parseInt(r)-parseInt(n)):(n=parseInt(k)/3600,i=(parseInt(r)*.02).toString(),a=(parseInt(r)*(parseInt(s)/100)).toString(),o=parseInt(r)-parseInt(n));const d=v(),$={tooltip:{trigger:"item",formatter:function(e){var t=`${e.name}`;if(c=="data")e.name==="提醒值"?(t+=`<div style="display: flex; align-items: center;"><div style="width: 10px; height: 10px; background-color: ${e.color}; border-radius: 50%; margin-right: 5px;"></div>`,t+=`${p(a)} (${s}%)`):(t+=`<div style="display: flex; align-items: center;"><div style="width: 10px; height: 10px; background-color: ${e.color}; border-radius: 50%; margin-right: 5px;"></div>`,t+=`${p(e.value)} (${e.percent}%)`);else if(e.name==="提醒值"){t+=`<div style="display: flex; align-items: center;"><div style="width: 10px; height: 10px; background-color: ${e.color}; border-radius: 50%; margin-right: 5px;"></div>`;try{t+=`${parseInt(a).toFixed(2)}h (${s}%)`}catch{t+=`${a}h (${s}%)`}}else t+=`<div style="display: flex; align-items: center;"><div style="width: 10px; height: 10px; background-color: ${e.color}; border-radius: 50%; margin-right: 5px;"></div>`,t+=`${e.value.toFixed(2)}h (${e.percent.toFixed(2)}%)`;return t}},series:[{data:[{value:n,name:"已使用"},{value:o,name:"未使用"},{value:i,name:"提醒值"}]}]};d&&d.setOption($)}),(i,a)=>(E(),F("div",{ref_key:"pieChartRef",ref:l,style:{width:"100%",height:"35vh"}},null,512))}});export{H as _};
