You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

testChooseMap.223c2bdf.js 3.2KB

3 mesi fa
1
  1. import{g as O,w as B}from"./locationTransform.e2d22cb6.js";import{s as I,g as $}from"./tiandimap.f7d8cf54.js";import{d as M,_ as S,r as f,o as V,z as D,f as v,g as w,n as N,w as u,e as p,h as y,J as j,L as z,b as A,c as F}from"./index.2f2d2ba5.js";const q=s=>(j("data-v-95183349"),s=s(),z(),s),E=q(()=>A("div",{id:"mapDiv",class:"map"},null,-1)),G=y("\u786E\u5B9A"),J=y(" \u5173\u95ED "),R=M({name:"TiandiChooseLocation"}),U=Object.assign(R,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(s,{emit:d}){const l=s,i=f(""),n=f({});V(()=>{setTimeout(function(){h()},100)});function _(o,e){I(o).then(a=>{if(console.log(a),a.code===200){const t=a.data.pois;e(t)}})}function C(o){const e=o.lonlat.split(",");L(e[0],e[1]),m(e[0],e[1])}function m(o,e){$(o,e).then(a=>{const t=a.data.result,r=B(parseFloat(t.location.lon),parseFloat(t.location.lat));console.log(r),console.log(t.location.lon,t.location.lat),n.value.longitude=r[0],n.value.latitude=r[1],n.value.regionCode=t.addressComponent.county_code.replace("156",""),n.value.region=`${t.addressComponent.province}-${t.addressComponent.city}-${t.addressComponent.county}`,n.value.address=t.formatted_address})}D(()=>l.visible,o=>{o?(n.value.addressType=l.data.addressType,n.value.id=l.data.id,setTimeout(function(){h()},100)):(n.value={},i.value="")});var c,b=14;function h(){const o=O(parseFloat(l.data.lng),parseFloat(l.data.lat));c=new T.Map("mapDiv"),c.centerAndZoom(new T.LngLat(o[0],o[1]),b);const e=new T.Marker(new T.LngLat(o[0],o[1]));c.addOverLay(e),c.addEventListener("click",k)}function k(o){const e=o.lnglat.getLng(),a=o.lnglat.getLat();L(e,a),m(e,a)}function L(o,e){c.clearOverLays();const a=new T.LngLat(o,e);var t=new T.Marker(a);c.addOverLay(t),c.panTo(a)}const x=()=>{d("close",n.value)};return(o,e)=>{const a=v("el-autocomplete"),t=v("el-button"),r=v("el-dialog");return w(),N(r,{"model-value":s.visible,title:"\u5730\u70B9\u67E5\u8BE2",width:"840px","destroy-on-close":"",onClose:e[2]||(e[2]=g=>d("close"))},{footer:u(()=>[p(t,{type:"primary",size:"small",onClick:x},{default:u(()=>[G]),_:1}),p(t,{type:"info",size:"small",onClick:e[1]||(e[1]=g=>d("close"))},{default:u(()=>[J]),_:1})]),default:u(()=>[p(a,{modelValue:i.value,"onUpdate:modelValue":e[0]||(e[0]=g=>i.value=g),"fetch-suggestions":_,placeholder:"\u8BF7\u8F93\u5165\u8BE6\u7EC6\u5730\u5740","trigger-on-focus":!1,"value-key":"name",class:"mb-16 w-full",onSelect:C},null,8,["modelValue"]),E]),_:1},8,["model-value"])}}}),W=S(U,[["__scopeId","data-v-95183349"]]),Z=y("\u663E\u793A"),Q={__name:"testChooseMap",setup(s){const d={id:768,orderId:261,region:"\u6D59\u6C5F\u7701-\u676D\u5DDE\u5E02-\u6EE8\u6C5F\u533A",regionCode:330108,address:"\u6D59\u6C5F\u7701\u676D\u5DDE\u5E02\u6EE8\u6C5F\u533A\u6D66\u6CBF\u676D\u5DDE\u7B2C\u4E8C\u4E2D\u5B66(\u6EE8\u6C5F\u6821\u533A)",lat:"30.201463",lng:"120.204171",addressType:"BOARDING_LOCATION",deleted:!1,createBy:91,updateBy:91,createOn:"2024-05-16 10:14:21",updateOn:"2024-05-16 10:14:21"},l=f(!0);function i(_){console.log(_)}function n(){l.value=!0}return(_,C)=>{const m=v("el-button");return w(),F("div",null,[p(W,{visible:l.value,style:{height:"500px"},data:d,onClose:i},null,8,["visible"]),p(m,{onClick:n},{default:u(()=>[Z]),_:1})])}}};export{Q as default};