From ea6bc6a90863e8800db77091810c647aa9328963 Mon Sep 17 00:00:00 2001 From: YYC <1833023622@qq.com> Date: 星期二, 30 五月 2023 16:27:42 +0800 Subject: [PATCH] 通风操作 --- igds-app/js/admin/device-verb.js | 532 +++++++++++++++++++++++++++++++++++++++++++- igds-app/js/admin/device-temp.js | 98 ++++---- igds-app/device-verb.html | 75 +++-- 3 files changed, 612 insertions(+), 93 deletions(-) diff --git a/igds-app/device-verb.html b/igds-app/device-verb.html index e446e09..3884dba 100644 --- a/igds-app/device-verb.html +++ b/igds-app/device-verb.html @@ -18,17 +18,17 @@ </header> <div class="mui-content"> <div class="mui-scroll-wrapper g-src_box"> - <div class="m-mana"> + <div class="m-mana" id="recordList"> <div class="m-tf"> <div class="g-tittf1">浠撳簱姝i潰</div> <ul class="ul-listmana1 ullisttf1"> <li> <div class="con myfancy huanliu"> <div class="pic"> - <img src="images/d6.png"> + <img src="images/device-status/STATUS_01_OPEN.png"> </div> <div class="info in" style="background-image: url(images/e3.png);"> - 鐜祦椋庢満1 + 椋庣獥1 </div> </div> </li> @@ -92,16 +92,35 @@ </div> </div> </div> + <!-- 椋庣獥鍜岄�氶鍙� 寮圭獥 --> + <div class="m-pop" id="win_chuangkou"> + <div class="pop-bg"></div> + <div class="inner"> + <div class="m-opts"> + <div class="name" id="Fname">椋庣獥</div> + <div class="btns"> + <a href="" class="btn" targetStatus="OPEN" style="background: linear-gradient(90deg,#ec8b42,#ffaf48);">鎵撳紑</a> + <a href="" class="btn" targetStatus="CLOSE" style="background: linear-gradient(90deg,#5889e2,#73b2e7);">鍏抽棴</a> + </div> + <div class="btns"> + <a href="" class="btn" targetStatus="OPEN_ALL" style="background: linear-gradient(90deg,#2aaad9,#72c6f1);">鍏ㄥ紑</a> + <a href="" class="btn" targetStatus="CLOSE_ALL" style="background: linear-gradient(90deg,#f36968,#fb9475);">鍏ㄥ叧</a> + </div> + </div> + <div class="close"><span class="mui-icon mui-icon-close"></span></div> + </div> + </div> + <!-- 鐜祦椋庢満 寮圭獥 --> <div class="m-pop" id="win_huanliu"> <div class="pop-bg"></div> <div class="inner"> <div class="m-opts huanliu"> - <div class="name">鐜祦椋庢満</div> + <div class="name" id="huanliuName">鐜祦椋庢満</div> <div class="btns"> - <a href="" class="btn" style="background: linear-gradient(90deg,#ec8b42,#ffaf48);">寮�闂�</a> - <a href="" class="btn" style="background: linear-gradient(90deg,#5889e2,#73b2e7);">鍏抽鏈�</a> - <a href="" class="btn" style="background: linear-gradient(90deg,#178255,#379a71);">鍏抽棬</a> + <a href="" class="btn" targetStatus="F_OPEN" style="background: linear-gradient(90deg,#ec8b42,#ffaf48);">寮洪</a> + <a href="" class="btn" targetStatus="F_CLOSE" style="background: linear-gradient(90deg,#5889e2,#73b2e7);">鍏抽鏈�</a> + <a href="" class="btn" targetStatus="F_OPEN_F" style="background: linear-gradient(90deg,#178255,#379a71);">寮遍</a> </div> </div> @@ -113,19 +132,19 @@ <div class="pop-bg"></div> <div class="inner"> <div class="m-opts hunliu"> - <div class="name">娣锋祦椋庢満</div> + <div class="name" id="hunliuName">娣锋祦椋庢満</div> <div class="btns sty1"> - <a href="" class="btn" style="background: linear-gradient(90deg,#2aaad9,#68c2f0);">寮�椋庡彛</a> - <a href="" class="btn" style="background: linear-gradient(90deg,#f36868,#fb9475);">鍏抽鍙�</a> + <a href="" class="btn" targetStatus="W_OPEN" style="background: linear-gradient(90deg,#2aaad9,#68c2f0);">寮�椋庡彛</a> + <a href="" class="btn" targetStatus="W_CLOSE" style="background: linear-gradient(90deg,#f36868,#fb9475);">鍏抽鍙�</a> </div> <div class="btns"> - <a href="" class="btn" style="background: linear-gradient(90deg,#ec8b42,#ffaf48);">姝h浆</a> - <a href="" class="btn" style="background: linear-gradient(90deg,#5889e2,#73b2e7);">鍏抽鏈�</a> - <a href="" class="btn" style="background: linear-gradient(90deg,#178255,#379a71);">鍙嶈浆</a> + <a href="" class="btn" targetStatus="F_OPEN" style="background: linear-gradient(90deg,#ec8b42,#ffaf48);">姝h浆</a> + <a href="" class="btn" targetStatus="F_CLOSE" style="background: linear-gradient(90deg,#5889e2,#73b2e7);">鍏抽鏈�</a> + <a href="" class="btn" targetStatus="F_OPEN_F" style="background: linear-gradient(90deg,#178255,#379a71);">鍙嶈浆</a> </div> <div class="btns sty1"> - <a href="" class="btn" style="background: linear-gradient(90deg,#2aaad9,#68c2f0);">椋庡彛鍏ㄥ紑</a> - <a href="" class="btn" style="background: linear-gradient(90deg,#f36868,#fb9475);">椋庡彛鍏ㄥ叧</a> + <a href="" class="btn" targetStatus="W_OPEN_ALL" style="background: linear-gradient(90deg,#2aaad9,#68c2f0);">椋庡彛鍏ㄥ紑</a> + <a href="" class="btn" targetStatus="W_CLOSE_ALL" style="background: linear-gradient(90deg,#f36868,#fb9475);">椋庡彛鍏ㄥ叧</a> </div> </div> <div class="close"><span class="mui-icon mui-icon-close"></span></div> @@ -136,15 +155,14 @@ <div class="pop-bg"></div> <div class="inner"> <div class="m-opts"> - <div class="name">鍔犲帇椋庢満</div> + <div class="name" id="jiayaName">鍔犲帇椋庢満</div> <div class="btns"> - <a href="" class="btn" style="background: linear-gradient(90deg,#ec8c42,#ffb453);">鎵撳紑</a> - <a href="" class="btn" style="background: linear-gradient(90deg,#188255,#379a71);">鍏抽棴</a> + <a href="" class="btn" targetStatus="OPEN" style="background: linear-gradient(90deg,#ec8c42,#ffb453);">鎵撳紑</a> + <a href="" class="btn" targetStatus="CLOSE" style="background: linear-gradient(90deg,#188255,#379a71);">鍏抽棴</a> </div> <div class="btns"> - - <a href="" class="btn" style="background: linear-gradient(90deg,#2aaad9,#72c6f1);">鍏ㄥ紑</a> - <a href="" class="btn" style="background: linear-gradient(90deg,#f36968,#fb9475);">鍏ㄥ叧</a> + <a href="" class="btn" targetStatus="OPEN_ALL" style="background: linear-gradient(90deg,#2aaad9,#72c6f1);">鍏ㄥ紑</a> + <a href="" class="btn" targetStatus="CLOSE_ALL" style="background: linear-gradient(90deg,#f36968,#fb9475);">鍏ㄥ叧</a> </div> </div> <div class="close"><span class="mui-icon mui-icon-close"></span></div> @@ -155,19 +173,18 @@ <div class="pop-bg"></div> <div class="inner"> <div class="m-opts"> - <div class="name">杞存祦椋庢満</div> + <div class="name" id="zhouliuName">杞存祦椋庢満</div> <div class="btns"> - <a href="" class="btn" style="background: linear-gradient(90deg,#2aaad9,#72c6f1);">寮�椋庣獥</a> - <a href="" class="btn" style="background: linear-gradient(90deg,#f36968,#fb9475);">鍏抽绐�</a> + <a href="" class="btn" targetStatus="OPEN" style="background: linear-gradient(90deg,#2aaad9,#72c6f1);">寮�椋庣獥</a> + <a href="" class="btn" targetStatus="CLOSE" style="background: linear-gradient(90deg,#f36968,#fb9475);">鍏抽绐�</a> </div> <div class="btns"> - <a href="" class="btn" style="background: linear-gradient(90deg,#ec8c42,#ffb453);">寮�椋庢満</a> - <a href="" class="btn" style="background: linear-gradient(90deg,#188255,#379a71);">鍏抽鏈�</a> + <a href="" class="btn" targetStatus="F_OPEN" style="background: linear-gradient(90deg,#ec8c42,#ffb453);">寮�椋庢満</a> + <a href="" class="btn" targetStatus="F_CLOSE" style="background: linear-gradient(90deg,#188255,#379a71);">鍏抽鏈�</a> </div> <div class="btns"> - - <a href="" class="btn" style="background: linear-gradient(90deg,#2aaad9,#72c6f1);">椋庣獥鍏ㄥ紑</a> - <a href="" class="btn" style="background: linear-gradient(90deg,#f36968,#fb9475);">椋庣獥鍏ㄥ叧</a> + <a href="" class="btn" targetStatus="OPEN_ALL" style="background: linear-gradient(90deg,#2aaad9,#72c6f1);">椋庣獥鍏ㄥ紑</a> + <a href="" class="btn" targetStatus="CLOSE_ALL" style="background: linear-gradient(90deg,#f36968,#fb9475);">椋庣獥鍏ㄥ叧</a> </div> </div> <div class="close"><span class="mui-icon mui-icon-close"></span></div> diff --git a/igds-app/js/admin/device-temp.js b/igds-app/js/admin/device-temp.js index fe16e28..2fba7a1 100644 --- a/igds-app/js/admin/device-temp.js +++ b/igds-app/js/admin/device-temp.js @@ -130,76 +130,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>' } @@ -234,7 +234,7 @@ if (targetStatus == 'OPEN') { //鏀瑰彉寮�鍏崇殑榛樿鐘舵�� document.getElementById("vibrationSwitch").classList.add('mui-active'); - }else if(targetStatus == 'CLOSE'){ + } else if (targetStatus == 'CLOSE') { document.getElementById("vibrationSwitch").classList.remove('mui-active'); } var passCode = this.getAttribute("passCode"); diff --git a/igds-app/js/admin/device-verb.js b/igds-app/js/admin/device-verb.js index 1e1b484..56aa61f 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", + // "type": "", // "passCode": "", // "serId": "", // "targetStatus": "" // } }; - +//璁惧鍒楄〃 var data1 = { "interfaceId": "5401", "outId": "10401", @@ -26,7 +37,7 @@ "data": { "deptId": "", "depotId": "", - "type": "01", //椋庣獥 + "type": "01", //椋庣獥 "type1": "02", //杞存祦椋庣獥 "type2": "04", //鐜祦椋庢満 "type3": "0B", //閫氶鍙� @@ -52,10 +63,275 @@ // depotName = self.depotName } -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; + } else { + mui.toast(result.msg); + } + }, + error: function() { + mui.alert("绯荤粺绻佸繖,璇烽噸璇曪紒", "鎻愮ず", ["纭畾"], function() {}, "div") + } + }) +} + +//娓叉煋椤甸潰 +function renderDevice() { + var html = ''; + if (deviceData) { + var deviceList = deviceData.listDevice; + if (deviceList && deviceList.length > 0) { + $.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) { + 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">'; + html += '<div class="pic"><img src="images/device-status/STATUS_01_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 == '02') { //杞存祦椋庢満 + html += '<li><div class="con myfancy zhouliu" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="front">'; + html += '<div class="pic"><img src="images/d8.png"></div>' + html += '<div class="info in" style="background-image: url(images/e4.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">'; + html += '<div class="pic"><img src="images/d7.png"></div>' + html += '<div class="info out" style="background-image: url(images/e5.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">'; + html += '<div class="pic"><img src="images/device-status/STATUS_0B_OPEN.png"></div>' + html += '<div class="info out" ' + 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">'; + html += '<div class="pic"><img src="images/device-status/STATUS_01_OPEN.png"></div>' + html += '<div class="info full" style="background-image: url(images/e6.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">'; + html += '<div class="pic pic1"><img src="images/d9.png"></div>' + html += '<div class="info full" style="background-image: url(images/e7.png);">' + item + .name + '</div>' + html += '</div></li>' + } + }) + html += '</ul></div>' + } else 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.type == '01') { //椋庣獥 + html += '<li><div class="con myfancy chuangkou" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="back" type="01">'; + html += '<div class="pic"><img src="images/device-status/STATUS_01_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 == '02') { //杞存祦椋庢満 + html += '<li><div class="con myfancy zhouliu" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + '" location="back">'; + html += '<div class="pic"><img src="images/d8.png"></div>' + html += '<div class="info in" style="background-image: url(images/e4.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="back">'; + html += '<div class="pic"><img src="images/d7.png"></div>' + html += '<div class="info out" style="background-image: url(images/e5.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="back" type="0B">'; + html += '<div class="pic"><img src="images/device-status/STATUS_0B_OPEN.png"></div>' + html += '<div class="info out" ' + 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="back">'; + html += '<div class="pic"><img src="images/device-status/STATUS_01_OPEN.png"></div>' + html += '<div class="info full" style="background-image: url(images/e6.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="back">'; + html += '<div class="pic pic1"><img src="images/d9.png"></div>' + html += '<div class="info full" style="background-image: url(images/e7.png);">' + item + .name + '</div>' + html += '</div></li>' + } + }) + html += '</ul></div>' + } else 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.type == '01') { //椋庣獥 + html += '<li><div class="con myfancy chuangkou" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="left" type="01">'; + html += '<div class="pic"><img src="images/device-status/STATUS_01_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 == '02') { //杞存祦椋庢満 + html += '<li><div class="con myfancy zhouliu" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + '" location="left">'; + html += '<div class="pic"><img src="images/d8.png"></div>' + html += '<div class="info in" style="background-image: url(images/e4.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="left">'; + html += '<div class="pic"><img src="images/d7.png"></div>' + html += '<div class="info out" style="background-image: url(images/e5.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="left" type="0B">'; + html += '<div class="pic"><img src="images/device-status/STATUS_0B_OPEN.png"></div>' + html += '<div class="info out" ' + 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="left">'; + html += '<div class="pic"><img src="images/device-status/STATUS_01_OPEN.png"></div>' + html += '<div class="info full" style="background-image: url(images/e6.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="left">'; + html += '<div class="pic pic1"><img src="images/d9.png"></div>' + html += '<div class="info full" style="background-image: url(images/e7.png);">' + item + .name + '</div>' + html += '</div></li>' + } + }) + html += '</ul></div>' + } else 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.type == '01') { //椋庣獥 + html += '<li><div class="con myfancy chuangkou" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="right" type="01">'; + html += '<div class="pic"><img src="images/device-status/STATUS_01_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 == '02') { //杞存祦椋庢満 + html += '<li><div class="con myfancy zhouliu" status="' + item.status + '" passCode="' + + item.passCode + '" serId="' + item.serId + '"name="' + item.name + + '" location="right">'; + html += '<div class="pic"><img src="images/d8.png"></div>' + html += '<div class="info in" style="background-image: url(images/e4.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="right">'; + html += '<div class="pic"><img src="images/d7.png"></div>' + html += '<div class="info out" style="background-image: url(images/e5.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="right" type="0B">'; + html += '<div class="pic"><img src="images/device-status/STATUS_0B_OPEN.png"></div>' + html += '<div class="info out" ' + 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="right">'; + html += '<div class="pic"><img src="images/device-status/STATUS_01_OPEN.png"></div>' + html += '<div class="info full" style="background-image: url(images/e6.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="right">'; + html += '<div class="pic pic1"><img src="images/d9.png"></div>' + html += '<div class="info full" style="background-image: url(images/e7.png);">' + item + .name + '</div>' + html += '</div></li>' + } + }) + html += '</ul></div>' + } + } +} + +//璁惧鎿嶄綔璇锋眰 +function toControlDevice() { + 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 +339,243 @@ 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; + } + + //浠撳簱鍓嶉潰 + if (deviceDetail.location == "front") { + //鍙傛暟娓呯┖ + data.data = []; + if (batchTag) { //鎵归噺鎿嶄綔 + $.each(frontList, function(index, item) { + if (deviceDetail.type == item.type) { + data.data.push({ + "deptId": deptId, + "depotId": depotId, + "passCode": item.passCode, + "serId": item.serId, + "type": item.type, + "targetStatus": targetStatus + }) + } + }) + } else { //鍗曡澶囨搷浣� + data.data.push({ + "deptId": deptId, + "depotId": depotId, + "passCode": deviceDetail.passCode, + "serId": deviceDetail.serId, + "type": deviceDetail.type, + "targetStatus": targetStatus + }) + } + } else if (deviceDetail.location == "back") { + //鍙傛暟娓呯┖ + data.data = []; + if (batchTag) { //鎵归噺鎿嶄綔 + $.each(backList, function(index, item) { + if (deviceDetail.type == item.type) { + data.data.push({ + "deptId": deptId, + "depotId": depotId, + "passCode": item.passCode, + "serId": item.serId, + "type": item.type, + "targetStatus": targetStatus + }) + } + }) + } else { //鍗曡澶囨搷浣� + data.data.push({ + "deptId": deptId, + "depotId": depotId, + "passCode": deviceDetail.passCode, + "serId": deviceDetail.serId, + "type": deviceDetail.type, + "targetStatus": targetStatus + }) + } + } else if (deviceDetail.location == "left") { + //鍙傛暟娓呯┖ + data.data = []; + if (batchTag) { //鎵归噺鎿嶄綔 + $.each(leftList, function(index, item) { + if (deviceDetail.type == item.type) { + data.data.push({ + "deptId": deptId, + "depotId": depotId, + "passCode": item.passCode, + "serId": item.serId, + "type": item.type, + "targetStatus": targetStatus + }) + } + }) + } else { //鍗曡澶囨搷浣� + data.data.push({ + "deptId": deptId, + "depotId": depotId, + "passCode": deviceDetail.passCode, + "serId": deviceDetail.serId, + "type": deviceDetail.type, + "targetStatus": targetStatus + }) + } + } else if (deviceDetail.location == "right") { + //鍙傛暟娓呯┖ + data.data = []; + if (batchTag) { //鎵归噺鎿嶄綔 + $.each(rightList, function(index, item) { + if (deviceDetail.type == item.type) { + data.data.push({ + "deptId": deptId, + "depotId": depotId, + "passCode": item.passCode, + "serId": item.serId, + "type": item.type, + "targetStatus": targetStatus + }) + } + }) + } else { //鍗曡澶囨搷浣� + data.data.push({ + "deptId": deptId, + "depotId": depotId, + "passCode": deviceDetail.passCode, + "serId": deviceDetail.serId, + "type": deviceDetail.type, + "targetStatus": targetStatus + }) + } + } + + //鍙戦�佹搷浣滆姹� + toControlDevice(); closePop(); }); @@ -89,4 +586,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