import{_ as G}from"./index-49332ae1.js";import{e as j}from"./index-33689e3e.js";import{d as J,K,y as Z,ap as p,B as k,b6 as $,a as r,f as P,e as t,b as a,h as i,G as W,F as X,r as ee,c as d,ac as y,J as v,t as te,C as ae,aq as ne,aQ as le,Y as oe,at as ie,a0 as se,P as re,ah as pe,_ as ue,au as de,Z as ce,av as me,aF as _e,aG as fe,aH as ge,aC as ye}from"./index-3ac32eb9.js";const ve={name:"EventManage"},Ce=J({...ve,props:{currentIotId:{type:String}},setup(O){const b=O,o=K({loading:!1,collectionEventListData:[],timeList:[],eventTypeOptionList:[{label:"信息",value:0},{label:"警告",value:1},{label:"错误",value:2}],replyTypeOptionList:[{label:"正常",value:1},{label:"异常",value:2}],queryParams:{iotId:b.currentIotId,currentPage:1,pageSize:10},paginationCondition:{paginationDataTotal:0,paginationLimitSize:10}}),{loading:h,collectionEventListData:w,timeList:m,eventTypeOptionList:S,replyTypeOptionList:be,queryParams:s,paginationCondition:T}=ne(o);function I(n){return{0:"success",1:"warning",2:"danger"}[n]||"info"}function x(n){const e=o.eventTypeOptionList.find(_=>_.value===n);return(e==null?void 0:e.label)||"未知"}function c(){o.loading=!0,j(o.queryParams).then(({data:n})=>{for(const e of n.list)e.createdAt=p(e.createdAt).format("YYYY-MM-DD HH:mm:ss"),e.updatedAt=p(e.updatedAt).format("YYYY-MM-DD HH:mm:ss");o.collectionEventListData=n.list,o.paginationCondition.paginationDataTotal=n.total,o.loading=!1})}function V(){o.timeList=[],o.queryParams={iotId:b.currentIotId,currentPage:1,pageSize:10},c()}function Y(n){o.paginationCondition.paginationLimitSize=n}function E(n){o.queryParams.startTime=p(n[0]).valueOf(),o.queryParams.endTime=p(n[1]).valueOf()}return Z(()=>{const n=p().endOf("day"),e=p().subtract(3,"day").endOf("day");o.timeList=[e,n],E([e.valueOf(),n.valueOf()]),c()}),(n,e)=>{const _=le,f=oe,g=ie,q=se,M=re,B=k("Search"),L=pe,C=ue,z=k("Refresh"),F=de,R=ce,A=me,u=_e,H=fe,Q=ge,U=G,D=$("deBounce"),N=ye;return r(),P("div",null,[t(A,{shadow:"never","body-style":{padding:"18px 0 0 18px"}},{default:a(()=>[t(R,{ref:"queryFormRef",model:i(s),inline:!0},{default:a(()=>[t(F,null,{default:a(()=>[t(g,{span:8},{default:a(()=>[t(f,{label:"时间"},{default:a(()=>[t(_,{modelValue:i(m),"onUpdate:modelValue":e[0]||(e[0]=l=>W(m)?m.value=l:null),type:"datetimerange","range-separator":"至","start-placeholder":"开始时间","end-placeholder":"结束时间",clearable:!1,onChange:E},null,8,["modelValue"])]),_:1})]),_:1}),t(g,{span:4},{default:a(()=>[t(f,{label:"事件类型"},{default:a(()=>[t(M,{modelValue:i(s).eventType,"onUpdate:modelValue":e[1]||(e[1]=l=>i(s).eventType=l),"value-key":"",placeholder:"请选择",clearable:"",filterable:"",style:{width:"220px"}},{default:a(()=>[(r(!0),P(X,null,ee(i(S),l=>(r(),d(q,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),t(g,{span:6},{default:a(()=>[t(f,null,{default:a(()=>[y((r(),d(C,{type:"primary",onClick:c},{default:a(()=>[t(L,null,{default:a(()=>[t(B)]),_:1}),e[5]||(e[5]=v(" 查询 ",-1))]),_:1})),[[D]]),y((r(),d(C,{onClick:V},{default:a(()=>[t(L,null,{default:a(()=>[t(z)]),_:1}),e[6]||(e[6]=v(" 重置 ",-1))]),_:1})),[[D]])]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),y((r(),d(Q,{data:i(w),stripe:"",class:"mt-20px"},{default:a(()=>[t(u,{label:"序号",type:"index",width:"60",align:"center"}),t(u,{prop:"createdAt",key:"",label:"时间",width:"200",align:"center"}),t(u,{prop:"eventType",key:"",label:"类型",width:"120",align:"center"},{default:a(({row:l})=>[t(H,{type:I(l.eventType)},{default:a(()=>[v(te(x(l.eventType)),1)]),_:2},1032,["type"])]),_:1}),t(u,{prop:"code",key:"",label:"状态码",width:"200",align:"center"}),t(u,{prop:"content",key:"",label:"事件内容","min-width":"300",align:"center"})]),_:1},8,["data"])),[[N,i(h)]]),i(T).paginationDataTotal>0?(r(),d(U,{key:0,total:i(T).paginationDataTotal,page:i(s).currentPage,"onUpdate:page":e[2]||(e[2]=l=>i(s).currentPage=l),limit:i(s).pageSize,"onUpdate:limit":[e[3]||(e[3]=l=>i(s).pageSize=l),Y],onPagination:e[4]||(e[4]=l=>c())},null,8,["total","page","limit"])):ae("",!0)])}}});export{Ce as _};
