From f1d67fb62ee6bb0bf46173ac82ef75869e971512 Mon Sep 17 00:00:00 2001 From: dev02 Date: Wed, 23 Nov 2022 17:26:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=B7=E5=8F=B2=E8=B3=87=E6=96=99=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E7=8D=B2=E5=8F=96=E8=B3=87=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frontend/_historyData.html | 50 ++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/Frontend/_historyData.html b/Frontend/_historyData.html index 4f8e54e..5aa86ac 100644 --- a/Frontend/_historyData.html +++ b/Frontend/_historyData.html @@ -59,11 +59,6 @@ - - 儲冰設備A01 - 27.0 - 2021-08-01 23:55:00 - @@ -123,7 +118,7 @@ $.each(val2.device, function (index3, val3) { strHtml += `
  • - + ${val3.full_name} ${val3.device_serial_tag} @@ -131,8 +126,9 @@
  • `; 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 += ` + ${val.deviceName} + ${val.value} + ${displayDate(val.timestamp)} + `; + }); + $('#tableData tbody').html(strHtml); } function setValue(deviceNumber, deviceName, deviceItem) { @@ -197,6 +200,7 @@ } else if (deviceItem != null && deviceItem != undefined) { pageAct.deviceItem = deviceItem; + getData(); } } \ No newline at end of file