Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

2 lignes
3.1KB

  1. var _=(s,c,n)=>new Promise((l,u)=>{var p=t=>{try{o(n.next(t))}catch(v){u(v)}},e=t=>{try{o(n.throw(t))}catch(v){u(v)}},o=t=>t.done?l(t.value):Promise.resolve(t.value).then(p,e);o((n=n.apply(s,c)).next())});import{A as I}from"./index.fa5dc7de.js";import{_ as S,d as q,r as b,a1 as z,A as N,f as y,g as V,p as $,w as m,e as h,h as A,L as B,M as D,b as C}from"./index.551f5afa.js";const M=s=>(B("data-v-d9c37bbd"),s=s(),D(),s),L=M(()=>C("input",{id:"searchInput",placeholder:"\u8BF7\u8F93\u5165\u5173\u952E\u5B57",class:"mb-16 w-full leading-[32px] rounded-[4px] px-11 py-1",style:{"box-shadow":"0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset",outline:"none"}},null,-1)),P=M(()=>C("div",{id:"map",class:"map"},null,-1)),G=A(" \u786E\u5B9A "),T=A(" \u5173\u95ED "),W=q({name:"queryAddressDialog"}),j=Object.assign(W,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(s,{emit:c}){const n=s;let l,u,p;const e=b({}),o=z(null),t=b(),v=r=>_(this,null,function*(){try{l=yield I.load({key:"75043a78a63743c51c18058e73a2a70e",version:"2.0",plugins:["AMap.AutoComplete","AMap.PlaceSearch","AMap.Geocoder","AMap.InfoWindow"]}),o.value=new l.Map("map",{resizeEnable:!0,center:r,zoom:17}),t.value=new l.Marker({position:new l.LngLat(r[0],r[1]),anchor:"bottom-center"}),o.value.add(t.value),l.plugin(["AMap.PlaceSearch","AMap.AutoComplete"],()=>{const d=new l.AutoComplete({input:"searchInput"}),a=new l.PlaceSearch({map:o.value}),g=i=>{a.setCity(i.poi.adcode),a.search(i.poi.name)};d.on("select",g),a.on("markerClick",i=>{e.value.longitude=i.data.location.lng,e.value.latitude=i.data.location.lat,w(),f()})}),u=new l.Geocoder({}),p=new l.InfoWindow({offset:new l.Pixel(0,-30)}),o.value.on("click",d=>{e.value.longitude=d.lnglat.lng,e.value.latitude=d.lnglat.lat,f(),w()})}catch(d){console.error(d)}}),f=()=>{x(),o.value.setFitView(),t.value=new l.Marker({map:o.value,position:[e.value.longitude,e.value.latitude],zIndex:9999999999}),o.value.setFitView(),o.value.add(t.value)},x=()=>{t.value&&o.value.remove(t.value)},w=()=>{const r=[e.value.longitude,e.value.latitude];u.getAddress(r,(d,a)=>{d==="complete"&&a.regeocode&&(e.value.region=`${a.regeocode.addressComponent.province}-${a.regeocode.addressComponent.city}-${a.regeocode.addressComponent.district}`,e.value.regionCode=a.regeocode.addressComponent.adcode,e.value.address=a.regeocode.formattedAddress,console.log(e.value),console.log(a),p.setContent(a.regeocode.formattedAddress),p.open(o.value,[e.value.longitude,e.value.latitude]))})},k=()=>{c("close",e.value)};return N(()=>n.visible,r=>_(this,null,function*(){r?(e.value.addressType=n.data.addressType,e.value.id=n.data.id,yield v([Number(n.data.lng),Number(n.data.lat)])):e.value={}})),(r,d)=>{const a=y("el-button"),g=y("el-dialog");return V(),$(g,{"model-value":s.visible,title:"\u5730\u70B9\u67E5\u8BE2",width:"840px","destroy-on-close":"",onClose:d[1]||(d[1]=i=>c("close"))},{footer:m(()=>[h(a,{type:"primary",size:"small",onClick:k},{default:m(()=>[G]),_:1}),h(a,{type:"info",size:"small",onClick:d[0]||(d[0]=i=>c("close"))},{default:m(()=>[T]),_:1})]),default:m(()=>[L,P]),_:1},8,["model-value"])}}}),R=S(j,[["__scopeId","data-v-d9c37bbd"]]);export{R as default};