Index.cshtml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. @{
  2. ViewBag.Title = "抄表历史查询";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script>
  6. $(document).ready(function () {
  7. initControl();
  8. initialPage();
  9. GetGrid();
  10. });
  11. //重设(表格)宽高
  12. function initialPage() {
  13. //resize重设(表格、树形)宽高
  14. $(window).resize(function (e) {
  15. window.setTimeout(function () {
  16. $('#gridTable').setGridWidth(($('.gridPanel').width()));
  17. $("#gridTable").setGridHeight($(window).height() - 108.5);
  18. }, 200);
  19. e.stopPropagation();
  20. });
  21. }
  22. //加载表格
  23. function GetGrid() {
  24. var selectedRowIndex = 0;
  25. var $gridTable = $('#gridTable');
  26. $gridTable.jqGrid({
  27. url: "/NBManage/OpenCloseSearch/GetRecordJson",
  28. datatype: "json",
  29. height: $(window).height() - 108.5,
  30. autowidth: true,
  31. colModel: [
  32. { label: 'MeterID', name: 'MeterID', hidden: true },
  33. { label: "区域名称", name: "AreaName", width: 150, align: "left", sortable: false },
  34. { label: "楼宇名称", name: "BldgName", width: 100, align: "left", sortable: false },
  35. { label: "单元", name: "ApmtName", width: 100, align: "left", sortable: false },
  36. { label: "门牌号", name: "RoomNo", width: 100, align: "left", sortable: false },
  37. { label: "用户编号", name: "UserNo", width: 100, align: "left", sortable: false },
  38. { label: "用户名称", name: "UserName", width: 150, align: "left", sortable: false },
  39. { label: "表类型", name: "MeterTypeName", width: 150, align: "left", sortable: false },
  40. { label: "表地址", name: "ElecAddress", width: 150, align: "left", sortable: false },
  41. { label: "IMEI", name: "IMEI", width: 150, align: "left", sortable: false },
  42. { label: "NB表类型", name: "NBDevTypeName", width: 100, align: "left", sortable: false },
  43. { label: "NB厂商", name: "NBDevManufacturerName", width: 100, align: "left", sortable: false },
  44. { label: "NB厂商ID", name: "NBDevManufacturerCodeName", width: 100, align: "left", sortable: false },
  45. { label: "NB型号", name: "NBTypeCodeName", width: 100, align: "left", sortable: false },
  46. { label: "命令名称", name: "CommandMemo", width: 100, align: "left", sortable: false },
  47. { label: "执行状态", name: "CmdResult", width: 100, align: "left", sortable: false }
  48. ],
  49. treeGrid: true,
  50. treeGridModel: "nested",
  51. ExpandColumn: "EnCode",
  52. viewrecords: true,
  53. rowNum: 30,
  54. rowList: [30, 50, 100],
  55. rownumbers: true,
  56. pager: "#gridPager",
  57. gridComplete: function () {
  58. $("#" + this.id).setSelection(selectedRowIndex, false);
  59. }
  60. });
  61. //$gridTable.authorizeColModel();
  62. //查询条件设置
  63. }
  64. function initControl() {
  65. //小区
  66. $("#AreaId").ComboBox({
  67. url: "/NBManage/NBHistorySearch/GetAreaListJson",
  68. id: "AreaId",
  69. text: "AreaName",
  70. description: "选择小区",
  71. height: "170px"
  72. }).bind("change", function () {
  73. var value = $(this).attr('data-value');
  74. $("#BldgId").ComboBox({
  75. url: "/NBManage/NBHistorySearch/GetBldgListJson",
  76. param: { parentId: value },
  77. id: "BldgId",
  78. text: "BldgName",
  79. description: "选择楼宇",
  80. height: "170px"
  81. });
  82. });
  83. //楼宇
  84. $("#BldgId").ComboBox({
  85. description: "选择楼宇",
  86. height: "170px"
  87. }).bind("change", function () {
  88. var value = $(this).attr('data-value');
  89. if (value) {
  90. $("#ApmtId").ComboBox({
  91. url: "/NBManage/NBHistorySearch/GetApmtListJson",
  92. param: { parentId: value },
  93. id: "ApmtId",
  94. text: "ApmtName",
  95. description: "选择单元",
  96. height: "170px"
  97. });
  98. }
  99. });
  100. $("#ApmtId").ComboBox({
  101. description: "选择单元",
  102. height: "170px"
  103. }).bind("change", function () {
  104. var value = $(this).attr('data-value');
  105. if (value) {
  106. $("#RoomId").ComboBox({
  107. url: "/NBManage/NBHistorySearch/GetRoomListJson",
  108. param: { parentId: value },
  109. id: "RoomID",
  110. text: "RoomName",
  111. description: "选择房间",
  112. height: "170px"
  113. });
  114. }
  115. });
  116. $("#RoomId").ComboBox({
  117. description: "选择房间",
  118. height: "170px"
  119. })
  120. }
  121. function btn_Search() {
  122. var areaId = $("#AreaId").attr('data-value');
  123. var bldgId = $('#BldgId').attr('data-value');
  124. var apmtId = $('#ApmtId').attr('data-value');
  125. var roomId = $('#RoomId').attr('data-value');
  126. var thisDate = $('#ThisDate').val();
  127. var lastDate = $('#LastDate').val();
  128. var queryType=1;
  129. var queryValue="";
  130. var userNo = $("#txt_userno").val();
  131. var imei = $("#txt_imei").val();
  132. if(areaId==undefined){
  133. queryType=1;
  134. queryValue="";
  135. }else{
  136. if(bldgId==undefined){
  137. queryType=1;
  138. queryValue=areaId;
  139. }else{
  140. if(ApmtId==undefined){
  141. queryType=2;
  142. queryValue=bldgId;
  143. }else{
  144. if(roomId==undefined){
  145. queryType=3;
  146. queryValue=apmtId;
  147. }else{
  148. queryType=4;
  149. queryValue=roomId;
  150. }
  151. }
  152. }
  153. }
  154. console.log(areaId);
  155. $("#gridTable").jqGrid('setGridParam', {
  156. postData: {
  157. queryType: queryType,
  158. queryValue:queryValue,
  159. userNo:userNo,
  160. imei: imei,
  161. thisDate: thisDate,
  162. lastDate:lastDate
  163. }
  164. }).trigger('reloadGrid');
  165. }
  166. </script>
  167. <div class="titlePanel">
  168. <div class="title-search">
  169. <table>
  170. <tr>
  171. <td>
  172. <div id="queryCondition" >
  173. <div id="AreaId" type="select" class="ui-select" style="float: left; width: 100px; margin-right: 1px;"></div>
  174. <div id="BldgId" type="select" class="ui-select" style="float: left; width: 100px; margin-right: 1px;"></div>
  175. <div id="ApmtId" type="select" class="ui-select" style="float: left; width: 100px; margin-right: 1px;"></div>
  176. <div id="RoomId" type="select" class="ui-select" style="float: left; width: 100px; margin-right: 1px;"></div>
  177. </div>
  178. </td>
  179. <td style="padding-left: 2px;">
  180. <input id="txt_userno" type="text" class="form-control" placeholder="用户编号" style="width: 200px;" />
  181. </td>
  182. <td style="padding-left: 2px;">
  183. <input id="txt_imei" type="text" class="form-control" placeholder="IMEI" style="width: 200px;" />
  184. </td>
  185. <td style="padding-left: 5px;">
  186. <a id="btn_Search" class="btn btn-primary" onclick="btn_Search()"><i class="fa fa-search"></i>&nbsp;查询</a>
  187. </td>
  188. </tr>
  189. </table>
  190. </div>
  191. <div class="toolbar">
  192. <div class="btn-group">
  193. <a id="lr-edit" class="btn btn-default" onclick="btn_export()"><i class="fa fa-file-excel-o"></i>&nbsp;导出</a>
  194. </div>
  195. </div>
  196. </div>
  197. <div class="gridPanel">
  198. <table id="gridTable"></table>
  199. <div id="gridPager"></div>
  200. </div>