import{a5 as V,_ as z,b as K,a6 as ie,aA as ne,o as I,c as N,v as j,p as W,a0 as oe,a1 as se,D as F,r as A,bW as le,J as E,w as re,q as O,F as de,A as ce,n as P,y as B,ab as pe,t as ue,s as me,C as ve,O as fe}from"./index.8d733f79.js";import{E as he,a as ge}from"./el-tab-pane.27bff4fc.js";import{n as _e}from"./deviceAnalysis.ce7ce4e7.js";import{_ as ye,d as Te}from"./index.7238d098.js";import{a as be}from"./dashboard.62cdb0f4.js";import Pe from"./deviceDataDetail.4a67ddb6.js";import Me from"./multiTrend.70e1aed8.js";import Ce from"./deviceImg.10d0a770.js";import{l as $e,p as Ie,q as J}from"./deviceTree.170dfbd9.js";import{c as ke}from"./deviceCanvas.1428b070.js";import{u as L}from"./searchStore.0c98fb50.js";import Se from"./tabPane3.ff2ae8e0.js";import De from"./tabPane4.1294d17c.js";import"./noDevice.e92e2fe2.js";import"./el-input-number.60463ef8.js";import"./index.28f6da25.js";import"./exporting.83037eec.js";import"./annotations.d7724f2a.js";import"./mesurePointCheckModal.e6c72632.js";import"./timePicker.917513aa.js";import"./el-date-picker-panel.089dbe6d.js";import"./panel-time-pick.b2dd8e75.js";import"./el-progress.ee3fa77d.js";import"./progressiveImage.298c3f69.js";import"./el-image.a7c44d35.js";import"./el-image-viewer.42b4b63f.js";import"./throttle.04d7163a.js";import"./index.edc51fee.js";import"./el-empty.a60dbc90.js";import"./multiDiagnosis.8917b8b6.js";import"./screenshotItem.4c5c059c.js";import"./deviceStatusDialog.20e27268.js";const H=M=>(oe("data-v-8e0bf4f4"),M=M(),se(),M),xe={style:{width:"100%",height:"100%",position:"relative"}},we=H(()=>j("div",{id:"mapContainer"},null,-1)),Ae=H(()=>j("img",{src:ye,style:{height:"26px",margin:"auto"}},null,-1)),Re=[Ae],Ee=V({name:"ModalMapPointModal"}),Le=Object.assign(Ee,{setup(M,{expose:R}){const{proxy:g}=F(),{t:l,locale:n}=K();let a=null,h=null,r=null,v=[],f,m,T,k,C=null,S={},_=[],e=0,o;const p=ie("handleButtonClick");function y(i,{pointInfoList:t,path:s,mapInfo:d},x,c){T=x,k=c,v=i.slice(0),v.length&&(t==null?void 0:t.length)&&t.forEach(w=>{const q=v.find(ae=>ae.pointIdentifier===w.pointIdentifier);q&&(q.position={x:w.x,y:w.y,z:w.z})}),G(s,d);const b=document.getElementById("mapContainer");a&&h&&h.removeEventListener("click",a),b.addEventListener("click",u),a=u,h=b}function u(i){if(i.target.classList.contains("pop_arrow_r")&&(e=Math.min(e+1,_.length-3),D()),i.target.classList.contains("pop_arrow_l")&&(e=Math.max(e-1,0),D()),i.target.classList.contains("pop_tabItem")){document.querySelectorAll(".pop_tabItem").forEach(d=>d.classList.remove("pop_tabItem_active")),i.target.classList.add("pop_tabItem_active");const t=i.target.getAttribute("data-tab"),s=_.find(d=>d.tag===t);U(s)}if(i.target.classList.contains("jsmapplugin-point-1")){const t=i.target.getAttribute("data-point");f=v.find(s=>s.pointIdentifier===t),X()}}const D=()=>{let i=0;for(let s=0;s<e;s++)i-=C;const t=document.querySelector(".tabWrap");t.style.transform=`translateX(${i}px)`},U=i=>{if(!_.length)return;const t=document.querySelector(".popTabContent");let s="";i.data.length&&(s+=`
              <table class="p-table">
                <thead>
                  <tr>
                    <th>\u540D\u79F0</th>
                    <th>\u6570\u636E</th>
                    <th>\u5355\u4F4D</th>
                    <th>\u65F6\u95F4</th>
                  </tr>
                </thead>
                <tbody>
                  ${i.data.map(d=>`
                      <tr>
                          <td>${d.name}</td>
                          <td>${d.value}</td>
                          <td>${d.unit}</td>
                          <td>${d.time}</td>
                      </tr>
                  `).join("")}
                </tbody>
              </table>
            `),t.innerHTML=s},X=()=>{m&&(r.removeMarkerByFilter(jsmapplugin.JSMarkerType.DOM_MARKER,c=>c?c.get("popType")==="pointPop":!1),m=null);let i=!1;const t=f.metricList||[];for(let c=0;c<t.length;c++)if(t[c].isAlarm){i=!0;break}const s=t.filter(c=>c.isAlarm),d=t.filter(c=>!c.isAlarm),x=[...s,...d];m=new jsmapplugin.JSDomMarker({id:"pointPop",position:f.position,show:!0,content:`<div class="popContainer_point">
                <div class="main ${i?"alarm":""}">
                  <div class="linkText" id="pointLink">${l("detail")}</div>
                  <img src="/imgs/close.png" class="pointPopClose" id="closePointPop"/>
                  <div class="content" id="popPointMain">
                    <div class="tit">${f.pointName}</div>
                    <div class="item-wrap">
                      ${x.length?x.map(c=>`
                        <div class="item">
                          <div>${c.metricName}${c.unit?`(${c.unit})`:""}</div>
                          <div style="color: ${c.isAlarm?"#d31a1a":""};padding-left: 6px">${c.value||""}</div>
                        </div>
                      `).join(""):"\u6682\u672A\u914D\u7F6E\u6307\u6807\u5C55\u793A\u987A\u5E8F\uFF0C\u8BF7\u53BB\u5DE5\u5382\u8BBE\u5907\u7C7B\u578B\u4E2D\u914D\u7F6E\u3002"}
                    </div>
                  </div>
                </div>
              </div>`,marginOffset:{x:0,y:-80},properties:{popType:"pointPop"},callback:c=>{setTimeout(()=>{$("#closePointPop").click(()=>{r.removeMarkerByFilter(jsmapplugin.JSMarkerType.DOM_MARKER,b=>b?b.get("popType")==="pointPop":!1),m=null}),document.querySelector(".popContainer_point").parentElement.style.zIndex=9,$("#pointLink").click(()=>{const b={pointId:f.pointId,pointName:f.pointName,deviceId:T,allName:`${k}/${f.pointName}`,pointType:f.pointType,sensorProductKey:f.sensorProductKey};p(b)})},100)}}),r.addMarker(m)},Y={rotate:20,tilt:70,distance:70};function G(i,t){r=new jsmapplugin.JSMap({container:"mapContainer",mapServerURL:"/loadMap",showLoading:!0,viewOptions:t?JSON.parse(t):Y,backgroundColor:"#00264c",selectedEffect:!1}),r.openMapById(i.split(".")[0],{modelType:jsmapplugin.JSModelType.GLTF}),r.on(jsmapplugin.JSEventType.LOAD_COMPLETE,()=>{console.log("\u52A0\u8F7D\u5B8C\u6210",v),Q()}),r.on(jsmapplugin.JSEventType.CLICK_NODE,s=>{console.log(s,s.mapCoord),s.properties&&s.properties.get("name")&&(o&&(clearTimeout(o),o=null),o=setTimeout(()=>{const d=s.properties.get("name");S=s.mapCoord,Z(d)},500))})}const Q=()=>{r&&r.removeAllDomMarker();for(let i=0;i<v.length;i++){const t=v[i],s=new jsmapplugin.JSDomMarker({id:t.pointIdentifier,position:t.position||{x:2.474714942726038,y:5.351457367210571,z:.8792980975223372},content:`<div class="jsmapplugin-dom" ><div class="jsmapplugin-text">${t.pointName}</div><div class="jsmapplugin-line"></div><div class="jsmapplugin-point-1" data-point='${t.pointIdentifier}'></div></div>`,show:!0,properties:{identifier:t.pointIdentifier,name:t.pointName},callback:d=>{}});r.addMarker(s)}},Z=i=>{be({modelCode:i,deviceId:T}).then(t=>{var s;(s=t.data)!=null&&s.length&&(_=t.data||[],ee())})},ee=()=>{m&&(r.removeMarkerByFilter(jsmapplugin.JSMarkerType.DOM_MARKER,i=>i?i.get("popType")==="modelPop":!1),m=null),m=new jsmapplugin.JSDomMarker({id:"modelPop",position:S,show:!0,content:`<div class="deviceModelPop" id="popContainer_info">
                <div class="popTitle">
                  <span>${l("deviceData")}</span> 
                  <img src="/imgs/close.png" class="popClose" id="closePop"/>
                </div>
                <div class="popContent">
                  <div class="popTab">
                    ${_.length>3?'<div class="arrow pop_arrow_l" style="margin-right: 7px"><</div>':""}
                    <div class="tabContainer"></div>
                    ${_.length>3?'<div class="arrow pop_arrow_r" style="margin-left: 7px">></div>':""}
                  </div>
                  <div class="popTabContent"></div>
                </div>
              </div>`,properties:{popType:"modelPop"},callback:i=>{setTimeout(()=>{const t=document.querySelector(".tabContainer");C=(t.offsetWidth-2)/3;const s=`<div class="tabWrap">
                        <div class="tab-ul">
                          ${_.map(d=>`
                            <div class="pop_tabItem" data-tab='${d.tag}' style="width: ${C}px">${d.tag}</div>
                          `).join("")}
                        </div>
                      </div>`;t.innerHTML=s,setTimeout(()=>{$(".pop_tabItem")[0].click()},100),$("#closePop").click(()=>{r.removeMarkerByFilter(jsmapplugin.JSMarkerType.DOM_MARKER,d=>d?d.get("popType")==="modelPop":!1),m=null}),document.getElementById("popContainer_info").parentElement.style.zIndex=9},100)}}),r.addMarker(m)},te=()=>{g.$refs.deviceDataDetailRef.showModal(T)};return ne(()=>{a&&h&&(h.removeEventListener("click",a),a=null,h=null),o&&(clearTimeout(o),o=null),r&&(r.destroy&&r.destroy(),r=null)}),R({loadDeviceModel:y}),(i,t)=>(I(),N("div",xe,[we,j("div",{class:"resumeSwitch",onClick:te},Re),W(Pe,{ref:"deviceDataDetailRef"},null,512)]))}}),Ne=z(Le,[["__scopeId","data-v-8e0bf4f4"]]);const je=V({name:"DeviceAnalysis"}),qe=Object.assign(je,{setup(M,{expose:R}){const{t:g}=K(),{proxy:l}=F(),n=A({}),a=A(""),h=A(!1),r=A([]),v=le({deviceCanvas:null,multiTrend:Me,equipmentPhoto:Ce,screenshotManagement:Se,deviceStatus:De});E.session.getJSON("userInfo"),re(()=>a.value,e=>{L().setChartTree({clickDeviceTab:e})});function f(e){if(n.value={...e},E.session.getJSON("userInfo").userType!==2){const o=E.session.getJSON("userInfo").superType===2,p=[{name:g("overView"),hasAuth:!0,identifier:"deviceCanvas"},{name:g("mutiTrend"),hasAuth:!0,identifier:"multiTrend"},{name:g("deviceImg"),hasAuth:!0,identifier:"equipmentPhoto"},{name:g("screenshotManagement"),hasAuth:!0,identifier:"screenshotManagement"},{name:g("deviceStatusManage"),hasAuth:!0,identifier:"deviceStatus"}];r.value=o?p.filter(D=>!["screenshotManagement","deviceStatus"].includes(D.identifier)):p;const y={tabPane3:"screenshotManagement",tabPane4:"deviceStatus"},u=l.$route.query.activeName?y[l.$route.query.activeName]:null;a.value=u||L().chartTree.clickDeviceTab||a.value||r.value[0].identifier,a.value==="deviceCanvas"?T():a.value==="equipmentPhoto"?setTimeout(()=>{l.$refs.equipmentPhotoRef[0].init({...n.value})}):a.value==="screenshotManagement"?setTimeout(()=>{l.$refs.screenshotManagementRef[0].initData({...n.value,allParentName:n.value.devicePath})},0):a.value==="deviceStatus"?setTimeout(()=>{l.$refs.deviceStatusRef[0].initData({...n.value})},0):setTimeout(()=>{l.$refs.multiTrendRef[0].loadChart({...n.value})},0)}else m()}function m(){r.value=[],$e({deviceId:n.value.deviceId||n.value.id}).then(e=>{for(let o=0;o<e.data.length;o++)if(e.data[o].identifier==="precisionDiagnosis")for(let p=0;p<e.data[o].children.length;p++){const y=e.data[o].children[p],u=["deviceCanvas","multiTrend","equipmentPhoto","screenshotManagement","deviceStatus"];y.hasAuth&&u.includes(y.identifier)&&r.value.push(y)}if(r.value.length){const o={tabPane3:"screenshotManagement",tabPane4:"deviceStatus"},p=l.$route.query.activeName?o[l.$route.query.activeName]:null;a.value=p||L().chartTree.clickDeviceTab||a.value||r.value[0].identifier,a.value==="deviceCanvas"?T():a.value==="multiTrend"?setTimeout(()=>{l.$refs.multiTrendRef[0].loadChart({...n.value})},0):a.value==="equipmentPhoto"?setTimeout(()=>{l.$refs.equipmentPhotoRef[0].init({...n.value})}):a.value==="screenshotManagement"?setTimeout(()=>{l.$refs.screenshotManagementRef[0].initData({...n.value,allParentName:n.value.devicePath})},0):a.value==="deviceStatus"&&setTimeout(()=>{l.$refs.deviceStatusRef[0].initData({...n.value})},0)}})}function T(){h.value=!1,_e({deviceId:n.value.deviceId||n.value.id,switchType:2}).then(e=>{Ie({deviceId:n.value.deviceId||n.value.id}).then(o=>{var p;h.value=!0,(p=o.data)!=null&&p.isExist?(v.value.deviceCanvas=Ne,setTimeout(()=>{l.$refs.deviceCanvasRef[0].loadDeviceModel(e.data.pointList||[],o.data,n.value.deviceId||n.value.id,e.data.devicePath)},0)):(v.value.deviceCanvas=Te,setTimeout(()=>{k(e.data||{})},0))})})}function k(e){var o;if((o=e.pointList)!=null&&o.length){const p=ke.handleCanvasData(e.pointList);l.$refs.deviceCanvasRef[0].initCanvas({mode:"pop",imageUrl:e.fileId||"",pointData:p||[],canEditPopPosition:!0,deviceId:n.value.deviceId||n.value.id,factoryId:n.value.factoryId||e.factoryId,devicePath:e.devicePath,from:"overView"})}else l.$refs.deviceCanvasRef[0].initCanvas({mode:"pop",imageUrl:e.fileId||"",pointData:[],deviceId:n.value.deviceId||n.value.id,devicePath:e.devicePath,from:"overView"})}function C(){a.value==="multiTrend"?setTimeout(()=>{l.$refs.multiTrendRef[0].loadChart({...n.value})},0):a.value==="deviceCanvas"?T():a.value==="equipmentPhoto"?setTimeout(()=>{l.$refs.equipmentPhotoRef[0].init({...n.value})}):a.value==="screenshotManagement"?setTimeout(()=>{l.$refs.screenshotManagementRef[0].initData({...n.value,allParentName:n.value.devicePath})},0):a.value==="deviceStatus"&&setTimeout(()=>{l.$refs.deviceStatusRef[0].initData({...n.value})},0),document.getElementById(`tab-${a.value}`).blur()}function S(e){J({pointId:e.id,factoryId:e.factoryId,deviceId:e.deviceId,popupX:e.extraPoint.x,popupY:e.extraPoint.y,popupW:e.width||200,popupH:e.height||200}).then(()=>{l.$modal.msgSuccess(g("savePopPosition"))}).catch(()=>{})}function _(e){J({pointId:e.id,popupW:e.width,popupH:e.height,deviceId:e.deviceId,factoryId:e.factoryId,popupX:e.x,popupY:e.y}).then(()=>{l.$modal.msgSuccess(g("savePopSize"))}).catch(()=>{})}return R({showTarget:f}),(e,o)=>{const p=he,y=ge;return I(),N("div",{style:fe({marginTop:P(l).$route.query.mode?"36px":0,height:P(l).$route.query.mode?"calc(100% - 40px)":"100%"})},[W(y,{style:{height:"100%",width:"100%"},class:"cardLineTab",modelValue:P(a),"onUpdate:modelValue":o[0]||(o[0]=u=>me(a)?a.value=u:null),type:"card",onTabChange:C,onKeydownCapture:o[1]||(o[1]=ve(()=>{},["stop"]))},{default:O(()=>[(I(!0),N(de,null,ce(P(r),u=>(I(),B(p,{key:u.identifier,label:u.name,name:u.identifier,style:{width:"100%"}},{default:O(()=>[P(a)==="deviceCanvas"&&P(h)||["multiTrend","equipmentPhoto","screenshotManagement","deviceStatus"].includes(P(a))?(I(),B(pe(P(v)[u.identifier]),{key:0,ref_for:!0,ref:u.identifier+"Ref",onCallBackPoints:S,onPopSizeChange:_},null,544)):ue("",!0)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])],4)}}}),gt=z(qe,[["__scopeId","data-v-c0b92940"]]);export{gt as default};
