0204-01
This commit is contained in:
parent
f01e882cfc
commit
f46092e14e
@ -55,6 +55,33 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<!--MAP-->
|
||||
<link rel="stylesheet"
|
||||
href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
|
||||
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
|
||||
crossorigin="" />
|
||||
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"
|
||||
integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
|
||||
crossorigin="">
|
||||
</script>
|
||||
<style>
|
||||
html, body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#myMap {
|
||||
height: 50vh;
|
||||
}
|
||||
|
||||
#img_id {
|
||||
display: block; /* 使圖像為塊級元素,以便使用 margin:auto; */
|
||||
margin: auto; /* 將圖像置中 */
|
||||
width: 80%
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>工程模式</h1>
|
||||
|
||||
|
||||
@ -65,19 +92,21 @@
|
||||
|
||||
|
||||
<div class="row">
|
||||
<!--每日違規數量-->
|
||||
<!--即時影像-->
|
||||
<div class="col-xl-8 col-lg-8">
|
||||
<div class="card shadow mb-8">
|
||||
<div class="card-header py-3">
|
||||
<h6 class="m-0 font-weight-bold text-primary">每日違規數量</h6>
|
||||
<h6 class="m-0 font-weight-bold text-primary">即時影像</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="chart-bar">
|
||||
<canvas id="violation_car_Bar"></canvas>
|
||||
</div>
|
||||
<button class="btn btn-outline-info" onclick="Yuntech_RTSP()">雲科即時影像</button>
|
||||
<div id="myMap"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--演算法狀態-->
|
||||
<div class="col-xl-4 col-lg-5">
|
||||
<div class="card shadow mb-4">
|
||||
@ -107,9 +136,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div class="row">
|
||||
<!--每日違規數量-->
|
||||
<div class="col-xl-8 col-lg-8">
|
||||
<div class="card shadow mb-8">
|
||||
<div class="card-header py-3">
|
||||
<h6 class="m-0 font-weight-bold text-primary">每日違規數量</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="chart-bar">
|
||||
<canvas id="violation_car_Bar"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--字幕機狀態-->
|
||||
<div class="col-xl-4 col-lg-5">
|
||||
@ -142,6 +182,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
|
||||
<!--彈跳視窗-->
|
||||
<div>
|
||||
<dialog id="RTSP_view" style="width:80%;">
|
||||
<div>
|
||||
<p id="choose_cam_id"></p>
|
||||
<button class="btn btn-danger" style="float:right" onclick="RTSP_Close();"> 關閉</button>
|
||||
<img id="img_id" />
|
||||
</div>
|
||||
</dialog>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="/bootstrap_1/vendor/chart.js/Chart.min.js"></script>
|
||||
|
||||
@ -266,7 +320,6 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<!--設置違規資料-->
|
||||
<script>
|
||||
var date_list = []
|
||||
@ -433,7 +486,6 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<!--編輯演算法資料-->
|
||||
<script>
|
||||
function put_algorithm_data(Model) {
|
||||
@ -517,9 +569,6 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!--放置字幕機資料-->
|
||||
<script>
|
||||
function set_LED_data(Model) {
|
||||
@ -547,6 +596,282 @@
|
||||
|
||||
|
||||
|
||||
<!--跳轉頁面-->
|
||||
<script>
|
||||
|
||||
function Yuntech_RTSP() {
|
||||
window.open("http://140.125.50.178:7006/", "_blank");
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--串流影像-->
|
||||
<script>
|
||||
var IP_1
|
||||
var stop = false
|
||||
|
||||
function CAM_RTSP(IP) {
|
||||
console.log(IP)
|
||||
IP_1 = IP
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: 'http://140.125.20.183:7705/IP/' + IP,
|
||||
headers: {
|
||||
'Authorization': token
|
||||
},
|
||||
success: function (response) {
|
||||
stop = false
|
||||
RTSP_START(response)
|
||||
token_check = "true"
|
||||
//from_token_import_id()
|
||||
},
|
||||
error: function (xhr) {
|
||||
console.log("111")
|
||||
window.alert("相機未連線");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function CAM_RTSP_1() {
|
||||
console.log(IP_1)
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: 'http://140.125.20.183:7705/IP/' + IP_1,
|
||||
headers: {
|
||||
'Authorization': token
|
||||
},
|
||||
success: function (response) {
|
||||
//webcam_view.showModal()
|
||||
RTSP_START(response)
|
||||
|
||||
token_check = "true"
|
||||
//from_token_import_id()
|
||||
},
|
||||
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<!--開啟視窗並串流-->
|
||||
<script>
|
||||
function RTSP_START(img_base_64) {
|
||||
//console.log(img)
|
||||
img = document.getElementById("img_id")
|
||||
img.src = img_base_64
|
||||
if (stop == false) {
|
||||
setTimeout('CAM_RTSP_1()', 20);
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--關閉串流-->
|
||||
<script>
|
||||
function RTSP_Close() {
|
||||
RTSP_view.close()
|
||||
stop = true
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--map_show_停車場位置-->
|
||||
<script>
|
||||
var map
|
||||
function map_show() {
|
||||
var centerCoordinates = [23.691951, 120.535318]; // Replace with your desired coordinates
|
||||
|
||||
map = L.map("myMap", {
|
||||
center: centerCoordinates,
|
||||
zoom: 17
|
||||
});
|
||||
|
||||
//放置圖標
|
||||
var cam_icon = L.icon({
|
||||
|
||||
iconUrl: '/image/icon/cam.png',
|
||||
iconSize: [34, 34], // size of the icon
|
||||
iconAnchor: [27.3, 11.35], // point of the icon which will correspond to marker's location
|
||||
});
|
||||
|
||||
for (var i = 0; i < location_name_list.length; i++) {
|
||||
var location = [location_lat_list[i], location_lng_list[i]];
|
||||
cam_ip = L.marker(location, {
|
||||
icon: cam_icon,
|
||||
title: "",
|
||||
opacity: 1.0
|
||||
}).addTo(map);
|
||||
};
|
||||
|
||||
|
||||
// 載入圖資
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
|
||||
}).addTo(map);
|
||||
|
||||
|
||||
|
||||
|
||||
const popup = L.popup();
|
||||
function onMapClick(e) {
|
||||
lat = e.latlng.lat; // 緯度
|
||||
lng = e.latlng.lng; // 經度
|
||||
//console.log(lat, lng)
|
||||
|
||||
for (var i = 0; i < location_name_list.length; i++) {
|
||||
var location = [location_lat_list[i], location_lng_list[i]];
|
||||
if (isDifferenceGreaterThan5Percent(location[0], lat) < 3 && isDifferenceGreaterThan5Percent(location[1], lng) < 3) {
|
||||
//console.log()
|
||||
get_RTSP_data_3(location_name_list[i])
|
||||
//CAM_RTSP('192.168.100.82')
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
map.on('click', onMapClick);
|
||||
}
|
||||
|
||||
function isDifferenceGreaterThan5Percent(number1, number2) {
|
||||
// 計算差異的百分比
|
||||
var difference = Math.abs(number1 - number2);
|
||||
var percentageDifference = (difference / Math.max(number1, number2)) * 1000000;
|
||||
//console.log(percentageDifference)
|
||||
return percentageDifference
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<!--獲取資料-->
|
||||
<script>
|
||||
var token = localStorage.getItem('token_park_space');
|
||||
var token_ckeck //= document.getElementById("token_ckeck_id").value
|
||||
var position //職位
|
||||
var location_name_list = []
|
||||
var location_lat_list = []
|
||||
var location_lng_list = []
|
||||
|
||||
function get_RTSP_data() {
|
||||
//token_check = document.getElementById("token_check_id").value
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "http://140.125.20.183:7700/api/Parking_spaces_total_table",
|
||||
data: {},
|
||||
headers: {
|
||||
'Authorization': token
|
||||
},
|
||||
contentType: "application/json",
|
||||
success: function (Model) {
|
||||
set_RTSP_data_1(Model)
|
||||
get_RTSP_data_2()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function get_RTSP_data_2() {
|
||||
//token_check = document.getElementById("token_check_id").value
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "http://140.125.20.183:7700/api/Parking_spaces_violation_total_table",
|
||||
data: {},
|
||||
headers: {
|
||||
'Authorization': token
|
||||
},
|
||||
contentType: "application/json",
|
||||
success: function (Model) {
|
||||
set_RTSP_data_2(Model)
|
||||
map_show()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var location_name
|
||||
function get_RTSP_data_3(location_name) {
|
||||
location_name = location_name
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "http://140.125.20.183:7700/api/Parking_spaces_cam",
|
||||
data: {},
|
||||
headers: {
|
||||
'Authorization': token
|
||||
},
|
||||
contentType: "application/json",
|
||||
success: function (Model) {
|
||||
console.log(location_name)
|
||||
set_RTSP_data_3(Model, location_name)
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<!--放置資料-->
|
||||
<script>
|
||||
function set_RTSP_data_1(Model) {
|
||||
for (var i = 0; i < Model.length; i++) {
|
||||
|
||||
var hasValue = location_name_list.includes(Model[i].parking_spaces_name);
|
||||
if (hasValue == false) {
|
||||
location_name_list.push(Model[i].parking_spaces_name)
|
||||
location_lat_list.push(Model[i].latitude)
|
||||
location_lng_list.push(Model[i].longitude)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//console.log(location_name_list); // 輸出: true
|
||||
}
|
||||
|
||||
function set_RTSP_data_2(Model) {
|
||||
for (var i = 0; i < Model.length; i++) {
|
||||
|
||||
var hasValue = location_name_list.includes(Model[i].parking_spaces_violation_name);
|
||||
if (hasValue == false) {
|
||||
location_name_list.push(Model[i].parking_spaces_violation_name)
|
||||
location_lat_list.push(Model[i].latitude)
|
||||
location_lng_list.push(Model[i].longitude)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function set_RTSP_data_3(Model, location_name) {
|
||||
Button = '<button class="btn btn-outline-success " onclick="CAM_RTSP(';
|
||||
var i1 = 0
|
||||
if (Model.length > 0) {
|
||||
for (var i = 0; i < Model.length; i++) {
|
||||
if (Model[i].parking_spaces_name == location_name) {
|
||||
i1 = i1 + 1
|
||||
if (parseInt(Model[i].port) > 400) {
|
||||
Button += "'" + Model[i].ip + ":" + Model[i].port + "'" + ')">' + Model[i].ip + ":" + Model[i].port + '</button>'
|
||||
}
|
||||
Button += '<button class="btn btn-outline-success " onclick="CAM_RTSP(';
|
||||
if (i1 == 1) {
|
||||
CAM_RTSP(Model[i].ip + ":" + Model[i].port)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
document.getElementById("choose_cam_id").innerHTML = Button
|
||||
RTSP_view.showModal()
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<!--檢查token-->
|
||||
@ -607,6 +932,7 @@
|
||||
get_violation_data_1()
|
||||
get_algorithm_data()
|
||||
get_LED_data()
|
||||
get_RTSP_data()
|
||||
}
|
||||
else {
|
||||
window.location.href = '/';
|
||||
|
Loading…
Reference in New Issue
Block a user