import{_ as x,a5 as E,r as f,o as I,y as L,q as c,v as y,p as g,P as _,x as v,n as T,s as J,ay as P,l as O,bv as b,a0 as N,a1 as B}from"./index.8d733f79.js";import{i as V}from"./deviceType.30ac56e5.js";const $=d=>(N("data-v-a3c0299e"),d=d(),B(),d),A=$(()=>y("div",{id:"mapContainer"},null,-1)),F={style:{"margin-top":"10px"}},R=E({name:"ModalMapPointModal"}),z=Object.assign(R,{emits:["updateData"],setup(d,{expose:M,emit:j}){let a=null,u=!1,s=null;const p=f(!1),l=f([]);function k(e){p.value=!0,P(()=>{V({deviceType:e.deviceType}).then(i=>{var o;l.value=i.data,(o=e.pointInfoList)!=null&&o.length&&e.pointInfoList.forEach(n=>{const r=l.value.find(w=>w.identifier===n.pointIdentifier);r&&(r.position={x:n.x,y:n.y,z:n.z})}),h(e)}),document.getElementById("mapContainer").addEventListener("click",i=>{if(i.target.classList.contains("jsmapplugin-point")){document.querySelectorAll(".jsmapplugin-point").forEach(n=>n.classList.remove("jsmapplugin-point-active")),i.target.classList.add("jsmapplugin-point-active");const o=i.target.getAttribute("data-point");s=JSON.parse(o),u=!0}})})}const S={rotate:20,tilt:70,distance:70};function h(e){a=new jsmapplugin.JSMap({container:"mapContainer",mapServerURL:"/loadMap/device",showLoading:!0,viewOptions:e.mapInfo?JSON.parse(e.mapInfo):S,backgroundColor:"#00264c",selectedEffect:!1}),a.openMapById(e.fileName.split(".")[0],{modelType:jsmapplugin.JSModelType.GLTF}),a.on(jsmapplugin.JSEventType.LOAD_COMPLETE,()=>{console.log("\u52A0\u8F7D\u5B8C\u6210",l.value),C()}),a.on(jsmapplugin.JSEventType.CLICK_NODE,t=>{if(console.log(t,t.mapCoord),t.FID&&u&&s){a.removeMarkerByFilter(jsmapplugin.JSMarkerType.DOM_MARKER,o=>o?o.get("identifier")===s.identifier:!1);const i=new jsmapplugin.JSDomMarker({id:s.identifier,position:t.mapCoord,content:`<div class="jsmapplugin-dom" ><div class="jsmapplugin-text">${s.name}</div><div class="jsmapplugin-line"></div><div class="jsmapplugin-point" data-point='${JSON.stringify(s)}'></div></div>`,show:!0,properties:{identifier:s.identifier,name:s.name},callback:o=>{u=!1;const n=l.value.find(r=>r.identifier===s.identifier);n.position=t.mapCoord}});a.addMarker(i)}})}const C=()=>{a&&a.removeAllDomMarker();for(let e=0;e<l.value.length;e++){const t=l.value[e],i=new jsmapplugin.JSDomMarker({id:t.identifier,position:t.position||{x:2.474714942726038,y:5.351457367210571,z:.8792980975223372},content:`<div class="jsmapplugin-dom" ><div class="jsmapplugin-text">${t.name}</div><div class="jsmapplugin-line"></div><div class="jsmapplugin-point" data-point='${JSON.stringify(t)}'></div></div>`,show:!0,properties:{identifier:t.identifier,name:t.name},callback:o=>{}});a.addMarker(i)}};function D(){j("updateData",l.value),m()}function m(){a&&(a=null),p.value=!1}return M({showModal:k}),(e,t)=>{const i=O,o=b;return I(),L(o,{title:e.$t("setPointPosition"),modelValue:T(p),"onUpdate:modelValue":t[0]||(t[0]=n=>J(p)?p.value=n:null),width:"800px","align-center":!0,"destroy-on-close":"","append-to-body":"",onClose:m},{footer:c(()=>[y("div",F,[g(i,{onClick:m},{default:c(()=>[_(v(e.$t("cancel")),1)]),_:1}),g(i,{type:"primary",onClick:D},{default:c(()=>[_(v(e.$t("confirm")),1)]),_:1})])]),default:c(()=>[A]),_:1},8,["title","modelValue"])}}}),U=x(z,[["__scopeId","data-v-a3c0299e"]]);export{U as default};
