123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- @{
- 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/NBChangeMeterManage/GetRecordJson",
- datatype: "json",
- postData: { commandId: "1015" },
- height: $(window).height() - 138.5,
- autowidth: true,
- colModel: [
- { label: 'MeterID', name: 'MeterID', hidden: true, fixed: true },
- { label: 'IOT_Code', name: 'IOT_Code', hidden: true, fixed: true },
- { label: "区域名称", name: "AreaName", width: 150, align: "left", sortable: false, fixed: true },
- { label: "楼宇名称", name: "BldgName", width: 100, align: "left", sortable: false, fixed: true },
- { label: "单元", name: "ApmtName", width: 100, align: "left", sortable: false, fixed: true },
- { label: "门牌号", name: "RoomNo", width: 100, align: "left", sortable: false, fixed: true },
- { label: "用户编号", name: "UserNo", width: 100, align: "left", sortable: false, fixed: true },
- { label: "用户名称", name: "UserName", width: 100, align: "left", sortable: false, fixed: true },
- { label: "表类型", name: "MeterTypeName", width: 100, align: "left", sortable: false, hidden: true, fixed: true },
- { label: "表地址", name: "ElecAddress", width: 150, align: "right", sortable: false, fixed: true },
- { label: "IMEI", name: "IMEI", width: 150, align: "left", sortable: false, hidden: true, fixed: true },
- { label: "表读数", name: "NowReading", width: 100, align: "right", sortable: false, formatter: 'number', formatoptions: { decimalPlaces: 2, defaulValue: "", thousandsSeparator: "," }, fixed: true },
- { label: "NB表类型", name: "NBDevTypeName", width: 100, align: "left", sortable: false, hidden: true, fixed: true },
- { label: "NB厂商", name: "NBDevManufacturerName", width: 100, align: "left", sortable: false, hidden: true, fixed: true },
- { label: "NB厂商ID", name: "NBDevManufacturerCodeName", width: 100, align: "left", sortable: false, hidden: true, fixed: true },
- { label: "NB型号", name: "NBTypeCodeName", width: 100, align: "left", sortable: false, hidden: true, fixed: true },
- { label: "命令ID", name: "CmdID", width: 100, align: "left", sortable: false, hidden: true, fixed: true },
- {
- label: "阀门状态", name: "ValveStatus", width: 100, align: "left", sortable: false,
- formatter: function (cellvalue, options, rowObject) {
- if (cellvalue == "1") { return "关" } else if (cellvalue == "0") { return "开" } else { return "异常" }
- }
- , fixed: true
- },
- { label: "命令发送时间", name: "SendTime", width: 165, align: "right", sortable: false, fixed: true },
- {
- label: "命令状态", name: "CmdResult", width: 100, align: "left", sortable: false,
- formatter: function (cellvalue, options, rowObject) {
- if (cellvalue == "PENDING") { return "传达成功,命令等待中" }
- else if (cellvalue == "DELIVERED") { return "命令已送达,等待执行" }
- else if (cellvalue == "SUCCESSFUL") { return "执行成功" }
- else if (cellvalue == "FAILED") { return "命令失败" }
- else if (cellvalue == "TIMEOUT") { return "命令超时" }
- else if (cellvalue == "CANCELED") { return "命令被取消" }
- else { return "" }
- }
- , fixed: true
- }
- ],
- viewrecords: true,
- rowNum: 30,
- rowList: [30, 50, 100],
- pager: "#gridPager",
- rownumbers: true,
- shrinkToFit: false,
- gridview: true,
- gridComplete: function () {
- $("#" + this.id).setSelection(selectedRowIndex, false);
- }
- });
- }
- function OpenClose() {
- var addr = $("#gridTable").jqGridRowValue("ElecAddress");
- var id = $("#gridTable").jqGridRowValue("MeterID");
- var IOT_Code = $("#gridTable").jqGridRowValue("IOT_Code");
- if (checkedRow(addr)) {
- dialogOpen({
- id: "Form",
- title: '修改上报间隔',
- url: '/NBManage/ReSetUpInterval/ResetReportNumForm?addr=' + addr + '&id=' + id + '&IOT_Code=' + IOT_Code,
- width: "750px",
- height: "460px",
- callBack: function (iframeId) {
- top.frames[iframeId].AcceptClick();
- setInterval("reload()", 5000);
- }
- });
- }
- }
- function historyCmd() {
- var id = $("#gridTable").jqGridRowValue("MeterID");
- if (checkedRow(id)) {
- dialogOpen({
- id: "Form",
- title: '历史命令',
- url: '/NBManage/NBCommandHis/index?id=' + id + '&cmdType=1015',
- width: "1400px",
- height: "760px",
- callBack: function (iframeId) {
- top.frames[iframeId].AcceptClick();
- setInterval("reload()", 30000);
- }
- });
- }
- }
- 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 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
- }
- }).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: 150px; 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-replace" class="btn btn-default" onclick="OpenClose();"><i class="fa fa-refresh"></i> 设置</a>
- <a id="lr-replace" class="btn btn-default" onclick="historyCmd();"><i class="fa fa-history"></i> 历史命令</a>
- <a id="lr-replace" class="btn btn-default" onclick="reload();"><i class="fa fa-refresh"></i> 刷新</a>
- </div>
- </div>
- </div>
- <div class="gridPanel">
- <table id="gridTable"></table>
- <div id="gridPager"></div>
- </div>
|