Files
aiot-platform-ui/apps/web-antd/dist/js/device-state-count-card-BF9LgtrD.js

2 lines
2.1 KiB
JavaScript

var y=(r,a,n)=>new Promise((o,i)=>{var h=e=>{try{f(n.next(e))}catch(c){i(c)}},p=e=>{try{f(n.throw(e))}catch(c){i(c)}},f=e=>e.done?o(e.value):Promise.resolve(e.value).then(h,p);f((n=n.apply(r,a)).next())});import{b as v}from"./chart-options-xTjDO5fl.js";import{u as C,_ as m}from"./use-echarts-DBBPKzKQ.js";import{bE as D,c0 as O,c1 as _,au as b,ac as g}from"./bootstrap-DsjPfOC_.js";import{m as E,b9 as x,aa as R,w as j,v as I,ab as w,b2 as u,bJ as l,ad as k,j as s,u as t,n as B}from"../jse/index-index-CO0ZsLf2.js";const S={key:0,class:"flex h-[300px] items-center justify-center"},G={key:1,class:"flex h-[300px] items-center justify-center"},J=E({name:"DeviceStateCountCard",__name:"device-state-count-card",props:{loading:{type:Boolean},statsData:{}},setup(r){const a=r,n=x(),o=x(),i=x(),{renderEcharts:h}=C(n),{renderEcharts:p}=C(o),{renderEcharts:f}=C(i),e=R(()=>a.statsData?a.statsData.deviceCount!==0:!1);function c(){return y(this,null,function*(){if(!e.value)return;yield B();const d=a.statsData.deviceCount||100;yield h(v(a.statsData.deviceOnlineCount,d,"#52c41a","在线设备")),yield p(v(a.statsData.deviceOfflineCount,d,"#ff4d4f","离线设备")),yield f(v(a.statsData.deviceInactiveCount,d,"#1890ff","待激活设备"))})}return j(()=>a.statsData,()=>{c()},{deep:!0}),I(()=>{c()}),(d,M)=>(u(),w(t(b),{title:"设备状态统计",loading:r.loading,class:"h-full"},{default:l(()=>[r.loading&&!e.value?(u(),k("div",S,[s(t(D),{description:"加载中..."})])):e.value?(u(),w(t(O),{key:2,class:"h-[280px]"},{default:l(()=>[s(t(_),{span:8,class:"flex items-center justify-center"},{default:l(()=>[s(t(m),{ref_key:"deviceOnlineChartRef",ref:n,class:"h-[250px] w-full"},null,512)]),_:1}),s(t(_),{span:8,class:"flex items-center justify-center"},{default:l(()=>[s(t(m),{ref_key:"deviceOfflineChartRef",ref:o,class:"h-[250px] w-full"},null,512)]),_:1}),s(t(_),{span:8,class:"flex items-center justify-center"},{default:l(()=>[s(t(m),{ref_key:"deviceInactiveChartRef",ref:i,class:"h-[250px] w-full"},null,512)]),_:1})]),_:1})):(u(),k("div",G,[s(t(D),{description:"暂无数据"})]))]),_:1},8,["loading"]))}}),z=g(J,[["__scopeId","data-v-60be0d81"]]);export{z as default};