| 1 |
- import{c as J,m as K,l as E,K as O,w as U}from"./index-f74a9797.js";import{P as W,B as G}from"./index-0836aac8.js";/* empty css */import{S as Q}from"./index-fcf30747.js";import{C as X}from"./index-7f9bc931.js";import{_ as Y}from"./CusNavigation-d53df9b9.js";import{d as j,r as f,a as Z,o as D,w as F,c as h,s as $,b as x,e as w,f as u,h as I,u as P,F as ee,q as te,k as oe,t as ne,P as se}from"./index-df5648cd.js";import{p as le}from"./index-4754b314.js";import{t as ae}from"./index-9c8b4e4e.js";import{L as ie}from"./index-3ba5f77a.js";import"./function-call-2cfc4e68.js";import"./use-expose-8ee00450.js";import"./on-popup-reopen-80498ca6.js";import"./index-7e168c84.js";import"./axios-9cbf0d09.js";const[ce,V]=J("text-ellipsis"),de={rows:K(1),dots:E("..."),content:E(""),expandText:E(""),collapseText:E(""),position:E("end")};var re=j({name:ce,props:de,emits:["clickAction"],setup(t,{emit:L}){const n=f(""),d=f(!1),r=f(!1),p=f(),N=Z(()=>d.value?t.collapseText:t.expandText),g=e=>{if(!e)return 0;const c=e.match(/^\d*(\.\d*)?/);return c?Number(c[0]):0},C=()=>{const e=()=>{if(!p.value)return;const s=window.getComputedStyle(p.value),o=document.createElement("div");return Array.prototype.slice.apply(s).forEach(k=>{o.style.setProperty(k,s.getPropertyValue(k))}),o.style.position="fixed",o.style.zIndex="-9999",o.style.top="-9999px",o.style.height="auto",o.style.minHeight="auto",o.style.maxHeight="auto",o.innerText=t.content,document.body.appendChild(o),o},c=(s,o)=>{const{content:l,position:k,dots:S}=t,T=l.length,q=()=>{const a=(i,_)=>{if(_-i<=1)return k==="end"?l.slice(0,i)+S:S+l.slice(_,T);const v=Math.round((i+_)/2);return k==="end"?s.innerText=l.slice(0,v)+S+N.value:s.innerText=S+l.slice(v,T)+N.value,s.offsetHeight>o?k==="end"?a(i,v):a(v,_):k==="end"?a(v,_):a(i,v)};s.innerText=a(0,T)},H=(a,i)=>{if(a[1]-a[0]<=1&&i[1]-i[0]<=1)return l.slice(0,a[0])+S+l.slice(i[1],T);const _=Math.floor((a[0]+a[1])/2),v=Math.ceil((i[0]+i[1])/2);return s.innerText=t.content.slice(0,_)+t.dots+t.content.slice(v,T)+t.expandText,s.offsetHeight>=o?H([a[0],_],[v,i[1]]):H([_,a[1]],[i[0],v])},R=0+T>>1;return t.position==="middle"?s.innerText=H([0,R],[R,T]):q(),s.innerText},m=e();if(!m)return;const{paddingBottom:y,paddingTop:A,lineHeight:B}=m.style,M=Math.ceil((Number(t.rows)+.5)*g(B)+g(A)+g(y));M<m.offsetHeight?(r.value=!0,n.value=c(m,M)):(r.value=!1,n.value=t.content),document.body.removeChild(m)},b=e=>{d.value=!d.value,L("clickAction",e)},z=()=>h("span",{class:V("action"),onClick:b},[N.value]);return D(C),F(()=>[t.content,t.rows,t.position],C),O("resize",C),()=>h("div",{ref:p,class:V()},[d.value?t.content:n.value,r.value?z():null])}});const ue=U(re);const pe={style:{display:"flex","flex-direction":"column",height:"100vh"}},me={style:{padding:"10px"}},ve={class:"container",style:{"overflow-y":"auto","flex-grow":"1"}},_e={style:{"text-align":"left"}},fe={style:{display:"flex","justify-content":"space-between","margin-bottom":"5px"}},ge={style:{"font-size":"0.9rem",color:"#000","font-weight":"bold"}},xe={style:{display:"flex","align-items":"flex-end"}},he={style:{width:"100%","word-wrap":"break-word","text-align":"justify"}},ye={key:0},ke={key:1,style:{"text-align":"center",padding:"20px",color:"#ccc"}},Te=u("span",null,"暂无数据",-1),we=[Te],be={key:2,style:{"text-align":"center",padding:"20px"}},Ne={key:3,style:{"text-align":"center",padding:"20px",color:"#ccc"}},Ce=u("span",null,"没有更多了",-1),Se=[Ce],Ee={key:4,style:{"text-align":"center",padding:"20px"}},Oe=j({__name:"Log",setup(t){const L=P(),n=$({total:0,pageNum:1,pageSize:10,pages:0}),d=f([]),r=f(!1),p=f(!1),N=f(!1),g=()=>{console.log("onload....."),le({url:"/device/searchRecord",data:{size:n.pageSize,page:n.pageNum,sort:"createtime",order:"desc",keyWord:b.value,mac:""}}).then(e=>{if(console.log(e),p.value=!1,r.value=!1,e.code==0){const c=e.data,m=e.total,y=Math.ceil(m/n.pageSize);console.log(y),console.log(c),n.pageNum==1&&d.value.splice(0,d.value.length),d.value.push(...c),n.pages=y,n.total=m,console.log(d.value,y)}},e=>{console.log(e),p.value=!1,r.value=!1}).catch(e=>{console.log(e),p.value=!1,r.value=!1})},C=()=>{console.log("onrefresh..."),console.log(r.value),n.pageNum=1,N.value=!1,p.value=!0,g()},b=f("");F(()=>L.currentRoute.value.params,(e,c)=>{console.log("路由参数发生了变化",e,c),e.deviceId&&(b.value=e.deviceId,g())}),D(()=>{console.log("onMounted"),b.value=L.currentRoute.value.params.deviceId,g()});const z=()=>{console.log("clickLoading"),n.pageNum++,p.value=!0,g()};return(e,c)=>{const m=Y,y=ue,A=X,B=Q,M=ie,s=W,o=G;return x(),w("div",pe,[u("div",me,[h(m,{gobackabled:"",title:"设备日志("+b.value+")"},null,8,["title"])]),u("div",ve,[h(s,{style:{"min-height":"100%"},modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=l=>r.value=l),onRefresh:C},{default:I(()=>[(x(!0),w(ee,null,te(d.value,l=>(x(),oe(B,{style:{"background-color":"#fff","margin-bottom":"10px"}},{default:I(()=>[h(A,{clickable:""},{default:I(()=>[u("div",_e,[u("div",fe,[u("div",ge,ne(se(ae)(l.time)),1)]),u("div",xe,[u("div",he,[h(y,{rows:5,content:JSON.stringify(l)},null,8,["content"])])])])]),_:2},1024)]),_:2},1024))),256)),u("div",null,[r.value?(x(),w("div",ye)):d.value.length==0?(x(),w("div",ke,we)):p.value?(x(),w("div",be,[h(M,{type:"spinner",color:"#1989fa"})])):n.pages<=n.pageNum?(x(),w("div",Ne,Se)):(x(),w("div",Ee,[u("span",{onClick:z},"点击加载")]))])]),_:1},8,["modelValue"]),h(o,{target:".container",right:"5vw",bottom:"80px"})])])}}});export{Oe as default};
|