From 279b87c61ae1bff17d924bc0aa625473c0fc830b Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期四, 08 六月 2023 18:04:17 +0800
Subject: [PATCH] 空调开关和温度显示

---
 igds-app/js/admin/device-temp.js |  129 ++++++++++++++++++++++--------------------
 1 files changed, 67 insertions(+), 62 deletions(-)

diff --git a/igds-app/js/admin/device-temp.js b/igds-app/js/admin/device-temp.js
index fe16e28..cfc3a37 100644
--- a/igds-app/js/admin/device-temp.js
+++ b/igds-app/js/admin/device-temp.js
@@ -50,18 +50,6 @@
 	// depotName = self.depotName
 }
 
-//鐩戝惉寮�鍏崇姸鎬�
-document.getElementById("vibrationSwitch").addEventListener("toggle", function(event) {
-	if (event.detail.isActive) {
-		targetStatus = 'OPEN';
-		data.data.targetStatus = targetStatus;
-		console.log("浣犲惎鍔ㄤ簡寮�鍏�");
-	} else {
-		targetStatus = 'CLOSE';
-		data.data.targetStatus = targetStatus;
-		console.log("浣犲叧闂簡寮�鍏�");
-	}
-})
 //鑾峰彇璁惧鍒楄〃锛堢┖璋冿級
 function getDeviceList() {
 	mui.ajax(url, {
@@ -130,76 +118,76 @@
 			if (frontList && frontList.length > 0) {
 				html += '<div class="m-tf"><div class="g-tittf1">浠撳簱姝i潰</div><ul class="ul-listmana1 ullisttf1">';
 				$.each(frontList, function(index, item) {
-					if (item.serId) {
-						html += '<li><div class="con myfancy" passCode="' + item.passCode + '" serId="' +
-							item.serId + '" targetStatus="' + item.targetStatus + '" name="' + item.name +
-							'" data-win="#win_kt"><div class="pic pic2"><img src="images/e1.png"></div>';
-						if (targetStatus == 'OPEN') {
-							html += '<div class="info out" style="background-image: url(images/e8.png);">' +
-								item.name + '</div>'
-						} else {
-							html += '<div class="info out" style="background-image: url(images/e9.png);">' +
-								item.name + '</div>'
-						}
-						html += '</div></div></li>'
+
+					html += '<li><div class="con myfancy" passCode="' + item.passCode + '" serId="' +
+						item.serId + '" targetStatus="' + item.targetStatus + '" name="' + item.name +
+						'" data-win="#win_kt"><div class="pic pic2"><img src="images/e1.png"></div>';
+					if (targetStatus == 'OPEN') {
+						html += '<div class="info out" style="background-image: url(images/e8.png);">' +
+							item.name + '</div>'
+					} else {
+						html += '<div class="info out" style="background-image: url(images/e9.png);">' +
+							item.name + '</div>'
 					}
+					html += '</div></div></li>'
+
 				})
 				html += '</ul></div>'
 			}
 			if (backList && backList.length > 0) {
 				html += '<div class="m-tf"><div class="g-tittf1">浠撳簱鍙嶉潰</div><ul class="ul-listmana1 ullisttf1">';
 				$.each(backList, function(index, item) {
-					if (item.serId) {
-						html += '<li><div class="con myfancy" passCode="' + item.passCode + '" serId="' +
-							item.serId + '" targetStatus="' + item.targetStatus + '" name="' + item.name +
-							'" data-win="#win_kt"><div class="pic pic2"><img src="images/e1.png"></div>';
-						if (targetStatus == 'OPEN') {
-							html += '<div class="info out" style="background-image: url(images/e8.png);">' +
-								item.name + '</div>'
-						} else {
-							html += '<div class="info out" style="background-image: url(images/e9.png);">' +
-								item.name + '</div>'
-						}
-						html += '</div></div></li>'
+
+					html += '<li><div class="con myfancy" passCode="' + item.passCode + '" serId="' +
+						item.serId + '" targetStatus="' + item.targetStatus + '" name="' + item.name +
+						'" data-win="#win_kt"><div class="pic pic2"><img src="images/e1.png"></div>';
+					if (targetStatus == 'OPEN') {
+						html += '<div class="info out" style="background-image: url(images/e8.png);">' +
+							item.name + '</div>'
+					} else {
+						html += '<div class="info out" style="background-image: url(images/e9.png);">' +
+							item.name + '</div>'
 					}
+					html += '</div></div></li>'
+
 				})
 				html += '</ul></div>'
 			}
 			if (leftList && leftList.length > 0) {
 				html += '<div class="m-tf"><div class="g-tittf1">浠撳簱宸︿晶闈�</div><ul class="ul-listmana1 ullisttf1">';
 				$.each(leftList, function(index, item) {
-					if (item.serId) {
-						html += '<li><div class="con myfancy" passCode="' + item.passCode + '" serId="' +
-							item.serId + '" targetStatus="' + item.targetStatus + '" name="' + item.name +
-							'" data-win="#win_kt"><div class="pic pic2"><img src="images/e1.png"></div>';
-						if (targetStatus == 'OPEN') {
-							html += '<div class="info out" style="background-image: url(images/e8.png);">' +
-								item.name + '</div>'
-						} else {
-							html += '<div class="info out" style="background-image: url(images/e9.png);">' +
-								item.name + '</div>'
-						}
-						html += '</div></div></li>'
+
+					html += '<li><div class="con myfancy" passCode="' + item.passCode + '" serId="' +
+						item.serId + '" targetStatus="' + item.targetStatus + '" name="' + item.name +
+						'" data-win="#win_kt"><div class="pic pic2"><img src="images/e1.png"></div>';
+					if (targetStatus == 'OPEN') {
+						html += '<div class="info out" style="background-image: url(images/e8.png);">' +
+							item.name + '</div>'
+					} else {
+						html += '<div class="info out" style="background-image: url(images/e9.png);">' +
+							item.name + '</div>'
 					}
+					html += '</div></div></li>'
+
 				})
 				html += '</ul></div>'
 			}
 			if (rightList && rightList.length > 0) {
 				html += '<div class="m-tf"><div class="g-tittf1">浠撳簱鍙充晶闈�</div><ul class="ul-listmana1 ullisttf1">';
 				$.each(rightList, function(index, item) {
-					if (item.serId) {
-						html += '<li><div class="con myfancy" passCode="' + item.passCode + '" serId="' +
-							item.serId + '" targetStatus="' + item.targetStatus + '" name="' + item.name +
-							'" data-win="#win_kt"><div class="pic pic2"><img src="images/e1.png"></div>';
-						if (targetStatus == 'OPEN') {
-							html += '<div class="info out" style="background-image: url(images/e8.png);">' +
-								item.name + '</div>'
-						} else {
-							html += '<div class="info out" style="background-image: url(images/e9.png);">' +
-								item.name + '</div>'
-						}
-						html += '</div></div></li>'
+
+					html += '<li><div class="con myfancy" passCode="' + item.passCode + '" serId="' +
+						item.serId + '" targetStatus="' + item.status + '" name="' + item.name +
+						'" data-win="#win_kt"><div class="pic pic2"><img src="images/e1.png"></div>';
+					if (targetStatus == 'OPEN') {
+						html += '<div class="info out" style="background-image: url(images/e8.png);">' +
+							item.name + '</div>'
+					} else {
+						html += '<div class="info out" style="background-image: url(images/e9.png);">' +
+							item.name + '</div>'
 					}
+					html += '</div></div></li>'
+
 				})
 				html += '</ul></div>'
 			}
@@ -226,17 +214,34 @@
 	})
 })
 
+//鐩戝惉寮�鍏崇姸鎬�
+document.getElementById("vibrationSwitch").addEventListener("toggle", function(event) {
+	if (event.detail.isActive) {
+		targetStatus = 'OPEN';
+		data.data.targetStatus = targetStatus;
+		console.log("浣犲惎鍔ㄤ簡寮�鍏�");
+	} else {
+		targetStatus = 'CLOSE';
+		data.data.targetStatus = targetStatus;
+		console.log("浣犲叧闂簡寮�鍏�");
+	}
+})
 //绌鸿皟鎿嶄綔
 mui(".mui-scroll-wrapper").on("tap", ".m-tf ul li .con", function() {
 
 	targetStatus = this.getAttribute("targetStatus")
 	data.data.targetStatus = targetStatus
+	var html = '';
 	if (targetStatus == 'OPEN') {
-		//鏀瑰彉寮�鍏崇殑榛樿鐘舵��
 		document.getElementById("vibrationSwitch").classList.add('mui-active');
-	}else if(targetStatus == 'CLOSE'){
+		$('.mui-switch-handle').css("-webkit-transform" , "translate3d(16px, 0, 0)");
+		console.log("寮�")
+	} else if (targetStatus == 'CLOSE') {
 		document.getElementById("vibrationSwitch").classList.remove('mui-active');
+		$('.mui-switch-handle').css("-webkit-transform" , "translate3d(0, 0, 0)");
+		console.log("鍏�")
 	}
+	
 	var passCode = this.getAttribute("passCode");
 	var serId = this.getAttribute("serId");
 	var name = this.getAttribute("name");

--
Gitblit v1.9.3