Index.cshtml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. @{
  2. ViewBag.Title = "用户管理";
  3. Layout = "~/Views/Shared/_LayoutIndex.cshtml";
  4. }
  5. <script>
  6. "use strict"
  7. $(document).ready(function () {
  8. InitialPage();
  9. InitControl();
  10. GetTree();
  11. GetGrid();
  12. });
  13. //初始化页面
  14. function InitialPage() {
  15. //layout布局
  16. $('#layout').layout({
  17. applyDemoStyles: true,
  18. onresize: function () {
  19. $(window).resize();
  20. }
  21. });
  22. // resize重设(表格、树形)宽高
  23. $(window).resize(function (e) {
  24. window.setTimeout(function () {
  25. $("#gridTable").setGridWidth(($('.gridPanel').width()));
  26. $("#gridTable").setGridHeight($(window).height() - 160);
  27. $("#itemTree").setTreeHeight($(window).height() - 52);
  28. }, 200);
  29. e.stopPropagation();
  30. });
  31. }
  32. //加载树
  33. var PointTreeCode = 0;
  34. var ParentId = 0;
  35. function GetTree() {
  36. var item = {
  37. height: $(window).height() - 52,
  38. url: "/NBManage/NBAreas/GetTreeJson",
  39. showcheck: false,
  40. checkstatus: 0,
  41. isexpand: true,
  42. onnodeclick: function (item) {
  43. PointTreeCode = item.id;
  44. ParentId = item.parentnodes;
  45. ReloadData()
  46. //展开下级
  47. // $(".bbit-tree-selected").children('.bbit-tree-ec-icon').trigger("click");
  48. }
  49. };
  50. //初始化
  51. $("#itemTree").treeview(item);
  52. }
  53. // 初始化控件
  54. function InitControl() {
  55. $("#queryAreas .dropdown-menu li").click(function () {
  56. var text = $(this).find('a').html();
  57. var value = $(this).find('a').attr('data-value');
  58. $("#queryAreas .dropdown-text").html(text).attr('data-value', value)
  59. ReloadData()
  60. });
  61. }
  62. // 刷新数据
  63. function ReloadData() {
  64. if (PointTreeCode) {
  65. var id = PointTreeCode.split("_")[1]
  66. var level = PointTreeCode.split("_")[0]
  67. //var searchType = $("#queryAreas").find('.dropdown-text').attr('data-value') || 'Area'
  68. var searchType = "Meter"
  69. $("#gridTable").jqGrid('setGridParam', {
  70. postData: { keyword: "", searchType: searchType, id: PointTreeCode.split("_")[1], level: level },
  71. page: 1
  72. }).trigger('reloadGrid');
  73. }
  74. }
  75. //加载表格
  76. function GetGrid() {
  77. var selectedRowIndex = 0;
  78. var $gridTable = $('#gridTable');
  79. $gridTable.jqGrid({
  80. url: "/NBManage/NBChangeMeterManage/GetRecordJson?commandId=1004",
  81. datatype: "json",
  82. height: $(window).height() - 108.5,
  83. autowidth: true,
  84. colModel: [
  85. { label: 'MeterID', name: 'MeterID', hidden: true },
  86. { label: 'IOT_Code', name: 'IOT_Code', hidden: true },
  87. { label: "区域名称", name: "AreaName", width: 100, align: "left", sortable: false },
  88. { label: "楼宇名称", name: "BldgName", width: 100, align: "left", sortable: false },
  89. { label: "单元", name: "ApmtName", width: 100, align: "left", sortable: false },
  90. { label: "门牌号", name: "RoomNo", width: 100, align: "left", sortable: false },
  91. { label: "用户编号", name: "UserNo", width: 100, align: "left", sortable: false },
  92. { label: "用户名称", name: "UserName", width: 100, align: "left", sortable: false },
  93. { label: "表类型", name: "MeterTypeName", width: 100, align: "left", sortable: false, hidden: true },
  94. { label: "表地址", name: "ElecAddress", width: 150, align: "left", sortable: false },
  95. { label: "IMEI", name: "IMEI", width: 150, align: "left", sortable: false, hidden: true },
  96. { label: "表读数", name: "NowReading", width: 100, align: "left", sortable: false },
  97. { label: "NB表类型", name: "NBDevTypeName", width: 100, align: "left", sortable: false, hidden: true },
  98. { label: "NB厂商", name: "NBDevManufacturerName", width: 100, align: "left", sortable: false, hidden: true },
  99. { label: "NB厂商ID", name: "NBDevManufacturerCodeName", width: 100, align: "left", sortable: false, hidden: true },
  100. { label: "NB型号", name: "NBTypeCodeName", width: 100, align: "left", sortable: false, hidden: true },
  101. { label: "命令ID", name: "CmdID", width: 100, align: "left", sortable: false, hidden: true },
  102. {
  103. label: "阀门状态", name: "ValveStatusNow", width: 100, align: "left", sortable: false,
  104. formatter: function (cellvalue, options, rowObject) {
  105. if (cellvalue == "1") { return "关" } else { return "开" }
  106. }
  107. },
  108. { label: "命令发送时间", name: "SendTime", width: 150, align: "left", sortable: false },
  109. {
  110. label: "命令状态", name: "CmdResult", width: 100, align: "left", sortable: false,
  111. formatter: function (cellvalue, options, rowObject) {
  112. if (cellvalue == "PENDING") { return "传达成功,命令等待中" }
  113. else if (cellvalue == "1") { return "关" }
  114. else { return "" }
  115. }
  116. }
  117. ],
  118. treeGrid: true,
  119. treeGridModel: "nested",
  120. ExpandColumn: "EnCode",
  121. viewrecords: true,
  122. rowNum: 30,
  123. rowList: [30, 50, 100],
  124. rownumbers: true,
  125. pager: "#gridPager",
  126. gridComplete: function () {
  127. $("#" + this.id).setSelection(selectedRowIndex, false);
  128. }
  129. });
  130. }
  131. </script>
  132. <div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
  133. <div class="ui-layout-west">
  134. <div class="west-Panel">
  135. <div class="panel-Title">区域信息</div>
  136. <div id="itemTree"></div>
  137. </div>
  138. </div>
  139. <div class="ui-layout-center">
  140. <div class="center-Panel">
  141. <div id="tabs">
  142. <div id="tabs-1">
  143. <div class="titlePanel">
  144. <div class="title-search">
  145. <table>
  146. </table>
  147. </div>
  148. <div class="toolbar">
  149. <div class="btn-group">
  150. <a id="lr-replace" class="btn btn-default" onclick="reload();"><i class="fa fa-refresh"></i>&nbsp;刷新</a>
  151. <a id="lr-export" class="btn btn-default" onclick="btn_point_export()"><i class="fa fa-sign-out"></i>&nbsp;导出</a>
  152. </div>
  153. </div>
  154. </div>
  155. <div class="gridPanel" id="gridpanel">
  156. <table id="gridTable"></table>
  157. <div id="gridpager"></div>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. </div>
  163. </div>