/**加载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 += '<ul id="walkThroughList"><li>暂无路线数据</li></ul>';
|
|
|
CmdHtml += ' <div class="" id="cmdShowMachineMinitor">';
|
CmdHtml += ' <a href="#"><i class="iconfont iconjiankong"> </i><span>监测</span></a>';
|
CmdHtml += ' </div>';
|
|
//wysBimWalkBox
|
CmdHtml += '<ul id="wysBimWalkBox" class="layui-nav bim_walk" style="left: 450px;top:70px;">';
|
CmdHtml += ' <li class="layui-nav-item Route" data-y_title="巡游路线"><a href="#"><i class="fa fa-sitemap"> </i><span>路线</span></a></li>';
|
CmdHtml += ' <li class="layui-nav-item y_State" data-y_title="开始巡游"><a href="#"><i class="layui-icon layui-icon-play"> </i><span>开始</span></a></li>';
|
CmdHtml += ' <li class="layui-nav-item y_Suspend" data-y_title="暂停巡游"><a href="#"><i class="layui-icon layui-icon-pause"> </i><span>暂停</span></a></li>';
|
CmdHtml += ' <li class="layui-nav-item y_End" data-y_title="结束巡游"><a href="#"><i class="fa fa-send-o"> </i><span>结束</span></a></li>';
|
CmdHtml += '</ul>';
|
|
//product_minitor_box
|
CmdHtml += '<div id="product_minitor_box" style="width: 368px;">';
|
CmdHtml += ' <div class="hander">监控</div>';
|
CmdHtml += ' <i class="close iconfont iconguanbi"></i>';
|
//CmdHtml += ' <img class="close" src="/Areas/BIM/images/close.png" alt="关闭" />';
|
CmdHtml += ' <div class="" style="max-height: 560px;overflow:auto;">';
|
CmdHtml += ' <div class="attr-box">';
|
CmdHtml += ' <table id="MinitorInfoTable" class="table-attr" cellspacing="0" cellpadding="0"></table>';
|
CmdHtml += ' </div>';
|
CmdHtml += ' </div>';
|
CmdHtml += '</div>';
|
|
//swiper_container
|
CmdHtml += '<div id="swiper_container" class="swiper-container" style="z-index:2" ><ul class="swiper-wrapper"></ul></div> ';
|
|
|
//bim_tool_outbox
|
CmdHtml += '<div class="bim_tool_outbox ">';
|
CmdHtml += ' <span class="bim_tool checked" id="btn_bimCmd_bulid"><a class="bim_tool_inner display_type_btn" title="建筑物" style="background-position-x:-252px"></a></span>';
|
//CmdHtml += ' <span class="bim_tool" id="btn_bimCmd_search"><a class="bim_tool_inner btn_check" title="搜索" style="background-position-x:-468px"></a></span>';
|
CmdHtml += ' <span class="bim_tool " id="btn_bimCmd_walk"><a class="bim_tool_inner iconfont btn_iconfont iconxuncharenwu btn_check" title="巡游" style="background-position-x:-596px"></a></span>';
|
CmdHtml += ' <span class="bim_tool" id="btn_bimCmd_StationInfo"><a class="bim_tool_inner btn_iconfont iconfont icontishi " title="机泵提示" style="background-position-x:-596px"></a></span>';
|
CmdHtml += '</div>';
|
|
//product_info_box
|
CmdHtml += '<div id="product_info_box" class="isStation">';
|
CmdHtml += ' <div class="title hander" style="cursor:pointer;">设备管控</div>';
|
CmdHtml += ' <div class="content_box">';
|
CmdHtml += getProductInfoPanel("station", 0);
|
CmdHtml += ' </div>';
|
CmdHtml += '</div>';
|
|
|
$(".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 += '<li class="bim_wayTrip" data-index="' + i + '">' + res[i].name + '</li>';
|
}
|
$("#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 = '<li class="treeview border1 active" data-level="0" >';
|
node_html += '<a class="nav-link">';
|
node_html += ' <i class="fa fa-shopping-bag"></i>';
|
node_html += ' <span class="title menu-text">' + group_node.Name + '</span><span class="pull-right-container">';
|
node_html += ' <i class="fa fa-circle-thin pull-right fontsize1"></i>';
|
node_html += ' </span>';
|
node_html += '</a>';
|
|
node_html += '<ul class="treeview-menu " style="display: block;" >';
|
|
node_html += ' <li class="treeview" data-level="1">';
|
node_html += ' <a class="nav-link J_menuItem" data-operatetype="CMD" target="iframe0" href="javascript:void(0);" data-cmdmainparas="station" data-cmdauxparas="station">';
|
node_html += ' <span class="title menu-text paddingleft-50">泵站信息</span>';//<i class="cus-icon fa fa-circle-thin fontsize1"></i>
|
|
node_html += ' </a>';
|
node_html += ' </li>';
|
|
node_html += '</ul> ';
|
node_html += '</li>';
|
|
cmd_tree_html += node_html;
|
}
|
else {
|
var node_html = "";
|
node_html = '<li class="treeview border1 " data-level="0">';
|
node_html += '<a class="nav-link">';
|
node_html += ' <i class="fa fa-shopping-bag"></i>';
|
node_html += ' <span class="title menu-text">' + group_node.Name + '</span><span class="pull-right-container">';
|
node_html += ' <i class="fa fa-circle-thin pull-right fontsize1"></i>';
|
node_html += ' </span>';
|
node_html += '</a>';
|
|
node_html += '<ul class="treeview-menu menu-open" style="display: block;">';
|
|
|
var product_nodes = group_node.Nodes;
|
if (product_nodes != null && product_nodes.length > 0) {
|
for (var j = 0; j < product_nodes.length; j++) {
|
var product_model = product_nodes[j];
|
//console.log(product_model)
|
var disp_name = product_model.Name;
|
if (product_model.ObjectType == 7002) {
|
if (product_model.RunStatus == 1)
|
disp_name = disp_name + "(开)";
|
else
|
disp_name = disp_name + "(关)";
|
}
|
|
node_html += ' <li class="treeview" data-level="1">';
|
node_html += ' <a class="nav-link J_menuItem" data-operatetype="CMD" target="iframe0" href="javascript:void(0);" data-cmdmainparas="product" data-cmdauxparas="' + product_model.NodeID + '">';
|
node_html += ' <span class="title menu-text paddingleft-50">' + disp_name + '</span>';//<i class="cus-icon fa fa-circle-thin fontsize1"></i>
|
node_html += ' <span data-cmdname="showorhide" data-cmdparas="' + product_model.NodeID + '" style="position:absolute;right:40px;top:0px; width:40px;height:40px;line-height:40px;font-size:18px;text-align:center;" ';
|
node_html += ' class="customer-cmd-btn fa fa-eye iconview fontsize1" ></span>';
|
node_html += ' <span data-cmdname="target" data-cmdparas="' + product_model.NodeID + '" style="position:absolute;right:0px;top:0px;width:40px;height:40px;line-height:40px;font-size:18px;text-align:center;" ';
|
node_html += ' class="customer-cmd-btn fa fa-paper-plane-o iconview fontsize1" ></span>';
|
node_html += ' </a>';
|
node_html += ' </li>';
|
}
|
node_html += '</ul> ';
|
node_html += '</li>';
|
|
cmd_tree_html += node_html;
|
}
|
}
|
}
|
//console.log(cmd_tree_html);
|
$(m_leftCustomMainMenu.menu).html(cmd_tree_html);
|
if (m_leftCustomMainMenu != null && m_leftCustomMainMenu.successCb != null)
|
m_leftCustomMainMenu.successCb();
|
|
return;
|
}
|
|
|
|
//主界面执行主界面的命令(点击li)
|
function excuteMainMenuLiCmd(mainPara, auxPara, sourceElement) {
|
if (m_bimViewer == null)
|
return;
|
|
var topCmdHtml = '';
|
//console.log(mainPara, auxPara)
|
if (mainPara == "product") {
|
var node_id = auxPara;
|
var product = findObjectByNodeID(node_id);
|
//console.log(product)
|
if (product != null) {
|
m_current_active_product = product;
|
|
$("#product_info_box").removeClass("isStation")
|
|
topCmdHtml += getProductInfoPanel("product", node_id);
|
$("#product_info_box .content_box").html(topCmdHtml);
|
|
highLightBimObject(product.BimID);
|
|
showPropGridPanel("product");
|
|
showMinitorGridPanel("product");
|
}
|
}
|
else if (mainPara == "station") {
|
|
$("#product_info_box").addClass("isStation")
|
topCmdHtml += getProductInfoPanel("station", 0);
|
$("#product_info_box .content_box").html(topCmdHtml);
|
|
showPropGridPanel("station");
|
|
showMinitorGridPanel("station");
|
}
|
productInfoCmd(mainPara);
|
|
}
|
|
|
//获取泵站或机组 设备管控面板html
|
function getProductInfoPanel(type, id) {
|
var active_prop = ''
|
var active_minitor = ''
|
$("#product_prop_box").hide();
|
if ($("#product_prop_box").is(":visible")) {
|
active_prop = 'active'
|
}
|
if ($("#product_minitor_box").is(":visible")) {
|
active_minitor = 'active'
|
}
|
let topCmdHtml = '';
|
if (type == "station") {
|
let name = "松花江泵站"
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn" >设备管理</div>';
|
topCmdHtml += ' <div class="flex box_tr_btn show_aside_box" id="cmdShowMachineProp" data-type="prop_box" style="cursor:pointer">松花江泵站</div>';
|
topCmdHtml += ' <div id="product_prop_box" class="aside_box prop_box">';
|
topCmdHtml += ' <i class="close iconfont iconguanbi"></i>';
|
topCmdHtml += ' <div id="PropInfoBox" ></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn" >累计流量</div>';
|
topCmdHtml += ' <div class="flex value leijiliuliang_box"><span>45614511 </span><span> m³</span></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn" >累计电能</div>';
|
topCmdHtml += ' <div class="flex value leijidianneng_box"><span>61154 </span><span> </span></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn" >安全运行</div>';
|
topCmdHtml += ' <div class="flex value"><span>461 </span><span> 天</span></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn" >报警信息</div>';
|
topCmdHtml += ' <div class="flex swiper_box1 swiper-container show_aside_box" data-type="baojing" data-url="./MiniAlarmList?id=' + m_StationID + '&pumpid=' + id + '" data-iframe="iframe" >';
|
topCmdHtml += ' <div class="swiper-wrapper">';
|
topCmdHtml += ' <div class="swiper-slide" >2021-04-14 电机 温度过高</div>';
|
topCmdHtml += ' <div class="swiper-slide" >2021-03-14 电流 电流过高</div>';
|
topCmdHtml += ' <div class="swiper-slide" >2021-02-14 压力 压力过高</div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="baojing aside_box" ><i class="close iconfont iconguanbi"></i><iframe></iframe></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn" >巡检信息</div>';
|
topCmdHtml += ' <div class="flex swiper_box2 swiper-container show_aside_box" data-type="xunjian" data-url="./MiniByProduct?id=' + m_StationID + '&pumpid=' + id + '" data-iframe="iframe">';
|
topCmdHtml += ' <div class="swiper-wrapper">';
|
topCmdHtml += ' <div class="swiper-slide">2021-04-15 电机 振动过大</div>';
|
topCmdHtml += ' <div class="swiper-slide">2021-03-23 流量计 损坏</div>';
|
topCmdHtml += ' <div class="swiper-slide">2021-02-21 压力计 工作不正常</div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="xunjian aside_box" ><i class="close iconfont iconguanbi"></i><iframe></iframe></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn " >时间选择</div>';
|
topCmdHtml += ' <div class="flex box_tr_btn " ><input type="text" class="layui-input" id="btn_date_select"></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div id="liuLIangYaLi" class="flex_25 box_tr_btn box_tr_btn_tab active" data-chartname="流量" data-type="line" data-pointid="1521">流量</div>';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn box_tr_btn_tab " data-type="line" data-chartname="压力" data-pointid="1520">压力</div>';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn box_tr_btn_tab " data-type="nenghao" data-chartname="能耗" data-pointid="1073">能耗</div>';
|
//topCmdHtml += ' <div class="flex_25 box_tr_btn box_tr_btn_tab " data-type="kpi" data-chartname="KPI" data-pointid="1073">KPI</div>';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn show_aside_box" data-type="nenghaozhibiao" data-url="./MiniEnergyAna?pumpid=' + pumpid + '&name=松花江泵站" data-iframe="iframe">KPI</div>';
|
topCmdHtml += ' <div class="nenghaozhibiao aside_box" ><i class="close iconfont iconguanbi"></i><iframe></iframe></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div id="prop_info_chart" class="" style="width:368px;height:220px;"></div>';
|
topCmdHtml += ' <div class="xingneng aside_box" ><i class="close iconfont iconguanbi"></i><iframe></iframe></div>';
|
topCmdHtml += ' <div class="nenghao aside_box" ><i class="close iconfont iconguanbi"></i><div id="neng_hao_chart" style="width:100%;height:100%;"></div></div>';
|
|
|
|
} else if (type == "product") {
|
|
var pumpid = m_current_active_product.ObjectID;
|
var name = m_current_active_product.Name.replace("#", "号");;
|
var active_start = '';
|
var active_text = '';
|
if (m_current_active_product.RunStatus == 1) {
|
active_start = 'iconjieshu'
|
active_text = '关机'
|
} else {
|
active_start = 'iconon'
|
active_text = '启动'
|
}
|
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn" >设备管理</div>';
|
topCmdHtml += ' <div class="flex box_tr_btn show_aside_box ' + active_prop + '" id="cmdShowMachineProp" data-type="prop_box" style="cursor:pointer">' + name + '</div>';
|
topCmdHtml += ' <div id="product_prop_box" class="aside_box prop_box">';
|
topCmdHtml += ' <i class="close iconfont iconguanbi"></i>';
|
topCmdHtml += ' <div id="PropInfoBox" ></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' </div>';
|
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn" >安全运行</div>';
|
topCmdHtml += ' <div class="flex value"><span>4561 </span><span> 小时</span></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn" >报警信息</div>';
|
topCmdHtml += ' <div class="flex swiper_box1 swiper-container show_aside_box" data-type="baojing" data-url="./MiniAlarmList?id=' + m_StationID + '&pumpid=' + id + '" data-iframe="iframe" >';
|
topCmdHtml += ' <div class="swiper-wrapper">';
|
topCmdHtml += ' <div class="swiper-slide" >2021-04-14 电机 温度过高</div>';
|
topCmdHtml += ' <div class="swiper-slide" >2021-03-14 电流 电流过高</div>';
|
topCmdHtml += ' <div class="swiper-slide" >2021-02-14 压力 压力过高</div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="baojing aside_box" ><i class="close iconfont iconguanbi"></i><iframe></iframe></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn" >巡检信息</div>';
|
topCmdHtml += ' <div class="flex swiper_box2 swiper-container show_aside_box" data-type="xunjian" data-url="/MiniByProduct?id=' + m_StationID + '&pumpid=' + id + '" data-iframe="iframe">';
|
topCmdHtml += ' <div class="swiper-wrapper">';
|
topCmdHtml += ' <div class="swiper-slide">2021-04-15 电机 振动过大</div>';
|
topCmdHtml += ' <div class="swiper-slide">2021-03-23 流量计 损坏</div>';
|
topCmdHtml += ' <div class="swiper-slide">2021-02-21 压力计 工作不正常</div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="xunjian aside_box" ><i class="close iconfont iconguanbi"></i><iframe></iframe></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn " >时间选择</div>';
|
topCmdHtml += ' <div class="flex box_tr_btn " ><input type="text" class="layui-input" id="btn_date_select"></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="display_flex box_tr" >';
|
topCmdHtml += ' <div id="liuLIangYaLi" class="flex_25 box_tr_btn box_tr_btn_tab active" data-type="xingneng" data-name="' + name + '" data-pointid="' + pumpid + '">性能曲线</div>';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn show_aside_box" data-type="nenghaozhibiao" data-url="./MiniEnergyAna?pumpid=' + pumpid + '&name=' + name + '" data-iframe="iframe">能耗指标</div>';
|
topCmdHtml += ' <div id="pumpStartBtn" data-type="runstatus" data-pointid="' + pumpid + '" class="flex_25 box_tr_btn iconfont show_aside_box ' + active_start + '">' + active_text + '</div>';
|
topCmdHtml += ' <div class="flex_25 box_tr_btn show_aside_box" data-type="tiaopin" data-pointid="' + pumpid + '">调频</div>';
|
topCmdHtml += ' <div class="tiaopin aside_box placeholder_fff" >';
|
topCmdHtml += ' <i class="close iconfont iconguanbi"></i>';
|
topCmdHtml += ' <form class="layui-form" action="">';
|
topCmdHtml += ' <div class="layui-form-item">';
|
topCmdHtml += ' <label class="layui-form-label">频率:</label>';
|
topCmdHtml += ' <div class="layui-input-block">';
|
topCmdHtml += ' <input type="number" name="pinlv" required lay-verify="pinlv" placeholder="请输入10~50的频率" autocomplete="off" class="layui-input">';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="layui-form-item">';
|
topCmdHtml += ' <label class="layui-form-label">密码:</label>';
|
topCmdHtml += ' <div class="layui-input-block">';
|
topCmdHtml += ' <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="layui-form-item">';
|
topCmdHtml += ' <div class="layui-input-block">';
|
topCmdHtml += ' <button class="layui-btn" lay-submit lay-filter="formDemo">确认</button>';
|
topCmdHtml += ' <button type="reset" class="layui-btn cancel">取消</button>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' </form>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="runstatus aside_box placeholder_fff" >';
|
topCmdHtml += ' <i class="close iconfont iconguanbi"></i>';
|
topCmdHtml += ' <form class="layui-form" action="">';
|
topCmdHtml += ' <div id="">你确认要' + active_text + '吗?</div>';
|
topCmdHtml += ' <div class="layui-form-item">';
|
topCmdHtml += ' <label class="layui-form-label">密码:</label>';
|
topCmdHtml += ' <div class="layui-input-block">';
|
topCmdHtml += ' <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="layui-form-item">';
|
topCmdHtml += ' <div class="layui-input-block">';
|
topCmdHtml += ' <button class="layui-btn" lay-submit lay-filter="runstatus">确认</button>';
|
topCmdHtml += ' <button type="reset" class="layui-btn cancel">取消</button>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' </form>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div class="nenghaozhibiao aside_box" ><i class="close iconfont iconguanbi"></i><iframe></iframe></div>';
|
topCmdHtml += ' </div>';
|
topCmdHtml += ' <div id="prop_info_chart" class="" style="width:368px;height:300px;"></div>';
|
topCmdHtml += ' <div class="xingneng aside_box" ><i class="close iconfont iconguanbi"></i><iframe></iframe></div>';
|
|
}
|
return topCmdHtml;
|
}
|
|
/**
|
* 文字长度过长时提示效果
|
* @param {any} ele jquery 选择器名称
|
* @param {any} tiptext 提示文字
|
* @param {any} l 文字长度大于 l 显示提示文字,默认为8
|
*/
|
function setTips(ele, tiptext, l) {
|
l = l || 8
|
$(ele).css({ "cursor": "pointer" });
|
layui.use(['layer'], function () {
|
var layer = layui.layer
|
var subtips;
|
$(ele).on('mouseover', function (event) {
|
var tipname = $(this).text()
|
if (tiptext.length > l) {
|
subtips = layer.tips(tiptext, $(this), { tips: [1, '#1E9FFF'], wysoffset: 1, offset: [0, -15], time: 10000 });
|
}
|
});
|
$(ele).on('mouseout', function (event) {
|
layer.close(subtips);
|
});
|
})
|
}
|
|
/**
|
* 根据测点ids 获取测点最后一条数据
|
* @param {Array} ids 测点集合
|
*/
|
function getMonitorDataByMonitorIds(ids) {
|
return new Promise((r, e) => {
|
$.ajax({
|
type: "get",
|
dataType: 'json',
|
url: GlobalParas.Url.MainApi + "LargeScreen/Demo/Run/GetLastRecordByMonitorPointIds",
|
data: { MonitorPointIds: ids.join(','), CorpID: m_corpID },
|
success: function (res) {
|
if (res.Code != 0) { r([]); return; }
|
let records = res.Data || []
|
r(records)
|
},
|
error: function (err, errorThrown) {
|
e(err)
|
}
|
});
|
})
|
}
|
|
//设备管控操作指令
|
async function productInfoCmd(type_alarm_use) {
|
//累计流量
|
let qresdata = await getMonitorDataByMonitorIds([1528])
|
let value = 0;
|
let unit = "m³";
|
let orginVal = 0
|
if (qresdata.length > 0) {
|
let record = qresdata[0]
|
orginVal = record.DataValue;
|
if (orginVal < 999999) {
|
value = orginVal;
|
unit = "m³";
|
} else if (orginVal < 999999999) {
|
value = orginVal / 1000;
|
unit = "Km³";
|
} else {
|
value = orginVal / 1000000;
|
unit = "Mm³";
|
}
|
}
|
|
value = parseFloat(parseFloat(value).toFixed(3))
|
|
var html = value + ' ' + unit;
|
$(".leijiliuliang_box").html(html)
|
|
setTips(".leijiliuliang_box", orginVal + " m³")
|
|
|
//累计电度
|
getLeiJiDianDu()
|
|
|
|
|
|
layui.use('form', function () {
|
var form = layui.form;
|
//调频验证表单
|
form.verify({
|
pinlv: function (value, item) { //value:表单的值、item:表单的DOM对象
|
if (value > 50 || value < 10) {
|
return '请输入合理范围的频率';
|
}
|
}
|
});
|
//调频
|
form.on('submit(formDemo)', function (data) {
|
//layer.msg(JSON.stringify(data.field));
|
console.log(data)
|
return false;
|
});
|
|
//开关机
|
form.on('submit(runstatus)', function (data) {
|
//console.log(data)
|
|
var pwd = data.field.password;
|
var text = "";
|
if ($("#pumpStartBtn").hasClass("iconon")) {
|
text = "开机";
|
} else {
|
text = "关机"
|
}
|
if (pwd == '') {
|
layer.msg("密码不能为空", { icon: 5 })
|
return;
|
}
|
if (pwd == '123456') {
|
if (m_current_active_product) {
|
if (text == '开机') {
|
m_current_active_product.RunStatus = 1;
|
$("#pumpStartBtn").addClass("iconjieshu").removeClass("iconon").text("关机");
|
//console.log(m_current_active_product)
|
} else {
|
m_current_active_product.RunStatus = 0;
|
$("#pumpStartBtn").addClass("iconon").removeClass("iconjieshu").text("启动");
|
}
|
BuildProductPropHtml();
|
layer.msg(text + "成功", { icon: 1 })
|
$("#kaiji_PWD").val("");
|
}
|
$(".runstatus").hide();
|
|
} else {
|
layer.msg("密码不正确", { icon: 5 })
|
return;
|
}
|
return false;
|
});
|
|
|
});
|
//开关机关闭按钮
|
$(".runstatus .cancel").off();
|
$(".runstatus .cancel").on("click", function () {
|
$(".runstatus").hide();
|
$(".show_aside_box").removeClass("active");
|
})
|
//调频关闭按钮
|
$(".tiaopin .cancel").off();
|
$(".tiaopin .cancel").on("click", function () {
|
$(".tiaopin").hide();
|
$(".show_aside_box").removeClass("active");
|
})
|
|
//获取最近报警信息
|
getAlarmListLastInfo(getDay(-3), type_alarm_use)
|
|
|
|
//报警信息 轮播
|
new Swiper('.swiper_box1', {
|
direction: 'vertical',
|
loop: true,
|
autoplay: 10 * 1000,
|
speed: 500,
|
preventClicks: false,//默认true
|
preventClicksPropagation: false,
|
})
|
|
//巡检信息 轮播
|
new Swiper('.swiper_box2', {
|
direction: 'vertical',
|
loop: true,
|
autoplay: 10 * 1000,
|
speed: 500,
|
preventClicks: false,//默认true
|
preventClicksPropagation: false,
|
})
|
|
|
|
$(".aside_box .close").off();
|
$(".aside_box .close").on("click", function () {
|
$(".aside_box").hide();
|
$(".show_aside_box").removeClass("active");
|
})
|
|
|
$(".show_aside_box").off();
|
$(".show_aside_box").on("click", function () {
|
let type = $(this).data("type");
|
//console.log(type)
|
$(".aside_box").hide();
|
$(".show_aside_box").removeClass("active");
|
$(this).addClass("active");
|
if (type == "xunjian") {
|
return;
|
}
|
$("." + type).show();
|
//console.log($(this).data("iframe"))
|
if ($(this).data("iframe")) {
|
let url = $(this).data("url");
|
m_iframe_loading_index = layer.load(1);
|
if ($(this).data("alarmday")) {
|
url = url + "&alarmday=" + $(this).data("alarmday")
|
}
|
if ($(this).data("resdata")) {
|
url = url + "&resdata=" + $(this).data("resdata")
|
}
|
$("." + type).children("iframe").attr("src", url);
|
//console.log(url)
|
}
|
})
|
|
|
|
|
//时间选择器
|
layui.use('laydate', function () {
|
var laydate = layui.laydate;
|
|
//执行一个laydate实例
|
laydate.render({
|
elem: '#btn_date_select' //指定元素
|
, value: getDay(0)
|
, max: getDay(0)
|
, showBottom: false
|
, done: function (value, date, endDate) {
|
let type = $(".box_tr_btn_tab.active").data("type");
|
let pointid = $(".box_tr_btn_tab.active").data("pointid");
|
let chartname = $(".box_tr_btn_tab.active").data("chartname");
|
//console.log(value, type); //得到日期生成的值,如:2017-08-18
|
|
$(".aside_box").hide();
|
$(".show_aside_box").removeClass("active");
|
|
if (m_setInterval.qp != null) {
|
clearInterval(m_setInterval.qp);
|
m_setInterval.qp = null;
|
}
|
if (m_setInterval.qp_lastpoint != null) {
|
clearInterval(m_setInterval.qp_lastpoint);
|
m_setInterval.qp_lastpoint = null;
|
}
|
if (type == "line") {
|
initialMonitorRecord(pointid, value, chartname)
|
} else if (type == "xingneng") {
|
InitialRatedCurveInfo(pointid, value)
|
}
|
else if (type == "nenghao") {
|
InitialNengHao(pointid, value)
|
}
|
}
|
});
|
});
|
let pointid = $(".box_tr_btn_tab.active").data("pointid");
|
let type = $(".box_tr_btn_tab.active").data("type");
|
let day = $("#btn_date_select").val();
|
let chartname = $(".box_tr_btn_tab.active").data("chartname");
|
|
|
|
|
//切换展示相应的曲线
|
$(".box_tr_btn_tab").on("click", function () {
|
if ($(this).hasClass("active")) {
|
return;
|
}
|
$(".box_tr_btn_tab").removeClass("active");
|
$(this).addClass("active");
|
|
if (!m_asideBoxIsShow) {
|
$(".aside_box").hide();
|
}
|
$(".show_aside_box").removeClass("active");
|
|
type = $(this).data("type");
|
pointid = $(this).data("pointid");
|
chartname = $(this).data("chartname");
|
day = $("#btn_date_select").val();
|
if (m_setInterval.qp != null) {
|
clearInterval(m_setInterval.qp);
|
m_setInterval.qp = null;
|
}
|
if (m_setInterval.qp_lastpoint != null) {
|
clearInterval(m_setInterval.qp_lastpoint);
|
m_setInterval.qp_lastpoint = null;
|
}
|
if (type == "line") {
|
initialMonitorRecord(pointid, day, chartname)
|
} else if (type == "xingneng") {
|
InitialRatedCurveInfo(pointid, day)
|
}
|
else if (type == "nenghao") {
|
InitialNengHao(pointid, day)
|
}
|
})
|
if (m_setInterval.qp != null) {
|
clearInterval(m_setInterval.qp);
|
m_setInterval.qp = null;
|
}
|
if (m_setInterval.qp_lastpoint != null) {
|
clearInterval(m_setInterval.qp_lastpoint);
|
m_setInterval.qp_lastpoint = null;
|
}
|
if (type == "line") {
|
initialMonitorRecord(pointid, getDay(0), "流量")
|
} else if (type == "xingneng") {
|
InitialRatedCurveInfo(pointid, getDay(0))
|
}
|
|
}
|
|
|
/**机泵运行时间 根据累计电度简单计算 */
|
let m_productRunTimeList = [
|
{ ObjectID: "409", MonitorPointID: 1549, Name: "1#机泵", runTime: "", },
|
{ ObjectID: "412", MonitorPointID: 1575, Name: "2#机泵", runTime: "", },
|
{ ObjectID: "415", MonitorPointID: 1601, Name: "3#机泵", runTime: "", },
|
{ ObjectID: "418", MonitorPointID: 1627, Name: "4#机泵", runTime: "", },
|
{ ObjectID: "421", MonitorPointID: 1653, Name: "5#机泵", runTime: "", },
|
{ ObjectID: "424", MonitorPointID: 1678, Name: "6#机泵", runTime: "", },
|
]
|
/**获取累计电度 */
|
async function getLeiJiDianDu() {
|
let d_ids = [1549, 1575, 1601, 1627, 1653, 1678];// 1549 一号机组 1575二号 1601三号 1627四号 1653五号 1678六号
|
|
let records = await getMonitorDataByMonitorIds(d_ids);
|
|
function getSum(total, num) {
|
return total + num;
|
}
|
var sumval = 0;
|
if (records && records.length > 0) {
|
sumval = records.map((item) => {
|
m_productRunTimeList.forEach(x => {
|
if (x.MonitorPointID == item.MonitorPointID) {
|
let shijian = 0
|
let unit = '小时'
|
let tempval = item.DataValue
|
if (tempval && (tempval - 0) > 0) {
|
shijian = parseInt(tempval / 280)
|
if (shijian > 24) {
|
shijian = parseInt(tempval / 280 / 24)
|
unit = '天'
|
}
|
}
|
x.runTime = shijian > 0 ? shijian + ' ' + unit : ''
|
}
|
})
|
return item.DataValue - 0
|
}).reduce(getSum)
|
}
|
console.log(m_productRunTimeList, 2029)
|
var value = sumval;
|
var unit = "KW.h";
|
if (sumval < 999999) {
|
value = sumval;
|
unit = "KW.h";
|
} else if (sumval < 999999999) {
|
value = sumval / 1000;
|
unit = "MW.h";
|
} else {
|
value = sumval / 1000000;
|
unit = "GW.h";
|
}
|
let shijian_s = 0
|
let unit_s = '小时'
|
if (sumval && (sumval - 0) > 0) {
|
shijian_s = parseInt(sumval / 280)
|
if (shijian_s > 24) {
|
shijian_s = parseInt(sumval / 280 / 24)
|
unit_s = '天'
|
}
|
}
|
$(".runTimeByStation span:first-of-type").text(shijian_s > 0 ? shijian_s + ' ' + unit_s : '')
|
//console.log(value,records,1993)
|
value = parseFloat(parseFloat(value).toFixed(3))
|
var html = value + ' ' + unit;
|
$(".leijidianneng_box").html(html)
|
setTips(".leijidianneng_box", sumval + " KW.h")
|
}
|
|
/**
|
* 根据产品id获取产品下所有测点id
|
* @param {any} productID
|
*/
|
function getProductMonitorIds(productID) {
|
return new Promise((r, e) => {
|
$.ajax({
|
type: "get",
|
// dataType: 'json',
|
url: GlobalParas.Url.MainApi + 'LargeScreen/Demo/Monitor/GetGeneralRealMonitorPointListByProductID',
|
data: {
|
ProductID: productID,
|
CorpID: m_corpID,
|
},
|
success: function (res) {
|
console.log(res, 1992)
|
if (res.Code != 0) {
|
r([])
|
}
|
let resdata = res.Data || []
|
let ids = []
|
if (resdata.length > 0) {
|
ids = resdata.map(x => {
|
return x.ID
|
})
|
}
|
r(ids)
|
},
|
error: function (textStatus, errorThrown) {
|
e(textStatus)
|
}
|
});
|
})
|
}
|
/**获取泵站下所有测点id */
|
function getStationMonitorIds() {
|
return new Promise((r, e) => {
|
$.ajax({
|
type: "get",
|
// dataType: 'json',
|
url: GlobalParas.Url.MainApi + 'LargeScreen/Demo/Monitor/GetGeneralRealMonitorPointListByStationID',
|
data: {
|
StationID: m_StationID,
|
CorpID: m_corpID,
|
},
|
success: function (res) {
|
//console.log(res)
|
if (res.Code != 0) {
|
r([])
|
}
|
let resdata = res.Data || []
|
let ids = []
|
if (resdata.length > 0) {
|
ids = resdata.map(x => {
|
return x.ID
|
})
|
}
|
r(ids)
|
},
|
error: function (textStatus, errorThrown) {
|
e(textStatus)
|
}
|
});
|
})
|
}
|
/**
|
* 获取最近时间范围内的报警信息
|
* @param {any} day
|
*/
|
async function getAlarmListLastInfo(day, type) {
|
|
|
var m_rows = [
|
{
|
"ID": 5523, "MonitorObjectName": null, "MonitorPointName": "噪音", "MonitorPointID": 0,
|
"DataTime": getDay(-3) + " 09:32:42", "DataValue": 90.1, "AlarmContent": "数据越上限", "AlarmType": "数据越上限",
|
"ThresholdValue": null, "AlarmTime": getDay(-3) + " 09:32:42", "AlarmLevel": 1,
|
"HandleStatus": "0", "Description": null
|
},
|
{
|
"ID": 5522, "MonitorObjectName": null, "MonitorPointName": "噪音", "MonitorPointID": 0,
|
"DataTime": getDay(-2) + " 09:28:42", "DataValue": 90.9, "AlarmContent": "数据越上限", "AlarmType": "数据越上限",
|
"ThresholdValue": null, "AlarmTime": getDay(-2) + " 09:28:42", "AlarmLevel": 1,
|
"HandleStatus": "0", "Description": null
|
},
|
{
|
"ID": 5521, "MonitorObjectName": null, "MonitorPointName": "噪音", "MonitorPointID": 0,
|
"DataTime": getDay(-1) + " 09:22:41", "DataValue": 90.8, "AlarmContent": "数据越上限", "AlarmType": "数据越上限",
|
"ThresholdValue": null, "AlarmTime": getDay(-1) + " 09:22:41", "AlarmLevel": 1,
|
"HandleStatus": "0", "Description": null
|
},
|
]
|
|
|
let tempids = []
|
if (type == "station") {
|
tempids = await getStationMonitorIds()
|
|
} else if (type == "product") {
|
if (m_current_active_product != null) {
|
tempids = await getProductMonitorIds(m_current_active_product.ObjectID)
|
m_productRunTimeList.forEach(x => {
|
if (x.ObjectID == m_current_active_product.ObjectID) {
|
$(".runTime span:first-of-type").text(x.runTime)
|
}
|
})
|
}
|
}
|
|
let ids = tempids.length > 0 ? tempids.join(',') : ''
|
let getdata = {
|
CorpID: m_corpID,
|
StartTime: getDay(-60),
|
EndTime: getDay(0) + " 23:59:59",
|
PageIndex: 1,
|
PageSize: 5,
|
MonitorPointIds: ids,
|
AlarmType: '',
|
AlarmLevel: '',
|
HandleStatus: '',
|
}
|
|
|
//最近报警信息
|
$.ajax({
|
dataType: 'json',
|
url: GlobalParas.Url.MainApi + 'LargeScreen/Demo/Run/GetMonitorAlarmRecordFluzzyPageList',
|
type: 'get',
|
data: getdata,
|
success: function (result) {
|
//console.log(result, 2082)
|
let isResData = false
|
if (result.Code != 0) {
|
isResData = true
|
}
|
var record = result.Data;
|
|
var topCmdHtml = '';
|
var list = record.List;
|
if (!list) {
|
isResData = true
|
}
|
$(".swiper_box1").data("resdata", isResData)
|
$(".swiper_box1").data("alarmday", day)
|
list = list || m_rows
|
topCmdHtml += '<div class="swiper-wrapper">';
|
for (var i = 0; i < list.length; i++) {
|
var item = list[i];
|
var time = getDay(0, item.AlarmTime)
|
topCmdHtml += '<div class="swiper-slide" >' + time + ' ' + item.MonitorPointName + ' ' + item.AlarmType + '</div>';
|
}
|
topCmdHtml += '</div>';
|
|
$(".swiper_box1").html(topCmdHtml)
|
|
//报警信息 轮播
|
new Swiper('.swiper_box1', {
|
direction: 'vertical',
|
loop: true,
|
autoplay: 10 * 1000,
|
speed: 500,
|
preventClicks: false,//默认true
|
preventClicksPropagation: false,
|
})
|
|
|
},
|
error: function (textStatus, errorThrown) {
|
console.log("Station.Bim.SHJ2 报警信息 与服务器交互错误, 错误代码, 信息: " + JSON.stringify(textStatus));
|
}
|
});
|
|
}
|
|
/**
|
* 根据泵站id和日期获取能耗数据
|
* @param {any} day
|
*/
|
function getNormalContentByStationIDOfDay(day) {
|
return new Promise((r, e) => {
|
$.ajax({
|
type: "get",
|
cache: false,
|
dataType: 'json',
|
url: GlobalParas.Url.MainApi + "LargeScreen/Demo/Eta/GetMultiRealRecordNormalContentByStationIDOfDay",
|
data: {
|
StationID: m_StationID,//m_StationID
|
CorpID: m_corpID,//m_corpID
|
Day: day
|
},
|
success: function (res) {
|
let resdata = []
|
if (res.Code != 0) {
|
resdata = []
|
}
|
resdata = res.Data || []
|
r(resdata)
|
},
|
error: function (err, errorThrown) {
|
e(err)
|
}
|
});
|
})
|
}
|
|
/**
|
* 格式化能耗数据
|
* @param {any} id
|
* @param {any} day
|
*/
|
async function InitialNengHao(id, day) {
|
let qp = {};
|
qp.day = day;
|
qp.id = 0;
|
qp.name = "千吨耗能";
|
let resdata = await getNormalContentByStationIDOfDay(day);
|
let nenghao = resdata.map((item) => {
|
return { RecordTime: item.DataTime, RecordValue: item.WPa }
|
})
|
|
qp.q = nenghao;
|
if (day == getDay(0)) {
|
let yday = getDay(-1)
|
let yresdata = await getNormalContentByStationIDOfDay(yday);
|
var nenghaoy = yresdata.map((item) => {
|
return { RecordTime: item.DataTime, RecordValue: item.WPa }
|
})
|
qp.qy = nenghaoy;
|
}
|
console.log(qp, 2223)
|
initialChartOfNengHao(qp);
|
}
|
|
|
/**
|
* 渲染能耗图表
|
* @param {any} data
|
*/
|
function initialChartOfNengHao(data) {
|
$(".show_chart_last_point_tip").remove();
|
if (m_chartMain) {
|
m_chartMain.clear();
|
}
|
m_chartMain = echarts.init(document.getElementById('prop_info_chart'));
|
//console.log(data)
|
m_chartRecordList = [];
|
var recordList_q = data.q;
|
if (recordList_q == null || recordList_q.length == 0)
|
recordList_q = []
|
|
//console.log(data);//所有记录
|
|
var series_data_station_power_per_q_arr = [];
|
var series_data_station_power_per_qy_arr = [];
|
var series_data_station_power_per_q = [];
|
var series_data_station_power_per_qy = [];
|
var lastTime = null;
|
|
var ignore_time = 1000 * 60 * 10;
|
for (var i = 0; i < recordList_q.length; i++) {
|
var record = recordList_q[i];
|
var real_time = record.RecordTime;
|
var real_value = record.RecordValue;
|
|
if (lastTime == null) {
|
lastTime = new Date(real_time).getTime();
|
}
|
|
if ((new Date(real_time).getTime() - lastTime) > ignore_time) {
|
|
if (series_data_station_power_per_q.length > 3) {
|
series_data_station_power_per_q_arr.push(series_data_station_power_per_q);
|
}
|
|
series_data_station_power_per_q = [];
|
}
|
|
series_data_station_power_per_q.push({ value: [real_time, real_value] });
|
|
lastTime = new Date(real_time).getTime();
|
|
}
|
if (series_data_station_power_per_q.length > 3) {
|
series_data_station_power_per_q_arr.push(series_data_station_power_per_q);
|
}
|
//console.log(series_data_station_power_per_q)
|
|
|
var series = [];
|
|
if (data.day == getDay(0)) {
|
var recordList_qy = data.qy;
|
if (recordList_qy == null || recordList_qy.length == 0)
|
recordList_qy = [];
|
|
var lastTime_qy = null;
|
for (var i = 0; i < recordList_qy.length; i++) {
|
var record = recordList_qy[i];
|
|
var real_time = data.day + " " + (record.RecordTime.split(" ")[1]);
|
var real_value = record.RecordValue;
|
|
|
|
if (lastTime_qy == null) {
|
lastTime_qy = new Date(real_time).getTime();
|
}
|
|
if ((new Date(real_time).getTime() - lastTime_qy) > ignore_time) {
|
|
if (series_data_station_power_per_qy.length > 3) {
|
series_data_station_power_per_qy_arr.push(series_data_station_power_per_qy);
|
}
|
|
series_data_station_power_per_qy = [];
|
}
|
|
series_data_station_power_per_qy.push({ value: [real_time, real_value] });
|
|
lastTime_qy = new Date(real_time).getTime();
|
|
}
|
if (series_data_station_power_per_qy.length > 3) {
|
series_data_station_power_per_qy_arr.push(series_data_station_power_per_qy);
|
}
|
|
|
|
series_data_station_power_per_qy_arr.forEach((item, index) => {
|
series.push({
|
name: '昨日' + data.name,
|
type: 'line',
|
symbolSize: 10,
|
hoverAnimation: false,
|
showSymbol: false,
|
itemStyle: {
|
color: "rgba(204, 204, 204, 0.8)"
|
},
|
data: item
|
});
|
});
|
}
|
|
|
series_data_station_power_per_q_arr.forEach((item, index) => {
|
series.push({
|
name: data.name,
|
type: 'line',
|
symbolSize: 10,
|
hoverAnimation: false,
|
showSymbol: false,
|
itemStyle: {
|
color: "#0f0"
|
},
|
data: item
|
});
|
});
|
|
|
|
var valeuDate = data.day;
|
var main_chart_option = {
|
title: {
|
text: ""
|
},
|
|
tooltip: {
|
trigger: 'axis',
|
show: false,
|
},
|
grid: {
|
containLabel: true,
|
x: '25',
|
y: '30',
|
x2: '25',
|
y2: '10'
|
},
|
xAxis: {
|
type: 'time',
|
splitLine: {
|
show: true,
|
lineStyle: {
|
type: 'dashed'
|
}
|
},
|
axisLabel: {
|
color: '#fff',
|
formatter: function (v, index) {
|
var date = new Date(v);
|
//console.log(date);
|
var texts = [date.getHours(), date.getMinutes()];
|
return texts.join(':');
|
}
|
},
|
axisLine: {
|
lineStyle: {
|
color: '#fff'
|
},
|
},
|
min: getDay(0, new Date(valeuDate)) + " 00:00:00",
|
max: getDay(0, new Date(valeuDate)) + " 23:59:59",
|
interval: 60 * 60 * 1000 * 4,
|
},
|
yAxis: [{
|
name: data.name,
|
nameLocation: 'end',
|
nameGap: 10,
|
nameTextStyle: {
|
fontSize: 10
|
},
|
type: 'value',
|
splitLine: {
|
show: true,
|
lineStyle: {
|
type: 'dashed'
|
}
|
},
|
axisLabel: {
|
color: '#fff',
|
show: false,
|
},
|
axisLine: {
|
lineStyle: {
|
color: '#fff'
|
},
|
},
|
scale: true
|
}
|
],
|
series: series
|
};
|
|
m_chartMain.setOption(main_chart_option);
|
|
//点击跳转页面
|
$("#prop_info_chart canvas").css({ "cursor": "pointer" });
|
$("#prop_info_chart").off("click");
|
$("#prop_info_chart").on('click', function () {
|
|
m_asideBoxIsShow = true
|
m_iframe_loading_index && layer.close(m_iframe_loading_index)
|
m_iframe_loading_index = layer.load(1);
|
$(".aside_box").hide();
|
$(".show_aside_box").removeClass("active");
|
$(".xingneng").show();
|
let url = "./GeneralNH?id=" + m_StationID + "&day=" + data.day
|
|
$(".xingneng").children("iframe").attr("src", url);
|
});
|
|
if (m_asideBoxIsShow) {
|
$("#prop_info_chart").click();
|
}
|
|
//console.log(m_chartMain.getOption())
|
//日期为今天时 定时两分钟刷新数据
|
if (m_setInterval.qp != null) {
|
clearInterval(m_setInterval.qp);
|
m_setInterval.qp = null;
|
}
|
if (m_setInterval.qp_lastpoint != null) {
|
clearInterval(m_setInterval.qp_lastpoint);
|
m_setInterval.qp_lastpoint = null;
|
}
|
|
|
|
if (data.day == getDay(0)) {
|
if (recordList_q == null || recordList_q.length == 0) {
|
return;
|
}
|
//开启定时器
|
m_setInterval.qp = setInterval(function () {
|
refreshMonitorNengHaoInChart(data.id);
|
//InitialNengHao(0,getDay(0))
|
}, 2 * 60 * 1000);
|
|
var series = m_chartMain.getOption().series;
|
var seriesIndex = series.length - 1;
|
var dataIndex = series[seriesIndex].data.length - 1;
|
|
showChartLastPointTip(m_chartMain);
|
|
|
m_chartMain.dispatchAction({
|
type: 'downplay',
|
seriesIndex: seriesIndex,
|
dataIndex: dataIndex - 1,
|
})
|
|
//设置最后一个点闪烁
|
m_setInterval.qp_lastpoint = setInterval(function () {
|
m_chartMain.dispatchAction({
|
type: 'highlight',
|
seriesIndex: seriesIndex,
|
dataIndex: dataIndex,
|
})
|
|
setTimeout(function () {
|
m_chartMain.dispatchAction({
|
type: 'downplay',
|
seriesIndex: seriesIndex,
|
dataIndex: dataIndex,
|
})
|
}, 1000 * 1)
|
}, 2 * 1000);
|
}
|
|
|
|
|
}
|
|
//定时刷新数据
|
function refreshMonitorNengHaoInChart() {
|
$.ajax({
|
type: "get",
|
cache: false,
|
dataType: 'json',
|
url: GlobalParas.Url.MainApi + "LargeScreen/Demo/Eta/GetLastNormalLogicRealRecord",
|
data: {
|
ObjectID: m_StationID,//m_StationID
|
CorpID: m_corpID,//m_corpID
|
ObjectType: '泵站'
|
},
|
success: function (res) {
|
let resdata = []
|
if (res.Code != 0) {
|
resdata = []
|
}
|
resdata = res.Data || {}
|
|
var ignore_time = 1000 * 60 * 10;
|
var real_time = resdata.DataTime
|
var real_value = resdata.WPa
|
|
|
var series = m_chartMain.getOption().series;
|
var seriesIndex = series.length - 1;
|
var data = series[seriesIndex].data;
|
var lastTime_q = data[data.length - 1].value[0];
|
var name = series[seriesIndex].name;
|
|
|
|
if (new Date(real_time).getTime() == lastTime_q) {
|
series = series;
|
} else if ((new Date(real_time).getTime() - lastTime_q) > ignore_time) {
|
series.push({
|
name: name,
|
type: 'line',
|
symbolSize: 10,
|
hoverAnimation: false,
|
showSymbol: false,
|
itemStyle: {
|
color: "#0f0"
|
},
|
data: [{ value: [real_time, real_value] }]
|
});
|
} else {
|
series[seriesIndex].data.push({ value: [real_time, real_value] })
|
}
|
|
if (m_chartMain) {
|
m_chartMain.setOption({
|
series: series
|
});
|
}
|
|
|
var series = m_chartMain.getOption().series;
|
var seriesIndex = series.length - 1;
|
var dataIndex = series[seriesIndex].data.length - 1;
|
//console.log(series)
|
|
showChartLastPointTip(m_chartMain);
|
|
if (m_setInterval.qp_lastpoint != null) {
|
clearInterval(m_setInterval.qp_lastpoint);
|
m_setInterval.qp_lastpoint = null;
|
}
|
|
m_chartMain.dispatchAction({
|
type: 'downplay',
|
seriesIndex: seriesIndex,
|
dataIndex: dataIndex - 1,
|
})
|
|
//设置最后一个点闪烁
|
m_setInterval.qp_lastpoint = setInterval(function () {
|
m_chartMain.dispatchAction({
|
type: 'highlight',
|
seriesIndex: seriesIndex,
|
dataIndex: dataIndex,
|
})
|
|
setTimeout(function () {
|
m_chartMain.dispatchAction({
|
type: 'downplay',
|
seriesIndex: seriesIndex,
|
dataIndex: dataIndex,
|
})
|
}, 1000 * 1)
|
}, 2 * 1000);
|
},
|
error: function (err, errorThrown) {
|
console.log(err)
|
}
|
});
|
}
|
|
/**
|
* 根据测点id 日期获取 测点某日的数据
|
* @param {any} day 日期
|
*/
|
function getMonitorDataByMonitorID(id, day) {
|
return new Promise((r, e) => {
|
$.ajax({
|
type: "get",
|
cache: false,
|
dataType: 'json',
|
url: GlobalParas.Url.MainApi + "LargeScreen/Demo/Run/GetRealRecordListByMonitorPointIDOfDay",
|
data: {
|
MonitorPointID: id,//id
|
CorpID: m_corpID,//m_corpID
|
Day: day
|
},
|
success: function (res) {
|
let resdata = []
|
if (res.Code != 0) {
|
resdata = []
|
}
|
resdata = res.Data || []
|
r(resdata)
|
},
|
error: function (err, errorThrown) {
|
e(err)
|
}
|
});
|
})
|
}
|
|
|
/**
|
* 获取监测点某日的数据
|
* @param {any} day 日期
|
*/
|
async function initialMonitorRecord(id, day, name) {
|
let qp = {};//流量压力
|
qp.day = day;
|
qp.id = id;
|
qp.name = name;
|
//console.log(id,day,name,2657)
|
let resdata = await getMonitorDataByMonitorID(id, day);
|
qp.q = resdata;
|
|
if (day == getDay(0)) {
|
let yday = getDay(-1)
|
let yresdata = await getMonitorDataByMonitorID(id, yday);
|
qp.qy = yresdata;
|
}
|
//console.log(qp, 2657)
|
|
initialChartOfValue(qp);
|
}
|
|
|
|
//初始化图表
|
|
m_setInterval.qp = null;//流量压力 定时刷新定时器
|
m_setInterval.qp_lastpoint = null;//最后一个点闪烁 定时器
|
function initialChartOfValue(data) {
|
$(".show_chart_last_point_tip").remove();
|
if (m_chartMain) {
|
m_chartMain.clear();
|
}
|
m_chartMain = echarts.init(document.getElementById('prop_info_chart'));
|
|
var recordList_q = data.q;
|
if (recordList_q == null || recordList_q.length == 0) {
|
recordList_q = [];
|
}
|
|
|
var series_data_station_power_per_q = [];
|
var series_data_station_power_per_qy = [];
|
|
for (var i = 0; i < recordList_q.length; i++) {
|
var record = recordList_q[i];
|
var real_time = record.DataTime;
|
var real_value = record.DataValue;
|
|
var dataValue = { value: [real_time, real_value] };
|
series_data_station_power_per_q.push(dataValue);
|
|
}
|
|
var series_arr = [];
|
|
if (data.day == getDay(0)) {
|
var recordList_qy = data.qy;
|
if (recordList_qy == null || recordList_qy.length == 0) {
|
recordList_qy = []
|
}
|
|
|
|
for (var i = 0; i < recordList_qy.length; i++) {
|
var record = recordList_qy[i];
|
|
var real_time = data.day + " " + (record.DataTime.split(" ")[1]);
|
var real_value = record.DataValue;
|
|
var dataValue = { value: [real_time, real_value] };
|
series_data_station_power_per_qy.push(dataValue);
|
|
}
|
|
|
series_arr = [
|
{
|
name: '昨日' + data.name,
|
type: 'line',
|
showSymbol: false,
|
hoverAnimation: false,
|
symbolSize: 10,
|
itemStyle: {
|
color: "rgba(204, 204, 204, 0.8)"
|
},
|
data: series_data_station_power_per_qy,
|
},
|
{
|
name: data.name,
|
type: 'line',
|
showSymbol: false,
|
hoverAnimation: false,
|
symbolSize: 10,
|
id: data.id,
|
itemStyle: {
|
color: "#0f0"
|
},
|
data: series_data_station_power_per_q,
|
},
|
];
|
} else {
|
series_arr = [{
|
name: data.name,
|
type: 'line',
|
showSymbol: false,
|
hoverAnimation: false,
|
symbolSize: 10,
|
id: data.id,
|
itemStyle: {
|
color: "#0f0"
|
},
|
data: series_data_station_power_per_q,
|
}];
|
}
|
|
|
var valeuDate = data.day;
|
var main_chart_option = {
|
title: {
|
text: ""
|
},
|
|
tooltip: {
|
trigger: 'axis',
|
show: false,
|
},
|
grid: {
|
containLabel: true,
|
x: '25',
|
y: '30',
|
x2: '25',
|
y2: '10'
|
},
|
xAxis: {
|
type: 'time',
|
splitLine: {
|
show: true,
|
lineStyle: {
|
type: 'dashed'
|
}
|
},
|
axisLabel: {
|
color: '#fff',
|
formatter: function (v, index) {
|
var date = new Date(v);
|
//console.log(date);
|
var texts = [date.getHours(), date.getMinutes()];
|
return texts.join(':');
|
}
|
},
|
axisLine: {
|
lineStyle: {
|
color: '#fff'
|
},
|
},
|
min: getDay(0, new Date(valeuDate)) + " 00:00:00",
|
max: getDay(0, new Date(valeuDate)) + " 23:59:59",
|
interval: 60 * 60 * 1000 * 4,
|
},
|
yAxis: [{
|
name: data.name,
|
nameLocation: 'end',
|
nameGap: 10,
|
nameTextStyle: {
|
fontSize: 10
|
},
|
type: 'value',
|
splitLine: {
|
show: true,
|
lineStyle: {
|
type: 'dashed'
|
}
|
},
|
axisLabel: {
|
color: '#fff',
|
show: false,
|
},
|
axisLine: {
|
lineStyle: {
|
color: '#fff'
|
},
|
},
|
scale: true
|
}
|
],
|
series: series_arr
|
};
|
|
m_chartMain.setOption(main_chart_option);
|
|
//数据为空是显示初始化图表
|
if (recordList_q == null || recordList_q.length == 0) {
|
return;
|
}
|
//日期为今天时 定时两分钟刷新数据
|
if (m_setInterval.qp != null) {
|
clearInterval(m_setInterval.qp);
|
m_setInterval.qp = null;
|
}
|
if (m_setInterval.qp_lastpoint != null) {
|
clearInterval(m_setInterval.qp_lastpoint);
|
m_setInterval.qp_lastpoint = null;
|
}
|
if (data.day == getDay(0)) {
|
//开启定时器
|
|
m_setInterval.qp = setInterval(function () {
|
refreshMonitorRecordInChart(data.id);
|
}, 2 * 60 * 1000);
|
|
var series = m_chartMain.getOption().series;
|
var seriesIndex = series.length - 1;
|
var dataIndex = series[seriesIndex].data.length - 1;
|
|
|
showChartLastPointTip(m_chartMain);
|
|
|
m_chartMain.dispatchAction({
|
type: 'downplay',
|
seriesIndex: seriesIndex,
|
dataIndex: dataIndex - 1,
|
})
|
|
//设置最后一个点闪烁
|
m_setInterval.qp_lastpoint = setInterval(function () {
|
m_chartMain.dispatchAction({
|
type: 'highlight',
|
seriesIndex: seriesIndex,
|
dataIndex: dataIndex,
|
})
|
|
setTimeout(function () {
|
m_chartMain.dispatchAction({
|
type: 'downplay',
|
seriesIndex: seriesIndex,
|
dataIndex: dataIndex,
|
})
|
}, 1000 * 1)
|
}, 2 * 1000);
|
}
|
|
|
|
//点击跳转页面
|
let id = $(".box_tr_btn_tab.active").data("pointid");
|
$("#prop_info_chart canvas").css({ "cursor": "pointer" });
|
$("#prop_info_chart").off("click");
|
$("#prop_info_chart").on('click', function () {
|
m_asideBoxIsShow = true
|
m_iframe_loading_index && layer.close(m_iframe_loading_index)
|
m_iframe_loading_index = layer.load(1);
|
var name = data.name;
|
$(".aside_box").hide();
|
$(".show_aside_box").removeClass("active");
|
$(".xingneng").show();
|
let url = "./GeneralQP?pointid=" + data.id + "&day=" + data.day + "&name=" + data.name
|
|
$(".xingneng").children("iframe").attr("src", url);
|
|
});
|
if (m_asideBoxIsShow) {
|
$("#prop_info_chart").click();
|
}
|
|
}
|
//刷新今天数据
|
function refreshMonitorRecordInChart(id) {
|
$.ajax({
|
type: "get",
|
cache: false,
|
dataType: 'json',
|
url: GlobalParas.Url.MainApi + "LargeScreen/Demo/Run/GetLastRealRecordByMonitorPointID",
|
data: { MonitorPointID: id, CorpID: m_corpID },//获取最近的数据
|
success: function (result) {
|
if (result.Code != 0)
|
return;
|
var resdata = result.Data;
|
resdata = resdata || []
|
if (resdata.length == 0) {
|
return
|
}
|
let record = resdata[0]
|
//console.log(record);
|
var series = m_chartMain.getOption().series;
|
var seriesIndex = series.length - 1;
|
var data1 = series[seriesIndex].data;
|
var dataValue = { value: [record.DataTime, record.DataValue] };
|
data1.push(dataValue);
|
|
m_chartMain.setOption({
|
series: [{}, {
|
data: data1
|
}]
|
});
|
|
if (m_setInterval.qp_lastpoint != null) {
|
clearInterval(m_setInterval.qp_lastpoint);
|
m_setInterval.qp_lastpoint = null;
|
}
|
|
series = m_chartMain.getOption().series;
|
var dataIndex = series[seriesIndex].data.length - 1;
|
|
|
m_chartMain.dispatchAction({
|
type: 'downplay',
|
seriesIndex: seriesIndex,
|
dataIndex: dataIndex - 1,
|
})
|
|
showChartLastPointTip(m_chartMain);
|
|
|
//设置最后一个点闪烁
|
m_setInterval.qp_lastpoint = setInterval(function () {
|
m_chartMain.dispatchAction({
|
type: 'highlight',
|
seriesIndex: seriesIndex,
|
dataIndex: dataIndex,
|
})
|
|
setTimeout(function () {
|
m_chartMain.dispatchAction({
|
type: 'downplay',
|
seriesIndex: seriesIndex,
|
dataIndex: dataIndex,
|
})
|
}, 1000 * 1)
|
}, 2 * 1000);
|
},
|
error: function (textStatus, errorThrown) {
|
console.log("Station.Bim.SHJ2.refreshMonitorRecordInChart 与服务器交互错误, 错误代码 , 信息: " + JSON.stringify(textStatus));
|
}
|
});
|
}
|
|
|
|
|
|
|
|
|
function showChartLastPointTip(myChart) {
|
var series = myChart.getOption().series;
|
var seriesIndex = series.length - 1;
|
var dataIndex = series[seriesIndex].data.length - 1;
|
var lastValue = series[seriesIndex].data[dataIndex].value
|
var ymax = myChart.getModel()._componentsMap.data.yAxis[0].axis.scale._extent
|
var xmax = myChart.getModel()._componentsMap.data.xAxis[0].axis.scale._extent
|
var xm = myChart.convertToPixel({ xAxisIndex: 0 }, xmax[1]);
|
var ym = myChart.convertToPixel({ yAxisIndex: 0 }, ymax[0]);
|
let showValue = formatNumber(lastValue[1])
|
var posix = myChart.convertToPixel({ xAxisIndex: 0 }, lastValue[0]);
|
var posiy = myChart.convertToPixel({ yAxisIndex: 0 }, showValue);
|
var box = setChartTipBoxWH(showValue)
|
var left = posix + 10;
|
var top = posiy + 10;
|
|
var domid = myChart._dom.id
|
|
if (posix + box.width > xm) {
|
left = left - box.width - 20;
|
}
|
if (posiy + box.height > ym) {
|
top = top - box.height - 20;
|
}
|
$(".show_chart_last_point_tip").remove();
|
$("#" + domid).append('<span style="left:' + left + 'px;top:' + top + 'px;" class="show_chart_last_point_tip">' + showValue + '</span>')
|
$(".show_chart_last_point_tip").css({
|
"background-color": "rgba(0,0,0,0.5)",
|
"color": "#fff",
|
"padding": "5px",
|
"border-radius": "5px",
|
"position": "absolute"
|
});
|
}
|
|
|
//计算文字的宽高
|
function setChartTipBoxWH(text) {
|
var span = document.createElement("span");
|
span.style.padding = "5px";
|
var result = {};
|
result.width = span.offsetWidth;
|
result.height = span.offsetHeight;
|
span.style.visibility = "hidden";
|
span.style.display = "inline-block";
|
document.body.appendChild(span);
|
if (typeof span.textContent != "undefined") {
|
span.textContent = text;
|
} else {
|
span.innerText = text;
|
}
|
|
result.width = parseFloat(window.getComputedStyle(span).width) - result.width;
|
result.height = parseFloat(window.getComputedStyle(span).height) - result.height;
|
span.remove();
|
return result;
|
}
|
|
let m_allFeatCurveList = [];//机泵性能曲线集合
|
/** 获取泵站下机泵性能曲线 */
|
function getFeatCurveByStationIdAndDay() {
|
$.ajax({
|
type: "get",
|
dataType: 'json',
|
cache: true,
|
url: GlobalParas.Url.MainApi + 'LargeScreen/Demo/PipeLine/GetExPumpFeatCurveListByBelongTypeAndBelongID',
|
data: {
|
BelongID: m_StationID,//m_StationID
|
CorpID: m_corpID,//m_corpID
|
BelongType: '泵站'
|
},
|
success: function (result) {
|
// console.log(result,2869)
|
if (result.Code != 0) {
|
return;
|
}
|
var data = result.Data;
|
m_allFeatCurveList = data || [];
|
},
|
error: function (textStatus, errorThrown) {
|
console.log("Pump.FeatCurve.Index 与服务器交互错误, 错误代码 390, 信息: " + JSON.stringify(textStatus));
|
}
|
});
|
|
}
|
|
|
|
//初始化曲线
|
function InitialRatedCurveInfo(id, day) {
|
if (id == null || id == 0)
|
return;
|
|
chartCurveQH = [];
|
chartPointQH = [];
|
|
BuildChartQH();
|
|
let featcurveList = m_allFeatCurveList.filter(x => {
|
return x.ID == id
|
})
|
let QH = null
|
if (featcurveList.length > 0) {
|
QH = featcurveList[0].Pump.FeatCurve.PointQH;
|
}
|
|
console.log(QH, m_allFeatCurveList, id, 3130)
|
if (QH != null) {
|
for (var j = 0; j < QH.length; j++) {
|
chartCurveQH.push([QH[j].X, QH[j].Y]);
|
}
|
}
|
|
m_chartMain.setOption({
|
series: [{
|
data: chartCurveQH
|
}, {
|
|
}]
|
});
|
|
|
$.ajax({
|
type: "get",
|
dataType: 'json',
|
url: GlobalParas.Url.MainApi + 'LargeScreen/Demo/Eta/GetDeviationContentByPipeLineIDOfDay',
|
data: {
|
PipeLineID: id, //id
|
CorpID: m_corpID, //m_corpID
|
Day: day,//day
|
},
|
success: function (result) {
|
console.log(result, 3101)
|
if (result == null) {
|
return;
|
}
|
if (result.Code != 0) {
|
return;
|
}
|
let data = result.Data || [];
|
|
for (var i = 0; i < data.length; i++) {
|
chartPointQH.push([data[i].Q, data[i].H]);
|
}
|
m_chartMain.setOption({
|
series: [{
|
}, {
|
data: chartPointQH
|
}]
|
});
|
|
},
|
error: function (textStatus, errorThrown) {
|
console.log("Pump.FeatCurve.Index 与服务器交互错误, 错误代码 459, 信息: " + JSON.stringify(textStatus));
|
}
|
});
|
|
|
}
|
|
function BuildChartQH() {
|
|
m_chartMain = echarts.init(document.getElementById('prop_info_chart'));
|
var option = {
|
title: {
|
text: '流量-扬程',
|
top: '5%',
|
right: '4%',
|
textStyle: {
|
fontSize: 14,
|
color: "#fff"
|
},
|
},
|
grid: {
|
top: '5%',
|
left: '2%',
|
right: '20',
|
bottom: '5%',
|
containLabel: true
|
},
|
tooltip: {
|
trigger: 'item',
|
show: false,
|
},
|
xAxis: [{
|
name: "",//流量(m³/h)
|
nameLocation: "middle",
|
nameGap: 29,
|
nameTextStyle: {
|
color: "#d4ce55"
|
},
|
splitLine: {
|
show: true,
|
lineStyle: {
|
type: 'dashed'
|
}
|
},
|
axisLine: {
|
onZero: false,
|
lineStyle: {
|
color: "#fff"
|
}
|
},
|
type: 'value'
|
}],
|
yAxis: [{
|
name: "",//"扬程(m)",
|
nameLocation: "middle",
|
nameGap: 39,
|
nameTextStyle: {
|
color: "#d4ce55"
|
},
|
splitLine: {
|
show: true,
|
lineStyle: {
|
type: 'dashed'
|
}
|
},
|
axisLine: {
|
onZero: false,
|
lineStyle: {
|
color: "#fff"
|
}
|
},
|
type: 'value'
|
}
|
],
|
series: [{
|
itemStyle: {
|
normal: {
|
color: '#48dcd7'
|
}
|
},
|
showSymbol: false,
|
data: [],
|
type: 'line',
|
smooth: true,
|
}, {
|
name: '扬程',
|
type: 'scatter',
|
symbolSize: 5,
|
itemStyle: {
|
normal: {
|
borderWidth: 1,
|
borderColor: "#FFF0F5",
|
color: "#fff"
|
},
|
emphasis: {
|
color: "red",
|
}
|
},
|
data: []
|
}]
|
}
|
// 使用刚指定的配置项和数据显示图表。
|
m_chartMain.setOption(option);
|
|
|
|
|
|
|
|
let id = $(".box_tr_btn_tab.active").data("pointid");
|
let name = $(".box_tr_btn_tab.active").data("name");
|
$("#prop_info_chart canvas").css({ "cursor": "pointer" });
|
$("#prop_info_chart").off("click");
|
$("#prop_info_chart").on('click', function () {
|
m_iframe_loading_index = layer.load(1);
|
$(".aside_box").hide();
|
$(".show_aside_box").removeClass("active");
|
$(".xingneng").show();
|
let url = './MiniFeatCurve?pumpid=' + id;
|
$(".xingneng").children("iframe").attr("src", url);
|
});
|
}
|
|
|
|
//主界面执行主界面的命令(点击BTN)
|
function excuteMainMenuBtnCmd(cmdName, cmdPara, sourceElement) {
|
if (m_bimViewer == null)
|
return;
|
var node_id = cmdPara;
|
var product = findObjectByNodeID(node_id);
|
if (product == null)
|
return;
|
|
//
|
if (cmdName == "showorhide") {
|
|
if (product.BimID == null || product.BimID == "")
|
return;
|
|
var j_sourceElement = $(sourceElement);
|
if (j_sourceElement.hasClass("fa-eye")) {
|
j_sourceElement.removeClass("fa-eye");
|
j_sourceElement.addClass("fa-low-vision");
|
|
m_bimViewer.hideComponents([product.BimID]);
|
}
|
else {
|
j_sourceElement.removeClass("fa-low-vision");
|
j_sourceElement.addClass("fa-eye");
|
m_bimViewer.clearSelectedComponents();
|
m_bimViewer.setSelectedComponentsById([product.BimID]);
|
|
m_bimViewer.showComponents([product.BimID]);
|
}
|
|
}
|
else if (cmdName == "target") {
|
|
if (product.BimID == null || product.BimID == "")
|
return;
|
m_bimViewer.clearSelectedComponents();
|
m_bimViewer.setSelectedComponentsById([product.BimID]);
|
m_bimViewer.zoomToSelectedComponents();
|
|
}
|
|
|
}
|
//高亮选中某BIM物体
|
var _last_hight_bim_id = 0;
|
function highLightBimObject(bim_id) {
|
if (bim_id == null || bim_id == "" || bim_id == 0)
|
return;
|
|
if (_last_hight_bim_id == bim_id)
|
return;
|
|
if (_last_hight_bim_id != 0 && _last_hight_bim_id != null)//恢复构件颜色
|
m_bimViewer.restoreComponentsColorById([_last_hight_bim_id]);
|
|
var colorActiveObj = new Glodon.Web.Graphics.Color(255, 165, 0, 1);//高亮色
|
m_bimViewer.overrideComponentsColorById([bim_id], colorActiveObj);
|
|
_last_hight_bim_id = bim_id;
|
|
//console.log(product)
|
m_bimViewer.render();
|
}
|
|
function openVedioWindow(product) {
|
|
layer.open({
|
skin: 'layui-layer-qwert',
|
type: 2,
|
title: '视频监控',
|
content: '/Video/MiniWindow/Index?id=' + product.ID,
|
maxmin: true,
|
area: ['850px', '650px'],
|
shadeClose: true,
|
shade: [0.5, '#000'],
|
success: function (layero, index) {
|
//$(document).on('keydown', function (e) {
|
// console.log(e);
|
// if (e.keyCode == 27) {
|
// alert('按了esc');
|
// //layer.restore();
|
// }
|
//})
|
//var maxmin = $(layero).find(".layui-layer-maxmin");
|
//console.log(maxmin);
|
},
|
full: function (layero) {
|
//alert("全屏");
|
var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
|
//console.log(iframeWin);
|
//iframeWin.gaunbi();
|
},
|
min: function () {
|
//alert("最小化");
|
},
|
restore: function () {
|
//alert("看看那个触发");
|
}
|
});
|
}
|
|
var click_obj_list_id = "";
|
var m_flow_meter_bimid_list = ["1829426", "1829232", "1829040", "1828846", "1828652", "1826227"];
|
var m_press_meter_bimid_list_outlet = ["1829427", "1829233", "1829041", "1828847", "1828653", "1826867"];
|
var m_press_meter_bimid_list_inlet = ["1829428", "1829234", "1829042", "1828848", "1828654", "1827057"];
|
var m_video_bimid_list = ["1642313", "1645885", "1645892", "1645947", "1645954", "1646054", "1646061", "1646047", "1683783"];
|
var m_vibration_bimdid_list = ["1829433", "1829435", "1829432", "1829438", "1829434", "1829431", "1829430", "1829437", "1829436", "1829429",
|
"1829239", "1829241", "1829238", "1829244", "1829235", "1829237", "1829240", "1829236", "1829243", "1829242",
|
"1829047", "1829049", "1829046", "1829052", "1829043", "1829045", "1829048", "1829044", "1829051", "1829050",
|
"1828853", "1828855", "1828852", "1828858", "1828851", "1828854", "1828849", "1828850", "1828857", "1828856",
|
"1828659", "1828661", "1828658", "1828664", "1828657", "1828660", "1828655", "1828656", "1828663", "1828662",
|
"1827764", "1828114", "1827686", "1828436", "1827641", "1828021", "1827371", "1827515", "1828293", "1828263"];
|
|
|
|
|
//显示视频监控
|
function showVideoInfo(index, position) {
|
var id = index % 3;
|
// console.log(id,3197)
|
$(".videoDiv").remove();
|
var config = new Glodon.Bimface.Plugins.Drawable.CustomItemConfig();
|
var circle = document.createElement('div');
|
circle.style.width = '300px';//自定义样式,支持Html的任意dom元素
|
//circle.style.padding = '10px';
|
circle.style.background = '#ffffff';
|
circle.className = 'videoDiv';
|
var html = "";
|
html += '<div style="height:30px;line-height:30px;position:relative;padding:0 10px;"><span>监控视频</span><i class="close iconfont iconbaseline-close-px"></i></div>';
|
html += '<div style="height:260px;"><iframe src="/Demo/miniVideo?id=' + id + '" style="width:100%;height:100%;" ></iframe></div>';
|
circle.innerHTML = html;//这里读取后台的问题的name
|
config.content = circle;
|
config.draggable = true;//设置可以拖拽
|
config.viewer = m_bimViewer;
|
//config.tooltip = '拖我试试';//增加一个Tip提示
|
config.worldPosition = position;
|
var customItem = new Glodon.Bimface.Plugins.Drawable.CustomItem(config);//生成customItem实例
|
m_drawableContainer.addItem(customItem)// 添加自定义标签
|
$(".videoDiv .close").on("click", function () {
|
$(".videoDiv").remove();
|
})
|
|
|
}
|
|
//添加水面效果
|
var isWaterAdded = false;
|
function addWaterEffect() {
|
if (isWaterAdded) {
|
return;
|
}
|
// 构造水面边界
|
var pt1_box1 = {
|
x: 21160.66015625,
|
y: -866.49609375,
|
z: 4300
|
};
|
var pt2_box1 = {
|
x: -38839.33984375,
|
y: -866.49609375,
|
z: 4300
|
};
|
var pt3_box1 = {
|
x: 21160.66015625,
|
y: -61066.4921875,
|
z: 4300
|
};
|
var pt4_box1 = {
|
x: -38839.33984375,
|
y: -61066.4921875,
|
z: 4300
|
};
|
|
var pt1_box2 = {
|
x: -54980.39453125,
|
y: 67307.05322265625,
|
z: 3200
|
};
|
var pt2_box2 = {
|
x: -54980.39453125, y: 7107.05712890625, z: 3200
|
};
|
var pt3_box2 = {
|
x: -114508.390625, y: 67307.05322265625, z: 3200
|
};
|
var pt4_box2 = {
|
x: -114508.390625, y: 7107.05712890625, z: 3200
|
};
|
|
// 构造水面效果配置项
|
var waterEffectConfig1 = new Glodon.Bimface.Plugins.Animation.WaterEffectConfig();
|
waterEffectConfig1.boundary = [pt1_box1, pt2_box1, pt4_box1, pt3_box1];
|
waterEffectConfig1.viewer = m_bimViewer;
|
// 构造水面效果类,并设置效果
|
var waterEffect1 = new Glodon.Bimface.Plugins.Animation.WaterEffect(waterEffectConfig1);
|
var waterEffectConfig2 = new Glodon.Bimface.Plugins.Animation.WaterEffectConfig();
|
waterEffectConfig2.boundary = [pt1_box2, pt2_box2, pt4_box2, pt3_box2];
|
waterEffectConfig2.viewer = m_bimViewer;
|
// 构造水面效果类,并设置效果
|
var waterEffect2 = new Glodon.Bimface.Plugins.Animation.WaterEffect(waterEffectConfig2);
|
// 移除水面效果
|
//waterEffect.remove();
|
isWaterAdded = true;
|
}
|
|
//在BIM视图中,添加监控面板(初始化时没有值)
|
var m_drawableContainer;
|
var m_isCreateProductTipPanel = false;
|
function showMinitorTipPanel(isDisp) {
|
//console.log("isDisp" + isDisp)
|
if (m_allMonitorPanel == null || m_allMonitorPanel.length == 0)
|
return;
|
if (m_isCreateProductTipPanel) {
|
var arrar_item = [];
|
for (var indexPanel = 0; indexPanel < m_allMonitorPanel.length; indexPanel++) {
|
var minitorPanel = m_allMonitorPanel[indexPanel];
|
arrar_item.push(minitorPanel.PanelID);
|
}
|
if (isDisp) {
|
m_drawableContainer.showItemsById(arrar_item);
|
if (m_clusterItem != null)
|
m_clusterItem.show();
|
}
|
else {
|
m_drawableContainer.hideItemsById(arrar_item);
|
if (m_clusterItem != null)
|
m_clusterItem.hide();
|
}
|
return;
|
}
|
if (!isDisp)
|
return;
|
|
createMinitorTipPanel();
|
createClusterItem();
|
}
|
function createMinitorTipPanel() {
|
m_isCreateProductTipPanel = true;
|
//加载监控指示
|
m_lastRecordsInBimPanel = [];
|
//console.log(m_allMonitorPanel,3333)
|
for (var indexPanel = 0; indexPanel < m_allMonitorPanel.length; indexPanel++) {
|
var minitorPanel = m_allMonitorPanel[indexPanel];
|
if (minitorPanel.Posi == null)
|
continue;
|
if (minitorPanel.RecordList == null || minitorPanel.RecordList.length == 0)
|
continue;
|
var configSiganlInBimItem = new Glodon.Bimface.Plugins.Drawable.CustomItemConfig();
|
// 创建自定义元素,可以是一个dom element,也可以是个字符串
|
var divSiganlInBim = document.createElement('div');
|
divSiganlInBim.style.width = '104px';
|
divSiganlInBim.style.height = '54px';
|
divSiganlInBim.style.borderRadius = '10%';
|
divSiganlInBim.style.background = 'rgba(0,0,0,.6)';
|
divSiganlInBim.style.border = '3px solid #eee';
|
divSiganlInBim.style.color = 'white';
|
divSiganlInBim.style.marginTop = '-66px';
|
divSiganlInBim.style.marginLeft = '-51px';
|
divSiganlInBim.style.padding = '5px';
|
divSiganlInBim.style.fontSize = '10px';
|
divSiganlInBim.id = "signalInBimDiv" + indexPanel;
|
if (minitorPanel.IsDispSignal) {//显示监控值
|
var defaultSignal = minitorPanel.RecordList[0];
|
var dispSignalValue = defaultSignal.RecordValue;
|
var signalId = defaultSignal.PointID;
|
var minitorPanelName = minitorPanel.Name;
|
|
//console.log(signalId, dispSignalValue);
|
//
|
//if (minitorPanel.RunStatus == 1 && minitorPanel.RecordList != null ) {
|
var htmlOnClick = 'onclick="showSignalChart(' + signalId + ',' + indexPanel + ')" ';
|
|
var statusColor = "runStatusInBimOpen";
|
var panel_html = '<div class="tooltipWrap"><span style="opacity:0.8;width:72px;" class="tooltip" >' + minitorPanelName.substr(0, 6) + '</span>';
|
panel_html += '<div data-chartsignalid="' + signalId + '" data-chartindexpanel="' + indexPanel + '" class="showSignalChart pointType ' + statusColor + '" ></div><br/>';
|
panel_html += '<div class="signalInBim"> <span data-chartsignalid="' + signalId + '" data-chartindexpanel="' + indexPanel + '" class="showSignalChart signalInBimValue" id="signalInBim' + signalId + '">' + dispSignalValue + '</span>';//' + dispSignalValue + '
|
panel_html += '<span class="signalInBimUnit">' + defaultSignal.RecordUnitName + '</span></div></div>';
|
|
divSiganlInBim.innerHTML = panel_html;
|
//最近的记录
|
var record_signal = {};
|
record_signal.PointID = signalId;
|
record_signal.ReocrdTime = defaultSignal.ReocrdTime;
|
record_signal.RecordValue = dispSignalValue;
|
m_lastRecordsInBimPanel.push(record_signal);
|
//}
|
//else {//关闭状态的面板:暂时没有
|
// colorProduct = new Glodon.Web.Graphics.Color(176, 196, 222, 1);
|
// statusColor = "runStatusInBimClose";
|
// dispSignalValue = "关闭";
|
// var panel_html = '<div class="tooltipWrap"><span class="tooltip" >' + minitorPanel.Name + '</span>';
|
// panel_html += '<div onclick="showSignalChart(' + signalId + ',' + indexPanel +')" class="pointType ' + statusColor + '" ></div><br/>';
|
// panel_html += '<div class="signalInBim"><span onclick="showSignalChart(' + signalId + ',' + indexPanel +')" class="signalInBimValue" id="signalInBim' + signalId + '">' + dispSignalValue + '</span>';
|
// panel_html += '<span class="signalInBimUnit">' + defaultSignal.Unit + '</span></div></div>';
|
// divSiganlInBim.innerHTML = panel_html;
|
// record_signal.ReocrdTime = "";
|
// record_signal.RecordValue = "";
|
//}
|
}
|
else {
|
var htmlOnClick = "";//暂时点击无效果
|
var minitorPanelName = minitorPanel.Name;
|
var panel_html = '<div class="tooltipWrap"><span ' + htmlOnClick + ' class="signalName" >' + minitorPanelName + '</span>';
|
panel_html += '<div ' + htmlOnClick + ' class="minitorPanelFlagPoint runStatusInBimOpen" ></div><br/>';
|
panel_html += ' </div>';
|
divSiganlInBim.innerHTML = panel_html;
|
}
|
configSiganlInBimItem.content = divSiganlInBim;
|
configSiganlInBimItem.viewer = m_bimViewer;
|
//增加一个Tip提示
|
// configSiganlInBimItem.tooltip = '<span class="abc" style="heiht:50px;line-height:50px;display:block;color:#F500;text-align:center">2432432432</span>';
|
//overrideComponentsColorById([minitorPanel.BimObjectID], colorProduct);
|
configSiganlInBimItem.worldPosition = minitorPanel.Posi;
|
//生成customItem实例
|
var customItem = new Glodon.Bimface.Plugins.Drawable.CustomItem(configSiganlInBimItem);
|
//自定义标签的鼠标左键事件
|
//customItem.onClick(function (item) {
|
// drawableContainer.removeItemById(item.id);
|
// console.log(item.id);
|
// // alert('left click');
|
//});
|
|
////自定义标签的鼠标右键事件
|
//customItem.onRightClick(function (item) {
|
// alert('right click');
|
//});
|
|
// 添加自定义标签
|
m_drawableContainer.addItem(customItem)
|
//设置Tip的样式
|
customItem.setTooltipStyle({ border: '1px' });
|
minitorPanel.PanelID = customItem.id;//保留ID 方便操作
|
}
|
|
$(".showSignalChart").on("click", function () {
|
var signalId = $(this).data("chartsignalid");
|
var indexPanel = $(this).data("chartindexpanel");
|
//console.log(signalId, indexPanel, 1111)
|
showSignalChart(signalId, indexPanel)
|
})
|
|
|
//因为开始时没有记录,所以初始化后获取一下记录
|
refreshMonitorRecordInBimPanel();
|
//开启定时器,暂时不要开启
|
var refreshRecordInterval = setInterval(function () {
|
refreshMonitorRecordInBimPanel();
|
}, 60 * 1000);
|
}
|
|
// 设置聚合标签
|
function createClusterItem() {
|
// 构造聚合标签容器配置项
|
var clusterContainerConfig = new Glodon.Bimface.Plugins.Cluster.ClusterContainerConfig();
|
clusterContainerConfig.viewer = m_bimViewer;
|
// 构造聚合标签容器
|
var clusterContainer = new Glodon.Bimface.Plugins.Cluster.ClusterContainer(clusterContainerConfig);
|
// 构造聚合标签配置项
|
var clusterItemConfig = new Glodon.Bimface.Plugins.Cluster.ClusterItemConfig();
|
clusterItemConfig.tags = m_drawableContainer.getAllItems();
|
clusterItemConfig.maxLevel = 10;
|
clusterItemConfig.viewer = m_bimViewer;
|
// 构造聚合标签对象
|
m_clusterItem = new Glodon.Bimface.Plugins.Cluster.ClusterItem(clusterItemConfig);
|
// 定义聚合标签的点击事件
|
m_clusterItem.onClick(function (data) {
|
var boundingBox = data.boundingBox;
|
m_bimViewer.zoomToBoundingBox(boundingBox, 0.5);
|
});
|
clusterContainer.addCluster(m_clusterItem);
|
clusterContainer.update();
|
}
|
|
|
|
|
|
//构建 摄像头面板
|
var m_cameraMinitorPanelID = "";
|
function showCameraMonitorPanel(isDisp) {
|
if (m_cameraMinitorPanelID != "") {
|
var arrar_item = [];
|
arrar_item.push(m_cameraMinitorPanelID);
|
if (isDisp) {
|
m_drawableContainer.showItemsById(arrar_item)
|
}
|
else {
|
console.log(isDisp, m_cameraMinitorPanelID)
|
m_drawableContainer.hideItemsById(arrar_item)
|
}
|
return;
|
}
|
if (!isDisp)
|
return;
|
var posi = { x: -5269.243450288003, y: 0.7945555635522538, z: 4500.004290323011 };
|
var configSiganlInBimItem = new Glodon.Bimface.Plugins.Drawable.CustomItemConfig();
|
// 创建自定义元素,可以是一个dom element,也可以是个字符串
|
var divSiganlInBim = document.createElement('div');
|
divSiganlInBim.style.width = '300px';
|
divSiganlInBim.style.height = '200px';
|
divSiganlInBim.style.borderRadius = '10%';
|
divSiganlInBim.style.background = 'rgba(0,0,0,.6)';
|
divSiganlInBim.style.border = '3px solid #eee';
|
divSiganlInBim.style.color = 'white';
|
divSiganlInBim.style.marginTop = '-227px';
|
divSiganlInBim.style.marginLeft = '-160px';
|
divSiganlInBim.style.padding = '5px';
|
divSiganlInBim.style.fontSize = '10px';
|
divSiganlInBim.style.overflow = 'hidden';
|
divSiganlInBim.id = "cameraInBimDiv" + 0;
|
var signalName = "视频头";//一号视频头
|
var panel_html = '<div class="tooltipWrap"><span class="signalName" ><iframe id="ysopen1" src="https://open.ys7.com/ezopen/h5/iframe?url=ezopen://LUXVDM@open.ys7.com/D64553479/1.live&autoplay=1&accessToken=at.chvuj2w33pflpi1n2vm4kpw83okab9z0-3k66griscx-173knpn-d1wowcqen" width="300" height="200" allowfullscreen></iframe></span>';
|
panel_html += '<div class="minitorPanelFlagPoint runStatusInBimOpen" ></div><br/>';
|
panel_html += ' </div>';
|
divSiganlInBim.innerHTML = panel_html;
|
configSiganlInBimItem.content = divSiganlInBim;
|
configSiganlInBimItem.viewer = m_bimViewer;
|
configSiganlInBimItem.worldPosition = posi;
|
//生成customItem实例
|
var customItem = new Glodon.Bimface.Plugins.Drawable.CustomItem(configSiganlInBimItem);
|
//console.log(m_drawableContainer, customItem)
|
// 添加自定义标签
|
m_drawableContainer.addItem(customItem)
|
//设置Tip的样式
|
customItem.setTooltipStyle({ border: '1px' });
|
m_cameraMinitorPanelID = customItem.id;
|
}
|
function showVibrationMeterChart(index) {
|
var pointId = [1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, 1306];
|
if (index >= 10)
|
index = 9
|
layer.open({
|
skin: 'layui-layer-qwert',
|
type: 2,
|
title: "振动",
|
content: './VibrationEPT?pointId=' + pointId[index],
|
maxmin: false,
|
area: ['850px', '550px'],
|
shadeClose: true,
|
shade: [0.5, '#000'],
|
});
|
}
|
//显示流量计的曲线小面板
|
function showFlowMeterChart(index) {
|
//layer.alert("单泵流量计信号还在远程调试中...暂时无法查看");
|
//return;
|
/**显示机泵的流量计的监控曲线 */
|
var signalId = [1554, 1580, 1606, 1632, 1657, 1683];
|
layer.open({
|
skin: 'layui-layer-qwert',
|
type: 2,
|
title: "流量" + (index + 1),
|
content: './GeneralQP?pointid=' + signalId[index],
|
maxmin: false,
|
area: ['850px', '550px'],
|
shadeClose: true,
|
shade: [0.5, '#000'],
|
success: function (layero, index) {
|
var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
|
iframeWin.getPointName("流量")
|
}
|
});
|
}
|
//显示压力计的曲线小面板
|
function showPressMeterChart(index, is_outlet) {
|
if (is_outlet) {
|
var signalId = [1553, 1579, 1605, 1631, 1656, 1682];
|
//console.log(is_outlet, signalId[index])
|
layer.open({
|
skin: 'layui-layer-qwert',
|
type: 2,
|
title: "压力",
|
content: './GeneralQP?pointid=' + signalId[index],
|
maxmin: false,
|
area: ['850px', '550px'],
|
shadeClose: true,
|
shade: [0.5, '#000'],
|
success: function (layero, index) {
|
var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
|
iframeWin.getPointName("压力")
|
}
|
});
|
}
|
else {
|
var signalId = [1552, 1578, 1604, 1630, 1655, 1681];
|
//console.log(is_outlet, signalId[index])
|
layer.open({
|
skin: 'layui-layer-qwert',
|
type: 2,
|
title: "压力",
|
content: './GeneralQP?pointid=' + signalId[index],
|
maxmin: false,
|
area: ['850px', '550px'],
|
shadeClose: true,
|
shade: [0.5, '#000'],
|
success: function (layero, index) {
|
var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
|
iframeWin.getPointName("压力")
|
}
|
});
|
}
|
}
|
//显示图表
|
function showSignalChart(signalId, indexPanel) {
|
var minitorPanel = m_allMonitorPanel[indexPanel];
|
//console.log(minitorPanel);
|
layer.open({
|
skin: 'layui-layer-qwert',
|
type: 2,
|
title: minitorPanel.Name,
|
content: './GeneralQP?pointid=' + signalId,
|
maxmin: false,
|
area: ['850px', '550px'],
|
shadeClose: true,
|
shade: [0.5, '#000'],
|
});
|
//振动数据
|
//layer.open({
|
// skin: 'layui-layer-qwert',
|
// type: 2,
|
// title: minitorPanel.Name + minitorPanel.RecordList[0].Name,
|
// content: '/Minitor/MiniChart/VibrationSignal?signalid=' + signalId + '&name=' + minitorPanel.RecordList[0].Name,
|
// maxmin: false,
|
// area: ['850px', '550px'],
|
// shadeClose: true,
|
// shade: [0.5, '#000'],
|
//});
|
}
|
//二维码
|
function showMachineQr() {
|
layer.open({
|
type: 1,
|
title: false,
|
closeBtn: 1,
|
shadeClose: true,
|
//area: ['260px', '262px'], //宽高
|
content: '<div style="width:300px;height:300px;text-align:center;padding-top:22px;"><div id="qrcodeDiv"></div></div> '
|
});
|
var model_share = {};
|
model_share.type = "product";
|
model_share.stationid = m_StationID;
|
model_share.productid = m_current_active_product.ProductID;
|
//console.log(model_share)
|
var strContent = JSON.stringify(model_share);
|
$("#qrcodeDiv").qrcode(strContent);
|
}
|
//显示 属性
|
function showPropGridPanel(objectTag) {
|
|
if (objectTag == "product" && m_current_active_product != null) {
|
if (m_current_active_product == null)
|
return;
|
if (m_current_active_product.ObjectType == 4)
|
return;
|
var partPropList = m_current_active_product.PartPropList;
|
//
|
if (partPropList != null) {
|
BuildProductPropHtml();
|
return;
|
}
|
// console.log(m_current_active_product)
|
if (m_current_active_product.ObjectID <= 0)
|
return;
|
|
$.ajax({
|
type: "get",
|
contentType: "application/json;utf-8",
|
dataType: 'json',
|
url: GlobalParas.Url.MainApi + "LargeScreen/Demo/EnginePump/GetDetailByID",
|
data: { ID: m_current_active_product.ObjectID, CorpID: m_corpID },
|
success: function (result) {
|
//console.log(result)
|
if (result.Code != 0) {
|
return;
|
}
|
let resData = result.Data;
|
let tempArr = [];
|
let jb = {
|
ID: "ID", Name: "名称", NO: "编号", Code: "型号", Specification: "规格",
|
Material: "材质", ManufacturerName: "厂商名称", ManufacturerNO: "出厂编号",
|
ManufacturerDay: "出厂日期", ContractNO: "合同编号",
|
}
|
let ed = {
|
Q: "额定流量", H: "额定扬程", P: "电机功率",
|
}
|
let eData = resData.Pump.RatedParas
|
let jData = resData
|
|
for (i in jb) {
|
tempArr.push({
|
"ID": 0,
|
"GroupName": "基本信息",
|
"PropName": jb[i],
|
"PropValue": jData[i]
|
})
|
}
|
|
for (i in ed) {
|
tempArr.push({
|
"ID": 0,
|
"GroupName": "额定参数",
|
"PropName": ed[i],
|
"PropValue": eData[i]
|
})
|
}
|
|
m_current_active_product.PartPropList = tempArr;
|
|
BuildProductPropHtml();
|
},
|
error: function (textStatus, errorThrown) {
|
console.log("bim.shj2 与服务器交互错误, 错误代码 1615, 信息: " + JSON.stringify(textStatus));
|
}
|
});
|
}
|
else if (objectTag == "station") {
|
|
buildStationPropHtml();
|
}
|
}
|
//显示 监控
|
function showMinitorGridPanel(objectTag) {
|
|
if (objectTag == "product" && m_current_active_product != null) {
|
//console.log(m_current_active_product)
|
if (m_current_active_product == null)
|
return;
|
var signalList = m_current_active_product.RecordList;
|
//console.log(signalList);
|
if (signalList != null) {
|
buildProductMonitorTable();
|
return;
|
}
|
}
|
else if (objectTag == "station") {
|
|
buildStationMonitorTable();
|
}
|
}
|
|
|
//初始化视图
|
function initialDispViewListPanel() {
|
// console.log(m_viewList)
|
if (m_viewList == undefined || m_viewList == '')
|
return;
|
var view_ctrl_html = '';
|
for (var i = 0; i < m_viewList.length; i++) {
|
var nodes = m_viewList[i];
|
let nodesImage = nodes.ThumbnailImage;
|
if (nodes.ThumbnailImage == null) {
|
nodesImage = '/images/demo/demo/y_BIM_img.png';
|
}
|
view_ctrl_html += '<li class="swiper-slide" data-index="' + i + '">';
|
view_ctrl_html += '<div class="y_absolute">';
|
view_ctrl_html += '<img class="y_a_img" src="' + nodesImage + '" ><div class="y_a_footer">' + nodes.Name + '</div>';
|
view_ctrl_html += '</div>';
|
view_ctrl_html += '</li>';
|
}
|
// $("#swiper_container>ul").html(view_ctrl_html);
|
|
|
var bim_btn_html = '';
|
for (var i = 0; i < m_viewList.length; i++) {
|
var nodes = m_viewList[i];
|
let nodesImage = nodes.ThumbnailImage;
|
if (nodes.ThumbnailImage == null) {
|
nodesImage = '/images/demo/y_BIM_img.png';
|
}
|
|
|
|
bim_btn_html += '<span class="bim_tool" data-index="' + i + '">';
|
bim_btn_html += '<a class="bim_tool_inner btn_radio" title="' + nodes.Name + '" style="background-position-x:-596px;text-align:center;line-height:50px;">';
|
bim_btn_html += '<img class="btn_img" src="' + nodesImage + '" />';
|
bim_btn_html += '</a>';
|
bim_btn_html += '</span>';
|
}
|
$(".bim_tool_outbox").append(bim_btn_html);
|
|
$(".btn_radio").on("click", function () {
|
|
$(".btn_radio").parent().removeClass("checked");
|
$(this).parent().addClass("checked");
|
|
let index = $(this).parent().data("index");
|
console.log(index)
|
var viewdata = {
|
position: m_viewList[index].CameraStatus_3D.position,
|
target: m_viewList[index].CameraStatus_3D.target,
|
up: m_viewList[index].CameraStatus_3D.up,
|
};
|
m_bimViewer.setCameraStatus(viewdata);
|
|
|
})
|
|
}
|
//用户添加视图
|
function addView() {
|
$("#view_add_info").css({ "display": "block" });
|
$("#product_view_box").css({ top: ($("#bimface-viewer").height() - $("#product_view_box").height()) + "px" });
|
//取消按钮
|
$(".view_add_btn_sumbit .cancel").unbind();
|
$(".view_add_btn_sumbit .cancel").on("click", function () {
|
$("#view_add_info").css({ "display": "none" })
|
$("#viewName").val('');
|
})
|
//确认按钮
|
$(".view_add_btn_sumbit .confirm").unbind();//先解除绑定事件
|
$(".view_add_btn_sumbit .confirm").on("click", function () {
|
var viewName = $("#viewName").val();
|
if (viewName == '') {
|
alert("请输入视图名称");
|
return;
|
}
|
cameraState = m_bimViewer.getCameraStatus();
|
//console.log(viewName)
|
var viewdata = {
|
name: viewName,
|
position: cameraState.position,
|
target: cameraState.target,
|
up: cameraState.up,
|
isUser: true
|
};//用户自定义视图的数据
|
m_viewList.push(viewdata);
|
showDispViewPanel();
|
//console.log()
|
$("#view_add_info").css({ "display": "none" })
|
$("#viewName").val('');
|
})
|
}
|
//逐渐隐藏
|
function layersSlowHide(ids) {
|
var opacity = 1;
|
var inter_SlowHide = setInterval(function () {
|
opacity -= 0.1;
|
var color = new Glodon.Web.Graphics.Color("#11DAB7", opacity);
|
//m_bimViewer.overrideComponentsColorById(ids, color);
|
m_bimViewer.overrideComponentsOpacityById(ids, opacity);
|
if (opacity <= 0) {
|
clearInterval(inter_SlowHide);
|
m_bimViewer.hideComponentsById(ids);
|
m_bimViewer.render();
|
}
|
m_bimViewer.render();
|
//console.log(opacity)
|
}, 10)
|
}
|
//逐渐显示
|
function layersSlowShow(ids) {
|
var opacity = 0;
|
var inter_SlowHide = setInterval(function () {
|
opacity += 0.1;
|
m_bimViewer.showComponentsById(ids);
|
var color = new Glodon.Web.Graphics.Color("#11DAB7", opacity);
|
//m_bimViewer.overrideComponentsColorById(ids, color);
|
m_bimViewer.overrideComponentsOpacityById(ids, opacity);
|
|
//需要传入所有构件id
|
if (opacity >= 1) {
|
clearInterval(inter_SlowHide);
|
m_bimViewer.restoreComponentsColorById(ids);
|
m_bimViewer.render();
|
}
|
m_bimViewer.render();
|
//console.log(opacity)
|
}, 10)
|
}
|
var m_refreshRecordInterval_Table = null;//定时刷新
|
//构建 监控表(设备)
|
function buildProductMonitorTable() {
|
if (m_current_active_product == null)
|
return;
|
|
var allSignalList = m_current_active_product.RecordList;
|
if (allSignalList == null || allSignalList.length == 0)
|
return;
|
|
var html = "";
|
//console.log(allSignalList,111)
|
m_recordInMonitorTable = [];
|
html += '<tr><th style="text-align:center;" class="group-tit">名称</th><th style="text-align:center;" class="group-tit">监控值</th></tr>';
|
for (var i = 0; i < allSignalList.length; i++) {
|
var signal = allSignalList[i];
|
//console.log(signal)
|
//var value = signal.RecordValue + signal.RecordUnit
|
html += '<tr>';
|
html += '<th>' + signal.RecordName + '</th>';
|
html += '<td class="minitorTableValueCell" ><span id="signalInTable' + signal.PointID + '" data-signalname="' + signal.RecordName + '" data-signalid="' + signal.PointID + '">' + signal.RecordValue + '</span>';
|
let unitname = signal.RecordUnitName || ''
|
html += '<span>' + unitname + '</span>';
|
m_recordInMonitorTable.push(signal);
|
html += '</td>';
|
html += '</tr>';
|
}
|
//console.log(html)
|
|
$("#MinitorInfoTable").html(html);
|
$(".minitorTableValueCell span:first-of-type").on("click", function () {
|
var signalname = $(this).data("signalname");
|
var signalId = $(this).data("signalid");
|
console.log("dd1")
|
layer.open({
|
skin: 'layui-layer-qwert',
|
type: 2,
|
title: signalname,
|
content: './GeneralQP?pointid=' + signalId,
|
maxmin: false,
|
area: ['850px', '550px'],
|
shadeClose: true,
|
shade: [0.5, '#000']
|
});
|
});
|
|
|
refreshMonitorRecordInTable();
|
|
//开启定时器
|
if (m_refreshRecordInterval_Table != null) {
|
clearInterval(m_refreshRecordInterval_Table);
|
m_refreshRecordInterval_Table = null;
|
}
|
m_refreshRecordInterval_Table = setInterval(function () {
|
//
|
refreshMonitorRecordInTable();
|
|
}, 60 * 1000);
|
}
|
//构建 监控表(泵站)
|
function buildStationMonitorTable() {
|
var allSignalList = m_allProductTree[0].Nodes[0].RecordList;
|
//console.log(allSignalList);
|
if (allSignalList == null || allSignalList.length == 0)
|
return;
|
|
var html = "";
|
// console.log(allSignalList, 222)
|
m_recordInMonitorTable = [];
|
html += '<tr><th style="text-align:center;" class="group-tit">名称</th><th style="text-align:center;" class="group-tit">监控值</th></tr>';
|
for (var i = 0; i < allSignalList.length; i++) {
|
var signal = allSignalList[i];
|
html += '<tr>';
|
html += '<th>' + signal.RecordName + '</th>';
|
html += '<td class="minitorTableValueCell" ><span id="signalInTable' + signal.PointID + '" data-signalname="' + signal.RecordName + '" data-signalid="' + signal.PointID + '">' + signal.RecordValue + '</span>';
|
let unitname = signal.RecordUnitName || ''
|
html += '<span>' + unitname + '</span>';
|
m_recordInMonitorTable.push(signal);
|
html += '</td>';
|
html += '</tr>';
|
}
|
|
$("#MinitorInfoTable").html(html);
|
$(".minitorTableValueCell span:first-of-type").on("click", function () {
|
var signalname = $(this).data("signalname");
|
var signalId = $(this).data("signalid");
|
console.log("dd2")
|
layer.open({
|
skin: 'layui-layer-qwert',
|
type: 2,
|
title: signalname,
|
content: './GeneralQP?pointid=' + signalId,
|
maxmin: false,
|
area: ['850px', '550px'],
|
shadeClose: true,
|
shade: [0.5, '#000']
|
});
|
});
|
|
|
refreshMonitorRecordInTable();
|
|
//开启定时器
|
if (m_refreshRecordInterval_Table != null) {
|
clearInterval(m_refreshRecordInterval_Table);
|
m_refreshRecordInterval_Table = null;
|
}
|
m_refreshRecordInterval_Table = setInterval(function () {
|
//
|
refreshMonitorRecordInTable();
|
|
}, 60 * 1000);
|
}
|
|
//打开爆炸图 E
|
function showExplodePage() {
|
if (m_current_active_product == null)
|
return;
|
//var url = "../../Product/Detail/Equipment.html?id=" + id + "&name=" + name;
|
var id = m_current_active_product.ProductID;
|
var name = "CLD立式泵结构图";
|
var url = "http://www.beng35.com/Product/Explode/demo.html?id=" + id + "&name=" + name;
|
if (window.top != window.self) {
|
window.parent.openPage(url, m_current_active_product.ObjectID, m_current_active_product.Name, "productDetail", { Name: m_current_active_product.Name, ID: m_current_active_product.ObjectID });
|
}
|
else {
|
window.open(url);
|
}
|
}
|
//打开设备详情 S
|
function showMachineDetail() {
|
if (m_current_active_product == null)
|
return;
|
if (window.top != window.self) {
|
window.parent.openPage("/Product/Detail/Index?id=" + m_current_active_product.ObjectID, m_current_active_product.ObjectID, m_current_active_product.Name, "productDetail", { Name: m_current_active_product.Name, ID: m_current_active_product.ObjectID });
|
}
|
else {
|
window.open("/Product/Detail/Index?id=" + data.ID);
|
}
|
}
|
//打开弹框 弹出3D模型 S
|
function showModel3D() {
|
layer.open({
|
skin: 'layui-layer-qwert',
|
type: 2,
|
title: '3D图',
|
content: '/Product/Detail/Show3dCad',
|
maxmin: true,
|
area: ['800px', '500px'],
|
shadeClose: true,
|
shade: [0.5, '#000'],
|
});
|
}
|
|
|
|
/**
|
* 刷新BIM视图上的监控值
|
*/
|
async function refreshMonitorRecordInBimPanel() {
|
if (m_lastRecordsInBimPanel == null || m_lastRecordsInBimPanel.length == 0)
|
return;
|
var signalIDs = [];
|
for (var i = 0; i < m_lastRecordsInBimPanel.length; i++) {//其他产品的监控ID
|
var signalID = m_lastRecordsInBimPanel[i].PointID;
|
signalIDs.push(signalID);
|
}
|
|
//console.log(m_lastRecordsInBimPanel);
|
let records = await getMonitorDataByMonitorIds(signalIDs);
|
setMonitorPanelData(records, "signalInBim")
|
|
for (var s = 0; s < records.length; s++) {
|
var record = records[s];
|
for (var k = 0; k < m_lastRecordsInBimPanel.length; k++) {
|
if (m_lastRecordsInBimPanel[k].PointID == record.PointID) {
|
m_lastRecordsInBimPanel[k].RecordTime = record.RecordTime;
|
m_lastRecordsInBimPanel[k].RecordValue = str_recoV;
|
break;
|
}
|
}
|
}
|
}
|
|
var m_recordInMonitorTable = null;
|
/**
|
* 刷新监控表上的监控值
|
*/
|
async function refreshMonitorRecordInTable() {
|
// console.log(m_recordInMonitorTable, 4530);
|
if (m_recordInMonitorTable == null || m_recordInMonitorTable.length == 0)
|
return;
|
//
|
var monitor_point_array = [];
|
for (var i = 0; i < m_recordInMonitorTable.length; i++) {//其他产品的监控ID
|
var id = m_recordInMonitorTable[i].PointID;
|
monitor_point_array.push(id);
|
}
|
let records = await getMonitorDataByMonitorIds(monitor_point_array);
|
|
setMonitorPanelData(records, "signalInTable")
|
}
|
|
|
|
/**
|
* 设置监控面板值
|
* @param {Array} records 测点数据集合
|
* @param {String} prefix ID前缀
|
*/
|
function setMonitorPanelData(records, prefix) {
|
if (!Array.isArray(records)) return;
|
for (var s = 0; s < records.length; s++) {
|
var record = records[s];
|
var signalInBimId = prefix + record.MonitorPointID;
|
var str_recoV = numberFormat4RecordValue(record.DataValue);
|
$("#" + signalInBimId).html(str_recoV);
|
if (str_recoV.length >= 10) {
|
$("#" + signalInBimId).attr("title", str_recoV);
|
}
|
}
|
}
|
|
|
function numberFormat4RecordValue(value) {
|
if (value == null || value == undefined)
|
return 0;
|
value = parseFloat(value)
|
if (value > 100)
|
return parseFloat(value.toFixed(1));
|
else if (value > 10)
|
return parseFloat(value.toFixed(2));
|
else
|
return parseFloat(value.toFixed(4));
|
}
|
|
|
//构建属性表(设备)
|
function BuildProductPropHtml() {
|
if (m_current_active_product == null) {
|
return;
|
}
|
var html = "";
|
var partPropList = m_current_active_product.PartPropList;
|
if (partPropList == null)
|
return;
|
var lastGroupName = "";
|
//console.log(partPropList)
|
|
var baseList = [];
|
var base1List = [];
|
for (var i = 0; i < partPropList.length; i++) {
|
var prop = partPropList[i];
|
if (prop.PropName == "RealImage") {
|
continue;
|
}
|
if (prop.GroupName == "基本信息") {
|
baseList.push(prop)
|
} else if (prop.GroupName == "额定参数") {
|
base1List.push(prop)
|
}
|
}
|
html += '<div class="box_title">基本信息</div><br/>';
|
html += '<div style="display:flex;flex-wrap:wrap;align-items: center;">';
|
|
for (var i = 0; i < baseList.length; i++) {
|
var item = baseList[i];
|
if (item.PropName == "ThumbRealImage") {
|
if (item.PropValue == null || item.PropValue == "")
|
continue;
|
//显示实物图
|
var thumbRealImage = "http://www.beng35.com/ProductData/RealImage/" + item.PropValue;
|
var bigRealImage = thumbRealImage.replace('_th.', '.');
|
|
html += ' <div class="flex33 layui-row">';
|
html += ' <div class="layui-col-md4 right">实物图:</div>';
|
html += ' <div class="layui-col-md8 value_col propimg" style="cursor:pointer;text-decoration:underline;" data-imgurl="' + bigRealImage + '">点击查看图片</div>';
|
html += ' </div>';
|
} else {
|
html += ' <div class="flex33 layui-row">';
|
html += ' <div class="layui-col-md4 right">' + item.PropName + ':</div>';
|
let value = item.PropValue || ''
|
html += ' <div class="layui-col-md8 value_col">' + value + '</div>';
|
html += ' </div>';
|
}
|
|
}
|
html += '</div>';
|
html += '<div class="box_title">额定参数</div><br/>';
|
html += '<div style="display:flex;flex-wrap:wrap;align-items: center;">';
|
for (var i = 0; i < base1List.length; i++) {
|
var item = base1List[i];
|
let value = item.PropValue || ''
|
html += ' <div class="flex33 layui-row">';
|
html += ' <div class="layui-col-md4 right">' + item.PropName + ':</div>';
|
html += ' <div class="layui-col-md8 value_col">' + value + '</div>';
|
html += ' </div>';
|
}
|
html += '</div>';
|
//console.log(html)
|
$("#PropInfoBox").html(html);
|
|
|
}
|
|
//构建属性表(泵站) //buildStationPropHtml() buildStationMonitorTable()
|
function buildStationPropHtml() {
|
var html = "";
|
|
|
html += '<div class="box_title">基本信息</div>';
|
html += ' <div class="layui-row layui-col-space10">';
|
html += ' <div class="layui-col-md4">';
|
html += ' <div class="layui-col-md4 right">名称:</div>';
|
html += ' <div class="layui-col-md8 value_col">松花江泵站</div>';
|
html += ' </div>';
|
html += ' <div class="layui-col-md4">';
|
html += ' <div class="layui-col-md4 right">经度:</div>';
|
html += ' <div class="layui-col-md8 value_col">' + m_stationInfo.Longitude + '</div>';
|
html += ' </div>';
|
html += ' <div class="layui-col-md4">';
|
html += ' <div class="layui-col-md4 right">纬度:</div>';
|
html += ' <div class="layui-col-md8 value_col">' + m_stationInfo.Latitude + '</div>';
|
html += ' </div>';
|
html += ' </div>';
|
html += ' <div class="layui-row layui-col-space10">';
|
html += ' <div class="layui-col-md4">';
|
html += ' <div class="layui-col-md4 right">机泵数:</div>';
|
html += ' <div class="layui-col-md8 value_col">' + m_stationInfo.PumpNumber + '</div>';
|
html += ' </div>';
|
html += ' <div class="layui-col-md8">';
|
html += ' <div class="layui-col-md2 right">地址:</div>';
|
html += ' <div class="layui-col-md10 value_col">' + m_stationInfo.Address + '</div>';
|
html += ' </div>';
|
html += '</div>';
|
|
html += '<div class="box_title">资产信息</div>';
|
html += '<table style="width:calc(100% - 0px);" class="" id="mainGrid" ></table>';
|
$("#PropInfoBox").html(html);
|
|
|
|
|
$.ajax({
|
type: "get",
|
//contentType: "application/json;utf-8",
|
dataType: 'json',
|
url: GlobalParas.Url.MainApi + "LargeScreen/Demo/Product/GetLogicalTreeByBelongTypeAndBelongID",
|
data: { BelongID: m_StationID, CorpID: m_corpID, BelongType: "泵站" },
|
success: function (result) {
|
if (result.Code != 0) {
|
alert(result.Message);
|
return;
|
}
|
//console.log(result, 92)
|
initialTable(result.Data);//加载表格//表格重载
|
},
|
error: function (textStatus, errorThrown) {
|
console.log("Product.InStation 与服务器交互错误, 错误代码 41, 信息: " + JSON.stringify(textStatus));
|
}
|
});
|
|
}
|
|
//树结构格式化list
|
function treeToList(data) {
|
let tmp = []
|
data.forEach((one) => {
|
tmp.push(Object.assign({}, one))
|
//{ Id: one.Id, ParentId: one.ParentId, LogicalName: one.LogicalName, LogicalType: one.LogicalType, }
|
if (one.Children && one.Children.length > 0) {
|
const children = treeToList(one.Children)
|
if (children) {
|
tmp = tmp.concat(children)
|
}
|
}
|
})
|
return tmp
|
}
|
function initialTable(allProducts) {
|
|
let newAllProducts = treeToList(allProducts);
|
|
let top_value = 0;
|
if (allProducts.length > 0) {
|
top_value = allProducts[0].ParentID
|
} else {
|
$("#mainGrid").html('<tr><td style="text-align:center;">暂未数据</td></tr>')
|
return
|
}
|
layui.use(['treeTable'],
|
function () {
|
layui.treeTable.render({
|
elem: '#mainGrid',
|
data: newAllProducts,
|
icon_key: 'LogicalName',
|
top_value: top_value,
|
primary_key: 'ID',
|
parent_key: 'ParentID',
|
id: 'mainGrid',
|
cols: [
|
{ key: 'LogicalName', title: '设备名称', align: 'left', width: '20%' },
|
{ key: 'LogicalModel', title: '设备型号', align: 'center', width: '10%', template: function (item) { return item.LogicalModel ? item.LogicalModel.Code ? item.LogicalModel.Code : '' : '' } },
|
{ key: 'LogicalModel', title: '设备编号', align: 'center', width: '220px', template: function (item) { return item.LogicalModel ? item.LogicalModel.NO ? item.LogicalModel.NO : '' : '' } },
|
{ key: 'LogicalModel', title: '规格', align: 'center', width: '220px', template: function (item) { return item.LogicalModel ? item.LogicalModel.Specification ? item.LogicalModel.Specification : '' : '' } },
|
{ key: 'LogicalModel', title: '厂商', align: 'center', width: "140px", template: function (item) { return item.LogicalModel ? item.LogicalModel.Manufacturer ? item.LogicalModel.Manufacturer : '' : '' } },
|
]
|
|
});
|
|
$("#mainGrid thead").css({
|
width: "calc(100% - 10px)",
|
display: "inline-table",
|
"table-layout": "fixed",
|
})
|
$("#mainGrid tbody").css({
|
"max-height": "315px",
|
display: "block",
|
"overflow-y": "scroll",
|
})
|
|
$(".layui-icon-triangle-r").parent().css({
|
"cursor": "pointer",
|
})
|
|
|
});
|
|
|
|
|
}
|
|
|
//四舍五入
|
function valueFormat(value) {
|
var v = value.toString();
|
var result = v;
|
var decimalIndex = v.indexOf('.');
|
if (decimalIndex != -1) {
|
result = v.substring(decimalIndex + 1, v.length);
|
if (result.length > 5) {
|
v = parseFloat(value).toFixed("5");
|
var str = v.toString();
|
if (str.substr(str.length - 2, 2) == "00") {
|
v = parseFloat(value).toFixed("1");
|
}
|
else if (str.substr(str.length - 1, 1) == "0") {
|
v = parseFloat(value).toFixed("2");
|
}
|
}
|
}
|
return v;
|
}
|
}
|