Index-747721da.js 12 KB

1
  1. import{d as J,r as i,a as oe,j as r,b as u,e,c,f as p,B as N,k as P,y as W,C as U,p as te,n as se,_ as ne,D as le,o as ae,s as ie,t as ce,h as re,v as de,x as T,F as H,u as pe,z as ue,E as Q,A as fe}from"./index-ba19c87a.js";import{P as _e,B as ve}from"./index-146f04ce.js";import{S as me}from"./index-1d17d6ab.js";import{C as ge}from"./index-e4b0f3a8.js";import{T as he}from"./index-eb57ff01.js";import{B as X}from"./index-30278767.js";import{F as ye}from"./index-43a65946.js";import{p as xe}from"./index-b30dafa0.js";import{F as ke,I as be,s as we}from"./vue-qrcode-reader-6750cc50.js";import{I as Y}from"./index-9c6666b7.js";import{P as Ce}from"./index-5cb3ebbf.js";import{L as Se}from"./index-81336658.js";import{s as ze}from"./function-call-17d6ed33.js";import"./use-scope-id-eeb8698e.js";import"./on-popup-reopen-d453be07.js";import"./use-route-503f7a9f.js";import"./constant-eba5e2d8.js";import"./axios-9cbf0d09.js";import"./mount-component-6050520d.js";const Te=B=>(te("data-v-9fb78c87"),B=B(),se(),B),Ne={key:0,style:{height:"100vh",width:"100vw",display:"flex","flex-direction":"column",overflow:"hidden"}},Be={style:{padding:"10px 16px","line-height":"0","align-items":"center",display:"flex","justify-content":"space-between"}},$e={style:{"margin-left":"16px"}},Pe={key:0},Re={key:1},Ve=Te(()=>e("div",{style:{"flex-grow":"1"}},null,-1)),Fe={style:{"flex-grow":"1","border-top":"1px solid #eee","box-sizing":"border-box"}},Ie=J({__name:"Index",emits:["success","close"],setup(B,{expose:b,emit:w}){const _=i(!1),A=()=>{_.value=!_.value},v=i(!1),R=()=>{v.value=!0},C=()=>{v.value=!1},E=()=>{C(),V("close")},V=w,F=()=>{const o=document.querySelector("input[name]");o.click(),console.log(o)},I=i([]);function D(o){console.log(o),I.value=o.map(t=>t.rawValue),V("success",I.value),C()}const S=i({facingMode:"environment"}),d=[{label:"rear camera",constraints:{facingMode:"environment"}},{label:"front camera",constraints:{facingMode:"user"}}],h=i(d);async function m(){const t=(await navigator.mediaDevices.enumerateDevices()).filter(({kind:l})=>l==="videoinput");h.value=[...d,...t.map(({deviceId:l,label:a})=>({label:`${a} (ID: ${l})`,constraints:{deviceId:l}}))],f.value=""}function y(o,t){for(const l of o){const[a,...x]=l.cornerPoints;t.strokeStyle="red",t.beginPath(),t.moveTo(a.x,a.y);for(const{x:g,y:k}of x)t.lineTo(g,k);t.lineTo(a.x,a.y),t.closePath(),t.stroke()}}function M(o,t){for(const l of o){const{boundingBox:{x:a,y:x,width:g,height:k}}=l;t.lineWidth=2,t.strokeStyle="#007bff",t.strokeRect(a,x,g,k)}}function $(o,t){for(const l of o){const{boundingBox:a,rawValue:x}=l,g=a.x+a.width/2,k=a.y+a.height/2,q=Math.max(12,50*a.width/t.canvas.width);t.font=`bold ${q}px sans-serif`,t.textAlign="center",t.lineWidth=3,t.strokeStyle="#35495e",t.strokeText(l.rawValue,g,k),t.fillStyle="#5cb984",t.fillText(x,g,k)}}const j=i([{text:"nothing (default)",value:void 0},{text:"outline",value:y},{text:"centered text",value:$},{text:"bounding box",value:M}][1]),z=i({aztec:!1,code_128:!1,code_39:!1,code_93:!1,codabar:!1,databar:!1,databar_expanded:!1,data_matrix:!1,dx_film_edge:!1,ean_13:!1,ean_8:!1,itf:!1,maxi_code:!1,micro_qr_code:!1,pdf417:!1,qr_code:!0,rm_qr_code:!1,upc_a:!1,upc_e:!1,linear_codes:!1,matrix_codes:!1}),L=oe(()=>Object.keys(z.value).filter(o=>z.value[o])),f=i("");function s(o){f.value=`[${o.name}]: `,o.name==="NotAllowedError"?f.value+="you need to grant camera access permission":o.name==="NotFoundError"?f.value+="no camera on this device":o.name==="NotSupportedError"?f.value+="secure context required (HTTPS, localhost)":o.name==="NotReadableError"?f.value+="is the camera already in use?":o.name==="OverconstrainedError"?f.value+="installed cameras are not suitable":o.name==="StreamApiNotSupportedError"?f.value+="Stream API is not supported in this browser":o.name==="InsecureContextError"?f.value+="Camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.":f.value+=o.message,we({type:"danger",message:f.value,zIndex:9999999})}return b({open:R,stop:C}),(o,t)=>{const l=X,a=Y;return v.value?(r(),u("div",Ne,[e("div",Be,[e("div",null,[c(l,{plain:"",icon:"photo-o",type:"primary",size:"small",onClick:F},{default:p(()=>[N("打开图片")]),_:1})]),e("div",$e,[c(l,{plain:"",icon:"bulb-o",type:"primary",size:"small",onClick:A},{default:p(()=>[_.value?(r(),u("span",Pe,"关闭灯光")):(r(),u("span",Re,"打开灯光"))]),_:1})]),Ve,e("div",null,[c(a,{name:"close",size:"30",onClick:E})])]),e("div",Fe,[v.value?(r(),P(W(ke),{key:0,onDetect:D,capture:null})):U("",!0),v.value?(r(),P(W(be),{key:1,torch:_.value,constraints:S.value,track:j.value.value,formats:L.value,onError:s,onDetect:D,onCameraOn:m},null,8,["torch","constraints","track","formats"])):U("",!0)])])):U("",!0)}}});const De=ne(Ie,[["__scopeId","data-v-9fb78c87"]]),Le={style:{padding:"16px"}},Ae={style:{"background-color":"#eee","border-radius":"2.5rem",margin:"0px 5px"}},Ee={style:{"margin-top":"16px",display:"flex"}},Me={style:{"flex-grow":"1"}},Oe=e("div",{style:{width:"10px"}},null,-1),je={style:{"flex-grow":"1"}},qe={style:{padding:"16px"}},Ue={style:{position:"absolute",width:"100vw",height:"100vh",top:"0",left:"0","z-index":"99999","background-color":"#ccc"}},We={style:{display:"flex","flex-direction":"column",height:"100vh"}},He={style:{padding:"10px 16px 10px 16px",border:"1px solid #f0f0f0"}},Qe={style:{display:"flex","justify-content":"space-between","align-items":"center"}},Je={style:{display:"flex","align-items":"flex-end"}},Xe=e("div",{style:{"font-size":"20px","font-weight":"bold"}},[e("span",null,"设备")],-1),Ye={style:{"font-size":"0.9rem","margin-left":"5px"}},Ge=e("div",{style:{"background-color":"#eee","border-radius":"2.5rem",width:"0px","flex-grow":"1",margin:"0px 5px"}},null,-1),Ke=e("div",{style:{width:"50px",height:"100%","background-color":"red",display:"flex","justify-content":"center","align-items":"center"}},[e("div",null,[e("div",{style:{color:"#fff","font-weight":"bold"}},[e("span",null,"删除")])])],-1),Ze={style:{"text-align":"left"}},eo={style:{display:"flex","justify-content":"space-between","margin-bottom":"5px"}},oo={style:{"font-size":"0.9rem"}},to={key:0,style:{color:"#000"}},so={key:1},no={style:{"font-size":"0.9rem"}},lo={style:{display:"flex","align-items":"flex-end"}},ao={style:{color:"#000","font-weight":"bold","font-size":"1.1rem"}},io={style:{"margin-left":"5px","margin-bottom":"2px"}},co={style:{display:"flex","justify-content":"space-between","margin-bottom":"5px"}},ro={style:{"font-size":"0.9rem","margin-left":"0px"}},po={style:{"font-size":"0.9rem","margin-left":"0px"}},uo={style:{display:"flex","justify-content":"space-between"}},fo=["onClick"],_o=e("div",{style:{"margin-left":"3px"}},"位置",-1),vo={key:1},mo=e("div",null,null,-1),go=["onClick"],ho=e("div",{style:{"margin-left":"3px"}},"传输日志",-1),yo={key:0},xo={key:1,style:{"text-align":"center",padding:"10px 20px 20px 20px",color:"#ccc"}},ko=e("span",null,"暂无数据",-1),bo=[ko],wo={key:2,style:{"text-align":"center",padding:"10px 20px 20px 20px"}},Co={key:3,style:{"text-align":"center",padding:"10px 20px 20px 20px",color:"#ccc"}},So=e("span",null,"没有更多了",-1),zo=[So],To={key:4,style:{"text-align":"center",padding:"10px 20px 20px 20px"}},No=e("div",{style:{height:"60px"}},null,-1),Jo=J({__name:"Index",setup(B){const b=i(!1),w=i(!1),_=i(!1),A=()=>{O(),b.value=!1},v=i(1),R=s=>{v.value=s,w.value=!1,_.value=!0,C.value.open()},C=i(),E=s=>{console.log(s),_.value=!1,v.value==1?S.value=s[0]:v.value==2&&(console.log(s),ze(s[0]))},V=()=>{_.value=!1},F=pe(),I=s=>{console.log(s),F.push("/device/location/"+s)},D=s=>{console.log(s),F.push("/device/log/"+s)},S=i(""),d=le({total:0,pageNum:1,pageSize:10,pages:0}),h=i([]),m=i(!1),y=i(!1),M=i(!1),$=()=>{console.log("onload....."),xe({url:"/device/search",data:{size:d.pageSize,page:d.pageNum,sort:"createtime",order:"desc",keyWord:S.value,mac:""}}).then(s=>{if(console.log(s),y.value=!1,m.value=!1,s.code==0){const o=s.data,t=s.total,l=Math.ceil(t/d.pageSize);console.log(l),console.log(o),d.pageNum==1&&h.value.splice(0,h.value.length),h.value.push(...o),d.pages=l,d.total=t,console.log(h.value,l)}},s=>{console.log(s),y.value=!1,m.value=!1}).catch(s=>{console.log(s),y.value=!1,m.value=!1})},O=()=>{console.log("onrefresh..."),console.log(m.value),d.pageNum=1,M.value=!1,y.value=!0,$()},j=s=>{const o=Date.parse(s);return(new Date().getTime()-o)/1e3};ae(()=>{console.log("onMounted"),$()});const z=i(null),L=i(0);ie(()=>{console.log("onActived..."),fe(()=>{z.value.scrollTop=L.value})}),ce((s,o,t)=>{console.log(s,o),console.log("onBeforeRouteLeave..."),L.value=z.value.scrollTop,t()});const f=()=>{console.log("clickLoading"),d.pageNum++,y.value=!0,$()};return(s,o)=>{const t=Y,l=ye,a=X,x=Ce,g=he,k=ge,q=me,G=Se,K=_e,Z=ve;return r(),u(H,null,[c(x,{show:b.value,"onUpdate:show":o[3]||(o[3]=n=>b.value=n),position:"top","close-on-click-overlay":!0},{default:p(()=>[e("div",Le,[e("div",Ae,[c(l,{style:{padding:"6px 16px",height:"44px","line-height":"25px","align-items":"center"},modelValue:S.value,"onUpdate:modelValue":o[1]||(o[1]=n=>S.value=n),size:"normal",clearable:""},{"right-icon":p(()=>[e("div",null,[c(t,{name:"scan",size:"1.5rem",onClick:o[0]||(o[0]=n=>R(1))})])]),_:1},8,["modelValue"])]),e("div",Ee,[e("div",Me,[c(a,{type:"primary",size:"normal",round:"",block:"",onClick:A},{default:p(()=>[N("搜索")]),_:1})]),Oe,e("div",je,[c(a,{type:"warning",size:"normal",round:"",block:"",onClick:o[2]||(o[2]=()=>{b.value=!1})},{default:p(()=>[N("取消")]),_:1})])])])]),_:1},8,["show"]),c(x,{show:w.value,"onUpdate:show":o[5]||(o[5]=n=>w.value=n),position:"top"},{default:p(()=>[e("div",qe,[e("div",null,[c(a,{type:"primary",size:"normal",icon:"scan",round:"",block:"",onClick:o[4]||(o[4]=n=>R(2))},{default:p(()=>[N("扫码添加设备")]),_:1})])])]),_:1},8,["show"]),re(e("div",Ue,[c(De,{ref_key:"scanQR",ref:C,onSuccess:E,onClose:V},null,512)],512),[[de,_.value]]),e("div",We,[e("div",He,[e("div",Qe,[e("div",Je,[Xe,e("div",Ye,[e("span",null,"共"+T(d.total)+"台",1)])]),Ge,e("div",{style:{"line-height":"0px"},onClick:o[6]||(o[6]=()=>{b.value=!0})},[c(t,{name:"static/images/icon-search-black.png",size:"2rem"})]),e("div",{style:{"line-height":"0px","margin-left":"10px"},onClick:o[7]||(o[7]=()=>{w.value=!0})},[c(t,{name:"plus",size:"1.5rem"})])])]),e("div",{ref_key:"scrollRef",ref:z,class:"container",style:{"overflow-y":"auto","flex-grow":"1"}},[c(K,{style:{"min-height":"100%"},modelValue:m.value,"onUpdate:modelValue":o[8]||(o[8]=n=>m.value=n),onRefresh:O},{default:p(()=>[(r(!0),u(H,null,ue(h.value,n=>(r(),P(q,{style:{"background-color":"#fff","margin-bottom":"10px"}},{right:p(()=>[Ke]),default:p(()=>[c(k,{clickable:"",to:"/device/detail/"+n.mac},{default:p(()=>[e("div",Ze,[e("div",eo,[e("div",oo,[n.username?(r(),u("span",to,T(n.username),1)):(r(),u("span",so,"未知用户"))]),e("div",no,T(n.productName),1)]),e("div",lo,[e("div",ao,[e("span",null,T(n.mac),1)]),e("div",io,[j(n.modifytime)<1200?(r(),P(g,{key:0,round:"",size:"medium",type:"success"},{default:p(()=>[N("在线")]),_:1})):(r(),P(g,{key:1,round:"",size:"medium",type:"danger"},{default:p(()=>[N("离线")]),_:1}))])]),e("div",co,[e("div",ro,[e("span",null,T(n.createtime),1)]),e("div",po,[e("span",null,T(n.modifytime),1)])]),e("div",uo,[JSON.parse(n.data).lat?(r(),u("div",{key:0,style:{display:"flex",color:"#000"},onClick:Q(ee=>I(n.mac),["stop"])},[e("div",null,[c(t,{name:"static/images/icon-location2.png",size:"1.5rem"})]),_o],8,fo)):(r(),u("div",vo,"暂无定位")),mo,e("div",{style:{display:"flex",color:"#000"},onClick:Q(ee=>D(n.mac),["stop"])},[e("div",null,[c(t,{name:"static/images/icon-log.png",size:"1.5rem"})]),ho],8,go)])])]),_:2},1032,["to"])]),_:2},1024))),256)),e("div",null,[m.value?(r(),u("div",yo)):h.value.length==0?(r(),u("div",xo,bo)):y.value?(r(),u("div",wo,[c(G,{type:"spinner",color:"#1989fa"})])):d.pages<=d.pageNum?(r(),u("div",Co,zo)):(r(),u("div",To,[e("span",{onClick:f},"点击加载")]))]),No]),_:1},8,["modelValue"]),c(Z,{target:".container",right:"5vw",bottom:"80px"})],512)])],64)}}});export{Jo as default};