123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- @{
- ViewBag.Title = "设备管理";
- Layout = "~/Views/Shared/_LayoutIndex.cshtml";
- }
- <script>
- $(function () {
- InitialPage();
- GetGrid();
- });
- //初始化页面
- function InitialPage() {
- //resize重设(表格、树形)宽高
- $(window).resize(function (e) {
- window.setTimeout(function () {
- $('#gridTable').setGridWidth(($('.gridPanel').width()));
- //$("#gridTable").setGridHeight($(window).height() - 136.5);
- }, 200);
- e.stopPropagation();
- });
- }
- //加载表格
- function GetGrid() {
- var $gridTable = $('#gridTable');
- $gridTable.jqGrid({
- url: "/SecondaryWaterSupply/Device/GetDeviceList",
- datatype: "json",
- height: $(window).height() - 140.5,
- autowidth: 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: 'longitude', width: 100, frozen: true, align: 'center' },
- { label: '纬度', name: 'latitude', width: 100, frozen: true, align: 'center' },
- {
- 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",
- rownumbers: true,
- shrinkToFit: false,
- gridview: true,
- gridComplete: function () {
-
- }
- });
-
-
- $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号泵' }
- ]
- });
- //$gridTable.jqGrid('setFrozenColumns');
- //查询条件
- $("#queryCondition .dropdown-menu li").click(function () {
- var text = $(this).find('a').html();
- var value = $(this).find('a').attr('data-value');
- $("#queryCondition .dropdown-text").html(text).attr('data-value', value)
- });
- //查询事件
- $("#btn_Search").click(function () {
- var queryJson = {
- condition: $("#queryCondition").find('.dropdown-text').attr('data-value'),
- keyword: $("#txt_Keyword").val()
- }
- $gridTable.jqGrid('setGridParam', {
- postData: { queryJson: JSON.stringify(queryJson) },
- page: 1
- }).trigger('reloadGrid');
- });
- //查询回车
- $('#txt_Keyword').bind('keypress', function (event) {
- if (event.keyCode == "13") {
- $('#btn_Search').trigger("click");
- }
- });
- }
- //新增
- function btn_add() {
- dialogOpen({
- id: "Form",
- title: '添加设备',
- url: '/SecondaryWaterSupply/Device/DeviceForm',
- width: "750px",
- height: "460px",
- callBack: function (iframeId) {
- top.frames[iframeId].AcceptClick();
- }
- });
- };
- //编辑
- function btn_edit() {
- var keyValue = $("#gridTable").jqGridRowValue("SecondaryWaterSupplyId");
- if (checkedRow(keyValue)) {
- dialogOpen({
- id: "Form",
- title: '编辑设备',
- url: '/SecondaryWaterSupply/Device/DeviceForm?keyValue=' + keyValue,
- width: "750px",
- height: "460px",
- callBack: function (iframeId) {
- top.frames[iframeId].AcceptClick();
- }
- });
- }
- }
- //删除
- function btn_delete() {
- var keyValue = $("#gridTable").jqGridRowValue("SecondaryWaterSupplyId");
- if (keyValue) {
- $.RemoveForm({
- url: "/SecondaryWaterSupply/Device/DelteDevice",
- param: { deviceId: keyValue },
- success: function (data) {
- $("#gridTable").trigger("reloadGrid");
- }
- })
- } else {
- dialogMsg('请选择需要删除的数据项!', 0);
- }
- }
- </script>
- <div class="titlePanel">
- <div class="title-search">
- <table>
- <tr>
- <td>
- <div id="queryCondition" class="btn-group">
- <a class="btn btn-default dropdown-text" data-toggle="dropdown">选择条件</a>
- <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
- <ul class="dropdown-menu">
- <li><a data-value="EnCode">角色编号</a></li>
- <li><a data-value="FullName">角色名称</a></li>
- </ul>
- </div>
- </td>
- <td style="padding-left: 2px;">
- <input id="txt_Keyword" type="text" class="form-control" placeholder="请输入要查询关键字" style="width: 200px;" />
- </td>
- <td style="padding-left: 5px;">
- <a id="btn_Search" class="btn btn-primary"><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-add" class="btn btn-default" onclick="btn_add()"><i class="fa fa-plus"></i> 新增</a>
- <a id="lr-edit" class="btn btn-default" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i> 编辑</a>
- <a id="lr-delete" class="btn btn-default" onclick="btn_delete()"><i class="fa fa-trash-o"></i> 删除</a>
- </div>
- </div>
- </div>
- <div class="gridPanel">
- <table id="gridTable"></table>
- <div id="gridPager"></div>
- </div>
|