2022-11-15 18:47:16 +08:00
|
|
|
|
<style>
|
2023-04-24 11:55:46 +08:00
|
|
|
|
[id^="yt_tooltip"] {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
min-width: 520px;
|
|
|
|
|
}
|
2022-11-15 18:47:16 +08:00
|
|
|
|
</style>
|
|
|
|
|
|
2022-11-18 17:12:45 +08:00
|
|
|
|
<div class="row m-0 mb-3">
|
2023-03-13 12:00:31 +08:00
|
|
|
|
<button id="resChartZoom" class="btn btn-info">圖檔重置</button>
|
2022-11-18 17:12:45 +08:00
|
|
|
|
</div>
|
2022-12-09 18:20:41 +08:00
|
|
|
|
<!-- <div class="row">
|
2023-03-13 12:00:31 +08:00
|
|
|
|
<div id="floChart" style="height : 80vh!important;width:100%"></div>
|
2022-12-09 18:20:41 +08:00
|
|
|
|
</div> -->
|
|
|
|
|
<!-- <div class="row">
|
2023-03-13 12:00:31 +08:00
|
|
|
|
<div id="forgeViewer" class="position-absolute" style="width:96%;height:96%;"></div>
|
2022-12-09 18:20:41 +08:00
|
|
|
|
</div> -->
|
|
|
|
|
<div class="d-flex">
|
2023-03-13 12:00:31 +08:00
|
|
|
|
<div class="col-6 my-3">
|
2023-04-24 11:55:46 +08:00
|
|
|
|
<div id="floChart"
|
|
|
|
|
style="height: 100%; width: 100%; background-color: #fff"></div>
|
2023-03-13 12:00:31 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="col-6 my-3">
|
|
|
|
|
<!-- <div id="forgeViewer" class="position-relative" style="height:100%">
|
2023-04-24 11:55:46 +08:00
|
|
|
|
<div id="forgeHeatBarDiv" class="d-flex mb-4 position-absolute" style="gap:15px">
|
|
|
|
|
</div>
|
|
|
|
|
</div> -->
|
|
|
|
|
<div id="forgeViewer" class="position-relative" style="height: 80vh">
|
|
|
|
|
<div id="forgeHeatBarDiv"
|
|
|
|
|
class="d-flex mb-4 position-absolute"
|
|
|
|
|
style="gap: 15px"></div>
|
2023-03-13 12:00:31 +08:00
|
|
|
|
</div>
|
2022-12-09 18:20:41 +08:00
|
|
|
|
</div>
|
2022-11-15 18:47:16 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
2022-12-31 18:03:16 +08:00
|
|
|
|
<!--<script src="lib/echarts.min.js"></script>-->
|
2022-11-15 18:47:16 +08:00
|
|
|
|
<script>
|
2023-03-13 12:00:31 +08:00
|
|
|
|
var floChart = null;
|
|
|
|
|
var currentData = [];
|
|
|
|
|
var heatMap = null;
|
|
|
|
|
var allDeviceRowData = []; //所有設備原始資料
|
|
|
|
|
var global_emergency_alarm_device_number = [];
|
2023-04-24 11:55:46 +08:00
|
|
|
|
var lightControl = "device"; // device 群控 node 燈控
|
2023-03-13 12:00:31 +08:00
|
|
|
|
var zoomToggle = 3;
|
|
|
|
|
$(function () {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
initChart();
|
|
|
|
|
getFloData();
|
2023-03-13 12:00:31 +08:00
|
|
|
|
drawHeatBar();
|
|
|
|
|
getHotspotPoint(() => {
|
|
|
|
|
show3DModel(pageAct.urn);
|
|
|
|
|
});
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
onEvent("click", "#resChartZoom", function () {
|
|
|
|
|
floChart.setOption({
|
|
|
|
|
geo: {
|
|
|
|
|
center: null,
|
|
|
|
|
zoom: 1.2,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
resetData();
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
function getFloData() {
|
|
|
|
|
let url = baseApiUrl + "/api/Device/GetDeviceList";
|
|
|
|
|
let sendData = {
|
|
|
|
|
sub_system_tag: pageAct.sysSubTag,
|
|
|
|
|
building_tag: pageAct.buiTag,
|
|
|
|
|
floor_tag: pageAct.floTag,
|
|
|
|
|
};
|
|
|
|
|
objSendData.Data = sendData;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
ytAjax = new YourTeam.Ajax(
|
|
|
|
|
url,
|
|
|
|
|
objSendData,
|
|
|
|
|
function (res) {
|
|
|
|
|
if (!res || res.code != "0000" || !res.data) {
|
|
|
|
|
} else {
|
|
|
|
|
lightControl = res.module;
|
|
|
|
|
chartHandler(
|
|
|
|
|
`${baseImgUrl}/upload/floor_map/${res.data[0].floor_map_name}`
|
|
|
|
|
);
|
|
|
|
|
if (pageAct.sysSubTag === "L1") {
|
|
|
|
|
let nodes = [];
|
|
|
|
|
res.data[0].device_list.forEach((d) => {
|
|
|
|
|
nodes = [...nodes, ...d.device_nodes];
|
|
|
|
|
});
|
|
|
|
|
getDevice([...nodes, ...res.data[0].device_list]);
|
|
|
|
|
} else {
|
|
|
|
|
getDevice(res.data[0].device_list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
null,
|
|
|
|
|
"POST"
|
|
|
|
|
).send();
|
2022-11-17 10:49:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
function getDevice(devList) {
|
|
|
|
|
let selected_floor = devList[0];
|
|
|
|
|
//let selected_floor_objs = devList.filter(function (item) {
|
|
|
|
|
// return item.floor_guid == selected_floor.floor_guid;
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
//currentData = selected_floor_objs[0].device;
|
|
|
|
|
|
|
|
|
|
currentData = $.map(devList, function (item) {
|
|
|
|
|
//資料處理
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
selected_floor.device_number != undefined &&
|
|
|
|
|
selected_floor.device_number != null &&
|
|
|
|
|
selected_floor.device_number != "" &&
|
|
|
|
|
selected_floor.device_number == item.device_number
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item.selected = true;
|
|
|
|
|
} else {
|
|
|
|
|
item.selected = false;
|
2022-11-17 15:22:45 +08:00
|
|
|
|
}
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
item.device_coordinate != undefined &&
|
|
|
|
|
item.device_coordinate != null
|
|
|
|
|
) {
|
|
|
|
|
var coordinate = item.device_coordinate.split(",");
|
|
|
|
|
item.value = [parseFloat(coordinate[0]), parseFloat(coordinate[1])];
|
2022-11-17 18:26:30 +08:00
|
|
|
|
}
|
2022-11-17 22:14:46 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
item.device_nodes != undefined &&
|
|
|
|
|
item.device_nodes != null &&
|
|
|
|
|
item.device_nodes.length > 0
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (item.device_master_number == selected_floor.device_master) {
|
|
|
|
|
//var datatable_data = {
|
|
|
|
|
// device_full_name: item.full_name,
|
|
|
|
|
// device_number: item.device_number,
|
|
|
|
|
// device_master: item.device_master_number
|
|
|
|
|
//}
|
|
|
|
|
//datatable_data_list.push(datatable_data);
|
|
|
|
|
|
|
|
|
|
$.map(item.device_nodes, function (item_node) {
|
|
|
|
|
item_node.selected = false;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
item_node.device_node_coordinate != undefined &&
|
|
|
|
|
item_node.device_node_coordinate != null
|
|
|
|
|
) {
|
|
|
|
|
var node_coordinate = item_node.device_node_coordinate.split(",");
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item_node.value = [
|
|
|
|
|
parseFloat(node_coordinate[0]),
|
2023-04-24 11:55:46 +08:00
|
|
|
|
parseFloat(node_coordinate[1]),
|
|
|
|
|
];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2023-04-24 11:55:46 +08:00
|
|
|
|
} else {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//var index = datatable_data_list.findIndex(x => x.device_number == item.device_number);
|
|
|
|
|
//if (index < 0) {
|
|
|
|
|
// var datatable_data = {
|
|
|
|
|
// device_number: item.device_number,
|
|
|
|
|
// device_master: item.device_master_number
|
|
|
|
|
// }
|
|
|
|
|
// datatable_data_list.push(datatable_data);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
$.map(item.device_nodes, function (item_node) {
|
|
|
|
|
item_node.selected = false;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
item_node.device_node_coordinate != undefined &&
|
|
|
|
|
item_node.device_node_coordinate != null
|
|
|
|
|
) {
|
|
|
|
|
var node_coordinate = item_node.device_node_coordinate.split(",");
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item_node.value = [
|
|
|
|
|
parseFloat(node_coordinate[0]),
|
2023-04-24 11:55:46 +08:00
|
|
|
|
parseFloat(node_coordinate[1]),
|
|
|
|
|
];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return item;
|
|
|
|
|
});
|
|
|
|
|
if (currentData == null || currentData.length == 0) {
|
|
|
|
|
currentData = [];
|
|
|
|
|
}
|
2022-11-17 10:49:49 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// myBaja.setPrepareSubscribeDevices(currentData);
|
|
|
|
|
// myBaja.setCallBack(mySubscribeDevices);
|
2022-11-17 10:49:49 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//if (datatable_data_list.length > 0) {
|
|
|
|
|
// $("#datatablediv").show();
|
|
|
|
|
// dataTableDraw();
|
|
|
|
|
//} else {
|
|
|
|
|
// $("#datatablediv").hide();
|
|
|
|
|
//}
|
2023-03-06 11:37:01 +08:00
|
|
|
|
resetData();
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
2022-11-17 10:49:49 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
function initChart() {
|
|
|
|
|
let chartDom = $("#floChart")[0];
|
2023-04-24 11:55:46 +08:00
|
|
|
|
floChart = echarts.init(chartDom, null, { width: "auto" });
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
2022-11-17 22:14:46 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
function chartHandler(url) {
|
|
|
|
|
floChart.clear();
|
|
|
|
|
|
|
|
|
|
$.get(url, function (svg) {
|
|
|
|
|
if (svg == undefined || svg == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-11-17 10:49:49 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
echarts.registerMap("floor_svg", { svg: svg });
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
option = {
|
|
|
|
|
// animationDurationUpdate: 1500,
|
|
|
|
|
tooltip: {
|
|
|
|
|
formatter: function (params) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
params.data.device_node_guid != undefined &&
|
|
|
|
|
params.data.device_node_guid != null &&
|
|
|
|
|
params.data.device_node_guid != ""
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
return `<div >
|
|
|
|
|
名稱:${params.data.device_node_full_name}<br>
|
|
|
|
|
Guid:${params.data.device_node_guid}
|
2023-04-24 11:55:46 +08:00
|
|
|
|
</div>`;
|
|
|
|
|
} else {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
return `<div >名稱:${params.data.full_name}<br>
|
2023-04-24 11:55:46 +08:00
|
|
|
|
Guid:${params.data.device_guid}</div>`;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
2023-04-24 11:55:46 +08:00
|
|
|
|
},
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
2023-04-24 11:55:46 +08:00
|
|
|
|
toolbox: {
|
|
|
|
|
//工具欄
|
|
|
|
|
show: false,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
|
|
|
|
geo: {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
map: "floor_svg",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
roam: true,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
scaleLimit: {
|
|
|
|
|
//限制放大縮小倍數
|
2023-03-13 12:00:31 +08:00
|
|
|
|
max: 16,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
min: 1,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
2023-04-24 11:55:46 +08:00
|
|
|
|
layoutSize: "100%",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
layoutCenter: [],
|
|
|
|
|
zoom: 1.2,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
silent: true,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
|
|
|
|
series: [
|
2023-04-24 11:55:46 +08:00
|
|
|
|
{
|
|
|
|
|
//不管有無被選擇(圓點)
|
|
|
|
|
type: "scatter",
|
|
|
|
|
coordinateSystem: "geo",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
geoIndex: 0,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
symbol: "circle",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
symbolSize: 20,
|
|
|
|
|
symbolOffset: [10, 10],
|
|
|
|
|
label: {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
show: false,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
|
|
|
|
/*data: currentData,*/
|
2023-04-24 11:55:46 +08:00
|
|
|
|
z: 2,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
2023-04-24 11:55:46 +08:00
|
|
|
|
{
|
|
|
|
|
//未選擇的設備(icon)
|
|
|
|
|
type: "scatter",
|
|
|
|
|
coordinateSystem: "geo",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
geoIndex: 0,
|
|
|
|
|
symbolSize: 50,
|
|
|
|
|
label: {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
formatter: "{b}",
|
|
|
|
|
position: "bottom",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
show: true,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
backgroundColor: "orange",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
|
|
|
|
emphasis: {
|
|
|
|
|
label: {
|
|
|
|
|
show: true,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
fontSize: "20",
|
|
|
|
|
fontWeight: "bold",
|
|
|
|
|
color: "yellow",
|
|
|
|
|
},
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
2023-04-24 11:55:46 +08:00
|
|
|
|
selectedMode: "single",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
data: null,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
z: 1,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
2023-04-24 11:55:46 +08:00
|
|
|
|
{
|
|
|
|
|
//被選擇的設備(icon)
|
|
|
|
|
type: "effectScatter",
|
|
|
|
|
coordinateSystem: "geo",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
geoIndex: 0,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
showEffectOn: "render",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
symbolSize: 50,
|
|
|
|
|
label: {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
formatter: "{b}",
|
|
|
|
|
position: "bottom",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
show: true,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
backgroundColor: "orange",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
|
|
|
|
emphasis: {
|
|
|
|
|
label: {
|
|
|
|
|
show: true,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
fontSize: "20",
|
|
|
|
|
fontWeight: "bold",
|
|
|
|
|
color: "yellow",
|
|
|
|
|
},
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
2023-04-24 11:55:46 +08:00
|
|
|
|
selectedMode: "single",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
data: null,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
z: 1,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
2023-04-24 11:55:46 +08:00
|
|
|
|
{
|
|
|
|
|
//編輯模式底下的設備(圓點,只會有一個)
|
|
|
|
|
type: "scatter",
|
|
|
|
|
coordinateSystem: "geo",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
geoIndex: 0,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
symbol: "circle",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
symbolSize: 20,
|
|
|
|
|
symbolOffset: [10, 10],
|
|
|
|
|
label: {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
show: false,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
|
|
|
|
/*data: currentData,*/
|
2023-04-24 11:55:46 +08:00
|
|
|
|
z: 2,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
2023-04-24 11:55:46 +08:00
|
|
|
|
{
|
|
|
|
|
//編輯模式底下的設備(icon,只會有一個)
|
|
|
|
|
type: "scatter",
|
|
|
|
|
coordinateSystem: "geo",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
geoIndex: 0,
|
|
|
|
|
symbolSize: 50,
|
|
|
|
|
label: {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
formatter: "{b}",
|
|
|
|
|
position: "bottom",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
show: true,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
backgroundColor: "orange",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
|
|
|
|
emphasis: {
|
|
|
|
|
label: {
|
|
|
|
|
show: true,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
fontSize: "20",
|
|
|
|
|
fontWeight: "bold",
|
|
|
|
|
color: "yellow",
|
|
|
|
|
},
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
|
|
|
|
data: null,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
z: 1,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
floChart.setOption(option);
|
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
currentData != undefined &&
|
|
|
|
|
currentData != null &&
|
|
|
|
|
currentData.length > 0
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
resetData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ordPath = {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
building_tag: pageAct.buiTag,
|
|
|
|
|
system_tag: pageAct.sysMainTag,
|
|
|
|
|
};
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//myBaja.setSubscribeDevicesByBql(ordPath);
|
|
|
|
|
//myBaja.setSubscribeDevicesCallBack(subscribeCallBack);
|
|
|
|
|
let parentEle = null;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
floChart.on("click", function (params) {
|
|
|
|
|
console.log("Click1", params);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
forgeUnFocusAll();
|
|
|
|
|
chartUnFocusAll();
|
|
|
|
|
if (params.componentType == "series") {
|
|
|
|
|
let data = params.data;
|
|
|
|
|
let rect = $("#floChart")[0].getBoundingClientRect();
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let position = [
|
|
|
|
|
rect.left + rect.width / 2,
|
|
|
|
|
rect.top + rect.height / 4,
|
|
|
|
|
];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// console.log(position)
|
|
|
|
|
// let position = [params.event.event.clientX+100, params.event.event.clientY-300];
|
2023-04-24 11:55:46 +08:00
|
|
|
|
data._dbId = data._dbId ?? "";
|
|
|
|
|
// currentData.find(
|
|
|
|
|
// (cData) => cData.device_number === data.device_number
|
|
|
|
|
// ).forge_dbid;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
parentEle = crePosPopover(position, data);
|
|
|
|
|
$(parentEle).click();
|
|
|
|
|
} else {
|
|
|
|
|
$(parentEle).YTTooltip("hide");
|
|
|
|
|
}
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
2022-11-17 10:49:49 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
floChart.getZr().on("click", function (params) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
/*console.log("click", params);*/
|
|
|
|
|
var pixelPoint = [params.offsetX, params.offsetY];
|
|
|
|
|
var dataPoint = floChart.convertFromPixel({ geoIndex: 0 }, pixelPoint);
|
2022-11-17 10:49:49 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (!(params?.target?.shape?.symbolType == "circle")) {
|
|
|
|
|
$(parentEle).YTTooltip("hide");
|
|
|
|
|
}
|
2022-12-31 18:03:16 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//temp_device_on_floor_map = [{
|
|
|
|
|
// device_guid: selected_temp_device.device_guid,
|
|
|
|
|
// device_full_name: selected_temp_device.device_full_name,
|
|
|
|
|
// device_node_guid: selected_temp_device.device_node_guid ? selected_temp_device.device_node_guid : null,
|
|
|
|
|
// device_node_full_name: selected_temp_device.device_node_full_name ? selected_temp_device.device_node_full_name : null,
|
|
|
|
|
// status: selected_temp_device.status,
|
|
|
|
|
// value: dataPoint
|
|
|
|
|
//}];
|
2022-11-17 10:49:49 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// currentData.push([dataPoint[0], dataPoint[1], 1]);
|
|
|
|
|
// floChart.setOption(option);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
onEvent("autodesk:complete:sprite", "#forgeViewer", function (e, obj) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
console.log(obj.myDataList);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
let option = floChart.getOption();
|
|
|
|
|
|
|
|
|
|
option.series.forEach(function (series) {
|
|
|
|
|
(series.data ?? []).forEach(function (point) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let dbid = obj.myDataList.filter(
|
|
|
|
|
(x) => x.device_number == point.device_number
|
|
|
|
|
)[0]?._dbId;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
point._dbId = dbid;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
// currentData.forEach(function (cData) {
|
|
|
|
|
// console.log(cData.device_node_guid=== point.device_node_guid)
|
|
|
|
|
// if (lightControl === "node" && pageAct.sysSubTag === "L1" && cData.device_node_guid == point.device_node_guid) {
|
|
|
|
|
// cData._dbId = dbid;
|
|
|
|
|
// cData.spriteDbid = dbid;
|
|
|
|
|
// setForgeHotSpotColor(cData);
|
|
|
|
|
// }
|
|
|
|
|
// else if (cData.device_guid == point.device_guid) {
|
|
|
|
|
// cData._dbId = dbid;
|
|
|
|
|
// cData.spriteDbid = dbid;
|
|
|
|
|
// setForgeHotSpotColor(cData);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
const cData = currentData.find((cur) => {
|
|
|
|
|
if (lightControl === "node" && pageAct.sysSubTag === "L1") {
|
|
|
|
|
if (cur.device_node_guid == point.device_node_guid) return cur;
|
|
|
|
|
} else if (cur.device_guid == point.device_guid) {
|
|
|
|
|
return cur;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
|
|
|
|
cData._dbId = dbid;
|
|
|
|
|
cData.spriteDbid = dbid;
|
|
|
|
|
setForgeHotSpotColor(cData);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
2023-04-24 11:55:46 +08:00
|
|
|
|
floChart.setOption(option);
|
|
|
|
|
});
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//floChart.on('selectchanged', function (params) {
|
2022-11-17 10:49:49 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// console.log("selectchanged", params);
|
|
|
|
|
// // currentData.push([dataPoint[0], dataPoint[1], 1]);
|
|
|
|
|
// // floChart.setOption(option);
|
2022-11-17 10:49:49 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// currentData = $.map(currentData, function (item) {
|
|
|
|
|
// item.selected = false;
|
|
|
|
|
// return item;
|
|
|
|
|
// });
|
2022-11-17 10:49:49 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// if (params.selected.length > 0) {
|
|
|
|
|
// currentData[params.selected[0].seriesIndex - 1].selected = true;
|
|
|
|
|
// }
|
2022-11-17 15:22:45 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//});
|
2022-11-17 22:14:46 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// floChart.getZr().on('mousewheel', function (params) {
|
|
|
|
|
// console.log(params)
|
|
|
|
|
// })
|
2023-04-24 11:55:46 +08:00
|
|
|
|
floChart.on("georoam", function (params) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
var zoom = floChart.getOption().geo[0].zoom;
|
2023-02-17 11:01:29 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (zoom <= 2.5) {
|
|
|
|
|
/*ResetFloorMap();*/
|
|
|
|
|
floChart.setOption({
|
|
|
|
|
geo: {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
roam: "scale",
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
floChart.setOption({
|
|
|
|
|
geo: {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
roam: true,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resetData();
|
|
|
|
|
});
|
2023-04-24 11:55:46 +08:00
|
|
|
|
}).fail(function () {
|
|
|
|
|
toast_warning("查無該樓層地圖");
|
|
|
|
|
floChart.clear();
|
|
|
|
|
});
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
2023-04-24 11:55:46 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//baja 訂閱設備
|
|
|
|
|
function subDevice() {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
console.log("subDevice 開始");
|
2023-03-13 12:00:31 +08:00
|
|
|
|
let floMyBaja = new subscriptionDevices();
|
|
|
|
|
var ordPath = {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
area_tag: pageAct.AreaTag,
|
|
|
|
|
building_tag: pageAct.buiTag,
|
|
|
|
|
system_tag: pageAct.sysMainTag,
|
|
|
|
|
name_tag: pageAct.sysSubTag,
|
|
|
|
|
flo_tag: pageAct.floTag,
|
|
|
|
|
};
|
2023-03-13 12:00:31 +08:00
|
|
|
|
floMyBaja.setSubscribeDevicesByBql(ordPath);
|
2023-04-24 11:55:46 +08:00
|
|
|
|
|
|
|
|
|
// 燈熱點用
|
|
|
|
|
let lightOnHotColorArr = [];
|
|
|
|
|
let lightOffHotColorArr = [];
|
|
|
|
|
// 燈光圈用
|
|
|
|
|
let lightOnGuidArr = [];
|
|
|
|
|
let lightOffGuidArr = [];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
floMyBaja.setSubscribeDevicesCallBack(function (data) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let matchDevice = currentData.filter(
|
|
|
|
|
(x) => x.device_number == data.device_number_full
|
|
|
|
|
)[0];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (!matchDevice) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//將訂閱值塞入 subDeviceData
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
subDeviceData.findIndex(
|
|
|
|
|
(x) => x.device_number == matchDevice.device_number
|
|
|
|
|
) == -1
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
let obj = {};
|
|
|
|
|
obj.device_number = matchDevice.device_number;
|
|
|
|
|
obj.dbid = matchDevice.forge_dbid;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
subDeviceData.push(obj);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
|
|
|
|
let norDevPoiName = matchDevice.device_normal_point_name;
|
|
|
|
|
let cloDevPoiName = matchDevice.device_close_point_name;
|
|
|
|
|
let errDevPoiName = matchDevice.device_error_point_name;
|
|
|
|
|
|
|
|
|
|
if (data.point_name == "Temp" || data.point_name == "TEMP") {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
heatMap?.changeTemp(
|
|
|
|
|
data.device_number_full,
|
|
|
|
|
!isNaN(parseInt(data.value)) ? parseInt(data.value) : 0
|
|
|
|
|
);
|
|
|
|
|
let devIdx = currentData.findIndex(
|
|
|
|
|
(x) => x.device_number == data.device_number_full
|
|
|
|
|
);
|
|
|
|
|
currentData[devIdx]._temp = !isNaN(parseInt(data.value))
|
|
|
|
|
? parseInt(data.value)
|
|
|
|
|
: 0;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
2023-02-18 21:00:48 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (data.point_name == "ONOFF" && pageAct.sysSubTag === "L1") {
|
|
|
|
|
const lightOn = data.value.includes("true");
|
2023-03-13 12:00:31 +08:00
|
|
|
|
setLightOpenOrClose(lightOn, matchDevice.device_guid);
|
2023-04-24 11:55:46 +08:00
|
|
|
|
// console.log("Forge 渲染",data.point_name,lightOn)
|
|
|
|
|
if (lightOn && matchDevice.spriteDbid) {
|
|
|
|
|
console.log(lightOn, matchDevice, matchDevice.spriteDbid);
|
|
|
|
|
// setLightValues(matchDevice.device_guid, 200, 0xe1cf18);
|
|
|
|
|
// changeColorForHotspot(matchDevice.spriteDbid, null, lightOn);
|
|
|
|
|
lightOnHotColorArr.push(matchDevice.spriteDbid);
|
|
|
|
|
lightOffHotColorArr = lightOffHotColorArr.filter(
|
|
|
|
|
(light) => light !== matchDevice.spriteDbid
|
|
|
|
|
);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
heatMap?.changeTemp(matchDevice.device_number, 40);
|
2023-04-24 11:55:46 +08:00
|
|
|
|
} else if (matchDevice.spriteDbid) {
|
|
|
|
|
// console.log(lightOn, matchDevice);
|
|
|
|
|
// setLightValues(matchDevice.device_guid, 0, 0xffffff);
|
|
|
|
|
// changeColorForHotspot(matchDevice.spriteDbid, null, lightOn);
|
|
|
|
|
lightOnHotColorArr = lightOnHotColorArr.filter(
|
|
|
|
|
(light) => light !== matchDevice.spriteDbid
|
|
|
|
|
);
|
|
|
|
|
lightOffHotColorArr.push(matchDevice.spriteDbid);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
heatMap?.changeTemp(matchDevice.device_number, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-02-17 11:01:29 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
data.point_name == norDevPoiName &&
|
|
|
|
|
data.value == matchDevice.device_normal_point_value
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//顯示正常燈號
|
2023-04-24 11:55:46 +08:00
|
|
|
|
$(`#${matchDevice.device_number}_status`)
|
|
|
|
|
.attr("data-light-type", "normal")
|
|
|
|
|
.data("light-type", "normal");
|
|
|
|
|
} else if (
|
|
|
|
|
data.point_name == cloDevPoiName &&
|
|
|
|
|
data.value == matchDevice.device_close_point_value
|
|
|
|
|
) {
|
|
|
|
|
$(`#${matchDevice.device_number}_status`)
|
|
|
|
|
.attr("data-light-type", "close")
|
|
|
|
|
.data("light-type", "close");
|
|
|
|
|
} else if (
|
|
|
|
|
data.point_name == errDevPoiName &&
|
|
|
|
|
data.value == matchDevice.device_error_point_value
|
|
|
|
|
) {
|
|
|
|
|
$(`#${matchDevice.device_number}_status`)
|
|
|
|
|
.attr("data-light-type", "error")
|
|
|
|
|
.data("light-type", "error");
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
|
|
|
|
setForgeHotSpotColor(matchDevice);
|
2023-02-17 11:01:29 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
console.log(lightOnHotColorArr, lightOffHotColorArr);
|
|
|
|
|
changeColorForHotspot(lightOnHotColorArr, null, true);
|
|
|
|
|
changeColorForHotspot(lightOffHotColorArr, null, false);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
});
|
2022-11-17 18:26:30 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
floMyBaja.setSubscribeDeviceEndCallBack(function (data) {
|
|
|
|
|
endPageLoading();
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
pageAct.sysSubTag !== "M12" &&
|
|
|
|
|
data.findIndex(
|
|
|
|
|
(x) => x.point_name == "Temp" || x.point_name == "TEMP"
|
|
|
|
|
) != -1
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// 顯示溫度條
|
|
|
|
|
showHeat("[name=forgeHeatBar]");
|
|
|
|
|
}
|
|
|
|
|
});
|
2023-01-11 18:37:58 +08:00
|
|
|
|
}
|
2023-02-17 11:01:29 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
function drawHeatBar() {
|
|
|
|
|
$("#forgeHeatBarDiv").html(setTopHeatBar());
|
|
|
|
|
}
|
2023-01-03 16:47:23 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// 電梯 3D 位置呈現
|
|
|
|
|
function set3DElevPos(viewer) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let nodeIds = allElevDevList
|
|
|
|
|
.filter((x) => !isNaN(parseInt(x.forge_dbid)))
|
|
|
|
|
.map((x) => {
|
|
|
|
|
return { devNum: x.device_number, nodeId: parseInt(x.forge_dbid) };
|
|
|
|
|
});
|
2023-01-03 16:47:23 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
$.each(nodeIds, (idx, item) => {
|
|
|
|
|
elev3DBind[item.devNum] = item.nodeId;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
|
|
|
|
nodeIds = nodeIds.map((x) => x.nodeId);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
$.each(nodeIds, function (idx, node) {
|
|
|
|
|
let options = {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
element: $("#forgeViewer"),
|
2023-03-13 12:00:31 +08:00
|
|
|
|
viewer: viewer,
|
|
|
|
|
nodeId: node,
|
|
|
|
|
floorHeight: elev3DOption.floorHeight ?? [],
|
2023-04-24 11:55:46 +08:00
|
|
|
|
inited: function () { },
|
|
|
|
|
};
|
2023-03-13 12:00:31 +08:00
|
|
|
|
let elevator3DObj = new elevator3D(options);
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let devNum = Object.keys(elev3DBind).filter(
|
|
|
|
|
(x) => elev3DBind[x] == node
|
|
|
|
|
)[0];
|
|
|
|
|
let subData = subSeviceData.filter((x) => x.device_number == devNum)[0];
|
2023-01-03 16:47:23 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (elev3DObj.filter((x) => x.nodeId == node).length == 0) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
elev3DObj.push({ id: devNum, nodeId: node, obj: elevator3DObj });
|
|
|
|
|
}
|
2023-01-03 16:47:23 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (subData) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let elevObj = elev3DObj.filter((x) => x.nodeId == node)[0];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (!elevObj.id) {
|
|
|
|
|
elevObj.id = devNum;
|
|
|
|
|
}
|
2023-04-24 11:55:46 +08:00
|
|
|
|
elevObj.obj = Object.assign(elevObj, elevator3DObj ?? {});
|
2023-03-13 12:00:31 +08:00
|
|
|
|
elevObj.obj.init(function () {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let frags = elevObj.obj.fragProxys.filter((x) => x.nodeId == node);
|
2023-01-03 16:47:23 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
frags.forEach((fragProxy) => {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
fragProxy.frag.position.z =
|
|
|
|
|
elev3DOption.floorHeight.filter(
|
|
|
|
|
(x) => x.floor == subData["CP"]
|
|
|
|
|
)[0]?.height ?? 0;
|
|
|
|
|
fragProxy.frag.updateAnimTransform();
|
|
|
|
|
});
|
2023-03-13 12:00:31 +08:00
|
|
|
|
elevObj.obj.viewer.impl.sceneUpdated(true);
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
2023-01-03 16:47:23 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// 電梯 3D Option 設置
|
|
|
|
|
function set3DElevOpt(data) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let devNumArr = data
|
|
|
|
|
.map((x) => {
|
|
|
|
|
return {
|
|
|
|
|
devNum: x.device_number_full,
|
|
|
|
|
priority: allElevDevList.filter(
|
|
|
|
|
(y) => y.device_number == x.device_number_full
|
|
|
|
|
)[0]?.priority,
|
|
|
|
|
};
|
|
|
|
|
})
|
|
|
|
|
.DistinctBy("devNum");
|
2023-03-13 12:00:31 +08:00
|
|
|
|
devNumArr = devNumArr.oSort("priority");
|
|
|
|
|
$.each(devNumArr, (idx, devObj) => {
|
|
|
|
|
devNum = devObj.devNum;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let subData = subSeviceData.filter((x) => x.device_number == devNum)[0];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
if (subData) {
|
|
|
|
|
//// 左側 3D 電梯 nodeID 與 device_number match
|
|
|
|
|
//if (Object.keys(elev3DBind).indexOf(devNum) == -1 && viewer3DNodeIds.length != 0) {
|
|
|
|
|
// elev3DBind[devNum] = viewer3DNodeIds[Object.keys(elev3DBind).length];
|
|
|
|
|
//}
|
|
|
|
|
// 左側 3D 電梯 Viewer Option 設置
|
|
|
|
|
/*elev3DOption.nodes = Object.keys(elev3DBind).map(x => elev3DBind[x]);*/
|
|
|
|
|
elev3DOption.nodeId = elev3DBind[devNum];
|
2023-04-24 11:55:46 +08:00
|
|
|
|
elev3DOption.floorHeight = floList.map((x) => {
|
|
|
|
|
return { floor: x };
|
|
|
|
|
});
|
2023-03-13 12:00:31 +08:00
|
|
|
|
elev3DOption.floorHeight.forEach((floObj, idx) => {
|
|
|
|
|
if (floObj.floor.startsWith("B")) {
|
|
|
|
|
let floor = parseInt(floObj.floor.split("B")[1].split("F")[0]);
|
|
|
|
|
floObj.height = floor * -13;
|
|
|
|
|
} else {
|
|
|
|
|
let floor = parseInt(floObj.floor.split("F")[0]);
|
|
|
|
|
if (floor == 1) {
|
|
|
|
|
floObj.height = 0;
|
|
|
|
|
} else if (floor == 2) {
|
|
|
|
|
floObj.height = 14.75;
|
|
|
|
|
} else {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
floObj.height = 14.75 + (floor - 2) * 9.75;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
2023-01-03 16:47:23 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (elev3DObj.length != 0) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let elevObj = elev3DObj.filter(
|
|
|
|
|
(x) => x.nodeId == elev3DBind[devNum]
|
|
|
|
|
)[0];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (!elevObj.id) {
|
|
|
|
|
elevObj.id = devNum;
|
|
|
|
|
}
|
|
|
|
|
elevObj.obj = Object.assign(elevObj.obj, elev3DOption);
|
|
|
|
|
elevObj.obj.init(function () {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let frags = elevObj.obj.fragProxys.filter(
|
|
|
|
|
(x) => x.nodeId == elev3DBind[devNum]
|
|
|
|
|
);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
frags.forEach((fragProxy) => {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
fragProxy.frag.position.z =
|
|
|
|
|
elev3DOption.floorHeight.filter(
|
|
|
|
|
(x) => x.floor == subData["CP"]
|
|
|
|
|
)[0]?.height ?? 0;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
fragProxy.frag.updateAnimTransform();
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
2023-03-13 12:00:31 +08:00
|
|
|
|
elevObj.obj.viewer.impl.sceneUpdated(true);
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-01-03 16:47:23 +08:00
|
|
|
|
}
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// //訂閱設備的回傳值,並塞到全域變數
|
|
|
|
|
// function subscribeCallBack(change_device, is_need_reset = false) {
|
|
|
|
|
// if (change_device != undefined && change_device != null) {
|
|
|
|
|
// var target_device = allDeviceRowData.filter(x => x.device_number == change_device.device_number)[0];
|
|
|
|
|
|
|
|
|
|
// if (target_device == undefined || target_device == null) {
|
|
|
|
|
// //新增
|
|
|
|
|
// obj = {
|
|
|
|
|
// device_number: change_device.device_number,
|
|
|
|
|
// points: [{
|
|
|
|
|
// name: change_device.point_name,
|
|
|
|
|
// value: change_device.value
|
|
|
|
|
// }]
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// allDeviceRowData.push(obj);
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// selected_device_point = target_device.points.find(x => x.name == change_device.point_name);
|
|
|
|
|
// if (selected_device_point != null) {
|
|
|
|
|
// selected_device_point.value = change_device.value;
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// obj = {
|
|
|
|
|
// name: change_device.point_name,
|
|
|
|
|
// value: change_device.value
|
|
|
|
|
// }
|
|
|
|
|
// target_device.points.push(obj);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if (is_need_reset) {
|
|
|
|
|
// resetData();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 重設平面圖設備資料
|
|
|
|
|
function resetData() {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
const scatter_symbol_convertData = function (data, zoom) {
|
|
|
|
|
//正常、關閉排除CCVT(圓點)
|
|
|
|
|
let res = [],
|
|
|
|
|
temp = [];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
data.forEach(function (item, index) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
global_emergency_alarm_device_number != undefined &&
|
|
|
|
|
global_emergency_alarm_device_number != null
|
|
|
|
|
) {
|
|
|
|
|
if (
|
|
|
|
|
global_emergency_alarm_device_number.findIndex(
|
|
|
|
|
(x) => x.device_number == item.device_number
|
|
|
|
|
) < 0 &&
|
|
|
|
|
item.device_system_category_layer3 != "C"
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//如果有子節點,則只針對子節點操作
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
lightControl === "node" &&
|
|
|
|
|
item.device_nodes != undefined &&
|
|
|
|
|
item.device_nodes != null &&
|
|
|
|
|
item.device_nodes.length > 0
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item.device_nodes.forEach(function (item_node, item_node_index) {
|
|
|
|
|
//添加父節點相關資訊
|
2023-04-24 11:55:46 +08:00
|
|
|
|
item_node.device_system_category_layer3 =
|
|
|
|
|
item.device_system_category_layer3;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item_node.device_normal_color = item.device_normal_color;
|
|
|
|
|
item_node.device_close_color = item.device_close_color;
|
|
|
|
|
|
|
|
|
|
//判斷父節點狀態
|
2023-04-24 11:55:46 +08:00
|
|
|
|
var device_index = allDeviceRowData.findIndex(
|
|
|
|
|
(x) => x.device_number == item.device_number
|
|
|
|
|
);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
var temp_point_value;
|
|
|
|
|
if (device_index > -1) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
item.device_normal_point_name != null ||
|
|
|
|
|
item.device_close_point_name != null
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//當其中point name 不為null的情況
|
|
|
|
|
if (item.device_normal_point_name != null) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value = allDeviceRowData[
|
|
|
|
|
device_index
|
|
|
|
|
].points.find(
|
|
|
|
|
(x) => x.name == item.device_normal_point_name
|
|
|
|
|
);
|
|
|
|
|
temp_point_value =
|
|
|
|
|
allDeviceRowData[device_index].points[
|
|
|
|
|
item.device_normal_point_name
|
|
|
|
|
];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (temp_point_value == item.device_normal_point_value) {
|
|
|
|
|
item_node.device_color = item.device_normal_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (item.device_close_point_name != null) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value =
|
|
|
|
|
allDeviceRowData[device_index].points[
|
|
|
|
|
item.device_close_point_name
|
|
|
|
|
];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (temp_point_value == item.device_close_point_value) {
|
|
|
|
|
item_node.device_color = item.device_close_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (item.device_normal_point_name == "ER") {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value =
|
|
|
|
|
allDeviceRowData[device_index].points[
|
|
|
|
|
item.device_normal_point_name
|
|
|
|
|
];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (temp_point_value == "true") {
|
|
|
|
|
item_node.device_color = item.device_normal_color;
|
|
|
|
|
} else {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value =
|
|
|
|
|
allDeviceRowData[device_index].points[
|
|
|
|
|
item.device_close_point_name
|
|
|
|
|
];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (temp_point_value == item.device_close_point_value) {
|
|
|
|
|
item_node.device_color = item.device_close_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (item.device_close_point_name == "ER") {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value =
|
|
|
|
|
allDeviceRowData[device_index].points[
|
|
|
|
|
item.device_close_point_name
|
|
|
|
|
];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (temp_point_value == "true") {
|
|
|
|
|
item_node.device_color = item.device_close_color;
|
|
|
|
|
} else {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value =
|
|
|
|
|
allDeviceRowData[device_index].points[
|
|
|
|
|
item.device_normal_point_name
|
|
|
|
|
];
|
|
|
|
|
if (
|
|
|
|
|
temp_point_value == item.device_normal_point_value
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item_node.device_color = item.device_normal_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value =
|
|
|
|
|
allDeviceRowData[device_index].points[
|
|
|
|
|
item.device_normal_point_name
|
|
|
|
|
];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (temp_point_value == item.device_normal_point_value) {
|
|
|
|
|
item_node.device_color = item.device_normal_color;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
} else if (
|
|
|
|
|
temp_point_value == item.device_close_point_value
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item_node.device_color = item.device_close_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
temp.push(item_node);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
var device_index = allDeviceRowData.findIndex(
|
|
|
|
|
(x) => x.device_number == item.device_number
|
|
|
|
|
);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (device_index > -1) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
item.device_normal_point_name != null ||
|
|
|
|
|
item.device_close_point_name != null
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//當其中point name 有為null的情況
|
|
|
|
|
if (item.device_normal_point_name != null) {
|
|
|
|
|
// temp_point_value = allDeviceRowData[device_index].points[item.device_normal_point_name];
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value = allDeviceRowData[
|
|
|
|
|
device_index
|
|
|
|
|
].points.find(
|
|
|
|
|
(x) => x.name == item.device_normal_point_name
|
|
|
|
|
).value;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (temp_point_value == item.device_normal_point_value) {
|
|
|
|
|
item.device_color = item.device_normal_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (item.device_close_point_name != null) {
|
|
|
|
|
// temp_point_value = allDeviceRowData[device_index].points[item.device_close_point_name];
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value = allDeviceRowData[
|
|
|
|
|
device_index
|
|
|
|
|
].points.find(
|
|
|
|
|
(x) => x.name == item.device_close_point_name
|
|
|
|
|
).value;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (temp_point_value == item.device_close_point_value) {
|
|
|
|
|
item.device_color = item.device_close_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (item.device_normal_point_name == "ER") {
|
|
|
|
|
// temp_point_value = allDeviceRowData[device_index].points[item.device_normal_point_name];
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value = allDeviceRowData[
|
|
|
|
|
device_index
|
|
|
|
|
].points.find(
|
|
|
|
|
(x) => x.name == item.device_normal_point_name
|
|
|
|
|
).value;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (temp_point_value == "true") {
|
|
|
|
|
item.device_color = item.device_normal_color;
|
|
|
|
|
} else {
|
|
|
|
|
// temp_point_value = allDeviceRowData[device_index].points[item.device_close_point_name];
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value = allDeviceRowData[
|
|
|
|
|
device_index
|
|
|
|
|
].points.find(
|
|
|
|
|
(x) => x.name == item.device_close_point_name
|
|
|
|
|
).value;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (temp_point_value == item.device_close_point_value) {
|
|
|
|
|
item.device_color = item.device_close_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (item.device_close_point_name == "ER") {
|
|
|
|
|
// temp_point_value = allDeviceRowData[device_index].points[item.device_close_point_name];
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value = allDeviceRowData[
|
|
|
|
|
device_index
|
|
|
|
|
].points.find(
|
|
|
|
|
(x) => x.name == item.device_close_point_name
|
|
|
|
|
).value;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (temp_point_value == "true") {
|
|
|
|
|
item.device_color = item.device_close_color;
|
|
|
|
|
} else {
|
|
|
|
|
// temp_point_value = allDeviceRowData[device_index].points[item.device_normal_point_name];
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value = allDeviceRowData[
|
|
|
|
|
device_index
|
|
|
|
|
].points.find(
|
|
|
|
|
(x) => x.name == item.device_normal_point_name
|
|
|
|
|
).value;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (temp_point_value == item.device_normal_point_value) {
|
|
|
|
|
item.device_color = item.device_normal_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// temp_point_value = allDeviceRowData[device_index].points[item.device_normal_point_name];
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp_point_value = allDeviceRowData[
|
|
|
|
|
device_index
|
|
|
|
|
].points.find(
|
|
|
|
|
(x) => x.name == item.device_normal_point_name
|
|
|
|
|
).value;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (temp_point_value == item.device_normal_point_value) {
|
|
|
|
|
item.device_color = item.device_normal_color;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
} else if (
|
|
|
|
|
temp_point_value == item.device_close_point_value
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item.device_color = item.device_close_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
item.zoom = zoom;
|
|
|
|
|
temp.push(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// let temp = data.filter(function (item, index) {
|
|
|
|
|
// if (global_emergency_alarm_device_number != undefined && global_emergency_alarm_device_number != null) {
|
|
|
|
|
// return global_emergency_alarm_device_number.findIndex(x => x.device_number == item.device_number) < 0 && item.device_system_category_layer3 != "C";
|
|
|
|
|
// } else {
|
|
|
|
|
// return [];
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
let option = floChart.getOption();
|
|
|
|
|
temp.forEach(function (tempData) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let oldTarObj = option.series[0]?.data?.filter(
|
|
|
|
|
(x) => x.device_number == tempData.device_number
|
|
|
|
|
)[0];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (oldTarObj) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
tempData = Object.assign(tempData, oldTarObj);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
2023-03-13 12:00:31 +08:00
|
|
|
|
temp.map(function (item) {
|
|
|
|
|
var obj = {
|
|
|
|
|
device_guid: item.device_guid,
|
|
|
|
|
device_number: item.device_number,
|
|
|
|
|
full_name: item.full_name ? item.full_name : null,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
device_node_guid: item.device_node_guid
|
|
|
|
|
? item.device_node_guid
|
|
|
|
|
: null,
|
|
|
|
|
device_node_full_name: item.device_node_full_name
|
|
|
|
|
? item.device_node_full_name
|
|
|
|
|
: null,
|
|
|
|
|
device_system_category_layer3: item.device_system_category_layer3
|
|
|
|
|
? item.device_system_category_layer3
|
|
|
|
|
: null,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
status: item.status,
|
|
|
|
|
value: item.value,
|
|
|
|
|
deviceItems: item.deviceItems,
|
|
|
|
|
deviceURL: item.deviceURL,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
_dbId: item._dbId ?? null,
|
|
|
|
|
};
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
obj.itemStyle = { color: item.device_color };
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
res.push(obj);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return res;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
};
|
2022-11-17 15:22:45 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
const scatter_icon_convertData = function (data) {
|
|
|
|
|
//正常、關閉(icon)
|
|
|
|
|
let res = [],
|
|
|
|
|
temp = [];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
data.forEach(function (item, index) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
global_emergency_alarm_device_number != undefined &&
|
|
|
|
|
global_emergency_alarm_device_number != null
|
|
|
|
|
) {
|
|
|
|
|
if (
|
|
|
|
|
global_emergency_alarm_device_number.findIndex(
|
|
|
|
|
(x) => x.device_number == item.device_number
|
|
|
|
|
) < 0 &&
|
|
|
|
|
item.device_system_category_layer3 != "C"
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//如果有子節點,則只針對子節點操作
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
lightControl === "node" &&
|
|
|
|
|
item.device_nodes != undefined &&
|
|
|
|
|
item.device_nodes != null &&
|
|
|
|
|
item.device_nodes.length > 0
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item.device_nodes.forEach(function (item_node, item_node_index) {
|
|
|
|
|
//添加父節點相關資訊
|
2023-04-24 11:55:46 +08:00
|
|
|
|
item_node.device_system_category_layer3 =
|
|
|
|
|
item.device_system_category_layer3;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item_node.device_normal_color = item.device_normal_color;
|
|
|
|
|
item_node.device_image = item.device_image;
|
|
|
|
|
temp.push(item_node);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp.push(item);
|
2023-03-06 11:37:01 +08:00
|
|
|
|
}
|
2022-11-17 15:22:45 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-13 12:00:31 +08:00
|
|
|
|
});
|
2022-11-17 15:22:45 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
temp = data.filter(function (item, index) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
global_emergency_alarm_device_number != undefined &&
|
|
|
|
|
global_emergency_alarm_device_number != null
|
|
|
|
|
) {
|
|
|
|
|
return (
|
|
|
|
|
global_emergency_alarm_device_number.findIndex(
|
|
|
|
|
(x) => x.device_number == item.device_number
|
|
|
|
|
) < 0 && item.device_system_category_layer3 != "C"
|
|
|
|
|
);
|
2022-11-17 22:14:46 +08:00
|
|
|
|
} else {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
return [];
|
2022-11-17 15:22:45 +08:00
|
|
|
|
}
|
2023-03-13 12:00:31 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
temp.map(function (item) {
|
|
|
|
|
var obj = {
|
|
|
|
|
device_guid: item.device_guid,
|
|
|
|
|
device_number: item.device_number,
|
|
|
|
|
full_name: item.full_name ? item.full_name : null,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
device_node_guid: item.device_node_guid
|
|
|
|
|
? item.device_node_guid
|
|
|
|
|
: null,
|
|
|
|
|
device_node_full_name: item.device_node_full_name
|
|
|
|
|
? item.device_node_full_name
|
|
|
|
|
: null,
|
|
|
|
|
device_system_category_layer3: item.device_system_category_layer3
|
|
|
|
|
? item.device_system_category_layer3
|
|
|
|
|
: null,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
status: item.status,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
symbol:
|
|
|
|
|
"image://" +
|
|
|
|
|
baseImgUrl +
|
|
|
|
|
"/upload/device_icon/" +
|
|
|
|
|
item.device_image,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
value: item.value,
|
|
|
|
|
deviceItems: item.deviceItems,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
deviceURL: item.deviceURL,
|
|
|
|
|
};
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
if (item.selected) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
obj.symbolSize = 50;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
res.push(obj);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return res;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
};
|
2022-11-17 15:22:45 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
const scatter_error_convertData = function (data) {
|
|
|
|
|
//異常(圓點)
|
|
|
|
|
let res = [],
|
|
|
|
|
temp = [];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
data.forEach(function (item, index) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
global_emergency_alarm_device_number != undefined &&
|
|
|
|
|
global_emergency_alarm_device_number != null
|
|
|
|
|
) {
|
|
|
|
|
if (
|
|
|
|
|
global_emergency_alarm_device_number.findIndex(
|
|
|
|
|
(x) => x.device_number == item.device_number
|
|
|
|
|
) > -1 &&
|
|
|
|
|
item.device_system_category_layer3 != "C"
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//如果有子節點,則只針對子節點操作
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
lightControl === "node" &&
|
|
|
|
|
item.device_nodes != undefined &&
|
|
|
|
|
item.device_nodes != null &&
|
|
|
|
|
item.device_nodes.length > 0
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item.device_nodes.forEach(function (item_node, item_node_index) {
|
|
|
|
|
//添加父節點相關資訊
|
2023-04-24 11:55:46 +08:00
|
|
|
|
item_node.device_system_category_layer3 =
|
|
|
|
|
item.device_system_category_layer3;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item_node.device_error_color = item.device_error_color;
|
|
|
|
|
temp.push(item_node);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp.push(item);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// if (global_emergency_alarm_device_number != undefined && global_emergency_alarm_device_number != null) {
|
|
|
|
|
// temp = data.filter(function (item, index) {
|
|
|
|
|
// return global_emergency_alarm_device_number.findIndex(x => x.device_number == item.device_number) > -1 && item.device_system_category_layer3 != "C";
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
temp.map(function (item) {
|
|
|
|
|
var obj = {
|
|
|
|
|
device_guid: item.device_guid,
|
|
|
|
|
device_number: item.device_number,
|
|
|
|
|
full_name: item.full_name ? item.full_name : null,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
device_node_guid: item.device_node_guid
|
|
|
|
|
? item.device_node_guid
|
|
|
|
|
: null,
|
|
|
|
|
device_node_full_name: item.device_node_full_name
|
|
|
|
|
? item.device_node_full_name
|
|
|
|
|
: null,
|
|
|
|
|
device_system_category_layer3: item.device_system_category_layer3
|
|
|
|
|
? item.device_system_category_layer3
|
|
|
|
|
: null,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
status: item.status,
|
|
|
|
|
value: item.value,
|
|
|
|
|
deviceItems: item.deviceItems,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
deviceURL: item.deviceURL,
|
|
|
|
|
};
|
2022-11-17 15:22:45 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
obj.itemStyle = { color: item.device_error_color };
|
2022-11-17 15:22:45 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
res.push(obj);
|
|
|
|
|
});
|
2022-11-17 15:22:45 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
return res;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
};
|
2022-11-17 15:22:45 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
const scatter_error_icon_convertData = function (data) {
|
|
|
|
|
//異常(icon)
|
|
|
|
|
let res = [],
|
|
|
|
|
temp = [];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
data.forEach(function (item, index) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
global_emergency_alarm_device_number != undefined &&
|
|
|
|
|
global_emergency_alarm_device_number != null
|
|
|
|
|
) {
|
|
|
|
|
if (
|
|
|
|
|
global_emergency_alarm_device_number.findIndex(
|
|
|
|
|
(x) => x.device_number == item.device_number
|
|
|
|
|
) > -1 &&
|
|
|
|
|
item.device_system_category_layer3 != "C"
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
//如果有子節點,則只針對子節點操作
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
lightControl === "node" &&
|
|
|
|
|
item.device_nodes != undefined &&
|
|
|
|
|
item.device_nodes != null &&
|
|
|
|
|
item.device_nodes.length > 0
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item.device_nodes.forEach(function (item_node, item_node_index) {
|
|
|
|
|
//添加父節點相關資訊
|
2023-04-24 11:55:46 +08:00
|
|
|
|
item_node.device_system_category_layer3 =
|
|
|
|
|
item.device_system_category_layer3;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
item_node.device_error_color = item.device_error_color;
|
|
|
|
|
item_node.device_image = item.device_image;
|
|
|
|
|
temp.push(item_node);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
temp.push(item);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
global_emergency_alarm_device_number != undefined &&
|
|
|
|
|
global_emergency_alarm_device_number != null
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
temp = data.filter(function (item, index) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
return (
|
|
|
|
|
global_emergency_alarm_device_number.findIndex(
|
|
|
|
|
(x) => x.device_number == item.device_number
|
|
|
|
|
) > -1 && item.device_system_category_layer3 != "C"
|
|
|
|
|
);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
});
|
2023-03-06 11:37:01 +08:00
|
|
|
|
}
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
temp.map(function (item) {
|
|
|
|
|
var obj = {
|
|
|
|
|
device_guid: item.device_guid,
|
|
|
|
|
device_number: item.device_number,
|
|
|
|
|
full_name: item.full_name ? item.full_name : null,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
device_node_guid: item.device_node_guid
|
|
|
|
|
? item.device_node_guid
|
|
|
|
|
: null,
|
|
|
|
|
device_node_full_name: item.device_node_full_name
|
|
|
|
|
? item.device_node_full_name
|
|
|
|
|
: null,
|
|
|
|
|
device_system_category_layer3: item.device_system_category_layer3
|
|
|
|
|
? item.device_system_category_layer3
|
|
|
|
|
: null,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
status: item.status,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
symbol:
|
|
|
|
|
"image://" +
|
|
|
|
|
baseImgUrl +
|
|
|
|
|
"/upload/device_icon/" +
|
|
|
|
|
item.device_image,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
value: item.value,
|
|
|
|
|
deviceItems: item.deviceItems,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
deviceURL: item.deviceURL,
|
|
|
|
|
};
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
res.push(obj);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return res;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
};
|
2022-11-17 15:22:45 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
const scatter_cctv_convertData = function (data) {
|
|
|
|
|
//CCTV
|
2023-03-13 12:00:31 +08:00
|
|
|
|
let res = [];
|
|
|
|
|
let temp = data.filter(function (item, index) {
|
|
|
|
|
return item.device_system_category_layer3 == "C";
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
temp.map(function (item) {
|
|
|
|
|
var obj = {
|
|
|
|
|
device_guid: item.device_guid,
|
|
|
|
|
device_number: item.device_number,
|
|
|
|
|
full_name: item.full_name,
|
|
|
|
|
device_system_category_layer3: item.device_system_category_layer3,
|
|
|
|
|
device_ip: item.device_ip,
|
|
|
|
|
device_port: item.device_port,
|
|
|
|
|
status: item.status,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
symbol:
|
|
|
|
|
"image://" +
|
|
|
|
|
str_location_url +
|
|
|
|
|
"/upload/device_icon/" +
|
|
|
|
|
item.device_image,
|
|
|
|
|
value: item.value,
|
|
|
|
|
};
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
res.push(obj);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return res;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
};
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
if (!floChart.getOption()) {
|
|
|
|
|
return;
|
2023-03-06 11:37:01 +08:00
|
|
|
|
}
|
2023-02-17 11:01:29 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
var zoom = 0;
|
|
|
|
|
if (floChart.getOption().geo && floChart.getOption().geo.length > 0) {
|
|
|
|
|
zoom = floChart.getOption().geo[0].zoom;
|
2022-11-17 15:22:45 +08:00
|
|
|
|
}
|
2022-12-09 18:20:41 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (zoom <= zoomToggle) {
|
|
|
|
|
floChart.setOption({
|
2023-04-24 11:55:46 +08:00
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
symbolOffset: [0, 0],
|
|
|
|
|
data: scatter_symbol_convertData(currentData), //正常、關閉(圓點)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
data: [], //正常、關閉(icon)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
symbolOffset: [0, 0],
|
|
|
|
|
data: scatter_error_convertData(currentData), //異常(圓點)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
data: [], //異常(icon)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
data: scatter_cctv_convertData(currentData), //CCTV
|
|
|
|
|
},
|
|
|
|
|
],
|
2023-03-13 12:00:31 +08:00
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
floChart.setOption({
|
2023-04-24 11:55:46 +08:00
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
symbolOffset: [10, 10],
|
|
|
|
|
|
|
|
|
|
data: scatter_symbol_convertData(currentData, zoom), //正常、關閉(圓點)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
data: scatter_icon_convertData(currentData), //正常、關閉(icon)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
symbolOffset: [10, 10],
|
|
|
|
|
data: scatter_error_convertData(currentData), //異常(圓點)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
data: scatter_error_icon_convertData(currentData), //異常(icon)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
data: scatter_cctv_convertData(currentData), //CCTV
|
|
|
|
|
},
|
|
|
|
|
],
|
2023-03-13 12:00:31 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
2023-03-06 11:37:01 +08:00
|
|
|
|
}
|
2022-12-31 18:03:16 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
function getNextFloor(floGuid = null) {
|
|
|
|
|
let url = baseApiUrl + "/api/Device/GetNextFloor";
|
2023-04-24 11:55:46 +08:00
|
|
|
|
objSendData.Data = { floor_guid: floGuid, building_tag: pageAct.buiTag };
|
2023-03-13 12:00:31 +08:00
|
|
|
|
let result = "";
|
2023-04-24 11:55:46 +08:00
|
|
|
|
ytAjax = new YourTeam.Ajax(
|
|
|
|
|
url,
|
|
|
|
|
objSendData,
|
|
|
|
|
function (res) {
|
|
|
|
|
if (!res || res.code != "0000" || !res.data) {
|
|
|
|
|
} else {
|
|
|
|
|
result = res.data?.full_name;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
null,
|
|
|
|
|
"POST"
|
|
|
|
|
).send();
|
2022-12-31 18:03:16 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
return result;
|
|
|
|
|
}
|
2022-12-31 18:03:16 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// show 3D 模型
|
|
|
|
|
function show3DModel(urn) {
|
|
|
|
|
$(loadEle).Loading("start");
|
|
|
|
|
launchViewerForHotspot(urn, (viewer, nodeIds) => {
|
|
|
|
|
// 隱藏 toolbar
|
|
|
|
|
document.querySelector("#guiviewer3d-toolbar").style.display = "none";
|
|
|
|
|
let nextFloor = getNextFloor(pageAct.floGuid);
|
|
|
|
|
let curFloTag = pageAct.floTag;
|
|
|
|
|
|
|
|
|
|
if (!nextFloor) {
|
|
|
|
|
toast_warning("超出樓層範圍");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-12-31 18:03:16 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
if (curFloTag?.startsWith("U")) {
|
|
|
|
|
curFloTag = curFloTag.split("U")[1];
|
|
|
|
|
}
|
|
|
|
|
if (nextFloor?.startsWith("U")) {
|
|
|
|
|
nextFloor = nextFloor.split("U")[1];
|
|
|
|
|
}
|
2023-01-03 16:47:23 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
getLevelsData(curFloTag, nextFloor, function () {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
viewer.model.search(
|
|
|
|
|
"天花板",
|
|
|
|
|
(nodeIds) => {
|
|
|
|
|
// console.log("2",nodeIds)
|
|
|
|
|
viewer.hide(nodeIds);
|
|
|
|
|
},
|
|
|
|
|
(e) => {
|
|
|
|
|
console.log(e);
|
|
|
|
|
}
|
|
|
|
|
);
|
2023-03-13 12:00:31 +08:00
|
|
|
|
$(loadEle).Loading("close");
|
|
|
|
|
});
|
2023-04-24 11:55:46 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
setHeatMap();
|
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (
|
|
|
|
|
(pageAct.sysSubTag == "M12" || pageAct.sysSubTag == "ELEV") &&
|
|
|
|
|
elevatorShow
|
|
|
|
|
) {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
let elevOption = {
|
|
|
|
|
viewer: viewer,
|
|
|
|
|
ordPath: {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
area_tag: pageAct.AreaTag,
|
|
|
|
|
building_tag: pageAct.buiTag,
|
|
|
|
|
},
|
|
|
|
|
};
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// 電梯移動訂閱程序載入
|
|
|
|
|
let forge3DElev = new Forge3DElevFull(elevOption);
|
|
|
|
|
forge3DElev.bajaEndCallback = function () {
|
|
|
|
|
endPageLoading();
|
2023-04-24 11:55:46 +08:00
|
|
|
|
};
|
2023-03-13 12:00:31 +08:00
|
|
|
|
forge3DElev.init();
|
2023-01-03 16:47:23 +08:00
|
|
|
|
}
|
2022-12-09 18:20:41 +08:00
|
|
|
|
});
|
2023-04-24 11:55:46 +08:00
|
|
|
|
|
|
|
|
|
subDevice();
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setHeatMap() {
|
|
|
|
|
if (pageAct.sysSubTag !== "M12") {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
devices = currentData.map((x) => {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
return {
|
|
|
|
|
roomDbId: !isNaN(parseInt(x.room_dbid)) ? parseInt(x.room_dbid) : -1,
|
|
|
|
|
id: x.device_number,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
position: isJSON(x.device_coordinate_3d)
|
|
|
|
|
? JSON.parse(x.device_coordinate_3d)
|
|
|
|
|
: {}, // x: 0, y: 25, z: -2.5 (3.35, -4.81, 12.88
|
|
|
|
|
sensorTypes: ["temperature", "humidity"],
|
|
|
|
|
};
|
|
|
|
|
});
|
2022-12-31 18:03:16 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
let option = {
|
|
|
|
|
devices: devices,
|
2023-04-24 11:55:46 +08:00
|
|
|
|
};
|
2023-03-13 12:00:31 +08:00
|
|
|
|
|
|
|
|
|
heatMap = new ADHeatMaps(option);
|
|
|
|
|
heatMap.onComplete = () => {
|
|
|
|
|
$.each(currentData, (idx, dev) => {
|
|
|
|
|
heatMap.changeTemp(dev.device_number, dev._temp || 0);
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pageAct.sysSubTag === "M12" && !elevatorShow) {
|
|
|
|
|
let sensorObjs = [];
|
|
|
|
|
addHotPoint(viewer);
|
|
|
|
|
Forge3DSensor.sensorTimes = 0;
|
|
|
|
|
sensorObjs = currentData.map((device) => {
|
|
|
|
|
Forge3DSensor.sensorTimes++;
|
|
|
|
|
return new Forge3DSensor({
|
|
|
|
|
viewer: viewer,
|
|
|
|
|
ordPath: {
|
|
|
|
|
area_tag: pageAct.AreaTag,
|
|
|
|
|
building_tag: pageAct.buiTag,
|
|
|
|
|
},
|
|
|
|
|
selector: "#forgeViewer",
|
|
|
|
|
elevCb: elevatorShow
|
|
|
|
|
? () => {
|
|
|
|
|
let elevOption = {
|
|
|
|
|
selector: "#forgeViewer",
|
|
|
|
|
viewer: viewer,
|
|
|
|
|
ordPath: {
|
|
|
|
|
area_tag: pageAct.AreaTag,
|
|
|
|
|
building_tag: pageAct.buiTag,
|
|
|
|
|
},
|
|
|
|
|
sensorObjs,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 電梯移動訂閱程序載入
|
|
|
|
|
let forge3DElev = new Forge3DElevFull(elevOption);
|
|
|
|
|
forge3DElev.bajaEndCallback = function () {
|
|
|
|
|
endPageLoading();
|
|
|
|
|
};
|
|
|
|
|
forge3DElev.init();
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
curDevice: {
|
|
|
|
|
...device,
|
|
|
|
|
roomDbId: !isNaN(parseInt(device.room_dbid))
|
|
|
|
|
? parseInt(device.room_dbid)
|
|
|
|
|
: -1,
|
|
|
|
|
id: device.device_number,
|
|
|
|
|
position: isJSON(device.device_coordinate_3d)
|
|
|
|
|
? JSON.parse(device.device_coordinate_3d)
|
|
|
|
|
: {}, // x: 0, y: 25, z: -2.5 (3.35, -4.81, 12.88
|
|
|
|
|
temp: 25,
|
|
|
|
|
forge_dbid: parseInt(device.forge_dbid),
|
|
|
|
|
},
|
|
|
|
|
deviceList: currentData.map((d) => ({
|
|
|
|
|
...d,
|
|
|
|
|
roomDbId: !isNaN(parseInt(d.room_dbid))
|
|
|
|
|
? parseInt(d.room_dbid)
|
|
|
|
|
: -1,
|
|
|
|
|
id: d.device_number,
|
|
|
|
|
position: isJSON(d.device_coordinate_3d)
|
|
|
|
|
? JSON.parse(d.device_coordinate_3d)
|
|
|
|
|
: {}, // x: 0, y: 25, z: -2.5 (3.35, -4.81, 12.88
|
|
|
|
|
temp: 25,
|
|
|
|
|
forge_dbid: parseInt(d.forge_dbid),
|
|
|
|
|
})),
|
|
|
|
|
});
|
|
|
|
|
});
|
2022-12-31 18:03:16 +08:00
|
|
|
|
}
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
2022-12-31 18:03:16 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
function getHotspotPoint(callback = null) {
|
|
|
|
|
let url = baseApiUrl + "/api/GetDevForCor";
|
|
|
|
|
let sendData = {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
device_area_tag: pageAct.AreaTag,
|
|
|
|
|
device_building_tag: pageAct.buiTag,
|
|
|
|
|
device_system_tag: pageAct.sysMainTag,
|
|
|
|
|
device_name_tag: pageAct.sysSubTag,
|
|
|
|
|
device_floor_tag: pageAct.floTag,
|
2023-03-13 12:00:31 +08:00
|
|
|
|
};
|
|
|
|
|
objSendData.Data = sendData;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
ytAjax = new YourTeam.Ajax(
|
|
|
|
|
url,
|
|
|
|
|
objSendData,
|
|
|
|
|
function (res) {
|
|
|
|
|
if (!res || res.code != "0000" || !res.data) {
|
|
|
|
|
} else {
|
|
|
|
|
let myDataList = [];
|
|
|
|
|
$.each(res.data, (idx, data) => {
|
|
|
|
|
if (lightControl == "node" && data.device_nodes.length > 0) {
|
|
|
|
|
data.device_nodes.forEach((node) => {
|
|
|
|
|
if (
|
|
|
|
|
node.device_node_coordinate_3D != null &&
|
|
|
|
|
isJSON(node.device_node_coordinate_3D)
|
|
|
|
|
) {
|
|
|
|
|
myDataList.push({
|
|
|
|
|
...node,
|
|
|
|
|
position: JSON.parse(node.device_node_coordinate_3D),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else if (
|
|
|
|
|
data.device_coordinate_3d != null &&
|
|
|
|
|
isJSON(data.device_coordinate_3d)
|
|
|
|
|
) {
|
|
|
|
|
myDataList.push({
|
|
|
|
|
...data,
|
|
|
|
|
position: JSON.parse(data.device_coordinate_3d),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
2022-12-29 18:19:22 +08:00
|
|
|
|
|
2023-04-24 11:55:46 +08:00
|
|
|
|
getLightData(myDataList);
|
|
|
|
|
setHotspotPoint(myDataList);
|
|
|
|
|
callback ? callback() : "";
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
null,
|
|
|
|
|
"POST"
|
|
|
|
|
).send();
|
2022-12-29 18:19:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
function setHotspotPoint(myDataList = []) {
|
|
|
|
|
getHopspotPoint(myDataList);
|
2022-12-29 18:19:22 +08:00
|
|
|
|
}
|
2022-12-31 18:03:16 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
onEvent("autodesk:click:sprite", "#forgeViewer", function (e, obj) {
|
|
|
|
|
forgeUnFocusAll();
|
|
|
|
|
chartUnFocusAll();
|
|
|
|
|
let rect = $("#forgeViewer")[0].getBoundingClientRect();
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let position = [rect.left + rect.width / 2, rect.top + rect.height / 4];
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// console.log(position)
|
|
|
|
|
// let position = [obj.event.target.toolController.lastClickX, obj.event.target.toolController.lastClickY];
|
|
|
|
|
let devObj = obj.myData;
|
2023-04-24 11:55:46 +08:00
|
|
|
|
let name =
|
|
|
|
|
lightControl === "node" && pageAct.sysSubTag === "L1"
|
|
|
|
|
? currentData.filter(
|
|
|
|
|
(x) => x.device_node_guid == devObj.device_node_guid
|
|
|
|
|
)[0]?.device_node_full_name
|
|
|
|
|
: currentData.filter((x) => x.device_guid == devObj.device_guid)[0]
|
|
|
|
|
?.full_name;
|
2023-03-13 12:00:31 +08:00
|
|
|
|
devObj.full_name = name;
|
|
|
|
|
parentEle = crePosPopover(position, devObj);
|
|
|
|
|
$(parentEle).click();
|
2023-02-17 11:01:29 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
let option = floChart.getOption();
|
|
|
|
|
option.series.forEach(function (series) {
|
|
|
|
|
series.data.forEach(function (point) {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
if (pageAct.sysSubTag === "L1") {
|
|
|
|
|
if (point.device_node_guid == devObj.device_node_guid) {
|
|
|
|
|
point.symbolSize = 50;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (point.device_guid == devObj.device_guid) {
|
|
|
|
|
point.symbolSize = 50;
|
|
|
|
|
}
|
2023-03-13 12:00:31 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
floChart.setOption(option);
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
2022-12-31 18:03:16 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
onEvent("autodesk:clickOut:sprite", "#forgeViewer", function (e) {
|
|
|
|
|
$(parentEle).YTTooltip("hide");
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
2022-12-31 18:03:16 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
function forgeUnFocusAll() {
|
|
|
|
|
$.each(currentData, (idx, cData) => {
|
2023-04-24 11:55:46 +08:00
|
|
|
|
const eleDbId = cData._dbId;
|
|
|
|
|
if (alarmDbIdList.some((dbId) => dbId == eleDbId)) {
|
|
|
|
|
changeScaleForHotspot(eleDbId, false);
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
2023-03-13 12:00:31 +08:00
|
|
|
|
// 3D 熱點解除
|
|
|
|
|
controlFocusHotspot(eleDbId, false);
|
|
|
|
|
}
|
2023-04-24 11:55:46 +08:00
|
|
|
|
});
|
2022-12-31 18:03:16 +08:00
|
|
|
|
}
|
2023-02-17 11:01:29 +08:00
|
|
|
|
|
2023-03-13 12:00:31 +08:00
|
|
|
|
function chartUnFocusAll() {
|
|
|
|
|
let option = floChart.getOption();
|
|
|
|
|
option.series.forEach(function (series) {
|
|
|
|
|
series.data.forEach(function (point) {
|
|
|
|
|
point.symbolSize = 20;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
floChart.setOption(option);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 解除 series 聚焦
|
|
|
|
|
function chartUnFocus(ele) {
|
|
|
|
|
let devGuid = $(ele).data("id");
|
|
|
|
|
let option = floChart.getOption();
|
|
|
|
|
option.series.forEach(function (series) {
|
|
|
|
|
series.data.forEach(function (point) {
|
|
|
|
|
if (point.device_guid == devGuid) {
|
|
|
|
|
point.symbolSize = 20;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
floChart.setOption(option);
|
|
|
|
|
}
|
2023-04-24 11:55:46 +08:00
|
|
|
|
</script>
|