Platform.cshtml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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. var value = "";
  23. function initControl() {
  24. //小区
  25. $("#AreaId").ComboBox({
  26. url: "/NBManage/NBHistorySearch/GetAreaListJson",
  27. id: "AreaId",
  28. text: "AreaName",
  29. description: "选择小区",
  30. height: "170px"
  31. }).bind("change", function () {
  32. value = $(this).attr('data-value');
  33. SetComboxInit("BldgId", "选择楼宇");
  34. SetComboxInit("ApmtId", "选择单元");
  35. SetComboxInit("RoomId", "选择房间");
  36. $("#BldgId").ComboBox({
  37. url: "/NBManage/NBHistorySearch/GetBldgListJson",
  38. param: { parentId: value },
  39. id: "BldgId",
  40. text: "BldgName",
  41. description: "选择楼宇",
  42. height: "170px"
  43. }).bind("change", function () {
  44. value = $(this).attr('data-value');
  45. SetComboxInit("ApmtId", "选择单元");
  46. SetComboxInit("RoomId", "选择房间");
  47. $("#ApmtId").ComboBox({
  48. url: "/NBManage/NBHistorySearch/GetApmtListJson",
  49. param: { parentId: value },
  50. id: "ApmtId",
  51. text: "ApmtName",
  52. description: "选择单元",
  53. height: "170px"
  54. }).bind("change", function () {
  55. value = $(this).attr('data-value');
  56. SetComboxInit("RoomId", "选择房间");
  57. $("#RoomId").ComboBox({
  58. url: "/NBManage/NBHistorySearch/GetRoomListJson",
  59. param: { parentId: value },
  60. id: "RoomID",
  61. text: "RoomName",
  62. description: "选择房间",
  63. height: "170px"
  64. });
  65. });
  66. })
  67. });
  68. function SetComboxInit(domId, text) {
  69. $("#" + domId).removeAttr('data-value');
  70. $("#" + domId).removeAttr('data-text');
  71. $("#" + domId + " .ui-select-text").text(text);
  72. $("#" + domId).ComboBoxTree({
  73. height: "170px"
  74. })
  75. }
  76. $("#RoomId").ComboBox({
  77. description: "选择房间",
  78. height: "170px"
  79. })
  80. $("#ApmtId").ComboBox({
  81. description: "选择单元",
  82. height: "170px"
  83. })
  84. $("#BldgId").ComboBox({
  85. description: "选择楼宇",
  86. height: "170px"
  87. })
  88. }
  89. //加载表格
  90. function GetGrid() {
  91. var selectedRowIndex = 0;
  92. var $gridTable = $('#gridTable');
  93. $gridTable.jqGrid({
  94. url: "/NBManage/NBHistorySearch/GetPlatformRecord",
  95. datatype: "json",
  96. height: $(window).height() - 138.8,
  97. autowidth: true,
  98. colModel: [
  99. { label: '表地址', name: 'addr', width: 150, align: "left", sortable: false },
  100. { label: "净累计(m³)", name: "total", width: 100, align: "left", sortable: false },
  101. { label: "正累计(m³)", name: "total_up", width: 100, align: "left", sortable: false },
  102. { label: "负累计(m³)", name: "total_down", width: 100, align: "left", sortable: false },
  103. {
  104. label: "瞬时流量(L/H)", name: "instance", width: 100, align: "left", sortable: false,
  105. formatter: function (cellvalue, options, rowObject) {
  106. return cellvalue
  107. }
  108. },
  109. {
  110. label: "阀门状态", name: "fa_status", width: 100, align: "left", sortable: false,
  111. formatter: function (cellvalue, options, rowObject) {
  112. if (cellvalue == "00") { return "开" }
  113. if (cellvalue == "01") { return "关" }
  114. if (cellvalue == "11") { return "异常" }
  115. }
  116. },
  117. {
  118. label: "电池状态", name: "battery_status", width: 100, align: "left", sortable: false, hidden: true,
  119. formatter: function (cellvalue, options, rowObject) {
  120. if (cellvalue == "00") { return "正常" }
  121. if (cellvalue == "01") { return "欠压" }
  122. if (cellvalue == "11") { return "严重欠压" }
  123. }
  124. },
  125. {
  126. label: "磁攻击报警", name: "attack", width: 100, align: "left", sortable: false, hidden: true,
  127. formatter: function (cellvalue, options, rowObject) {
  128. if (cellvalue == "0") { return "无磁攻击" }
  129. if (cellvalue == "1") { return "正在磁攻击" }
  130. }
  131. },
  132. {
  133. label: "曾经磁攻击", name: "attack_ever", width: 100, align: "left", sortable: false, hidden: true,
  134. formatter: function (cellvalue, options, rowObject) {
  135. if (cellvalue == "0") { return "无磁攻击" }
  136. if (cellvalue == "1") { return "曾经磁攻击" }
  137. }
  138. },
  139. {
  140. label: "水流量超过水表Q4值", name: "q4", width: 150, align: "left", sortable: false,
  141. formatter: function (cellvalue, options, rowObject) {
  142. if (cellvalue == "0") { return "正常" }
  143. if (cellvalue == "1") { return "异常" }
  144. }
  145. },
  146. { label: "电池电量(%)", name: "batteryLevel", width: 100, align: "left", sortable: false },
  147. { label: "信号强度", name: "rsrp", width: 100, align: "left", sortable: false },
  148. { label: "信号覆盖等级", name: "ecl", width: 100, align: "left", sortable: false },
  149. { label: "信噪比", name: "snr", width: 100, align: "left", sortable: false },
  150. {
  151. label: "抄表时间", name: "read_time", width:180, align: "left", sortable: false,
  152. formatter: function (cellvalue, options, rowObject) {
  153. return formatDate(cellvalue, 'yyyy-MM-dd hh:mm:ss');
  154. }
  155. },
  156. {
  157. label: "上报时间", name: "time", width: 180, align: "left", sortable: false,
  158. formatter: function (cellvalue, options, rowObject) {
  159. return formatDate(cellvalue, 'yyyy-MM-dd hh:mm:ss');
  160. }
  161. }
  162. ],
  163. treeGrid: true,
  164. treeGridModel: "nested",
  165. ExpandColumn: "EnCode",
  166. viewrecords: true,
  167. rowNum: 30,
  168. rowList: [30, 50, 100],
  169. rownumbers: true,
  170. pager: "#gridPager",
  171. gridComplete: function () {
  172. $("#" + this.id).setSelection(selectedRowIndex, false);
  173. }
  174. });
  175. }
  176. function btn_Search() {
  177. var areaId = $("#AreaId").attr('data-value');
  178. var bldgId = $('#BldgId').attr('data-value');
  179. var apmtId = $('#ApmtId').attr('data-value');
  180. var roomId = $('#RoomId').attr('data-value');
  181. if (!areaId) {
  182. queryType = 1;
  183. queryValue = "";
  184. } else {
  185. if (!bldgId) {
  186. queryType = 1;
  187. queryValue = areaId;
  188. } else {
  189. if (!apmtId) {
  190. queryType = 2;
  191. queryValue = bldgId;
  192. } else {
  193. if (!roomId) {
  194. queryType = 3;
  195. queryValue = apmtId;
  196. } else {
  197. queryType = 4;
  198. queryValue = roomId;
  199. }
  200. }
  201. }
  202. }
  203. var thisDate = $('#ThisDate').val();
  204. var lastDate = $('#LastDate').val();
  205. $("#gridTable").jqGrid('setGridParam', {
  206. postData: {
  207. queryType: queryType,
  208. queryValue: queryValue,
  209. thisDate: thisDate,
  210. lastDate: lastDate,
  211. isButton: 1
  212. }
  213. }).trigger('reloadGrid');
  214. }
  215. //导出
  216. function btn_export() {
  217. var datavalue = $("#gridTable").jqGrid('getRowData'); //获取全部数据
  218. dialogOpen({
  219. id: "ExcelIExportDialog",
  220. title: '导出',
  221. url: '/Utility/ExcelExportForm?gridId=gridTable&filename=历史记录',
  222. width: "500px",
  223. height: "380px",
  224. callBack: function (iframeId) {
  225. top.frames[iframeId].AcceptClick();
  226. }, btn: ['导出Excel', '关闭']
  227. });
  228. }
  229. </script>
  230. <div class="titlePanel">
  231. <div class="title-search">
  232. <table>
  233. <tr>
  234. <td>
  235. <div id="queryCondition">
  236. <div id="AreaId" type="select" class="ui-select" style="float: left; min-width: 100px; margin-right: 1px;"></div>
  237. <div id="BldgId" type="select" class="ui-select" style="float: left; min-width: 100px; margin-right: 1px;"></div>
  238. <div id="ApmtId" type="select" class="ui-select" style="float: left; min-width: 100px; margin-right: 1px;"></div>
  239. <div id="RoomId" type="select" class="ui-select" style="float: left; min-width: 100px; margin-right: 1px;"></div>
  240. </div>
  241. </td>
  242. <td>开始日期</td>
  243. <td>
  244. <input id="ThisDate" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" />
  245. </td>
  246. <td>结束日期</td>
  247. <td>
  248. <input id="LastDate" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" />
  249. </td>
  250. <td style="padding-left: 5px;">
  251. <a id="btn_Search" class="btn btn-primary" onclick="btn_Search()"><i class="fa fa-search"></i>&nbsp;查询</a>
  252. </td>
  253. </tr>
  254. </table>
  255. </div>
  256. <div class="toolbar">
  257. <div class="btn-group">
  258. <a id="lr-edit" class="btn btn-default" onclick="btn_export()"><i class="fa fa-file-excel-o"></i>&nbsp;导出</a>
  259. <a id="lr-replace" class="btn btn-default" onclick="reload();"><i class="fa fa-refresh"></i>&nbsp;刷新</a>
  260. </div>
  261. </div>
  262. </div>
  263. <div class="gridPanel">
  264. <table id="gridTable"></table>
  265. <div id="gridPager"></div>
  266. </div>