import{_ as P,b as F,r as m,ai as i,e as K,o as p,c as b,p as s,q as c,n as o,F as T,A as L,y as Y,P as R,x as N,aH as U,cr as O,cs as A,E as B,i as j,k as q,j as Q,l as z,m as G,bH as J,D as W}from"./index.8d733f79.js";import{E as X}from"./el-date-picker-panel.089dbe6d.js";import{e as Z}from"./deviceAnalysis.ce7ce4e7.js";import{h as ee}from"./deviceType.30ac56e5.js";import{_ as ae}from"./index.e4159d81.js";import"./panel-time-pick.b2dd8e75.js";import"./index.28f6da25.js";const le={class:"page-content"},te={class:"page-table","element-loading-background":"rgba(0,0,0,0.4)"},oe={__name:"index",setup(ne){const{t:w}=F(),{proxy:k}=W(),y=m({loading:!1,list:[]}),_=m({loading:!1,list:[]}),a=m({factoryIds:[],factoryName:"",productKey:"",deviceTypeName:"",deviceName:"",timeRange:[i().subtract(8,"hour").format("YYYY-MM-DD HH:mm:ss"),i().format("YYYY-MM-DD HH:mm:ss")]}),S=e=>{const l=i(),u=l.subtract(30,"day").valueOf(),n=l.valueOf();return i(e).valueOf()<u||i(e).valueOf()>n},d=m({loading:!1,columns:[{prop:"factoryName",label:"factoryName"},{prop:"devicePath",label:"devicePath"},{prop:"deviceTypeName",label:"deviceTypeName"},{prop:"deviceName",label:"deviceName"},{prop:"oneLevelCount",label:"alarmLevel1"},{prop:"twoLevelCount",label:"alarmLevel2"},{prop:"threeLevelCount",label:"alarmLevel3"},{prop:"fourLevelCount",label:"alarmLevel4"}],rowData:[],sums:["\u5408\u8BA1"]}),V=()=>d.value.sums,$=()=>{y.value.loading=!0,O().then(e=>{y.value.list=e.data||[]}).finally(()=>{y.value.loading=!1})},E=()=>{_.value.loading=!0,ee().then(e=>{_.value.list=e.data||[]}).finally(()=>{_.value.loading=!1})},h=()=>{d.value.loading=!0;const e={...a.value,startTime:a.value.timeRange[0],endTime:a.value.timeRange[1]};A(e).then(l=>{if(l.data){d.value.rowData=(l.data.factoryDatas||[]).reduce((v,g)=>v.concat(g.detail||[]),[]);const{oneLevelTotal:u=0,twoLevelTotal:n=0,threeLevelTotal:r=0,fourLevelTotal:f=0}=l.data;d.value.sums=["\u5408\u8BA1","","","",u,n,r,f]}}).finally(()=>{d.value.loading=!1})},D=m(!1),H=m(null),M=m(null),x=()=>{D.value=!0;const e={...a.value,startTime:a.value.timeRange[0],endTime:a.value.timeRange[1]};Z(e).then(l=>{const u=new Blob([l]),n=document.createElement("a");n.href=URL.createObjectURL(u);const r=["\u5DE5\u5382\u8BBE\u5907\u62A5\u8B66\u6C47\u603B"];if(a.value.timeRange&&a.value.timeRange.length){const f=i(a.value.timeRange[0]).format("YYYY-MM-DD HH-mm-ss"),v=i(a.value.timeRange[1]).format("YYYY-MM-DD HH-mm-ss");r.push(`${f}~${v}`)}n.download=`${r.join("-")}.xls`,n.style.display="none",document.body.appendChild(n),n.click(),n.remove(),k.$modal.msgSuccess(w("exportSuccess"))}).finally(()=>{D.value=!1})};return K(()=>{$(),E(),h()}),(e,l)=>{const u=B,n=j,r=q,f=Q,v=X,g=z,C=G,I=J;return p(),b("div",le,[s(C,{model:o(a),inline:!0},{default:c(()=>[s(r,{label:e.$t("factory"),prop:"factoryIds"},{default:c(()=>[s(n,{ref_key:"factorySelectRef",ref:H,modelValue:o(a).factoryIds,"onUpdate:modelValue":l[0]||(l[0]=t=>o(a).factoryIds=t),placeholder:e.$t("factoryP"),clearable:"",filterable:"",multiple:"","collapse-tags":"","max-collapse-tags":1,"collapse-tags-tooltip":!0,class:"factory-select"},{default:c(()=>[(p(!0),b(T,null,L(o(y).list,t=>(p(),Y(u,{key:t.id,label:t.name,value:t.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),s(r,{label:e.$t("deviceType"),prop:"productKey"},{default:c(()=>[s(n,{ref_key:"deviceTypeSelectRef",ref:M,modelValue:o(a).productKey,"onUpdate:modelValue":l[1]||(l[1]=t=>o(a).productKey=t),filterable:"",placeholder:e.$t("deviceTypeP"),clearable:""},{default:c(()=>[(p(!0),b(T,null,L(o(_).list,t=>(p(),Y(u,{key:t.productKey,label:t.name,value:t.productKey},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),s(r,{label:e.$t("deviceName"),prop:"deviceName"},{default:c(()=>[s(f,{modelValue:o(a).deviceName,"onUpdate:modelValue":l[2]||(l[2]=t=>o(a).deviceName=t),placeholder:e.$t("deviceNameP"),maxlength:"20",style:{width:"236px"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s(r,{label:"\u65F6\u95F4\u533A\u95F4"},{default:c(()=>[s(v,{modelValue:o(a).timeRange,"onUpdate:modelValue":l[3]||(l[3]=t=>o(a).timeRange=t),"disabled-date":S,type:"datetimerange","range-separator":"-","start-placeholder":e.$t("startTime"),"end-placeholder":e.$t("endTime"),"value-format":"YYYY-MM-DD HH:mm:ss",clearable:!1,"default-time":[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)]},null,8,["modelValue","start-placeholder","end-placeholder","default-time"])]),_:1}),s(r,null,{default:c(()=>[s(g,{type:"primary",onClick:h},{default:c(()=>[R(N(e.$t("query")),1)]),_:1}),s(g,{type:"primary",onClick:x},{default:c(()=>[R(N(e.$t("export")),1)]),_:1})]),_:1})]),_:1},8,["model"]),U((p(),b("div",te,[s(o(ae),{ref:"tableRef",columns:o(d).columns,rowData:o(d).rowData,showSummary:!0,summaryMethod:V,autoQuery:!1,pagination:!1},null,8,["columns","rowData"])])),[[I,o(d).loading]])])}}},pe=P(oe,[["__scopeId","data-v-e8099054"]]);export{pe as default};
