From 8e92b167650c011cfd38096524e6877268ae65b1 Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期六, 06 五月 2023 15:58:13 +0800
Subject: [PATCH] 预警和视频页面

---
 igds-app/security-video.html        |   21 +-
 igds-app/warn-list.html             |   64 ++------
 igds-app/inout-out-record.html      |    2 
 igds-app/inout-in-record.html       |    6 
 igds-app/js/admin/security-video.js |  146 ++++++++++++++++++
 igds-app/js/admin/warn-list.js      |  238 +++++++++++++++++++++++++++++
 6 files changed, 416 insertions(+), 61 deletions(-)

diff --git a/igds-app/inout-in-record.html b/igds-app/inout-in-record.html
index 396e296..7a5278a 100644
--- a/igds-app/inout-in-record.html
+++ b/igds-app/inout-in-record.html
@@ -32,7 +32,7 @@
 				<div class="mui-scroll-wrapper rkjl">
 					<div class="mui-scroll">
 						<div class="m-record" id="recordList">
-							<div class="id" style="text-align: center;font-size: 20px;color:#dd524d">鎵�閫夋棩鏈熸殏鏃犲叆搴撹褰曚俊鎭�</div>
+							<!-- <div class="id" style="text-align: center;font-size: 20px;color:#dd524d">鎵�閫夋棩鏈熸殏鏃犲叆搴撹褰曚俊鎭�</div> -->
 							<!-- <div class="item">
 								<div class="id">鍗曟嵁鍙�: 202205050002</div>
 								<ul class="g-listb2">
@@ -59,7 +59,8 @@
 								</ul>
 								<div class="time">瀹屾垚鏃堕棿: 2021-05-08 12:00 </div>
 							</div>
-							<div class="item">
+							 
+							 <div class="item">
 								<div class="id">鍗曟嵁鍙�: 202205050002</div>
 								<ul class="g-listb2">
 									<li>
@@ -110,6 +111,7 @@
 									</li>
 								</ul>
 								<div class="time">瀹屾垚鏃堕棿: 2021-05-08 12:00 </div>
+								-->
 							</div>
 						</div>
 					</div>
diff --git a/igds-app/inout-out-record.html b/igds-app/inout-out-record.html
index 11eed15..dcf687a 100644
--- a/igds-app/inout-out-record.html
+++ b/igds-app/inout-out-record.html
@@ -23,7 +23,7 @@
 			<div class="g-date_box">
 				<span class="day prev" onclick="addAndReduceMonth(-1)">鍓嶄竴澶�</span>
 				<div class="inpbox" onclick="chooseDate();">
-					<input id="dateTime" type="text" value="2022-04-15" readonly class="inp" />
+					<input id="dateTime" type="text" value="" readonly class="inp" />
 				</div>
 				<span class="day next" onclick="addAndReduceMonth(1)">鍚庝竴澶�</span>
 			</div>
