diff --git a/Frontend/_sysMonAll.html b/Frontend/_sysMonAll.html index 262b678..dafebe2 100644 --- a/Frontend/_sysMonAll.html +++ b/Frontend/_sysMonAll.html @@ -55,7 +55,6 @@ $(function () { $(loadEle).Loading("start"); getBuildMenu((arr, data) => { - console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@", arr, data); buildMenuData = data; if (arr.indexOf(4) != -1) { getFloDevList(arr[0] == 4 ? "left" : "right"); @@ -119,7 +118,7 @@ let deviceCloseArr = []; myBaja.setSubscribeDevicesCallBack(function (data) { - // console.log(data) + console.log("subDevice 開始"); let matchDevice = allDevList.filter( (x) => x.device_number == data.device_number_full )[0]; @@ -237,15 +236,10 @@ (device) => device.device_number === matchDevice.device_number ) ) { - if (pageAct.sysSubTag === "L1") { - $(`#${matchDevice.device_number}_status`) - .attr("data-light-error-type", "error") - .data("light-error-type", "error"); - } else { - $(`#${matchDevice.device_number}_status`) - .attr("data-light-type", "error") - .data("light-type", "error"); - } + $(`#${matchDevice.device_number}_status`) + .attr("data-light-error-type", "error") + .data("light-error-type", "error"); + alarmDbIdList.push(matchDevice); } else if ( data.point_name == errDevPoiName && @@ -260,8 +254,21 @@ } if ( - allDevList.length === - deviceNormalArr.length + deviceCloseArr.length + alarmDbIdList.length + deviceCloseArr.length === 0 && + alarmDbIdList.some( + (device) => device.device_number === matchDevice.device_number + ) + ) { + $(`#${matchDevice.device_number}_status`) + .attr("data-light-type", "error") + .data("light-type", "error"); + } + + if ( + (!pageAct.floTag && + allDevList.length === + deviceNormalArr.length + deviceCloseArr.length) || + allDevList.length === deviceNormalArr.length + alarmDbIdList.length ) { changeColorForHotspot( deviceNormalArr.map(({ spriteDbid }) => spriteDbid), @@ -292,166 +299,12 @@ if (data.findIndex((x) => x.point_name == "CO2") != -1) { // 顯示溫度條 showHeatCO2("[name=forgeHeatBar]"); - } else if (data.findIndex((x) => x.point_name == "Temp") != -1) { + } else if (data.findIndex((x) => x.point_name == "Temp" || x.point_name == "TEMP") != -1) { // 顯示溫度條 showHeat("[name=forgeHeatBar]"); } }); } - // function subDevice() { - // let myBaja = new subscriptionDevices(); - // var ordPath = { - // area_tag: pageAct.AreaTag, - // building_tag: pageAct.buiTag, - // system_tag: pageAct.sysMainTag, - // name_tag: pageAct.sysSubTag, - // }; - // myBaja.setSubscribeDevicesByBql(ordPath); - - // // 燈熱點用 - // let lightOnHotColorArr = []; - // let lightOffHotColorArr = []; - // // 燈光圈用 - // let lightOnGuidArr = []; - // let lightOffGuidArr = []; - - // myBaja.setSubscribeDevicesCallBack(function (data) { - // // console.log(data) - // let matchDevice = allDevList.filter( - // (x) => x.device_number == data.device_number_full - // )[0]; - // if (!matchDevice) { - // return false; - // } - - // //將訂閱值塞入 subDeviceData - // if ( - // subDeviceData.findIndex( - // (x) => x.device_number == matchDevice.device_number - // ) == -1 - // ) { - // let obj = {}; - // obj.device_number = matchDevice.device_number; - // obj.dbid = matchDevice.forge_dbid; - // subDeviceData.push(obj); - // } - - // let subData = subDeviceData.filter( - // (x) => x.device_number == matchDevice.device_number - // )[0]; - - // if (subData) { - // subData[data.point_name] = data.value; - // } - - // let norDevPoiName = matchDevice.device_normal_point_name; - // let cloDevPoiName = matchDevice.device_close_point_name; - // let errDevPoiName = matchDevice.device_error_point_name; - - // if (data.point_name == "ONOFF" && pageAct.sysSubTag === "L1") { - // const lightOn = data.value.includes("true"); - - // setLightOpenOrClose(lightOn, matchDevice.device_guid); - // if (lightOn) { - // setLightValues(matchDevice.device_guid, 200, 0xe1cf18); - // // changeColorForHotspot(matchDevice.spriteDbid, null, true) - // if ( - // !lightOnHotColorArr.some( - // ({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid - // ) - // ) { - // lightOnHotColorArr.push(matchDevice); - // } - // lightOffHotColorArr = lightOffHotColorArr.filter( - // (light) => light.spriteDbid !== matchDevice.spriteDbid - // ); - // heatMap?.changeTemp(matchDevice.device_number, 40); - // } else { - // setLightValues(matchDevice.device_guid, 0, 0xffffff); - // // changeColorForHotspot(matchDevice.spriteDbid) - // if ( - // !lightOffHotColorArr.some( - // ({ spriteDbid }) => spriteDbid === matchDevice.spriteDbid - // ) - // ) { - // lightOffHotColorArr.push(matchDevice); - // } - // lightOnHotColorArr = lightOnHotColorArr.filter( - // (light) => light.spriteDbid !== matchDevice.spriteDbid - // ); - - // heatMap?.changeTemp(matchDevice.device_number, 0); - // } - // } - - // if (data.point_name == "Temp") { - // heatMap?.changeTemp( - // data.device_number_full, - // !isNaN(parseInt(data.value)) ? parseInt(data.value) : 0 - // ); - // let devIdx = allDevList.findIndex( - // (x) => x.device_number == data.device_number_full - // ); - // allDevList[devIdx]._temp = !isNaN(parseInt(data.value)) - // ? parseInt(data.value) - // : 0; - // } - // if ( - // data.point_name == norDevPoiName && - // data.value == matchDevice.device_normal_point_value - // ) { - // //顯示正常燈號 - // $(`#${matchDevice.device_number}_status`) - // .attr("data-light-type", "normal") - // .data("light-type", "normal"); - // } else if ( - // data.point_name == cloDevPoiName && - // data.value == matchDevice.device_close_point_value - // ) { - // $(`#${matchDevice.device_number}_status`) - // .attr("data-light-type", "close") - // .data("light-type", "close"); - // } else if ( - // data.point_name == errDevPoiName && - // data.value == matchDevice.device_error_point_value - // ) { - // $(`#${matchDevice.device_number}_status`) - // .attr("data-light-type", "error") - // .data("light-type", "error"); - // } - // if ( - // allDevList.length === - // lightOnHotColorArr.length + lightOffHotColorArr.length - // ) { - // changeColorForHotspot( - // lightOnHotColorArr.map(({ spriteDbid }) => spriteDbid), - // null, - // true - // ); - // changeColorForHotspot( - // lightOffHotColorArr.map(({ spriteDbid }) => spriteDbid), - // null, - // false - // ); - - // } - // $(loadEle).Loading("close"); - - // setLightColor(); - // setForgeHotSpotColor(matchDevice); - // lightDevForgeSpotLig(matchDevice); - // // 從設備訂閱更新每個設備卡片即時點位 - // setDevItemPoiValBySub(data); - // }); - - // myBaja.setSubscribeDeviceEndCallBack(function (data) { - // endPageLoading(); - // if (data.findIndex((x) => x.point_name == "Temp") != -1) { - // // 顯示溫度條 - // showHeat("[name=forgeHeatBar]"); - // } - // }); - // } function lightDevForgeSpotLig(devObj) { } @@ -605,9 +458,9 @@ endPageLoading(); } else { // 訂閱 baja 設備 - if (pageAct.sysSubTag !== "L1" && pageAct.sysSubTag !== "M12") { - subDevice(); - } + // if (pageAct.sysSubTag !== "L1" && pageAct.sysSubTag !== "M12") { + // subDevice(); + // } } // 繪製 html @@ -865,14 +718,14 @@ .map((y) => x) ); - for (let sub of stSubArr) { - let matchDevice = allDevList.filter( - (x) => x.device_number == sub[0]?.device_number - )[0]; - if (matchDevice) { - setForgeHotSpotColor(matchDevice); - } - } + // for (let sub of stSubArr) { + // let matchDevice = allDevList.filter( + // (x) => x.device_number == sub[0]?.device_number + // )[0]; + // if (matchDevice) { + // setForgeHotSpotColor(matchDevice); + // } + // } } if (pageAct.sysSubTag == "W2") { // console.log("@@",pageAct, pageAct.sub_system_tag) @@ -1036,11 +889,14 @@ allDevList.forEach((dev, idx) => { if (dev.device_number == devNum) { dev.spriteDbid = dbid; - setForgeHotSpotColor(dev); + // setForgeHotSpotColor(dev); } }); $(ele).data("dbId", dbid); }); + if (pageAct.sysSubTag !== "L1" && pageAct.sysSubTag !== "M12") { + subDevice(); + } }); onEvent("yt:tooltip:show", "[name=devItem]", function (e, obj) { diff --git a/Frontend/_sysMonFloor.html b/Frontend/_sysMonFloor.html index 77da459..ce8a580 100644 --- a/Frontend/_sysMonFloor.html +++ b/Frontend/_sysMonFloor.html @@ -43,6 +43,7 @@ var zoomToggle = 1.3; $(function () { $(loadEle).Loading("start"); + alarmDbIdList = []; $("#topLight").html(setTopLight()); setLightColor(); initChart(); @@ -442,7 +443,7 @@ }); cData._dbId = dbid; cData.spriteDbid = dbid; - setForgeHotSpotColor(cData); + // setForgeHotSpotColor(cData); }); }); floChart.setOption(option); @@ -597,9 +598,36 @@ heatMap?.changeTemp(matchDevice.device_number, 0); } } + + if ( + data.point_name == errDevPoiName && + data.value !== matchDevice.device_error_point_value && + alarmDbIdList.some( + ({ device_number }) => matchDevice.device_number === device_number + ) + ) { + alarmDbIdList = alarmDbIdList.filter( + ({ device_number }) => matchDevice.device_number === device_number + ); + } else if ( + data.point_name == errDevPoiName && + data.value == matchDevice.device_error_point_value && + !alarmDbIdList.some( + ({ device_number }) => matchDevice.device_number === device_number + ) + ) { + $(`#${matchDevice.device_number}_status`) + .attr("data-light-type", "error") + .data("light-type", "error"); + alarmDbIdList.push(matchDevice); + } + if ( data.point_name == norDevPoiName && - data.value == matchDevice.device_normal_point_value + data.value == matchDevice.device_normal_point_value && + !deviceScatterNormalArr.some( + ({ device_number }) => data.device_number_full === device_number + ) ) { //顯示正常燈號 $(`#${matchDevice.device_number}_status`) @@ -609,120 +637,114 @@ deviceScatterCloseArr = deviceScatterCloseArr.filter( (device) => device.spriteDbid !== matchDevice.spriteDbid ); - deviceScatterErrorArr = deviceScatterErrorArr.filter( - (device) => device.spriteDbid !== matchDevice.spriteDbid - ); } else if ( data.point_name == cloDevPoiName && - data.value == matchDevice.device_close_point_value + data.value == matchDevice.device_close_point_value && + !deviceScatterCloseArr.some( + ({ device_number }) => data.device_number_full === device_number + ) ) { $(`#${matchDevice.device_number}_status`) .attr("data-light-type", "close") .data("light-type", "close"); deviceScatterCloseArr.push(matchDevice); - deviceScatterNormalArr = deviceScatterNormalArr.filter( (device) => device.spriteDbid !== matchDevice.spriteDbid ); - deviceScatterErrorArr = deviceScatterErrorArr.filter( - (device) => device.spriteDbid !== matchDevice.spriteDbid - ); - } else if ( - data.point_name == errDevPoiName && - data.value == matchDevice.device_error_point_value - ) { - $(`#${matchDevice.device_number}_status`) - .attr("data-light-type", "error") - .data("light-type", "error"); - deviceScatterErrorArr.push(matchDevice); - deviceScatterNormalArr = deviceScatterNormalArr.filter( - (device) => device.spriteDbid !== matchDevice.spriteDbid - ); - deviceScatterCloseArr = deviceScatterCloseArr.filter( - (device) => device.spriteDbid !== matchDevice.spriteDbid - ); } - console.log(deviceScatterCloseArr.length, - deviceScatterNormalArr.length, - deviceScatterErrorArr.length) + + if (pageAct.sysSubTag === "L1" && lightControl === "node") { + alarmDbIdList = alarmDbIdList.filter( + ({ device_node_guid }) => + device_node_guid !== undefined && device_node_guid !== null + ); + + deviceScatterNormalArr = deviceScatterNormalArr.filter( + ({ device_node_guid }) => + device_node_guid !== undefined && device_node_guid !== null + ); + deviceScatterCloseArr = deviceScatterCloseArr.filter( + ({ device_node_guid }) => + device_node_guid !== undefined && device_node_guid !== null + ); + + lightOnHotColorArr = lightOnHotColorArr.filter( + ({ device_node_guid }) => + device_node_guid !== undefined && device_node_guid !== null + ); + lightOffHotColorArr = lightOffHotColorArr.filter( + ({ device_node_guid }) => + device_node_guid !== undefined && device_node_guid !== null + ); + } + if ( - option.series[0].data.length === - lightOnHotColorArr.length + lightOffHotColorArr.length + deviceScatterCloseArr.length + deviceScatterNormalArr.length === + option.series[0].data.length || + deviceScatterCloseArr.length + + deviceScatterNormalArr.length + + alarmDbIdList.length === + option.series[0].data.length ) { - lightOnHotColorArr.forEach((light) => { - const cur = option.series[0].data.find( - ({ device_number }) => device_number === light.device_number - ); + deviceScatterNormalArr.length && + deviceScatterNormalArr.forEach((device) => { + const cur = option.series[0].data.find( + ({ device_number }) => device_number === device.device_number + ); - const onColor = currentData.find( - ({ device_number }) => device_number === light.device_number - ).device_normal_color; - cur.itemStyle = { color: onColor }; - }); - - lightOffHotColorArr.forEach((light) => { - const cur = option.series[0].data.find( - ({ device_number }) => device_number === light.device_number - ); - const offColor = currentData.find( - ({ device_number }) => device_number === light.device_number - ).device_close_color; - cur.itemStyle = { color: offColor }; - }); - - floChart.setOption(option); + const normalColor = currentData.find( + ({ device_number }) => device_number === device.device_number + ).device_normal_color; + if (cur) { + cur.itemStyle = { color: normalColor }; + } + }); changeColorForHotspot( - lightOnHotColorArr.map(({ spriteDbid }) => spriteDbid), + deviceScatterNormalArr.map(({ spriteDbid }) => spriteDbid), null, true ); + + deviceScatterCloseArr.length && + deviceScatterCloseArr.forEach((device) => { + const cur = option.series[0].data.find( + ({ device_number }) => device_number === device.device_number + ); + const closeColor = currentData.find( + ({ device_number }) => device_number === device.device_number + ).device_close_color; + if (cur) { + cur.itemStyle = { color: closeColor }; + } + }); + changeColorForHotspot( - lightOffHotColorArr.map(({ spriteDbid }) => spriteDbid), + deviceScatterCloseArr.map(({ spriteDbid }) => spriteDbid), null, false ); - $(loadEle).Loading("close"); - } else if ( - deviceScatterCloseArr.length + - deviceScatterNormalArr.length + - deviceScatterErrorArr.length === - option.series[0].data.length - ) { - deviceScatterNormalArr.forEach((device) => { - const cur = option.series[0].data.find( - ({ device_number }) => device_number === device.device_number - ); - const normalColor = currentData.find( - ({ device_number }) => device_number === device.device_number - ).device_normal_color; - cur.itemStyle = { color: normalColor }; - }); + alarmDbIdList.length && + alarmDbIdList.forEach((device) => { + const cur = option.series[0].data.find( + ({ device_number }) => device_number === device.device_number + ); + const errColor = currentData.find( + ({ device_number }) => device_number === device.device_number + )?.device_error_color; - deviceScatterCloseArr.forEach((device) => { - const cur = option.series[0].data.find( - ({ device_number }) => device_number === device.device_number - ); - const closeColor = currentData.find( - ({ device_number }) => device_number === device.device_number - ).device_close_color; - cur.itemStyle = { color: closeColor }; - }); - - deviceScatterErrorArr.forEach((device) => { - const cur = option.series[0].data.find( - ({ device_number }) => device_number === device.device_number - ); - - const errColor = currentData.find( - ({ device_number }) => device_number === device.device_number - ).device_error_color; - cur.itemStyle = { color: errColor }; - }); + if (cur) { + cur.itemStyle = { color: errColor }; + } + }); + changeColorForHotspot( + alarmDbIdList.map(({ spriteDbid }) => spriteDbid), + "error", + false + ); floChart.setOption(option); - setForgeHotSpotColor(matchDevice); $(loadEle).Loading("close"); } }); @@ -1595,7 +1617,6 @@ }); }; } - if (pageAct.sysSubTag === "M12" && !elevatorShow) { let sensorObjs = []; addHotPoint(viewer); diff --git a/Frontend/index.html b/Frontend/index.html index b983e40..d7b3724 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -9,68 +9,68 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li --> - - Marketing Dashboard - Application Intel - SmartAdmin v4.5.1 - - - - - - - - - - - - - - - - - - - - - + + Marketing Dashboard - Application Intel - SmartAdmin v4.5.1 + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - -
-
- - -
- - + + + + +
+ + +
+ +
+
+
    +
    - + + + + + + + + + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +
    - - -
    -
    - - -
    - - - - - -
    - - -
    - -
    -
    -
      -
      - - - - - - - - - -

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

      - -
      - - - -