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