123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- @{
- ViewBag.Title = "用户管理";
- Layout = "~/Views/Shared/_LayoutIndex.cshtml";
- }
- <script>
- "use strict"
- $(document).ready(function () {
- InitialPage();
- InitControl();
- GetTree();
- GetGrid();
- });
- //初始化页面
- function InitialPage() {
- //layout布局
- $('#layout').layout({
- applyDemoStyles: true,
- onresize: function () {
- $(window).resize();
- }
- });
- // resize重设(表格、树形)宽高
- $(window).resize(function (e) {
- window.setTimeout(function () {
- $("#gridTable").setGridWidth(($('.gridPanel').width()));
- $("#gridTable").setGridHeight($(window).height() - 160);
- $("#itemTree").setTreeHeight($(window).height() - 52);
- }, 200);
- e.stopPropagation();
- });
- }
- //加载树
- var PointTreeCode = 0;
- var ParentId = 0;
- function GetTree() {
- var item = {
- height: $(window).height() - 52,
- url: "/NBManage/NBAreas/GetTreeJson",
- showcheck: false,
- checkstatus: 0,
- isexpand: true,
- onnodeclick: function (item) {
- PointTreeCode = item.id;
- ParentId = item.parentnodes;
- ReloadData()
- //展开下级
- // $(".bbit-tree-selected").children('.bbit-tree-ec-icon').trigger("click");
- }
- };
- //初始化
- $("#itemTree").treeview(item);
- }
- // 初始化控件
- function InitControl() {
- $("#queryAreas .dropdown-menu li").click(function () {
- var text = $(this).find('a').html();
- var value = $(this).find('a').attr('data-value');
- $("#queryAreas .dropdown-text").html(text).attr('data-value', value)
- ReloadData()
- });
- }
- // 刷新数据
- function ReloadData() {
- if (PointTreeCode) {
- var id = PointTreeCode.split("_")[1]
- var level = PointTreeCode.split("_")[0]
- //var searchType = $("#queryAreas").find('.dropdown-text').attr('data-value') || 'Area'
- var searchType = "Meter"
- $("#gridTable").jqGrid('setGridParam', {
- postData: { keyword: "", searchType: searchType, id: PointTreeCode.split("_")[1], level: level },
- page: 1
- }).trigger('reloadGrid');
- }
- }
- //加载表格
- function GetGrid() {
- var selectedRowIndex = 0;
- var $gridTable = $('#gridTable');
- $gridTable.jqGrid({
- url: "/NBManage/NBChangeMeterManage/GetRecordJson?commandId=1004",
- datatype: "json",
- height: $(window).height() - 108.5,
- autowidth: true,
- colModel: [
- { label: 'MeterID', name: 'MeterID', hidden: true },
- { label: 'IOT_Code', name: 'IOT_Code', hidden: true },
- { label: "区域名称", name: "AreaName", width: 100, 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: 100, align: "left", sortable: false },
- { label: "表类型", name: "MeterTypeName", width: 100, align: "left", sortable: false, hidden: true },
- { label: "表地址", name: "ElecAddress", width: 150, align: "left", sortable: false },
- { label: "IMEI", name: "IMEI", width: 150, align: "left", sortable: false, hidden: true },
- { label: "表读数", name: "NowReading", width: 100, align: "left", sortable: false },
- { label: "NB表类型", name: "NBDevTypeName", width: 100, align: "left", sortable: false, hidden: true },
- { label: "NB厂商", name: "NBDevManufacturerName", width: 100, align: "left", sortable: false, hidden: true },
- { label: "NB厂商ID", name: "NBDevManufacturerCodeName", width: 100, align: "left", sortable: false, hidden: true },
- { label: "NB型号", name: "NBTypeCodeName", width: 100, align: "left", sortable: false, hidden: true },
- { label: "命令ID", name: "CmdID", width: 100, align: "left", sortable: false, hidden: true },
- {
- label: "阀门状态", name: "ValveStatusNow", width: 100, align: "left", sortable: false,
- formatter: function (cellvalue, options, rowObject) {
- if (cellvalue == "1") { return "关" } else { return "开" }
- }
- },
- { label: "命令发送时间", name: "SendTime", width: 150, align: "left", sortable: false },
- {
- label: "命令状态", name: "CmdResult", width: 100, align: "left", sortable: false,
- formatter: function (cellvalue, options, rowObject) {
- if (cellvalue == "PENDING") { return "传达成功,命令等待中" }
- else if (cellvalue == "1") { return "关" }
- else { return "" }
- }
- }
- ],
- 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);
- }
- });
- }
- </script>
- <div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
- <div class="ui-layout-west">
- <div class="west-Panel">
- <div class="panel-Title">区域信息</div>
- <div id="itemTree"></div>
- </div>
- </div>
- <div class="ui-layout-center">
- <div class="center-Panel">
- <div id="tabs">
- <div id="tabs-1">
- <div class="titlePanel">
- <div class="title-search">
- <table>
- </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-export" class="btn btn-default" onclick="btn_point_export()"><i class="fa fa-sign-out"></i> 导出</a>
- </div>
- </div>
- </div>
- <div class="gridPanel" id="gridpanel">
- <table id="gridTable"></table>
- <div id="gridpager"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
|