diff --git a/igds-app/js/admin/security-video.js b/igds-app/js/admin/security-video.js
new file mode 100644
index 0000000..8e873a8
--- /dev/null
+++ b/igds-app/js/admin/security-video.js
@@ -0,0 +1,146 @@
+var url = null;
+var videoData = null;
+var playData =null;
+var data = {
+	"interfaceId": "5604",
+	"tokenAuth": "",
+	"sign": "10003",
+	"outId": "10003",
+	"reqDateTime": new Date(),
+	"data": {
+		"deptId": ""
+	}
+};
+var data1 = {
+	"interfaceId": "5605",
+	"tokenAuth": "",
+	"sign": "10003",
+	"outId": "10003",
+	"reqDateTime": new Date(),
+	"data": {
+		"id": "",
+		"playType": ""
+	}
+};
+
+function init() {
+
+	var user = JSON.parse(localStorage.getItem('user'));
+	var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId'));
+	data.tokenAuth = user.tokenAuth;
+	data1.tokenAuth = user.tokenAuth;
+	data.data.deptId = selectDeptId;
+	url = user.url + "/api-phone/v35/gateway";
+
+	getVideoList();
+
+}
+
+function getVideoList() {
+	//鍙戦�佽姹傝幏鍙栬棰戣澶�
+	mui.ajax(url, {
+		type: "POST",
+		dataType: "json",
+		crossDomain: true,
+		contentType: "application/json;charset=utf-8",
+		data: JSON.stringify(data),
+		success: function(result) {
+			if (result.code == "0000") {
+				videoData = result.data;
+				console.log(JSON.stringify(videoData))
+				renderVideo();
+			} else {
+				renderVideo();
+				mui.alert(result.msg, '鎻愮ず', ["纭畾"], function() {}, "div");
+				
+			}
+		},
+		error: function() {
+			renderVideo();
+			mui.alert('绯荤粺绻佸繖,璇烽噸璇曪紒', '鎻愮ず', ["纭畾"], function() {}, "div");
+		}
+	})
+}
+
+//娓叉煋瑙嗛鐩戞帶璁惧
+function renderVideo() {
+	var html = '';
+	if (videoData) {
+		var videoList = videoData.data;
+		if (videoList && videoList.length > 0) {
+			$.each(videoList, function(index, item) {
+				if (index % 3 == 0) {
+					html +=
+					'<li><a onclick="getVideo('+item.id,item.playType+')" class="con" style="background-image: url(images/icons/g-i15.png);">';
+				}
+				if (index % 3 == 1) {
+					html +=
+					'<li><a onclick="getVideo('+item.id,item.playType+')" class="con" style="background-image: url(images/icons/g-i16.png);">';
+				}
+				if (index % 3 == 2) {
+					html +=
+					'<li><a onclick="getVideo('+item.id,item.playType+')" class="con" style="background-image: url(images/icons/g-i17.png);">';
+				}
+				if (item.type = '02') {
+					html +=
+						'<div class="left"><div class="icon"><img src="images/icons/g-i13.png" alt=""></div><div class="name">' +
+						item.name + ' (鐞冩満)</div></div>';
+				}
+				if (item.type == '01') {
+					html +=
+						'<div class="left"><div class="icon"><img src="images/icons/g-i14.png" alt=""></div><div class="name">' +
+						item.name + ' (鏋満)</div></div>';
+				}
+
+				html += '<div class="right"><span class="mui-icon  mui-icon-forward"></span></div></a></li>';
+			})
+		} else {
+			html += '<li><a class="con" style="background-image: url(images/icons/g-i15.png);"><span>鏆傛棤鐩稿叧璁惧</span></a></li>';
+		}
+	}else{
+		html += '<li><a class="con" style="background-image: url(images/icons/g-i15.png);"><span>鏆傛棤鐩稿叧璁惧</span></a></li>';
+	}
+	$("#recordList").html(html);
+}
+
+
+function getVideo(cameraId,playType){
+	data1.data.id = cameraId;
+	data1.data.playType = playType;
+	
+	//鍙戦�佽姹傝幏鍙栬棰戣澶�
+	mui.ajax(url, {
+		type: "POST",
+		dataType: "json",
+		crossDomain: true,
+		contentType: "application/json;charset=utf-8",
+		data: JSON.stringify(data1),
+		success: function(result) {
+			if (result.code == "0000") {
+				playData = result.data;
+				console.log(JSON.stringify(playData))
+				toVideo(playData.playAddr);
+			} else {
+				toVideo('');
+				mui.alert(result.msg, '鎻愮ず', ["纭畾"], function() {}, "div");
+			}
+		},
+		error: function() {
+			toVideo('');
+			mui.alert('绯荤粺绻佸繖,璇烽噸璇曪紒', '鎻愮ず', ["纭畾"], function() {}, "div");
+		}
+	})
+}
+
+function toVideo(playAddr){
+	var html = '';
+	html += '<video src="'+playAddr+'" poster="images/pos1.png" class="video" webkit-playsinline="true" playsinline="true" controls></video>'
+	$("#toVideo").html(html);
+}
+
+mui('.mui-scroll-wrapper').scroll({
+	indicators: false, //鏄惁鏄剧ず婊氬姩鏉�
+	deceleration: 0.0006, //闃诲凹绯绘暟,绯绘暟瓒婂皬婊戝姩瓒婄伒鏁�
+	bounce: false, //鏄惁鍚敤鍥炲脊
+	deceleration: 0.0005 //flick 鍑忛�熺郴鏁帮紝绯绘暟瓒婂ぇ锛屾粴鍔ㄩ�熷害瓒婃參锛屾粴鍔ㄨ窛绂昏秺灏忥紝榛樿鍊�0.0006
+});
\ No newline at end of file
diff --git a/igds-app/js/admin/warn-list.js b/igds-app/js/admin/warn-list.js
new file mode 100644
index 0000000..525270c
--- /dev/null
+++ b/igds-app/js/admin/warn-list.js
@@ -0,0 +1,238 @@
+var url = null;
+var dateTime;
+var warnData = null;
+var data = {
+	"interfaceId": "5801",
+	"tokenAuth": "",
+	"sign": "10003",
+	"outId": "10003",
+	"reqDateTime": new Date(),
+	"data": {
+		"deptId": "",
+		"dataTime": ""
+	}
+};
+var dataPop = {
+	"interfaceId": "5802",
+	"tokenAuth": "",
+	"sign": "10003",
+	"outId": "10003",
+	"reqDateTime": new Date(),
+	"data": {
+		"id":"",
+		"status": "",
+		"remark": ""
+	}
+};
+
+function init() {
+
+	console.log("init")
+	var user = JSON.parse(localStorage.getItem('user'));
+	var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId'));
+	data.tokenAuth = user.tokenAuth;
+	dataPop.tokenAuth = user.tokenAuth;
+	data.data.deptId = selectDeptId;
+	url = user.url + "/api-phone/v35/gateway";
+
+	dateTime = getDate(new Date())
+	$('#date').val(dateTime)
+
+	//鑾峰彇璀﹀憡璁板綍
+	getWarnList();
+
+}
+
+
+//鑾峰彇璀﹀憡璁板綍
+function getWarnList() {
+	warnData = null;
+	//璧嬪�煎弬鏁扮殑鏃ユ湡
+	data.data.dateTime = dateTime;
+	//璇锋眰
+	mui.ajax(url, {
+		type: "POST",
+		dataType: "json",
+		crossDomain: true,
+		contentType: "application/json;charset=utf-8",
+		data: JSON.stringify(data),
+		success: function(result) {
+			if (result.code == "0000") {
+				warnData = result.data;
+				console.log(warnData)
+				renderWarn();
+			} else {
+				renderWarn();
+				mui.toast(result.msg);
+				console.log(JSON.stringify(result))
+			}
+		},
+		error: function() {
+			mui.alert("绯荤粺绻佸繖,璇烽噸璇曪紒", "鎻愮ず", ["纭畾"], function() {}, "div")
+		}
+	})
+}
+
+//榛樿鑾峰彇褰撳ぉ鏃ユ湡(yyyy-MM-dd)
+function getDate() {
+	var date = new Date();
+	var year = date.getFullYear();
+	var month, day;
+	month = date.getMonth() + 1;
+	if (month >= 1 && month <= 9) {
+		month = "0" + month;
+	}
+	day = date.getDate();
+	if (day >= 1 && day <= 9) {
+		day = "0" + day;
+	}
+	return year + "-" + month + "-" + day
+}
+//榛樿鑾峰彇褰撳墠鏃ユ湡(yyyy-MM-dd)
+function getDate(date) {
+	var year = date.getFullYear();
+	var month, day;
+	month = date.getMonth() + 1;
+	if (month >= 1 && month <= 9) {
+		month = "0" + month;
+	}
+	day = date.getDate();
+	if (day >= 1 && day <= 9) {
+		day = "0" + day;
+	}
+	return year + "-" + month + "-" + day;
+}
+
+//鍔犲噺澶╂暟
+function addAndReduceMonth(tag) {
+
+	var date = new Date(dateTime);
+
+	date = date.setDate(date.getDate() + tag);
+	date = new Date(date);
+	dateTime = getDate(date);
+	$('#date').val(dateTime)
+	//鑾峰彇璀﹀憡璁板綍
+	getWarnList();
+}
+
+function chooseDate() {
+	var dtpicker = new mui.DtPicker({
+		type: "date", //璁剧疆鏃ュ巻鍒濆瑙嗗浘妯″紡 
+		// beginDate: new Date(2015, 04, 25), //璁剧疆寮�濮嬫棩鏈� 
+		// endDate: new Date(2016, 04, 25), //璁剧疆缁撴潫鏃ユ湡 
+	})
+	dtpicker.show(function(e) {
+		document.getElementById("date").value = e.value
+	})
+}
+
+
+
+
+//娓叉煋椤甸潰
+function renderWarn() {
+	var html = '';
+	if (warnData) {
+		var warnList = warnData.data;
+		if (warnList && warnList.length > 0) {
+			$.each(warnList, function(index, item) {
+				html += '<li><div class="con myfancy" onclick="openPop('+item.id+')">';
+				if (item.status == '10') {
+					html += '<span class="type">鏈鐞�</span>';
+				}
+				if (item.status == '20') {
+					html += '<span class="type k">澶勭悊寤惰繜</span>';
+				}
+				if (item.status == '30') {
+					html += '<span class="type k">宸插鐞�</span>';
+				}
+				if (item.status == '40') {
+					html += '<span class="type k">蹇界暐</span>';
+				}
+				html += '<div class="tit">璀﹀憡鍚嶇О: <span>' + item.name + '</span></div>';
+				html += '<div class="txt">';
+				html += '<div class="box"><div class="group c"><div class="desc">' + item.type +
+					'</div><div class="ort">璀﹀憡绫诲瀷</div></div></div>';
+				html += '<div class="box"><div class="group c1"><div class="desc">' + item.depotName +
+					'</div><div class="ort">浠撳簱鍚嶇О</div></div></div>';
+				if (item.level == '1') {
+					html +=
+						'<div class="box"><div class="group level-2"><div class="desc">楂樼骇</div><div class="ort">璀﹀憡绾у埆</div></div></div></div>';
+				}
+				if (item.level == '2') {
+					html +=
+						'<div class="box"><div class="group level-1"><div class="desc">涓骇</div><div class="ort">璀﹀憡绾у埆</div></div></div></div>';
+				}
+
+				html += '<div class="tit coation">璀﹀憡鍐呭: <span>' + item.info + '</span></div>';
+				html += '<div class="time">' + item.time + '</div></div></li>';
+			})
+		} else {
+			html +=
+				'<li><div class="con myfancy" style="text-align: center;font-size: 20px;color:#dd524d">鏆傛棤璀﹀憡淇℃伅</div></li>';
+		}
+	} else {
+		html +=
+			'<li><div class="con myfancy" style="text-align: center;font-size: 20px;color:#dd524d">鏆傛棤璀﹀憡淇℃伅</div></li>';
+	}
+	$("#recordList").html(html);
+
+}
+
+
+
+//鎵撳紑寮圭獥
+function openPop(warnId) {
+	dataPop.data.id = warnId;
+	$('#m-pop').css('display', 'flex');
+}
+//璀﹀憡澶勭悊
+function handleWarn(tag) {
+	if (tag == "1") {
+		dataPop.data.status = '40'
+		// mui.toast("蹇界暐璀﹀憡");
+	}
+	if (tag == "2") {
+		dataPop.data.status = '30'
+		// mui.toast("璀﹀憡澶勭悊");
+	}
+    dataPop.data.remark = mui("#textareaPop")[0].value;
+	//璇锋眰
+	mui.ajax(url, {
+		type: "POST",
+		dataType: "json",
+		crossDomain: true,
+		contentType: "application/json;charset=utf-8",
+		data: JSON.stringify(dataPop),
+		success: function(result) {
+			if (result.code == "0000") {
+				console.log(JSON.stringify(result))
+			} else {
+				mui.toast(result.msg);
+				console.log(JSON.stringify(result))
+			}
+		},
+		error: function() {
+			mui.alert("绯荤粺绻佸繖,璇烽噸璇曪紒", "鎻愮ず", ["纭畾"], function() {}, "div")
+		}
+	})
+	closePop();
+}
+//鍏抽棴寮圭獥
+function closePop() {
+	$("#m-pop").css('display', 'none');
+}
+$('.pop-bg,.m-pop .close').click(function(e) {
+	e.stopPropagation();
+	$('.m-pop').fadeOut();
+});
+
+
+//婊戝姩
+mui('.mui-scroll-wrapper').scroll({
+	indicators: false, //鏄惁鏄剧ず婊氬姩鏉�
+	deceleration: 0.0006, //闃诲凹绯绘暟,绯绘暟瓒婂皬婊戝姩瓒婄伒鏁�
+	bounce: false, //鏄惁鍚敤鍥炲脊
+	deceleration: 0.0005 //flick 鍑忛�熺郴鏁帮紝绯绘暟瓒婂ぇ锛屾粴鍔ㄩ�熷害瓒婃參锛屾粴鍔ㄨ窛绂昏秺灏忥紝榛樿鍊�0.0006
+});
\ No newline at end of file
diff --git a/igds-app/security-video.html b/igds-app/security-video.html
index 91a8295..4be086f 100644
--- a/igds-app/security-video.html
+++ b/igds-app/security-video.html
@@ -23,13 +23,14 @@
 			<div class="mui-scroll-wrapper box">
 				<div class="mui-scroll">
 					<div class="wp">
