import{M as G,av as V,aw as J}from"./index.17037962789732.js";import"./index.170379627897319.js";import"./index.170379627897327.js";import{a as u}from"./comm.1703796278973.js";import g from"./Guide.17037962789732.js";import{h}from"./moment.1703796278973.js";import{q as S,l as Q}from"./home.17037962789732.js";import{i as T}from"./index.1703796278973314.js";import{h as D}from"./system.1703796278973.js";import{u as W}from"./permission.1703796278973.js";import{d as I,k as y,m as K,r as X,o as _,c as Y,a as r,b as i,z as e,E as Z,x as C,F as A,h as F,A as c,u as x,D as ee,V as te,G as se,H as ae,S as oe}from"./vue.1703796278973.js";import{_ as ie}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./index.170379627897332.js";import"./index.170379627897315.js";import"./index.170379627897333.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";const O=d=>(se("data-v-52841728"),d=d(),ae(),d),re={class:"home-guide"},ne=["onClick"],ce={class:"item-english"},de={class:"item-title"},le={class:"item-index"},me=["src"],pe={class:"home-statistics"},ue={class:"home-statistics-body"},he={class:"home-guide-item"},_e=O(()=>e("div",{class:"item-english"},"昨日流量统计",-1)),ve={class:"item-title"},fe={class:"item-index-echarts",style:{height:"75px",width:"110px"}},ge={class:"chart",ref:"todayFlowChart"},ye={class:"home-guide-item"},Ce=O(()=>e("div",{class:"item-english"},"物联卡",-1)),xe={class:"item-content"},be={class:"item-node-text"},we={class:"item-index-echarts",style:{height:"75px",width:"110px"}},ke={class:"chart",ref:"iotCardChart"},Pe={class:"home-body"},Ee={class:"home-body-img"},Se=["src"],Te=I({name:"IotCardHome"}),De=I({...Te,setup(d){const{proxy:b}=oe(),v=D(),l=D().hasPermission,w=W().hasPermission;l("iot-card/Dashboard"),l("iot-card/Platform/Detail");const M=l("iot-card/Record");l("iot-card/CardManagement");const N=w("iot-card/Platform:add"),B=w("iot-card/CardManagement:add"),R={1:u("/home/1.png"),2:u("/home/2.png"),3:u("/home/3.png")},f=[{key:"EQUIPMENT",name:"平台对接",english:"STEP1",auth:N,url:"iot-card/Platform/Detail"},{key:"SCREEN",name:"物联卡管理",english:"STEP2",auth:!!B,url:"iot-card/CardManagement",param:{save:!0}},{key:"CASCADE",name:"操作记录",english:"STEP3",auth:!!M,url:"iot-card/Record"}],k=y(0),m=y([]),p=y([{key:"using",name:"正常",value:0,className:"normal"},{key:"toBeActivated",name:"未激活",value:0,className:"notActive"},{key:"deactivate",name:"停用",value:0,className:"stopped"}]),j=t=>{if(!t.auth){G.warning("暂无权限,请联系管理员");return}if(t.key==="EQUIPMENT")v.jumpPage(t.url,{id:":id"});else{let s;t.key==="SCREEN"&&(s={type:"add"}),v.jumpPage(t.url,s)}},z=()=>{v.jumpPage("iot-card/Dashboard")},L=async()=>{const t=h().subtract(1,"days").startOf("day").valueOf(),s=h().subtract(1,"days").endOf("day").valueOf();(await S(t,s,{orderBy:"date"})).result.map(n=>{k.value+=parseFloat(n.value.toFixed(2))})},H=async()=>{const t=h().subtract(15,"days").startOf("day").valueOf(),s=h().subtract(1,"days").endOf("day").valueOf(),a=await S(t,s,{orderBy:"date"});m.value=a.result.map(n=>({...n})).reverse(),P()},$=async()=>{Promise.all(p.value.map(t=>{const s={terms:[{terms:[{column:"cardStateType",termType:"eq",value:t.key}]}]};return Q(s)})).then(t=>{t.forEach((s,a)=>{s.success&&(p.value[a].value=s.result.total)}),U()}).catch(t=>{console.log(t)})},P=()=>{const t=T(b.$refs.todayFlowChart),s={tooltip:{},xAxis:{show:!1,data:m.value.map(a=>a.date)},yAxis:{show:!1},series:[{name:"流量消耗",type:"bar",color:"#FACD89",showBackground:!0,data:m.value.map(a=>parseFloat(a.value.toFixed(2)))}]};t.setOption(s),window.addEventListener("resize",function(){t.resize()})},U=()=>{te(()=>{const t=T(b.$refs.iotCardChart),s={tooltip:{trigger:"item",formatter:"{b}: {c} ({d}%)"},color:["#85a5ff","#f29b55","#c4c4c4"],series:[{name:"",type:"pie",avoidLabelOverlap:!0,radius:["50%","90%"],center:["50%","50%"],itemStyle:{borderColor:"rgba(255,255,255,1)",borderWidth:2},label:{normal:{show:!1}},data:p.value}]};t.setOption(s),window.addEventListener("resize",function(){t.resize()})})};return K(m.value,()=>{P()},{deep:!0}),L(),H(),$(),(t,s)=>{const a=V,n=J,q=X("page-container");return _(),Y(q,null,{default:r(()=>[i(n,{gutter:[24,24]},{default:r(()=>[i(a,{xxl:14,xl:24},{default:r(()=>[e("div",re,[i(g,{title:"物联卡引导"}),e("div",{class:"home-guide-items",style:Z(`grid-template-columns: repeat(${f?f.length:1}, 1fr);`)},[(_(),C(A,null,F(f,(o,E)=>e("div",{key:E,class:"home-guide-item step-bar arrow-2 pointer",onClick:Ae=>j(o)},[e("div",ce,c(o.english),1),e("div",de,c(o.name),1),e("div",le,[e("img",{src:R[E+1]},null,8,me)])],8,ne)),64))],4)])]),_:1}),i(a,{xxl:10,xl:24},{default:r(()=>[e("div",pe,[i(g,{title:"基础统计"},{extra:r(()=>[e("span",{class:"extra-text",onClick:z},"详情")]),_:1}),e("div",ue,[e("div",he,[_e,e("div",ve,c(x(k))+" M",1),e("div",fe,[e("div",ge,null,512)])]),e("div",ye,[Ce,e("div",xe,[(_(!0),C(A,null,F(x(p),o=>(_(),C("div",{key:o.key,class:"item-node"},[e("div",be,c(o.value),1),e("div",{class:ee(`state ${o.className}`)},c(o.name),3)]))),128))]),e("div",we,[e("div",ke,null,512)])])])])]),_:1}),i(a,{span:24},{default:r(()=>[e("div",Pe,[i(g,{title:"平台架构图",english:"PLATFORM ARCHITECTURE DIAGRAM"}),e("div",Ee,[e("img",{src:x(u)("/iot-card/iotcard-home.png")},null,8,Se)])])]),_:1})]),_:1})]),_:1})}}});const st=ie(De,[["__scopeId","data-v-52841728"]]);export{st as default};