[Frontend] 樓層調整
This commit is contained in:
parent
168574c941
commit
4a862086bf
Binary file not shown.
After Width: | Height: | Size: 823 KiB |
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 105 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 2.0 MiB |
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 105 KiB |
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 105 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 2.0 MiB |
@ -123,19 +123,6 @@
|
|||||||
}
|
}
|
||||||
}, null, "POST").send();
|
}, null, "POST").send();
|
||||||
|
|
||||||
//let strHtml = `<table class="table table-bordered table-striped text-center m-0">
|
|
||||||
// <tbody>
|
|
||||||
// <tr>
|
|
||||||
// <td>設備編號</td>
|
|
||||||
// <td>B01-B2-19F-CR-001</td>
|
|
||||||
// </tr>
|
|
||||||
// <tr>
|
|
||||||
// <td>設備名稱</td>
|
|
||||||
// <td>A區迴路001</td>
|
|
||||||
|
|
||||||
// </tr>
|
|
||||||
// </tbody>
|
|
||||||
// </table>`
|
|
||||||
return tabEle.prop("outerHTML");
|
return tabEle.prop("outerHTML");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +160,7 @@
|
|||||||
${drawStateTabBlo()}
|
${drawStateTabBlo()}
|
||||||
</div>
|
</div>
|
||||||
<div id="info" data-tabname="cardTab" data-tabrole="child">
|
<div id="info" data-tabname="cardTab" data-tabrole="child">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="errRec" data-tabname="cardTab" data-tabrole="child">
|
<div id="errRec" data-tabname="cardTab" data-tabrole="child">
|
||||||
${drawErrRecTabBlo()}
|
${drawErrRecTabBlo()}
|
||||||
@ -185,97 +172,104 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>`,
|
</div>`,
|
||||||
group:"device",
|
group: "device",
|
||||||
onShow: function (tooltipEle, oriEle) {
|
onShow: function (tooltipEle, oriEle) {
|
||||||
var tab = new YT.Tab({ tabName: "cardTab" })
|
var tab = new YT.Tab({ tabName: "cardTab" })
|
||||||
//基本資料tab block
|
//基本資料tab block
|
||||||
$("#info").append(drawInfoTabBlo(devGuid))
|
$("#info").append(drawInfoTabBlo(devGuid))
|
||||||
loadOpeRecTable();
|
loadOpeRecTable();
|
||||||
//loadErrRecTable2($(oriEle).data("number"));
|
//loadErrRecTable2($(oriEle).data("number"));
|
||||||
loadErrRecTable();
|
loadErrRecTable();
|
||||||
}
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function loadOpeRecTable() {
|
function loadOpeRecTable() {
|
||||||
let url = "https://api.npoint.io/31e717774a0f5822cc7b";
|
let url = baseApiUrl + "/api/Device/GetOpeDevice";
|
||||||
let tag = "#opeRecTable";
|
let tag = "#opeRecTable";
|
||||||
|
|
||||||
let column_defs = [
|
let column_defs = [
|
||||||
{ "targets": [0], "width": "8%", "sortable": true },
|
{ "targets": [0], "width": "8%", "sortable": true },
|
||||||
{ "targets": [1], "width": "8%", "sortable": true },
|
{ "targets": [1], "width": "8%", "sortable": true },
|
||||||
{ "targets": [2], "width": "7%", "sortable": true },
|
{ "targets": [2], "width": "7%", "sortable": true },
|
||||||
{ "targets": [3], "width": "7%", "sortable": true },
|
{ "targets": [3], "width": "7%", "sortable": true },
|
||||||
];
|
];
|
||||||
|
|
||||||
let columns = [
|
let columns = [
|
||||||
{
|
{
|
||||||
"title": "異常ID",
|
"title": "類型",
|
||||||
"data": "errId",
|
"data": "work_type",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "異常原因",
|
"title": "項目",
|
||||||
"data": "errReason",
|
"data": "fix_do",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "ACK確認",
|
"title": "處理人員",
|
||||||
"data": "ackCheck",
|
"data": "work_person_name",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "發生/賦歸時間",
|
"title": "發生/完成時間",
|
||||||
"data": "time",
|
"data": "finish_time",
|
||||||
|
"render": function (data,type,row) {
|
||||||
|
return row.created_at + "<br>" + data;
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let callback = function () {
|
//let callback = function () {
|
||||||
$('#opeRecTable').wrap("<div class='scrolledTable'></div>"); //不採用datatable內建scrollbody,會導致thead跑掉
|
// $('#opeRecTable').wrap("<div class='scrolledTable'></div>"); //不採用datatable內建scrollbody,會導致thead跑掉
|
||||||
let api = this.api();
|
// let api = this.api();
|
||||||
api.columns.adjust();
|
// api.columns.adjust();
|
||||||
}
|
//}
|
||||||
|
|
||||||
opeRecTable = new YourTeam.JqDataTables.getTableByAjax(url, tag, null, columns, column_defs, callback, null, null, null, null, null, "tpi");
|
opeRecTable = new YourTeam.JqDataTables.getTableByAjax(url, tag, null, columns, column_defs,null, null, null, null, null, null, "tpi");
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadErrRecTable() {
|
function loadErrRecTable() {
|
||||||
let tag = "#errRecTable";
|
let tag = "#errRecTable";
|
||||||
let datas;
|
let datas;
|
||||||
//getOneDeviceAlarmTop10ByBaja(_devicePath, callback);
|
//getOneDeviceAlarmTop10ByBaja(_devicePath, callback);
|
||||||
|
|
||||||
let column_defs = [
|
let column_defs = [
|
||||||
{ "targets": [0], "width": "8%", "sortable": true },
|
{ "targets": [0], "width": "8%", "sortable": true },
|
||||||
{ "targets": [1], "width": "8%", "sortable": true },
|
{ "targets": [1], "width": "8%", "sortable": true },
|
||||||
{ "targets": [2], "width": "7%", "sortable": true },
|
{ "targets": [2], "width": "7%", "sortable": true },
|
||||||
{ "targets": [3], "width": "7%", "sortable": true },
|
{ "targets": [3], "width": "7%", "sortable": true },
|
||||||
];
|
];
|
||||||
|
|
||||||
let columns = [
|
let columns = [
|
||||||
{
|
{
|
||||||
"title": "異常ID",
|
"title": "異常ID",
|
||||||
"data": "uuid",
|
"data": "uuid",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "異常原因",
|
"title": "異常原因",
|
||||||
"data": "msgText",
|
"data": "msgText",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "ACK確認",
|
"title": "ACK確認",
|
||||||
"data": "ackState",
|
"data": "ackState",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "發生/賦歸時間",
|
"title": "發生/賦歸時間",
|
||||||
"data": "timestamp",
|
"data": "timestamp",
|
||||||
},
|
},
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
//let callback = function (result) {
|
//let callback = function (result) {
|
||||||
// datas = result;
|
// datas = result;
|
||||||
//}
|
//}
|
||||||
let result = '{"count": 2,"data":[{ "uuid": "43dc7846-bd96-4be2-ab35-f11aec729c60","msgText": "","ackState": "1","timestamp": "2022-Nov-16 10:30:24.951 AM UTC+08:00"},{"uuid": "7c309846-d862-4a8b-803b-cdc8e0efa092","msgText": "","ackState": "1","timestamp": "2022-Nov-16 10:00:24.893 AM UTC+08:00"}]}';
|
let result = '{"count": 2,"data":[{ "uuid": "43dc7846-bd96-4be2-ab35-f11aec729c60","msgText": "","ackState": "1","timestamp": "2022-Nov-16 10:30:24.951 AM UTC+08:00"},{"uuid": "7c309846-d862-4a8b-803b-cdc8e0efa092","msgText": "","ackState": "1","timestamp": "2022-Nov-16 10:00:24.893 AM UTC+08:00"}]}';
|
||||||
let json_object = JSON.parse(result);
|
let json_object = JSON.parse(result);
|
||||||
datas = json_object['data'];
|
datas = json_object['data'];
|
||||||
errRecTable = new YourTeam.JqDataTables.getTableByStatic(tag, datas, columns, column_defs);
|
errRecTable = new YourTeam.JqDataTables.getTableByStatic(tag, datas, columns, column_defs);
|
||||||
}
|
}
|
||||||
|
|
||||||
//function loadErrRecTable2(allPath) {
|
//function loadErrRecTable2(allPath) {
|
||||||
// if (allPath != undefined && allPath != null) {
|
// if (allPath != undefined && allPath != null) {
|
||||||
@ -314,7 +308,7 @@
|
|||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,14 +12,15 @@
|
|||||||
<script src="lib/echarts.min.js"></script>
|
<script src="lib/echarts.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var floChart = null;
|
var floChart = null;
|
||||||
|
var currentData = [];
|
||||||
|
var allDeviceRowData = []; //所有設備原始資料
|
||||||
|
var global_emergency_alarm_device_number = [];
|
||||||
$(function () {
|
$(function () {
|
||||||
initChart();
|
initChart();
|
||||||
getFloData();
|
getFloData();
|
||||||
})
|
})
|
||||||
|
|
||||||
function getFloData() {
|
function getFloData() {
|
||||||
|
|
||||||
let url = baseApiUrl + "/api/Device/GetDeviceList";
|
let url = baseApiUrl + "/api/Device/GetDeviceList";
|
||||||
let sendData = {
|
let sendData = {
|
||||||
main_system_tag: pageAct.sysMainTag,
|
main_system_tag: pageAct.sysMainTag,
|
||||||
@ -32,9 +33,101 @@
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
chartHandler(`${baseImgUrl}/upload/floor_map/${res.data[0].floor_map_name}`);
|
chartHandler(`${baseImgUrl}/upload/floor_map/${res.data[0].floor_map_name}`);
|
||||||
|
allDeviceRowData = res.data[0].device_list;
|
||||||
|
getDevice(res.data[0].device_list);
|
||||||
}
|
}
|
||||||
}, null, "POST").send();
|
}, null, "POST").send();
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
debugger
|
||||||
|
currentData = $.map(devList, function (item) {
|
||||||
|
|
||||||
|
//資料處理
|
||||||
|
if (selected_floor.device_number != undefined
|
||||||
|
&& selected_floor.device_number != null
|
||||||
|
&& selected_floor.device_number != ""
|
||||||
|
&& selected_floor.device_number == item.device_number) {
|
||||||
|
item.selected = true;
|
||||||
|
} else {
|
||||||
|
item.selected = false;
|
||||||
|
}
|
||||||
|
if (item.device_coordinate != undefined && item.device_coordinate != null) {
|
||||||
|
var coordinate = item.device_coordinate.split(',')
|
||||||
|
item.value = [
|
||||||
|
parseFloat(coordinate[0]),
|
||||||
|
parseFloat(coordinate[1])
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.device_nodes != undefined
|
||||||
|
&& item.device_nodes != null
|
||||||
|
&& item.device_nodes.length > 0) {
|
||||||
|
|
||||||
|
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;
|
||||||
|
if (item_node.device_node_coordinate != undefined && item_node.device_node_coordinate != null) {
|
||||||
|
var node_coordinate = item_node.device_node_coordinate.split(',')
|
||||||
|
item_node.value = [
|
||||||
|
parseFloat(node_coordinate[0]),
|
||||||
|
parseFloat(node_coordinate[1])
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//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;
|
||||||
|
if (item_node.device_node_coordinate != undefined && item_node.device_node_coordinate != null) {
|
||||||
|
var node_coordinate = item_node.device_node_coordinate.split(',')
|
||||||
|
item_node.value = [
|
||||||
|
parseFloat(node_coordinate[0]),
|
||||||
|
parseFloat(node_coordinate[1])
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
console.log(currentData)
|
||||||
|
if (currentData == null || currentData.length == 0) {
|
||||||
|
this.currentData = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// myBaja.setPrepareSubscribeDevices(currentData);
|
||||||
|
// myBaja.setCallBack(mySubscribeDevices);
|
||||||
|
|
||||||
|
//if (datatable_data_list.length > 0) {
|
||||||
|
// $("#datatablediv").show();
|
||||||
|
// dataTableDraw();
|
||||||
|
//} else {
|
||||||
|
// $("#datatablediv").hide();
|
||||||
|
//}
|
||||||
|
resetData();
|
||||||
}
|
}
|
||||||
|
|
||||||
function initChart() {
|
function initChart() {
|
||||||
@ -54,18 +147,18 @@
|
|||||||
|
|
||||||
option = {
|
option = {
|
||||||
// animationDurationUpdate: 1500,
|
// animationDurationUpdate: 1500,
|
||||||
//tooltip: {
|
tooltip: {
|
||||||
// formatter: function (params) {
|
formatter: function (params) {
|
||||||
// if (params.data.device_node_guid != undefined && params.data.device_node_guid != null && params.data.device_node_guid != "") {
|
if (params.data.device_node_guid != undefined && params.data.device_node_guid != null && params.data.device_node_guid != "") {
|
||||||
// return `名稱:${params.data.device_node_full_name}<br>
|
return `名稱:${params.data.device_node_full_name}<br>
|
||||||
// Guid:${params.data.device_node_guid}`
|
Guid:${params.data.device_node_guid}`
|
||||||
// }
|
}
|
||||||
// else {
|
else {
|
||||||
// return `名稱:${params.data.device_full_name}<br>
|
return `名稱:${params.data.device_full_name}<br>
|
||||||
// Guid:${params.data.device_guid}`
|
Guid:${params.data.device_guid}`
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//},
|
},
|
||||||
toolbox: { //工具欄
|
toolbox: { //工具欄
|
||||||
show: false
|
show: false
|
||||||
},
|
},
|
||||||
@ -181,6 +274,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
floChart.setOption(option);
|
floChart.setOption(option);
|
||||||
|
|
||||||
|
if (currentData != undefined && currentData != null && currentData.length > 0) {
|
||||||
|
resetData();
|
||||||
|
}
|
||||||
|
|
||||||
console.log(floChart)
|
console.log(floChart)
|
||||||
floChart.getZr().on('click', function (params) {
|
floChart.getZr().on('click', function (params) {
|
||||||
console.log("click", params);
|
console.log("click", params);
|
||||||
@ -188,19 +286,19 @@
|
|||||||
var dataPoint = floChart.convertFromPixel({ geoIndex: 0 }, pixelPoint);
|
var dataPoint = floChart.convertFromPixel({ geoIndex: 0 }, pixelPoint);
|
||||||
console.log(dataPoint);
|
console.log(dataPoint);
|
||||||
|
|
||||||
if (floor_map_mode == "edit") {
|
|
||||||
|
|
||||||
temp_device_on_floor_map = [{
|
temp_device_on_floor_map = [{
|
||||||
device_guid: selected_temp_device.device_guid,
|
device_guid: selected_temp_device.device_guid,
|
||||||
device_full_name: selected_temp_device.device_full_name,
|
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_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,
|
device_node_full_name: selected_temp_device.device_node_full_name ? selected_temp_device.device_node_full_name : null,
|
||||||
status: selected_temp_device.status,
|
status: selected_temp_device.status,
|
||||||
value: dataPoint
|
value: dataPoint
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// currentData.push([dataPoint[0], dataPoint[1], 1]);
|
// currentData.push([dataPoint[0], dataPoint[1], 1]);
|
||||||
@ -233,7 +331,7 @@
|
|||||||
var zoom = floChart.getOption().geo[0].zoom;
|
var zoom = floChart.getOption().geo[0].zoom;
|
||||||
|
|
||||||
if (zoom <= 2.5) {
|
if (zoom <= 2.5) {
|
||||||
ResetFloorMap();
|
/*ResetFloorMap();*/
|
||||||
floChart.setOption({
|
floChart.setOption({
|
||||||
geo: {
|
geo: {
|
||||||
roam: 'scale'
|
roam: 'scale'
|
||||||
@ -255,5 +353,408 @@
|
|||||||
toast_warning("查無該樓層地圖")
|
toast_warning("查無該樓層地圖")
|
||||||
floChart.clear();
|
floChart.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重設平面圖設備資料
|
||||||
|
function resetData() {
|
||||||
|
console.log(123)
|
||||||
|
const scatter_symbol_convertData = function (data) { //正常、關閉排除CCVT(圓點)
|
||||||
|
let res = [], temp = [];
|
||||||
|
|
||||||
|
data.forEach(function (item, index) {
|
||||||
|
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") {
|
||||||
|
//如果有子節點,則只針對子節點操作
|
||||||
|
if (item.device_nodes != undefined && item.device_nodes != null && item.device_nodes.length > 0) {
|
||||||
|
item.device_nodes.forEach(function (item_node, item_node_index) {
|
||||||
|
//添加父節點相關資訊
|
||||||
|
item_node.device_system_category_layer3 = item.device_system_category_layer3;
|
||||||
|
item_node.device_normal_color = item.device_normal_color;
|
||||||
|
item_node.device_close_color = item.device_close_color;
|
||||||
|
|
||||||
|
//判斷父節點狀態
|
||||||
|
var device_index = allDeviceRowData.findIndex(x => x.device_number == item.device_number)
|
||||||
|
var temp_point_value;
|
||||||
|
if (device_index > -1) {
|
||||||
|
if (item.device_normal_point_name != null || item.device_close_point_name != null) {
|
||||||
|
//當其中point name 不為null的情況
|
||||||
|
if (item.device_normal_point_name != null) {
|
||||||
|
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];
|
||||||
|
if (temp_point_value == item.device_normal_point_value) {
|
||||||
|
item_node.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];
|
||||||
|
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") {
|
||||||
|
temp_point_value = allDeviceRowData[device_index].points[item.device_normal_point_name];
|
||||||
|
if (temp_point_value == "true") {
|
||||||
|
item_node.device_color = item.device_normal_color;
|
||||||
|
} else {
|
||||||
|
temp_point_value = allDeviceRowData[device_index].points[item.device_close_point_name];
|
||||||
|
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") {
|
||||||
|
temp_point_value = allDeviceRowData[device_index].points[item.device_close_point_name];
|
||||||
|
if (temp_point_value == "true") {
|
||||||
|
item_node.device_color = item.device_close_color;
|
||||||
|
} else {
|
||||||
|
temp_point_value = allDeviceRowData[device_index].points[item.device_normal_point_name];
|
||||||
|
if (temp_point_value == item.device_normal_point_value) {
|
||||||
|
item_node.device_color = item.device_normal_color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
temp_point_value = allDeviceRowData[device_index].points[item.device_normal_point_name];
|
||||||
|
if (temp_point_value == item.device_normal_point_value) {
|
||||||
|
item_node.device_color = item.device_normal_color;
|
||||||
|
} else if (temp_point_value == item.device_close_point_value) {
|
||||||
|
item_node.device_color = item.device_close_color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
temp.push(item_node);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
|
||||||
|
var device_index = allDeviceRowData.findIndex(x => x.device_number == item.device_number)
|
||||||
|
if (device_index > -1) {
|
||||||
|
if (item.device_normal_point_name != null || item.device_close_point_name != null) {
|
||||||
|
//當其中point name 有為null的情況
|
||||||
|
if (item.device_normal_point_name != null) {
|
||||||
|
// temp_point_value = allDeviceRowData[device_index].points[item.device_normal_point_name];
|
||||||
|
temp_point_value = allDeviceRowData[device_index].points.find(x => x.name == item.device_normal_point_name).value;
|
||||||
|
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];
|
||||||
|
temp_point_value = allDeviceRowData[device_index].points.find(x => x.name == item.device_close_point_name).value;
|
||||||
|
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];
|
||||||
|
temp_point_value = allDeviceRowData[device_index].points.find(x => x.name == item.device_normal_point_name).value;
|
||||||
|
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];
|
||||||
|
temp_point_value = allDeviceRowData[device_index].points.find(x => x.name == item.device_close_point_name).value;
|
||||||
|
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];
|
||||||
|
temp_point_value = allDeviceRowData[device_index].points.find(x => x.name == item.device_close_point_name).value;
|
||||||
|
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];
|
||||||
|
temp_point_value = allDeviceRowData[device_index].points.find(x => x.name == item.device_normal_point_name).value;
|
||||||
|
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];
|
||||||
|
temp_point_value = allDeviceRowData[device_index].points.find(x => x.name == item.device_normal_point_name).value;
|
||||||
|
if (temp_point_value == item.device_normal_point_value) {
|
||||||
|
item.device_color = item.device_normal_color;
|
||||||
|
} else if (temp_point_value == item.device_close_point_value) {
|
||||||
|
item.device_color = item.device_close_color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 [];
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
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,
|
||||||
|
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,
|
||||||
|
status: item.status,
|
||||||
|
value: item.value,
|
||||||
|
deviceItems: item.deviceItems,
|
||||||
|
deviceURL: item.deviceURL
|
||||||
|
}
|
||||||
|
|
||||||
|
obj.itemStyle = { 'color': item.device_color };
|
||||||
|
|
||||||
|
if (item.selected) {
|
||||||
|
obj.symbolSize = 60
|
||||||
|
}
|
||||||
|
|
||||||
|
res.push(obj);
|
||||||
|
});
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
const scatter_icon_convertData = function (data) { //正常、關閉(icon)
|
||||||
|
let res = [], temp = [];
|
||||||
|
|
||||||
|
data.forEach(function (item, index) {
|
||||||
|
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") {
|
||||||
|
//如果有子節點,則只針對子節點操作
|
||||||
|
if (item.device_nodes != undefined && item.device_nodes != null && item.device_nodes.length > 0) {
|
||||||
|
item.device_nodes.forEach(function (item_node, item_node_index) {
|
||||||
|
//添加父節點相關資訊
|
||||||
|
item_node.device_system_category_layer3 = item.device_system_category_layer3;
|
||||||
|
item_node.device_normal_color = item.device_normal_color;
|
||||||
|
item_node.device_image = item.device_image;
|
||||||
|
temp.push(item_node);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
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 [];
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
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,
|
||||||
|
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,
|
||||||
|
status: item.status,
|
||||||
|
symbol: 'image://' + str_location_url + "/upload/device_icon/" + item.device_image,
|
||||||
|
value: item.value,
|
||||||
|
deviceItems: item.deviceItems,
|
||||||
|
deviceURL: item.deviceURL
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.selected) {
|
||||||
|
obj.symbolSize = 50
|
||||||
|
}
|
||||||
|
|
||||||
|
res.push(obj);
|
||||||
|
});
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
const scatter_error_convertData = function (data) { //異常(圓點)
|
||||||
|
let res = [], temp = [];
|
||||||
|
|
||||||
|
data.forEach(function (item, index) {
|
||||||
|
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") {
|
||||||
|
|
||||||
|
//如果有子節點,則只針對子節點操作
|
||||||
|
if (item.device_nodes != undefined && item.device_nodes != null && item.device_nodes.length > 0) {
|
||||||
|
item.device_nodes.forEach(function (item_node, item_node_index) {
|
||||||
|
//添加父節點相關資訊
|
||||||
|
item_node.device_system_category_layer3 = item.device_system_category_layer3;
|
||||||
|
item_node.device_error_color = item.device_error_color;
|
||||||
|
temp.push(item_node);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
temp.push(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
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,
|
||||||
|
status: item.status,
|
||||||
|
value: item.value,
|
||||||
|
deviceItems: item.deviceItems,
|
||||||
|
deviceURL: item.deviceURL
|
||||||
|
}
|
||||||
|
|
||||||
|
obj.itemStyle = { 'color': item.device_error_color };
|
||||||
|
|
||||||
|
res.push(obj);
|
||||||
|
});
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
const scatter_error_icon_convertData = function (data) { //異常(icon)
|
||||||
|
let res = [], temp = [];
|
||||||
|
|
||||||
|
data.forEach(function (item, index) {
|
||||||
|
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") {
|
||||||
|
//如果有子節點,則只針對子節點操作
|
||||||
|
if (item.device_nodes != undefined && item.device_nodes != null && item.device_nodes.length > 0) {
|
||||||
|
item.device_nodes.forEach(function (item_node, item_node_index) {
|
||||||
|
//添加父節點相關資訊
|
||||||
|
item_node.device_system_category_layer3 = item.device_system_category_layer3;
|
||||||
|
item_node.device_error_color = item.device_error_color;
|
||||||
|
item_node.device_image = item.device_image;
|
||||||
|
temp.push(item_node);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
temp.push(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
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,
|
||||||
|
status: item.status,
|
||||||
|
symbol: 'image://' + str_location_url + "/upload/device_icon/" + item.device_image,
|
||||||
|
value: item.value,
|
||||||
|
deviceItems: item.deviceItems,
|
||||||
|
deviceURL: item.deviceURL
|
||||||
|
}
|
||||||
|
|
||||||
|
res.push(obj);
|
||||||
|
});
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
const scatter_cctv_convertData = function (data) { //CCTV
|
||||||
|
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,
|
||||||
|
symbol: 'image://' + str_location_url + "/upload/device_icon/" + item.device_image,
|
||||||
|
value: item.value
|
||||||
|
}
|
||||||
|
|
||||||
|
res.push(obj);
|
||||||
|
});
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!floChart.getOption()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var zoom = 0;
|
||||||
|
if (floChart.getOption().geo && floChart.getOption().geo.length > 0) {
|
||||||
|
zoom = floChart.getOption().geo[0].zoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zoom <= 8) {
|
||||||
|
|
||||||
|
floChart.setOption({
|
||||||
|
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
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
|
||||||
|
floChart.setOption({
|
||||||
|
series: [{
|
||||||
|
symbolOffset: [10, 10],
|
||||||
|
data: scatter_symbol_convertData(currentData) //正常、關閉(圓點)
|
||||||
|
}, {
|
||||||
|
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
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue
Block a user