/**加载iframe等待框 */ let m_iframe_loading_index = null /** 关闭加载iframe时的loading*/ function closeLoading() { if (m_iframe_loading_index != null) layer.close(m_iframe_loading_index); } var runBim = function () { this.showColor = function () { //console.log("aa"); }; let m_corpID = 5; var m_StationID = 24; var m_stationInfo = null; var m_bimApp = null; var m_bimViewer = null; var m_BimfaceFileID = ''; var m_current_active_product = null;//当前激活的机泵 var m_allMonitorPanel = [];//监控面板 var m_allProductTree = [];//机泵等资产树 var m_layerList = null;//常规图层设置 var m_layer4Builder = null;//建筑外墙图层 var m_viewList = null;//视图设置 var m_walkThroughList = null;//漫游路线 var m_lastRecordsInBimPanel = [];//记录 var m_isViewMinitorPanel = true;//是否显示监控面板 var m_clusterItem;//聚合标签对象 var m_selWalkRounteIndex = 0;//选择路线下标 var m_currentWalk = null;//漫游对象 var m_walkCamera4Pause = null;//巡游暂停视角 var m_walkCameraDefault = null;//BIM加载默认视角 var m_currentEmployeeID = 1; var m_setInterval = {};//定时器对象 var m_chartMain = null; /** * 泵站下是所有测点 */ let m_stationMonitorList = []; let m_asideBoxIsShow = false;//放大展示容器是否显示中 this.initDataStationCenter = function (station_id) { m_StationID = 24; m_currentEmployeeID = 1; if (m_currentEmployeeID == "" || m_currentEmployeeID <= 0) m_currentEmployeeID = 1; m_current_active_product = null;//当前激活的机泵 //初始化layui layui.use(['table'], function () { initialBimfaceView(); }); } //获取泵站监控值 function getStationMonitorData() { //Monitor/MonitorPoint/GetByBelongTypeAndBelongID@V1.0 return new Promise(resolve => { $.ajax({ type: "get", contentType: "application/json;utf-8", dataType: 'json', url: GlobalParas.Url.MainApi + "LargeScreen/Demo/Monitor/GetMasterGeneralRealMonitorPointListByStationID", data: { StationID : m_StationID, CorpID: m_corpID, }, success: function (result) { // console.log(result, 54) resolve(result) }, error: function (textStatus, errorThrown) { console.log("bim.station 与服务器交互错误, 错误代码 90, 信息: " + JSON.stringify(textStatus)); } }); }) } //获取设备监控值 function getProductMonitorData(id) { return new Promise(resolve => { $.ajax({ type: "get", contentType: "application/json;utf-8", dataType: 'json', url: GlobalParas.Url.MainApi + "LargeScreen/Demo/Monitor/GetGeneralRealMonitorPointListByProductID", data: { ProductID: id, CorpID: m_corpID, }, success: function (result) { // console.log(result, 54) resolve(result) }, error: function (textStatus, errorThrown) { console.log("bim.station 与服务器交互错误, 错误代码 90, 信息: " + JSON.stringify(textStatus)); } }); }) } //获取泵站机泵列表 function getPumpListByStationID() { // Product/Product/GetPumpListByBelongTypeAndBelongID@V1.0 return new Promise(resolve => { $.ajax({ type: "get", contentType: "application/json;utf-8", dataType: 'json', url: GlobalParas.Url.MainApi + "LargeScreen/Demo/EnginePump/GetSimpleListByStationID", data: { StationID: m_StationID, CorpID: m_corpID, }, success: function (result) { //console.log(result, 81) resolve(result) }, error: function (textStatus, errorThrown) { console.log("bim.station 与服务器交互错误, 错误代码 90, 信息: " + JSON.stringify(textStatus)); } }); }) } //获取泵站详细信息 function getStationDetailInfo() { return new Promise(resolve => { $.ajax({ type: "get", contentType: "application/json;utf-8", dataType: 'json', url: GlobalParas.Url.MainApi + "LargeScreen/Demo/Station/GetDetailByID", data: { ID: m_StationID, CorpID: m_corpID, }, success: function (result) { //console.log(result, 81) resolve(result) }, error: function (textStatus, errorThrown) { console.log("bim.station 与服务器交互错误, 错误代码 90, 信息: " + JSON.stringify(textStatus)); } }); }) } //获取bim展示的基本信息 async function getProdunctInfo() { let ProductTree = [{}, {}]; let StattionResData = await getStationDetailInfo(); let stationInfo = null if (StattionResData.Code != 0) { stationInfo = null } stationInfo = StattionResData.Data; let StationMonitorResData = await getStationMonitorData(); let stationMonitor = null; if (StationMonitorResData.Code != 0) { stationMonitor = null } stationMonitor = StationMonitorResData.Data; let stationRecordList = []; if (stationMonitor != null) { m_stationMonitorList = stationMonitor; for (var i = 0; i < stationMonitor.length; i++) { let x = stationMonitor[i]; let y = x.SignalList if (x.Name == "电流") { continue; } if (x.Name == "运行状态") { continue; } stationRecordList.push( { "RecordType": y && y.length > 0 ? y[0].SignalType : '', "RecordName": x.Name, "RecordUnitName": y && y.length > 0 ? y[0].UnitValue : '', "SortCode": x.SortCode, "Tag": "", "RecordValueType": y && y.length > 0 ? y[0].ValueType : '', "RecordValueEnumDict": null, "PointID": y && y.length > 0 ? y[0].MonitorPointID : '', "RecordTime": null, "RecordValue": 0, "RecordStatus": x.UseStatus } ) } } let stationBaseInfo = { "ID": '', "Name": "", "Address": "", "Longitude": '', "Latitude": '', "PumpNumber": 0 } if (stationInfo != null) { ProductTree[0] = { "NodeID": "S4", "Name": "泵站", "ObjectType": "4", "Nodes": [ { "NodeID": "S" + stationInfo.ID + "child", "ObjectType": "4", "ObjectID": stationInfo.ID, "Name": stationInfo.Name, "BimID": stationInfo.BimID ? stationInfo.BimID : null, "RunStatus": 0, "RecordList": stationRecordList } ] } stationBaseInfo.ID = stationInfo.ID; stationBaseInfo.Name = stationInfo.Name; stationBaseInfo.Address = stationInfo.Address; } let pumpResData = await getPumpListByStationID() let pumpInfo = null; if (pumpResData.Code != 0) { pumpInfo = null; } pumpInfo = pumpResData.Data; if (pumpInfo != null) { stationBaseInfo.PumpNumber = pumpInfo.length; let Nodes = [] pumpInfo.sort(function (a, b) { return a.ID - b.ID }); for (var i = 0; i < pumpInfo.length; i++) { let x = pumpInfo[i]; let pumpRecordList = []; let pumpRecordInfo = null let pumpResData = await getProductMonitorData(x.ID); if (pumpResData.Code != 0) { pumpRecordInfo = null; } pumpRecordInfo = pumpResData.Data; if (pumpRecordInfo != null) { pumpRecordInfo.forEach(z => { let y = z.SignalList pumpRecordList.push( { "RecordType": y && y.length > 0 ? y[0].SignalType : '', "RecordName": z.Name, "RecordUnitName": y && y.length > 0 ? y[0].UnitValue : '', "SortCode": z.SortCode, "Tag": "", "RecordValueType": y && y.length > 0 ? y[0].ValueType : '', "RecordValueEnumDict": { "-2": "未知", "-1": "故障", "0": "停机", "1": "开机", "2": "工频", "3": "变频" }, "PointID": y && y.length > 0 ? y[0].MonitorPointID : '', "RecordTime": null, "RecordValue": 0, "RecordStatus": z.UseStatus } ) }) } Nodes.push({ "NodeID": "P" + x.ID, "ObjectType": "7102", "ObjectID": x.ID, "Name": x.Name, "BimID": "", "RunStatus": 0, "RecordList": pumpRecordList }) } ProductTree[1] = { "NodeID": "M7102", "Name": "机泵", "ObjectType": "7102", "Nodes": Nodes } } m_allProductTree = ProductTree; m_stationInfo = stationBaseInfo; initialStaionInfo(); // console.log(m_allProductTree, m_stationInfo, 260) } //初始化View function initialBimfaceView() { var bimfaceLoaderConfig; try { bimfaceLoaderConfig = new BimfaceSDKLoaderConfig(); } catch (error) { var message = window.confirm("没有找到JSSDK,点击确定下载最新的JSSDK。"); if (message) { return; } } bimfaceLoaderConfig.dataEnvType = BimfaceEnvOption.Local; bimfaceLoaderConfig.sdkPath = '/Scripts/demo/bim/jssdk'; bimfaceLoaderConfig.path = '/Scripts/demo/bim/locFile/SHJ.json'; BimfaceSDKLoader.load(bimfaceLoaderConfig, onSDKLoadSucceeded, function (error) { console.log("Failed to load SDK!"); }); } //加载成功 function onSDKLoadSucceeded(viewMetaData) { var view_element = document.getElementById('bimface-viewer') var webAppConfig = new Glodon.Bimface.Application.WebApplication3DConfig(); webAppConfig.domElement = view_element; var eventManager = Glodon.Bimface.Application.WebApplication3DEvent; m_bimApp = new Glodon.Bimface.Application.WebApplication3D(webAppConfig); m_bimViewer = m_bimApp.getViewer(); m_bimViewer.addModel(viewMetaData); //自定义按钮 https://segmentfault.com/q/1010000012157247?utm_source=tag-newest //"Home","RectangleSelect","Measure","Section","Walk","Map","Property","Setting","Information","FullScreen" //修改按钮显示 https://segmentfault.com/q/1010000012519272?utm_source=tag-newest webAppConfig.Buttons = ["Home", "RectangleSelect", "Measure", "Walk", "Setting", "FullScreen"]; // m_bimApp.addEventListener(Glodon.Bimface.Application.WebApplication3DEvent.ViewAdded, function () { //initialStaionInfo(); getProdunctInfo() }); //初始化DrawableContainer var drawableConfig = new Glodon.Bimface.Plugins.Drawable.DrawableContainerConfig(); drawableConfig.viewer = m_bimViewer; m_drawableContainer = new Glodon.Bimface.Plugins.Drawable.DrawableContainer(drawableConfig); //// 监听添加view进行中的时间,可获取添加进度 //app.addEventListener(Glodon.Bimface.Application.WebApplication3DEvent.ViewLoading, function (progress) { // //console.log(progress); //}); }; //从后台获取数据 function initialStaionInfo() { let loading_index = layer.load(2) $.ajax({ type: "get", contentType: "application/json;utf-8", dataType: 'json', url: GlobalParas.Url.MainApi + "LargeScreen/Demo/Bimface/GetDefaultWithViewTokenByStationID", data: { StationID: m_StationID, CorpID: m_corpID }, success: function (result) { layer.close(loading_index); // console.log(result, 309) if (result.Code != 0) { alert(result.Message); return; } var data = result.Data; if (m_StationID == 24) { m_allMonitorPanel_pump = [ { "NodeID": "P638", "ObjectType": 7102, "ObjectID": 638, "Name": "1#机组", "BimID": "556792", "RunStatus": 1, "RecordList": [ { "RecordType": 12203, "RecordName": "上次报警", "RecordUnitName": " ", "SortCode": 0, "PointID": 1947, "RecordTime": '2021-01-06 10:25:46', "RecordValue": 0, "RecordStatus": 0 }, { "RecordType": 12203, "RecordName": "上次巡检", "RecordUnitName": " ", "SortCode": 0, "PointID": 1947, "RecordTime": '2021-01-06 10:25:46', "RecordValue": 0, "RecordStatus": 0 }, ], "Posi": { x: -19388.94216280575, y: 36537.834941455614, z: 1032.7121236119422 }, "IsDispSignal": true }, { "NodeID": "P641", "ObjectType": 7102, "ObjectID": 641, "Name": "2#机组", "BimID": "577484", "RunStatus": 0, "RecordList": [ { "RecordType": 12203, "RecordName": "上次报警", "RecordUnitName": " ", "SortCode": 0, "PointID": 1947, "RecordTime": '2021-01-06 10:25:46', "RecordValue": 0, "RecordStatus": 0 }, { "RecordType": 12203, "RecordName": "上次巡检", "RecordUnitName": " ", "SortCode": 0, "PointID": 1947, "RecordTime": '2021-01-06 10:25:46', "RecordValue": 0, "RecordStatus": 0 }, ], "Posi": { x: -14232.825622448117, y: 36670.5276060532, z: 1118.8246081718353 }, "IsDispSignal": true }, { "NodeID": "P644", "ObjectType": 7102, "ObjectID": 644, "Name": "3#机组", "BimID": "577763", "RunStatus": -2, "RecordList": [ { "RecordType": 12203, "RecordName": "上次报警", "RecordUnitName": " ", "SortCode": 0, "PointID": 1947, "RecordTime": '2021-01-06 10:25:46', "RecordValue": 0, "RecordStatus": 0 }, { "RecordType": 12203, "RecordName": "上次巡检", "RecordUnitName": " ", "SortCode": 0, "PointID": 1947, "RecordTime": '2021-01-06 10:25:46', "RecordValue": 0, "RecordStatus": 0 }, ], "Posi": { x: -9225.393698254264, y: 36639.04270429188, z: 1103.3341939650677 }, "IsDispSignal": true }, { "NodeID": "P647", "ObjectType": 7102, "ObjectID": 647, "Name": "4#机组", "BimID": "577777", "RunStatus": 0, "RecordList": [ { "RecordType": 12203, "RecordName": "上次报警", "RecordUnitName": " ", "SortCode": 0, "PointID": 1947, "RecordTime": '2021-01-06 10:25:46', "RecordValue": 0, "RecordStatus": 0 }, { "RecordType": 12203, "RecordName": "上次巡检", "RecordUnitName": " ", "SortCode": 0, "PointID": 1947, "RecordTime": '2021-01-06 10:25:46', "RecordValue": 0, "RecordStatus": 0 }, ], "Posi": { x: -3217.8937161791355, y: 36604.53761966858, z: 1084.890847366324 }, "IsDispSignal": true }, { "NodeID": "P650", "ObjectType": 7102, "ObjectID": 650, "Name": "5#机组", "BimID": "577777", "RunStatus": 0, "RecordList": [ { "RecordType": 12203, "RecordName": "上次报警", "RecordUnitName": " ", "SortCode": 0, "PointID": 1947, "RecordTime": '2021-01-06 10:25:46', "RecordValue": 0, "RecordStatus": 0 }, { "RecordType": 12203, "RecordName": "上次巡检", "RecordUnitName": " ", "SortCode": 0, "PointID": 1947, "RecordTime": '2021-01-06 10:25:46', "RecordValue": 0, "RecordStatus": 0 }, ], "Posi": { x: 1674.1473669538157, y: 36567.261566113666, z: 1056.8619213851346 }, "IsDispSignal": true }, { "NodeID": "P653", "ObjectType": 7102, "ObjectID": 653, "Name": "6#机组", "BimID": "577777", "RunStatus": 0, "RecordList": [ { "RecordType": 12203, "RecordName": "上次报警", "RecordUnitName": " ", "SortCode": 0, "PointID": 1947, "RecordTime": '2021-01-06 10:25:46', "RecordValue": 0, "RecordStatus": 0 }, { "RecordType": 12203, "RecordName": "上次巡检", "RecordUnitName": " ", "SortCode": 0, "PointID": 1947, "RecordTime": '2021-01-06 10:25:46', "RecordValue": 0, "RecordStatus": 0 }, ], "Posi": { x: 6673.249153824896, y: 36582.51354159763, z: 1069.3788946260677 }, "IsDispSignal": true }, ]; } else { m_allMonitorPanel_pump = [] } if (data.FileSettings) { if (data.FileSettings.CustomCameraStatus3ds != null && data.FileSettings.CustomCameraStatus3ds.length > 0) { let CustomCameraStatus3ds = data.FileSettings.CustomCameraStatus3ds; let tempArr = [] CustomCameraStatus3ds.forEach(x => { tempArr.push({ CameraStatus_3D: x.CameraStatus3d, KeyFrame: x.KeyFrame, ThumbnailImage: x.ThumbnailImage, KeyFrame: x.KeyFrame, ID: x.ID, Name: x.Name, }) }) m_viewList = tempArr } if (data.FileSettings.CustomWalkThroughs && data.FileSettings.CustomWalkThroughs.length > 0) { let CustomWalkThroughs = data.FileSettings.CustomWalkThroughs let tempArr = []; CustomWalkThroughs.forEach(x => { let CustomKeyFrames = [] if (x.CustomKeyFrames && x.CustomKeyFrames.length > 0) { x.CustomKeyFrames.forEach(y => { CustomKeyFrames.push({ id: y.KeyFrame.id, pauseTime: y.PauseTime, position: y.KeyFrame.position, target: y.KeyFrame.target, coordinateSystem: y.KeyFrame.coordinateSystem, }) }) } tempArr.push({ id: x.ID, name: x.Name, totalTime: x.Time, frames: CustomKeyFrames, }) }) m_walkThroughList = tempArr } if (data.FileSettings.CustomComponentLayers && data.FileSettings.CustomComponentLayers.length > 0) { m_layerList = data.FileSettings.CustomComponentLayers;//常规图层 let tempArr = []; let CustomComponentLayers = data.FileSettings.CustomComponentLayers let obj = {} CustomComponentLayers.forEach(x => { // x.Name == "建筑物" || if (x.ComponentType == 1) { tempArr = tempArr.concat(x.ComponentIds) obj.ID = x.ID; obj.Name = "外墙"; obj.ComponentType = x.ComponentType; obj.DisplayColor = x.DisplayColor obj.Translucent = x.Translucent obj.Visible = x.Visible } }) if (tempArr.length > 0) { obj.ComponentIds = tempArr m_layer4Builder = obj } } } let ComponentMappers = null if (data.MappingSettings) { if (data.MappingSettings.MonitorPanelLayers && data.MappingSettings.MonitorPanelLayers.length > 0) { let MonitorPanelLayers = data.MappingSettings.MonitorPanelLayers let tempArr = []; // console.log(m_stationMonitorList, 457) MonitorPanelLayers.forEach(x => { x.MonitorPanels.forEach(y => { let RecordList = [] y.MonitorPointIds.forEach(z => { m_stationMonitorList.forEach(o => { let p = o.SignalList if (p && p.length > 0) { if (z == p[0].MonitorPointID) { RecordList.push({ "RecordType": p[0].SignalType, "RecordName": o.Name, "RecordUnitName": p[0].UnitValue, "SortCode": o.SortCode, "PointID": p[0].MonitorPointID, "RecordTime": null, "RecordValue": 0, "RecordStatus": o.UseStatus }) } } }) }) let obj = { "NodeID": "", "ObjectType": 7102, "ObjectID": "", "Name": y.Name, "BimID": "603301", "RunStatus": 0, "RecordList": RecordList, "Posi": y.WorldPostion, "IsDispSignal": y.ValuesVisible } tempArr.push(obj) }) }) m_allMonitorPanel = tempArr; } if (data.MappingSettings.ComponentMappers && data.MappingSettings.ComponentMappers.length > 0) { ComponentMappers = data.MappingSettings.ComponentMappers } } //console.log(m_allMonitorPanel, 459) if (m_allProductTree != null && m_allProductTree.length == 2) { // if (ComponentMappers != null) { // ComponentMappers.forEach(x => { // if (m_allProductTree[1].Nodes && m_allProductTree[1].Nodes.length > 0) { // m_allProductTree[1].Nodes.forEach(y => { // if (y.ObjectID == x.ObjectID) { // y.BimID = x.ComponentID // } // }) // } // }) // } if (m_allProductTree[1].Nodes && m_allProductTree[1].Nodes.length >= 1) m_allProductTree[1].Nodes[0].BimID = "1389485"; if (m_allProductTree[1].Nodes && m_allProductTree[1].Nodes.length >= 2) m_allProductTree[1].Nodes[1].BimID = "1389429"; if (m_allProductTree[1].Nodes && m_allProductTree[1].Nodes.length >= 3) m_allProductTree[1].Nodes[2].BimID = "1514145"; if (m_allProductTree[1].Nodes && m_allProductTree[1].Nodes.length >= 4) m_allProductTree[1].Nodes[3].BimID = "1514086"; if (m_allProductTree[1].Nodes && m_allProductTree[1].Nodes.length >= 5) m_allProductTree[1].Nodes[4].BimID = "1513993"; if (m_allProductTree[1].Nodes && m_allProductTree[1].Nodes.length >= 6) m_allProductTree[1].Nodes[5].BimID = "1373960"; } if (m_leftCustomMainMenu != null && m_allProductTree != null && m_allProductTree.length > 0) { //产品菜单 buildMainTreeeMenu(); ////初始化属性和监控值,默认显示 buildStationPropHtml(); buildStationMonitorTable(); } //BIM视图上的自定义按钮等 buildBimfaceModelView(); //报警状态闪烁 //checkMachineStatus(); //loadWaterMaterial(); //setTimeout(flowEffect, 200); $(".btn_check").on("click", function () { if ($(this).parent().hasClass("checked")) { $(this).parent().removeClass("checked"); } else { $(this).parent().addClass("checked"); } }) }, error: function (textStatus, errorThrown) { layer.close(loading_index); console.log("BIM.SHJ2 与服务器交互错误, 错误代码 165, 信息: " + JSON.stringify(textStatus)); } }); } //报警状态闪烁 function setBlinkColor() { //console.log(1545554555) //有报警时传入构件ID,构件就开始闪烁 m_bimViewer.addBlinkComponentsById(["1389485"]); m_bimViewer.setBlinkColor(new Glodon.Web.Graphics.Color("#ff0000", 0.8)); m_bimViewer.enableBlinkComponents(true); m_bimViewer.setBlinkIntervalTime(500); m_bimViewer.render(); } //BIM视图上的自定义按钮等 function buildBimfaceModelView() { //点击事件 m_bimViewer.addEventListener("MouseClicked", function (objectdata) { var click_bim_id = objectdata.objectId; console.log(objectdata) if (m_flow_meter_bimid_list.indexOf(click_bim_id) > -1) { showFlowMeterChart(m_flow_meter_bimid_list.indexOf(click_bim_id)); } else if (m_press_meter_bimid_list_outlet.indexOf(click_bim_id) > -1) { showPressMeterChart(m_press_meter_bimid_list_outlet.indexOf(click_bim_id), true); } else if (m_press_meter_bimid_list_inlet.indexOf(click_bim_id) > -1) { showPressMeterChart(m_press_meter_bimid_list_inlet.indexOf(click_bim_id), false); } else if (m_video_bimid_list.indexOf(click_bim_id) > -1) { var position = objectdata.worldPosition showVideoInfo(m_video_bimid_list.indexOf(click_bim_id), position); } else if (m_vibration_bimdid_list.indexOf(click_bim_id) > -1) { showVibrationMeterChart(m_vibration_bimdid_list.indexOf(click_bim_id)); } else { var product = findObjectByBimID(click_bim_id); if (product != null) { highLightBimObject(product.BimID); m_current_active_product = product; if (product.ObjectType == "7102") { $("#product_info_box").removeClass("isStation") excuteMainMenuLiCmd("product", product.NodeID, '') } else { if (!$("#product_info_box").hasClass("isStation")) { excuteMainMenuLiCmd("station", product.NodeID, '') } } } } }); //设置背景颜色 m_bimViewer.setBackgroundColor(new Glodon.Web.Graphics.Color(0, 7, 131, 1));// 230,230,250 31, 91, 117 //设置背景图片S document.querySelector('.bf-view').style.background = "url(../../images/demo/center/bim_bg.jpg)"; document.querySelector('.bf-view').style.backgroundSize = "cover"; m_bimViewer.render(); //设置背景图片E //获取机泵曲线 getFeatCurveByStationIdAndDay(); //上部菜单 bulidBimTopCmdHtml(); //记录BIM默认视角 m_walkCameraDefault = m_bimViewer.getCameraStatus(); //调用菜单命令 initalCmdFuncCb(); //构件巡游路线 bulidWalkThroughList(); //默认显示泵站的属性 showPropGridPanel("station"); showMinitorGridPanel("station"); //初始化工具条 buildBimMenToolBar(); // m_bimViewer.render(); // setTimeout(function () { //初始化视图控件 initialDispViewListPanel(); }, 600); // 在BIM视图中 setTimeout(function () { //添加水效果 addWaterEffect(); //,添加监控状态 //createMinitorPanel(); }, 1200); } //初始化工具条 function buildBimMenToolBar() { $("div[title='目录树']").hide();//隐藏左上角的东西 $(".gld-bf-settings").hide();//设置 $(".gld-bf-properties").hide();//构件详情 $(".gld-bf-map").hide();//地图 $(".gld-bf-firstperson").hide();//漫游 $(".gld-bf-sectionbox").hide();//剖切 $(".gld-bf-measure").hide();//测量 $(".gld-bf-information").hide();//基本信息 $(".gld-bf-zoomrect").hide();//框选 $(".bf-toolbar-bottom").hide();//主菜单 } //BIM上添加的内容 function bulidBimTopCmdHtml() { var CmdHtml = ''; CmdHtml += ''; CmdHtml += '
'; CmdHtml += ' 监测'; CmdHtml += '
'; //wysBimWalkBox CmdHtml += ''; //product_minitor_box CmdHtml += '
'; CmdHtml += '
监控
'; CmdHtml += ' '; //CmdHtml += ' 关闭'; CmdHtml += '
'; CmdHtml += '
'; CmdHtml += '
'; CmdHtml += '
'; CmdHtml += '
'; CmdHtml += '
'; //swiper_container CmdHtml += '
'; //bim_tool_outbox CmdHtml += '
'; CmdHtml += ' '; //CmdHtml += ' '; CmdHtml += ' '; CmdHtml += ' '; CmdHtml += '
'; //product_info_box CmdHtml += '
'; CmdHtml += '
设备管控
'; CmdHtml += '
'; CmdHtml += getProductInfoPanel("station", 0); CmdHtml += '
'; CmdHtml += '
'; $(".bf-container").append(CmdHtml); $(".y_State").click(function () { hydrantplaykey(); }); $(".y_Suspend").click(function () { hydrantpause(); }); $(".y_End").click(function () { hydrantend(); }); $("#btn_bimCmd_search").click(function () { $("#product_search_box").toggle(); }); $("#btn_bimCmd_walk").click(function () { //$("#wysBimWalkBox").toggle(); $(".layui-nav-item.Route,.y_State,.y_Suspend,.y_End").toggle(); }); $("#btn_bimCmd_StationInfo").click(function () { if ($(this).hasClass("checked")) { $(this).removeClass("checked"); showMinitorTipPanel(false); } else { $(this).addClass("checked"); showMinitorTipPanel(true); } }); let diMian = [] let shuiChiShangGai = [] m_layerList && m_layerList.length && m_layerList.forEach(function (item) { if (item.Name == "地面" || item.ComponentType == 2) { diMian = item.ComponentIds } if (item.Name == "水池上盖" || item.ComponentType == 3) { shuiChiShangGai = item.ComponentIds } }); $("#btn_bimCmd_DiMian").click(function () { var ComponentIds = diMian if ($(this).hasClass("checked")) { $(this).removeClass("checked"); layersSlowHide(ComponentIds); } else { $(this).addClass("checked"); layersSlowShow(ComponentIds); } }); $("#btn_bimCmd_bulid").click(function () { var componentIds = []; var newComponentIds = componentIds.concat(m_layer4Builder.ComponentIds, shuiChiShangGai, diMian); if ($(this).hasClass("checked")) { $(this).removeClass("checked"); layersSlowHide(newComponentIds); } else { $(this).addClass("checked"); layersSlowShow(newComponentIds); } }); $("#btn_bimCmd_shuiChi").click(function () { var ComponentIds = shuiChiShangGai if ($(this).hasClass("checked")) { $(this).removeClass("checked"); layersSlowHide(ComponentIds); } else { $(this).addClass("checked"); layersSlowShow(ComponentIds); } }); productInfoCmd() } //模糊查询 S function findObjectByKeyWrd(keyWord) { var reg = new RegExp(keyWord); var arr = []; for (var g = 0; g < m_allProductTree.length; g++) { var child_nodes = m_allProductTree[g].Nodes; for (var c = 0; c < child_nodes.length; c++) { var item = child_nodes[c]; if (reg.test(item.Name)) { arr.push({ Name: item.Name, ID: item.ID }); } } } return arr; } //根据节点ID查找 function findObjectByNodeID(NodeID) { for (var g = 0; g < m_allProductTree.length; g++) { var child_nodes = m_allProductTree[g].Nodes; for (var c = 0; c < child_nodes.length; c++) { var item = child_nodes[c]; if (item.NodeID == NodeID) { return item; } } } return null; } //根据 BimID ID查找 function findObjectByBimID(BimID) { for (var g = 0; g < m_allProductTree.length; g++) { var child_nodes = m_allProductTree[g].Nodes; for (var c = 0; c < child_nodes.length; c++) { var item = child_nodes[c]; if (item.BimID == BimID) { return item; } } } return null; } //菜单 function initalCmdFuncCb() { //视图关闭 $("#product_view_box .close").click(function () { $("#product_view_box").css("display", "none"); $("#cmdShowMachineView").removeClass("wys_checked layui-this"); }); //监控显示/隐藏 var lockMinitor = true; $("#cmdShowMachineMinitor").on("click", function () { if (lockMinitor) { //showMinitorGridPanel("product"); $("#product_minitor_box").css({ "width": "0px" }); $("#product_minitor_box").show(); $("#cmdShowMachineMinitor").hide() $("#product_minitor_box").animate({ width: '368px', height: '600px' }, 1500, function () { lockMinitor = true; }) } lockMinitor = false; }); $("#product_minitor_box .close").click(function () { if (lockMinitor) { $("#product_minitor_box").animate({ width: '0px', height: '0px' }, 1000, function () { lockMinitor = true; $("#cmdShowMachineMinitor").show() $("#product_minitor_box").hide(); }) } lockMinitor = false; }); $(".bim_walk li.Route").on("click", function () { $("#walkThroughList").css({ "display": "block", "left": "445px", "top": "130px" }); if (m_currentWalk) { m_currentWalk.stop(); $(".y_State").removeClass("wys_checked_start"); m_walkCamera4Pause = null;//清空暂停视角 } }); $("#walkThroughList>li").on("click", function () { $("#walkThroughList").css("display", "none"); }); } //路径巡游 function wayTrip(index) { //隐藏 $(".y_State span").text("开始"); $(".y_State").data("y_title", "开始巡游"); $("#walkThroughList").css("display", "none"); m_selWalkRounteIndex = index; // 构造路径漫游配置wtConfig var config = new Glodon.Bimface.Plugins.Walkthrough.WalkthroughConfig(); // 设置路径漫游配置匹配的viewer对象 config.viewer = m_bimViewer; // 构造路径漫游对象 m_currentWalk = new Glodon.Bimface.Plugins.Walkthrough.Walkthrough(config); var hydrantKeyFrames = []; if (m_walkThroughList.length <= 0) return; var WTarr = m_walkThroughList[m_selWalkRounteIndex].frames; if (WTarr.length <= 0) return; for (var i = 0; i < WTarr.length; i++) { hydrantKeyFrames.push(WTarr[i]) } m_currentWalk.setKeyFrames(hydrantKeyFrames); m_currentWalk.play(); m_currentWalk.pause(); } //巡游开始 function hydrantplaykey() { if (!m_currentWalk) { layui.use("layer", function () { layer.msg('请选择路线', { icon: 5 }); }) return; } var time = m_walkThroughList[m_selWalkRounteIndex].totalTime; m_currentWalk.setKeyFrameCallback(keyFrameCallback); m_currentWalk.setWalkthroughTime(time); if (!$(".y_State").hasClass("wys_checked_start")) { $(".y_State span").text(" 继续"); $(".y_State").data("y_title", "继续巡游"); m_currentWalk.play(); $(".y_State").addClass("wys_checked_start"); $(".y_Suspend").removeClass("wys_checked_pause"); $(".y_End").removeClass("wys_checked_stop"); } else if (!$(".y_State").hasClass("wys_checked_continue")) { if (m_walkCamera4Pause) { m_bimViewer.setCameraStatus(m_walkCamera4Pause); } $(".y_State").addClass("wys_checked_continue"); $(".y_Suspend").removeClass("wys_checked_pause"); m_currentWalk.play(); } $("#walkThroughList").css("display", "none"); //console.log(!$(".y_State").hasClass("wys_checked_start")) //console.log(!$(".y_Suspend").hasClass("wys_checked_pause")) //console.log(!$(".y_End").hasClass("wys_checked_stop")) } //巡游暂停 function hydrantpause() { if (!$(".y_Suspend").hasClass("wys_checked_pause")) { m_currentWalk.pause(); $(".y_State").removeClass("wys_checked_continue"); $(".y_Suspend").addClass("wys_checked_pause"); m_walkCamera4Pause = null;//清空视角 m_walkCamera4Pause = m_bimViewer.getCameraStatus(); } } //巡游结束 function hydrantend() { if (!$(".y_End").hasClass("wys_checked_stop")) { $(".y_State span").text("开始"); $(".y_State").data("y_title", "开始巡游"); if ($(".y_Suspend").hasClass("wys_checked_pause")) m_currentWalk.play(); m_currentWalk.stop(); $(".y_State").removeClass("wys_checked_start"); $(".y_End").addClass("wys_checked_stop"); $(".y_Suspend").addClass("wys_checked_pause"); m_walkCamera4Pause = null;//清空暂停视角 if (m_walkCameraDefault) { m_bimViewer.setCameraStatus(m_walkCameraDefault); } } } //巡游关键帧回调 function keyFrameCallback(idx) { var index = m_walkThroughList[m_selWalkRounteIndex].frames.length - 1; if (idx == index) { m_currentWalk.stop(); $(".y_State span").text("开始"); $(".y_State").data("y_title", "开始巡游"); $(".y_State").removeClass("wys_checked_start"); m_walkCamera4Pause = null;//清空暂停视角 //console.log("巡游结束"); } } //巡游路线 function bulidWalkThroughList() { var res = m_walkThroughList; var Route = ''; if (res.length <= 0) return; for (var i = 0; i < res.length; i++) { Route += '
  • ' + res[i].name + '
  • '; } $("#walkThroughList").html(Route); $(".bim_wayTrip").off(); $(".bim_wayTrip").on("click", function () { var index = $(this).data("index"); wayTrip(index); }) } // var m_leftCustomMainMenu = null; function buildLeftCustomMainMenu(mainMenu, successCb, failCb) { m_leftCustomMainMenu = {}; m_leftCustomMainMenu.menu = mainMenu; m_leftCustomMainMenu.successCb = successCb; m_leftCustomMainMenu.failCb = failCb; if (m_allProductTree != null && m_allProductTree.length > 0) { buildMainTreeeMenu(); return true; } else { return false; } } //构建产品主菜单 function buildMainTreeeMenu() { //console.log(m_allPumpSystems) if (m_allProductTree == null || m_allProductTree.length == 0) { if (m_leftCustomMainMenu != null && m_leftCustomMainMenu.failCb != null) m_leftCustomMainMenu.failCb(); return; } var cmd_tree_html = ""; for (var g = 0; g < m_allProductTree.length; g++) { var group_node = m_allProductTree[g]; if (group_node.ObjectType == 4) { var node_html = ""; node_html = '
  • '; node_html += ''; node_html += ' '; node_html += ' ' + group_node.Name + ''; node_html += ' '; node_html += ' '; node_html += ''; node_html += ' '; node_html += '
  • '; cmd_tree_html += node_html; } else { var node_html = ""; node_html = '
  • '; node_html += ''; node_html += ' '; node_html += ' ' + group_node.Name + ''; node_html += ' '; node_html += ' '; node_html += ''; node_html += '