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.adc98274.js";import{_ as S,d as z,r as b,a1 as q,z as N,f as y,g as V,n as $,w as m,e as h,h as C,J as B,L as D,b as A}from"./index.2f2d2ba5.js";const M=s=>(B("data-v-d9c37bbd"),s=s(),D(),s),L=M(()=>A("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(()=>A("div",{id:"map",class:"map"},null,-1)),G=C(" \u786E\u5B9A "),T=C(" \u5173\u95ED "),W=z({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=q(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"])}}}),J=S(j,[["__scopeId","data-v-d9c37bbd"]]);export{J as default};
