[Frontend] datatable ajax 讀取判斷是否為後端API Object 另存取datas | [系統監控] tooltip 跳出增加設備名稱

This commit is contained in:
dev01 2022-11-18 10:50:46 +08:00
parent eba8bba41e
commit c0e2ae2f71
6 changed files with 1410 additions and 7 deletions

1
.gitignore vendored
View File

@ -361,3 +361,4 @@ MigrationBackup/
# Fody - auto-generated XML schema # Fody - auto-generated XML schema
FodyWeavers.xsd FodyWeavers.xsd
/Backend/wwwroot/upload/floor_map.zip

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 105 KiB

View File

@ -1,6 +1,6 @@
<style> <style>
[id^=yt_tooltip] { [id^=yt_tooltip] {
width: 450px; width: 600px;
} }
</style> </style>
@ -73,7 +73,7 @@
$.each(floObj.device_list, (index2, devObj) => { $.each(floObj.device_list, (index2, devObj) => {
console.log(">>>> url: " + baseImgUrl + " , img: " + varPathImg + ", icon: " + devObj.device_master_icon); console.log(">>>> url: " + baseImgUrl + " , img: " + varPathImg + ", icon: " + devObj.device_master_icon);
strHtml += `<div name="devItem" data-id="${devObj.device_guid}" data-number="${devObj.device_number}" class="mr-5 cur-poi"> strHtml += `<div name="devItem" data-id="${devObj.device_guid}" data-number="${devObj.device_number}" data-name="${devObj.full_name}" class="mr-5 cur-poi">
<span class="status status-success d-inline-block"> <span class="status status-success d-inline-block">
<img src="${baseImgUrl + varPathImg + devObj.device_master_icon}" class="profile-image rounded-circle" onerror="defDev(this)" alt="..."> <img src="${baseImgUrl + varPathImg + devObj.device_master_icon}" class="profile-image rounded-circle" onerror="defDev(this)" alt="...">
</span> ${devObj.full_name} </span> ${devObj.full_name}
@ -144,9 +144,13 @@
$("[name=devItem]").each((index, ele) => { $("[name=devItem]").each((index, ele) => {
let devNum = $(ele).data("number"); //設備編號 let devNum = $(ele).data("number"); //設備編號
let devGuid = $(ele).data("id"); //guid let devGuid = $(ele).data("id"); //guid
let devName = $(ele).data("name"); //full_name
$(ele).YTTooltip({ $(ele).YTTooltip({
html: `<div class="card m-1 border device-wrap"> html: `<div class="card m-1 border device-wrap">
<div class="card-header p-2 px-3"> <div class="card-header p-2 px-3">
<div class="position-absolute w-50" style="word-break: break-all;">
<label class="m-0 mt-2">${devName}</label>
</div>
<div id="card-tab" class="row justify-content-end nav nav-tabs" role="tablist"> <div id="card-tab" class="row justify-content-end nav nav-tabs" role="tablist">
<button type="button" id="state-tab" class="btn btn-icon nav-link active" role="tab" data-tabname="cardTab" data-target="#state"><i class="fa fa-desktop icon"></i></button> <button type="button" id="state-tab" class="btn btn-icon nav-link active" role="tab" data-tabname="cardTab" data-target="#state"><i class="fa fa-desktop icon"></i></button>
<button type="button" id="info-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#info"><i class="fa fa-cog icon"></i></button> <button type="button" id="info-tab" class="btn btn-icon nav-link" role="tab" data-tabname="cardTab" data-target="#info"><i class="fa fa-cog icon"></i></button>
@ -200,7 +204,7 @@
let columns = [ let columns = [
{ {
"title": "類型", "title": "類型",
"data": "work_type", "data": "work_type_name",
}, },
{ {
"title": "項目", "title": "項目",
@ -269,7 +273,7 @@
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, null, null, null, null, "tpi");
} }
//function loadErrRecTable2(allPath) { //function loadErrRecTable2(allPath) {

View File

@ -15,6 +15,7 @@
var currentData = []; var currentData = [];
var allDeviceRowData = []; //所有設備原始資料 var allDeviceRowData = []; //所有設備原始資料
var global_emergency_alarm_device_number = []; var global_emergency_alarm_device_number = [];
var zoomToggle = 3;
$(function () { $(function () {
initChart(); initChart();
getFloData(); getFloData();
@ -565,7 +566,7 @@
obj.symbolSize = 60 obj.symbolSize = 60
} }
console.log(item.zoom) console.log(item.zoom)
if (item.zoom > 8) { if (item.zoom > zoomToggle) {
obj.symbolSize = 10 obj.symbolSize = 10
} }
res.push(obj); res.push(obj);
@ -771,7 +772,7 @@
zoom = floChart.getOption().geo[0].zoom; zoom = floChart.getOption().geo[0].zoom;
} }
if (zoom <= 8) { if (zoom <= zoomToggle) {
floChart.setOption({ floChart.setOption({
series: [{ series: [{
symbolOffset: [0, 0], symbolOffset: [0, 0],

View File

@ -4,6 +4,7 @@
} }
/* ================================================================ */ /* ================================================================ */
/* 單一方法 */ /* 單一方法 */
/* ================================================================ */ /* ================================================================ */

View File

@ -144,6 +144,9 @@ function fnInitJqDataTablesAjax(apiUrl, tag, sendData = null, columns, columns_d
if (sendData == null) { if (sendData == null) {
sendData = function (json) { sendData = function (json) {
console.log("讀取列表", json) console.log("讀取列表", json)
if (json.code && json.code == "0000") {
return json.data;
}
return json; return json;
} }
} }