2022-11-15 12:54:21 +08:00
|
|
|
|
<main id="js-page-content" role="main" class="page-content">
|
|
|
|
|
<div class="row">
|
2022-12-05 18:45:24 +08:00
|
|
|
|
<div class="col-sm-12 col-xl-4 poisition-relative">
|
|
|
|
|
<!-- <img src="img/clouds.png" class="img-fluid" style="min-height: 520px;"> -->
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
|
|
|
|
<div id="forgeViewer" class="position-absolute" style="width:96%;height:96%;"></div>
|
|
|
|
|
|
2022-11-15 12:54:21 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-12 col-xl-4">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-sm-6 col-xl-6">
|
|
|
|
|
<div class="p-3 bg-primary-300 rounded overflow-hidden position-relative text-white mb-g">
|
|
|
|
|
<div class="">
|
|
|
|
|
<h3 class="display-4 d-block l-h-n m-0 fw-500">
|
2022-12-07 18:59:53 +08:00
|
|
|
|
<span id="todayUseElec">--</span>
|
2022-12-01 19:32:32 +08:00
|
|
|
|
<small class="m-0 l-h-n">今日用電量 kWH</small>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
</h3>
|
|
|
|
|
</div>
|
|
|
|
|
<i class="fal fa-user position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n1" style="font-size:6rem"></i>
|
|
|
|
|
</div>
|
2022-11-15 11:25:47 +08:00
|
|
|
|
</div>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="col-sm-6 col-xl-6">
|
|
|
|
|
<div class="p-3 bg-warning-400 rounded overflow-hidden position-relative text-white mb-g">
|
|
|
|
|
<div class="">
|
|
|
|
|
<h3 class="display-4 d-block l-h-n m-0 fw-500">
|
2022-12-07 18:59:53 +08:00
|
|
|
|
<span id="yesUseElec">--</span>
|
2022-12-29 18:44:09 +08:00
|
|
|
|
<small class="m-0 l-h-n">昨日用電量 kWH</small>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
</h3>
|
|
|
|
|
</div>
|
|
|
|
|
<i class="fal fa-gem position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n4" style="font-size: 6rem;"></i>
|
|
|
|
|
</div>
|
2022-11-15 11:25:47 +08:00
|
|
|
|
</div>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="col-lg-12">
|
2022-12-05 18:45:24 +08:00
|
|
|
|
<div id="panel-2" class="panel" data-panel-sortable data-panel-collapsed data-panel-close>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="panel-hdr">
|
|
|
|
|
<h2>
|
|
|
|
|
昨日/今日用電比較
|
|
|
|
|
</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="panel-container show">
|
2022-12-05 18:45:24 +08:00
|
|
|
|
<div class="panel-content poisition-relative">
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="p-1 position-absolute pos-right pos-top mt-3 mr-3 z-index-cloud d-flex align-items-center justify-content-center">
|
2022-12-05 18:45:24 +08:00
|
|
|
|
<!--<div class="border-faded border-top-0 border-left-0 border-bottom-0 py-2 pr-4 mr-3 hidden-sm-down">
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="text-right fw-500 l-h-n d-flex flex-column">
|
|
|
|
|
<div class="h3 m-0 d-flex align-items-center justify-content-end">
|
|
|
|
|
<div class='icon-stack mr-2'>
|
|
|
|
|
<i class="base base-7 icon-stack-3x opacity-100 color-success-600"></i>
|
|
|
|
|
<i class="base base-7 icon-stack-2x opacity-100 color-success-500"></i>
|
|
|
|
|
<i class="fal fa-arrow-up icon-stack-1x opacity-100 color-white"></i>
|
|
|
|
|
</div>
|
|
|
|
|
$44.34 / GE
|
|
|
|
|
</div>
|
|
|
|
|
<span class="m-0 fs-xs text-muted">Increased Profit as per redux margins and estimates</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="js-easy-pie-chart color-info-400 position-relative d-inline-flex align-items-center justify-content-center" data-percent="35" data-piesize="95" data-linewidth="10" data-scalelength="5">
|
|
|
|
|
<div class="js-easy-pie-chart color-success-400 position-relative position-absolute pos-left pos-right pos-top pos-bottom d-flex align-items-center justify-content-center" data-percent="65" data-piesize="60" data-linewidth="5" data-scalelength="1" data-scalecolor="#fff">
|
|
|
|
|
<div class="position-absolute pos-top pos-left pos-right pos-bottom d-flex align-items-center justify-content-center fw-500 fs-xl text-dark">78%</div>
|
|
|
|
|
</div>
|
2022-12-05 18:45:24 +08:00
|
|
|
|
</div>-->
|
|
|
|
|
</div>
|
|
|
|
|
<div style="width:100%; min-height:300px;">
|
|
|
|
|
<canvas class="chart" id="eveDayElecChart"></canvas>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-11-15 11:25:47 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="col-sm-12 col-xl-4">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-sm-6 col-xl-6">
|
|
|
|
|
<div class="p-3 bg-success-200 rounded overflow-hidden position-relative text-white mb-g">
|
|
|
|
|
<div class="">
|
|
|
|
|
<h3 class="display-4 d-block l-h-n m-0 fw-500">
|
2022-12-07 18:59:53 +08:00
|
|
|
|
<span id="insPower">--</span>
|
2022-12-29 18:44:09 +08:00
|
|
|
|
<small class="m-0 l-h-n">即時功率 kW</small>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
</h3>
|
|
|
|
|
</div>
|
|
|
|
|
<i class="fal fa-lightbulb position-absolute pos-right pos-bottom opacity-15 mb-n5 mr-n6" style="font-size: 8rem;"></i>
|
|
|
|
|
</div>
|
2022-11-15 11:25:47 +08:00
|
|
|
|
</div>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="col-sm-6 col-xl-6">
|
|
|
|
|
<div class="p-3 bg-info-200 rounded overflow-hidden position-relative text-white mb-g">
|
|
|
|
|
<div class="">
|
|
|
|
|
<h3 class="display-4 d-block l-h-n m-0 fw-500">
|
2022-12-12 15:06:35 +08:00
|
|
|
|
<span id="insPowerPer">--</span>
|
2022-12-29 18:44:09 +08:00
|
|
|
|
<small class="m-0 l-h-n">即時契約容量占比 %</small>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
</h3>
|
|
|
|
|
</div>
|
|
|
|
|
<i class="fal fa-globe position-absolute pos-right pos-bottom opacity-15 mb-n1 mr-n4" style="font-size: 6rem;"></i>
|
|
|
|
|
</div>
|
2022-11-15 11:25:47 +08:00
|
|
|
|
</div>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="col-lg-12">
|
2022-12-05 18:45:24 +08:00
|
|
|
|
<div id="panel-3" class="panel" data-panel-sortable data-panel-collapsed data-panel-close>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="panel-hdr">
|
|
|
|
|
<h2>
|
|
|
|
|
本週/上週用電比較
|
|
|
|
|
</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="panel-container show">
|
|
|
|
|
<div class="panel-content poisition-relative">
|
2022-12-05 18:45:24 +08:00
|
|
|
|
<!--<div class="pb-5 pt-3">
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-6 col-xl-3 d-sm-flex align-items-center">
|
|
|
|
|
<div class="p-2 mr-3 bg-info-200 rounded">
|
|
|
|
|
<span class="peity-bar" data-peity="{"fill": ["#fff"], "width": 27, "height": 27 }">3,4,5,8,2</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label class="fs-sm mb-0">Bounce Rate</label>
|
|
|
|
|
<h4 class="font-weight-bold mb-0">37.56%</h4>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-6 col-xl-3 d-sm-flex align-items-center">
|
|
|
|
|
<div class="p-2 mr-3 bg-info-300 rounded">
|
|
|
|
|
<span class="peity-bar" data-peity="{"fill": ["#fff"], "width": 27, "height": 27 }">5,3,1,7,9</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label class="fs-sm mb-0">Sessions</label>
|
|
|
|
|
<h4 class="font-weight-bold mb-0">759</h4>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-6 col-xl-3 d-sm-flex align-items-center">
|
|
|
|
|
<div class="p-2 mr-3 bg-success-300 rounded">
|
|
|
|
|
<span class="peity-bar" data-peity="{"fill": ["#fff"], "width": 27, "height": 27 }">3,4,3,5,5</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label class="fs-sm mb-0">New Sessions</label>
|
|
|
|
|
<h4 class="font-weight-bold mb-0">12.17%</h4>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-6 col-xl-3 d-sm-flex align-items-center">
|
|
|
|
|
<div class="p-2 mr-3 bg-success-500 rounded">
|
|
|
|
|
<span class="peity-bar" data-peity="{"fill": ["#fff"], "width": 27, "height": 27 }">6,4,7,5,6</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label class="fs-sm mb-0">Clickthrough</label>
|
|
|
|
|
<h4 class="font-weight-bold mb-0">19.77%</h4>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-12-05 18:45:24 +08:00
|
|
|
|
</div>-->
|
|
|
|
|
<div style="width:100%; min-height:300px;">
|
|
|
|
|
<canvas class="chart" id="eveWeekElecChart"></canvas>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
</div>
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-11-15 12:54:21 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-11-15 11:25:47 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
|
|
|
|
|
<div class="row">
|
2022-12-02 18:53:00 +08:00
|
|
|
|
<div class="col-sm-12 col-lg-8">
|
|
|
|
|
<div class="row" id="sysSubBtnList">
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-11-15 11:25:47 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="col-sm-12 col-lg-4">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-lg-6">
|
2022-12-05 18:45:24 +08:00
|
|
|
|
<div id="panel-3" class="panel" data-panel-sortable data-panel-collapsed data-panel-close>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="panel-hdr">
|
|
|
|
|
<h2>
|
|
|
|
|
異常狀態
|
|
|
|
|
</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="panel-container show">
|
2022-12-03 16:45:20 +08:00
|
|
|
|
<div class="panel-content poisition-relative p-0">
|
2022-12-02 11:19:20 +08:00
|
|
|
|
<!--<div class="pb-5 pt-3">
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="d-flex mr-4">
|
|
|
|
|
<div class="mr-2">
|
|
|
|
|
<span class="peity-donut" data-peity="{ "fill": ["#967bbd", "#ccbfdf"], "innerRadius": 14, "radius": 20 }">7/10</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label class="fs-sm mb-0 mt-2 mt-md-0">New Sessions</label>
|
|
|
|
|
<h4 class="font-weight-bold mb-0">70.60%</h4>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-12-02 11:19:20 +08:00
|
|
|
|
</div>-->
|
2022-12-03 16:45:20 +08:00
|
|
|
|
<div class="col-12 mb-2 position-relative row m-0 justify-content-center">
|
2022-12-28 13:12:08 +08:00
|
|
|
|
<canvas class="chart" id="errRecChart"></canvas>
|
2022-12-02 11:19:20 +08:00
|
|
|
|
</div>
|
2022-12-03 16:45:20 +08:00
|
|
|
|
<div class="col-12 mb-2 position-relative row m-0 justify-content-center">
|
2022-12-06 14:34:04 +08:00
|
|
|
|
<canvas class="chart" id="errChkChart"></canvas>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-lg-6">
|
2022-12-05 18:45:24 +08:00
|
|
|
|
<div id="panel-3" class="panel" data-panel-sortable data-panel-collapsed data-panel-close>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
<div class="panel-hdr">
|
|
|
|
|
<h2>
|
|
|
|
|
工單進度
|
|
|
|
|
</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="panel-container show">
|
2022-12-03 16:45:20 +08:00
|
|
|
|
<div class="panel-content poisition-relative p-0">
|
2022-12-02 11:19:20 +08:00
|
|
|
|
<!--<div class="pb-5 pt-3">
|
2022-12-28 13:12:08 +08:00
|
|
|
|
<div class="d-flex mr-0">
|
|
|
|
|
<div class="mr-2">
|
|
|
|
|
<span class="peity-donut" data-peity="{ "fill": ["#2196F3", "#9acffa"], "innerRadius": 14, "radius": 20 }">3/10</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label class="fs-sm mb-0 mt-2 mt-md-0">Page Views</label>
|
|
|
|
|
<h4 class="font-weight-bold mb-0">14,134</h4>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>-->
|
2022-12-03 16:45:20 +08:00
|
|
|
|
<div class="col-12 mb-2 position-relative row m-0 justify-content-center">
|
|
|
|
|
<span class="text-center position-absolute t-white" style="top:25%;left:27%;">已完成<br>6</span>
|
|
|
|
|
<img src="img/u40.png" class="" style="width:75%;margin-left:0px;left:-22px;">
|
|
|
|
|
<span class="text-center position-absolute t-white" style="top:51%;left:58%;">未完成<br>8</span>
|
2022-12-02 11:19:20 +08:00
|
|
|
|
</div>
|
2022-12-03 16:45:20 +08:00
|
|
|
|
<div class="col-12 mb-2 position-relative row m-0 justify-content-center">
|
|
|
|
|
<span class="text-center position-absolute t-white" style="top:43%;left:26%;">未派工<br>5</span>
|
|
|
|
|
<img src="img/u43.png" class="mt-2 mb-1" style="width:51%;">
|
|
|
|
|
<span class="text-center position-absolute t-white" style="top:42%;left:58%;">派工中<br>9</span>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-11-15 11:25:47 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-11-15 12:54:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</main>
|
|
|
|
|
|
2022-11-15 11:25:47 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-12-02 18:59:00 +08:00
|
|
|
|
var tarElePath = '';
|
2022-12-05 18:45:24 +08:00
|
|
|
|
var sysSubList = [];
|
2022-12-08 17:27:32 +08:00
|
|
|
|
var floList = []; //每個樓層
|
|
|
|
|
var subSeviceData = []; //每個設備訂閱點位值
|
|
|
|
|
var allEleDevList = [];
|
|
|
|
|
var viewer3DNodeIds = [];
|
|
|
|
|
var elev3DBind = {};
|
|
|
|
|
var elev3DOption = {};
|
|
|
|
|
var elev3DObj = [];
|
2022-12-09 18:20:41 +08:00
|
|
|
|
var timeOuters = [];
|
|
|
|
|
var eveDayElecChart = null;
|
|
|
|
|
var eveWeekElecChart = null;
|
|
|
|
|
var errRecChart = null;
|
|
|
|
|
var errChkChart = null;
|
2022-12-12 15:06:35 +08:00
|
|
|
|
var loadedCnt = 0;
|
2022-12-28 13:12:08 +08:00
|
|
|
|
var chartDataCnt = { alarmCnt: 0, recCnt: 0, chkedErrCnt: 0, unChkedErrCnt: 0 };
|
2022-12-09 18:20:41 +08:00
|
|
|
|
|
2022-12-08 17:27:32 +08:00
|
|
|
|
var sysIconList = [
|
2022-12-08 18:12:40 +08:00
|
|
|
|
{ mainSys: "EE", subSys: "E1", iconClass: "fal fa-grip-vertical" },
|
|
|
|
|
{ mainSys: "EE", subSys: "E2", iconClass: "fal fa-grip-horizontal" },
|
|
|
|
|
{ mainSys: "EE", subSys: "E3", iconClass: "fal fa-bolt" },
|
|
|
|
|
{ mainSys: "EE", subSys: "E4", iconClass: "fal fa-car-battery" },
|
|
|
|
|
{ mainSys: "LT", subSys: "L1", iconClass: "fal fa-lightbulb-on" },
|
|
|
|
|
{ mainSys: "ME", subSys: "M10", iconClass: "fal fa-wind" },
|
|
|
|
|
{ mainSys: "ME", subSys: "M12", iconClass: "fal fa-snowflake" },
|
|
|
|
|
{ mainSys: "ELEV", subSys: "EL", iconClass: "fal fa-door-open" },
|
2022-12-28 13:12:08 +08:00
|
|
|
|
{ mainSys: "FE", subSys: "F1", iconClass: "fal fa-fire-extinguisher" },
|
|
|
|
|
{ mainSys: "FE", subSys: "F2", iconClass: "fal fa-smog" },
|
|
|
|
|
{ mainSys: "WP", subSys: "W1", iconClass: "fal fa-stopwatch" },
|
|
|
|
|
{ mainSys: "S", subSys: "R", iconClass: "fal fa-user-shield" },
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
var tempSysSubText = [
|
|
|
|
|
{ text: "高壓配電盤" ,mainSys: "EE", subSys: "E1", },
|
|
|
|
|
{ text: "低壓配電盤" ,mainSys: "EE", subSys: "E2", },
|
|
|
|
|
{ text: "緊急發電機" ,mainSys: "EE", subSys: "E3", },
|
|
|
|
|
{ text: "電錶系統" ,mainSys: "EE", subSys: "E4", },
|
|
|
|
|
{ text: "二線式照明系統" ,mainSys: "LT", subSys: "L1", },
|
|
|
|
|
{ text: "小型送風機" ,mainSys: "ME", subSys: "M10", },
|
|
|
|
|
{ text: "環境感測設備" ,mainSys: "ME", subSys: "M12", },
|
|
|
|
|
{ text: "電梯設備" ,mainSys: "ELEV", subSys: "EL", },
|
|
|
|
|
{ text: "消防設備" ,mainSys: "FE", subSys: "F1", },
|
|
|
|
|
{ text: "排煙系統" ,mainSys: "FE", subSys: "F2", },
|
|
|
|
|
{ text: "電子水錶" ,mainSys: "WP", subSys: "W1", },
|
|
|
|
|
{ text: "門禁安全系統" ,mainSys: "S", subSys: "R", }
|
2022-12-08 18:12:40 +08:00
|
|
|
|
];
|
|
|
|
|
|
2022-11-15 12:54:21 +08:00
|
|
|
|
$(document).ready(function () {
|
2022-12-04 01:16:30 +08:00
|
|
|
|
show3DModel();
|
2022-12-02 18:53:00 +08:00
|
|
|
|
getSubList();
|
2022-12-08 17:27:32 +08:00
|
|
|
|
getElevData();
|
2022-12-02 18:59:00 +08:00
|
|
|
|
getFirstEletric();
|
2022-12-08 17:27:32 +08:00
|
|
|
|
subDeviceSetStatus();
|
|
|
|
|
timeOutGetData();
|
2022-12-05 18:45:24 +08:00
|
|
|
|
});
|
2022-11-15 12:54:21 +08:00
|
|
|
|
|
2022-12-28 13:12:08 +08:00
|
|
|
|
function demoSubList() {
|
|
|
|
|
let isExiNames = $("#sysSubBtnList .dev-group button[id^=sysSubCardBtn]").toArray().map(x => $(x).text());
|
|
|
|
|
let strHtml = ``;
|
|
|
|
|
$.each(tempSysSubText, (idx, obj) => {
|
|
|
|
|
if (isExiNames.indexOf(obj.text) == -1) {
|
|
|
|
|
let iconObj = sysIconList.filter(x => x.mainSys == obj.mainSys && x.subSys == obj.subSys)[0];
|
|
|
|
|
strHtml += `<div class="btn-group btn-group-lg col-lg-3 mb-4 dev-group">
|
|
|
|
|
<button name="topFunBtn" data-page="alert" type="button" class="btn btn-secondary col-4"><i class="${iconObj.iconClass || "fal fa-hdd"} fa-2x py-2"></i></button>
|
|
|
|
|
<button id="sysSubCardBtn${obj.subSys}" type="button" class="btn btn-secondary" data-id="${obj.subSys}">${obj.text}</button>
|
|
|
|
|
</div>`;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
$("#sysSubBtnList").append(strHtml);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-05 18:45:24 +08:00
|
|
|
|
//取得 左下方 各系統小類
|
2022-12-02 18:53:00 +08:00
|
|
|
|
function getSubList() {
|
|
|
|
|
let url = baseApiUrl + "/api/Device/GetMainSub";
|
|
|
|
|
let sendData = {
|
|
|
|
|
building_tag: pageAct.buiTag,
|
|
|
|
|
};
|
|
|
|
|
objSendData.Data = sendData;
|
|
|
|
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
|
|
|
|
if (!res || res.code != "0000" || !res.data) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
let strHtml = ``;
|
2022-12-05 18:45:24 +08:00
|
|
|
|
let contest = ["E4", "EL", "L1", "M10", "M12"]
|
2022-12-02 18:53:00 +08:00
|
|
|
|
$.each(res.data.history_Main_Systems, (index, mainSysObj) => {
|
|
|
|
|
$.each(mainSysObj.history_Sub_systems, (index2, subSysObj) => {
|
2022-12-28 13:12:08 +08:00
|
|
|
|
if (contest.indexOf(subSysObj.sub_system_tag) != -1) {
|
2022-12-05 18:45:24 +08:00
|
|
|
|
sysSubList.push({ sysMainTag: mainSysObj.main_system_tag, sysSubTag: subSysObj.sub_system_tag });
|
|
|
|
|
}
|
2022-12-08 17:27:32 +08:00
|
|
|
|
let iconClass = sysIconList.filter(x => x.mainSys == mainSysObj.main_system_tag && x.subSys == subSysObj.sub_system_tag)[0]?.iconClass;
|
2022-12-03 16:45:20 +08:00
|
|
|
|
strHtml += `<div class="btn-group btn-group-lg col-lg-3 mb-4 dev-group" data-id="/${pageAct.AreaTag}/${pageAct.buiTag}/${mainSysObj.main_system_tag}/${subSysObj.sub_system_tag}">
|
2022-12-08 17:27:32 +08:00
|
|
|
|
<button name="topFunBtn" data-page="alert" type="button" class="btn btn-secondary col-4"><i class="${iconClass || "fal fa-hdd"} fa-2x py-2"></i></button>
|
|
|
|
|
<button id="sysSubCardBtn${subSysObj.sub_system_tag}" type="button" class="btn btn-secondary" data-id="${subSysObj.sub_system_tag}">${subSysObj.full_name}</button>
|
2022-12-02 18:53:00 +08:00
|
|
|
|
</div>`;
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
$("#sysSubBtnList").html(strHtml);
|
2022-12-28 13:12:08 +08:00
|
|
|
|
demoSubList();
|
|
|
|
|
|
2022-12-02 18:53:00 +08:00
|
|
|
|
}
|
|
|
|
|
}, null, "POST").send();
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-05 18:45:24 +08:00
|
|
|
|
//取得第一筆電錶
|
2022-12-02 18:59:00 +08:00
|
|
|
|
function getFirstEletric() {
|
2022-12-22 14:27:17 +08:00
|
|
|
|
let url = baseApiUrl + "/api/Energe/GetElecBySubSysTag";
|
|
|
|
|
|
|
|
|
|
ytAjax = new YourTeam.Ajax(url, null, function (res) {
|
2022-12-02 18:59:00 +08:00
|
|
|
|
if (!res || res.code != "0000" || !res.data) {
|
|
|
|
|
|
|
|
|
|
} else {
|
2022-12-22 14:27:17 +08:00
|
|
|
|
subSysElecList = res.data;
|
|
|
|
|
tarElePath = subSysElecList.filter(x => x.mainSubTag == "total")[0]?.system_device_tag ?? "";
|
2022-12-12 15:06:35 +08:00
|
|
|
|
startPageLoading();
|
|
|
|
|
getSubBaja();
|
2022-12-02 18:59:00 +08:00
|
|
|
|
getElectricBaja();
|
|
|
|
|
}
|
|
|
|
|
}, null, "POST").send();
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-12 15:06:35 +08:00
|
|
|
|
function getSubBaja() {
|
|
|
|
|
let devPath = tarElePath.split("_").slice(0, 8).join("/");
|
|
|
|
|
let tempOrdPath = { devicePath: devPath }
|
|
|
|
|
let myBaja = new subscriptionElectricmeter();
|
|
|
|
|
|
|
|
|
|
myBaja.setSubscribeElectricmeterByBql(tempOrdPath);
|
|
|
|
|
myBaja.setSubscribeElectricmeterCallBack(function (data) {
|
|
|
|
|
if (data.point_name == "P") {
|
|
|
|
|
let value = parseFloat(data.value).roundDecimal(2);
|
|
|
|
|
$("#insPower").text(value);
|
2022-12-29 18:44:09 +08:00
|
|
|
|
$("#insPowerPer").text((value / 4).roundDecimal(2));
|
2022-12-12 15:06:35 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
myBaja.setSubscribeElectricmeterEndCallBack(function () {
|
|
|
|
|
chkBajaLoaded();
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-05 18:45:24 +08:00
|
|
|
|
//從 baja 取得電表用電量
|
2022-12-02 18:59:00 +08:00
|
|
|
|
function getElectricBaja() {
|
2022-12-03 16:45:20 +08:00
|
|
|
|
let devNum = tarElePath.split("_").slice(0, 8).join("_");
|
|
|
|
|
let devPath = tarElePath.split("_").slice(0, 8).join("/");
|
|
|
|
|
|
2022-12-05 18:45:24 +08:00
|
|
|
|
let today = displayDate(new Date(), "date").replaceAll("/", "-") + "T00:00:00";
|
|
|
|
|
let prevTwoWeek = displayDate(getTimeByType(null, -14), "date").replaceAll("/", "-") + "T00:00:00";
|
2022-12-06 14:34:04 +08:00
|
|
|
|
let yesterday = displayDate(getTimeByType(null, -1), "date").replaceAll("/", "-") + "T00:00:00";
|
2022-12-05 18:45:24 +08:00
|
|
|
|
let tomorrow = displayDate(getTimeByType(null, 1), "date").replaceAll("/", "-") + "T00:00:00";
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-07 18:59:53 +08:00
|
|
|
|
// 今日用電量
|
2022-12-26 18:32:21 +08:00
|
|
|
|
getElectricMeterDayDataByBaja(devNum + "_kWh_tot", n4Sup, today, tomorrow, (data) => {
|
2022-12-07 18:59:53 +08:00
|
|
|
|
let result = data?.data[0]?.sum;
|
|
|
|
|
result = result ? parseFloat(result).toFixed(2) : 0;
|
|
|
|
|
$("#todayUseElec").text(result);
|
2022-12-06 14:34:04 +08:00
|
|
|
|
chkBajaLoaded();
|
2022-12-03 16:45:20 +08:00
|
|
|
|
})
|
2022-12-05 18:45:24 +08:00
|
|
|
|
|
2022-12-07 18:59:53 +08:00
|
|
|
|
// 今日用電量 (每小時)
|
2022-12-26 18:32:21 +08:00
|
|
|
|
getElectricMeterHourDataByBaja(devNum + "_kWh_tot", n4Sup, yesterday, tomorrow, (data) => {
|
2022-12-06 14:34:04 +08:00
|
|
|
|
|
2022-12-05 18:45:24 +08:00
|
|
|
|
let todayData = data.data.filter(x => x.timestamp.$date.$year == getTimeByType("year") && x.timestamp.$date.$month == getTimeByType("month") && x.timestamp.$date.$day == getTimeByType("date"));
|
|
|
|
|
let yesData = data.data.filter(x => x.timestamp.$date.$year == getTimeByType("year", -1) && x.timestamp.$date.$month == getTimeByType("month", -1) && x.timestamp.$date.$day == getTimeByType("date", -1));
|
|
|
|
|
chartEveDaysElec(todayData, yesData);
|
2022-12-06 14:34:04 +08:00
|
|
|
|
chkBajaLoaded();
|
2022-12-05 18:45:24 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 昨日用電量
|
2022-12-26 18:32:21 +08:00
|
|
|
|
getElectricMeterDayDataByBaja(devNum + "_kWh_tot", n4Sup, yesterday, today, (data) => {
|
2022-12-07 18:59:53 +08:00
|
|
|
|
let result = data?.data[0]?.sum;
|
|
|
|
|
result = result ? parseFloat(result).toFixed(2) : 0;
|
|
|
|
|
$("#yesUseElec").text(result);
|
2022-12-06 14:34:04 +08:00
|
|
|
|
chkBajaLoaded();
|
2022-12-03 16:45:20 +08:00
|
|
|
|
})
|
2022-12-05 18:45:24 +08:00
|
|
|
|
|
2022-12-07 18:59:53 +08:00
|
|
|
|
// 本週與上週用電量 (每天)
|
2022-12-26 18:32:21 +08:00
|
|
|
|
getElectricMeterDayDataByBaja(devNum + "_kWh_tot", n4Sup, prevTwoWeek, tomorrow, (data) => {
|
2022-12-05 18:45:24 +08:00
|
|
|
|
let curDay = (new Date()).getDay() == 0 ? 7 : (new Date()).getDay();
|
2022-12-06 14:34:04 +08:00
|
|
|
|
let curWeekData = data.data.filter(x => strToDate(displayDate(new Date(), "date"), null, 0 - (curDay - 1)) <= strToDate(x.timestamp.$cEncStr));
|
2022-12-05 18:45:24 +08:00
|
|
|
|
let prevWeekData = data.data.filter(x => strToDate(displayDate(new Date(), "date"), null, 0 - 7 - (curDay - 1)) <= strToDate(x.timestamp.$cEncStr) && strToDate(new Date(), null, 0 - 7) >= strToDate(x.timestamp.$cEncStr));
|
|
|
|
|
|
|
|
|
|
chartEveWeeksElec(curWeekData, prevWeekData)
|
2022-12-06 14:34:04 +08:00
|
|
|
|
chkBajaLoaded();
|
2022-12-05 18:45:24 +08:00
|
|
|
|
})
|
|
|
|
|
|
2022-12-06 14:34:04 +08:00
|
|
|
|
// 異常數量與賦歸數量
|
|
|
|
|
getAlarmCountByBaja((aData) => {
|
2022-12-12 15:06:35 +08:00
|
|
|
|
chartDataCnt.alarmCnt = aData.count;
|
2022-12-06 14:34:04 +08:00
|
|
|
|
chkBajaLoaded();
|
|
|
|
|
})
|
|
|
|
|
getRecoverCountByBaja((rData) => {
|
2022-12-12 15:06:35 +08:00
|
|
|
|
chartDataCnt.recCnt = rData.count;
|
2022-12-06 14:34:04 +08:00
|
|
|
|
chkBajaLoaded();
|
2022-12-02 18:53:00 +08:00
|
|
|
|
})
|
2022-12-06 14:34:04 +08:00
|
|
|
|
// 異常數量與賦歸數量
|
|
|
|
|
getCheckedAckedCountByBaja((data) => {
|
2022-12-12 15:06:35 +08:00
|
|
|
|
chartDataCnt.chkedErrCnt = data.count;
|
2022-12-06 14:34:04 +08:00
|
|
|
|
chkBajaLoaded();
|
|
|
|
|
})
|
2022-12-12 15:06:35 +08:00
|
|
|
|
|
2022-12-06 14:34:04 +08:00
|
|
|
|
getUnCheckedAckedCountByBaja((uData) => {
|
2022-12-12 15:06:35 +08:00
|
|
|
|
chartDataCnt.unChkedErrCnt = uData.count;
|
2022-12-06 14:34:04 +08:00
|
|
|
|
chkBajaLoaded();
|
|
|
|
|
})
|
2022-12-12 15:06:35 +08:00
|
|
|
|
}
|
2022-12-06 14:34:04 +08:00
|
|
|
|
|
2022-12-12 15:06:35 +08:00
|
|
|
|
function chkBajaLoaded() {
|
|
|
|
|
loadedCnt++;
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-12-12 15:06:35 +08:00
|
|
|
|
if (loadedCnt == 9) {
|
|
|
|
|
chartErrRec(["異常數量", "賦歸數量"], [chartDataCnt.alarmCnt, chartDataCnt.recCnt]);
|
|
|
|
|
chartErrChk(["已確認異常", "未確認異常"], [chartDataCnt.chkedErrCnt, chartDataCnt.unChkedErrCnt]);
|
|
|
|
|
|
|
|
|
|
endPageLoading();
|
2022-12-06 14:34:04 +08:00
|
|
|
|
}
|
2022-12-02 18:59:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-09 18:20:41 +08:00
|
|
|
|
// 圖表 - 今天與昨天用電量 (長條圖)
|
2022-12-05 18:45:24 +08:00
|
|
|
|
function chartEveDaysElec(todayData, yesData) {
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-12-05 18:45:24 +08:00
|
|
|
|
let eveDayElecChartCanvas = $('#eveDayElecChart').get(0).getContext('2d');
|
|
|
|
|
let curHour = (new Date()).getHours();
|
|
|
|
|
todayData.data = todayData.filter(x => x.timestamp.$time.$hour < curHour);
|
|
|
|
|
yesData.data = yesData.filter(x => x.timestamp.$time.$hour < curHour);
|
|
|
|
|
let eveDayElecChartData = {
|
|
|
|
|
labels: todayData?.data.map(x => x.timestamp.$time.$hour),
|
|
|
|
|
datasets: [
|
|
|
|
|
{
|
2022-12-28 13:12:08 +08:00
|
|
|
|
id: "today",
|
2022-12-05 18:45:24 +08:00
|
|
|
|
type: "bar",
|
|
|
|
|
label: '今日用電量',
|
|
|
|
|
fill: false,
|
2022-12-06 14:34:04 +08:00
|
|
|
|
backgroundColor: color.success._500,
|
|
|
|
|
borderColor: color.success._500,
|
|
|
|
|
pointColor: color.success._500,
|
2022-12-05 18:45:24 +08:00
|
|
|
|
pointBackgroundColor: color.main1,
|
2022-12-07 18:59:53 +08:00
|
|
|
|
data: todayData?.data.map(x => x.sum),
|
2022-12-05 18:45:24 +08:00
|
|
|
|
order: 1,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: "yesterday",
|
|
|
|
|
type: "bar",
|
|
|
|
|
label: '昨日用電量',
|
|
|
|
|
fill: false,
|
2022-12-06 14:34:04 +08:00
|
|
|
|
backgroundColor: color.info._100,
|
|
|
|
|
borderColor: color.info._100,
|
|
|
|
|
pointColor: color.info._100,
|
|
|
|
|
pointBackgroundColor: color.info._100,
|
2022-12-07 18:59:53 +08:00
|
|
|
|
data: yesData?.data.map(x => x.sum),
|
2022-12-05 18:45:24 +08:00
|
|
|
|
order: 2,
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let eveDayElecChartOptions = {
|
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
|
responsive: true,
|
|
|
|
|
legend: {
|
|
|
|
|
display: true,
|
|
|
|
|
},
|
|
|
|
|
scales: {
|
|
|
|
|
xAxes: [{
|
|
|
|
|
offset: true,
|
2022-12-06 14:34:04 +08:00
|
|
|
|
gridLines: { color: color.fusion._500 },
|
2022-12-05 18:45:24 +08:00
|
|
|
|
ticks: {
|
|
|
|
|
callback: function (value, index, ticks) {
|
|
|
|
|
return value
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}],
|
|
|
|
|
yAxes: [{
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-12-05 18:45:24 +08:00
|
|
|
|
ticks: {
|
2022-12-28 13:12:08 +08:00
|
|
|
|
min: 0,
|
2022-12-05 18:45:24 +08:00
|
|
|
|
beginAtZero: true
|
|
|
|
|
},
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
tooltips: {
|
|
|
|
|
callbacks: {
|
|
|
|
|
label: function (tooltipItem) {
|
|
|
|
|
let isTodayOrYes = tooltipItem.datasetIndex == 1 ? "昨日" : "今日";
|
|
|
|
|
return isTodayOrYes + "用電量 : " + tooltipItem.value + " kWH";
|
|
|
|
|
},
|
|
|
|
|
title: function (tooltipItem) {
|
|
|
|
|
let result = tooltipItem[0].xLabel.toString().padStart(2, "0") + ":00";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-09 18:20:41 +08:00
|
|
|
|
if (eveDayElecChart == null) {
|
|
|
|
|
eveDayElecChart = new Chart(eveDayElecChartCanvas, {
|
|
|
|
|
data: eveDayElecChartData,
|
|
|
|
|
options: eveDayElecChartOptions
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
eveDayElecChart.data.datasets.forEach((dataset) => {
|
|
|
|
|
if (dataset.order == 1) {
|
|
|
|
|
dataset.data = todayData?.data.map(x => x.sum);
|
|
|
|
|
} else {
|
|
|
|
|
dataset.data = yesData?.data.map(x => x.sum);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-12-05 18:45:24 +08:00
|
|
|
|
}
|
2022-12-08 17:27:32 +08:00
|
|
|
|
|
2022-12-09 18:20:41 +08:00
|
|
|
|
// 圖表 - 這週與上週用電量 (長條圖)
|
2022-12-05 18:45:24 +08:00
|
|
|
|
function chartEveWeeksElec(curWeekData, prevWeekData) {
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-12-05 18:45:24 +08:00
|
|
|
|
let eveWeekElecChartCanvas = $('#eveWeekElecChart').get(0).getContext('2d');
|
|
|
|
|
let eveWeekElecChartData = {
|
|
|
|
|
labels: curWeekData.map(x => dayToChiDay(strToDate(x.timestamp.$cEncStr, "day"))),
|
|
|
|
|
datasets: [
|
|
|
|
|
{
|
|
|
|
|
id: "today",
|
|
|
|
|
type: "bar",
|
|
|
|
|
label: '本週用電量',
|
|
|
|
|
fill: false,
|
2022-12-06 14:34:04 +08:00
|
|
|
|
backgroundColor: color.success._500,
|
|
|
|
|
borderColor: color.success._500,
|
|
|
|
|
pointColor: color.success._500,
|
|
|
|
|
pointBackgroundColor: color.success._500,
|
2022-12-07 18:59:53 +08:00
|
|
|
|
data: curWeekData.map(x => x.sum),
|
2022-12-05 18:45:24 +08:00
|
|
|
|
order: 1,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: "yesterday",
|
|
|
|
|
type: "bar",
|
|
|
|
|
label: '上週用電量',
|
|
|
|
|
fill: false,
|
2022-12-06 14:34:04 +08:00
|
|
|
|
backgroundColor: color.info._100,
|
|
|
|
|
borderColor: color.info._100,
|
|
|
|
|
pointColor: color.info._100,
|
|
|
|
|
pointBackgroundColor: color.info._100,
|
2022-12-07 18:59:53 +08:00
|
|
|
|
data: prevWeekData.map(x => x.sum),
|
2022-12-05 18:45:24 +08:00
|
|
|
|
order: 2,
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let eveWeekElecChartOptions = {
|
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
|
responsive: true,
|
|
|
|
|
legend: {
|
|
|
|
|
display: true,
|
|
|
|
|
},
|
|
|
|
|
scales: {
|
|
|
|
|
xAxes: [{
|
|
|
|
|
offset: true,
|
2022-12-06 14:34:04 +08:00
|
|
|
|
gridLines: { color: color.fusion._500 },
|
2022-12-05 18:45:24 +08:00
|
|
|
|
ticks: {
|
|
|
|
|
callback: function (value, index, ticks) {
|
|
|
|
|
return value
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}],
|
|
|
|
|
yAxes: [{
|
|
|
|
|
|
|
|
|
|
ticks: {
|
|
|
|
|
min: 0,
|
|
|
|
|
beginAtZero: true
|
|
|
|
|
},
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
tooltips: {
|
|
|
|
|
callbacks: {
|
|
|
|
|
label: function (tooltipItem) {
|
|
|
|
|
let isTodayOrYes = tooltipItem.datasetIndex == 1 ? "上週" : "本週";
|
|
|
|
|
return isTodayOrYes + "用電量 : " + tooltipItem.value + " kWH";
|
|
|
|
|
},
|
|
|
|
|
title: function (tooltipItem) {
|
|
|
|
|
let result = tooltipItem[0].xLabel.toString();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-09 18:20:41 +08:00
|
|
|
|
if (eveWeekElecChart == null) {
|
|
|
|
|
eveWeekElecChart = new Chart(eveWeekElecChartCanvas, {
|
|
|
|
|
data: eveWeekElecChartData,
|
|
|
|
|
options: eveWeekElecChartOptions
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
eveWeekElecChart.data.datasets.forEach((dataset) => {
|
|
|
|
|
if (dataset.order == 1) {
|
|
|
|
|
dataset.data = curWeekData.map(x => x.sum);
|
|
|
|
|
} else {
|
|
|
|
|
dataset.data = prevWeekData.map(x => x.sum);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-12-05 18:45:24 +08:00
|
|
|
|
}
|
2022-12-08 17:27:32 +08:00
|
|
|
|
|
2022-12-06 14:34:04 +08:00
|
|
|
|
// 圖表 - 異常與賦歸圖表 (圓餅圖)
|
2022-12-28 13:12:08 +08:00
|
|
|
|
function chartErrRec(labels, datas) {
|
2022-12-06 14:34:04 +08:00
|
|
|
|
|
|
|
|
|
let errRecChartCanvas = ctx = $('#errRecChart').get(0).getContext('2d');
|
2022-12-05 18:45:24 +08:00
|
|
|
|
|
2022-12-06 14:34:04 +08:00
|
|
|
|
let errRecChartData = {
|
|
|
|
|
labels: labels,
|
|
|
|
|
datasets: [
|
|
|
|
|
{
|
|
|
|
|
label: '數量',
|
|
|
|
|
unit: '個',
|
|
|
|
|
fill: true,
|
|
|
|
|
backgroundColor: [color.danger._500, color.info._300],
|
|
|
|
|
//data: errRecArr.map(x => parseInt((Math.random() * (1500 - 300) + 300))),
|
|
|
|
|
data: datas,
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let errRecChartOptions = {
|
|
|
|
|
//maintainAspectRatio: false,
|
|
|
|
|
responsive: true,
|
|
|
|
|
legend: {
|
|
|
|
|
display: true,
|
|
|
|
|
},
|
|
|
|
|
tooltips: {
|
|
|
|
|
enabled: true,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This will get the first returned node in the jQuery collection.
|
2022-12-09 18:20:41 +08:00
|
|
|
|
if (errRecChart == null) {
|
|
|
|
|
errRecChart = new Chart(errRecChartCanvas, {
|
|
|
|
|
type: "pie",
|
|
|
|
|
data: errRecChartData,
|
|
|
|
|
options: errRecChartOptions
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
errRecChart.data.datasets.forEach((dataset) => {
|
|
|
|
|
dataset.data = datas;
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-12-06 14:34:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 圖表 - 異常確認與未確認圖表 (圓餅圖)
|
|
|
|
|
function chartErrChk(labels, datas) {
|
|
|
|
|
|
|
|
|
|
let errChkChartCanvas = ctx = $('#errChkChart').get(0).getContext('2d');
|
|
|
|
|
|
|
|
|
|
let errChkChartData = {
|
|
|
|
|
labels: labels,
|
|
|
|
|
datasets: [
|
|
|
|
|
{
|
|
|
|
|
label: '數量',
|
|
|
|
|
unit: '個',
|
|
|
|
|
fill: true,
|
|
|
|
|
backgroundColor: [color.danger._500, color.info._300],
|
|
|
|
|
//data: errChkArr.map(x => parseInt((Math.random() * (1500 - 300) + 300))),
|
|
|
|
|
data: datas,
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let errChkChartOptions = {
|
|
|
|
|
//maintainAspectRatio: false,
|
|
|
|
|
responsive: true,
|
|
|
|
|
legend: {
|
|
|
|
|
display: true,
|
|
|
|
|
},
|
|
|
|
|
tooltips: {
|
|
|
|
|
enabled: true,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-09 18:20:41 +08:00
|
|
|
|
if (errChkChart == null) {
|
|
|
|
|
errChkChart = new Chart(errChkChartCanvas, {
|
|
|
|
|
type: "pie",
|
|
|
|
|
data: errChkChartData,
|
|
|
|
|
options: errChkChartOptions
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
errChkChart.data.datasets.forEach((dataset) => {
|
|
|
|
|
dataset.data = datas;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-06 14:34:04 +08:00
|
|
|
|
}
|
2022-12-08 17:27:32 +08:00
|
|
|
|
|
|
|
|
|
// 從 baja 訂閱 左下角各系統小類異常狀態
|
2022-12-12 15:06:35 +08:00
|
|
|
|
function getAlarmSub(data) {
|
|
|
|
|
$.each(data.data, (idx, alaObj) => {
|
|
|
|
|
if (alaObj.alarmClass.indexOf("_") != -1) {
|
|
|
|
|
let mainSubSys = alaObj.alarmClass.split("_").slice(0, 2).join("/");
|
|
|
|
|
$(`.btn-group.dev-group[data-id*='${mainSubSys}'] i`).addClass("blink");
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
$(`.dev-group i.fa-lightbulb-on.blink`).each((idx, ele) => {
|
|
|
|
|
let devPath = $(ele).parents(".dev-group").data("id");
|
|
|
|
|
let sysPath = devPath.split("/").slice(3, 5).join("/");
|
|
|
|
|
let alaDevPath = data.data.map(x => x.alarmClass?.split("_").slice(0, 2).join("/"));
|
|
|
|
|
if (alaDevPath.indexOf(sysPath) == -1) {
|
|
|
|
|
$(ele).removeClass("blink");
|
|
|
|
|
}
|
2022-12-05 18:45:24 +08:00
|
|
|
|
})
|
2022-12-08 17:27:32 +08:00
|
|
|
|
}
|
2022-12-02 18:59:00 +08:00
|
|
|
|
|
2022-12-08 17:27:32 +08:00
|
|
|
|
// 取得電梯資料
|
|
|
|
|
function getElevData() {
|
|
|
|
|
let url = baseApiUrl + "/api/Device/GetDeviceList";
|
|
|
|
|
let sendData = {
|
|
|
|
|
sub_system_tag: "EL",
|
|
|
|
|
building_tag: pageAct.buiTag,
|
|
|
|
|
};
|
|
|
|
|
objSendData.Data = sendData;
|
|
|
|
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
|
|
|
|
if (!res || res.code != "0000" || !res.data) {
|
2022-12-02 18:59:00 +08:00
|
|
|
|
|
2022-12-08 17:27:32 +08:00
|
|
|
|
} else {
|
|
|
|
|
$.each(res.data, (index, floObj) => {
|
|
|
|
|
let masters = floObj.device_list.map(x => x.device_number?.split("_")[5]).Distinct();
|
|
|
|
|
$.each(masters, (idx, master) => {
|
|
|
|
|
floObj.device_list.filter(x => x.device_number?.split("_")[5] == master).forEach((devObj) => {
|
|
|
|
|
allEleDevList.push(devObj);
|
|
|
|
|
allEleDevList = allEleDevList.oSort("priority");
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-12-08 17:27:32 +08:00
|
|
|
|
}
|
|
|
|
|
}, null, "POST").send();
|
2022-12-02 18:53:00 +08:00
|
|
|
|
}
|
2022-12-04 01:16:30 +08:00
|
|
|
|
|
2022-12-12 15:06:35 +08:00
|
|
|
|
//function timeOutGetData() {
|
|
|
|
|
// let timeOut3s = setInterval(() => {
|
|
|
|
|
// getAlarmSub();
|
|
|
|
|
// }, 3000)
|
|
|
|
|
// let timeOut5m = setInterval(() => {
|
|
|
|
|
// getElectricBaja();
|
|
|
|
|
// }, 5 * 60 * 1000)
|
|
|
|
|
// timeOuters = timeOuters.concat([timeOut3s, timeOut5m]);
|
|
|
|
|
//}
|
2022-12-05 18:45:24 +08:00
|
|
|
|
|
2022-12-04 01:16:30 +08:00
|
|
|
|
function show3DModel() {
|
2022-12-09 18:20:41 +08:00
|
|
|
|
launchViewerNoTools(pageAct.urn, (viewer, nodeIds) => {
|
2022-12-08 17:27:32 +08:00
|
|
|
|
nodeIds = Array.from(nodeIds);
|
|
|
|
|
$.each(nodeIds, (idx, item) => {
|
|
|
|
|
elev3DBind[item[0]] = item[1];
|
|
|
|
|
})
|
|
|
|
|
nodeIds = nodeIds.map(x => x[1]);
|
|
|
|
|
$.each(nodeIds, function (idx, node) {
|
|
|
|
|
let options = {
|
|
|
|
|
element: $("#forgeViewer"),
|
|
|
|
|
viewer: viewer,
|
|
|
|
|
nodeId: node,
|
|
|
|
|
floorHeight: elev3DOption.floorHeight ?? [],
|
|
|
|
|
inited: function () {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let elevator3DObj = new elevator3D(options);
|
|
|
|
|
let devNum = Object.keys(elev3DBind).filter(x => elev3DBind[x] == node)[0];
|
|
|
|
|
let subData = subSeviceData.filter(x => x.device_number == devNum)[0];
|
|
|
|
|
|
|
|
|
|
if (elev3DObj.filter(x => x.nodeId == node).length == 0) {
|
|
|
|
|
elev3DObj.push({ id: devNum, nodeId: node, obj: elevator3DObj });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (subData) {
|
|
|
|
|
let elevObj = elev3DObj.filter(x => x.nodeId == node)[0];
|
|
|
|
|
if (!elevObj.id) {
|
|
|
|
|
elevObj.id = devNum;
|
|
|
|
|
}
|
|
|
|
|
elevObj.obj = Object.assign(elevObj, elevator3DObj ?? {})
|
|
|
|
|
elevObj.obj.init(function () {
|
|
|
|
|
let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == node);
|
|
|
|
|
frags.forEach((fragProxy) => {
|
|
|
|
|
fragProxy.frag.position.z = elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
|
|
|
|
|
fragProxy.frag.updateAnimTransform()
|
|
|
|
|
})
|
|
|
|
|
elevObj.obj.viewer.impl.sceneUpdated(true);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function subDeviceSetStatus() {
|
|
|
|
|
let subOrdPath = {
|
2022-12-22 14:27:17 +08:00
|
|
|
|
"area_tag": pageAct.AreaTag,
|
2022-12-08 17:27:32 +08:00
|
|
|
|
"building_tag": pageAct.buiTag,
|
|
|
|
|
"system_tag": "ELEV",
|
|
|
|
|
"name_tag": "EL",
|
|
|
|
|
};
|
|
|
|
|
myBaja = new subscriptionDevices();
|
|
|
|
|
myBaja.setSubscribeDevicesByBql(subOrdPath);
|
|
|
|
|
myBaja.setSubscribeDevicesCallBack(function (data) {
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
if (allEleDevList.length == 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
data.device_number = data.device_number_full;
|
|
|
|
|
let matchDevice = allEleDevList.filter(x => x.device_number == data.device_number)[0];
|
2022-12-09 18:20:41 +08:00
|
|
|
|
let master = matchDevice?.device_number.split("_")[5];
|
|
|
|
|
|
|
|
|
|
if (!matchDevice) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-12-08 17:27:32 +08:00
|
|
|
|
|
|
|
|
|
if (data.point_name == "CP") {
|
|
|
|
|
if (elev3DObj.length != 0) {
|
|
|
|
|
let elevObj = elev3DObj.filter(x => x.nodeId == elev3DBind[matchDevice.device_number])[0];
|
|
|
|
|
if (elevObj && elevObj.id) {
|
|
|
|
|
elevObj.obj.setElevatorFloor(data.value)
|
|
|
|
|
elevObj.obj.movElevator();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//將訂閱值塞入 subSeviceData
|
|
|
|
|
if (subSeviceData.findIndex(x => x.device_number == matchDevice.device_number) == -1) {
|
|
|
|
|
let obj = {};
|
|
|
|
|
obj.device_number = matchDevice.device_number;
|
|
|
|
|
subSeviceData.push(obj)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let subData = subSeviceData.filter(x => x.device_number == matchDevice.device_number)[0];
|
|
|
|
|
|
|
|
|
|
if (subData) {
|
|
|
|
|
subData[data.point_name] = data.value;
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log("e", e)
|
|
|
|
|
}
|
2022-12-07 18:59:53 +08:00
|
|
|
|
});
|
2022-12-08 17:27:32 +08:00
|
|
|
|
myBaja.setSubscribeDeviceEndCallBack(function (data) {
|
|
|
|
|
|
|
|
|
|
let devNumArr = data.map(x => { return { devNum: x.device_number_full, priority: allEleDevList.filter(y => y.device_number == x.device_number_full)[0]?.priority } }).DistinctBy("devNum");
|
|
|
|
|
devNumArr = devNumArr.oSort("priority");
|
|
|
|
|
$.each(devNumArr, (idx, devObj) => {
|
|
|
|
|
devNum = devObj.devNum;
|
|
|
|
|
let subData = subSeviceData.filter(x => x.device_number == devNum)[0];
|
|
|
|
|
|
|
|
|
|
if (subData) {
|
|
|
|
|
//// 左側 3D 電梯 nodeID 與 device_number match
|
|
|
|
|
//if (Object.keys(elev3DBind).indexOf(devNum) == -1 && viewer3DNodeIds.length != 0) {
|
|
|
|
|
// elev3DBind[devNum] = viewer3DNodeIds[Object.keys(elev3DBind).length];
|
|
|
|
|
//}
|
|
|
|
|
// 左側 3D 電梯 Viewer Option 設置
|
|
|
|
|
/*elev3DOption.nodes = Object.keys(elev3DBind).map(x => elev3DBind[x]);*/
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-12-08 17:27:32 +08:00
|
|
|
|
floList = Object.keys(subData).filter(x => x.startsWith("SP_FLS_")).map(x => x?.split("SP_FLS_")[1]);
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-12-08 17:27:32 +08:00
|
|
|
|
elev3DOption.nodeId = elev3DBind[devNum];
|
|
|
|
|
elev3DOption.floorHeight = floList.map((x) => { return { floor: x } });
|
|
|
|
|
elev3DOption.floorHeight.forEach((floObj, idx) => {
|
|
|
|
|
if (floObj.floor.startsWith("B")) {
|
|
|
|
|
let floor = parseInt(floObj.floor.split("B")[1].split("F")[0]);
|
|
|
|
|
floObj.height = floor * -13;
|
|
|
|
|
} else {
|
|
|
|
|
let floor = parseInt(floObj.floor.split("F")[0]);
|
|
|
|
|
if (floor == 1) {
|
|
|
|
|
floObj.height = 0;
|
|
|
|
|
} else if (floor == 2) {
|
|
|
|
|
floObj.height = 14.75;
|
|
|
|
|
} else {
|
|
|
|
|
floObj.height = (14.75 + ((floor - 2) * 9.75));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-12-08 17:27:32 +08:00
|
|
|
|
if (elev3DObj.length != 0) {
|
|
|
|
|
let elevObj = elev3DObj.filter(x => x.nodeId == elev3DBind[devNum])[0];
|
|
|
|
|
if (!elevObj.id) {
|
|
|
|
|
elevObj.id = devNum;
|
|
|
|
|
}
|
|
|
|
|
elevObj.obj = Object.assign(elevObj.obj, elev3DOption);
|
|
|
|
|
elevObj.obj.init(function () {
|
|
|
|
|
let frags = elevObj.obj.fragProxys.filter(x => x.nodeId == elev3DBind[devNum]);
|
|
|
|
|
frags.forEach((fragProxy) => {
|
|
|
|
|
fragProxy.frag.position.z = elev3DOption.floorHeight.filter(x => x.floor == subData["CP"])[0]?.height ?? 0;
|
|
|
|
|
fragProxy.frag.updateAnimTransform();
|
|
|
|
|
})
|
|
|
|
|
elevObj.obj.viewer.impl.sceneUpdated(true);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
})
|
2022-12-04 01:16:30 +08:00
|
|
|
|
}
|
2022-12-08 17:27:32 +08:00
|
|
|
|
|
2022-12-12 15:06:35 +08:00
|
|
|
|
|
|
|
|
|
$(window).on("timeout:5m", function () {
|
|
|
|
|
console.log("五分鐘更新")
|
|
|
|
|
getElectricBaja();
|
|
|
|
|
})
|
2022-12-28 13:12:08 +08:00
|
|
|
|
|
2022-12-08 17:27:32 +08:00
|
|
|
|
onEvent("click", "button[id^=sysSubCardBtn]", function () {
|
|
|
|
|
let subSysTag = $(this).data("id");
|
|
|
|
|
$(`#subSysBtn${subSysTag}`).click();
|
|
|
|
|
})
|
2022-11-15 11:25:47 +08:00
|
|
|
|
</script>
|