2 lines
2.7 KiB
JavaScript
2 lines
2.7 KiB
JavaScript
var k=(r,i,a)=>new Promise((c,n)=>{var p=s=>{try{t(a.next(s))}catch(e){n(e)}},u=s=>{try{t(a.throw(s))}catch(e){n(e)}},t=s=>s.done?c(s.value):Promise.resolve(s.value).then(p,u);t((a=a.apply(r,i)).next())});import L from"./Box.2e00bcef.js";import{u as S}from"./useECharts.16068aa4.js";import{i as T}from"./other.cc970318.js";import{u as E}from"./visualization.c000cfc7.js";import{a as w}from"./colors.28a3398e.js";import{a as $,w as B,v as C,K as z,bq as F,L as N,aG as Z,o as d,j,z as A,i as x,h as D,F as q,aJ as G,q as I,t as M}from"./index.49914b5a.js";const P=$({components:{Box:L},setup(){const r=B([{key:"1",value:"\u9972\u6599"},{key:"2",value:"\u80A5\u6599"}]),i=B({x_axis:[],series:[]}),a=C("1"),c=E(),n=C(null),p=e=>{a.value!=e&&(a.value=e,t())},{setOptions:u}=S(n);function t(){return k(this,null,function*(){const e=yield T({year:c.getYear,type:a.value});i.x_axis=e.x_axis,i.series=e.series,s()})}const s=()=>{const e={legendData:[],series:[]};i.series.forEach(({name:l,data:_,diffs:h},o)=>{const f=w[o%w.length];e.legendData.push(l),e.series.push({name:"Placeholder",type:"bar",barGap:0,stack:"Total"+o,itemStyle:{borderColor:"transparent",color:"transparent"},data:_}),e.series.push({name:l,type:"bar",stack:"Total"+o,itemStyle:{color:f.itemColor1},label:{show:!1,position:"inside",color:"#fff"},data:h})}),u({grid:{left:"2%",right:"2%",top:"50px",bottom:"2%",containLabel:!0},legend:{show:!0,data:e.legendData,textStyle:{color:"#ffffff"}},tooltip:{trigger:"axis",axisPointer:{lineStyle:{width:1,color:"#019680"}},formatter:function(l){var h;let _=((h=l[0])==null?void 0:h.name)+"<br/>";return l.forEach((o,f)=>{var m,y,v,b,g;f%2&&(_+=o.seriesName+" : "+((y=(m=l[f-1])==null?void 0:m.value)!=null?y:0)+"-"+(Number((v=o==null?void 0:o.value)!=null?v:0)+Number((g=(b=l[f-1])==null?void 0:b.value)!=null?g:0))+"<br>")}),_}},xAxis:{type:"category",data:i.x_axis,axisTick:{show:!1},axisLine:{show:!1},axisLabel:{color:"#fff"}},yAxis:[{type:"value",axisTick:{show:!1},splitLine:{lineStyle:{type:"solid",color:"#8EEEFF",opacity:.3}},axisLabel:{color:"#fff"}}],series:e.series})};return z(()=>c.getYear,()=>{t()}),F(()=>{t()}),{tabList:r,currentTab:a,chartRef:n,changeTab:p}}}),R={class:"h-full flex flex-col"},V={class:"py-10px"},W={class:"flex items-center justify-center m-0"},Y=["onClick"],J={class:"flex-1",ref:"chartRef"};function K(r,i,a,c,n,p){const u=Z("Box");return d(),j(u,{title:"\u5927\u5B97\u7269\u8D44"},{default:A(()=>[x("div",R,[x("div",V,[x("ul",W,[(d(!0),D(q,null,G(r.tabList,t=>(d(),D("li",{class:I(["mx-11px text-white text-12px cursor-pointer",{active:r.currentTab==t.key}]),onClick:s=>r.changeTab(t.key),key:t.key},M(t.value),11,Y))),128))])]),x("div",J,null,512)])]),_:1})}var ae=N(P,[["render",K],["__scopeId","data-v-6d156848"]]);export{ae as default};
|