remote-upper-devicefilter.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="Cache-Control" content="no-cache,no-store,no-siteapp,must-revalidate">
  6. <meta http-equiv="pragma" content="no-cache">
  7. <meta http-equiv="expires" content="0">
  8. <meta name="author" content="">
  9. <meta name="description" content=""/>
  10. <meta name="keywords" content="扫码支付,线上投币,运营数据,物联网"/>
  11. <meta name="format-detection" content="telephone=no,email=no">
  12. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
  13. <title>选择上分设备</title>
  14. <link rel="stylesheet" href="https://cdn.washpayer.com/components/lib/mui.min.css">
  15. <link rel="stylesheet" href="../components/custom/css/common.css">
  16. <link rel="stylesheet" href="css/xyf.common.min.css">
  17. </head>
  18. <style>
  19. .mui-segmented-control.mui-segmented-control-inverted.mui-segmented-control-vertical .mui-control-item, .mui-segmented-control.mui-segmented-control-inverted.mui-segmented-control-vertical .mui-control-item.mui-active {
  20. border-bottom: 1px solid #E5E5E5 !important;
  21. }
  22. .mui-segmented-control .mui-control-item {
  23. line-height: 50px;
  24. width: 100%;
  25. }
  26. #leftContents .mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active {
  27. background-color: #fff;
  28. border-left: 3px solid;
  29. }
  30. #leftContents, #rightContents {
  31. bottom: 0;
  32. position: absolute;
  33. overflow: auto;
  34. }
  35. #rightContents {
  36. top: 0;
  37. right: 0;
  38. background-color: #fff
  39. }
  40. #leftContents {
  41. top: 51px;
  42. left: 0
  43. }
  44. #leftContents a {
  45. padding-left: 10px;
  46. }
  47. #rightContents p b {
  48. color: #333333;
  49. }
  50. #rightContents .mui-segmented-control-inverted a {
  51. font-size: 1em
  52. }
  53. .groupTitle {
  54. padding-left: 10px;
  55. line-height: 50px;
  56. display: block;
  57. border-bottom: 1px solid #E5E5E5;
  58. background-color: #fff
  59. }
  60. .offline, .online,.busy {
  61. float: right;
  62. line-height: 16px;
  63. }
  64. .typeHeader {
  65. position: fixed;
  66. background-color: #fff;
  67. z-index: 99;
  68. width: 66.66% !important;
  69. }
  70. .typeItem {
  71. top: 53px
  72. }
  73. #rightContents .mui-table-view:after {
  74. left: 15px
  75. }
  76. </style>
  77. <body>
  78. <div class="mui-content mui-row mui-fullscreen">
  79. <div class="mui-col-xs-4 mui-col-sm-4"><a class="groupTitle">场地</a></div>
  80. <div id="leftContents" class="mui-col-xs-4 mui-col-sm-4">
  81. <div class="mui-segmented-control mui-segmented-control-inverted mui-segmented-control-vertical">
  82. </div>
  83. </div>
  84. <div id="rightContents" class="mui-col-xs-8 mui-col-sm-8" style="border-left: 1px solid #E5E5E5;">
  85. </div>
  86. </div>
  87. <script src="https://cdn.washpayer.com/components/lib/jquery.min.js"></script>
  88. <script src="https://cdn.washpayer.com/components/lib/mui.min.js"></script>
  89. <script src="/components/custom/js/common.js"></script>
  90. <script src="js/xyf.common.js"></script>
  91. <script>
  92. $(function () {
  93. var loadEnd = false;
  94. var leftContents = $("#leftContents").children(".mui-segmented-control"),
  95. rightContents = $("#rightContents");
  96. var generalHtml = function (record, type) {
  97. var onlineTag = '';
  98. if (record.online == 1) {
  99. onlineTag = '<em class="online">在线</em>';
  100. } else if (record.online == 0) {
  101. onlineTag = '<em class="offline">离线</em>';
  102. }
  103. var groupName = record.groupNumber,
  104. remarks = record.remarks,
  105. eType = record.devType,
  106. value = record.logicalCode
  107. return '<li online="' + record.online + '" class="mui-table-view-cell" eValue="' + value + '" eType="' + eType + '" >'
  108. + (groupName !== 0 ? '<p><i class="c-primary iconfont ' + getDevIconName(eType) + '"></i><b>' + eType + " " + value + '</b>' + onlineTag + '</p>' : '<p></p>')
  109. + '<p class="worldlimit"><i>' + groupName + '号</i>' + (groupName !== 0 ? "" : onlineTag) + '</p>'
  110. + (remarks.length !== 0 ? '<p class="worldlimit">备注:' + remarks + '</p>' : '<p></p>')
  111. + '</li>';
  112. };
  113. /**
  114. * 根据分组Id获得设备列表
  115. * @param groupId 分组Id
  116. */
  117. var getEquipmentsByGroupId = function (groupId) {
  118. if ($("#" + groupId).children().length === 1) {
  119. sendRequest("/device/getEquipmentsByGroupId", "post", JSON.stringify({"groupId": groupId}), function (res) {
  120. if (res.result == 1) {
  121. var records = res.para;
  122. var allHtml = '<div id="all' + groupId + '" class="mui-control-content mui-active typeItem"><ul class="mui-table-view">';
  123. $.each(records, function (i, record) {
  124. allHtml += generalHtml(record, "all");
  125. });
  126. allHtml += '</ul></div>';
  127. var selector = $("#" + groupId);
  128. selector.append(allHtml);
  129. }
  130. })
  131. }
  132. };
  133. /**
  134. * 获得全部分组
  135. */
  136. var getGroups = function () {
  137. sendRequest("/device/getEquipmentNumAndAddressList", "post", {}, function (res) {
  138. if (res.result == 1) {
  139. var records = res.para.groups;
  140. var list = "";
  141. $.each(records, function (i, record) {
  142. if (record.isManager == false) {
  143. return;
  144. }
  145. var groupId = record.groupId;
  146. var active = i == 0 ? "mui-active" : "";
  147. list += '<a class="mui-text-left mui-control-item ' + active + '" groupId="' + groupId + '" href="#' + groupId + '">' + record.name + '</a>';
  148. var rightList = '<div id="' + groupId + '" class="mui-control-content ' + active + '">'
  149. + '<div class="mui-segmented-control mui-segmented-control-inverted mui-segmented-control-primary typeHeader">'
  150. + '<a class="mui-control-item mui-active" href="#all' + groupId + '">设备</a>'
  151. + '</div></div>';
  152. rightContents.append(rightList);
  153. });
  154. leftContents.html(list);
  155. if (!loadEnd) {
  156. getEquipmentsByGroupId(leftContents.children().eq(0).attr("groupId"));
  157. loadEnd = true;
  158. }
  159. }
  160. });
  161. };
  162. /**
  163. * 点击左侧列表
  164. */
  165. leftContents.on("tap", "a", function () {
  166. var _this = $(this);
  167. var groupId = _this.attr("groupId");
  168. getEquipmentsByGroupId(groupId);
  169. });
  170. var returnData = {};
  171. /**
  172. * 选择设备
  173. */
  174. rightContents.on("tap", "li", function () {
  175. var _this = $(this),
  176. online = _this.attr("online"),
  177. eValue = _this.attr("eValue");
  178. if (online != 1) {
  179. mui.toast('设备离线,无法上分。');
  180. return;
  181. }
  182. window.history.replaceState({}, "管理系统", "index.html");
  183. var url = "remote-upper.html?logicalCode=" + eValue;
  184. goPage(url);
  185. });
  186. getGroups();
  187. })
  188. </script>
  189. </body>
  190. </html>