import{a1 as k,k as F,aR as S,aA as j}from"./index.17037962789732.js";import"./index.1703796278973303.js";import"./index.170379627897322.js";import"./index.170379627897323.js";import"./index.170379627897315.js";import"./index.1703796278973301.js";import{b as M}from"./system.1703796278973.js";import{a as c}from"./dayjs.min.1703796278973.js";import{i as T}from"./index.1703796278973314.js";import{d as D,k as h,m as v,r as Y,o as I,c as O,a as l,b as m,z as d,u as p,t as y,V as P,G as A,H as N}from"./vue.1703796278973.js";import{_ as z}from"./_plugin-vue_export-helper.1703796278973.js";const it=(t,e)=>M.post(`/data-collect/${t}/_count`,e),B=t=>M.post("/dashboard/_multi",t),g=t=>{switch(t.type){case"today":return{limit:24,interval:"1h",format:"YYYY-MM-dd HH:mm"};case"week":return{limit:7,interval:"1d",format:"YYYY-MM-dd HH:mm"};case"hour":return{limit:60,interval:"1m",format:"YYYY-MM-dd HH:mm"};default:const e=t.time[1]-t.time[0],r=60*60*1e3,a=r*24,_=a*365;return e<=r?{limit:Math.abs(Math.ceil(e/(60*60))),interval:"1m",format:"YYYY-MM-dd HH:mm"}:e>r&&e<=a?{limit:Math.abs(Math.ceil(e/r)),interval:"1h",format:"YYYY-MM-dd HH:mm"}:e>a&&e<=a*7?{limit:Math.abs(Math.ceil(e/a/7))+1,interval:"1d",format:"YYYY-MM-dd HH:mm"}:e>=_?{limit:Math.abs(Math.ceil(e/a/31))+1,interval:"1M",format:"YYYY-MM-dd HH:mm"}:{limit:Math.abs(Math.ceil(e/a))+1,interval:"1d",format:"YYYY-MM-dd HH:mm"}}},R=t=>{switch(t){case"hour":return c().subtract(1,"hours");case"week":return c().subtract(6,"days");case"month":return c().subtract(29,"days");case"year":return c().subtract(365,"days");default:return c().startOf("day")}},V=t=>[{dashboard:"collector",object:"pointData",measurement:"quantity",dimension:"agg",params:{limit:g(t.time).limit,from:Number(t.time.time[0]),to:Number(t.time.time[1]),interval:g(t.time).interval,format:"YYYY-MM-dd HH:mm"}}],q={type:"line",smooth:!0,color:"#60DFC7",areaStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#60DFC7"},{offset:1,color:"#FFFFFF"}],global:!1}}},lt={terms:[{column:"runningState",termType:"not",value:"running"}]},mt=[[{type:"channel",title:"异常通道",status:"error",label:"通道数量",value:0,total:0}],[{type:"collector",title:"异常采集器",status:"error",label:"采集器数量",value:0,total:0}],[{type:"point",title:"异常点位",status:"error",label:"采集点位",value:0,total:0}]],E=t=>(A("data-v-1990c3ca"),t=t(),N(),t),G={class:"dash-board"},U={class:"header"},$=E(()=>d("div",{class:"left"},[d("h3",{style:{width:"100px"}},"点位数据量")],-1)),L={class:"right"},J=D({__name:"Card",setup(t){const e=h({}),r=h(!1),a=h({time:{type:"hour",time:[null,null]}}),_=()=>{a.value.time.type=void 0,console.log(1)},b=async s=>{r.value=!0;const o=await B(V(s));if(o.success){const n=o.result.map(i=>i.data.timeString).reverse(),u=o.result.map(i=>i.data.value).reverse();H(n,u)}setTimeout(()=>{r.value=!1},300)},H=(s=[],o=[])=>{const n=e.value;if(n){const u=T(n),i={xAxis:{type:"category",boundaryGap:!1,data:s},yAxis:{type:"value"},grid:{left:"80px",right:"50px"},tooltip:{trigger:"axis"},color:["#979AFF"],series:[{name:"消息量",data:o,...q}]};P(()=>{u.setOption(i),window.addEventListener("resize",function(){u.resize()})})}};return v(()=>a.value.time.type,s=>{if(s===void 0)return;const o=R(s);a.value.time.time=[c(o),c(new Date)]},{immediate:!0,deep:!0}),v(()=>a.value,s=>{const{time:o}=s;(o.type||o.time[0]&&o.time[1])&&b(s)},{immediate:!0,deep:!0}),(s,o)=>{const n=k,u=F,i=Y("AIcon"),x=S,w=Y("FullPage"),C=j;return I(),O(C,{spinning:p(r)},{default:l(()=>[m(w,null,{default:l(()=>[d("div",G,[d("div",U,[$,d("div",L,[m(u,{"button-style":"solid",style:{"margin-right":"10px"},value:p(a).time.type,"onUpdate:value":o[0]||(o[0]=f=>p(a).time.type=f)},{default:l(()=>[m(n,{value:"hour"},{default:l(()=>[y(" 最近1小时 ")]),_:1}),m(n,{value:"today"},{default:l(()=>[y(" 今日 ")]),_:1}),m(n,{value:"week"},{default:l(()=>[y(" 近一周 ")]),_:1})]),_:1},8,["value"]),m(x,{allowClear:!1,"show-time":{format:"HH:mm:ss"},format:"YYYY-MM-DD HH:mm:ss",value:p(a).time.time,"onUpdate:value":o[1]||(o[1]=f=>p(a).time.time=f),onChange:_},{suffixIcon:l(()=>[m(i,{type:"CalendarOutlined"})]),_:1},8,["value"])])]),d("div",{ref_key:"chartRef",ref:e,style:{width:"100%","min-height":"350px"}},null,512)])]),_:1})]),_:1},8,["spinning"])}}});const K=z(J,[["__scopeId","data-v-1990c3ca"]]),ct=Object.freeze(Object.defineProperty({__proto__:null,default:K},Symbol.toStringTag,{value:"Module"}));export{K as C,ct as a,lt as d,it as q,mt as s};
