import{B as L,u as F,C as H,_ as k}from"./index-8db2df2c.js";import{L as I}from"./date-20546ee0.js";import{d as w}from"./libs-51817cd7.js";import{k as O,b as Y,v as j,w as P}from"./ui-ba7aaa7e.js";import{e as R,r as x,d as q,o as G,n as M,q as U,v as J,w as v,P as K,a3 as Q,a4 as u,f as p,a7 as y,I as X,ae as $}from"./vue-bf422dc1.js";import{b3 as Z,dd as z}from"./echarts-bf9d612c.js";import{d as V,a as ee,l as te,e as ae,k as oe,y as ne}from"./others-9f318174.js";import"./plugins-ca970193.js";import"./icons-a8498fb6.js";function D(n=100){let e=Number((Math.random()*n).toFixed(0));return e<=1&&(e=1),e}function W({dateTime:n=[],placeholderColor:e,borderColor:a}){const l=[],d=[],i=[];for(let s=0;s<10;s++){if(n.length>0){const c=(new Date(n[1]).getTime()-new Date(n[0]).getTime())/10,_=new Date(n[0]).getTime()+c*s;l.push(w(_).format("MM-DD"))}else l.push(w().subtract(10-s,"day").format("MM-DD"));d.push(D().toString()),i.push(D().toString())}return{color:L(),tooltip:{trigger:"item"},grid:{left:"0",right:"20px",top:"5px",bottom:"36px",containLabel:!0},legend:{left:"center",bottom:"0",orient:"horizontal",data:["本月","上月"],textStyle:{fontSize:12,color:e}},xAxis:{type:"category",data:l,boundaryGap:!1,axisLabel:{color:e},axisLine:{lineStyle:{width:1}}},yAxis:{type:"value",axisLabel:{color:e},splitLine:{lineStyle:{color:a}}},series:[{name:"本月",data:i,type:"line",smooth:!1,showSymbol:!0,symbol:"circle",symbolSize:8,itemStyle:{borderColor:a,borderWidth:1},areaStyle:{opacity:.1}},{name:"上月",data:d,type:"line",smooth:!1,showSymbol:!0,symbol:"circle",symbolSize:8,itemStyle:{borderColor:a,borderWidth:1}}]}}function ie({radius:n=42,textColor:e,placeholderColor:a,containerColor:t}){return{color:L(),tooltip:{show:!1,trigger:"axis",position:null},grid:{top:"0",right:"0"},legend:{selectedMode:!1,itemWidth:12,itemHeight:4,textStyle:{fontSize:12,color:a},left:"center",bottom:"0",orient:"horizontal"},series:[{name:"销售渠道",type:"pie",radius:["48%","60%"],avoidLabelOverlap:!0,selectedMode:!0,silent:!0,itemStyle:{borderColor:t,borderWidth:1},label:{show:!0,position:"center",formatter:["{value|{d}%}","{name|{b}渠道占比}"].join(`
`),rich:{value:{color:e,fontSize:28,fontWeight:"normal",lineHeight:46},name:{color:"#909399",fontSize:12,lineHeight:14}}},emphasis:{scale:!0,label:{show:!0,formatter:["{value|{d}%}","{name|{b}渠道占比}"].join(`
`),rich:{value:{color:e,fontSize:28,fontWeight:"normal",lineHeight:46},name:{color:"#909399",fontSize:14,lineHeight:14}}}},labelLine:{show:!1},data:[{value:1048,name:"线上"},{value:n*7,name:"门店"}]}]}}const re={class:"dashboard-chart-title-container"},se=R({__name:"MiddleChart",setup(n){Z([V,ee,te,ae,oe,ne]);const e=o=>{let r;if(!o||o.length===0)return r=new Date,`${r.getFullYear()}-${r.getMonth()+1}`;r=new Date(o[0]);const m=new Date(o[1]),f=r.getMonth()+1>9?r.getMonth()+1:`0${r.getMonth()+1}`,g=m.getMonth()+1>9?m.getMonth()+1:`0${m.getMonth()+1}`;return`${r.getFullYear()}-${f}  至  ${m.getFullYear()}-${g}`},a=F(),t=x(1),l=q(()=>a.chartColors);let d,i;const S=()=>{d||(d=document.getElementById("monitorContainer")),i=z(d),i.setOption(W({...l.value}))};let s,c;const _=()=>{s||(s=document.getElementById("countContainer")),c=z(s),c.setOption(ie(l.value))},C=()=>{S(),_()},h=()=>{document.documentElement.clientWidth>=1400&&document.documentElement.clientWidth<1920?t.value=Number((document.documentElement.clientWidth/2080).toFixed(2)):document.documentElement.clientWidth<1080?t.value=Number((document.documentElement.clientWidth/1080).toFixed(2)):t.value=1,i.resize({width:d.clientWidth,height:t.value*326}),c.resize({width:t.value*326,height:t.value*326})};G(()=>{C(),M(()=>{h()}),window.addEventListener("resize",h,!1)}),U(()=>{window.removeEventListener("resize",h)}),J(()=>{N(),T(),E()});const b=x(e()),T=v(()=>a.brandTheme,()=>{H([i,c])}),E=v(()=>a.isSidebarCompact,()=>{a.isSidebarCompact?M(()=>{h()}):setTimeout(()=>{h()},180)}),N=v(()=>a.mode,()=>{[i,c].forEach(o=>{o.dispose()}),C()}),A=o=>{b.value=e(o),i.setOption(W({dateTime:o,...l.value}))};return(o,r)=>{const m=O,f=Y,g=j,B=P;return K(),Q(B,{gutter:16,class:"row-container"},{default:u(()=>[p(g,{xs:12,xl:9},{default:u(()=>[p(f,{title:"统计数据",subtitle:`(万元)${b.value}`,class:"dashboard-chart-card",bordered:!1},{option:u(()=>[y("div",re,[p(m,{class:"card-date-picker-container",theme:"primary",mode:"date","default-value":X(I),onChange:A},null,8,["default-value"])])]),default:u(()=>[y("div",{id:"monitorContainer",class:"dashboard-chart-container",style:$({width:"100%",height:`${t.value*326}px`})},null,4)]),_:1},8,["subtitle"])]),_:1}),p(g,{xs:12,xl:3},{default:u(()=>[p(f,{title:"销售渠道",subtitle:b.value,class:"dashboard-chart-card",bordered:!1},{default:u(()=>[y("div",{id:"countContainer",style:$({width:`${t.value*326}px`,height:`${t.value*326}px`,margin:"0 auto"}),class:"dashboard-chart-container"},null,4)]),_:1},8,["subtitle"])]),_:1})]),_:1})}}});const _e=k(se,[["__scopeId","data-v-8a21da71"]]);export{_e as default};
