From 2df906a447195f9786dd468512ea895d6cc18532 Mon Sep 17 00:00:00 2001 From: YYC <1833023622@qq.com> Date: 星期四, 15 五月 2025 14:53:54 +0800 Subject: [PATCH] APP3.5开发 --- igds-app/js/admin/device-verb.js | 601 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 577 insertions(+), 24 deletions(-) diff --git a/igds-app/js/admin/device-verb.js b/igds-app/js/admin/device-verb.js index 1e1b484..66ed039 100644 --- a/igds-app/js/admin/device-verb.js +++ b/igds-app/js/admin/device-verb.js @@ -1,23 +1,34 @@ var deviceData; -var deviceList; -var deptId; -var depotId; +var deptId; //搴撳尯缂栫爜 +var depotId; //浠撳簱缂栫爜 +var frontList = []; //浠撳簱姝i潰璁惧鍒楄〃 +var backList = []; //浠撳簱鍙嶉潰璁惧鍒楄〃 +var leftList = []; //浠撳簱宸︿晶闈㈣澶囧垪琛� +var rightList = []; //浠撳簱鍙充晶闈㈣澶囧垪琛� +var deviceDetail = { + "passCode": "", + "serId": "", + "location": "", + "type": "", + "status": "" +} +//璁惧鎺у埗 var data = { - "interfaceId": "5403", - "outId": "10403", + "interfaceId": "5402", + "outId": "10402", "reqDateTime": new Date(), "tokenAuth": "", - "data": [], - // { - // "deptId": "", - // "depotId": "", - // "type": "01", - // "passCode": "", - // "serId": "", - // "targetStatus": "" - // } + "data": { + "deptId": "", + "depotId": "", + "type": "", + "passCode": "", + "serId": "", + "targetStatus": "", + "batchTag":"" + } }; - +//璁惧鍒楄〃 var data1 = { "interfaceId": "5401", "outId": "10401", @@ -26,7 +37,7 @@ "data": { "deptId": "", "depotId": "", - "type": "01", //椋庣獥 + "type": "01", //椋庣獥 "type1": "02", //杞存祦椋庣獥 "type2": "04", //鐜祦椋庢満 "type3": "0B", //閫氶鍙� @@ -39,23 +50,436 @@ var user = JSON.parse(localStorage.getItem('user')); var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId')); - url = user.url + "/api-phone/v35/gateway"; + url = user.url + "/api/phone/v35/gateway"; data.tokenAuth = user.tokenAuth; data.data.deptId = user.deptId; + data1.data.deptId = user.deptId; data1.tokenAuth = user.tokenAuth; deptId = user.deptId; //鑾峰彇浠庝笂涓�涓〉闈紶閫掔殑鏁版嵁 var self = plus.webview.currentWebview(); data.data.depotId = self.depotId + data1.data.depotId = self.depotId depotId = self.depotId + console.log(depotId) // depotType = self.depotType // depotName = self.depotName + getDeviceList(); } -var slider = mui(".mui-slider"); -slider.slider({ - interval: 3000 -}); +//鑾峰彇璁惧鍒楄〃锛堥�氶锛� +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; + renderDevice(); + } else { + mui.toast(result.msg); + renderDevice(); + } + }, + error: function() { + mui.alert("绯荤粺绻佸繖,璇烽噸璇曪紒", "鎻愮ず", ["纭畾"], function() {}, "div") + } + }) +} + +//娓叉煋椤甸潰 +function renderDevice() { + var html = ''; + if (deviceData) { + var deviceList = deviceData.listDevice; + if (deviceList && deviceList.length > 0) { + frontList=[]; + backList=[]; + leftList=[]; + 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) { //浠撳簱姝i潰 + html += '<div class="m-tf"><div class="g-tittf1">浠撳簱姝i潰</div><ul class="ul-listmana1 ullisttf1">'; + $.each(frontList, function(index, item) { + targetStatus = item.status + if (item.type == '01') { //椋庣獥 + html += '<li><div class="con myfancy chuangkou" status="' + item.status + + '" passCode="' + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front" type="01">'; + if(targetStatus == 'OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_01_OPEN.png"></div>' + html += '<div class="info in" style="background-image: url(images/e5.png);">'+ item.name +'</div>' + }else if(targetStatus == 'CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_01_CLOSE.png"></div>' + html += '<div class="info in" style="background-image: url(images/e3.png);">'+ item.name +'</div>' + } + html += '</div></li>' + } else if (item.type == '02') { //杞存祦椋庢満 + html += '<li><div class="con myfancy zhouliu" status="'+ item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front">'; + if(targetStatus == 'W_CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_W_CLOSE.png"></div>' + }else if(targetStatus == 'W_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_W_OPEN.png"></div>' + }else if(targetStatus == 'F_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_F_OPEN.gif"></div>' + }else if(targetStatus == 'F_OPEN_F'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_F_OPEN_F.gif"></div>' + }else if(targetStatus == 'F_CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_W_OPEN.png"></div>' + } + html += '<div class="info in" style="background-image: url(images/e3.png);">' + item.name +'</div>' + html += '</div></li>' + } else if (item.type == '04') { //鐜祦椋庢満 + html += '<li><div class="con myfancy huanliu" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front">'; + if(targetStatus == 'CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_04_ClOSE.png"></div>' + }else if(targetStatus == 'OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_04_OPEN.gif"></div>' + } + html += '<div class="info out" style="background-image: url(images/e3.png);"> ' + item.name + '</div>' + html += '</div></li>' + } else if (item.type == '0B') { //閫氶鍙� + html += '<li><div class="con myfancy chuangkou" status="' + item.status + + '" passCode="' +item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front" type="0B">'; + if(targetStatus == 'CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0B_CLOSE.png"></div>' + }else if(targetStatus == 'OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0B_OPEN.png"></div>' + } + html += '<div class="info in" style="background-image: url(images/e3.png);">'+ item.name +'</div>' + html += '</div></li>' + } else if (item.type == '0C') { //娣锋祦椋庢満 + html += '<li><div class="con myfancy hunliu" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name +'" location="front">'; + if(targetStatus == 'W_CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_w_CLOSE.png"></div>' + }else if(targetStatus == 'F_OPEN_F'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_F_OPEN_F.gif"></div>' + }else if(targetStatus == 'F_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_F_OPEN.gif"></div>' + }else if(targetStatus == 'W_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_W_OPEN.png"></div>' + } + html += '<div class="info out" style="background-image: url(images/e3.png);"> ' + item.name + '</div>' + html += '</div></li>' + } else if (item.type == '0D') { //鍔犲帇椋庢満 + html += '<li><div class="con myfancy jiaya" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name +'" location="front">'; + if(targetStatus == 'CLOSE'){ + html += '<div class="pic pic1"><img src="images/device-status/STATUS_0D_CLOSE.png"></div>' + }else if(targetStatus == 'OPEN'){ + html += '<div class="pic pic1"><img src="images/device-status/STATUS_0D_OPEN.png"></div>' + } + html += '<div class="info out" style="background-image: url(images/e3.png);"> ' + item.name + '</div>' + html += '</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(frontList, function(index, item) { + targetStatus = item.status + if (item.type == '01') { //椋庣獥 + html += '<li><div class="con myfancy chuangkou" status="' + item.status + + '" passCode="' + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front" type="01">'; + if(targetStatus == 'OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_01_OPEN.png"></div>' + html += '<div class="info in" style="background-image: url(images/e5.png);">'+ item.name +'</div>' + }else if(targetStatus == 'CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_01_CLOSE.png"></div>' + html += '<div class="info in" style="background-image: url(images/e3.png);">'+ item.name +'</div>' + } + html += '</div></li>' + } else if (item.type == '02') { //杞存祦椋庢満 + html += '<li><div class="con myfancy zhouliu" status="'+ item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front">'; + if(targetStatus == 'W_CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_W_CLOSE.png"></div>' + }else if(targetStatus == 'W_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_W_OPEN.png"></div>' + }else if(targetStatus == 'F_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_F_OPEN.gif"></div>' + }else if(targetStatus == 'F_OPEN_F'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_F_OPEN_F.gif"></div>' + }else if(targetStatus == 'F_CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_W_OPEN.png"></div>' + } + html += '<div class="info in" style="background-image: url(images/e3.png);">' + item.name +'</div>' + html += '</div></li>' + } else if (item.type == '04') { //鐜祦椋庢満 + html += '<li><div class="con myfancy huanliu" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front">'; + if(targetStatus == 'CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_04_ClOSE.png"></div>' + }else if(targetStatus == 'OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_04_OPEN.gif"></div>' + } + html += '<div class="info out" style="background-image: url(images/e3.png);"> ' + item.name + '</div>' + html += '</div></li>' + } else if (item.type == '0B') { //閫氶鍙� + html += '<li><div class="con myfancy chuangkou" status="' + item.status + + '" passCode="' +item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front" type="0B">'; + if(targetStatus == 'CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0B_CLOSE.png"></div>' + }else if(targetStatus == 'OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0B_OPEN.png"></div>' + } + html += '<div class="info in" style="background-image: url(images/e3.png);">'+ item.name +'</div>' + html += '</div></li>' + } else if (item.type == '0C') { //娣锋祦椋庢満 + html += '<li><div class="con myfancy hunliu" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name +'" location="front">'; + if(targetStatus == 'W_CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_w_CLOSE.png"></div>' + }else if(targetStatus == 'F_OPEN_F'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_F_OPEN_F.gif"></div>' + }else if(targetStatus == 'F_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_F_OPEN.gif"></div>' + }else if(targetStatus == 'W_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_W_OPEN.png"></div>' + } + html += '<div class="info out" style="background-image: url(images/e3.png);"> ' + item.name + '</div>' + html += '</div></li>' + } else if (item.type == '0D') { //鍔犲帇椋庢満 + html += '<li><div class="con myfancy jiaya" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name +'" location="front">'; + if(targetStatus == 'CLOSE'){ + html += '<div class="pic pic1"><img src="images/device-status/STATUS_0D_CLOSE.png"></div>' + }else if(targetStatus == 'OPEN'){ + html += '<div class="pic pic1"><img src="images/device-status/STATUS_0D_OPEN.png"></div>' + } + html += '<div class="info out" style="background-image: url(images/e3.png);"> ' + item.name + '</div>' + html += '</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(frontList, function(index, item) { + targetStatus = item.status + if (item.type == '01') { //椋庣獥 + html += '<li><div class="con myfancy chuangkou" status="' + item.status + + '" passCode="' + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front" type="01">'; + if(targetStatus == 'OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_01_OPEN.png"></div>' + html += '<div class="info in" style="background-image: url(images/e5.png);">'+ item.name +'</div>' + }else if(targetStatus == 'CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_01_CLOSE.png"></div>' + html += '<div class="info in" style="background-image: url(images/e3.png);">'+ item.name +'</div>' + } + html += '</div></li>' + } else if (item.type == '02') { //杞存祦椋庢満 + html += '<li><div class="con myfancy zhouliu" status="'+ item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front">'; + if(targetStatus == 'W_CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_W_CLOSE.png"></div>' + }else if(targetStatus == 'W_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_W_OPEN.png"></div>' + }else if(targetStatus == 'F_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_F_OPEN.gif"></div>' + }else if(targetStatus == 'F_OPEN_F'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_F_OPEN_F.gif"></div>' + }else if(targetStatus == 'F_CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_W_OPEN.png"></div>' + } + html += '<div class="info in" style="background-image: url(images/e3.png);">' + item.name +'</div>' + html += '</div></li>' + } else if (item.type == '04') { //鐜祦椋庢満 + html += '<li><div class="con myfancy huanliu" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front">'; + if(targetStatus == 'CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_04_ClOSE.png"></div>' + }else if(targetStatus == 'OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_04_OPEN.gif"></div>' + } + html += '<div class="info out" style="background-image: url(images/e3.png);"> ' + item.name + '</div>' + html += '</div></li>' + } else if (item.type == '0B') { //閫氶鍙� + html += '<li><div class="con myfancy chuangkou" status="' + item.status + + '" passCode="' +item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front" type="0B">'; + if(targetStatus == 'CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0B_CLOSE.png"></div>' + }else if(targetStatus == 'OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0B_OPEN.png"></div>' + } + html += '<div class="info in" style="background-image: url(images/e3.png);">'+ item.name +'</div>' + html += '</div></li>' + } else if (item.type == '0C') { //娣锋祦椋庢満 + html += '<li><div class="con myfancy hunliu" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name +'" location="front">'; + if(targetStatus == 'W_CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_w_CLOSE.png"></div>' + }else if(targetStatus == 'F_OPEN_F'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_F_OPEN_F.gif"></div>' + }else if(targetStatus == 'F_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_F_OPEN.gif"></div>' + }else if(targetStatus == 'W_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_W_OPEN.png"></div>' + } + html += '<div class="info out" style="background-image: url(images/e3.png);"> ' + item.name + '</div>' + html += '</div></li>' + } else if (item.type == '0D') { //鍔犲帇椋庢満 + html += '<li><div class="con myfancy jiaya" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name +'" location="front">'; + if(targetStatus == 'CLOSE'){ + html += '<div class="pic pic1"><img src="images/device-status/STATUS_0D_CLOSE.png"></div>' + }else if(targetStatus == 'OPEN'){ + html += '<div class="pic pic1"><img src="images/device-status/STATUS_0D_OPEN.png"></div>' + } + html += '<div class="info out" style="background-image: url(images/e3.png);"> ' + item.name + '</div>' + html += '</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(frontList, function(index, item) { + targetStatus = item.status + if (item.type == '01') { //椋庣獥 + html += '<li><div class="con myfancy chuangkou" status="' + item.status + + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front" type="01">'; + if(targetStatus == 'OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_01_OPEN.png"></div>' + html += '<div class="info in" style="background-image: url(images/e5.png);">'+ item.name +'</div>' + }else if(targetStatus == 'CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_01_CLOSE.png"></div>' + html += '<div class="info in" style="background-image: url(images/e3.png);">'+ item.name +'</div>' + } + html += '</div></li>' + } else if (item.type == '02') { //杞存祦椋庢満 + html += '<li><div class="con myfancy zhouliu" status="'+ item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front">'; + if(targetStatus == 'W_CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_W_CLOSE.png"></div>' + }else if(targetStatus == 'W_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_W_OPEN.png"></div>' + }else if(targetStatus == 'F_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_F_OPEN.gif"></div>' + }else if(targetStatus == 'F_OPEN_F'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_F_OPEN_F.gif"></div>' + }else if(targetStatus == 'F_CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_02_W_OPEN.png"></div>' + } + html += '<div class="info in" style="background-image: url(images/e3.png);">' + item.name +'</div>' + html += '</div></li>' + } else if (item.type == '04') { //鐜祦椋庢満 + html += '<li><div class="con myfancy huanliu" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front">'; + if(targetStatus == 'CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_04_ClOSE.png"></div>' + }else if(targetStatus == 'OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_04_OPEN.gif"></div>' + } + html += '<div class="info out" style="background-image: url(images/e3.png);"> ' + item.name + '</div>' + html += '</div></li>' + } else if (item.type == '0B') { //閫氶鍙� + html += '<li><div class="con myfancy chuangkou" status="' + item.status + + '" passCode="' +item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front" type="0B">'; + if(targetStatus == 'CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0B_CLOSE.png"></div>' + }else if(targetStatus == 'OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0B_OPEN.png"></div>' + } + html += '<div class="info in" style="background-image: url(images/e3.png);">'+ item.name +'</div>' + html += '</div></li>' + } else if (item.type == '0C') { //娣锋祦椋庢満 + html += '<li><div class="con myfancy hunliu" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name +'" location="front">'; + if(targetStatus == 'W_CLOSE'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_w_CLOSE.png"></div>' + }else if(targetStatus == 'F_OPEN_F'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_F_OPEN_F.gif"></div>' + }else if(targetStatus == 'F_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_F_OPEN.gif"></div>' + }else if(targetStatus == 'W_OPEN'){ + html += '<div class="pic"><img src="images/device-status/STATUS_0C_W_OPEN.png"></div>' + } + html += '<div class="info out" style="background-image: url(images/e3.png);"> ' + item.name + '</div>' + html += '</div></li>' + } else if (item.type == '0D') { //鍔犲帇椋庢満 + html += '<li><div class="con myfancy jiaya" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name +'" location="front">'; + if(targetStatus == 'CLOSE'){ + html += '<div class="pic pic1"><img src="images/device-status/STATUS_0D_CLOSE.png"></div>' + }else if(targetStatus == 'OPEN'){ + html += '<div class="pic pic1"><img src="images/device-status/STATUS_0D_OPEN.png"></div>' + } + html += '<div class="info out" style="background-image: url(images/e3.png);"> ' + item.name + '</div>' + html += '</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></div>'; + } + } else { + html += + '<div class="m-tf"><div class="g-tittf1" style="text-align: center;font-size: 20px;color:#dd524d">鏆傛棤鏁版嵁</div></div>'; + } + $("#recordList").html(html); + +} + +//璁惧鎿嶄綔璇锋眰 +function toControlDevice() { + console.log(JSON.stringify(data)) + 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") { + window.setTimeout(function() { + renderDevice(); + }, 200) + } else { + mui.alert(result.msg, "鎻愮ず", ["纭畾"], function() {}, "div") + } + }, + error: function() { + mui.alert("绯荤粺绻佸繖,璇烽噸璇曪紒", "鎻愮ず", ["纭畾"], function() {}, "div") + } + }) +} mui('.mui-scroll-wrapper').scroll({ indicators: false, //鏄惁鏄剧ず婊氬姩鏉� @@ -63,22 +487,146 @@ bounce: false, //鏄惁鍚敤鍥炲脊 deceleration: 0.0005 //flick 鍑忛�熺郴鏁帮紝绯绘暟瓒婂ぇ锛屾粴鍔ㄩ�熷害瓒婃參锛屾粴鍔ㄨ窛绂昏秺灏忥紝榛樿鍊�0.0006 }); - -//绌鸿皟鎿嶄綔 +//椋庣獥鍜岄�氶鍙e脊绐� +mui(".mui-scroll-wrapper").on("tap", ".m-tf ul li .chuangkou", function() { + deviceDetail.passCode = this.getAttribute("passCode"); + deviceDetail.serId = this.getAttribute("serId"); + deviceDetail.location = this.getAttribute("location"); + deviceDetail.type = this.getAttribute("type") + deviceDetail.status = this.getAttribute("status") + var name = this.getAttribute("name"); + document.getElementById("Fname").innerText = name + $('#win_chuangkou').css('display', 'flex'); +}); +//鐜祦寮圭獥 mui(".mui-scroll-wrapper").on("tap", ".m-tf ul li .huanliu", function() { + deviceDetail.passCode = this.getAttribute("passCode"); + deviceDetail.serId = this.getAttribute("serId"); + deviceDetail.location = this.getAttribute("location"); + deviceDetail.status = this.getAttribute("status") + deviceDetail.type = '04' + var name = this.getAttribute("name"); + document.getElementById("huanliuName").innerText = name $('#win_huanliu').css('display', 'flex'); }); +//娣锋祦寮圭獥 mui(".mui-scroll-wrapper").on("tap", ".m-tf ul li .hunliu", function() { + deviceDetail.passCode = this.getAttribute("passCode"); + deviceDetail.serId = this.getAttribute("serId"); + deviceDetail.location = this.getAttribute("location"); + deviceDetail.status = this.getAttribute("status") + deviceDetail.type = "0C" + var name = this.getAttribute("name"); + document.getElementById("hunliuName").innerText = name $('#win_hunliu').css('display', 'flex'); }); +//杞存祦寮圭獥 mui(".mui-scroll-wrapper").on("tap", ".m-tf ul li .zhouliu", function() { + deviceDetail.passCode = this.getAttribute("passCode"); + deviceDetail.serId = this.getAttribute("serId"); + deviceDetail.location = this.getAttribute("location"); + deviceDetail.status = this.getAttribute("status") + deviceDetail.type = "02" + var name = this.getAttribute("name"); + document.getElementById("zhouliuName").innerText = name $('#win_zhouliu').css('display', 'flex'); }); +//鍔犲帇椋庢満寮圭獥 mui(".mui-scroll-wrapper").on("tap", ".m-tf ul li .jiaya", function() { + deviceDetail.passCode = this.getAttribute("passCode"); + deviceDetail.serId = this.getAttribute("serId"); + deviceDetail.location = this.getAttribute("location"); + deviceDetail.status = this.getAttribute("status"); + deviceDetail.type = "0D" + var name = this.getAttribute("name"); + document.getElementById("zhouliuName").innerText = name $('#win_jiaya').css('display', 'flex'); }); +//璁惧鎿嶄綔 mui(".m-pop").on("tap", ".inner a", function() { - var id = this.getAttribute("id"); + //鎵�杩涜鐨勬搷浣� + var targetStatus = this.getAttribute("targetStatus"); + + //濡傛灉鏄酱娴侀鏈猴紝鍏堟牴鎹鏈虹姸鎬佸垽鏂鏈烘搷浣滄槸鍚﹀彲浠ユ墽琛� + if (deviceDetail.type == '02') { + //椋庢満鐘舵�佷负椋庢満寮�椋庣獥寮�锛屽嵆F_OPEN鎴栬�匜_OPEN_F鏃讹紝涓嶈兘鎵ц鍏抽绐楁搷浣� + if ((deviceDetail.status == 'F_OPEN' || deviceDetail.status == 'F_OPEN_F') && targetStatus == 'CLOSE') { + mui.alert("姝ら鏈烘鍦ㄨ繍琛岋紝涓嶈兘鎵ц鍏抽棴椋庣獥鎿嶄綔锛�", "鎻愮ず", ["纭畾"], function() {}, "div") + return; + } + //椋庢満鐘舵�佷负椋庢満寮�椋庣獥寮�锛屽嵆F_OPEN鎴栬�匜_OPEN_F鏃讹紝涓嶈兘鎵ц椋庣獥鍏ㄥ叧鎿嶄綔 + if ((deviceDetail.status == 'F_OPEN' || deviceDetail.status == 'F_OPEN_F') && targetStatus == + 'W_CLOSE_ALL') { + mui.alert("姝ら鏈烘鍦ㄨ繍琛岋紝涓嶈兘鎵ц椋庣獥鍏ㄥ叧鎿嶄綔锛�", "鎻愮ず", ["纭畾"], function() {}, "div") + return; + } + //椋庢満鐘舵�佷负椋庢満鍏抽绐楀叧锛屽嵆W_CLOSE鏃讹紝涓嶈兘鎵ц寮�椋庢満鎿嶄綔 + if (deviceDetail.status == 'W_CLOSE' && (targetStatus == 'F_CLOSE' || targetStatus == 'F_OPEN')) { + mui.alert("姝ら鏈虹殑椋庣獥鍏抽棴涓紝涓嶈兘鎵ц椋庢満鎿嶄綔锛�", "鎻愮ず", ["纭畾"], function() {}, "div") + return; + } + } + //濡傛灉鏄贩娴侀鏈猴紝鍏堝垽鏂鏈烘搷浣滄槸鍚﹀彲浠ユ墽琛� + if (deviceDetail.type == '0C') { + //椋庢満鐘舵�佷负椋庢満寮�椋庡彛寮�锛屽嵆F_OPEN鏃讹紝涓嶈兘鎵ц鍏抽鍙f搷浣� + if ((deviceDetail.status == 'F_OPEN_F' || deviceDetail.status == 'F_OPEN') && targetStatus == 'CLOSE') { + mui.alert("姝ら鏈烘鍦ㄨ繍琛岋紝涓嶈兘鎵ц鍏抽棴椋庡彛鎿嶄綔锛�", "鎻愮ず", ["纭畾"], function() {}, "div") + return; + } + //椋庢満鐘舵�佷负椋庢満寮�椋庣獥寮�锛屽嵆F_OPEN鏃讹紝涓嶈兘鎵ц椋庣獥鍏ㄥ叧鎿嶄綔 + if ((deviceDetail.status == 'F_OPEN_F' || deviceDetail.status == 'F_OPEN') && targetStatus == + 'W_CLOSE_ALL') { + mui.alert("姝ら鏈烘鍦ㄨ繍琛岋紝涓嶈兘鎵ц椋庡彛鍏ㄥ叧鎿嶄綔锛�", "鎻愮ず", ["纭畾"], function() {}, "div") + return; + } + //椋庢満鐘舵�佷负椋庢満鍏抽绐楀叧锛屽嵆W_CLOSE鏃讹紝涓嶈兘鎵ц寮�椋庣獥鎿嶄綔 + if (deviceDetail.status == 'W_CLOSE' && (targetStatus == 'F_CLOSE' || targetStatus == 'F_OPEN' || + targetStatus == 'F_OPEN_F')) { + mui.alert("姝ら鏈虹殑椋庡彛鍏抽棴涓紝涓嶈兘鎵ц椋庢満鎿嶄綔锛�", "鎻愮ず", ["纭畾"], function() {}, "div") + return; + } + //椋庢満鐘舵�佷负椋庢満寮�椋庣獥寮�锛屽嵆F_OPEN鏃讹紝涓嶈兘鎵ц鍙嶈浆鎿嶄綔 + if (deviceDetail.status == 'F_OPEN' && targetStatus == 'F_OPEN_F') { + mui.alert("姝ら鏈烘杞姸鎬侊紝涓嶈兘鎵ц鍙嶈浆鎿嶄綔锛�", "鎻愮ず", ["纭畾"], function() {}, "div") + return; + } + //椋庢満鐘舵�佷负椋庢満寮�椋庣獥寮�锛屽嵆F_OPEN_F鏃讹紝涓嶈兘鎵ц姝h浆鎿嶄綔 + if (deviceDetail.status == 'F_OPEN_F' && targetStatus == 'F_OPEN') { + mui.alert("姝ら鏈哄弽杞姸鎬侊紝涓嶈兘鎵ц姝h浆鎿嶄綔锛�", "鎻愮ず", ["纭畾"], function() {}, "div") + return; + } + } + //鍒ゆ柇鏄惁鏄壒閲� + var batchTag = false; + if (targetStatus == 'W_OPEN_ALL') { + targetStatus = 'OPEN'; + batchTag = true; + } + if (targetStatus == 'W_CLOSE_ALL') { + targetStatus = 'CLOSE'; + batchTag = true; + } + if (targetStatus == 'OPEN_ALL') { + targetStatus = 'OPEN'; + batchTag = true; + } + if (targetStatus == 'CLOSE_ALL') { + targetStatus = 'CLOSE'; + batchTag = true; + } +console.log(batchTag); + + // //浠撳簱鍓嶉潰 + data.data.deptId=deptId; + data.data.depotId=depotId; + data.data.passCode=deviceDetail.passCode; + data.data.serId=deviceDetail.serId; + data.data.targetStatus=targetStatus; + data.data.type=deviceDetail.type; + data.data.batchTag=batchTag; + console.log(JSON.stringify(data.data)) + //鍙戦�佹搷浣滆姹� + toControlDevice(); closePop(); }); @@ -89,4 +637,9 @@ $('.pop-bg,.m-pop .close').click(function(e) { e.stopPropagation(); $('.m-pop').fadeOut(); +}); + +var slider = mui(".mui-slider"); +slider.slider({ + interval: 3000 }); \ No newline at end of file -- Gitblit v1.9.3