Aeratedmachinerunningstate.jsp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
  2. <%@ page import="com.runzhixing.bean.CityPlace" %>
  3. <%@ page import="com.runzhixing.bean.CountryPlace" %>
  4. <%@ page import="com.runzhixing.bean.Station" %>
  5. <%@ page import="com.runzhixing.bean.AuthorityRegionPlace" %>
  6. <%@ page import="com.runzhixing.bean.User" %>
  7. <%@ page import="com.runzhixing.constant.Constant" %>
  8. <%@ page import="com.runzhixing.tool.Util" %>
  9. <%
  10. String path = request.getContextPath();
  11. String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  12. User user = (User)session.getAttribute(Constant.userMark);
  13. List<AuthorityRegionPlace> arplist = user.getPrivilegePlaces1();
  14. List<CityPlace> cplist = new ArrayList<CityPlace>();
  15. List<CountryPlace> cyplist = new ArrayList<CountryPlace>();
  16. List<Station> slist = new ArrayList<Station>();
  17. %>
  18. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  19. <html>
  20. <head>
  21. <base href="<%=basePath%>">
  22. <title>加气机运行状态</title>
  23. <meta http-equiv="pragma" content="no-cache">
  24. <meta http-equiv="cache-control" content="no-cache">
  25. <meta http-equiv="expires" content="0">
  26. <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
  27. <meta http-equiv="description" content="This is my page">
  28. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  29. <meta http-equiv="X-UA-Compatible" content="IE=10"/>
  30. <link rel="stylesheet" type="text/css" href="css/easyui/themes/default/easyui.css">
  31. <link rel="stylesheet" type="text/css" href="css/easyui/themes/icon.css">
  32. <link rel="stylesheet" type="text/css" href="css/easyui/demo/demo.css">
  33. <script type="text/javascript" src="css/easyui/jquery.min.js"></script>
  34. <script type="text/javascript" src="css/easyui/jquery.easyui.min.js" charset="utf-8"></script>
  35. <script type="text/javascript" src="css/easyui/locale/easyui-lang-zh_CN.js" charset="utf-8"></script>
  36. <link rel="stylesheet" type="text/css" href="css/common/hzbstyle.css">
  37. <script type="text/javascript">
  38. var i = 1;//第几页
  39. var sum;//总条数
  40. var totalpage;//总页数
  41. $(document).ready(function(){
  42. fLoadTable();
  43. selectCountry();
  44. });
  45. //点击查询按钮
  46. $('#btninfosearch').click(function(){
  47. fLoadData(1,100);
  48. });
  49. var sortFlag = false;
  50. function fLoadTable(){
  51. $('#tt').datagrid({
  52. fit: true,//自动大小
  53. title: '加气机运行状态',
  54. width: '100%',
  55. height: 'auto',
  56. toolbar: '#toolbar',
  57. fitColumns: true,
  58. singleSelect:false,
  59. loadMsg:'正在加载, 请稍等 …',
  60. nowrap : true,//设置为true,当数据长度超出列宽时将会自动截取
  61. striped : true,//设置为true将交替显示行背景
  62. collapsible : false,//显示可折叠按钮
  63. singleSelect:true,//为true时只能选择单行
  64. fitColumns:true,//允许表格自动缩放,以适应父容器
  65. rownumbers:true,
  66. fitColumns:true,
  67. singleSelect:true,
  68. remoteSort: false,
  69. pagination:true,//分页控件
  70. pageSize: 100,//每页显示的记录条数,默认为10
  71. pageList: [20,50,100,150,200],//可以设置每页记录条数的列表
  72. columns:[[
  73. {field:'provinceName',align:'left',title:'省份',width:'100px'},
  74. {field:'cityName',align:'left',title:'市州',width:'100px'},
  75. {field:'countryName',align:'left',title:'区县',width:'200px'},
  76. {field:'stationName',align:'left',title:'加气站',width:'160px'},
  77. {field:'netState',title:'网络状态',width:'80px',height:'auto',align:'left',formatter: function(value, row, index){
  78. if(value=="断开"){
  79. return '<img title="断开" src="images/rzx/disconnect.png">';
  80. }else if(value=="连接"){
  81. return '<img title="连接" src="images/rzx/connect.png">';
  82. }else{
  83. //return '<font style="color:red;font-weight: bold;">'+"未知状态"+'</font>';
  84. }
  85. }},
  86. {field:'machineName',align:'left',title:'加气机',width:'150px'},
  87. {field:'media',align:'left',title:'充装介质',width:'150px',formatter: function(value, row, index){
  88. if (value == "0") {
  89. return '<font style="color:green;font-weight: bold;">'+"CNG-高压气体"+'</font>';
  90. }
  91. else if(value == "1") {
  92. return '<font style="color:blue;font-weight: bold;">'+"LNG-低温液化天然气"+'</font>';
  93. }else{
  94. return '<font style="color:red;font-weight: bold;">'+"其他"+'</font>';
  95. }
  96. }},
  97. {field:'gun1State',align:'left',title:'1号枪状态',width:'100px',formatter: function(value, row, index){
  98. if (value == "0") {
  99. //return '<font style="color:green;font-weight: bold;">'+"正常"+'</font>';
  100. return '<font style="color:orange;font-weight: bold;">'+"在用"+'</font>';
  101. }
  102. else if(value == "1") {
  103. //return '<font style="color:red;font-weight: bold;">'+"停用"+'</font>';
  104. return '<font style="color:green;font-weight: bold;">'+"可用"+'</font>';
  105. }else if(value == "2") {
  106. //return '<font style="color:red;font-weight: bold;">'+"未知状态"+'</font>';
  107. return '<font style="color:red;font-weight: bold;">'+"检修"+'</font>';
  108. }
  109. }},
  110. {field:'gun2State',align:'left',title:'2号枪状态',width:'100px',formatter: function(value, row, index){
  111. if (value == "0") {
  112. //return '<font style="color:green;font-weight: bold;">'+"正常"+'</font>';
  113. return '<font style="color:orange;font-weight: bold;">'+"在用"+'</font>';
  114. }
  115. else if(value == "1") {
  116. //return '<font style="color:red;font-weight: bold;">'+"停用"+'</font>';
  117. return '<font style="color:green;font-weight: bold;">'+"可用"+'</font>';
  118. } else if(value == "2") {
  119. //return '<font style="color:red;font-weight: bold;">'+"未知状态"+'</font>';
  120. return '<font style="color:red;font-weight: bold;">'+"检修"+'</font>';
  121. }
  122. }}
  123. ]],
  124. onSortColumn:function(sort, order){
  125. sortFlag = true;
  126. if("provinceName"==sort){
  127. $(this).datagrid("autoMergeCells",[sort]);
  128. }else{
  129. $(this).datagrid("autoMergeCells");
  130. }
  131. },
  132. onLoadSuccess: function(data){
  133. if(!sortFlag) $(this).datagrid("autoMergeCells");
  134. }
  135. });
  136. }
  137. function show(message) {
  138. $.messager.show({
  139. title: '提示信息',
  140. msg: message,
  141. timeout: 2000,
  142. showType: 'slide'
  143. });
  144. }
  145. function fLoadData(page,rows){
  146. $.messager.progress({
  147. title: '请等待',
  148. msg: '正在加载数据...',
  149. text: '查询中.......'
  150. });
  151. $.ajax({
  152. type:"POST",
  153. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  154. data:$('#aeratedmachinerunningstateform').serialize(),
  155. url:"ajax/aeratedmachinerunningstate?page="+page+"&psize="+rows,
  156. success:function (data){
  157. $.messager.progress('close');
  158. var vData = $.parseJSON(data);
  159. sum = vData.total;
  160. if(sum==0){
  161. show("没有查询到相关信息!!!");
  162. }
  163. totalpage = Math.ceil(sum/rows);
  164. $('#tt').datagrid('loadData', vData); //将数据绑定到datagrid
  165. var p = $('#tt').datagrid('getPager');
  166. $(p).pagination({
  167. pageList: [20,50,100,150,200],//可以设置每页记录条数的列表
  168. beforePageText: '第',//页数文本框前显示的汉字
  169. afterPageText: '页 共 {pages} 页',
  170. displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录',
  171. onSelectPage: function (pageNumber, pageSize) {
  172. fLoadData(pageNumber, pageSize);
  173. }
  174. });
  175. }
  176. });
  177. }
  178. function selectCountry1(){
  179. selectCountry();
  180. //fLoadData(1,10);
  181. }
  182. function selectCountry(){
  183. var id=document.getElementById("city").value;
  184. //document.getElementById("hiddenCity").value=id;
  185. var select = document.getElementById("country");
  186. for(var i=select.options.length-1;i>=0;i--) {
  187. select.options.remove(i);
  188. }
  189. $.ajax({
  190. type:"POST",
  191. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  192. url:"ajax/hiddenCity?cityId="+id,
  193. success:function (data){
  194. var obj=eval("(" + data + ")");
  195. $.each(obj.rows, function(i,item){
  196. select.options.add(new Option(item.name, item.id));
  197. });
  198. }
  199. });
  200. }
  201. function selectStation(){
  202. var id=document.getElementById("city").value;
  203. var id1=document.getElementById("country").value;
  204. //document.getElementById("hiddenCity").value=id;
  205. var select = document.getElementById("station");
  206. for(var i=select.options.length-1;i>=0;i--) {
  207. select.options.remove(i);
  208. }
  209. $.ajax({
  210. type:"POST",
  211. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  212. url:"ajax/hiddenCountry?countryId="+id1+"&cityId="+id,
  213. success:function (data){
  214. var obj=eval("(" + data + ")");
  215. $.each(obj.rows, function(i,item){
  216. select.options.add(new Option(item.name, item.id));
  217. });
  218. }
  219. });
  220. }
  221. $.extend($.fn.datagrid.methods, {
  222. autoMergeCells : function (jq, fields) {
  223. return jq.each(function () {
  224. var target = $(this);
  225. if (!fields) {
  226. fields = target.datagrid("getColumnFields");
  227. }
  228. var rows = target.datagrid("getRows");
  229. var i = 0,
  230. j = 0,
  231. temp = {};
  232. for (i; i < rows.length; i++) {
  233. var row = rows[i];
  234. j = 0;
  235. //for (j; j < fields.length; j++) {
  236. for (j; j < 5; j++) {
  237. var field = fields[j];
  238. var tf = temp[field];
  239. if (!tf) {
  240. tf = temp[field] = {};
  241. tf[row[field]] = [i];
  242. } else {
  243. var tfv = tf[row[field]];
  244. if (tfv) {
  245. tfv.push(i);
  246. } else {
  247. tfv = tf[row[field]] = [i];
  248. }
  249. }
  250. }
  251. }
  252. $.each(temp, function (field, colunm) {
  253. $.each(colunm, function () {
  254. var group = this;
  255. if (group.length > 1) {
  256. var before,
  257. after,
  258. megerIndex = group[0];
  259. for (var i = 0; i < group.length; i++) {
  260. before = group[i];
  261. after = group[i + 1];
  262. if (after && (after - before) == 1) {
  263. continue;
  264. }
  265. var rowspan = before - megerIndex + 1;
  266. if (rowspan > 1) {
  267. target.datagrid('mergeCells', {
  268. index : megerIndex,
  269. field : field,
  270. rowspan : rowspan
  271. });
  272. }
  273. if (after && (after - before) != 1) {
  274. megerIndex = after;
  275. }
  276. }
  277. }
  278. });
  279. });
  280. });
  281. }
  282. });
  283. </script>
  284. </head>
  285. <body>
  286. <!-- 查询结果:数据表格 -->
  287. <table id="tt" cellspacing="0" cellpadding="0" >
  288. </table>
  289. <div id="toolbar">
  290. <form id="aeratedmachinerunningstateform" action="ajax/aeratedmachinerunningstate" method="post">
  291. <table style="border-collapse:separate; border-spacing:10px;">
  292. <tr>
  293. <td>
  294. <span style="cursor: default;"><span class="hzbspan" >省:</span></span>
  295. </td>
  296. <td>
  297. <select name="province" style="width: 150px;height: 34px;min-width: 100px;" class="hzbspan select">
  298. <%for(AuthorityRegionPlace arp:arplist){
  299. cplist = arp.getCityPlace();
  300. %>
  301. <option value="<%=arp.getId() %>">
  302. <%=arp.getName() %>
  303. </option>
  304. <%} %>
  305. </select>
  306. </td>
  307. <td>
  308. <span style="cursor: default;"><span class="hzbspan" >市:</span></span>
  309. </td>
  310. <td>
  311. <select name="city" id="city" style="width: 150px;height: 34px;min-width: 100px;" class="hzbspan select" onchange="selectCountry1()">
  312. <%
  313. for(CityPlace cp:cplist){
  314. cyplist = cp.getSubPlaceList();
  315. %>
  316. <option value="<%=cp.getId() %>">
  317. <%=cp.getName() %>
  318. </option>
  319. <%} %>
  320. </select>
  321. </td>
  322. <td>
  323. <span style="cursor: default;"><span class="hzbspan" >县:</span></span>
  324. </td>
  325. <td>
  326. <select name="country" id = "country" style="width: 150px;height: 34px;min-width: 100px;" class="hzbspan select" >
  327. </select>
  328. </td>
  329. <td>
  330. <a id="btninfosearch" onclick="fLoadData(1,100);" class="easyui-linkbutton" icon="icon-search" href="javascript:void(0)" ><span class="hzbspan" style="color: #f08300;font-size: 16px;">查&nbsp;&nbsp;询&nbsp;&nbsp;</span></a>
  331. </td>
  332. </tr>
  333. </table>
  334. </form>
  335. </div>
  336. <form action="hiddenCity" name="hiddenCityform">
  337. <input type="text" id="hiddenCity" />
  338. </form>
  339. </body>
  340. </html>