96b04f7de8fc9d24da17b2bc4dd7194f68e78013.svn-base 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. /**
  2. * 功能:
  3. *
  4. *
  5. * @author HXB
  6. * @date 2015/09/18
  7. */
  8. //部门id
  9. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  10. //部门名称
  11. var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
  12. var _this = this;
  13. _this.listGrid = null;// 数据列表
  14. ReportInputPlan = function() {
  15. /** 定义变量* */
  16. _this.searchPanel = null; // 查询面板
  17. $queryForm = null;// 查询区域表单
  18. $searchButt = null;// 查询按钮
  19. $more = null; // 更多
  20. _this.loadParams = null;// 列表加载参数
  21. /** 私有方法* */
  22. // // 查询
  23. // function search(obj) {
  24. // //var queryFormValue = $queryForm.serialize();
  25. // var area_id = $("#GPS_AREA_ID_610_show").val();
  26. // var year = $("#GPS_YEAR_610").attr("reltext");
  27. // var endtime = $("#END_TIME_610").attr("reltext");
  28. // var month = $("#GPS_MONTH").attr("reltext");
  29. // /**********表格头部*****************/
  30. // year = !year?"":year;
  31. // endtime = !endtime?"":endtime;
  32. // month = !month?"":month;
  33. // var penelTitle = "";
  34. // var title = "保供电任务统计表";
  35. // if(month==""){
  36. // penelTitle = area_id + " "+title +"("+ year + "年" + endtime +")";
  37. // }else{
  38. // penelTitle = area_id + " "+title +"("+ year + "年" + month +"月)";
  39. // }
  40. // $("#searchPanel1").attr("panelTitle",penelTitle);
  41. // $("#searchPanel1").render();
  42. // /**********表格头部*****************/
  43. // var queryParams = getQueryFormParams($queryForm);
  44. // var params = concatJson({}, [ _this.loadParams, queryParams ]);
  45. // var dept_id = params.GPS_AREA_ID_610;
  46. // var year = params.GPS_YEAR_610;
  47. // var endtime = params.END_TIME_610;
  48. // var month = params.GPS_MONTH;
  49. // queryTask(dept_id,year,endtime,month);
  50. // /*_this.listGrid.setNewPage(1);
  51. // _this.listGrid.loadData();// 加载数据*/
  52. // }
  53. // 查询
  54. function search(obj) {
  55. var area_id = $("#GPS_AREA_ID_610_show").val();
  56. var startime = $("#beginTime").val();
  57. var endTime = $("#endTime").val();
  58. if(startime==""){
  59. startime = getDateTime();
  60. $("#beginTime").val(startime);
  61. }
  62. if(endTime==""){
  63. endTime = getDateTime();
  64. $("#endTime").val(endTime);
  65. }
  66. if(startime>endTime){
  67. top.Dialog.alert("任务时间选择不正确,开始日期应小于结束日期!");
  68. return;
  69. }
  70. /**********表格头部*****************/
  71. var penelTitle = "";
  72. var title = "保供电任务统计表";
  73. penelTitle = area_id + " "+title +"("+ startime + " ~ " + endTime +")";
  74. $("#searchPanel1").attr("panelTitle",penelTitle);
  75. $("#searchPanel1").render();
  76. /**********表格头部*****************/
  77. var dept_id = $("#GPS_AREA_ID_610").val();
  78. queryTask(dept_id,startime,endTime);
  79. }
  80. /***
  81. * 导出
  82. */
  83. function exportGridData() {
  84. var titlte = $("#searchPanel1").attr("panelTitle");
  85. var winname = window.open('', '_blank', 'top=10000');
  86. //获得页面上需要导出的数据内容
  87. var strHTML = document.all.grid.innerHTML; //其中tableExcel是需要导出数据的div的id或者表的id
  88. winname.document.open('text/html', 'replace');
  89. winname.document.writeln(strHTML);
  90. winname.document.execCommand('saveas','',titlte+'.xls'); //excel是导出excel的默认名称
  91. winname.close();
  92. };
  93. /**
  94. * 打印
  95. */
  96. function printGridData() {
  97. $("#searchPanel1").jqprint();
  98. };
  99. return {
  100. init : function() {
  101. $queryForm = $("#queryForm");
  102. /** 绑定查询面板的按钮点击事件* */
  103. $searchButt = $("#searchButt");// 查询按钮
  104. $searchButt.bind('click', function() {
  105. search();
  106. });
  107. $("#exportButt").bind('click', function() {
  108. exportGridData();
  109. });
  110. $("#PrintButt").bind('click', function() {
  111. printGridData();
  112. });
  113. $("#toMXButt").bind('click', function() {
  114. $(top.document.body).find("iframe").attr("src","/nwyj/page/business/gps/queryStatistics/list/quaryStatic.jsp");
  115. });
  116. /*// 列表加载参数
  117. _this.loadParams = {
  118. "GPS_AREA_ID_610" : deptId,
  119. "GPS_YEAR_610" : currDate,
  120. "END_TIME_610" : ""
  121. };*/
  122. /** grid载入数据* */
  123. _this.listGrid = $("#dataGrid").quiGrid({
  124. columns : [{
  125. display : '单位',
  126. name : 'unit',
  127. align : 'center',
  128. width : "20%",
  129. showTitle:true
  130. }, {
  131. display : '特级(项)',
  132. name : 'tjx',
  133. align : 'center',
  134. width : "10%",
  135. showTitle:true
  136. }, {
  137. display : '特级(天数)',
  138. name : 'tjt',
  139. align : 'center',
  140. width : "10%",
  141. isSort : true
  142. }, {
  143. display : '一级(项)',
  144. name : 'yjx',
  145. align : 'center',
  146. width : "10%",
  147. showTitle:true
  148. }, {
  149. display : '一级(天数)',
  150. name : 'yjt',
  151. align : 'center',
  152. width : "10%",
  153. showTitle:true
  154. }, {
  155. display : '二级(项)',
  156. name : 'ejx',
  157. align : 'center',
  158. width : "10%"
  159. }, {
  160. display : '二级(天数)',
  161. name : 'ejt',
  162. align : 'center',
  163. width : "10%"
  164. }, {
  165. display : '三级(项)',
  166. name : 'sjx',
  167. align : 'center',
  168. width : "10%"
  169. }, {
  170. display : '三级(天数)',
  171. name : 'sjt',
  172. align : 'center',
  173. width : "10%",
  174. showTitle:true
  175. }],
  176. /*url : $.pathname() + '/ws/taskStatistics/BGDStatisticsService/gpsstatistics',
  177. params :_this.loadParams,*/
  178. data:"",
  179. sortOrder : 'desc', // 排序方式
  180. rownumbers : true,
  181. width : '100%',
  182. usePager:false,
  183. percentWidthMode : true
  184. });
  185. }
  186. };
  187. }();
  188. function queryTask(dept_id,startime,endtime){
  189. var url = $.pathname() + '/ws/taskStatistics/BGDStatisticsService/gpsstatistics?';
  190. params = {
  191. "GPS_AREA_ID_610" : dept_id,
  192. /* "GPS_YEAR_610" : year,
  193. "END_TIME_610" : end_time,*/
  194. "startime":startime,
  195. "endtime":endtime,
  196. };
  197. $.ajax({
  198. url : url,
  199. type : 'post',
  200. data : params,
  201. dataType : 'json',
  202. success : function(data) {
  203. _this.listGrid.setOptions({data:JSON.parse(data.rows)});
  204. //top.Dialog.alert("查询成功!");
  205. },
  206. error : function(e) {
  207. $.messager.alert( '访问服务失败!', 'error');
  208. }
  209. }).done(function(){
  210. $(top.document.body).find("#frmright").height($(window.document.body).height());
  211. });
  212. }
  213. $(function() {
  214. ReportInputPlan.init();
  215. $(".l-grid2").attr("id","grid");
  216. //queryTask(deptId,currDate);
  217. });
  218. //获得当前系统时间:年月
  219. function getDateTime(){
  220. var s="";
  221. var d = allGetServerTime();
  222. var vYear = d.getFullYear();
  223. var vMon = d.getMonth() + 1;
  224. /*var vDay = d.getDate();
  225. var h = d.getHours();
  226. var m = d.getMinutes();
  227. var se = d.getSeconds(); */
  228. s=vYear+"-"+(vMon<10 ? "0" + vMon : vMon)/*+"-"+(vDay<10 ? "0"+ vDay : vDay)+" "+(h<10 ? "0"+ h : h)+":"+(m<10 ? "0" + m : m)+":"+(se<10 ? "0" +se : se)*/;
  229. return s;
  230. }