import{a5 as F,b as O,J as $,ah as C,b1 as j,e as x,e0 as Y,cr as J,o as d,c as f,p as n,q as r,n as o,B as K,F as N,A as V,y as D,s as M,P as g,x as b,v as W,aj as H,e1 as Q,j as G,k as X,E as Z,i as ee,l as ae,m as te,D as le}from"./index.8d733f79.js";import{E as oe}from"./el-date-picker-panel.089dbe6d.js";import{u as E}from"./searchStore.0c98fb50.js";import"./panel-time-pick.b2dd8e75.js";import"./index.28f6da25.js";const ne={style:{height:"100%",display:"flex","flex-direction":"column"}},re={style:{position:"relative"},class:"f-h"},se=F({name:"sensor"}),ye=Object.assign(se,{props:{status:String},setup(w){const{t:v,locale:ue}=O(),I=[new Date(2e3,1,1,0,0,0),new Date(2e3,2,1,23,59,59)],{proxy:P}=le(),R=$.session.getJSON("enums").alarmType,S=$.session.getJSON("enums").relieveStatus,i=C({total:0,tableData:[],columns:[{prop:"collectorSn",label:"gatewaySn"},{prop:"factoryName",label:"belongTofactory"},{prop:"alarmType",label:"alarmType",formatter:e=>R.find(l=>l.key===e.alarmType).desc},{prop:"createTime",label:"alarmTime"},{prop:"alarmStatus",label:"alarmStatus",formatter:e=>S.find(l=>l.key===`${e.alarmStatus}`).desc},{prop:"removeTime",label:"alarmRemoveTime"}]}),h=C({buildingList:[],queryParams:{pageNo:1,pageSize:10,sn:"",factoryId:"",alarmStatus:"0",startTime:"",endTime:""},timeRange:["",""]}),{queryParams:a,buildingList:T,timeRange:s}=j(h);x(()=>{const e=E().getSearchCondition("autoAlarm_collector",h.queryParams);a.value={...e},s.value=[a.value.startTime,a.value.endTime],c(),z()});function c(){Y({...a.value}).then(e=>{i.tableData=e.data.content||[],i.total=e.data.totalElements||0}),E().setSearchCondition("autoAlarm_collector",a.value)}function U(){a.value.startTime=s.value?s.value[0]:"",a.value.endTime=s.value?s.value[1]:"",m()}function m(){a.value.pageNo=1,c()}function L(){a.value={pageNo:1,pageSize:10,sn:"",factoryId:"",alarmStatus:"0",startTime:"",endTime:""},s.value=["",""],m()}function z(){J().then(e=>{T.value=e.data})}function B(){Q(a.value).then(e=>{const l=new Blob([e]),u=document.createElement("a");u.href=URL.createObjectURL(l),u.download=`${v("gatewayAlarm")}.xls`,u.style.display="none",document.body.appendChild(u),u.click(),u.remove(),P.$modal.msgSuccess(v("exportSuccess"))})}return(e,l)=>{const u=G,p=X,_=Z,k=ee,q=oe,y=ae,A=te;return d(),f("div",ne,[n(A,{model:o(a),ref:"queryRef",inline:!0,style:{"padding-right":"68px"}},{default:r(()=>[n(p,{label:e.$t("gatewaySn"),prop:"deviceType"},{default:r(()=>[n(u,{modelValue:o(a).sn,"onUpdate:modelValue":l[0]||(l[0]=t=>o(a).sn=t),placeholder:e.$t("gatewaySnP"),clearable:"",style:{width:"236px"},onKeyup:K(m,["enter"])},null,8,["modelValue","placeholder","onKeyup"])]),_:1},8,["label"]),n(p,{label:e.$t("alarmStatus"),prop:"alarmStatus"},{default:r(()=>[n(k,{modelValue:o(a).alarmStatus,"onUpdate:modelValue":l[1]||(l[1]=t=>o(a).alarmStatus=t),placeholder:e.$t("alarmStatusP"),clearable:"",onChange:m},{default:r(()=>[(d(!0),f(N,null,V(o(S),t=>(d(),D(_,{key:t.key,value:t.key,label:t.desc},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(p,{label:e.$t("factory"),prop:"factoryId"},{default:r(()=>[n(k,{modelValue:o(a).factoryId,"onUpdate:modelValue":l[2]||(l[2]=t=>o(a).factoryId=t),placeholder:e.$t("factoryP"),clearable:"",filterable:"",onChange:m},{default:r(()=>[(d(!0),f(N,null,V(o(T),t=>(d(),D(_,{key:t.id,label:t.name,value:Number(t.id)},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(p,{label:e.$t("alarmTime"),prop:"time"},{default:r(()=>[n(q,{modelValue:o(s),"onUpdate:modelValue":l[3]||(l[3]=t=>M(s)?s.value=t:null),type:"datetimerange","start-placeholder":e.$t("startTime"),"end-placeholder":e.$t("endTime"),"value-format":"YYYY-MM-DD HH:mm:ss","default-time":I,onChange:U},null,8,["modelValue","start-placeholder","end-placeholder"])]),_:1},8,["label"]),n(p,null,{default:r(()=>[n(y,{type:"primary",onClick:m},{default:r(()=>[g(b(e.$t("query")),1)]),_:1}),n(y,{onClick:L},{default:r(()=>[g(b(e.$t("reset")),1)]),_:1})]),_:1})]),_:1},8,["model"]),W("div",re,[n(y,{onClick:B,style:{position:"absolute",top:"-50px",right:"0"}},{default:r(()=>[g(b(e.$t("export")),1)]),_:1}),n(o(H),{tableWrapId:`tableWrap_${w.status}`,style:{height:"100%"},columns:o(i).columns,tableData:o(i).tableData,total:o(i).total,pageNum:o(a).pageNo,"onUpdate:pageNum":l[4]||(l[4]=t=>o(a).pageNo=t),pageSize:o(a).pageSize,"onUpdate:pageSize":l[5]||(l[5]=t=>o(a).pageSize=t),onPagination:c},null,8,["tableWrapId","columns","tableData","total","pageNum","pageSize"])])])}}});export{ye as default};