-						<div class="m-videob1">
-							<video src="http://player.alicdn.com/video/aliyunmedia.mp4" poster="images/pos1.png"
+						<div class="m-videob1" id="toVideo">
+							<!-- src="http://player.alicdn.com/video/aliyunmedia.mp4" -->
+							<video src="" poster="images/pos1.png"
 								class="video" webkit-playsinline="true" playsinline="true" controls></video>
 						</div>
-						<ul class="ul-locb1">
+						<ul class="ul-locb1" id="recordList">
 							<li>
-								<a href="" class="con" style="background-image: url(images/icons/g-i15.png);">
+								<a onclick="getVideo(1,1)" class="con" style="background-image: url(images/icons/g-i15.png);">
 									<div class="left">
 										<div class="icon">
 											<img src="images/icons/g-i13.png" alt="">
@@ -134,13 +135,13 @@
 		</div>
 	</body>
 	<script src="./js/mui.min.js"></script>
+	<script src="./js/jquery.js"></script>
+	<script src="./js/admin/security-video.js"></script>
 	<script type="text/javascript" charset="utf-8">
 		mui.init();
-		mui('.mui-scroll-wrapper').scroll({
-			indicators: false, //鏄惁鏄剧ず婊氬姩鏉�
-			deceleration: 0.0006, //闃诲凹绯绘暟,绯绘暟瓒婂皬婊戝姩瓒婄伒鏁�
-			bounce: false, //鏄惁鍚敤鍥炲脊
-			deceleration: 0.0005 //flick 鍑忛�熺郴鏁帮紝绯绘暟瓒婂ぇ锛屾粴鍔ㄩ�熷害瓒婃參锛屾粴鍔ㄨ窛绂昏秺灏忥紝榛樿鍊�0.0006
-		});
+		mui.plusReady(function() {
+			//鏁版嵁鍒濆鍖�
+			init();
+		})
 	</script>
 </html>
