diff --git a/Frontend/_historyData2.html b/Frontend/_historyData2.html index 18dd4d6..0d8db71 100644 --- a/Frontend/_historyData2.html +++ b/Frontend/_historyData2.html @@ -124,10 +124,7 @@
+ > @@ -183,7 +180,9 @@ - + @@ -207,6 +206,7 @@ pageAct.hisBuiName = ""; hisFirst = true; var device_list = []; + var temp_device_list = []; // 用來儲存搜尋資料的值 $(function () { flatpickr(".selectDate", { locale: "zh_tw", @@ -224,7 +224,6 @@ setDateType(1, $(`[onclick="setDateType(1, this)"]`)); initList(); getFavorite(); - loadTable(null); }); @@ -273,62 +272,23 @@ $("[name=subRadio]:checked").parent().addClass("btn-info"); subTag = subRadios.val(); //sub tag pageAct.selectedSub = subTag; - if(e){ - await getSidebar(subTag); - } + if (e) { + await getSidebar(subTag); + } result = true; } return result; } - - function selectAllBuildingDevice(e){ - if(e.target.name==='bui_selected'){ - let curData = device_list.find(({building_tag})=> e.target.dataset.building ===building_tag) - const curBuisDev = curData.device_list.map(({device_number})=> device_number) - const form = $("#device_list_form")[0]; - const formData = new FormData(form); - let list = formData.getAll("Device_list") - - if(e.target.checked){ - - list = [...list, ...curBuisDev]; - }else{ - - list = list.filter((dev)=> !curBuisDev.includes(dev)) - } - - $('[name="Device_list"]').each((i, e)=>{ - if( list.includes(e.dataset.device)){ - e.checked = true; - }else{ - e.checked = false; - } - }) - } - } - document.querySelector(".js_nested_list").addEventListener("change",selectAllBuildingDevice) - - // 取得右側sidebar - function getSidebar(subTag) { - // let subTag = $("[name=subRadio]:checked").val() - let sendData = { - sub_system_tag: subTag, - }; - objSendData.Data = sendData; - let url = baseApiUrl + "/api/History/GetDeviceInfo"; - function stop(e) { - e.stopPropagation(); - } - function success(res) { - let strHtml = ``; + function showDeviceList(data){ + temp_device_list = data; + let strHtml = ""; let i1 = null, i2 = null, first = true; - device_list = res.data; - $.each(res.data, function (index, building) { + $.each(data, function (index, building) { let innerHtml = ""; $.each(building.device_list, function (index2, val2) { innerHtml += `+
${building.building_name}
全選
+