This commit is contained in:
dev01 2022-11-23 17:27:46 +08:00
commit 4166ddd3cc

View File

@ -59,11 +59,6 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<td>儲冰設備A01</td>
<td>27.0</td>
<td>2021-08-01 23:55:00</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -123,7 +118,7 @@
$.each(val2.device, function (index3, val3) { $.each(val2.device, function (index3, val3) {
strHtml += `<li> 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"> <span class="nav-link-text">
${val3.full_name} ${val3.device_serial_tag} ${val3.full_name} ${val3.device_serial_tag}
</span> </span>
@ -131,8 +126,9 @@
</li>`; </li>`;
if (index == i1 && index2 == i2 && first) { if (index == i1 && index2 == i2 && first) {
first = false;
pageAct.deviceNumber = val3.device_number; pageAct.deviceNumber = val3.device_number;
pageAct.deviceSerialTag = val3.device_serial_tag; pageAct.deviceName = val3.full_name;
devPointsList(); devPointsList();
} }
}); });
@ -160,7 +156,7 @@
if (index == 0) { if (index == 0) {
pageAct.deviceItem = val.points; pageAct.deviceItem = val.points;
//getData(); getData();
} }
}); });
@ -169,24 +165,31 @@
ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send(); ytAjax = new YourTeam.Ajax(url, objSendData, success, null, "POST").send();
} }
function getData() { function getData(start = null, end = null) {
// var dt = new Date(); var sdt = new Date();
// console.log(dt); var edt = new Date(new Date().setDate(sdt.getDate() + 1));
// var start = dt.getFullYear().toString() + "-" + dt.getMonth().toString() + "-" + (dt.getDate()).toString() + "T00:00:00Z"; start = start ?? sdt.toLocaleDateString();
//var end = dt.getFullYear().toString() + "-" + dt.getMonth().toString() + "-" + (dt.getDate() + 1).toString() + "T00:00:00Z"; end = end ?? edt.toLocaleDateString();
// console.log(new Date(start).getTime()); getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem,
// console.log(new Date(end).getTime()); new Date(start).getTime(),
//getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem, new Date(end).getTime(),
// 1666396800000, pageAct.deviceName,
// 1666483200000, "Mitsubishi_Sup",
// pageAct.deviceName, callBackFromHistory);
// "Mitsubishi_Sup",
// callBackFromHistory);
} }
function callBackFromHistory(res) { function callBackFromHistory(res) {
//$('#tableData tbody').html(); let strHtml = ``;
console.log(res) 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) { function setValue(deviceNumber, deviceName, deviceItem) {
@ -197,6 +200,7 @@
} }
else if (deviceItem != null && deviceItem != undefined) { else if (deviceItem != null && deviceItem != undefined) {
pageAct.deviceItem = deviceItem; pageAct.deviceItem = deviceItem;
getData();
} }
} }
</script> </script>