diff --git a/Frontend/_sysElevator.html b/Frontend/_sysElevator.html index cb12e7c..022faa4 100644 --- a/Frontend/_sysElevator.html +++ b/Frontend/_sysElevator.html @@ -3,7 +3,9 @@ background-color: #fff; min-height: 520px; } - + .elevator-table-wrapper { + padding:0.8rem; + } table.elevator-build { /*border: 1px double #000;*/ } @@ -25,6 +27,20 @@ height: 47px; border: 4px solid orange; } + + .elevator-item-toup { + border: 4px solid rgba(255,255,255,0); + position: absolute; + border-bottom: 0; + z-index: 2; + } + + .elevator-item-todown { + border: 4px solid rgba(255,255,255,0); + position: absolute; + border-top: 0; + z-index: 2; + }
@@ -35,30 +51,22 @@
- - -
-
- -
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file diff --git a/Frontend/css/site.css b/Frontend/css/site.css index 17352a4..d0a17f3 100644 --- a/Frontend/css/site.css +++ b/Frontend/css/site.css @@ -55,6 +55,12 @@ label[id$='-error'].error { animation: flashing-c 0.5s linear infinite; } +.light-flash-c-bd { + --flash-color-1: #ffa100; + --flash-color-2: #26272b; + animation: flashing-c-bd 0.5s linear infinite; +} + /* checkbox switch */ input.toggle:checked::before { content: ''; @@ -131,6 +137,23 @@ input.toggle:checked { } } +@keyframes flashing-c-bd { + 0% { + border-color: var(--flash-color-1); + } + + 49% { + border-color: var(--flash-color-1); + } + + 50% { + border-color: var(--flash-color-2); + } + + 99% { + border-color: var(--flash-color-2); + } +} /* ================================================================ */ /* 單一方法 */ /* ================================================================ */ diff --git a/Frontend/index.html b/Frontend/index.html index de22389..1178452 100644 --- a/Frontend/index.html +++ b/Frontend/index.html @@ -2528,15 +2528,15 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li - - + - + + - + diff --git a/Frontend/js/forge/forgemodel.js b/Frontend/js/forge/forgemodel.js index 1d2ffaf..115f5ba 100644 --- a/Frontend/js/forge/forgemodel.js +++ b/Frontend/js/forge/forgemodel.js @@ -1,25 +1,63 @@ var viewer; +// const devices = [ +// { +// id: "Sensor 1", +// position: { +// x: -22.779729106182415, +// y: 5.431043023608719, +// z: 4.553068469137088, +// }, +// type: "combo", +// sensorTypes: ["temperature", "co2"], +// dbId: 1, +// }, +// { +// id: "Sensor 2", +// position: { +// x: 0.20752051811882666, +// y: 5.431043023608719, +// z: 4.553068469137088, +// }, +// type: "combo", +// sensorTypes: ["temperature", "co2"], +// dbId: 2, +// }, +// ]; + +// var sensorStyleDefinitions = { +// co2: { +// url: "https://d2zqnmauvnpnnm.cloudfront.net/assets-1/images/co2.svg", +// color: 0xffffff, +// }, +// temperature: { +// url: "https://d2zqnmauvnpnnm.cloudfront.net/assets-1/images/thermometer.svg", +// color: 0xffffff, +// }, +// default: { +// url: "https://d2zqnmauvnpnnm.cloudfront.net/assets-1/images/circle.svg", +// color: 0xffffff, +// }, +// }; + // Initialize sensor values //let sensorVals = []; let fragProxy; var targetFloorZ; var elevatorSpeed; -let bulbLight; -//for (let i = 0; i < devices.length; i++) { -// sensorVals[i] = Math.random(); -//} +// for (let i = 0; i < devices.length; i++) { +// sensorVals[i] = Math.random(); +// } function launchViewer(urn) { var options = { env: 'AutodeskProduction', - getAccessToken: getForgeToken, - language: 'en' + getAccessToken: getForgeToken }; Autodesk.Viewing.Initializer(options, () => { viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('forgeViewer')); - //viewer = new Autodesk.Viewing.Viewer3D(document.getElementById('forgeViewer'));//這是沒有工具列的 + //viewer = new Autodesk.Viewing.Viewer3D(document.getElementById('forgeViewer')); viewer.start(); var documentId = 'urn:' + urn; Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure); @@ -27,24 +65,24 @@ function launchViewer(urn) { //test - //for (let i = 0; i < urn.length; i++) { - // Autodesk.Viewing.Document.load(urn[i]["urn"], async (doc) => { - // let viewables = doc.getRoot().getDefaultGeometry(); - // let model = await viewer.loadDocumentNode(doc, viewables, { - // preserveView: false, - // keepCurrentModels: true, - // placementTransform: (new THREE.Matrix4()).setPosition(urn[i]["xform"]), - // keepCurrentModels: true, - // globalOffset: { - // x: 0, - // y: 0, - // z: 0 - // } - // }); + // for (let i = 0; i < urn.length; i++) { + // Autodesk.Viewing.Document.load(urn[i]["urn"], async (doc) => { + // let viewables = doc.getRoot().getDefaultGeometry(); + // let model = await viewer.loadDocumentNode(doc, viewables, { + // preserveView: false, + // keepCurrentModels: true, + // placementTransform: (new THREE.Matrix4()).setPosition(urn[i]["xform"]), + // keepCurrentModels: true, + // globalOffset: { + // x: 0, + // y: 0, + // z: 0 + // } + // }); - // await viewer.waitForLoadDone(); //!<<< Wait for loading materials, properties and geometries for this model (URN) - // }); - //} + // await viewer.waitForLoadDone(); //!<<< Wait for loading materials, properties and geometries for this model (URN) + // }); + // } //loadHeatmaps(viewer.getAllModels()[0]); //!<<< equals to viewer.model @@ -85,65 +123,36 @@ function onDocumentLoadSuccess(doc) { viewer.loadDocumentNode(doc, viewables).then(i => { // documented loaded, any action? }); - //viewer.addEventListener(Autodesk.Viewing.AGGREGATE_SELECTION_CHANGED_EVENT, (args) => { - // var currSelection = viewer.getSelection(); - // var domElem = document.getElementById('id_printer'); - // domElem.innerText = currSelection[0]; + // viewer.addEventListener(Autodesk.Viewing.AGGREGATE_SELECTION_CHANGED_EVENT, (args) => { + // var currSelection = viewer.getSelection(); + // var domElem = document.getElementById('id_printer'); + // domElem.innerText = currSelection[0]; + // }); - // const targetElem = currSelection[0]; + //viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function () { + // var instanceTree = viewer.model.getData().instanceTree; + // var allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex); + // var domElem = document.getElementById('all_id'); + // domElem.innerText = allDbIdsStr; - // const model = viewer.model; - // const instanceTree = model.getData().instanceTree; - // const fragList = model.getFragmentList(); + // let tree = viewer.model.getData().instanceTree; + // let nodeId = 10952; - // let bounds = new THREE.Box3(); + // tree.enumNodeFragments(nodeId, function (frag) { + // fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); + // fragProxy.getAnimTransform(); + // let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26 - // instanceTree.enumNodeFragments(targetElem, (fragId) => { - // let box = new THREE.Box3(); - // fragList.getWorldBounds(fragId, box); - // bounds.union(box); - // }, true); + // fragProxy.position = fragPosition - // const position = bounds.center(); - // console.log(position) + // fragProxy.updateAnimTransform() + + // }); + // viewer.impl.sceneUpdated(true); //}); - viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function (data) { - //var viewer = data.target; - //var instanceTree = viewer.model.getData().instanceTree; - //var allDbIdsStr = Object.keys(instanceTree.nodeAccess.dbIdToIndex); - //var domElem = document.getElementById('all_id'); - //domElem.innerText = allDbIdsStr; - - - //let tree = viewer.model.getData().instanceTree; - //let nodeId = 10952; - - //tree.enumNodeFragments(nodeId, function (frag) { - // fragProxy = viewer.impl.getFragmentProxy(viewer.model, frag); - // console.log("p:" + fragProxy.position); - // fragProxy.getAnimTransform(); - // let fragPosition = new THREE.Vector3(0, 0, 0);// 一樓0 二樓15 三樓 26 - // fragProxy.position = fragPosition; - // fragProxy.updateAnimTransform(); - //}); - //viewer.impl.sceneUpdated(true); - - });//, { once: true, } - - //bulbLight = new THREE.PointLight(0xff0000, 20, 2, 1);//0xffee88 - //bulbLight.position.set(39.33340644836426, 19.965089797973633, 18);//17.880840301513672 - //bulbLight.castShadow = true; - //bulbLight.power = 100;// 110000; - //bulbLight.emissiveIntensity = bulbLight.intensity / Math.pow(0.02, 2.0); - //viewer.scene.add(bulbLight); -} - -function setLightPower(value) { - bulbLight.intensity = (value * 10); - viewer.impl.sceneUpdated(true); - //bulbLight.power = value; + } function setElevatorFloor(floor) { diff --git a/Frontend/js/n4js/alarmbaja.js b/Frontend/js/n4js/alarmbaja.js index e24fba3..d67a3f1 100644 --- a/Frontend/js/n4js/alarmbaja.js +++ b/Frontend/js/n4js/alarmbaja.js @@ -12,6 +12,39 @@ function addzero(num) { * @param {any} alarmClass * @param {any} callback */ +// function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, alarmClass, callback) { +// let _sourceTmp; +// var _result = ""; +// var _ss = ""; +// var _bfName = ""; +// var _sourceName = ""; +// var _index = 0; +// var _recoverState = isRecover ? "!= null" : "= null"; +// var _ackState = isAck ? "= 1" : "!= 1"; + +// require(['baja!'], function (baja) { +// baja.Ord.make("local:|foxs:|alarm:|bql:select timestamp, ackState, alarmClass, alarmClassDisplayName, alarmValue, alarmData, alarmData.sourceName, uuid, alarmData.msgText, alarmData.numericValue, alarmData.presentValue, alarmData.status, alarmData.toState, normalTime from openAlarms where alarmClass = '" + alarmClass + "' and timestamp.millis > " + startDate_millisecond + " and timestamp.millis < " + endDate_millisecond + " and normalTime " + _recoverState + " order by timestamp asc").get() +// .then(function (table) { +// return table.cursor({ +// each: function (record) { +// _sourceTmp = (record.get('alarmData').get('sourceName')).toString().split('_'); +// _bfName = _sourceTmp[1] + "-" + _sourceTmp[4]; +// _sourceName = _sourceTmp[7] + "-" + _sourceTmp[8]; +// _ss += ', "' + _index + '": {"buildingFloorName_zh":"' + _bfName + '", "uuid":"' + record.get('uuid') + '", "timestamp":"' + record.get('timestamp') + '", "alarmClass":"' + record.get('alarmClass') + '", "sourceName_zh":"' + _sourceName + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "normalTime":"' + record.get('normalTime') + '"}'; +// _index++; +// }, +// after: function () { +// _result += '{' + '"count": ' + _index; +// _result += _ss; +// _result += '}'; +// if (typeof callback === 'function') { +// callback(_result); +// } +// } +// }); +// }); +// }); +// } function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, isAck, alarmClass, callback) { let _sourceTmp; var _result = ""; @@ -57,6 +90,35 @@ function getAlarmByBaja(startDate_millisecond, endDate_millisecond, isRecover, i * @param {any} devicePath * @param {any} callback */ +// function getOneDeviceAlarmTop10ByBaja(devicePath, callback) { +// var _result = ""; +// var _ss = ""; +// var _index = 0; +// //{ "count":2,"data": [{ "time": "2022/11/14 15:00:00", "errId": "0001", "ackCheck": "未確認", "errReason": "燈泡故障" }, { "time": "2022/11/14 15:00:00", "errId": "0002", "ackCheck": "未確認", "errReason": "燈泡故障" }]} +// require(['baja!'], function (baja) { +// baja.Ord.make("local:|foxs:|alarm:|bql:select top 10 timestamp, ackState, alarmData, alarmData.sourceName, sourceState, uuid, alarmData.msgText, normalTime where alarmData.sourceName like '%" + devicePath + "%' order by timestamp desc").get() +// .then(function (table) { +// return table.cursor({ +// each: function (record) { +// if (_index == 0) +// _ss += '{"uuid":"' + record.get('uuid') + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + record.get('timestamp') + '"}'; +// else +// _ss += ',{"uuid":"' + record.get('uuid') + '", "msgText":"' + record.get('alarmData').get('msgText') + '", "ackState":"' + record.get('ackState') + '", "timestamp":"' + record.get('timestamp') + '"}'; +// _index++; +// }, +// after: function () { +// _result += '{' + '"count": ' + _index +', "data":['; + +// _result += _ss+']'; +// _result += '}'; +// if (typeof callback === 'function') { +// callback(_result); +// } +// } +// }); +// }); +// }); +// } function getOneDeviceAlarmTop10ByBaja(devicePath, callback) { var _result = ""; var _ss = ""; @@ -109,6 +171,31 @@ function getOneDeviceAlarmTop10ByBaja(devicePath, callback) { * @param {any} systemPath * @param {any} callback */ +// function getOneSystemAlarmStateByBaja(systemPath, callback) { +// var _result = ""; +// var _ss = ""; +// var _index = 0; + +// require(['baja!'], function (baja) { +// baja.Ord.make("local:|foxs:|alarm:|bql:select alarmData, alarmData.sourceName, sourceState, uuid where alarmData.sourceName like '%" + systemPath + "%' order by timestamp desc").get() +// .then(function (table) { +// return table.cursor({ +// each: function (record) { +// _ss += ', "' + _index + '": {"uuid":"' + record.get('uuid') + '", "sourceName":"' + record.get('alarmData').get('sourceName') + '", "sourceState":"' + record.get('sourceState') + '"}'; +// _index++; +// }, +// after: function () { +// _result += '{' + '"count": ' + _index; +// _result += _ss; +// _result += '}'; +// if (typeof callback === 'function') { +// callback(_result); +// } +// } +// }); +// }); +// }); +// } function getOneSystemAlarmStateByBaja(systemPath, callback) { var _result = ""; var _ss = ""; diff --git a/Frontend/js/n4js/historybaja.js b/Frontend/js/n4js/historybaja.js index 9043e3f..5bf45a8 100644 --- a/Frontend/js/n4js/historybaja.js +++ b/Frontend/js/n4js/historybaja.js @@ -8,6 +8,32 @@ * @param {any} company * @param {any} callback */ +// function getHistoryDataByBaja(devicePath, startDate_millisecond, endDate_millisecond, deviceName, company, callback) { +// var _result = ""; +// var _ss = ""; +// var _index = 0; + +// require(['baja!'], function (baja) { +// baja.Ord.make('local:|foxs:|history:/' + company + '/' + devicePath + '|bql:select * from control:ControlPoint where timestamp.millis > ' + startDate_millisecond + ' and timestamp.millis < ' + endDate_millisecond).get() +// .then(function (table) { +// return table.cursor({ +// each: function (record) { +// _ss += ', "' + _index + '": {"deviceName":"' + deviceName + '", "value":' + record.get('value') + ', "timestamp":"' + record.get('timestamp') + '"}'; +// _index++; +// }, +// after: function () { +// _result += '{' + '"count": ' + _index; +// _result += _ss; +// _result += '}'; +// if (typeof callback === 'function') { +// callback(_result); +// } +// } +// }); +// }); +// }); +// } + function getHistoryDataByBaja(devicePath, startDate_millisecond, endDate_millisecond, deviceName, company, callback) { var _result = ""; var _ss = ""; diff --git a/Frontend/js/site.js b/Frontend/js/site.js index 9ce7f53..4ad606f 100644 --- a/Frontend/js/site.js +++ b/Frontend/js/site.js @@ -114,11 +114,11 @@ class ElevatorHandler { this.eleId = ""; this.eleWra = $("
"); this.speed = 0.3; - this.monStatus = 0; // 0=no 1=up 2=down + this.movStatus = {}; // {id:elevator01,value:0} 0=no 1=up 2=down this.floorHeight = typeof option.fHeight == "undefined" ? 50 : option.fHeight; this.floorWidth = typeof option.fWidth == "undefined" ? 45 : option.fWidth; this.floors = typeof option.floors == "undefined" ? [{}] : option.floors; - this.elevators = typeof option.elevators == "undefined" ? [{ id: "elevator01" }] : option.elevators; + this.elevators = typeof option.elevators == "undefined" ? [{}] : option.elevators; // {id:elevator01} this.curElevFloor = typeof option.curElevFloor == "undefined" ? {} : option.curElevFloor; this.setTimeout = null; this.init(); @@ -130,7 +130,6 @@ class ElevatorHandler { if (Object.keys(this.curElevFloor).length != 0) { $.each(Object.keys(this.curElevFloor), (idx, elevKey) => { this.setElevFloor(elevKey,this.curElevFloor[elevKey]); - }) } } @@ -161,11 +160,17 @@ class ElevatorHandler { let th = creEle("th"); th.css({ "width": `${_w}px`, "height": `${_h}px` }); if (e != 1 && e != _elevators.length + 2) { - let elevId = _elevators[e - 2].id; + let elevId = _elevators[e - 2]?.id; // 電梯方框 let span = creEle("span", null, "elevator-item-" + (elevId), null, ["elevator-item"]); + let spanUp = creEle("span", null, null, null, ["elevator-item-toup"]); + let spanDown = creEle("span", null, null, null, ["elevator-item-todown"]); span.css({ "width": `${_w - 3}px`, "height": `${_h - 3}px`, "top": `1.5px`, "transition":`transform ${1 / this.speed}s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`}) + spanUp.css({ "width": `${_w - 3}px`, "height": `${(_h - 3) / 2}px`, "top": `1.5px`, "transition":`transform ${1 / this.speed}s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`}) + spanDown.css({ "width": `${_w - 3}px`, "height": `${(_h - 3) / 2}px`, "top": `1.5px`, "transition":`transform ${1 / this.speed}s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`,"top":`${1.5 + (_h-3) / 2}px`}) + th.append(spanUp); th.append(span); + th.append(spanDown); } theadTr.append(th); } @@ -221,25 +226,46 @@ class ElevatorHandler { let curSort = this.floors.filter(x => x.id == curFloId).map(x => x.sort)[0]; let tarSort = this.floors.filter(x => x.id == floId).map(x => x.sort)[0]; let gapFloor = tarSort - curSort; + let cssEle = [$(`#elevator-item-${elevId}`)[0], $(`#elevator-item-${elevId}`).prev("span.elevator-item-toup")[0], $(`#elevator-item-${elevId}`).next("span.elevator-item-todown")[0]] clearTimeout(this.setTimeout); - console.log(this.movStatus) - if (this.movStatus != 0) { - $(`#elevator-item-${elevId}`).css("transition", `transform ${1 / this.speed}s cubic-bezier(0, 0, 0.62, 1) 0s`); - } - if (gapFloor < 0) { - this.movStatus = 2; - } else if (gapFloor > 0) { - this.movStatus = 1; - } else { - this.movStatus = 0; + console.log("123",this.movStatus) + if (this.movStatus[elevId] != 0) { + $(cssEle).css("transition", `transform ${1 / this.speed * Math.abs(gapFloor)}s cubic-bezier(0, 0, 0.62, 1) 0s`); } + //if (gapFloor < 0) { + // this.movStatus[elevId] = 2; + //} else if (gapFloor > 0) { + // this.movStatus[elevId] = 1; + //} else { + // this.movStatus[elevId] = 0; + //} this.setTimeout = setTimeout(() => { - this.movStatus = 0; - $(`#elevator-item-${elevId}`).css("transition", `transform ${1 / this.speed}s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`) - }, (1 / this.speed) * 1000) - $(`#elevator-item-${elevId}`).css("transform", `translateY(${this.floorHeight * (this.floors.length - tarSort)}px)`); + /*this.movStatus[elevId] = 0;*/ + $(cssEle).css("transition", `transform ${1 / this.speed * Math.abs(gapFloor)}s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`); + this.setEleUpDownStyle(elevId); + }, (1 / this.speed * Math.abs(gapFloor)) * 1000) + this.setEleUpDownStyle(elevId); + this.curElevFloor[elevId] = floId; + $(cssEle).css("transition", `transform ${1 / this.speed * Math.abs(gapFloor)}s cubic-bezier(0.43, 0.05, 0.62, 1) 0s`) + $(cssEle).css("transform", `translateY(${this.floorHeight * (this.floors.length - tarSort)}px)`); } + setEleMovStatus = function (elevId,status) { + this.movStatus[elevId] = status; + } + + setEleUpDownStyle = function (elevId) { + if (this.movStatus[elevId] == 1) { + $(`#elevator-item-${elevId}`).prev("span.elevator-item-toup").addClass("light-flash-c-bd") + .css("--flash-color-1", "#44ea8e").css("--flash-color-2", "rgba(255,255,255,0)"); + } else if (this.movStatus[elevId] == 2) { + $(`#elevator-item-${elevId}`).next("span.elevator-item-todown").addClass("light-flash-c-bd") + .css("--flash-color-1", "#44ea8e").css("--flash-color-2", "rgba(255,255,255,0)"); + } else { + $(`#elevator-item-${elevId}`).prev("span.elevator-item-toup").removeClass("light-flash-c-bd"); + $(`#elevator-item-${elevId}`).next("span.elevator-item-todown").removeClass("light-flash-c-bd"); + } + } setCurElevFloor = function (elevId,floId) { this.curElevFloor[elevId] = floId; @@ -248,6 +274,11 @@ class ElevatorHandler { redraw = function () { $(this.ele).empty(); this.setTabFloor(); + if (Object.keys(this.curElevFloor).length != 0) { + $.each(Object.keys(this.curElevFloor), (idx, elevKey) => { + this.setElevFloor(elevKey, this.curElevFloor[elevKey]); + }) + } } } \ No newline at end of file diff --git a/Frontend/js/yourteam/plugins/yt-tab/yt-tab.js b/Frontend/js/yourteam/plugins/yt-tab/yt-tab.js index 0e50fa8..a111ec8 100644 --- a/Frontend/js/yourteam/plugins/yt-tab/yt-tab.js +++ b/Frontend/js/yourteam/plugins/yt-tab/yt-tab.js @@ -19,12 +19,13 @@ $(function () { * 初始全頁面 yt tab * */ function initTabsByEle() { + _ytTabInited = []; $("[data-tabname][data-target]:not([data-tabrole=child])").each(function (index, value) { let tabName = $(value).data("tabname"); - if (_ytTabInited.indexOf(tabName) == -1) { - var ytTab = new YT.Tab({ tabName: tabName }) - _ytTabInited.push(tabName); - } + + var ytTab = new YT.Tab({ tabName: tabName }) + _ytTabInited.push(tabName); + }) } diff --git a/Frontend/js/yourteam/yourteam.jquery.datatables.js b/Frontend/js/yourteam/yourteam.jquery.datatables.js index 7652f02..85da7f2 100644 --- a/Frontend/js/yourteam/yourteam.jquery.datatables.js +++ b/Frontend/js/yourteam/yourteam.jquery.datatables.js @@ -58,7 +58,7 @@ function fnInitJqDataTablesNoData(tag, dataSet = null, columns = null, columnDef "columns": columns, "aoColumnDefs": columnDefs, "stateSave": true, - "pagingType": "simple", + "pagingType": "full_numbers", "destroy": false, "initComplete": initComplete, "drawCallback": fnDrawCallBack,