123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491 |
- <!doctype html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
- <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
- <meta name="format-detection" content="telephone=no">
- <title>设备监控</title>
- <link rel="stylesheet" type="text/css" href="../../css/api.css" />
- <link rel="stylesheet" type="text/css" href="../../css/style.css" />
- <link rel="stylesheet" href="../../css/projeck.css">
- </head>
- <style>
- body,
- html {
- background: #009FE8;
- }
- .api_layout {
- padding: 0 10px 10px 10px;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- }
- .top {
- width: 100%;
- position: relative;
- }
- .top_img {
- display: block;
- width: 100%;
- height: 100%;
- border-radius: 10px;
- }
- .top p {
- position: absolute;
- top: 130px;
- right: 8px;
- font-weight: bold;
- font-size: 15px;
- }
- .content {
- padding: 15px;
- background: white;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- width: 100%;
- /* margin-bottom: 13px; */
- margin-top: 6px;
- position: relative;
- padding-top: 13px;
- box-shadow: 0 3px 29px 0 rgba(59, 74, 116, 0.14);
- }
- /*.borderRa {
- -webkit-border-radius: 10px;
- -moz-border-radius: 10px;
- border-radius: 10px;
- }*/
- .con_two {
- display: inline-block;
- height: 100%;
- }
- .content .title {
- text-align: center;
- font-size: 15px;
- color: #222627;
- font-weight: bold;
- }
- .borderRa:after {
- content: "";
- position: absolute;
- top: 50px;
- left: 0;
- width: 100%;
- height: 1px;
- background: #F3F3F3;
- }
- .content .condition {
- display: inline-block;
- width: 100%;
- height: 140px;
- background: white;
- position: relative;
- padding-top: 30px;
- }
- .condition .draught {
- width: 14px;
- height: 14px;
- border-radius: 50%;
- background: #ff3d27;
- }
- .circular-name {
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .circular-name span {
- font-size: 15px;
- margin-left: 5px;
- }
- .content .condition .statistical {
- display: inline-block;
- width: 100%;
- }
- .content .condition .statistical img {
- width: 100%;
- height: 100%;
- }
- .con {
- display: inline-block;
- width: 100%;
- height: 100%;
- padding: 0;
- }
- #tab_bar {
- width: 100%;
- height: 30px;
- }
- #tab_bar ul {
- padding: 0px;
- margin: 0px;
- height: 30px;
- text-align: center;
- border-bottom: 1px solid #f8f8fb;
- }
- #tab_bar li {
- list-style-type: none;
- float: left;
- width: 90px;
- height: 30px;
- line-height: 24px;
- color: #222627;
- }
- .tab_css {
- width: 100%;
- display: none;
- margin-top: 10px;
- }
- .tab_css .head {
- width: 100%;
- height: 40px;
- background: #F3F6FA;
- border-radius: 2px;
- color: #222627;
- display: flex;
- justify-content: space-between;
- }
- .head li {
- list-style: none;
- line-height: 40px;
- width: 25%;
- color: #222627;
- font-size: 13px;
- text-align: center;
- }
- .head li:first-child {
- width: 50%;
- }
- .items {
- padding: 0;
- margin: 0;
- width: 100%;
- border-radius: 2px;
- color: #222627;
- }
- .items .list {
- padding: 10px 0;
- text-align: center;
- display: flex;
- justify-content: space-between;
- position: relative;
- align-items: center;
- }
- .items .list span {
- width: 25%;
- color: #222627;
- font-size: 13px;
- }
- .list span:first-child {
- width: 50%;
- padding: 0 5px;
- box-sizing: border-box;
- }
- .list::after {
- content: '';
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 1px;
- background: #E8E9EA;
- }
- .list span:nth-child(2) {
- background: #64dcff;
- height: 20px;
- line-height: 20px;
- }
- #contents {
- margin-top: 23px;
- }
- </style>
- <body>
- <div class="api_layout">
- <div class="top">
- <img class="top_img" src="../../image/Equipmentmonito.png" alt="">
- <p class="time-box"></p>
- </div>
- <div class="content borderRa con_two">
- <p class="title">实时参数</p>
- <pseudo:after></pseudo:after>
- <div id="contents" class="con">
- <div id="tab_bar">
- <ul>
- <li id="tab1" onclick="myclick(1)" style="color: #3498DB;border-bottom: 2px solid #009FE8;font-weight: bold;">
- 1#设备
- </li>
- <li id="tab2" onclick="myclick(2)">
- 2#设备
- </li>
- </ul>
- </div>
- <div class="tab_css" id="tab1_content" style="display: block">
- </div>
- <div class="tab_css" id="tab2_content">
- </div>
- </div>
- </div>
- <div id="template_item_one">
- </div>
- <!-- 设备1# -->
- <div class="equipment_one_items tab_css" id="equipment_one" style="display: block">
- <div id="equipment_I_temperature" class="content borderRa con_two" style="padding: 15px 5px;">
- </div>
- <div id="equipment_I_vibration" class="content borderRa con_two" style="padding: 15px 5px;">
- </div>
- </div>
- <!-- 设备2# -->
- <div class="equipment_two_items tab_css" id="equipment_two" style="display: none">
- <div id="equipment_II_temperature" class="content borderRa con_two" style="padding: 15px 5px;">
- </div>
- <div id="equipment_II_vibration" class="content borderRa con_two" style="padding: 15px 5px;">
- </div>
- </div>
- </div>
- </body>
- <script type="text/template" id="fanTemplate">
- <ul class="head">
- <li>参数名称</li>
- <li>数值</li>
- <li>单位</li>
- </ul>
- <ul class="items">
- {{ for (var i = 0;i
- <it.length;i++) { }} <li class="list">
- <span>{{=it[i].title}}</span>
- <span>{{=it[i].val}}</span>
- <span>{{=it[i].unit}}</span>
- </li>
- {{ } }}
- </ul>
- </script>
- <script type="text/template" id="fan2Template">
- <ul class="head">
- <li>参数名称</li>
- <li>数值</li>
- <li>单位</li>
- </ul>
- <ul class="items">
- {{ for (var i = 0;i
- <it.length;i++) { }} <li class="list">
- <span>{{=it[i].title}}</span>
- <span>{{=it[i].val}}</span>
- <span>{{=it[i].unit}}</span>
- </li>
- {{ } }}
- </ul>
- </script>
- <script type="text/template" id="equipmentTemperature">
- <p class="title">设备温度趋势</p>
- <canvas id="equipmentTemperatureOne" style="width: 100%;height: 230px"></canvas>
- </script>
- <script type="text/template" id="equipmentVibration">
- <p class="title">设备震动趋势</p>
- <canvas id="equipmentVibrationOne" style="width: 100%;height: 230px"></canvas>
- </script>
- <script type="text/template" id="equipmentTemperatureSecond">
- <p class="title">设备温度趋势</p>
- <canvas id="equipmentTemperatureTwo" style="width: 100%;height: 230px"></canvas>
- </script>
- <script type="text/template" id="equipmentVibrationSecond">
- <p class="title">设备震动趋势</p>
- <canvas id="equipmentVibrationTwo" style="width: 100%;height: 230px"></canvas>
- </script>
- <script type="text/javascript" src="../../script/api.js"></script>
- <script src="../../script/f2.js"></script>
- <script type="text/javascript" src="../../script/doT.min.js"></script>
- <script type="text/javascript" src="../../script/config.js"></script>
- <script type="text/javascript" src="../../script/f2.js"></script>
- <script type="text/javascript">
- var header = ''
- // var toast = new auiToast()
- apiready = function() {
- setInterval(function() {
- $api.html($api.dom('.time-box'), getNowFormatDate());
- }, 1000)
- var info = $api.getStorage('data'),
- token = JSON.parse(info).data.access_token;
- headers = {
- "Authorization": "Bearer " + token
- };
- fanData(1)
- };
- // 参数依次为 容器的id名(containerId) script的模版id名(templateId)后台的返回数据(queryData)
- //canvas容器的id名() axisName是后台返回字段time (axisName) 最后一个参数是单位名称 (iValueName)例如 mm/s ...
- function f2ChartItem(containerId, templateId, queryData, canvasId, data, axisName, iValueName) {
- $apis.html(containerId, templateId, queryData);
- const chart = new F2.Chart({
- id: canvasId,
- pixelRatio: window.devicePixelRatio
- });
- chart.source(data, {
- time: {
- tickCount: 5
- },
- value: {
- tickCount: 8,
- min: 30,
- max: 100,
- formatter: function formatter(val) {
- // console.log(JSON.stringify(val));
- return val + iValueName;
- }
- }
- });
- chart.axis('value', {
- label: function label(text, index, total) {
- const textCfg = {};
- if (index === 0) {
- textCfg.textBaseline = 'bottom';
- } else if (index === total - 1) {
- textCfg.textBaseline = 'top';
- }
- return textCfg;
- }
- });
- chart.axis(axisName, {
- line: null,
- tickLine: {
- top: false
- },
- label: {
- offset: [-10, 10]
- }
- });
- chart.legend({
- position: 'top',
- offsetY: 15
- });
- chart.line()
- .position('time*value')
- .color('type')
- .shape('type', function(type) {
- if (type != '') {
- return 'line';
- }
- });
- chart.render();
- }
- // 1# 2#设备
- function fanData(type) {
- //
- $http.fnReuestDataNologing(UrlRouter.realList, header, 'get', '', function(ret, err) {
- // console.log(JSON.stringify(ret));
- // console.log(JSON.stringify(err));
- if (ret.code === 0) {
- // toast.hide();
- if (type == 1) {
- $apis.html(tab1_content, '#fanTemplate', ret.data.real['1#设备'].data);
- $api.css($api.dom('#equipment_one'), 'display: block');
- $api.css($api.dom('#equipment_two'), 'display: none');
- let temperatureData = ret.data.temperature['1#设备'].data;
- let equipmentVibrationData = ret.data.shock['1#设备'].data;
- console.log(JSON.stringify(temperatureData));
- // 设备1#温度趋势
- f2ChartItem(equipment_I_temperature, '#equipmentTemperature', temperatureData, 'equipmentTemperatureOne', temperatureData, 'time', '℃');
- // 设备1#震动趋势
- f2ChartItem(equipment_I_vibration, '#equipmentVibration', equipmentVibrationData, 'equipmentVibrationOne', equipmentVibrationData, 'time', 'mm/s');
- } else {
- $api.css($api.dom('#equipment_one'), 'display: none');
- $api.css($api.dom('#equipment_two'), 'display: block');
- $apis.html(tab2_content, '#fan2Template', ret.data.real['2#设备'].data);
- let temperatureDataTwo = ret.data.temperature['2#设备'].data;
- let equipmentVibrationDataTwo = ret.data.shock['2#设备'].data;
- //设备2#温度趋势
- f2ChartItem(equipment_II_temperature, '#equipmentTemperatureSecond', temperatureDataTwo, 'equipmentTemperatureTwo', temperatureDataTwo, 'time', '℃');
- f2ChartItem(equipment_II_vibration, '#equipmentVibrationSecond', equipmentVibrationDataTwo, 'equipmentVibrationTwo', equipmentVibrationDataTwo, 'time', 'mm/s');
- }
- }
- })
- }
- // tab切换
- var myclick = function(v) {
- var llis = document.getElementsByTagName("li");
- for (var i = 0; i < llis.length; i++) {
- var lli = llis[i];
- if (lli == document.getElementById("tab" + v)) {
- lli.style['border-bottom'] = '2px solid #009FE8';
- lli.style.color = "#3498DB";
- lli.style.fontWeight = "bold";
- } else {
- lli.style['border-bottom'] = "none";
- lli.style.color = "#273438";
- lli.style.fontWeight = "normal";
- }
- }
- var divs = document.getElementsByClassName("tab_css");
- for (var i = 0; i < divs.length; i++) {
- var divv = divs[i];
- if (divv == document.getElementById("tab" + v + "_content")) {
- divv.style.display = "block";
- fanData(v)
- } else {
- fanData(v)
- divv.style.display = "none";
- }
- }
- }
- </script>
- </html>
|