123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- @{
- ViewBag.Title = "实时数据";
- Layout = "~/Views/Shared/_LayoutIndex.cshtml";
- }
- <script>
- var checkedIds = [];
- $(function () {
- InitialPage();
- GetTree();
- GetPointGrid();
- $("#tabs").tabs();
- //device.init();
- });
- function getSelectedTabIndex() {
- return $("#tabs").tabs('option', 'active');
- }
- //初始化页面
- function InitialPage() {
- //layout布局
- $('#layout').layout({
- applyDemoStyles: true,
- onresize: function () {
- $(window).resize();
- }
- });
- //resize重设(表格、树形)宽高
- $(window).resize(function (e) {
- window.setTimeout(function () {
- $("#itemTree").setTreeHeight($(window).height() - 52);
- $("#pointGridTable").setGridHeight($(window).height() - 72);
- }, 200);
- e.stopPropagation();
- });
- }
- //加载树
- function GetTree() {
- var item = {
- height: $(window).height() - 52,
- url: "/SecondaryWaterSupply/Device/GetDeviceTree?showcheck=true",
- oncheckboxclick: function (item, status) {
- GetAllCheckNodes(item.id, status, item.text);//维护 选中元素id的数组
- }
- };
- //初始化
- $("#itemTree").treeview(item);
- }
- //被选中元素的ID,TEXT 数组维护
- function GetAllCheckNodes(id, status, text) {
- //数据加入数组
- if (status == 1) {
- if (!checkedIds.contain(id)) {
- checkedIds.push(id);
- }
- }
- if (status == 0) {
- if (checkedIds.contain(id)) {
- checkedIds.splice(checkedIds.indexOf(id), 1);
- }
- }
- }
- //AutoComplete
- var device = {
- init: function () {
- var width = $('#device').width();
- $('#device').autocomplete({
- source: function (request, response) {
- $.ajax({
- url: "/IPm/DeviceInfo/GetDeviceBySearch",
- type: "GET",
- data: { q: $('#device').val() },
- dataType: "json",
- success: function (data) {
- response($.map(data, function (item) {
- console.log(item);
- return {
- label: item.label,
- value: "dev" + item.value
- }
- }));
- }
- });
- },
- select: function (event, ui) {
- $("#device").val(ui.item.label);
- PointTreeCode = ui.item.value;
- return false;
- }
- });
- }
- };
- function GetPointGrid() {
- var selectedRowIndex = 0;
- var $gridTable = $('#pointGridTable');
- $gridTable.jqGrid({
- url: "/SecondaryWaterSupply/Device/GetAllDeviceRealTimeData",
- datatype: "json",
- width: $('.gridPanel').width(),
- height:$(window).height() - 72,
- autowidth: true,
- rownumbers: true,
- colModel: [
- { label: '设备ID', name: 'SecondaryWaterSupplyId', hidden: true, frozen: true },
- { label: '泵房名称', name: 'PumpHouseName', width: 100, frozen: true, align: 'center' },
- {
- label: '厂商编码', name: 'ManufacturerCode', width: 280, align: 'center', frozen: true,
- formatter: function (cellvalue, options, rowObject) {
- return cellvalue.trim();
- }
- },
- {
- label: '泵站编码', name: 'PumpingStationNumber', width: 100, align: 'center', frozen: true,
- formatter: function (cellvalue, options, rowObject) {
- return cellvalue.trim();
- }
- },
- {
- label: '采集时间', name: 'GetDateTime', width: 100, align: 'center', frozen: true,
- formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i', newformat: 'Y-m-d H:i' }
- },
- { label: '净累计流量', name: 'NetCumulativeFlow', width: 100, frozen: true, align: 'center' },
- { label: '进水压力', name: 'InletPressure', width: 80, frozen: true, align: 'center' },
- { label: '出水压力', name: 'OutletPressure', width: 80, frozen: true, align: 'center' },
- { label: '瞬时流量', name: 'InstantaneousFlow', width: 80, frozen: true, align: 'center' },
- { label: '余氯', name: 'ResidualChlorine', width: 80, frozen: true, align: 'center' },
- { label: '浊度', name: 'Turbidity', width: 80, frozen: true, align: 'center' },
- { label: '温度', name: 'Temperature', align: 'center', frozen: true, width: 80 },
- { label: '工频/变频', name: 'PressureUpAlarm', width: 80, frozen: true, align: 'center' },
- { label: 'A相电压', name: 'VoltageA_1', width: 80, align: 'center' },
- { label: 'B相电压', name: 'VoltageB_1', width: 80, align: 'center' },
- { label: 'C相电压', name: 'VoltageC_1', width: 80, align: 'center' },
- { label: 'A相电流', name: 'CurrentA_1', width: 80, align: 'center' },
- { label: 'B相电流', name: 'CurrentB_1', width: 80, align: 'center' },
- { label: 'C相电流', name: 'CurrentC_1', width: 80, align: 'center' },
- { label: '有功电能', name: 'ActiveElectricalEnergy_1', width: 80, align: 'center' },
- { label: '频率', name: 'Frequency_1', width: 80, align: 'center' },
- { label: '运行状态', name: 'RunningState_1', width: 80, align: 'center' },
- { label: 'A相电压', name: 'VoltageA_2', width: 80, align: 'center' },
- { label: 'B相电压', name: 'VoltageB_2', width: 80, align: 'center' },
- { label: 'C相电压', name: 'VoltageC_2', width: 80, align: 'center' },
- { label: 'A相电流', name: 'CurrentA_2', width: 80, align: 'center' },
- { label: 'B相电流', name: 'CurrentB_2', width: 80, align: 'center' },
- { label: 'C相电流', name: 'CurrentC_2', width: 80, align: 'center' },
- { label: '有功电能', name: 'ActiveElectricalEnergy_2', width: 80, align: 'center' },
- { label: '频率', name: 'Frequency_2', width: 80, align: 'center' },
- { label: '运行状态', name: 'RunningState_2', width: 80, align: 'center' },
- { label: 'A相电压', name: 'VoltageA_3', width: 80, align: 'center' },
- { label: 'B相电压', name: 'VoltageB_3', width: 80, align: 'center' },
- { label: 'C相电压', name: 'VoltageC_3', width: 80, align: 'center' },
- { label: 'A相电流', name: 'CurrentA_3', width: 80, align: 'center' },
- { label: 'B相电流', name: 'CurrentB_3', width: 80, align: 'center' },
- { label: 'C相电流', name: 'CurrentC_3', width: 80, align: 'center' },
- { label: '有功电能', name: 'ActiveElectricalEnergy_3', width: 80, align: 'center' },
- { label: '频率', name: 'Frequency_3', width: 80, align: 'center' },
- { label: '运行状态', name: 'RunningState_3', width: 80, align: 'center' },
- { label: 'A相电压', name: 'VoltageA_4', width: 80, align: 'center' },
- { label: 'B相电压', name: 'VoltageB_4', width: 80, align: 'center' },
- { label: 'C相电压', name: 'VoltageC_4', width: 80, align: 'center' },
- { label: 'A相电流', name: 'CurrentA_4', width: 80, align: 'center' },
- { label: 'B相电流', name: 'CurrentB_4', width: 80, align: 'center' },
- { label: 'C相电流', name: 'CurrentC_4', width: 80, align: 'center' },
- { label: '有功电能', name: 'ActiveElectricalEnergy_4', width: 80, align: 'center' },
- { label: '频率', name: 'Frequency_4', width: 80, align: 'center' },
- { label: '运行状态', name: 'RunningState_4', width: 80, align: 'center' },
- { label: 'A相电压', name: 'VoltageA_5', width: 80, align: 'center' },
- { label: 'B相电压', name: 'VoltageB_5', width: 80, align: 'center' },
- { label: 'C相电压', name: 'VoltageC_5', width: 80, align: 'center' },
- { label: 'A相电流', name: 'CurrentA_5', width: 80, align: 'center' },
- { label: 'B相电流', name: 'CurrentB_5', width: 80, align: 'center' },
- { label: 'C相电流', name: 'CurrentC_5', width: 80, align: 'center' },
- { label: '有功电能', name: 'ActiveElectricalEnergy_5', width: 80, align: 'center' },
- { label: '频率', name: 'Frequency_5', width: 80, align: 'center' },
- { label: '运行状态', name: 'RunningState_5', width: 80, align: 'center' }
- ],
- viewrecords: true,
- rowNum: 30,
- rowList: [30, 50, 100],
- pager: "#gridPager",
- gridview: true,
- onSelectRow: function () {
- selectedRowIndex = $("#" + this.id).getGridParam('selrow');
- },
- gridComplete: function () {
- $("#" + this.id).setSelection(selectedRowIndex, false);
- }
- });
- $gridTable.jqGrid('setGroupHeaders', {
- useColSpanStyle: true,
- groupHeaders: [
- { startColumnName: 'VoltageA_1', numberOfColumns: 9, titleText: '1号泵' },
- { startColumnName: 'VoltageA_2', numberOfColumns: 9, titleText: '2号泵' },
- { startColumnName: 'VoltageA_3', numberOfColumns: 9, titleText: '3号泵' },
- { startColumnName: 'VoltageA_4', numberOfColumns: 9, titleText: '4号泵' },
- { startColumnName: 'VoltageA_5', numberOfColumns: 9, titleText: '5号泵' }
- ]
- });
-
- //查询事件
- $("#btn_point_Search").click(function () {
- var PointStartTime = $("#PointStartTime").val();
- var PointEndTime = $("#PointEndTime").val();
- if (checkedIds.length == 0) {
- dialogMsg('请选择测点!', 0);
- return;
- }
-
- $gridTable.jqGrid('setGridParam', {
- postData: { ids: checkedIds.toString() },
- page: 1
- }).trigger('reloadGrid');
- });
- }
- //导出
- function btn_point_export() {
- dialogOpen({
- id: "ExcelIExportDialog",
- title: '导出采购报表',
- url: '/Utility/ExcelExportForm?gridId=pointGridTable',
- width: "500px",
- height: "380px",
- callBack: function (iframeId) {
- top.frames[iframeId].AcceptClick();
- }, btn: ['导出Excel', '关闭']
- });
- }
- </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 class="panel-Title">实时数据</div>
- <div class="titlePanel">
- <div class="title-search">
- <table>
- <tr>
- @* <td style="padding-left: 10px;">测点名称:
- </td>
- <td style="padding-left: 10px;">
- <input type="text" id="device" name="device" class="form-control" style="width: 130px;" />
- </td>
- <td style="padding-left: 10px;">
- 开始时间:
- </td>
- <td style="padding-left: 10px;">
- <input id="PointStartTime" readonly type="text" value="@LeaRun.Util.Time.GetDate(-7)" class="form-control input-wdatepicker" onfocus="WdatePicker({maxDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'PointEndTime\')}'})" style="width:175px">
- </td>
- <td style="padding-left: 10px;">
- 结束时间:
- </td>
- <td style="padding-left: 10px;">
- <input id="PointEndTime" readonly type="text" value="@LeaRun.Util.Time.GetToday()" class="form-control input-wdatepicker" onfocus="WdatePicker({maxDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'PointStartTime\')}'})" style="width:175px">
- </td>
- <td style="padding-left: 10px;">
- <div id="time_horizon" class="btn-group">
- <a class="btn btn-default" data-value="1">24小时</a>
- <a class="btn btn-default active" data-value="2">近7天</a>
- <a class="btn btn-default" data-value="3">近1个月</a>
- <a class="btn btn-default" data-value="4">自定义</a>
- </div>
- </td>*@
- <td style="padding-left: 10px;">
- <a id="btn_point_Search" class="btn btn-primary"> 查 询</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-export" class="btn btn-default" onclick="btn_point_export()"><i class="fa fa-sign-out"></i> 导出</a>
- </div>
- </div>
- </div>
- <div class="gridPanel">
- <table id="pointGridTable"></table>
- <div id="gridPager"></div>
- </div>
- </div>
- </div>
- </div>
|