123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Aisky-Sixth</title>
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <!-- 新 Bootstrap4 核心 CSS 文件 -->
- <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css">
- <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
- <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
- <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
- <script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
- <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
- <script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
- <!--可用來建立使用者小圖示-->
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
- <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js"></script>
- <!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">-->
- <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
- <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>-->
- <!--<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>-->
- <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
- <style>
- body {
- margin:0;
- <!--background-color: #4d4d4d;-->
- }
- .navbar-dark .navbar-nav .nav-link {
- color: white;
- cursor: pointer;
- text-decoration:none;
- width: 110px;
- height: 46px;
- }
- .nav-top {
- line-height:40px;
- background-color: #C4C4C4;
- }
- .website_title{
- font-family: Roboto;
- font-style: normal;
- font-weight: normal;
- font-size: 30px;
- color: #000000;
- }
- .navbar-nav > li{
- float: none;
- display: inline-block;
- width: 110px;
- margin: 0 auto;
- text-align: center;
- }
- .navbar-nav > li a{
- font-size: 20px;
- }
- .main-page {
- margin-top: 200px;
- }
- .page-title {
- font-family: Roboto;
- font-style: normal;
- font-weight: bold;
- font-size: 36px;
- }
- .flex {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- justify-content: center;
- }
- .node {
- height: auto;
- border: 2px solid #E5E5E5;
- border-radius: 5px;
- margin-top:35px;
- }
- .node-opt {
- font-size: 21px;
- }
- ol {
- list-style-type: disc;
- font-size: 17px;
- }
- .set-link {
- display: inline-block;
- width: 350px;
- height: 100px;
- line-height: 100px;
- background: #008CBA;
- border: 1px solid #CFCFCF;
- box-sizing: border-box;
- color: #FFFFFF;
- border-radius: 10px;
- font-size: 36px;
- }
- .fa{
- display: inline-block;
- font: normal normal normal 14px/1 FontAwesome;
- font-size: inherit;
- text-rendering: auto;
- -webkit-font-smoothing: antialiased;
- }
- .fa-user-o:before{
- content: "\f2c0";
- }
- .abc {background:lightgreen;border:1px #000 solid;cursor:move;padding:10px 5px;}
- .draggable {min-width:50px;height:45px;display:inline-block;font-size:.9em;z-index:1;text-align:center;}
- html, body, #map-canvas{
- width:100%;
- height: 100%;
- }
- @media(max-width:373px){
- .card {
- margin-right: 0px;
- }
- }
- @media(max-width:577px){
- }
- @media(min-width:576px){
- }
- @media(min-width:768px){
- .navbar-nav > li {
- margin-left: 0px;
- }
- .navbar-nav .li-block {
- display:none;
- }
- }
- @media(min-width:991px){
- .navbar-nav > li {
- margin-left: 20px;
- }
- .navbar-nav .li-block {
- display:none;
- }
- }
- @media(min-width:1200px){
- .navbar-nav > li {
- margin-left: 50px;
- }
- .navbar-nav .li-block {
- display: inline-block;
- width: 20px;
- }
- }
- @media(min-width:1400px){
- .navbar-nav .li-block {
- display: inline-block;
- width: 100px;
- }
- }
- @media(min-width:1689px) {
- .navbar-nav > li {
- margin-left: 50px;
- }
- .navbar-nav .li-block {
- display: inline-block;
- width: 450px;
- }
- }
- </style>
- <script>
- var img_id = 0;
- $(function(){
- //動態添加感測點圖片文件input
- var node_img = document.getElementById('node_img');
- var html = '';
- for(var s=1; s<={{params.monitor_num}}; s++){
- if(s < 10){
- s = "0" + s
- };
- html += '<div class="col-5">';
- html += 'Nr.' + s + ' : <input type="file" style="margin-bottom:20px;width:85%;color:white;background-color:red;" name="filename" class="filename" onchange="" accept="image/gif, image/jpeg, image/png">';
- html += '</div>';
- //html += '<br>';
- };
- node_img.innerHTML = html;
- //判斷用戶如果是上傳圖片
- {% if params.path %}
- var path = '..' + '{{params.path}}'.substring(3);
- $("#farm_img").attr('src', path);
- $("#map-canvas").css('display', 'none');
- img_id = "#farm_img";
- var node_div = document.getElementById('node-list');
- for(var i=1; i<={{params.monitor_num}}; i++){
- if(i < 10){
- i = "0" + i
- };
- var div = document.createElement('div');
- var html = '';
- html += '<p style="font-weight: bold;">Nr.' + i + '</p>';
- html += '<input type="hidden" name="lat' + i + '" id="a' + i + '-1" value="0"></input>';
- html += '<input type="hidden" name="lng' + i + '" id="a' + i + '-2" value="0"></input>';
- div.innerHTML = html;
- div.setAttribute('id', 'a' + i);
- div.setAttribute('class', 'draggable abc');
- node_div.appendChild(div);
- <!--$('#a' + i).draggable({-->
- <!--disabled: false,-->
- <!--containment: '' + img_id,-->
- <!--grid: [ 1, 1 ],-->
- <!--snap: true,-->
- <!--snapMode: 'outter',-->
- <!--snapTolerance: 5,-->
- <!--scroll: false-->
- <!--}).mousemove(function(){-->
- <!--var coord = $(this).position();-->
- <!--document.getElementById('a' + i + '-1').value = Math.floor(coord.left);-->
- <!--document.getElementById('a' + i + '-2').value = Math.floor(coord.top);-->
- <!--});-->
- //使用eval()函數執行字串
- eval("$('#a" + i + "').draggable({disabled:false,containment:'" + img_id + "',grid:[1,1],snap:true,snapMode:'outter',snapTolerance:5,scroll:false}).mousemove(function(){var coord = $(this).position();document.getElementById('a" + i + "-1').value = Math.floor(coord.left);document.getElementById('a" + i + "-2').value = Math.floor(coord.top);});");
- };
- //判斷用戶如果是輸入地址
- {% else %}
- img_id = "#map-canvas";
- {% endif %}
- });
- function img_error() {
- //this.src='./inimage/psfi.jpg';
- document.getElementById("" + img_id).src="../static/img/psfi.jpg";
- $('#a01').draggable('option','disabled', true);
- $('#a01').css('background-color', 'red');
- $('#a02').draggable('option','disabled', true);
- $('#a02').css('background-color', 'red');
- $('#a03').draggable('option','disabled', true);
- $('#a03').css('background-color', 'red');
- $('#a04').draggable('option','disabled', true);
- $('#a04').css('background-color', 'red');
- $('#a05').draggable('option','disabled', true);
- $('#a05').css('background-color', 'red');
- $('#a06').draggable('option','disabled', true);
- $('#a06').css('background-color', 'red');
- }
- //------------------------------
- function readURL(input) {
- if (input.files && input.files[0]) {
- var reader = new FileReader();
- reader.onload = function (e) {
- $('' + img_id).attr('src', e.target.result);
- $('' + img_id).css("width", "1100px");
- $('' + img_id).css("height", "650px");
- $('#a01').draggable('option','disabled', false);
- $('#a01').css('background-color', 'lightgreen');
- $('#a02').draggable('option','disabled', false);
- $('#a02').css('background-color', 'lightgreen');
- $('#a03').draggable('option','disabled', false);
- $('#a03').css('background-color', 'lightgreen');
- $('#a04').draggable('option','disabled', false);
- $('#a04').css('background-color', 'lightgreen');
- $('#a05').draggable('option','disabled', false);
- $('#a05').css('background-color', 'lightgreen');
- $('#a06').draggable('option','disabled', false);
- $('#a06').css('background-color', 'lightgreen');
- //$('' + img_id).css("max-height", 800);
- }
- reader.readAsDataURL(input.files[0]);
- }
- //-------------------------------------------------------
- var inputVal = document.getElementById("filename");
- var OK = document.getElementById("OK");
- if (inputVal.value == "") {
- inputVal.style.backgroundColor = "#e67300";
- document.getElementById("" + img_id).src="";
- }
- else{
- inputVal.style.backgroundColor = "";
- }
- }
- //---------------------------------------------------------
- function refreshPage(){
- //window.location.reload(true); //error in safari
- $('#rq').submit();
- }
- </script>
- </head>
- <body>
- <nav class="fixed-top">
- <nav class="navbar navbar-expand-md nav-top justify-content-center">
- <div>
- <span class="website_title">序號登記2</span>
- </div>
- </nav>
- <nav class="navbar navbar-expand-md bg-dark navbar-dark nav-bottom">
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
- <span class="navbar-toggler-icon"></span>
- </button>
- <div class="collapse navbar-collapse" id="collapsibleNavbar">
- <ul class="navbar-nav">
- <li class="nav-item">
- <a class="nav-link" href="/">序號登記</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="#">排程設定</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="#">報表輸出</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="#">RMA</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="#">故障紀錄</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="#">求助</a>
- </li>
- <li class="li-block"></li>
- <li class="nav-item">
- <a class="nav-link" href="#"><i class="fa fa-user-o"></i> {{params.username}}</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/logout">Logout</a>
- </li>
- </ul>
- </div>
- </nav>
- </nav>
- <div class="main-page">
- <form method="post" action="/register_number2" enctype="multipart/form-data">
- <div class="container">
- <div class="row">
- <div class="col flex" style="margin: auto; ">
- <div class="col-12" style="margin-top:30px;">
- <h1>Step3:</h1>
- </div>
- <div class="col-2"></div>
- <div class="col-10">
- <label style="color:black;font-size:20px;">Please place the sensor and upload photos/請將感測器置於案場後並上傳相對應圖片:</label>
- </div>
- <div class="col-2"></div>
- <div id="node_img" class="col-10 row">
- <!--Nr.01 : <input type="file" style="width:40%;color:white;background-color:red;" name="filename" id="filename" onchange="" accept="image/gif, image/jpeg, image/png">-->
- </div>
- <div class="col-12" style="background-color:black;height:2px;margin:20px auto 20px;"></div>
- <div class="col-12" style="margin-top:30px;">
- <h1>Step4:</h1>
- </div>
- <div class="col-2"></div>
- <div class="col-10">
- <label style="color:black;font-size:20px;">Please drag sensor point to the right position/請把感測點拖到農場相對位置上</label>
- </div>
- <div id="node-list" class="col-12" style="width:100%;">
- <!--<div id='a01' class='draggable abc' style=''>-->
- <!--<p style='font-weight: bold;'>Nr.1</p>-->
- <!--<input type='hidden' name='l1' id='a01-1' value='0'></input>-->
- <!--<input type='hidden' name='t1' id='a01-2' value='0'></input>-->
- <!--</div>-->
- <!--<div id='a02' class='draggable abc' style=''>-->
- <!--<p style='font-weight: bold;'>Nr.2</p>-->
- <!--<input type='hidden' name='l2' id='a02-1' value='0'></input>-->
- <!--<input type='hidden' name='t2' id='a02-2' value='0'></input>-->
- <!--</div>-->
- <!--<div id='a03' class='draggable abc' style=''>-->
- <!--<p style='font-weight: bold;'>Nr.3</p>-->
- <!--<input type='hidden' name='l3' id='a03-1' value='0'></input>-->
- <!--<input type='hidden' name='t3' id='a03-2' value='0'></input>-->
- <!--</div>-->
- <!--<div id='a04' class='draggable abc' style=''>-->
- <!--<p style='font-weight: bold;'>Nr.4</p>-->
- <!--<input type='hidden' name='l4' id='a04-1' value='0'></input>-->
- <!--<input type='hidden' name='t4' id='a04-2' value='0'></input>-->
- <!--</div>-->
- <!--<div id='a05' class='draggable abc' style=''>-->
- <!--<p style='font-weight: bold;'>Nr.5</p>-->
- <!--<input type='hidden' name='l5' id='a05-1' value='0'></input>-->
- <!--<input type='hidden' name='t5' id='a05-2' value='0'></input>-->
- <!--</div>-->
- <!--<div id='a06' class='draggable abc' style=''>-->
- <!--<p style='font-weight: bold;'>Nr.6</p>-->
- <!--<input type='hidden' name='l6' id='a06-1' value='0'></input>-->
- <!--<input type='hidden' name='t6' id='a06-2' value='0'></input>-->
- <!--</div>-->
- </div>
- <div class="col-12">
- <img id="farm_img" src="" style='width:1080px;height:650px;' onError="img_error()" ondragstart="return false;">
- </div>
- <div class="col-12">
- <div id="map-canvas" class="col-12" style="text-align:center;background-color:#f2f2f2;padding:280px;border:1px;border-radius: 35px;"></div>
- </div>
- <div class="col-12" style="background-color:black;height:2px;margin-bottom:20px;margin-top:50px;"></div>
- <div class="col-xs-2 col-xs-offset-2">
- <input type="reset" class="btn btn-secondary" style="margin:0 20px;font-weight:bold;" data-dismiss="modal" value="Reset/重設">
- </div>
- <div class="col-xs-2 col-xs-offset-3">
- <input type="submit" class="btn btn-success" style="margin:0 20px;font-weight:bold;color:black;" data-toggle="modal" data-target="#123" value="Save changes/設定完成">
- </div>
- <div class="col-12" style="height:70px;"></div>
- </div>
- </div>
- </div>
- </form>
- </div>
- </body>
- <script>
- {% if params.lat %}
- $("#farm_img").css('display', 'none');
- function initialize() {
- var lat = {{params.lat}};
- var lng = {{params.lng}};
- var a = -1;
- var mapOptions = {
- center: { lat: lat, lng: lng},
- <!--center: { lat: 22.707340, lng: 120.531000},-->
- zoom: 19,
- mapTypeId: 'satellite',
- };
- var map = new google.maps.Map(
- document.getElementById('map-canvas'),
- mapOptions);
- var node_div = document.getElementById('node-list');
- for(var i=1; i<={{params.monitor_num}}; i++){
- if(i < 10){
- i = "0" + i
- };
- var div = document.createElement('div');
- var html = '';
- html += '<input type="hidden" name="lat' + i + '" id="a' + i + '-1" value="0"></input>';
- html += '<input type="hidden" name="lng' + i + '" id="a' + i + '-2" value="0"></input>';
- div.innerHTML = html;
- node_div.appendChild(div);
- lng = lng + 0.00008;
- var defineStr = "var position" + i.toString();
- var defineStr2 = "var marker" + i.toString();
- //使用eval()函數執行字串
- eval(defineStr);
- eval(defineStr2);
- //為position賦值
- eval("position" + i.toString() + " = " + "{lat:" + lat + ",lng:" + lng + "};");
- //為marker賦值
- eval("marker" + i.toString() + " = " + "new google.maps.Marker({position:" + ("position" + i.toString()) + ",map:map,label:'" + i + "',draggable:true});");
- //監聽marker拖曳結束事件
- eval("marker" + i.toString() + ".addListener('dragend',function(){var s = marker" + i.toString() + ".getPosition();var lat = s.lat().toString();var lng = s.lng().toString();document.getElementById('a" + i + "-1').value = lat;document.getElementById('a" + i + "-2').value = lng;});");
- };
- };
- <!--google.maps.event.addDomListener(-->
- <!--window, 'load', initialize);-->
- {% endif %}
- </script>
- <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDKVm-6LBJqxrDJLEzJujGjZLVTfK0RiAE&callback=initialize"></script>
- </html>
|