diff --git a/igds-app/warn-list.html b/igds-app/warn-list.html
index ba37091..8488db0 100644
--- a/igds-app/warn-list.html
+++ b/igds-app/warn-list.html
@@ -22,18 +22,18 @@
 		</header>
 		<div class="mui-content">
 			<div class="g-date_box">
-				<span class="day prev">鍓嶄竴澶�</span>
+				<span class="day prev" onclick="addAndReduceMonth(-1)">鍓嶄竴澶�</span>
 				<div class="inpbox" onclick="chooseDate();">
-					<input id="date" type="text" value="2022-04-15" readonly class="inp" />
+					<input id="date" type="text" value="" readonly class="inp" />
 				</div>
-				<span class="day next">鍚庝竴澶�</span>
+				<span class="day next" onclick="addAndReduceMonth(1)">鍚庝竴澶�</span>
 			</div>
 			<div class="mui-scroll-wrapper jglb">
 				<div class="g-in-sl">
 					<div class="m-pow-dist">
 						<div class="m-caution-mana">
-							<ul class="ul-listmana ul-listcaut1">
-								<li>
+							<ul class="ul-listmana ul-listcaut1" id="recordList">
+								 <!-- <li>
 									<div class="con myfancy" onclick="openPop('11')">
 										<span class="type">鏈鐞�</span>
 										<div class="tit">
