lcny-vue3-antd-admin/dist/assets/DZWZ.8fde25fd.js

2 lines
4.0 KiB
JavaScript

var T=(u,v,n)=>new Promise((d,p)=>{var _=s=>{try{i(n.next(s))}catch(f){p(f)}},y=s=>{try{i(n.throw(s))}catch(f){p(f)}},i=s=>s.done?d(s.value):Promise.resolve(s.value).then(_,y);i((n=n.apply(u,v)).next())});import N from"./Box.48a60aaf.js";import{u as Z}from"./useECharts.3bc533c1.js";import{k as j}from"./other.2ace3f8e.js";import{u as P}from"./visualization.e2a861b8.js";import{a as w}from"./colors.69d1b0cd.js";import{u as M}from"./useVContext.196d6a81.js";import{a as z,s as C,r as B,H as S,G as V,bp as W,af as G,J as O,aA as R,o as k,j as U,x as Y,i as b,h as A,F as H,aD as J,n as q,t as K}from"./index.d96edf17.js";import{a as Q}from"./add.b13fee16.js";const X=z({components:{Box:N},setup(){const{rootEmitter:u}=M(),v=C([{key:"1",value:"\u9972\u6599"},{key:"2",value:"\u80A5\u6599"}]),n=C({x_axis:[],series:[]}),d=B("1"),p=P(),_=B(null),y=e=>{d.value!=e&&(d.value=e,f())},{setOptions:i,getInstance:s}=Z(_);function f(e=!0){return T(this,null,function*(){const t=yield j({year:p.getYear,type:d.value});n.x_axis=t.x_axis,n.series=t.series,e?$():E()})}let h=[];function I(){const e={legendData:[],series:[]};return n.series.forEach(({name:t,data:r,diffs:l},a)=>{const c=w[a%w.length];e.legendData.push(t),e.series.push({name:"Placeholder",type:"bar",barGap:0,stack:"Total"+a,itemStyle:{borderColor:"transparent",color:"transparent"},data:r}),e.series.push({name:t,type:"bar",stack:"Total"+a,itemStyle:{color:c.itemColor1},label:{show:!1,position:"inside",color:"#fff"},data:l})}),h=e.legendData,e}const $=()=>{const e=I();i({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(t){var l;let r=((l=t[0])==null?void 0:l.name)+"<br/>";return t.forEach(a=>{var c,x;if(a.seriesName!="Placeholder"){const g=n.series.find(m=>m.name==a.seriesName);if(g){const m=(c=g.data[a.dataIndex])!=null?c:0,L=(x=g.diffs[a.dataIndex])!=null?x:0,F=Q(Number(m),Number(L));r+=`${a.marker}<span style="width:50px;display: inline-block;">${a.seriesName}</span> ${m}-${F}<br>`}}}),r}},xAxis:{type:"category",data:n.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:e.series}),p.getPlay&&D()};let o=null;function D(){let e=0;const t=3e3;o&&clearInterval(o);let r=0,l=0;const a=2;o=setInterval(()=>{var c;r=e%4,l=e%(4*a),(c=s())==null||c.dispatchAction({type:"showTip",seriesIndex:0,dataIndex:r}),l+1>=4*a&&(o&&clearInterval(o),setTimeout(()=>{var x;(x=s())==null||x.dispatchAction({type:"hideTip"})},t),f(!1)),e++},t)}function E(){const e=I();let t=0,r=0;const l=3e3;o&&clearInterval(o),o=setInterval(()=>{var a,c;r=t%h.length,r==0&&h.forEach((x,g)=>{var m;(m=s())==null||m.dispatchAction({type:"legendUnSelect",name:h[g]})}),(a=s())==null||a.setOption({series:[e.series[r]]}),(c=s())==null||c.dispatchAction({type:"legendSelect",name:h[r]}),r==h.length-1&&(o&&clearInterval(o),setTimeout(()=>{D()},l)),t++},l)}return S(()=>p.getYear,()=>{f()}),S(()=>p.getPlay,()=>{o&&clearInterval(o),f()}),V(()=>{var e,t;(t=(e=s())==null?void 0:e.getZr())==null||t.on("click",()=>{u.emit("leftModel:click","DZWZ")})}),W(()=>{f(),u.on("interval:auto",()=>{})}),G(()=>{o&&clearInterval(o)}),{tabList:v,currentTab:d,chartRef:_,changeTab:y}}}),ee={class:"h-full flex flex-col"},te={class:"py-10px"},ae={class:"flex items-center justify-center m-0"},se=["onClick"],oe={class:"flex-1",ref:"chartRef"};function re(u,v,n,d,p,_){const y=R("Box");return k(),U(y,{title:"\u5927\u5B97\u7269\u8D44\uFF08\u5143/\u5428\uFF09"},{default:Y(()=>[b("div",ee,[b("div",te,[b("ul",ae,[(k(!0),A(H,null,J(u.tabList,i=>(k(),A("li",{class:q(["mx-11px text-white text-12px cursor-pointer",{active:u.currentTab==i.key}]),onClick:s=>u.changeTab(i.key),key:i.key},K(i.value),11,se))),128))])]),b("div",oe,null,512)])]),_:1})}var he=O(X,[["render",re],["__scopeId","data-v-fb89b344"]]);export{he as default};