123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- @{
- ViewBag.Title = "抄表历史查询";
- Layout = "~/Views/Shared/_Index.cshtml";
- }
- <script>
- $(document).ready(function () {
- initControl();
- initialPage();
- GetGrid();
- });
- //重设(表格)宽高
- function initialPage() {
- //resize重设(表格、树形)宽高
- $(window).resize(function (e) {
- window.setTimeout(function () {
- $('#gridTable').setGridWidth(($('.gridPanel').width()));
- $("#gridTable").setGridHeight($(window).height() - 108.5);
- }, 200);
- e.stopPropagation();
- });
- }
- //加载表格
- function GetGrid() {
- var selectedRowIndex = 0;
- var $gridTable = $('#gridTable');
- $gridTable.jqGrid({
- url: "/NBManage/OpenCloseSearch/GetRecordJson",
- datatype: "json",
- height: $(window).height() - 108.5,
- autowidth: true,
- colModel: [
- { label: 'MeterID', name: 'MeterID', hidden: true },
- { label: "区域名称", name: "AreaName", width: 150, align: "left", sortable: false },
- { label: "楼宇名称", name: "BldgName", width: 100, align: "left", sortable: false },
- { label: "单元", name: "ApmtName", width: 100, align: "left", sortable: false },
- { label: "门牌号", name: "RoomNo", width: 100, align: "left", sortable: false },
- { label: "用户编号", name: "UserNo", width: 100, align: "left", sortable: false },
- { label: "用户名称", name: "UserName", width: 150, align: "left", sortable: false },
- { label: "表类型", name: "MeterTypeName", width: 150, align: "left", sortable: false },
- { label: "表地址", name: "ElecAddress", width: 150, align: "left", sortable: false },
- { label: "IMEI", name: "IMEI", width: 150, align: "left", sortable: false },
- { label: "NB表类型", name: "NBDevTypeName", width: 100, align: "left", sortable: false },
- { label: "NB厂商", name: "NBDevManufacturerName", width: 100, align: "left", sortable: false },
- { label: "NB厂商ID", name: "NBDevManufacturerCodeName", width: 100, align: "left", sortable: false },
- { label: "NB型号", name: "NBTypeCodeName", width: 100, align: "left", sortable: false },
- { label: "命令名称", name: "CommandMemo", width: 100, align: "left", sortable: false },
- { label: "执行状态", name: "CmdResult", width: 100, align: "left", sortable: false }
- ],
- treeGrid: true,
- treeGridModel: "nested",
- ExpandColumn: "EnCode",
- viewrecords: true,
- rowNum: 30,
- rowList: [30, 50, 100],
- rownumbers: true,
- pager: "#gridPager",
- gridComplete: function () {
- $("#" + this.id).setSelection(selectedRowIndex, false);
- }
- });
- //$gridTable.authorizeColModel();
- //查询条件设置
- }
- function initControl() {
- //小区
- $("#AreaId").ComboBox({
- url: "/NBManage/NBHistorySearch/GetAreaListJson",
- id: "AreaId",
- text: "AreaName",
- description: "选择小区",
- height: "170px"
- }).bind("change", function () {
- var value = $(this).attr('data-value');
- $("#BldgId").ComboBox({
- url: "/NBManage/NBHistorySearch/GetBldgListJson",
- param: { parentId: value },
- id: "BldgId",
- text: "BldgName",
- description: "选择楼宇",
- height: "170px"
- });
- });
- //楼宇
- $("#BldgId").ComboBox({
- description: "选择楼宇",
- height: "170px"
- }).bind("change", function () {
- var value = $(this).attr('data-value');
- if (value) {
- $("#ApmtId").ComboBox({
- url: "/NBManage/NBHistorySearch/GetApmtListJson",
- param: { parentId: value },
- id: "ApmtId",
- text: "ApmtName",
- description: "选择单元",
- height: "170px"
- });
- }
- });
- $("#ApmtId").ComboBox({
- description: "选择单元",
- height: "170px"
- }).bind("change", function () {
- var value = $(this).attr('data-value');
- if (value) {
- $("#RoomId").ComboBox({
- url: "/NBManage/NBHistorySearch/GetRoomListJson",
- param: { parentId: value },
- id: "RoomID",
- text: "RoomName",
- description: "选择房间",
- height: "170px"
- });
- }
- });
- $("#RoomId").ComboBox({
- description: "选择房间",
- height: "170px"
- })
- }
- function btn_Search() {
- var areaId = $("#AreaId").attr('data-value');
- var bldgId = $('#BldgId').attr('data-value');
- var apmtId = $('#ApmtId').attr('data-value');
- var roomId = $('#RoomId').attr('data-value');
- var thisDate = $('#ThisDate').val();
- var lastDate = $('#LastDate').val();
- var queryType=1;
- var queryValue="";
- var userNo = $("#txt_userno").val();
- var imei = $("#txt_imei").val();
- if(areaId==undefined){
- queryType=1;
- queryValue="";
- }else{
- if(bldgId==undefined){
- queryType=1;
- queryValue=areaId;
- }else{
- if(ApmtId==undefined){
- queryType=2;
- queryValue=bldgId;
- }else{
- if(roomId==undefined){
- queryType=3;
- queryValue=apmtId;
- }else{
- queryType=4;
- queryValue=roomId;
- }
- }
- }
- }
- console.log(areaId);
- $("#gridTable").jqGrid('setGridParam', {
- postData: {
- queryType: queryType,
- queryValue:queryValue,
- userNo:userNo,
- imei: imei,
- thisDate: thisDate,
- lastDate:lastDate
- }
- }).trigger('reloadGrid');
- }
- </script>
- <div class="titlePanel">
- <div class="title-search">
- <table>
- <tr>
- <td>
- <div id="queryCondition" >
- <div id="AreaId" type="select" class="ui-select" style="float: left; width: 100px; margin-right: 1px;"></div>
- <div id="BldgId" type="select" class="ui-select" style="float: left; width: 100px; margin-right: 1px;"></div>
- <div id="ApmtId" type="select" class="ui-select" style="float: left; width: 100px; margin-right: 1px;"></div>
- <div id="RoomId" type="select" class="ui-select" style="float: left; width: 100px; margin-right: 1px;"></div>
- </div>
- </td>
- <td style="padding-left: 2px;">
- <input id="txt_userno" type="text" class="form-control" placeholder="用户编号" style="width: 200px;" />
- </td>
- <td style="padding-left: 2px;">
- <input id="txt_imei" type="text" class="form-control" placeholder="IMEI" style="width: 200px;" />
- </td>
- <td style="padding-left: 5px;">
- <a id="btn_Search" class="btn btn-primary" onclick="btn_Search()"><i class="fa fa-search"></i> 查询</a>
- </td>
- </tr>
- </table>
- </div>
- <div class="toolbar">
- <div class="btn-group">
- <a id="lr-edit" class="btn btn-default" onclick="btn_export()"><i class="fa fa-file-excel-o"></i> 导出</a>
- </div>
- </div>
- </div>
- <div class="gridPanel">
- <table id="gridTable"></table>
- <div id="gridPager"></div>
- </div>
|