lcny-vue3-antd-admin/dist/assets/DZWZ.a3ca5c4e.js

2 lines
3.9 KiB
JavaScript

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