123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- @{
- ViewBag.Title = "抄表历史查询";
- Layout = "~/Views/Shared/_Index.cshtml";
- }
- <script>
- $(document).ready(function () {
- initControl();
- initialPage();
- GetGrid();
- //表格表头居中显示
- $(".ui-th-column").css("text-align", "center");
- });
- //重设(表格)宽高
- 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/NBHistorySearch/GetRecordJson",
- datatype: "json",
- height: $(window).height() - 148.5,
- autowidth: true,
- postData:{thisDate:"@LeaRun.Util.Time.GetDate(0)",lastDate:"@LeaRun.Util.Time.GetDate(1)"},
- colModel: [
- { label: '主键', name: 'OrganizeId', hidden: true },
- { label: "区域名称", name: "area", width: 200, align: "left", sortable: false ,fixed:true},
- { label: "用户编号", name: "UserNo", width: 150, align: "left", sortable: false, hidden: true, fixed: true },
- { label: "用户名称", name: "UserName", width: 150, align: "left", sortable: false, hidden: true, fixed: true },
- { label: "门牌号", name: "HouseNo", width: 100, align: "left", sortable: false, hidden: true, fixed: true },
- { label: "表类型", name: "MeterType", width: 100, align: "left", sortable: false, hidden: true, fixed: true },
- { label: "表地址", name: "ElecAddress", width: 100, align: "right", sortable: false, fixed: true },
- { label: "IMIE", name: "IMEI", width: 150, align: "right", sortable: false, fixed: true },
- { label: "表状态", name: "Description", width: 200, align: "left", sortable: false, hidden: true, fixed: true },
- { label: "表读数", name: "MeterReading", width: 200, align: "left", sortable: false, hidden: true, fixed: true },
- { label: "阀门状态", name: "ValveState", width: 200, align: "left", sortable: false, hidden: true, fixed: true },
- { label: "净累计(m³)", name: "Total", width: 120, align: "right", formatter: 'number', formatoptions: { decimalPlaces: 2, defaulValue: "", thousandsSeparator: "," }, fixed: true },
- { label: "正累计(m³)", name: "TotalUp", width: 120, align: "right", formatter: 'number', formatoptions: { decimalPlaces: 2, defaulValue: "", thousandsSeparator: "," }, fixed: true },
- { label: "负累计(m³)", name: "TotalDown", width: 120, align: "right", formatter: 'number', formatoptions: { decimalPlaces: 2, defaulValue: "", thousandsSeparator: "," }, fixed: true },
- { label: "瞬时流量(L/H)", name: "Instance", width: 120, align: "right", formatter: 'number', formatoptions: { decimalPlaces: 2, defaulValue: "", thousandsSeparator: "," }, fixed: true },
- { label: "抄表时间", name: "ReadingDT", width: 165, align: "right", formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' }, fixed: true },
- { label: "电池电量(%)", name: "BatteryLevel", width: 100, align: "right", fixed: true ,hidden: true },
- { label: "信号强度", name: "Rsrp", width: 100, align: "right", sortable: false, fixed: true },
- { label: "信号覆盖等级", name: "Ecl", width: 100, align: "right", sortable: false, fixed: true, hidden: true },
- { label: "信噪比", name: "Snr", width: 100, align: "right", sortable: false, hidden: true, fixed: true },
- { label: "电池门", name: "BatteryDoor", width: 100, align: "right", sortable: false, fixed: true },
- { label: "公司代码", name: "FactoryCode", width: 100, align: "right", sortable: false, fixed: true },
- { label: "方向", name: "Direction", width: 100, align: "right", sortable: false, fixed: true },
- { label: "数据错误标识", name: "DataRight", width: 100, align: "right", sortable: false, fixed: true },
- { label: "电池电量", name: "BatteryQuantity", width: 100, align: "right", sortable: false, fixed: true },
- { label: "计量状态", name: "MeasureState", width: 100, align: "right", sortable: false, fixed: true },
- { label: "水表电子号", name: "MeterEleno", width: 100, align: "right", sortable: false, fixed: true },
- { label: "基站信息", name: "Pci", width: 100, align: "right", sortable: false, fixed: true },
- { label: "其它报警值", name: "OtherState", width: 100, align: "right", sortable: false, fixed: true },
- { label: "day1-15", name: "day1_day15", width: 200, align: "right", sortable: false, fixed: true },
- { label: "otherpart", name: "OtherPart", width: 200, align: "right", sortable: false, fixed: true },
- {
- label: "阀门状态", name: "ValveStatus", width: 100, align: "left", sortable: false,
- formatter: function (cellvalue, options, rowObject) {
- if (cellvalue == "00") { return "开" }
- if (cellvalue == "01") { return "关" }
- if (cellvalue == "11") { return "异常" }
- else { return "开" }
- }
- ,fixed:true},
- {
- label: "电池状态", name: "BatteryStatus", width: 100, align: "left", sortable: false, hidden: true,
- formatter: function (cellvalue, options, rowObject) {
- if (cellvalue == "00") { return "正常" }
- if (cellvalue == "01") { return "欠压" }
- if (cellvalue == "11") { return "严重欠压" }
- }
- , fixed: true
- },
- {
- label: "磁攻击报警", name: "Attack", width: 100, align: "left", sortable: false, hidden: true,
- formatter: function (cellvalue, options, rowObject) {
- if (cellvalue == "0") { return "无磁攻击" }
- if (cellvalue == "1") { return "正在磁攻击" }
- }
- , fixed: true
- },
- {
- label: "曾经磁攻击", name: "AttackEver", width: 100, align: "left", sortable: false, hidden: true,
- formatter: function (cellvalue, options, rowObject) {
- if (cellvalue == "0") { return "无磁攻击" }
- if (cellvalue == "1") { return "曾经磁攻击" }
- }
- , fixed: true
- },
- {
- label: "水流量超过水表Q4值", name: "Q4", width: 150, align: "left", sortable: false,
- formatter: function (cellvalue, options, rowObject) {
- if (cellvalue == "0") { return "正常" }
- if (cellvalue == "1") { return "异常" }
- }
- , fixed: true, hidden: true
- }
-
- ],
- viewrecords: true,
- rowNum: 30,
- rowList: [30, 50, 100],
- pager: "#gridPager",
- gridview: true,
- rownumbers: true,
- sortable: true,
- sortname: "ReadingDT",
- sortorder:"desc",
- gridComplete: function () {
- $("#" + this.id).setSelection(selectedRowIndex, false);
- }
- });
- //$gridTable.authorizeColModel();
- //查询条件设置
- }
- var value = "";
- function initControl() {
- //小区
- $("#AreaId").ComboBox({
- url: "/NBManage/NBHistorySearch/GetAreaListJson",
- id: "AreaId",
- text: "AreaName",
- description: "选择小区",
- height: "170px"
- }).bind("change", function () {
- value = $(this).attr('data-value');
- SetComboxInit("BldgId", "选择楼宇");
- SetComboxInit("ApmtId", "选择单元");
- SetComboxInit("RoomId", "选择房间");
- $("#BldgId").ComboBox({
- url: "/NBManage/NBHistorySearch/GetBldgListJson",
- param: { parentId: value },
- id: "BldgId",
- text: "BldgName",
- description: "选择楼宇",
- height: "170px"
- }).bind("change", function () {
- value = $(this).attr('data-value');
- SetComboxInit("ApmtId", "选择单元");
- SetComboxInit("RoomId", "选择房间");
- $("#ApmtId").ComboBox({
- url: "/NBManage/NBHistorySearch/GetApmtListJson",
- param: { parentId: value },
- id: "ApmtId",
- text: "ApmtName",
- description: "选择单元",
- height: "170px"
- }).bind("change", function () {
- value = $(this).attr('data-value');
- SetComboxInit("RoomId", "选择房间");
- $("#RoomId").ComboBox({
- url: "/NBManage/NBHistorySearch/GetRoomListJson",
- param: { parentId: value },
- id: "RoomID",
- text: "RoomName",
- description: "选择房间",
- height: "170px"
- });
- });
- })
- });
- function SetComboxInit(domId, text) {
- $("#" + domId).removeAttr('data-value');
- $("#" + domId).removeAttr('data-text');
- $("#" + domId + " .ui-select-text").text(text);
- $("#" + domId).ComboBoxTree({
- height: "170px"
- })
- }
- $("#RoomId").ComboBox({
- description: "选择房间",
- height: "170px"
- })
- $("#ApmtId").ComboBox({
- description: "选择单元",
- height: "170px"
- })
- $("#BldgId").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) {
- queryType = 1;
- queryValue = "";
- } else {
- if (!bldgId) {
- queryType = 1;
- queryValue = areaId;
- } else {
- if (!apmtId) {
- queryType = 2;
- queryValue = bldgId;
- } else {
- if (!roomId) {
- queryType = 3;
- queryValue = apmtId;
- } else {
- queryType = 4;
- queryValue = roomId;
- }
- }
- }
- }
- $("#gridTable").jqGrid('setGridParam', {
- postData: {
- queryType: queryType,
- queryValue: queryValue,
- userNo: userNo,
- imei: imei,
- thisDate: thisDate,
- lastDate: lastDate,
- searchFlag: 1
- }
- }).trigger('reloadGrid');
- }
- //导出
- function btn_export() {
- var datavalue = $("#gridTable").jqGrid('getRowData'); //获取全部数据
- dialogOpen({
- id: "ExcelIExportDialog",
- title: '导出',
- url: '/Utility/ExcelExportForm?gridId=gridTable&filename=历史记录',
- width: "500px",
- height: "380px",
- callBack: function (iframeId) {
- top.frames[iframeId].AcceptClick();
- }, btn: ['导出Excel', '关闭']
- });
- }
- </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; min-width: 150px; margin-right: 1px;"></div>
- <div id="BldgId" type="select" class="ui-select" style="float: left; min-width: 100px; margin-right: 1px;"></div>
- <div id="ApmtId" type="select" class="ui-select" style="float: left; min-width: 100px; margin-right: 1px;"></div>
- <div id="RoomId" type="select" class="ui-select" style="float: left; min-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>开始日期</td>
- <td>
- <input id="ThisDate" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" value="@LeaRun.Util.Time.GetDate(-7)" />
- </td>
- <td>结束日期</td>
- <td>
- <input id="LastDate" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" value="@LeaRun.Util.Time.GetDate(1)" />
- </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-replace" class="btn btn-default" onclick="reload();"><i class="fa fa-refresh"></i> 刷新</a>
- <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>
|