From 9382a00fe89139663216673a1a8e8ddb8761a14d Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期二, 06 六月 2023 20:13:19 +0800
Subject: [PATCH] 无数据时的页面
---
igds-app/js/admin/device-temp.js | 203 +++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 191 insertions(+), 12 deletions(-)
diff --git a/igds-app/js/admin/device-temp.js b/igds-app/js/admin/device-temp.js
index def7a1c..2fba7a1 100644
--- a/igds-app/js/admin/device-temp.js
+++ b/igds-app/js/admin/device-temp.js
@@ -1,6 +1,8 @@
var targetStatus;
var targetModel;
var targetTemp;
+var deviceData;
+//绌鸿皟鎺у埗
var data = {
"interfaceId": "5403",
"outId": "10403",
@@ -9,7 +11,7 @@
"data": {
"deptId": "",
"depotId": "",
- "type": "",
+ "type": "05",
"passCode": "",
"serId": "",
"targetStatus": "",
@@ -18,20 +20,32 @@
"name": ""
}
};
+//璁惧鍒楄〃 - 绌鸿皟
+var data1 = {
+ "interfaceId": "5401",
+ "outId": "10401",
+ "reqDateTime": new Date(),
+ "tokenAuth": "",
+ "data": {
+ "deptId": "",
+ "depotId": "",
+ "type": "05",
+ }
+};
+
function init() {
var user = JSON.parse(localStorage.getItem('user'));
var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId'));
url = user.url + "/api-phone/v35/gateway";
data.tokenAuth = user.tokenAuth;
- data.deptId = user.deptId;
- //鏀瑰彉寮�鍏崇殑榛樿鍊�
- // document.getElementById("vibrationSwitch").classList.add('mui-active');
- //璁剧疆寮�鍏崇殑榛樿鍊�
- data.data.targetStatus = 'CLOSE'
+ data.data.deptId = user.deptId;
+ data1.tokenAuth = user.tokenAuth;
+ data1.data.deptId = user.deptId;
//鑾峰彇浠庝笂涓�涓〉闈紶閫掔殑鏁版嵁
var self = plus.webview.currentWebview();
data.data.depotId = self.depotId
+ data1.data.depotId = self.depotId
// depotType = self.depotType
// depotName = self.depotName
}
@@ -48,9 +62,32 @@
console.log("浣犲叧闂簡寮�鍏�");
}
})
+//鑾峰彇璁惧鍒楄〃锛堢┖璋冿級
+function getDeviceList() {
+ 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") {
+ deviceData = result.data;
+ } else {
+ mui.toast(result.msg);
+ }
+ },
+ error: function() {
+ mui.alert("绯荤粺绻佸繖,璇烽噸璇曪紒", "鎻愮ず", ["纭畾"], function() {}, "div")
+ }
+ })
+
+}
+
//娓╂帶绠$悊
-function setTemp(){
+function setTemp() {
+ console.log(JSON.stringify(data.data))
mui.ajax(url, {
type: "POST",
dataType: "json",
@@ -62,13 +99,119 @@
mui.toast(result.msg);
} else {
mui.toast(result.msg);
- console.log(JSON.stringify(result))
}
},
error: function() {
mui.alert("绯荤粺绻佸繖,璇烽噸璇曪紒", "鎻愮ず", ["纭畾"], function() {}, "div")
}
})
+}
+//娓叉煋椤甸潰
+function renderDevice() {
+ var html = '';
+ if (deviceData) {
+ var deviceList = deviceData.listDevice
+ if (deviceList && deviceList.length > 0) {
+ var frontList = [];
+ var backList = [];
+ var leftList = [];
+ var rightList = [];
+ $.each(deviceList, function(index, item) {
+ if (item.location == '01') {
+ frontList.push(item)
+ } else if (item.location == '02') {
+ backList.push(item)
+ } else if (item.location == '03') {
+ leftList.push(item)
+ } else if (item.location == '04') {
+ rightList.push(item)
+ }
+ })
+ 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) {
+
+ 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) {
+
+ 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) {
+
+ 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) {
+
+ 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>'
+ }
+ } else {
+ html +=
+ '<div class="m-tf"><div class="g-tittf1" style="text-align: center;font-size: 20px;color:#dd524d>鏆傛棤鏁版嵁</div>';
+ }
+ } else {
+ html +=
+ '<div class="m-tf"><div class="g-tittf1" style="text-align: center;font-size: 20px;color:#dd524d>鏆傛棤鏁版嵁</div>';
+ }
+ // $("#recordList").html(html);
}
var slider = mui(".mui-slider");
@@ -85,17 +228,53 @@
//绌鸿皟鎿嶄綔
mui(".mui-scroll-wrapper").on("tap", ".m-tf ul li .con", function() {
- $('.m-pop').css('display', 'flex');
+ targetStatus = this.getAttribute("targetStatus")
+ data.data.targetStatus = targetStatus
+ if (targetStatus == 'OPEN') {
+ //鏀瑰彉寮�鍏崇殑榛樿鐘舵��
+ document.getElementById("vibrationSwitch").classList.add('mui-active');
+ } else if (targetStatus == 'CLOSE') {
+ document.getElementById("vibrationSwitch").classList.remove('mui-active');
+ }
+ var passCode = this.getAttribute("passCode");
+ var serId = this.getAttribute("serId");
+ var name = this.getAttribute("name");
+ data.data.passCode = passCode;
+ data.data.serId = serId;
+ data.data.name = name;
+ $('.m-pop').css('display', 'flex');
});
+
+//绌鸿皟妯″紡閫夋嫨
+mui(".m-pop").on("tap", ".inner .group .val", function() {
+ var modelPicker = new mui.PopPicker();
+ modelPicker.setData([{
+ value: "HEATING",
+ text: "鍒剁儹"
+ }, {
+ value: "01-REFRIGERATION",
+ text: "鍒跺喎"
+ }, {
+ value: "02-AERATION",
+ text: "閫氶"
+ }, {
+ value: "DEHU",
+ text: "闄ゆ箍"
+ }])
+ modelPicker.show(function(selectItems) {
+ targetModel = selectItems[0].value;
+ document.getElementById("targetModel").innerText = selectItems[0].text
+ })
+});
+
+//纭畾鎸夐敭锛屾妸閫夌殑鍙傛暟浼犵粰鍚庣
mui(".m-pop").on("tap", ".inner .confirm", function() {
var id = this.getAttribute("id");
- targetModel = document.getElementById("targetModel").value;
targetTemp = document.getElementById("range").value;
data.data.targetModel = targetModel;
data.data.targetTemp = targetTemp
- console.log(JSON.stringify(data.data))
- // setTemp();
+ setTemp();
closePop();
});
//鍏抽棴寮圭獥
--
Gitblit v1.9.3