Location-e5e5667c.js 3.7 KB

1
  1. import{d as k,r as h,w as z,o as M,b as O,c as B,y as C,e,x as _,u as I,j as F}from"./index-77a68c60.js";import{p as L}from"./index-20e50406.js";import{_ as N}from"./CusNavigation-b3aabd42.js";import{s as b}from"./function-call-a5c0fdd2.js";import"./axios-9cbf0d09.js";import"./index-9acba25b.js";import"./index-87dc5ea8.js";import"./use-scope-id-c03bf1c4.js";import"./constant-eba5e2d8.js";import"./on-popup-reopen-9aaf85c5.js";import"./mount-component-b9b13576.js";import"./index-91a16a63.js";const R={style:{display:"flex","flex-direction":"column",height:"100vh"}},S={class:"container",style:{"overflow-y":"auto","flex-grow":"1","background-color":"#F7F8FA"}},W={style:{height:"100%",position:"relative"}},A=e("div",{id:"map_1",style:{height:"100%","background-color":"#aaa"}},null,-1),D={style:{position:"absolute",width:"100%","z-index":"99999999","border-top-left-radius":"20px","border-top-right-radius":"20px","background-color":"#fff","border-top":"2px solid #eee",bottom:"0px"}},T={style:{padding:"30px 40px"}},V={style:{display:"flex","align-items":"flex-end"}},Z=e("div",{style:{width:"80px",color:"#969799","font-size":"0.9rem"}},[e("span",null,"设备编号:")],-1),j={style:{"font-weight":"bold"}},E={style:{display:"flex","align-items":"flex-end","margin-top":"5px"}},G=e("div",{style:{width:"80px",color:"#969799","font-size":"0.9rem"}},[e("span",null,"坐标(lng):")],-1),J={style:{"font-weight":"bold"}},q={style:{display:"flex","align-items":"flex-end","margin-top":"5px"}},H=e("div",{style:{width:"80px",color:"#969799","font-size":"0.9rem"}},[e("span",null,"坐标(lat):")],-1),K={style:{"font-weight":"bold"}},P={style:{display:"flex","align-items":"flex-start","margin-top":"5px"}},Q=e("div",{style:{width:"80px",color:"#969799","font-size":"0.9rem"}},[e("span",null,"地址:")],-1),U={style:{"font-weight":"bold",width:"0px","flex-grow":"1"}},ce=k({__name:"Location",setup(X){const s=window.BMapGL,a=h(null),m=()=>{a.value||(a.value=new s.Map("map_1"),a.value.centerAndZoom(new s.Point(116.404,39.915),15),a.value.enableScrollWheelZoom(!0))},f=()=>{var o,i,n,d;if(console.log(t.value),a.value.clearOverlays(),(o=t.value)!=null&&o.data.lat&&((i=t.value)!=null&&i.data.lng)){const r=(n=t.value)==null?void 0:n.data.lng.value,c=(d=t.value)==null?void 0:d.data.lat.value;let l=new s.Point(r,c);console.log(r,c);let u=new s.Marker(l),v=new s.Circle(l,500,{strokeColor:"red",strokeWeight:1,strokeOpacity:1,fillOpacity:0});a.value.addOverlay(u),a.value.addOverlay(v),setTimeout(()=>{a.value.setCenter(l)},300)}else console.log("hhhh"),b({message:"暂无定位"})},t=h(),g=async()=>{await L({url:"/device/search",data:{size:200,page:1,sort:"createtime",order:"desc",keyWord:p.value}}).then(o=>{o.data[0]?(t.value=o.data[0],t.value.data=JSON.parse(o.data[0].data),console.log(t.value)):b("设备不存在")})},y=I(),p=h("");return z(()=>y.currentRoute.value.params,async(o,i)=>{console.log("路由参数发生了变化",o,i),o.deviceId&&(p.value=o.deviceId,await g(),m(),f())}),M(async()=>{console.log("deviceDetail onMounted"),p.value=y.currentRoute.value.params.deviceId,await g(),m(),f()}),(o,i)=>{var n,d,r,c,l,u,v,x,w;return F(),O("div",R,[B(C(N),{gobackabled:"",title:"设备位置"}),e("div",S,[e("div",W,[A,e("div",D,[e("div",T,[e("div",V,[Z,e("div",j,[e("span",null,_(p.value),1)])]),e("div",E,[G,e("div",J,[e("span",null,[e("span",null,_((r=(d=(n=t.value)==null?void 0:n.data)==null?void 0:d.lng)==null?void 0:r.value),1)])])]),e("div",q,[H,e("div",K,[e("span",null,[e("span",null,_((u=(l=(c=t.value)==null?void 0:c.data)==null?void 0:l.lat)==null?void 0:u.value),1)])])]),e("div",P,[Q,e("div",U,[e("span",null,_((w=(x=(v=t.value)==null?void 0:v.data)==null?void 0:x.address)==null?void 0:w.value),1)])])])])])])])}}});export{ce as default};