import{d as b,c as v}from"./project-d8b2e0b3-1778929502341v=1.0.0.js";import{d as y,u as k,z as L,b as M,aA as C,a0 as B,o as T,c as E,_ as D}from"./index-17740f03-1778929502341v=1.0.0.js";import{u as j}from"./index-13acf308-1778929502341v=1.0.0.js";const I={id:"container",class:"map"},O=y({__name:"MatchMap",props:{regionId:{default:"530000"},geometriesList:{default:()=>[]}},setup(l){const p=k(),n=l,e=L({markerLayer:null,area:null,markerCluster:null,infoWindow:null,paths:[],centerLocation:[25.046432,102.709372],level:1,clusterBubbleList:[],markerGeometries:[],marker:null}),d={1:6.5,2:8,3:10.5};M(async()=>{window.marker=null,u()});const u=async()=>{const s=new window.TMap.LatLng(24.8487,102.766351);window.map=new window.TMap.Map(document.getElementById("container"),{center:s,zoom:6.5}),window.map.removeControl(window.TMap.constants.DEFAULT_CONTROL_ID.ZOOM),window.map.removeControl(window.TMap.constants.DEFAULT_CONTROL_ID.SCALE),window.map.removeControl(window.TMap.constants.DEFAULT_CONTROL_ID.ROTATION),i(),c()},i=()=>{e.markerCluster=new window.TMap.MarkerCluster({map:window.map,enableDefaultStyle:!1,minimumClusterSize:3,geometries:n.geometriesList,zoomOnClick:!0,gridSize:60,averageCenter:!1,maxZoom:6.5}),m()},m=()=>{e.markerCluster.on("cluster_changed",function(s){e.clusterBubbleList.length&&(e.clusterBubbleList.forEach(function(t){t.destroy()}),e.clusterBubbleList=[]),e.markerGeometries=[],e.markerCluster.getClusters().forEach(function(t){if(t.geometries.length>1){let o=new window.ClusterBubble({map:window.map,position:t.center,content:t.geometries.length,properties:t.geometries[0].properties});o.on("click",()=>{window.map.fitBounds(t.bounds)}),e.clusterBubbleList.push(o)}else e.markerGeometries.push({position:t.center,properties:t.geometries[0].properties})}),r()})},r=()=>{window.marker?window.marker.setGeometries(e.markerGeometries):(window.marker=new window.TMap.MultiMarker({map:window.map,styles:{default:new window.TMap.MarkerStyle({width:34,height:42,anchor:{x:17,y:21},src:"https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/marker_blue.png"})},geometries:e.markerGeometries}),w())},c=async()=>{const s=await C({keyword:n.regionId,get_polygon:1,max_offset:3e3});if(!s.result[0].length)return;const a=s.result[0];e.level=a[0].level,e.centerLocation=[a[0].location.lat,a[0].location.lng],a.forEach(t=>{const o=[];t.polygon.forEach(h=>{o.push([h.reverse()])}),e.paths.push({path:o,styleId:"styel1"})}),!e.area&&(e.area=new window.TMap.visualization.Area({styles:{styel1:{fillColor:"rgba(209, 230, 255, 0.5)",strokeColor:"#6ba3fe"}}}).setData(e.paths).addTo(window.map))},w=()=>{e.infoWindow=new window.TMap.InfoWindow({map:window.map,position:new window.TMap.LatLng(39.984104,116.307503),offset:{x:0,y:-40}}),e.infoWindow.close(),window.marker.on("click",async s=>{const{geometry:a}=s,t=await _(a.properties.project_id),o=await b({project_id:a.properties.project_id});e.infoWindow.open(),e.infoWindow.setPosition(s.geometry.position),e.infoWindow.setContent(`
      <div class='map-info-container'>
				<div class='top-title'>
					<span>\u5168\u540D\u5065\u8EAB\u8DB3\u7403\u6BD4\u8D5B</span>
					<span class=${t.status==1?"info":t.status==2?"warning":t.status==4?"danger":""}>${t.status_str}</span>
				</div>
				<img class='top-img' src=${o.data.project_img&&o.data.project_img.length?o.data.project_img[0].full_url:"https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/em.jpg"}>
				<div class='content'>
					<div class='info'>
						<div>
							<img class='icon' src='https://zwapitest.wesais.cn/images/company_logo/20231102/cfe5abd3df02338980e44ec2e0d176ce.png'>
							<span class='info-text'>${t.address}</span>
						</div>
						<div>
							<img class='icon' src='https://zwapitest.wesais.cn/images/company_logo/20231102/19a9598c1e62827de9cd83fb8b4a57bd.png'>
							<span class='info-text'>${t.name}</span>
						</div>
					</div>
					<div id='mapInfo' data-id=${a.properties.project_id} data-typeid=${a.properties.type_id} class='check-detail'>\u67E5\u770B\u8BE6\u60C5 <span>></span></span></div>
				</div>
				<div class='footer'>
					<div>
						<span>\u9884\u8BA1\u5EFA\u8BBE\u65F6\u95F4</span>
						<span class='num'>${t.build_time_str}</span>
					</div>
				</div>
			</div>
				`),g()})},g=()=>{document.getElementById("mapInfo").addEventListener("click",f)},f=s=>{p.push({name:"projectSubmitDetail",query:{project_id:s.target.dataset.id,type_id:s.target.typeid}})},_=async s=>{const{data:a}=await v({project_id:s});return a};return B(()=>n.geometriesList,j(async()=>{var s,a;e.paths=[],(s=e.infoWindow)==null||s.close(),(a=e.area)==null||a.destroy(),e.clusterBubbleList.length&&(e.clusterBubbleList.forEach(function(t){t.destroy()}),e.clusterBubbleList=[]),e.markerGeometries=[],i(),r(),await c(),window.map.setCenter(e.centerLocation),window.map.setZoom(d[e.level]),e.area.setData(e.paths).addTo(window.map),e.markerCluster.setGeometries(n.geometriesList)},500)),(s,a)=>(T(),E("div",I))}});const W=D(O,[["__scopeId","data-v-5c86515a"]]);export{W as default};
