歷史資料完成獲取資料
This commit is contained in:
parent
2af5307c50
commit
f1d67fb62e
@ -59,11 +59,6 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>儲冰設備A01</td>
|
||||
<td>27.0</td>
|
||||
<td>2021-08-01 23:55:00</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -123,7 +118,7 @@
|
||||
|
||||
$.each(val2.device, function (index3, val3) {
|
||||
strHtml += `<li>
|
||||
<a href="#" onClick=setValue('${val3.device_number}', '${val3.full_name}') data-filter-tags="user interface buttons" data-devnum="${val3.device_number}">
|
||||
<a href="#" onClick="setValue('${val3.device_number}', '${val3.full_name}', null)" data-filter-tags="user interface buttons" data-devnum="${val3.device_number}">
|
||||
<span class="nav-link-text">
|
||||
${val3.full_name} ${val3.device_serial_tag}
|
||||
</span>
|
||||
@ -131,8 +126,9 @@
|
||||
</li>`;
|
||||
|
||||
if (index == i1 && index2 == i2 && first) {
|
||||
first = false;
|
||||
pageAct.deviceNumber = val3.device_number;
|
||||
pageAct.deviceSerialTag = val3.device_serial_tag;
|
||||
pageAct.deviceName = val3.full_name;
|
||||
devPointsList();
|
||||
}
|
||||
});
|
||||
@ -160,7 +156,7 @@
|
||||
|
||||
if (index == 0) {
|
||||
pageAct.deviceItem = val.points;
|
||||
//getData();
|
||||
getData();
|
||||
}
|
||||
});
|
||||
|
||||
@ -169,24 +165,31 @@
|
||||
ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
|
||||
}
|
||||
|
||||
function getData() {
|
||||
// var dt = new Date();
|
||||
// console.log(dt);
|
||||
// var start = dt.getFullYear().toString() + "-" + dt.getMonth().toString() + "-" + (dt.getDate()).toString() + "T00:00:00Z";
|
||||
//var end = dt.getFullYear().toString() + "-" + dt.getMonth().toString() + "-" + (dt.getDate() + 1).toString() + "T00:00:00Z";
|
||||
// console.log(new Date(start).getTime());
|
||||
// console.log(new Date(end).getTime());
|
||||
//getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem,
|
||||
// 1666396800000,
|
||||
// 1666483200000,
|
||||
// pageAct.deviceName,
|
||||
// "Mitsubishi_Sup",
|
||||
// callBackFromHistory);
|
||||
function getData(start = null, end = null) {
|
||||
var sdt = new Date();
|
||||
var edt = new Date(new Date().setDate(sdt.getDate() + 1));
|
||||
start = start ?? sdt.toLocaleDateString();
|
||||
end = end ?? edt.toLocaleDateString();
|
||||
getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem,
|
||||
new Date(start).getTime(),
|
||||
new Date(end).getTime(),
|
||||
pageAct.deviceName,
|
||||
"Mitsubishi_Sup",
|
||||
callBackFromHistory);
|
||||
}
|
||||
|
||||
function callBackFromHistory(res) {
|
||||
//$('#tableData tbody').html();
|
||||
console.log(res)
|
||||
let strHtml = ``;
|
||||
res = JSON.parse(res);
|
||||
console.log(res);
|
||||
$.each(res.data, function (index, val) {
|
||||
strHtml += `<tr>
|
||||
<td>${val.deviceName}</td>
|
||||
<td>${val.value}</td>
|
||||
<td>${displayDate(val.timestamp)}</td>
|
||||
</tr>`;
|
||||
});
|
||||
$('#tableData tbody').html(strHtml);
|
||||
}
|
||||
|
||||
function setValue(deviceNumber, deviceName, deviceItem) {
|
||||
@ -197,6 +200,7 @@
|
||||
}
|
||||
else if (deviceItem != null && deviceItem != undefined) {
|
||||
pageAct.deviceItem = deviceItem;
|
||||
getData();
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user