Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
e867495d77
BIN
Backend/App_Data/bajaJsList.ods
Normal file
BIN
Backend/App_Data/bajaJsList.ods
Normal file
Binary file not shown.
@ -5,8 +5,8 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 col-xl-5">
|
<div class="col-sm-12 col-xl-5" id="floDevList">
|
||||||
<div class="d-flex justify-content-start mb-6">
|
<!--<div class="d-flex justify-content-start mb-6">
|
||||||
<button type="button" class="btn btn-primary waves-effect waves-themed mr-5">19 F</button>
|
<button type="button" class="btn btn-primary waves-effect waves-themed mr-5">19 F</button>
|
||||||
<div id="floor19" class="mr-5 cur-poi">
|
<div id="floor19" class="mr-5 cur-poi">
|
||||||
<span class="status status-success d-inline-block">
|
<span class="status status-success d-inline-block">
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<img src="img/demo/avatars/avatar-c.png" class="profile-image rounded-circle" alt="...">
|
<img src="img/demo/avatars/avatar-c.png" class="profile-image rounded-circle" alt="...">
|
||||||
</span> 21F 電錶02
|
</span> 21F 電錶02
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-12 col-xl-7">
|
<div class="col-sm-12 col-xl-7">
|
||||||
@ -51,30 +51,48 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
initPopover();
|
getFloDevList();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function getFloDevList() {
|
||||||
|
let url = baseApiUrl + "/api/Device/GetDeviceList";
|
||||||
|
let sendData = {
|
||||||
|
main_system_tag: pageAct.sysMainTag,
|
||||||
|
building_tag: pageAct.buiTag,
|
||||||
|
floor_tag: pageAct.floTag,
|
||||||
|
};
|
||||||
|
objSendData.Data = sendData;
|
||||||
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||||
|
if (!res || res.code != "0000" || !res.data) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
let strHtml = ``;
|
||||||
|
$.each(res.data, (index, floObj) => {
|
||||||
|
strHtml += "<div class='d-flex justify-content-start mb-6'>"
|
||||||
|
strHtml += `<button id="floItemBtn${floObj.full_name}" type="button" class="btn btn-primary waves-effect waves-themed mr-5">${floObj.full_name}</button>`
|
||||||
|
|
||||||
|
$.each(floObj.device_list, (index2, devObj) => {
|
||||||
|
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">
|
||||||
|
<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="...">
|
||||||
|
</span> ${devObj.full_name}
|
||||||
|
</div>`;
|
||||||
|
})
|
||||||
|
strHtml += "</div>"
|
||||||
|
})
|
||||||
|
$("#floDevList").append(strHtml);
|
||||||
|
initPopover();
|
||||||
|
}
|
||||||
|
}, null, "POST").send();
|
||||||
|
}
|
||||||
|
|
||||||
function drawStateTabBlo() {
|
function drawStateTabBlo() {
|
||||||
let strHtml = `<table class="table table-bordered table-striped text-center m-0">
|
let strHtml = `<table class="table table-bordered table-striped text-center m-0" id="iframemodal">
|
||||||
<tbody>
|
<div class="modal-body">
|
||||||
<tr>
|
<iframe src="http://localhost:8080/ord?station:%7Cslot:/TPE/B1/EE/E4/R2F/NA/WHT/N1|view:?fullScreen=true" width="100%" height="100%"></iframe>
|
||||||
<td>電壓 V</td>
|
</div>
|
||||||
<td>113</td>
|
</table>`
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>電流 A</td>
|
|
||||||
<td>8</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>功率 W</td>
|
|
||||||
<td>203</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>今日用電 kWh</td>
|
|
||||||
<td>58</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>`
|
|
||||||
return strHtml;
|
return strHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,45 +141,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function drawErrRecTabBlo() {
|
function drawErrRecTabBlo() {
|
||||||
let strHtml = `<table class="table table-bordered table-striped text-center m-0">
|
let strHtml = `<table id="errRecTable" class="table table-bordered table-striped text-center m-0 w-100">
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>設備編號</td>
|
|
||||||
<td>B01-B2-19F-CR-001</td>
|
|
||||||
<td>3D 座標</td>
|
|
||||||
<td>113</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>設備名稱</td>
|
|
||||||
<td>A區迴路001</td>
|
|
||||||
<td>forge dbid</td>
|
|
||||||
<td>101</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>廠牌</td>
|
|
||||||
<td>飛利浦 Philip</td>
|
|
||||||
<td>IP</td>
|
|
||||||
<td>192.168.1.105</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>型號</td>
|
|
||||||
<td>BH065</td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>原廠文件</td>
|
|
||||||
<td><a href="#">2022使用手冊.pdf</a></td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>型號</td>
|
|
||||||
<td>BH065</td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>`
|
</table>`
|
||||||
return strHtml;
|
return strHtml;
|
||||||
}
|
}
|
||||||
@ -174,7 +155,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initPopover() {
|
function initPopover() {
|
||||||
$("#floor19").YTTooltip({
|
$("[name=devItem]").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 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">
|
||||||
@ -202,9 +183,13 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>`,
|
</div>`,
|
||||||
onShow: function () {
|
group:"device",
|
||||||
|
onShow: function (tooltipEle, oriEle) {
|
||||||
|
console.log( "ori: " + $(oriEle).data("number"))
|
||||||
var tab = new YT.Tab({ tabName: "cardTab" })
|
var tab = new YT.Tab({ tabName: "cardTab" })
|
||||||
loadOpeRecTable();
|
loadOpeRecTable();
|
||||||
|
//loadErrRecTable2($(oriEle).data("number"));
|
||||||
|
loadErrRecTable();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -247,6 +232,87 @@
|
|||||||
|
|
||||||
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, callback, null, null, null, null, null, "tpi");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadErrRecTable() {
|
||||||
|
let tag = "#errRecTable";
|
||||||
|
let datas;
|
||||||
|
//getOneDeviceAlarmTop10ByBaja(_devicePath, callback);
|
||||||
|
|
||||||
|
let column_defs = [
|
||||||
|
{ "targets": [0], "width": "8%", "sortable": true },
|
||||||
|
{ "targets": [1], "width": "8%", "sortable": true },
|
||||||
|
{ "targets": [2], "width": "7%", "sortable": true },
|
||||||
|
{ "targets": [3], "width": "7%", "sortable": true },
|
||||||
|
];
|
||||||
|
|
||||||
|
let columns = [
|
||||||
|
{
|
||||||
|
"title": "異常ID",
|
||||||
|
"data": "uuid",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "異常原因",
|
||||||
|
"data": "msgText",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "ACK確認",
|
||||||
|
"data": "ackState",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "發生/賦歸時間",
|
||||||
|
"data": "timestamp",
|
||||||
|
},
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
//let callback = function (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 json_object = JSON.parse(result);
|
||||||
|
datas = json_object['data'];
|
||||||
|
errRecTable = new YourTeam.JqDataTables.getTableByStatic(tag, datas, columns, column_defs);
|
||||||
|
}
|
||||||
|
|
||||||
|
//function loadErrRecTable2(allPath) {
|
||||||
|
// if (allPath != undefined && allPath != null) {
|
||||||
|
// let _pathArr = allPath.split("_");//TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1
|
||||||
|
// let _devicePath = _pathArr[0] + "_" + _pathArr[1] + "_" + _pathArr[2] + "_" + _pathArr[3] + "_" + _pathArr[4] + "_" + _pathArr[5];
|
||||||
|
// //getOneDeviceAlarmTop10ByBaja(_devicePath, callback);
|
||||||
|
// console.log("devicePath: " + _devicePath);
|
||||||
|
// let result = '{"count": 2,"0": { "uuid": "43dc7846-bd96-4be2-ab35-f11aec729c60","timestamp": "2022-Nov-16 10:30:24.951 AM UTC+08:00","sourceName": "TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1_TRIP","sourceState": "1","msgText": "","ackState": "1","normalTime": "1970-Jan-1 08:00:00.000 AM UTC+08:00"},"1": {"uuid": "7c309846-d862-4a8b-803b-cdc8e0efa092","timestamp": "2022-Nov-16 10:00:24.893 AM UTC+08:00","sourceName": "TPE_B1_ELEV_EL_R2F_NA_ELEV1_N1_TRIP","sourceState": "0","msgText": "","ackState": "1","normalTime": "2022-Nov-16 10:15:24.939 AM UTC+08:00"}}';
|
||||||
|
// let result_Json = JSON.parse(result)
|
||||||
|
// var eachTable = $('.each-table tbody');
|
||||||
|
|
||||||
|
// for (var i = 0; i < result_Json['count']; i++)
|
||||||
|
// {
|
||||||
|
// item = result_Json[i.toString()];
|
||||||
|
// eachTable.append(
|
||||||
|
// '<tr>' +
|
||||||
|
// '<td>' + item.uuid + '</td>' +
|
||||||
|
// '<td>' + item.msgText + '</td>' +
|
||||||
|
// '<td>' + (item.ackState = 1 ? item.normalTime : '未確認') + '</td>' +
|
||||||
|
// '<td>' + item.timestamp + '</td>' +
|
||||||
|
// '</tr>');
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// let callback = function (result) {
|
||||||
|
// var eachTable = $('.each-table tbody');
|
||||||
|
// $.each(result, function (index, element) {
|
||||||
|
// eachTable.append(
|
||||||
|
// '<tr>' +
|
||||||
|
// '<td>' + element[index].uuid + '</td>' +
|
||||||
|
// '<td>' + element[index].msgText + '</td>' +
|
||||||
|
// '<td>' + (element[index].ackState = 1 ? element[index].normalTime : '未確認') + '</td>' +
|
||||||
|
// '<td>' + element[index].timestamp + '</td>' +
|
||||||
|
// '</tr>');
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
@ -29,215 +29,223 @@
|
|||||||
|
|
||||||
function chartHandler() {
|
function chartHandler() {
|
||||||
floChart.clear();
|
floChart.clear();
|
||||||
$.get(`${baseImgUrl}/upload/floor_map/c0de2199-e62b-4f82-b7f7-abacd4e1cd17.svg`, function (svg) {
|
/*let url = `${baseApiUrl}/upload/graph_manage/de08e7ee-9839-4403-90e5-754dec4e389b.jpg`*/
|
||||||
|
let url = `${baseImgUrl}/upload/floor_map/2e5be49c-f8e8-4977-b5b6-db4d95ff9691.svg`
|
||||||
|
|
||||||
if (svg == undefined || svg == null) {
|
download(url)
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
echarts.registerMap('floor_svg', { svg: svg });
|
//ytAjax = new YourTeam.Ajax(url, null, function (res) {
|
||||||
|
// if (svg == undefined || svg == null) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
option = {
|
// echarts.registerMap('floor_svg', { svg: svg });
|
||||||
// animationDurationUpdate: 1500,
|
|
||||||
tooltip: {
|
|
||||||
formatter: function (params) {
|
|
||||||
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>
|
|
||||||
Guid:${params.data.device_node_guid}`
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return `名稱:${params.data.device_full_name}<br>
|
|
||||||
Guid:${params.data.device_guid}`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
toolbox: { //工具欄
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
geo: {
|
|
||||||
map: 'floor_svg',
|
|
||||||
roam: true,
|
|
||||||
scaleLimit: { //限制放大縮小倍數
|
|
||||||
max: 32,
|
|
||||||
min: 2.5
|
|
||||||
},
|
|
||||||
layoutSize: '100%',
|
|
||||||
layoutCenter: ['50%', '50%'],
|
|
||||||
zoom: 2.5,
|
|
||||||
silent: true
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{ //不管有無被選擇(圓點)
|
|
||||||
type: 'scatter',
|
|
||||||
coordinateSystem: 'geo',
|
|
||||||
geoIndex: 0,
|
|
||||||
symbol: 'circle',
|
|
||||||
symbolSize: 10,
|
|
||||||
symbolOffset: [10, 10],
|
|
||||||
label: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
data: currentData,
|
|
||||||
z: 2
|
|
||||||
},
|
|
||||||
{ //未選擇的設備(icon)
|
|
||||||
type: 'scatter',
|
|
||||||
coordinateSystem: 'geo',
|
|
||||||
geoIndex: 0,
|
|
||||||
symbolSize: 30,
|
|
||||||
label: {
|
|
||||||
formatter: '{b}',
|
|
||||||
position: 'bottom',
|
|
||||||
show: true,
|
|
||||||
backgroundColor: 'orange'
|
|
||||||
},
|
|
||||||
emphasis: {
|
|
||||||
label: {
|
|
||||||
show: true,
|
|
||||||
fontSize: '20',
|
|
||||||
fontWeight: 'bold',
|
|
||||||
color: 'yellow'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selectedMode: 'single',
|
|
||||||
data: null,
|
|
||||||
z: 1
|
|
||||||
},
|
|
||||||
{ //被選擇的設備(icon)
|
|
||||||
type: 'effectScatter',
|
|
||||||
coordinateSystem: 'geo',
|
|
||||||
geoIndex: 0,
|
|
||||||
showEffectOn: 'render',
|
|
||||||
symbolSize: 30,
|
|
||||||
label: {
|
|
||||||
formatter: '{b}',
|
|
||||||
position: 'bottom',
|
|
||||||
show: true,
|
|
||||||
backgroundColor: 'orange'
|
|
||||||
},
|
|
||||||
emphasis: {
|
|
||||||
label: {
|
|
||||||
show: true,
|
|
||||||
fontSize: '20',
|
|
||||||
fontWeight: 'bold',
|
|
||||||
color: 'yellow'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selectedMode: 'single',
|
|
||||||
data: null,
|
|
||||||
z: 1
|
|
||||||
},
|
|
||||||
{ //編輯模式底下的設備(圓點,只會有一個)
|
|
||||||
type: 'scatter',
|
|
||||||
coordinateSystem: 'geo',
|
|
||||||
geoIndex: 0,
|
|
||||||
symbol: 'circle',
|
|
||||||
symbolSize: 10,
|
|
||||||
symbolOffset: [10, 10],
|
|
||||||
label: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
data: currentData,
|
|
||||||
z: 2
|
|
||||||
},
|
|
||||||
{ //編輯模式底下的設備(icon,只會有一個)
|
|
||||||
type: 'scatter',
|
|
||||||
coordinateSystem: 'geo',
|
|
||||||
geoIndex: 0,
|
|
||||||
symbolSize: 30,
|
|
||||||
label: {
|
|
||||||
formatter: '{b}',
|
|
||||||
position: 'bottom',
|
|
||||||
show: true,
|
|
||||||
backgroundColor: 'orange'
|
|
||||||
},
|
|
||||||
emphasis: {
|
|
||||||
label: {
|
|
||||||
show: true,
|
|
||||||
fontSize: '20',
|
|
||||||
fontWeight: 'bold',
|
|
||||||
color: 'yellow'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data: null,
|
|
||||||
z: 1
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
floChart.setOption(option);
|
// option = {
|
||||||
|
// // animationDurationUpdate: 1500,
|
||||||
|
// tooltip: {
|
||||||
|
// formatter: function (params) {
|
||||||
|
// 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>
|
||||||
|
// Guid:${params.data.device_node_guid}`
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// return `名稱:${params.data.device_full_name}<br>
|
||||||
|
// Guid:${params.data.device_guid}`
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// toolbox: { //工具欄
|
||||||
|
// show: false
|
||||||
|
// },
|
||||||
|
// geo: {
|
||||||
|
// map: 'floor_svg',
|
||||||
|
// roam: true,
|
||||||
|
// scaleLimit: { //限制放大縮小倍數
|
||||||
|
// max: 32,
|
||||||
|
// min: 2.5
|
||||||
|
// },
|
||||||
|
// layoutSize: '100%',
|
||||||
|
// layoutCenter: ['50%', '50%'],
|
||||||
|
// zoom: 2.5,
|
||||||
|
// silent: true
|
||||||
|
// },
|
||||||
|
// series: [
|
||||||
|
// { //不管有無被選擇(圓點)
|
||||||
|
// type: 'scatter',
|
||||||
|
// coordinateSystem: 'geo',
|
||||||
|
// geoIndex: 0,
|
||||||
|
// symbol: 'circle',
|
||||||
|
// symbolSize: 10,
|
||||||
|
// symbolOffset: [10, 10],
|
||||||
|
// label: {
|
||||||
|
// show: false
|
||||||
|
// },
|
||||||
|
// data: currentData,
|
||||||
|
// z: 2
|
||||||
|
// },
|
||||||
|
// { //未選擇的設備(icon)
|
||||||
|
// type: 'scatter',
|
||||||
|
// coordinateSystem: 'geo',
|
||||||
|
// geoIndex: 0,
|
||||||
|
// symbolSize: 30,
|
||||||
|
// label: {
|
||||||
|
// formatter: '{b}',
|
||||||
|
// position: 'bottom',
|
||||||
|
// show: true,
|
||||||
|
// backgroundColor: 'orange'
|
||||||
|
// },
|
||||||
|
// emphasis: {
|
||||||
|
// label: {
|
||||||
|
// show: true,
|
||||||
|
// fontSize: '20',
|
||||||
|
// fontWeight: 'bold',
|
||||||
|
// color: 'yellow'
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// selectedMode: 'single',
|
||||||
|
// data: null,
|
||||||
|
// z: 1
|
||||||
|
// },
|
||||||
|
// { //被選擇的設備(icon)
|
||||||
|
// type: 'effectScatter',
|
||||||
|
// coordinateSystem: 'geo',
|
||||||
|
// geoIndex: 0,
|
||||||
|
// showEffectOn: 'render',
|
||||||
|
// symbolSize: 30,
|
||||||
|
// label: {
|
||||||
|
// formatter: '{b}',
|
||||||
|
// position: 'bottom',
|
||||||
|
// show: true,
|
||||||
|
// backgroundColor: 'orange'
|
||||||
|
// },
|
||||||
|
// emphasis: {
|
||||||
|
// label: {
|
||||||
|
// show: true,
|
||||||
|
// fontSize: '20',
|
||||||
|
// fontWeight: 'bold',
|
||||||
|
// color: 'yellow'
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// selectedMode: 'single',
|
||||||
|
// data: null,
|
||||||
|
// z: 1
|
||||||
|
// },
|
||||||
|
// { //編輯模式底下的設備(圓點,只會有一個)
|
||||||
|
// type: 'scatter',
|
||||||
|
// coordinateSystem: 'geo',
|
||||||
|
// geoIndex: 0,
|
||||||
|
// symbol: 'circle',
|
||||||
|
// symbolSize: 10,
|
||||||
|
// symbolOffset: [10, 10],
|
||||||
|
// label: {
|
||||||
|
// show: false
|
||||||
|
// },
|
||||||
|
// data: currentData,
|
||||||
|
// z: 2
|
||||||
|
// },
|
||||||
|
// { //編輯模式底下的設備(icon,只會有一個)
|
||||||
|
// type: 'scatter',
|
||||||
|
// coordinateSystem: 'geo',
|
||||||
|
// geoIndex: 0,
|
||||||
|
// symbolSize: 30,
|
||||||
|
// label: {
|
||||||
|
// formatter: '{b}',
|
||||||
|
// position: 'bottom',
|
||||||
|
// show: true,
|
||||||
|
// backgroundColor: 'orange'
|
||||||
|
// },
|
||||||
|
// emphasis: {
|
||||||
|
// label: {
|
||||||
|
// show: true,
|
||||||
|
// fontSize: '20',
|
||||||
|
// fontWeight: 'bold',
|
||||||
|
// color: 'yellow'
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// data: null,
|
||||||
|
// z: 1
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// };
|
||||||
|
|
||||||
floChart.getZr().on('click', function (params) {
|
// floChart.setOption(option);
|
||||||
console.log("click", params);
|
|
||||||
var pixelPoint = [params.offsetX, params.offsetY];
|
|
||||||
var dataPoint = floChart.convertFromPixel({ geoIndex: 0 }, pixelPoint);
|
|
||||||
console.log(dataPoint);
|
|
||||||
|
|
||||||
if (floor_map_mode == "edit") {
|
// floChart.getZr().on('click', function (params) {
|
||||||
|
// console.log("click", params);
|
||||||
|
// var pixelPoint = [params.offsetX, params.offsetY];
|
||||||
|
// var dataPoint = floChart.convertFromPixel({ geoIndex: 0 }, pixelPoint);
|
||||||
|
// console.log(dataPoint);
|
||||||
|
|
||||||
temp_device_on_floor_map = [{
|
// if (floor_map_mode == "edit") {
|
||||||
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
|
|
||||||
}];
|
|
||||||
|
|
||||||
|
// 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
|
||||||
|
// }];
|
||||||
|
|
||||||
|
|
||||||
// currentData.push([dataPoint[0], dataPoint[1], 1]);
|
// }
|
||||||
// floChart.setOption(option);
|
|
||||||
});
|
|
||||||
|
|
||||||
floChart.on('selectchanged', function (params) {
|
|
||||||
|
|
||||||
console.log("selectchanged", params);
|
|
||||||
// currentData.push([dataPoint[0], dataPoint[1], 1]);
|
|
||||||
// floChart.setOption(option);
|
|
||||||
|
|
||||||
currentData = $.map(currentData, function (item) {
|
// // currentData.push([dataPoint[0], dataPoint[1], 1]);
|
||||||
item.selected = false;
|
// // floChart.setOption(option);
|
||||||
return item;
|
// });
|
||||||
});
|
|
||||||
|
|
||||||
if (params.selected.length > 0) {
|
// floChart.on('selectchanged', function (params) {
|
||||||
currentData[params.selected[0].seriesIndex - 1].selected = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// console.log("selectchanged", params);
|
||||||
});
|
// // currentData.push([dataPoint[0], dataPoint[1], 1]);
|
||||||
|
// // floChart.setOption(option);
|
||||||
|
|
||||||
// floChart.getZr().on('mousewheel', function (params) {
|
// currentData = $.map(currentData, function (item) {
|
||||||
// console.log(params)
|
// item.selected = false;
|
||||||
// })
|
// return item;
|
||||||
floChart.on('georoam', function (params) {
|
// });
|
||||||
|
|
||||||
var zoom = floChart.getOption().geo[0].zoom;
|
|
||||||
|
|
||||||
if (zoom <= 2.5) {
|
// if (params.selected.length > 0) {
|
||||||
ResetFloorMap();
|
// currentData[params.selected[0].seriesIndex - 1].selected = true;
|
||||||
floChart.setOption({
|
// }
|
||||||
geo: {
|
|
||||||
roam: 'scale'
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
floChart.setOption({
|
|
||||||
geo: {
|
|
||||||
roam: true
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
// });
|
||||||
})
|
|
||||||
.fail(function () {
|
// // floChart.getZr().on('mousewheel', function (params) {
|
||||||
toast_warning("查無該樓層地圖")
|
// // console.log(params)
|
||||||
floChart.clear();
|
// // })
|
||||||
});
|
// floChart.on('georoam', function (params) {
|
||||||
|
|
||||||
|
// var zoom = floChart.getOption().geo[0].zoom;
|
||||||
|
|
||||||
|
// if (zoom <= 2.5) {
|
||||||
|
// ResetFloorMap();
|
||||||
|
// floChart.setOption({
|
||||||
|
// geo: {
|
||||||
|
// roam: 'scale'
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// floChart.setOption({
|
||||||
|
// geo: {
|
||||||
|
// roam: true
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// });
|
||||||
|
//}).send();
|
||||||
|
//$.get(`${baseImgUrl}/device/GetFloorSvg/c0de2199-e62b-4f82-b7f7-abacd4e1cd17.svg`, function (svg) {
|
||||||
|
|
||||||
|
|
||||||
|
//})
|
||||||
|
// .fail(function () {
|
||||||
|
// toast_warning("查無該樓層地圖")
|
||||||
|
// floChart.clear();
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
@ -5,11 +5,9 @@
|
|||||||
</style>
|
</style>
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row bg-dark">
|
<div class="row bg-dark">
|
||||||
<h1 class="p-2 mx-5 mb-0">電錶系統</h1>
|
<h1 id="sysMainText" class="p-2 mx-5 mb-0"></h1>
|
||||||
<div class="btn-group my-2">
|
<div class="btn-group my-2" id="floList">
|
||||||
<button name="floBtn" data-id="all" type="button" class="btn btn-secondary waves-effect waves-themed" data-tabname="floor" data-target="all">總覽</button>
|
|
||||||
<button name="floBtn" data-id="19" class="btn btn-secondary waves-effect waves-themed" data-tabname="floor" data-target="19">19 F</button>
|
|
||||||
<button name="floBtn" data-id="21" class="btn btn-secondary waves-effect waves-themed" data-tabname="floor" data-target="21">21 F</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -19,20 +17,46 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
var floList = [];
|
||||||
$("#js-page-content").load("_sysMonAll.html",loadCallback);
|
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
$("#sysMainText").text(pageAct.sysMainName);
|
||||||
onEvent("click", "[name=floBtn]", function () {
|
getFloList();
|
||||||
if ($(this).data("id") == "all") {
|
|
||||||
$("#js-page-content").load("_sysMonAll.html", loadCallback);
|
|
||||||
} else {
|
|
||||||
$("#js-page-content").load("_sysMonFloor.html", loadCallback);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onEvent("yt:tab:change", "[name=floBtn]", function () {
|
||||||
|
pageAct.floTag = $(this).data("id");
|
||||||
|
if ($(this).data("id") == "all") {
|
||||||
|
pageAct.floTag = null;
|
||||||
|
$("#js-page-content").load("_sysMonAll.html", loadCallback);
|
||||||
|
} else {
|
||||||
|
$("#js-page-content").load("_sysMonFloor.html", loadCallback);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onEvent("change", "#buiList", function (e, actEle) {
|
||||||
|
getFloList();
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
function getFloList() {
|
||||||
|
let url = baseApiUrl + "/api/Device/GetFloor";
|
||||||
|
let sendData = { building_tag: pageAct.buiTag };
|
||||||
|
objSendData.Data = sendData;
|
||||||
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||||
|
if (!res || res.code != "0000" || !res.data) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
let strHtml = `<button name="floBtn" data-id="all" type="button" class="btn btn-secondary waves-effect waves-themed" data-tabname="floor" data-target="all">總覽</button>`;
|
||||||
|
$.each(res.data, (index, floObj) => {
|
||||||
|
strHtml += `<button name="floBtn" data-id="${floObj.floor_tag}" class="btn btn-secondary waves-effect waves-themed" data-tabname="floor" data-target="${floObj.floor_tag}">${floObj.floor_tag}</button>`;
|
||||||
|
})
|
||||||
|
$("#floList").html(strHtml);
|
||||||
|
floList = res.data;
|
||||||
|
|
||||||
|
var ytTab = new YT.Tab({ tabName: "floor" })
|
||||||
|
}
|
||||||
|
}, null, "POST").send();
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
BIN
Frontend/img/defdev.png
Normal file
BIN
Frontend/img/defdev.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
@ -25,6 +25,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
<link id="appbundle" rel="stylesheet" media="screen, print" href="lib/app.bundle.css">
|
<link id="appbundle" rel="stylesheet" media="screen, print" href="lib/app.bundle.css">
|
||||||
<link id="mytheme" rel="stylesheet" media="screen, print" href="#">
|
<link id="mytheme" rel="stylesheet" media="screen, print" href="#">
|
||||||
<link id="myskin" rel="stylesheet" media="screen, print" href="lib/skins/skin-master.css">
|
<link id="myskin" rel="stylesheet" media="screen, print" href="lib/skins/skin-master.css">
|
||||||
|
<link rel="stylesheet" href="lib/notifications/toastr/toastr.min.css" />
|
||||||
<!-- Place favicon.ico in the root directory -->
|
<!-- Place favicon.ico in the root directory -->
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="img/favicon/apple-touch-icon.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="img/favicon/apple-touch-icon.png">
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon/favicon-32x32.png">
|
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon/favicon-32x32.png">
|
||||||
@ -1114,19 +1115,17 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a class="dropdown-toggle" href="javascript:;" role="button" id="buiActDrop" data-target="buiList" data-toggle="dropdown" aria-haspopup="true">
|
||||||
總公司
|
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
|
<div id="buiList" class="dropdown-menu dropdown-select-menu js-auto-close">
|
||||||
<a class="dropdown-item" href="#">分公司一</a>
|
|
||||||
<a class="dropdown-item" href="#">分公司二</a>
|
|
||||||
<a class="dropdown-item" href="#">分公司三</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ml-auto d-flex">
|
<div class="ml-auto d-flex">
|
||||||
<div class="btn-group mx-4">
|
<div class="btn-group mx-4">
|
||||||
<a href="javascript:;" name="dasBoaBtn" class="text-center">
|
<a href="javascript:;" name="topFunBtn" data-page="dashboard" class="text-center">
|
||||||
<i class="fal fa-home fa-2x"></i><br>首頁
|
<i class="fal fa-home fa-2x"></i><br>首頁
|
||||||
</a>
|
</a>
|
||||||
<!--<div class="dropdown-menu">
|
<!--<div class="dropdown-menu">
|
||||||
@ -1139,12 +1138,12 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
<a href="javascript:;" class="dropdown-toggle no-arrow text-center" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a href="javascript:;" class="dropdown-toggle no-arrow text-center" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
<i class="fal fa-tv fa-2x"></i><br>系統監控
|
<i class="fal fa-tv fa-2x"></i><br>系統監控
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu" id="sysMonBtnList">
|
<div class="dropdown-menu dropdown-select-menu js-auto-close" id="sysMonBtnList">
|
||||||
<button class="dropdown-item" type="button" name="sysMonBtn">電錶</button>
|
<!--<button class="dropdown-item" type="button" name="sysMonBtn">電錶</button>
|
||||||
<button class="dropdown-item" type="button" name="sysMonBtn">照明系統</button>
|
<button class="dropdown-item" type="button" name="sysMonBtn">照明系統</button>
|
||||||
<button class="dropdown-item" type="button" name="sysMonBtn">電梯系統</button>
|
<button class="dropdown-item" type="button" name="sysMonBtn">電梯系統</button>
|
||||||
<button class="dropdown-item" type="button" name="sysMonBtn">環境感測</button>
|
<button class="dropdown-item" type="button" name="sysMonBtn">環境感測</button>
|
||||||
<button class="dropdown-item" type="button" name="sysMonBtn">空調系統</button>
|
<button class="dropdown-item" type="button" name="sysMonBtn">空調系統</button>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-group mx-4">
|
<div class="btn-group mx-4">
|
||||||
@ -2055,18 +2054,23 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
<script src="lib/statistics/flot/flot.bundle.js"></script>
|
<script src="lib/statistics/flot/flot.bundle.js"></script>
|
||||||
<script src="lib/statistics/easypiechart/easypiechart.bundle.js"></script>
|
<script src="lib/statistics/easypiechart/easypiechart.bundle.js"></script>
|
||||||
<script src="lib/datagrid/datatables/datatables.bundle.js"></script>
|
<script src="lib/datagrid/datatables/datatables.bundle.js"></script>
|
||||||
|
<script src="lib/notifications/toastr/toastr.min.js"></script>
|
||||||
<script src="js/yourteam/yourteam.ajax.class.js"></script>
|
<script src="js/yourteam/yourteam.ajax.class.js"></script>
|
||||||
<script src="js/yourteam/yourteam.jquery.datatables.js"></script>
|
<script src="js/yourteam/yourteam.jquery.datatables.js"></script>
|
||||||
<script src="js/yourteam/yourteam.utility.class.js"></script>
|
<script src="js/yourteam/yourteam.utility.class.js"></script>
|
||||||
<script src="js/yourteam/plugins/yt-tooltip/yt-tooltip.js"></script>
|
<script src="js/yourteam/plugins/yt-tooltip/yt-tooltip.js"></script>
|
||||||
<script src="js/yourteam/plugins/yt-tab/yt-tab.js"></script>
|
<script src="js/yourteam/plugins/yt-tab/yt-tab.js"></script>
|
||||||
|
<script src="js/toast.js"></script>
|
||||||
<script src="js/style.js"></script>
|
<script src="js/style.js"></script>
|
||||||
<script src="js/main.js"></script>
|
<script src="js/site.js"></script>
|
||||||
<script src="js/init.js"></script>
|
<script src="js/init.js"></script>
|
||||||
|
<script src="js/n4js/alarmbaja.js"></script>
|
||||||
<script>
|
<script>
|
||||||
let user = localStorage.getItem("JWT-Authorization");
|
|
||||||
|
|
||||||
if (user) {
|
var jwt = localStorage.getItem("JWT-Authorization");
|
||||||
|
var pageAct = {}; //記錄全頁面已選擇項目
|
||||||
|
|
||||||
|
if (jwt) {
|
||||||
$("#app").load("_dashboard.html", loadCallback);
|
$("#app").load("_dashboard.html", loadCallback);
|
||||||
} else {
|
} else {
|
||||||
location.href = "login.html";
|
location.href = "login.html";
|
||||||
@ -2074,15 +2078,36 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
getSysMonBtnList();
|
getSysMonBtnList();
|
||||||
|
getBuiList();
|
||||||
|
/*setBuiAct();*/
|
||||||
})
|
})
|
||||||
|
|
||||||
onEvent("click", "button[name^=sysMonBtn]", function () {
|
|
||||||
$("#app").load("_systemMonitor.html", loadCallback);
|
onEvent("click", "[name=topFunBtn]", function () {
|
||||||
})
|
let page = $(this).data("page");
|
||||||
onEvent("click", "button[name=dasBoaBtn]", function () {
|
|
||||||
$("#app").load("_dashboard.html", loadCallback);
|
if (page != "systemMonitor") {
|
||||||
|
$("#sysMonBtnList .dropdown-item").removeClass("active");
|
||||||
|
pageAct.sysMainTag = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#app").load(`_${page}.html`, loadCallback);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onEvent("active:change", "#sysMonBtnList", function (e, actEle) {
|
||||||
|
if (actEle) {
|
||||||
|
pageAct.sysMainTag = $(actEle).prop("id").split("mainSysBtn")[1];
|
||||||
|
pageAct.sysMainName = $(actEle).text();
|
||||||
|
}
|
||||||
|
$(this).trigger("change");
|
||||||
|
})
|
||||||
|
|
||||||
|
onEvent("active:change", "#buiList", function (e, actEle) {
|
||||||
|
if (actEle) {
|
||||||
|
pageAct.buiTag = $(actEle).prop("id").split("buiBtn")[1];
|
||||||
|
}
|
||||||
|
$(this).trigger("change");
|
||||||
|
})
|
||||||
function loadCallback() {
|
function loadCallback() {
|
||||||
initTabsByEle();
|
initTabsByEle();
|
||||||
resetYTTooltip();
|
resetYTTooltip();
|
||||||
@ -2090,12 +2115,34 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
|
|
||||||
function getSysMonBtnList() {
|
function getSysMonBtnList() {
|
||||||
let url = baseApiUrl + "/api/Device/GetMainSub";
|
let url = baseApiUrl + "/api/Device/GetMainSub";
|
||||||
ytAjax = new YourTeam.Ajax(url, null, function (data) {
|
ytAjax = new YourTeam.Ajax(url, null, function (res) {
|
||||||
console.log(data)
|
if (!res || res.code != "0000" || !res.data) {
|
||||||
/*sysMonBtnList*/
|
|
||||||
},null,"POST").send();
|
} else {
|
||||||
|
let strHtml = ``;
|
||||||
|
$.each(res.data.history_Main_Systems, (index, mainSysObj) => {
|
||||||
|
strHtml += `<button id="mainSysBtn${mainSysObj.main_system_tag}" class="dropdown-item" type="button" data-page="systemMonitor" name="topFunBtn">${mainSysObj.full_name}</button>`;
|
||||||
|
})
|
||||||
|
$("#sysMonBtnList").append(strHtml);
|
||||||
|
}
|
||||||
|
}, null, "POST").send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getBuiList() {
|
||||||
|
let url = baseApiUrl + "/api/Device/GetBuild";
|
||||||
|
ytAjax = new YourTeam.Ajax(url, null, function (res) {
|
||||||
|
if (!res || res.code != "0000" || !res.data) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
let strHtml = ``;
|
||||||
|
$.each(res.data, (index, buiObj) => {
|
||||||
|
strHtml += `<a id="buiBtn${buiObj.building_tag}" class="dropdown-item" href="javascript:;">${buiObj.full_name}</a>`;
|
||||||
|
})
|
||||||
|
$("#buiList").append(strHtml).droSetItem(); //droSetItem 預設第一筆 active
|
||||||
|
}
|
||||||
|
}, null, "POST").send();
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
<!-- END Body -->
|
<!-- END Body -->
|
||||||
|
@ -6,4 +6,14 @@ var varApiUrl = "/api/"; //API路徑
|
|||||||
var varPathImg = "/Upload/Images/";
|
var varPathImg = "/Upload/Images/";
|
||||||
var varPathFile = "/Upload/Files/";
|
var varPathFile = "/Upload/Files/";
|
||||||
var statusArr = { 1: "啟用", 0: "未啟用", 9: "刪除" };
|
var statusArr = { 1: "啟用", 0: "未啟用", 9: "刪除" };
|
||||||
var objSendData = { Data: null };
|
var objSendData = { Data: null };
|
||||||
|
|
||||||
|
//重新轉址 for Niagara4
|
||||||
|
var temp_cuurent_Url_pathname = window.location.pathname.split("/").slice(0, 3);
|
||||||
|
var redirectionUrl = window.location.origin + "/" +
|
||||||
|
temp_cuurent_Url_pathname[temp_cuurent_Url_pathname.length - 1].replace(":%5E", "/") + "/" +
|
||||||
|
window.location.pathname.split("/").slice(3).join("/");
|
||||||
|
//判斷url是否包含"ord",如果有重新轉址
|
||||||
|
if (temp_cuurent_Url_pathname.findIndex(x => x == "ord") > -1) {
|
||||||
|
document.location.href = redirectionUrl.substr(0, redirectionUrl.length - 1);
|
||||||
|
}
|
110
Frontend/js/n4js/alarmbaja.js
Normal file
110
Frontend/js/n4js/alarmbaja.js
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* 取得異常資料 by baja
|
||||||
|
* @param {any} startDate_millisecond
|
||||||
|
* @param {any} endDate_millisecond
|
||||||
|
* @param {any} isRecover
|
||||||
|
* @param {any} isAck
|
||||||
|
* @param {any} alarmClass
|
||||||
|
* @param {any} callback
|
||||||
|
*/
|
||||||
|
function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, alarmClass, callback) {
|
||||||
|
let _sourceTmp;
|
||||||
|
var _result = "";
|
||||||
|
var _ss = "";
|
||||||
|
var _bfName = "";
|
||||||
|
var _sourceName = "";
|
||||||
|
var _index = 0;
|
||||||
|
var _recoverState = isRecover ? "!= null" : "= null"
|
||||||
|
var _ackState = isAck ? "= 1" : "!= 1";
|
||||||
|
|
||||||
|
require(['baja!'], function (baja) {
|
||||||
|
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " order by timestamp asc").get()
|
||||||
|
.then(function (table) {
|
||||||
|
return table.cursor({
|
||||||
|
each: function (record) {
|
||||||
|
_sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_');
|
||||||
|
_bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
|
||||||
|
_sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
|
||||||
|
_ss += ', "' + _index + '": {"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
|
||||||
|
_index++;
|
||||||
|
},
|
||||||
|
after: function () {
|
||||||
|
_result += '{' + '"count": ' + _index;
|
||||||
|
_result += _ss;
|
||||||
|
_result += '}';
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
callback(_result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取得單一設備最新10筆異常資料 by baja
|
||||||
|
* @param {any} devicePath
|
||||||
|
* @param {any} callback
|
||||||
|
*/
|
||||||
|
function getOneDeviceAlarmTop10ByBaja(devicePath, callback) {
|
||||||
|
var _result = "";
|
||||||
|
var _ss = "";
|
||||||
|
var _index = 0;
|
||||||
|
//{ "count":2,"data": [{ "time": "2022/11/14 15:00:00", "errId": "0001", "ackCheck": "未確認", "errReason": "燈泡故障" }, { "time": "2022/11/14 15:00:00", "errId": "0002", "ackCheck": "未確認", "errReason": "燈泡故障" }]}
|
||||||
|
require(['baja!'], function (baja) {
|
||||||
|
baja.Ord.make("local:|foxs:|alarm:|bql:select top 10 timestamp, ackState, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc").get()
|
||||||
|
.then(function (table) {
|
||||||
|
return table.cursor({
|
||||||
|
each: function (record) {
|
||||||
|
if (_index == 0)
|
||||||
|
_ss += '{"uuid":"' + record.get('uuid') + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + record.get('timestamp') + '"}';
|
||||||
|
else
|
||||||
|
_ss += ',{"uuid":"' + record.get('uuid') + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + record.get('timestamp') + '"}';
|
||||||
|
_index++;
|
||||||
|
},
|
||||||
|
after: function () {
|
||||||
|
_result += '{' + '"count": ' + _index +', data:[';
|
||||||
|
|
||||||
|
_result += _ss+']';
|
||||||
|
_result += '}';
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
callback(_result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在單一系統下,取得各個設備的異常狀態
|
||||||
|
* @param {any} systemPath
|
||||||
|
* @param {any} callback
|
||||||
|
*/
|
||||||
|
function getOneSystemAlarmStateByBaja(systemPath, callback) {
|
||||||
|
var _result = "";
|
||||||
|
var _ss = "";
|
||||||
|
var _index = 0;
|
||||||
|
|
||||||
|
require(['baja!'], function (baja) {
|
||||||
|
baja.Ord.make("local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc").get()
|
||||||
|
.then(function (table) {
|
||||||
|
return table.cursor({
|
||||||
|
each: function (record) {
|
||||||
|
_ss += ', "' + _index + '": {"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}';
|
||||||
|
_index++;
|
||||||
|
},
|
||||||
|
after: function () {
|
||||||
|
_result += '{' + '"count": ' + _index;
|
||||||
|
_result += _ss;
|
||||||
|
_result += '}';
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
callback(_result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -1,79 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取得歷史資料 by baja
|
|
||||||
* @param {any} devicePath
|
|
||||||
* @param {any} startDate_millisecond
|
|
||||||
* @param {any} endDate_millisecond
|
|
||||||
* @param {any} deviceName
|
|
||||||
* @param {any} company
|
|
||||||
* @param {any} callback
|
|
||||||
*/
|
|
||||||
function getHistoryDataByBaja(devicePath, startDate_millisecond, endDate_millisecond, deviceName, company, callback) {
|
|
||||||
var _result = "";
|
|
||||||
var _ss = "";
|
|
||||||
var _index = 0;
|
|
||||||
|
|
||||||
require(['baja!'], function (baja) {
|
|
||||||
baja.Ord.make('local:|foxs:|history:/' + company + '/' + devicePath + '|bql:select * from control:ControlPoint where timestamp.millis > ' + startDate_millisecond + ' and timestamp.millis < ' + endDate_millisecond).get()
|
|
||||||
.then(function (table) {
|
|
||||||
return table.cursor({
|
|
||||||
each: function (record) {
|
|
||||||
_ss += ', "' + _index + '": {"deviceName":"' + deviceName + '", "value":' + record.get('value') + ', "timestamp":"' + record.get('timestamp') + '"}';
|
|
||||||
_index++;
|
|
||||||
},
|
|
||||||
after: function () {
|
|
||||||
_result += '{' + '"count": ' + _index;
|
|
||||||
_result += _ss;
|
|
||||||
_result += '}';
|
|
||||||
if (typeof callback === 'function') {
|
|
||||||
callback(_result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取得異常資料 by baja
|
|
||||||
* @param {any} startDate_millisecond
|
|
||||||
* @param {any} endDate_millisecond
|
|
||||||
* @param {any} isRecover
|
|
||||||
* @param {any} isAck
|
|
||||||
* @param {any} alarmClass
|
|
||||||
* @param {any} callback
|
|
||||||
*/
|
|
||||||
function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, alarmClass, callback) {
|
|
||||||
let _sourceTmp;
|
|
||||||
var _result = "";
|
|
||||||
var _ss = "";
|
|
||||||
var _bfName = "";
|
|
||||||
var _sourceName = "";
|
|
||||||
var _index = 0;
|
|
||||||
var _recoverState = isRecover ? "!= null" : "= null"
|
|
||||||
var _ackState = isAck ? "= 1" : "!= 1";
|
|
||||||
|
|
||||||
require(['baja!'], function (baja) {
|
|
||||||
baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " order by timestamp asc").get()
|
|
||||||
.then(function (table) {
|
|
||||||
return table.cursor({
|
|
||||||
each: function (record) {
|
|
||||||
_sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_');
|
|
||||||
_bfName = _sourceTmp[1] + "-" + _sourceTmp[4];
|
|
||||||
_sourceName = _sourceTmp[7] + "-" + _sourceTmp[8];
|
|
||||||
_ss += ', "' + _index + '": {"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}';
|
|
||||||
_index++;
|
|
||||||
},
|
|
||||||
after: function () {
|
|
||||||
_result += '{' + '"count": ' + _index;
|
|
||||||
_result += _ss;
|
|
||||||
_result += '}';
|
|
||||||
if (typeof callback === 'function') {
|
|
||||||
callback(_result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
37
Frontend/js/n4js/historybaja.js
Normal file
37
Frontend/js/n4js/historybaja.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* 取得歷史資料 by baja
|
||||||
|
* @param {any} devicePath
|
||||||
|
* @param {any} startDate_millisecond
|
||||||
|
* @param {any} endDate_millisecond
|
||||||
|
* @param {any} deviceName
|
||||||
|
* @param {any} company
|
||||||
|
* @param {any} callback
|
||||||
|
*/
|
||||||
|
function getHistoryDataByBaja(devicePath, startDate_millisecond, endDate_millisecond, deviceName, company, callback) {
|
||||||
|
var _result = "";
|
||||||
|
var _ss = "";
|
||||||
|
var _index = 0;
|
||||||
|
|
||||||
|
require(['baja!'], function (baja) {
|
||||||
|
baja.Ord.make('local:|foxs:|history:/' + company + '/' + devicePath + '|bql:select * from control:ControlPoint where timestamp.millis > ' + startDate_millisecond + ' and timestamp.millis < ' + endDate_millisecond).get()
|
||||||
|
.then(function (table) {
|
||||||
|
return table.cursor({
|
||||||
|
each: function (record) {
|
||||||
|
_ss += ', "' + _index + '": {"deviceName":"' + deviceName + '", "value":' + record.get('value') + ', "timestamp":"' + record.get('timestamp') + '"}';
|
||||||
|
_index++;
|
||||||
|
},
|
||||||
|
after: function () {
|
||||||
|
_result += '{' + '"count": ' + _index;
|
||||||
|
_result += _ss;
|
||||||
|
_result += '}';
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
callback(_result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1 +1,45 @@
|
|||||||
|
$(function () {
|
||||||
|
$(".dropdown-menu.dropdown-select-menu").each((index, value) => {
|
||||||
|
setDropdownItem(value)
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fn 定義 | 手動初始化 Bootstrap dropdown select
|
||||||
|
*/
|
||||||
|
$.fn.droSetItem = function () {
|
||||||
|
setDropdownItem(this);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 設置 bootstrap dropdown 為下拉選單
|
||||||
|
* @param {any} menuEle .dropdown-menu element
|
||||||
|
*/
|
||||||
|
function setDropdownItem(menuEle) {
|
||||||
|
if ($(menuEle).find(".dropdown-item.active").length == 0) {
|
||||||
|
$(menuEle).find(".dropdown-item").first().addClass("active");
|
||||||
|
}
|
||||||
|
|
||||||
|
let actText = $(menuEle).find(".dropdown-item.active").first().text();
|
||||||
|
let actEleId = $(menuEle).prop("id");
|
||||||
|
$(`.dropdown-toggle[data-target=${actEleId}]`).text(actText);
|
||||||
|
$(menuEle).trigger("active:change", $(menuEle).find(".dropdown-item.active"));
|
||||||
|
|
||||||
|
//點選選項 add active class
|
||||||
|
onEvent("click", ".dropdown-menu.dropdown-select-menu .dropdown-item", function () {
|
||||||
|
$(this).parent(".dropdown-menu.dropdown-select-menu").find(".dropdown-item").removeClass("active");
|
||||||
|
$(this).addClass("active");
|
||||||
|
setDropdownItem($(this).parent(".dropdown-menu.dropdown-select-menu"));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 預設設備圖像
|
||||||
|
* @param {any} obj
|
||||||
|
*/
|
||||||
|
function defDev(obj) {
|
||||||
|
let defSrc = 'img/defdev.png';
|
||||||
|
obj.src = defSrc;
|
||||||
|
}
|
||||||
|
@ -1338,8 +1338,9 @@ async function download(url, filename) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onEvent(type,selector,callback) {
|
function onEvent(type, selector, callback) {
|
||||||
$("body").on(type, selector, callback)
|
$("body").off(type, selector);
|
||||||
|
$("body").on(type, selector, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,11 +10,14 @@
|
|||||||
* */
|
* */
|
||||||
var YT = YT || {};
|
var YT = YT || {};
|
||||||
|
|
||||||
var _ytTabInited = []
|
var _ytTabInited = [];
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始全頁面 yt tab
|
||||||
|
* */
|
||||||
function initTabsByEle() {
|
function initTabsByEle() {
|
||||||
$("[data-tabname][data-target]:not([data-tabrole=child])").each(function (index, value) {
|
$("[data-tabname][data-target]:not([data-tabrole=child])").each(function (index, value) {
|
||||||
let tabName = $(value).data("tabname");
|
let tabName = $(value).data("tabname");
|
||||||
@ -31,25 +34,31 @@ class YourTeamTab {
|
|||||||
this.init()
|
this.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
init = function() {
|
init = function () {
|
||||||
|
if (_ytTabInited.indexOf(this.tabName) != -1) {
|
||||||
|
_ytTabInited.splice($.inArray(this.tabName, _ytTabInited), 1);
|
||||||
|
$(`[data-tabname=${this.tabName}][data-target]`).off("click").unbind("click");
|
||||||
|
}
|
||||||
this.event();
|
this.event();
|
||||||
$(`[data-tabname=${this.tabName}][data-tabrole=child]`).css("display", "none");
|
$(`[data-tabname=${this.tabName}][data-tabrole=child]`).css("display", "none");
|
||||||
$(`[data-tabname=${this.tabName}][data-target]`).first().click();
|
$(`[data-tabname=${this.tabName}][data-target]`).first().trigger("click");
|
||||||
|
_ytTabInited.push(this.tabName);
|
||||||
}
|
}
|
||||||
|
|
||||||
event = function () {
|
event = function () {
|
||||||
let clsObj = this;
|
let clsObj = this;
|
||||||
// custom tab
|
|
||||||
// example :
|
// Tab Item 按鈕 click
|
||||||
// <button id="test" data-target="#okDiv" data-tabname="tab1"></button>
|
$(`[data-tabname=${this.tabName}][data-target]`).off("click").on("click", function (e) {
|
||||||
// <div id="okDiv" data-tabrole="child" data-tabname="tab1"></div>
|
|
||||||
$("body").on("click", `[data-tabname=${this.tabName}][data-target]`, function () {
|
|
||||||
let target = $(this).data("target");
|
let target = $(this).data("target");
|
||||||
let obj = this;
|
let obj = this;
|
||||||
$(`[data-tabname=${clsObj.tabName}][data-target]:not([data-tabrole=child])`).removeClass("active")
|
$(`[data-tabname=${clsObj.tabName}][data-target]:not([data-tabrole=child])`).removeClass("active");
|
||||||
$(obj).addClass("active")
|
$(obj).addClass("active");
|
||||||
|
// 觸發 yt:tab:change事件
|
||||||
|
$(obj).trigger("yt:tab:change");
|
||||||
let tabName = $(target).data("tabname");
|
let tabName = $(target).data("tabname");
|
||||||
if (tabName) {
|
if (tabName) {
|
||||||
|
// 找出該觸發對象 block
|
||||||
if ($(target).data("tabrole") == "child") {
|
if ($(target).data("tabrole") == "child") {
|
||||||
$(obj).trigger("yt:tab:show");
|
$(obj).trigger("yt:tab:show");
|
||||||
$(`[data-tabname='${tabName}'][data-tabrole='child']`).css("opacity", 0).hide();
|
$(`[data-tabname='${tabName}'][data-tabrole='child']`).css("opacity", 0).hide();
|
||||||
|
@ -30,6 +30,7 @@ $.fn.YTTooltip = function (option) {
|
|||||||
toggle: option.toggle || "click",
|
toggle: option.toggle || "click",
|
||||||
hideTooltipEvent: hideTooltipEvent,
|
hideTooltipEvent: hideTooltipEvent,
|
||||||
onShow: option.onShow || null,
|
onShow: option.onShow || null,
|
||||||
|
group: option.group || null,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (obj.toggle == "hover") {
|
if (obj.toggle == "hover") {
|
||||||
@ -42,7 +43,6 @@ $.fn.YTTooltip = function (option) {
|
|||||||
//顯示 tooltip 程序 及 存入已顯示紀錄arr
|
//顯示 tooltip 程序 及 存入已顯示紀錄arr
|
||||||
if (!tooId || obj.isShowArr.indexOf(tooId) == -1) {
|
if (!tooId || obj.isShowArr.indexOf(tooId) == -1) {
|
||||||
let ranId = Math.floor((Math.random() * (9999999 - 1000000)) + 1000000);
|
let ranId = Math.floor((Math.random() * (9999999 - 1000000)) + 1000000);
|
||||||
obj.isShowArr.push(ranId);
|
|
||||||
let clone = $(obj.html);
|
let clone = $(obj.html);
|
||||||
//body 元素 高寬
|
//body 元素 高寬
|
||||||
let bodyWidth = $("body")[0].offsetWidth;
|
let bodyWidth = $("body")[0].offsetWidth;
|
||||||
@ -54,12 +54,24 @@ $.fn.YTTooltip = function (option) {
|
|||||||
let height = $(this)[0].offsetHeight;
|
let height = $(this)[0].offsetHeight;
|
||||||
|
|
||||||
$(this).data("yttooltipid", ranId);
|
$(this).data("yttooltipid", ranId);
|
||||||
$(clone).attr("id", "yt_tooltip_" + ranId)
|
$(clone).attr("id", "yt_tooltip_" + ranId);
|
||||||
|
if (obj.group) {
|
||||||
|
$(clone).data("group", obj.group).attr("data-group", obj.group);
|
||||||
|
}
|
||||||
|
//同一 group tooltip 先隱藏 (只顯示一個)
|
||||||
|
if (obj.group) {
|
||||||
|
$(`body [id^=yt_tooltip_][data-group=${obj.group}]`).each((index, groTooEle) => {
|
||||||
|
let eleId = $(groTooEle).prop("id").split("yt_tooltip_")[1];
|
||||||
|
obj.hideTooltipEvent(eleId);
|
||||||
|
})
|
||||||
|
}
|
||||||
$("body").append(clone);
|
$("body").append(clone);
|
||||||
|
//push 已顯示紀錄
|
||||||
|
obj.isShowArr.push(ranId);
|
||||||
obj.tooltipDiv = clone;
|
obj.tooltipDiv = clone;
|
||||||
//顯示 tooltip
|
//顯示 tooltip
|
||||||
$(clone).css({ "display": display, "position": "absolute" });
|
$(clone).css({ "display": display, "position": "absolute" });
|
||||||
obj.onShow ? obj.onShow(clone,obj) : "";
|
obj.onShow ? obj.onShow(clone,obj.ele,obj) : "";
|
||||||
//tooltip 高寬
|
//tooltip 高寬
|
||||||
let toolWidth = $(clone)[0].offsetWidth;
|
let toolWidth = $(clone)[0].offsetWidth;
|
||||||
let toolHeight = $(clone)[0].offsetHeight;
|
let toolHeight = $(clone)[0].offsetHeight;
|
||||||
@ -108,13 +120,14 @@ $.fn.YTTooltip = function (option) {
|
|||||||
|
|
||||||
|
|
||||||
function hideTooltipEvent(tooId) {
|
function hideTooltipEvent(tooId) {
|
||||||
$("#yt_tooltip_" + tooId).hide();
|
$("#yt_tooltip_" + tooId).remove();
|
||||||
setTimeout(function () {
|
obj.isShowArr.splice($.inArray(tooId, obj.isShowArr), 1);
|
||||||
if ($("#yt_tooltip_" + tooId).css("display") == "none") {
|
//setTimeout(function () {
|
||||||
obj.isShowArr.splice($.inArray(tooId, obj.isShowArr), 1);
|
// if ($("#yt_tooltip_" + tooId).css("display") == "none") {
|
||||||
$("#yt_tooltip_" + tooId).remove();
|
// obj.isShowArr.splice($.inArray(tooId, obj.isShowArr), 1);
|
||||||
}
|
// $("#yt_tooltip_" + tooId).remove();
|
||||||
}, 100)
|
// }
|
||||||
|
//}, 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ class Ajax {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
this.dataType = dataType;
|
this.dataType = dataType;
|
||||||
this.sendData = sendData;
|
this.sendData = sendData;
|
||||||
|
this.extSuccessFunction = successFunction;
|
||||||
/*if (successFunction) this.successFunction = successFunction;*/
|
/*if (successFunction) this.successFunction = successFunction;*/
|
||||||
if (errorFunction) this.errorFunction = errorFunction;
|
if (errorFunction) this.errorFunction = errorFunction;
|
||||||
return this;
|
return this;
|
||||||
@ -128,9 +129,9 @@ class Ajax {
|
|||||||
if (sendData) {
|
if (sendData) {
|
||||||
this.sendData = sendData;
|
this.sendData = sendData;
|
||||||
}
|
}
|
||||||
//if (successFunction) {
|
if (successFunction) {
|
||||||
// this.successFunction = successFunction;
|
this.successFunction = successFunction;
|
||||||
//}
|
}
|
||||||
if (errorFunction) {
|
if (errorFunction) {
|
||||||
this.errorFunction = errorFunction;
|
this.errorFunction = errorFunction;
|
||||||
}
|
}
|
||||||
@ -148,11 +149,11 @@ class Ajax {
|
|||||||
//processData: false,
|
//processData: false,
|
||||||
|
|
||||||
beforeSend: this.beforeSendFunction,
|
beforeSend: this.beforeSendFunction,
|
||||||
success:(data) => this.successFunction(data,successFunction),
|
success: (data) => this.successFunction(data, this.extSuccessFunction),
|
||||||
error: this.errorFunction,
|
error: this.errorFunction,
|
||||||
complete: this.completeFunction,
|
complete: this.completeFunction,
|
||||||
statusCode: {
|
statusCode: {
|
||||||
201: (data) => this.successFunction(data,successFunction),
|
201: (data) => this.successFunction(data, this.extSuccessFunction),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -58,52 +58,52 @@ function fnInitJqDataTablesNoData(tag, dataSet = null, columns = null, columnDef
|
|||||||
"columns": columns,
|
"columns": columns,
|
||||||
"aoColumnDefs": columnDefs,
|
"aoColumnDefs": columnDefs,
|
||||||
"stateSave": true,
|
"stateSave": true,
|
||||||
"pagingType": "full_numbers_custom",
|
"pagingType": "simple",
|
||||||
"destroy": false,
|
"destroy": false,
|
||||||
"initComplete": initComplete,
|
"initComplete": initComplete,
|
||||||
"drawCallback": fnDrawCallBack,
|
"drawCallback": fnDrawCallBack,
|
||||||
"rowsGroup": rowsGroup,
|
//"rowsGroup": rowsGroup,
|
||||||
"rowGroup": rowGroup,
|
//"rowGroup": rowGroup,
|
||||||
"retrieve": true,
|
"retrieve": true,
|
||||||
"responsive": {
|
//"responsive": {
|
||||||
details: {
|
// details: {
|
||||||
|
|
||||||
target: '.dt-mobile-btn',
|
// target: '.dt-mobile-btn',
|
||||||
type: "column",
|
// type: "column",
|
||||||
renderer: function (api, rowIdx, columns) {
|
// renderer: function (api, rowIdx, columns) {
|
||||||
var data = $.map(columns, function (col, i) {
|
// var data = $.map(columns, function (col, i) {
|
||||||
return col.hidden ?
|
// return col.hidden ?
|
||||||
'<tr data-dt-row="' + col.rowIndex + '" data-dt-column="' + col.columnIndex + '">' +
|
// '<tr data-dt-row="' + col.rowIndex + '" data-dt-column="' + col.columnIndex + '">' +
|
||||||
'<td>' + col.title + ':' + '</td> ' +
|
// '<td>' + col.title + ':' + '</td> ' +
|
||||||
'<td>' + col.data + '</td>' +
|
// '<td>' + col.data + '</td>' +
|
||||||
'</tr>' :
|
// '</tr>' :
|
||||||
'';
|
// '';
|
||||||
}).join('');
|
// }).join('');
|
||||||
|
|
||||||
return data ?
|
// return data ?
|
||||||
$('<table/>').append(data) :
|
// $('<table/>').append(data) :
|
||||||
false;
|
// false;
|
||||||
},
|
// },
|
||||||
|
|
||||||
},
|
// },
|
||||||
},
|
//},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let time = 0;
|
let time = 0;
|
||||||
table = $(tag).DataTable(oTable);
|
table = $(tag).DataTable(oTable);
|
||||||
table.on('processing', function (e, settings, processing) {
|
table.on('processing', function (e, settings, processing) {
|
||||||
//過100ms的讀取才秀出loading
|
////過100ms的讀取才秀出loading
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
time == 1 ? loadingSetting("show", "dtProcessing") : "";
|
// time == 1 ? loadingSetting("show", "dtProcessing") : "";
|
||||||
}, 100);
|
//}, 100);
|
||||||
|
|
||||||
if (processing && time == 0) { //第一次讀取processing = true
|
//if (processing && time == 0) { //第一次讀取processing = true
|
||||||
time = 1;
|
// time = 1;
|
||||||
} else if (!processing && time == 1 ) { //結束讀取後processing = false
|
//} else if (!processing && time == 1 ) { //結束讀取後processing = false
|
||||||
loadingSetting("hide", "dtProcessing");
|
// loadingSetting("hide", "dtProcessing");
|
||||||
time = 0;
|
// time = 0;
|
||||||
}
|
//}
|
||||||
})
|
})
|
||||||
table.on('responsive-display', function (e, datatable, row, showHide, update ) {
|
table.on('responsive-display', function (e, datatable, row, showHide, update ) {
|
||||||
table.columns.adjust();
|
table.columns.adjust();
|
||||||
@ -222,16 +222,16 @@ function fnInitJqDataTablesAjax(apiUrl, tag, sendData = null, columns, columns_d
|
|||||||
table = $(tag).DataTable(oTable);
|
table = $(tag).DataTable(oTable);
|
||||||
table.on('processing', function (e, settings, processing) {
|
table.on('processing', function (e, settings, processing) {
|
||||||
//過100ms的讀取才秀出loading
|
//過100ms的讀取才秀出loading
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
time == 1 ? loadingSetting("show", "dtProcessing") : "";
|
// time == 1 ? loadingSetting("show", "dtProcessing") : "";
|
||||||
}, 100);
|
//}, 100);
|
||||||
|
|
||||||
if (processing && time != 1) { //第一次讀取processing = true
|
//if (processing && time != 1) { //第一次讀取processing = true
|
||||||
time = 1;
|
// time = 1;
|
||||||
} else if (!processing && time == 1) { //結束讀取後processing = false
|
//} else if (!processing && time == 1) { //結束讀取後processing = false
|
||||||
loadingSetting("hide", "dtProcessing");
|
// loadingSetting("hide", "dtProcessing");
|
||||||
time = 0;
|
// time = 0;
|
||||||
}
|
//}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
@ -369,16 +369,16 @@ function fnInitJqDataTablesServerSideAjax(apiUrl, tag, sendData, columns, column
|
|||||||
console.log($.fn.DataTable.ext.pager)
|
console.log($.fn.DataTable.ext.pager)
|
||||||
table.on('processing', function (e, settings, processing) {
|
table.on('processing', function (e, settings, processing) {
|
||||||
//過100ms的讀取才秀出loading
|
//過100ms的讀取才秀出loading
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
time == 1 ? loadingSetting("show", "pageload") : "";
|
// time == 1 ? loadingSetting("show", "pageload") : "";
|
||||||
}, 100);
|
//}, 100);
|
||||||
|
|
||||||
if (processing && time == 0) { //第一次讀取processing = true
|
//if (processing && time == 0) { //第一次讀取processing = true
|
||||||
time = 1;
|
// time = 1;
|
||||||
} else if (!processing && time == 1 && tableStatus != 2){ //結束讀取後processing = false
|
//} else if (!processing && time == 1 && tableStatus != 2){ //結束讀取後processing = false
|
||||||
loadingSetting("hide", "pageload");
|
// loadingSetting("hide", "pageload");
|
||||||
time = 0;
|
// time = 0;
|
||||||
}
|
//}
|
||||||
})
|
})
|
||||||
|
|
||||||
table.on('xhr', function (e, settings, json, xhr) {
|
table.on('xhr', function (e, settings, json, xhr) {
|
||||||
@ -608,15 +608,15 @@ function serverSideExecLimit() {
|
|||||||
|
|
||||||
//tableStatus = 2 | 已觸發執行,不可接受執行(超出執行條件)
|
//tableStatus = 2 | 已觸發執行,不可接受執行(超出執行條件)
|
||||||
if (tableStatus == 2) {
|
if (tableStatus == 2) {
|
||||||
showAlert("danger", "執行次數過多!")
|
//showAlert("danger", "執行次數過多!")
|
||||||
loadingSetting("show","dtServerSide"); //出現loading
|
//loadingSetting("show","dtServerSide"); //出現loading
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
loadingSetting("hide", "dtServerSide");
|
// loadingSetting("hide", "dtServerSide");
|
||||||
pageEventNum = searchEventNum = orderEventNum = 0 //執行次數復歸
|
// pageEventNum = searchEventNum = orderEventNum = 0 //執行次數復歸
|
||||||
timeNum = 0 //秒數歸零
|
// timeNum = 0 //秒數歸零
|
||||||
tableStatus = 0 //狀態復歸
|
// tableStatus = 0 //狀態復歸
|
||||||
clearInterval(calEventTime) //計數關閉
|
// clearInterval(calEventTime) //計數關閉
|
||||||
}, 5000)
|
//}, 5000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,476 +0,0 @@
|
|||||||
/*
|
|
||||||
* Toastr
|
|
||||||
* Copyright 2012-2015
|
|
||||||
* Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
|
|
||||||
* All Rights Reserved.
|
|
||||||
* Use, reproduction, distribution, and modification of this code is subject to the terms and
|
|
||||||
* conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
|
|
||||||
*
|
|
||||||
* ARIA Support: Greta Krafsig
|
|
||||||
*
|
|
||||||
* Project: https://github.com/CodeSeven/toastr
|
|
||||||
*/
|
|
||||||
/* global define */
|
|
||||||
(function (define) {
|
|
||||||
define(['jquery'], function ($) {
|
|
||||||
return (function () {
|
|
||||||
var $container;
|
|
||||||
var listener;
|
|
||||||
var toastId = 0;
|
|
||||||
var toastType = {
|
|
||||||
error: 'error',
|
|
||||||
info: 'info',
|
|
||||||
success: 'success',
|
|
||||||
warning: 'warning'
|
|
||||||
};
|
|
||||||
|
|
||||||
var toastr = {
|
|
||||||
clear: clear,
|
|
||||||
remove: remove,
|
|
||||||
error: error,
|
|
||||||
getContainer: getContainer,
|
|
||||||
info: info,
|
|
||||||
options: {},
|
|
||||||
subscribe: subscribe,
|
|
||||||
success: success,
|
|
||||||
version: '2.1.4',
|
|
||||||
warning: warning
|
|
||||||
};
|
|
||||||
|
|
||||||
var previousToast;
|
|
||||||
|
|
||||||
return toastr;
|
|
||||||
|
|
||||||
////////////////
|
|
||||||
|
|
||||||
function error(message, title, optionsOverride) {
|
|
||||||
return notify({
|
|
||||||
type: toastType.error,
|
|
||||||
iconClass: getOptions().iconClasses.error,
|
|
||||||
message: message,
|
|
||||||
optionsOverride: optionsOverride,
|
|
||||||
title: title
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getContainer(options, create) {
|
|
||||||
if (!options) { options = getOptions(); }
|
|
||||||
$container = $('#' + options.containerId);
|
|
||||||
if ($container.length) {
|
|
||||||
return $container;
|
|
||||||
}
|
|
||||||
if (create) {
|
|
||||||
$container = createContainer(options);
|
|
||||||
}
|
|
||||||
return $container;
|
|
||||||
}
|
|
||||||
|
|
||||||
function info(message, title, optionsOverride) {
|
|
||||||
return notify({
|
|
||||||
type: toastType.info,
|
|
||||||
iconClass: getOptions().iconClasses.info,
|
|
||||||
message: message,
|
|
||||||
optionsOverride: optionsOverride,
|
|
||||||
title: title
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function subscribe(callback) {
|
|
||||||
listener = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
function success(message, title, optionsOverride) {
|
|
||||||
return notify({
|
|
||||||
type: toastType.success,
|
|
||||||
iconClass: getOptions().iconClasses.success,
|
|
||||||
message: message,
|
|
||||||
optionsOverride: optionsOverride,
|
|
||||||
title: title
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function warning(message, title, optionsOverride) {
|
|
||||||
return notify({
|
|
||||||
type: toastType.warning,
|
|
||||||
iconClass: getOptions().iconClasses.warning,
|
|
||||||
message: message,
|
|
||||||
optionsOverride: optionsOverride,
|
|
||||||
title: title
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function clear($toastElement, clearOptions) {
|
|
||||||
var options = getOptions();
|
|
||||||
if (!$container) { getContainer(options); }
|
|
||||||
if (!clearToast($toastElement, options, clearOptions)) {
|
|
||||||
clearContainer(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function remove($toastElement) {
|
|
||||||
var options = getOptions();
|
|
||||||
if (!$container) { getContainer(options); }
|
|
||||||
if ($toastElement && $(':focus', $toastElement).length === 0) {
|
|
||||||
removeToast($toastElement);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ($container.children().length) {
|
|
||||||
$container.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// internal functions
|
|
||||||
|
|
||||||
function clearContainer (options) {
|
|
||||||
var toastsToClear = $container.children();
|
|
||||||
for (var i = toastsToClear.length - 1; i >= 0; i--) {
|
|
||||||
clearToast($(toastsToClear[i]), options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearToast ($toastElement, options, clearOptions) {
|
|
||||||
var force = clearOptions && clearOptions.force ? clearOptions.force : false;
|
|
||||||
if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
|
|
||||||
$toastElement[options.hideMethod]({
|
|
||||||
duration: options.hideDuration,
|
|
||||||
easing: options.hideEasing,
|
|
||||||
complete: function () { removeToast($toastElement); }
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createContainer(options) {
|
|
||||||
$container = $('<div/>')
|
|
||||||
.attr('id', options.containerId)
|
|
||||||
.addClass(options.positionClass);
|
|
||||||
|
|
||||||
$container.appendTo($(options.target));
|
|
||||||
return $container;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDefaults() {
|
|
||||||
return {
|
|
||||||
tapToDismiss: true,
|
|
||||||
toastClass: 'toast',
|
|
||||||
containerId: 'toast-container',
|
|
||||||
debug: false,
|
|
||||||
|
|
||||||
showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
|
|
||||||
showDuration: 300,
|
|
||||||
showEasing: 'swing', //swing and linear are built into jQuery
|
|
||||||
onShown: undefined,
|
|
||||||
hideMethod: 'fadeOut',
|
|
||||||
hideDuration: 1000,
|
|
||||||
hideEasing: 'swing',
|
|
||||||
onHidden: undefined,
|
|
||||||
closeMethod: false,
|
|
||||||
closeDuration: false,
|
|
||||||
closeEasing: false,
|
|
||||||
closeOnHover: true,
|
|
||||||
|
|
||||||
extendedTimeOut: 1000,
|
|
||||||
iconClasses: {
|
|
||||||
error: 'toast-error',
|
|
||||||
info: 'toast-info',
|
|
||||||
success: 'toast-success',
|
|
||||||
warning: 'toast-warning'
|
|
||||||
},
|
|
||||||
iconClass: 'toast-info',
|
|
||||||
positionClass: 'toast-top-right',
|
|
||||||
timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
|
|
||||||
titleClass: 'toast-title',
|
|
||||||
messageClass: 'toast-message',
|
|
||||||
escapeHtml: false,
|
|
||||||
target: 'body',
|
|
||||||
closeHtml: '<button type="button">×</button>',
|
|
||||||
closeClass: 'toast-close-button',
|
|
||||||
newestOnTop: true,
|
|
||||||
preventDuplicates: false,
|
|
||||||
progressBar: false,
|
|
||||||
progressClass: 'toast-progress',
|
|
||||||
rtl: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function publish(args) {
|
|
||||||
if (!listener) { return; }
|
|
||||||
listener(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
function notify(map) {
|
|
||||||
var options = getOptions();
|
|
||||||
var iconClass = map.iconClass || options.iconClass;
|
|
||||||
|
|
||||||
if (typeof (map.optionsOverride) !== 'undefined') {
|
|
||||||
options = $.extend(options, map.optionsOverride);
|
|
||||||
iconClass = map.optionsOverride.iconClass || iconClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldExit(options, map)) { return; }
|
|
||||||
|
|
||||||
toastId++;
|
|
||||||
|
|
||||||
$container = getContainer(options, true);
|
|
||||||
|
|
||||||
var intervalId = null;
|
|
||||||
var $toastElement = $('<div/>');
|
|
||||||
var $titleElement = $('<div/>');
|
|
||||||
var $messageElement = $('<div/>');
|
|
||||||
var $progressElement = $('<div/>');
|
|
||||||
var $closeElement = $(options.closeHtml);
|
|
||||||
var progressBar = {
|
|
||||||
intervalId: null,
|
|
||||||
hideEta: null,
|
|
||||||
maxHideTime: null
|
|
||||||
};
|
|
||||||
var response = {
|
|
||||||
toastId: toastId,
|
|
||||||
state: 'visible',
|
|
||||||
startTime: new Date(),
|
|
||||||
options: options,
|
|
||||||
map: map
|
|
||||||
};
|
|
||||||
|
|
||||||
personalizeToast();
|
|
||||||
|
|
||||||
displayToast();
|
|
||||||
|
|
||||||
handleEvents();
|
|
||||||
|
|
||||||
publish(response);
|
|
||||||
|
|
||||||
if (options.debug && console) {
|
|
||||||
console.log(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $toastElement;
|
|
||||||
|
|
||||||
function escapeHtml(source) {
|
|
||||||
if (source == null) {
|
|
||||||
source = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return source
|
|
||||||
.replace(/&/g, '&')
|
|
||||||
.replace(/"/g, '"')
|
|
||||||
.replace(/'/g, ''')
|
|
||||||
.replace(/</g, '<')
|
|
||||||
.replace(/>/g, '>');
|
|
||||||
}
|
|
||||||
|
|
||||||
function personalizeToast() {
|
|
||||||
setIcon();
|
|
||||||
setTitle();
|
|
||||||
setMessage();
|
|
||||||
setCloseButton();
|
|
||||||
setProgressBar();
|
|
||||||
setRTL();
|
|
||||||
setSequence();
|
|
||||||
setAria();
|
|
||||||
}
|
|
||||||
|
|
||||||
function setAria() {
|
|
||||||
var ariaValue = '';
|
|
||||||
switch (map.iconClass) {
|
|
||||||
case 'toast-success':
|
|
||||||
case 'toast-info':
|
|
||||||
ariaValue = 'polite';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ariaValue = 'assertive';
|
|
||||||
}
|
|
||||||
$toastElement.attr('aria-live', ariaValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleEvents() {
|
|
||||||
if (options.closeOnHover) {
|
|
||||||
$toastElement.hover(stickAround, delayedHideToast);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!options.onclick && options.tapToDismiss) {
|
|
||||||
$toastElement.click(hideToast);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.closeButton && $closeElement) {
|
|
||||||
$closeElement.click(function (event) {
|
|
||||||
if (event.stopPropagation) {
|
|
||||||
event.stopPropagation();
|
|
||||||
} else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
|
|
||||||
event.cancelBubble = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.onCloseClick) {
|
|
||||||
options.onCloseClick(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
hideToast(true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.onclick) {
|
|
||||||
$toastElement.click(function (event) {
|
|
||||||
options.onclick(event);
|
|
||||||
hideToast();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function displayToast() {
|
|
||||||
$toastElement.hide();
|
|
||||||
|
|
||||||
$toastElement[options.showMethod](
|
|
||||||
{duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (options.timeOut > 0) {
|
|
||||||
intervalId = setTimeout(hideToast, options.timeOut);
|
|
||||||
progressBar.maxHideTime = parseFloat(options.timeOut);
|
|
||||||
progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
|
|
||||||
if (options.progressBar) {
|
|
||||||
progressBar.intervalId = setInterval(updateProgress, 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setIcon() {
|
|
||||||
if (map.iconClass) {
|
|
||||||
$toastElement.addClass(options.toastClass).addClass(iconClass);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setSequence() {
|
|
||||||
if (options.newestOnTop) {
|
|
||||||
$container.prepend($toastElement);
|
|
||||||
} else {
|
|
||||||
$container.append($toastElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setTitle() {
|
|
||||||
if (map.title) {
|
|
||||||
var suffix = map.title;
|
|
||||||
if (options.escapeHtml) {
|
|
||||||
suffix = escapeHtml(map.title);
|
|
||||||
}
|
|
||||||
$titleElement.append(suffix).addClass(options.titleClass);
|
|
||||||
$toastElement.append($titleElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setMessage() {
|
|
||||||
if (map.message) {
|
|
||||||
var suffix = map.message;
|
|
||||||
if (options.escapeHtml) {
|
|
||||||
suffix = escapeHtml(map.message);
|
|
||||||
}
|
|
||||||
$messageElement.append(suffix).addClass(options.messageClass);
|
|
||||||
$toastElement.append($messageElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCloseButton() {
|
|
||||||
if (options.closeButton) {
|
|
||||||
$closeElement.addClass(options.closeClass).attr('role', 'button');
|
|
||||||
$toastElement.prepend($closeElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setProgressBar() {
|
|
||||||
if (options.progressBar) {
|
|
||||||
$progressElement.addClass(options.progressClass);
|
|
||||||
$toastElement.prepend($progressElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setRTL() {
|
|
||||||
if (options.rtl) {
|
|
||||||
$toastElement.addClass('rtl');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function shouldExit(options, map) {
|
|
||||||
if (options.preventDuplicates) {
|
|
||||||
if (map.message === previousToast) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
previousToast = map.message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideToast(override) {
|
|
||||||
var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
|
|
||||||
var duration = override && options.closeDuration !== false ?
|
|
||||||
options.closeDuration : options.hideDuration;
|
|
||||||
var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
|
|
||||||
if ($(':focus', $toastElement).length && !override) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
clearTimeout(progressBar.intervalId);
|
|
||||||
return $toastElement[method]({
|
|
||||||
duration: duration,
|
|
||||||
easing: easing,
|
|
||||||
complete: function () {
|
|
||||||
removeToast($toastElement);
|
|
||||||
clearTimeout(intervalId);
|
|
||||||
if (options.onHidden && response.state !== 'hidden') {
|
|
||||||
options.onHidden();
|
|
||||||
}
|
|
||||||
response.state = 'hidden';
|
|
||||||
response.endTime = new Date();
|
|
||||||
publish(response);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function delayedHideToast() {
|
|
||||||
if (options.timeOut > 0 || options.extendedTimeOut > 0) {
|
|
||||||
intervalId = setTimeout(hideToast, options.extendedTimeOut);
|
|
||||||
progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
|
|
||||||
progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function stickAround() {
|
|
||||||
clearTimeout(intervalId);
|
|
||||||
progressBar.hideEta = 0;
|
|
||||||
$toastElement.stop(true, true)[options.showMethod](
|
|
||||||
{duration: options.showDuration, easing: options.showEasing}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateProgress() {
|
|
||||||
var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
|
|
||||||
$progressElement.width(percentage + '%');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getOptions() {
|
|
||||||
return $.extend({}, getDefaults(), toastr.options);
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeToast($toastElement) {
|
|
||||||
if (!$container) { $container = getContainer(); }
|
|
||||||
if ($toastElement.is(':visible')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$toastElement.remove();
|
|
||||||
$toastElement = null;
|
|
||||||
if ($container.children().length === 0) {
|
|
||||||
$container.remove();
|
|
||||||
previousToast = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
|
||||||
});
|
|
||||||
}(typeof define === 'function' && define.amd ? define : function (deps, factory) {
|
|
||||||
if (typeof module !== 'undefined' && module.exports) { //Node
|
|
||||||
module.exports = factory(require('jquery'));
|
|
||||||
} else {
|
|
||||||
window.toastr = factory(window.jQuery);
|
|
||||||
}
|
|
||||||
}));
|
|
1
Frontend/lib/notifications/toastr/toastr.min.css
vendored
Normal file
1
Frontend/lib/notifications/toastr/toastr.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
2
Frontend/lib/notifications/toastr/toastr.min.js
vendored
Normal file
2
Frontend/lib/notifications/toastr/toastr.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -15,6 +15,7 @@
|
|||||||
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon/favicon-32x32.png">
|
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon/favicon-32x32.png">
|
||||||
<link rel="mask-icon" href="img/favicon/safari-pinned-tab.svg" color="#5bbad5">
|
<link rel="mask-icon" href="img/favicon/safari-pinned-tab.svg" color="#5bbad5">
|
||||||
<link rel="stylesheet" media="screen, print" href="lib/page-login-alt.css">
|
<link rel="stylesheet" media="screen, print" href="lib/page-login-alt.css">
|
||||||
|
<link rel="stylesheet" href="lib/notifications/toastr/toastr.min.css" />
|
||||||
|
|
||||||
<!-- Font Awesome -->
|
<!-- Font Awesome -->
|
||||||
<link href="lib/fontawesome-free/css/all.min.css" rel="stylesheet" />
|
<link href="lib/fontawesome-free/css/all.min.css" rel="stylesheet" />
|
||||||
@ -26,7 +27,7 @@
|
|||||||
<div class="blankpage-form-field">
|
<div class="blankpage-form-field">
|
||||||
<div class="page-logo m-0 w-100 align-items-center justify-content-center rounded border-bottom-left-radius-0 border-bottom-right-radius-0 px-4">
|
<div class="page-logo m-0 w-100 align-items-center justify-content-center rounded border-bottom-left-radius-0 border-bottom-right-radius-0 px-4">
|
||||||
<div class="page-logo-link press-scale-down d-flex align-items-center">
|
<div class="page-logo-link press-scale-down d-flex align-items-center">
|
||||||
<img src="/img/logo.png" aria-roledescription="logo">
|
<img src="img/logo.png" aria-roledescription="logo">
|
||||||
<span class="page-logo-text mr-1">全方位監控系統</span>
|
<span class="page-logo-text mr-1">全方位監控系統</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -69,14 +70,14 @@
|
|||||||
</video>
|
</video>
|
||||||
<!--Base JS-->
|
<!--Base JS-->
|
||||||
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
|
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
|
||||||
<script src="lib//vendors.bundle.js"></script>
|
<script src="lib/vendors.bundle.js"></script>
|
||||||
<script src="lib//app.bundle.js"></script>
|
<script src="lib/app.bundle.js"></script>
|
||||||
<!-- JQuery Validate -->
|
<!-- JQuery Validate -->
|
||||||
<script src="lib/jquery-validation/dist/jquery.validate.js"></script>
|
<script src="lib/jquery-validation/dist/jquery.validate.js"></script>
|
||||||
<script src="lib/jquery-validation/dist/additional-methods.min.js"></script>
|
<script src="lib/jquery-validation/dist/additional-methods.min.js"></script>
|
||||||
<script src="lib/jquery-validation/dist/localization/messages_zh_TW.js"></script>
|
<script src="lib/jquery-validation/dist/localization/messages_zh_TW.js"></script>
|
||||||
<script src="lib/notifications/sweetalert2/sweetalert2.bundle.js"></script>
|
<script src="lib/notifications/sweetalert2/sweetalert2.bundle.js"></script>
|
||||||
<script src="lib/notifications/toastr/toastr.js"></script>
|
<script src="lib/notifications/toastr/toastr.min.js"></script>
|
||||||
<script src="js/toast.js"></script>
|
<script src="js/toast.js"></script>
|
||||||
<script src="js/init.js"></script>
|
<script src="js/init.js"></script>
|
||||||
</body>
|
</body>
|
||||||
@ -180,15 +181,11 @@
|
|||||||
|
|
||||||
//rel = JSON.stringify(rel);
|
//rel = JSON.stringify(rel);
|
||||||
if (rel.code != "0000") {
|
if (rel.code != "0000") {
|
||||||
if (rel.code == "9999") {
|
toast_error(rel.msg || "系統內部發生錯誤,請聯絡系統管理員");
|
||||||
toast_error(rel.msg);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
toast_ok(rel.msg);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
toast_ok(rel.msg);
|
||||||
localStorage.setItem('JWT-Authorization', rel.data.token);
|
localStorage.setItem('JWT-Authorization', rel.data.token);
|
||||||
location.href = "index.html";
|
location.href = "index.html";
|
||||||
return;
|
return;
|
||||||
|
@ -132,7 +132,7 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sqlString = $@"select floor_tag, full_name from floor where deleted = 0 and building_tag = @building_tag";
|
var sqlString = $@"select full_name as floor_tag from floor where deleted = 0 and building_tag = @building_tag";
|
||||||
var param = new { @building_tag = fd.building_tag };
|
var param = new { @building_tag = fd.building_tag };
|
||||||
var fl = await backendRepository.GetAllAsync<FloorList>(sqlString, param);
|
var fl = await backendRepository.GetAllAsync<FloorList>(sqlString, param);
|
||||||
|
|
||||||
@ -175,17 +175,17 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sqlString = $@"select floor_tag, full_name, InitMapName as map_name, floor_map_name + '.svg' as floor_map_name from floor where deleted = 0 and building_tag = @building_tag and full_name = ifnull(@floor_tag, full_name)";
|
var sqlString = $@"select full_name, InitMapName as map_name, floor_map_name + '.svg' as floor_map_name from floor where deleted = 0 and building_tag = @building_tag and full_name = ifnull(@floor_tag, full_name)";
|
||||||
var param = new { @building_tag = fd.building_tag, @floor_tag = fd.floor_tag };
|
var param = new { @building_tag = fd.building_tag, @floor_tag = fd.floor_tag };
|
||||||
var fl = await backendRepository.GetAllAsync<FloorList>(sqlString, param);
|
var fl = await backendRepository.GetAllAsync<FloorList>(sqlString, param);
|
||||||
|
|
||||||
foreach (var f in fl)
|
foreach (var f in fl)
|
||||||
{
|
{
|
||||||
List<DeviceLists> dl = new List<DeviceLists>();
|
List<DeviceLists> dl = new List<DeviceLists>();
|
||||||
sqlString = $@"select d.device_guid, d.device_last_name, d.status, d.device_coordinate, dm.device_master_icon
|
sqlString = $@"select d.device_guid, d.full_name, d.status, d.device_coordinate, dm.device_master_icon,d.device_number
|
||||||
from device d
|
from device d
|
||||||
left join device_master dm on d.device_building_tag = dm.device_building_tag and d.device_name_tag = dm.device_name_tag and dm.deleted = 0
|
left join device_master dm on d.device_building_tag = dm.device_building_tag and d.device_name_tag = dm.device_name_tag
|
||||||
where deleted = 0 and device_system_tag = @main_system_tag and device_building_tag = @building_tag and device_floor_tag = ifnull(@floor_tag, device_floor_tag)";
|
where d.deleted = 0 and d.device_system_tag = @main_system_tag and d.device_building_tag = @building_tag and d.device_floor_tag = ifnull(@floor_tag, d.device_floor_tag)";
|
||||||
var dlParam = new { @main_system_tag = fd.main_system_tag, @building_tag = fd.building_tag, @floor_tag = fd.floor_tag };
|
var dlParam = new { @main_system_tag = fd.main_system_tag, @building_tag = fd.building_tag, @floor_tag = fd.floor_tag };
|
||||||
dl = await backendRepository.GetAllAsync<DeviceLists>(sqlString, dlParam);
|
dl = await backendRepository.GetAllAsync<DeviceLists>(sqlString, dlParam);
|
||||||
f.device_list = dl;
|
f.device_list = dl;
|
||||||
|
@ -30,6 +30,7 @@ namespace FrontendWebApi.Models
|
|||||||
public class DeviceLists
|
public class DeviceLists
|
||||||
{
|
{
|
||||||
public string device_guid { get; set; }
|
public string device_guid { get; set; }
|
||||||
|
public string device_number { get; set; }
|
||||||
public string full_name { get; set; }
|
public string full_name { get; set; }
|
||||||
public string device_coordinate { get; set; }
|
public string device_coordinate { get; set; }
|
||||||
public string device_coordinate_3d { get; set; }
|
public string device_coordinate_3d { get; set; }
|
||||||
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 2.0 MiB |
Loading…
Reference in New Issue
Block a user