@@ -132,7 +132,8 @@
 										<div class="time">2022-03-02 10:10</div>
 									</div>
 								</li>
-							</ul>
+							 -->
+							 </ul>
 						</div>
 					</div>
 
@@ -146,7 +147,7 @@
 						<div class="h3"><span class="red">*</span> 澶勭悊璇存槑</div>
 						<form class="">
 							<div class="mui-input-row">
-								<textarea rows="" cols="" placeholder="璇疯緭鍏ヨ鏄�"></textarea>
+								<textarea id="textareaPop" rows="" cols="" placeholder="璇疯緭鍏ヨ鏄�"></textarea>
 							</div>
 						</form>
 						<div class="btns">
@@ -161,48 +162,15 @@
 	<script src="./js/mui.min.js"></script>
 	<script src="./js/mui.picker.min.js"></script>
 	<script src="./js/jquery.js"></script>
+	<script src="./js/admin/warn-list.js"></script>
 	<script type="text/javascript" charset="utf-8">
+		//mui鍒濆鍖�
 		mui.init();
-
-		function chooseDate() {
-			var dtpicker = new mui.DtPicker({
-				type: "date", //璁剧疆鏃ュ巻鍒濆瑙嗗浘妯″紡 
-				// beginDate: new Date(2015, 04, 25), //璁剧疆寮�濮嬫棩鏈� 
-				// endDate: new Date(2016, 04, 25), //璁剧疆缁撴潫鏃ユ湡 
-
-			})
-			dtpicker.show(function(e) {
-				document.getElementById("date").value = e.value
-			})
-		}
-
-		mui('.mui-scroll-wrapper').scroll({
-			indicators: false, //鏄惁鏄剧ず婊氬姩鏉�
-			deceleration: 0.0006, //闃诲凹绯绘暟,绯绘暟瓒婂皬婊戝姩瓒婄伒鏁�
-			bounce: false, //鏄惁鍚敤鍥炲脊
-			deceleration: 0.0005 //flick 鍑忛�熺郴鏁帮紝绯绘暟瓒婂ぇ锛屾粴鍔ㄩ�熷害瓒婃參锛屾粴鍔ㄨ窛绂昏秺灏忥紝榛樿鍊�0.0006
-		});
-		//鎵撳紑寮圭獥
-		function openPop(warnId) {
-			$('#m-pop').css('display', 'flex');
-		}
-		//璀﹀憡澶勭悊
-		function handleWarn(tag) {
-			if(tag == "1"){
-				mui.toast("蹇界暐璀﹀憡");
-			}
-			if(tag == "2"){
-				mui.toast("璀﹀憡澶勭悊");
-			}
-			closePop();
-		}
-		//鍏抽棴寮圭獥
-		function closePop() {
-			$("#m-pop").css('display', 'none');
-		}
-		$('.pop-bg,.m-pop .close').click(function(e) {
-			e.stopPropagation();
-			$('.m-pop').fadeOut();
-		});
+		
+		mui.plusReady(function() {
+			//鏁版嵁鍒濆鍖�
+			init();
+		})
+		
 	</script>
 </html>
\ No newline at end of file

--
Gitblit v1.9.3