a23b9c276c08a394630c93060cdb55d5e69bb977.svn-base 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>台区停电统计图</title>
  5. <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <script type="text/javascript" src="/nwyj/page/cockpit/context.js"></script>
  8. <!--框架必需start-->
  9. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/jquery.js"></script>
  10. <script type="text/javascript"
  11. src="/nwyj/scripts/qui/libs/js/language/cn.js"></script>
  12. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/main.js"></script>
  13. <script type="text/javascript"
  14. src="/nwyj/scripts/qui/libs/js/framework.js"></script>
  15. <link href="/nwyj/scripts/qui/libs/css/import_basic.css"
  16. rel="stylesheet" type="text/css" />
  17. <link rel="stylesheet" type="text/css" id="skin"
  18. prePath="/nwyj/scripts/qui/" scrollerY="false" />
  19. <link rel="stylesheet" type="text/css" id="customSkin" />
  20. <!--框架必需end-->
  21. <!--树组件start-->
  22. <link rel="stylesheet" type="text/css"
  23. href="/nwyj/scripts/qui/libs/js/tree/ztree/ztree.css" />
  24. <script type="text/javascript"
  25. src="/nwyj/scripts/qui/libs/js/tree/ztree/ztree.js"></script>
  26. <script type="text/javascript"
  27. src="/nwyj/scripts/qui/libs/js/form/selectTree.js"></script>
  28. <script type="text/javascript"
  29. src="/nwyj/scripts/qui/libs/js/form/listerTree.js"></script>
  30. <!--树组件end-->
  31. <link rel="stylesheet" type="text/css"
  32. href="/nwyj/page/cockpit/chartPage.css">
  33. <script type="text/javascript"
  34. src="/nwyj/page/cockpit/echarts-2.2.7/build/dist/echarts-all.js"></script>
  35. <script type="text/javascript"
  36. src="/nwyj/page/cockpit/echarts-2.2.7/build/dist/chart/pie.js"></script>
  37. <script type="text/javascript"
  38. src=" /nwyj/page/cockpit/cockpit_echart.js"></script>
  39. <script type="text/javascript"
  40. src="/nwyj/page/cockpit/laydate/laydate.js"></script>
  41. <script type="text/javascript" src="/nwyj/page/cockpit/webgis/util.js"></script>
  42. <link rel="stylesheet" type="text/css" href="/nwyj/css/cockpit/charTitle.css">
  43. </head>
  44. <body>
  45. <div id="title" class="jsc_chartitle"></div>
  46. <div id="container"></div>
  47. <div id="choose_content">
  48. <h2>单位:</h2>
  49. <div id="compTree" class="selectTree _left_margin" selWidth="280"
  50. asyncMode="true" multiMode="true"></div>
  51. </br>
  52. <h2>数据源:</h2>
  53. <div id="from">
  54. <input type="radio" class="_left_margin" name="from" value="sys">系统数据源
  55. <input type="radio" class="_left_margin" name="from" value="peo"
  56. checked="checked">人工数据源
  57. </div>
  58. <h2>间隔时间:</h2>
  59. <select id="selectList" value=""></select><br />
  60. <div class="_startTime _hide">
  61. <h2>起始时间(YYYY-MM-DD HH:mm:ss):</h2>
  62. <input id="startTime" class="_left_margin"
  63. onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
  64. </div>
  65. <div class="_endTime">
  66. <h2>时间(YYYY-MM-DD HH:mm:ss):</h2>
  67. <input id="dataTime" class="_left_margin"
  68. onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
  69. </div>
  70. <h2 class="_center">
  71. <span class="_query_command">查询</span><span class="_rend_command">刷新</span>
  72. </h2>
  73. </div>
  74. <script type="text/javascript">
  75. /******************************************************查询条件***********************************************************/
  76. //图表用参数
  77. // dept_id//user_id//user_name//dept_name
  78. var customMadeTool=["search","render","list","enlarge","resource"];//父页面显示的工具栏
  79. var interval = null;//定时器
  80. var dataFrom = "peo";//数据源的状态
  81. var n = intervalTime;//初始化默认刷新时间
  82. var list = intervalList//刷新时间list列表
  83. var urlParams = resolveUrl();//主页面传递参数
  84. HTitle["fixed"] = urlParams["dept_name"];//固定标题
  85. HTitle["change"] = urlParams["dept_name"];//可变标题
  86. var text = HTitle[tState] + taiQuTitleChart;
  87. var childId = "'" + urlParams["dept_id"] + "'";//该部门的ID
  88. var bindChildId = childId.split(",");//绑定点击事件查询id
  89. var parentId = urlParams["parentId"];//该部门父部门的ID
  90. var dateTime = getNowDateTime();//获取现在的时间
  91. var chart = null;//图表对象
  92. var categorie = [ urlParams["dept_name"] ];//部门名称
  93. var state = [ {
  94. name : "已恢复",
  95. column : "TD_COUNT"
  96. }, {
  97. name : "未恢复",
  98. column : "UNRECOVERED"
  99. } ];
  100. var deptUrl = deptTreePath;//组织结构树的映射路径
  101. function init() {
  102. //加载刷新时间列表
  103. loadSelect($("#selectList"), list);
  104. // 添加额外属性主要用于最初的初始节点
  105. $("#compTree").attr('params',
  106. '{"deptId":"' + urlParams["dept_id"] + '"}');
  107. // 异步加载请求地址
  108. $("#compTree").attr('url', deptUrl);
  109. $.post(deptUrl, {
  110. "id" : urlParams["dept_id"]
  111. }, function(data) {
  112. $("#compTree").data("data", data);
  113. $("#compTree").render();
  114. }, "json");
  115. $("._query_command").on("click", query);
  116. $("._rend_command").on("click", rend);
  117. }
  118. /**
  119. *时时数据刷新
  120. */
  121. function rend() {
  122. //移除定时器
  123. interval = removeRendChart(interval);
  124. //获取刷新间隔时间
  125. n = getInterval($("#selectList"), n);
  126. //获取部门Id
  127. getDepartment($("#compTree"), taiQuTitleChart);
  128. bindChildId = childId.split(",");//绑定点击事件查询id
  129. //检查查询条件参数
  130. //alert("parentId=" + parentId + ";childId=" + childId + ";n=" + n+ ";")
  131. //加载表格
  132. rendChart();
  133. interval = outoRendChart(interval, n, rendChart);
  134. }
  135. /**
  136. *查询历史
  137. */
  138. function query() {
  139. //移除定时器
  140. interval = removeRendChart(interval);
  141. //获取部门
  142. getDepartment($("#compTree"), taiQuTitleChart);
  143. bindChildId = childId.split(",");//绑定点击事件查询id
  144. //获取时间
  145. dateTime = getTimeChart($("#dataTime"));
  146. //加载
  147. //检查查询条件的参数
  148. //alert("parentId=" + parentId + ";childId=" + childId + ";dateTime="+ dateTime + ";")
  149. loadChart(parentId, childId, dateTime, "5");
  150. }
  151. /**
  152. *初始化加载图表,
  153. *根据系统配置参数判断初始化加载本部门的数据还是直辖部门的数据
  154. *如果是直辖部门,根据配置初始化加载的部门数量选择加载该配置量的部门
  155. */
  156. function getInitParams() {
  157. //当oadState["lineChart"]==0时,加载本部门的数据
  158. //否则加载直辖loadState["lineChart"]数量的部门,
  159. //如果直辖部门大于loadState["lineChart"]数量,则显示该数量部门
  160. //否则显示实际部门数量
  161. if (loadState["lineChart"] == 0) {
  162. rendChart();
  163. } else {
  164. $.post(path+ "ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getParentsInfo",
  165. {
  166. comId : urlParams["dept_id"],
  167. count : loadState["lineChart"]
  168. },
  169. function(result) {
  170. categorie = [];
  171. HTitle["change"] = "";
  172. childId = "'"
  173. + result.rows.childId.join("','")
  174. + "'";
  175. bindChildId = childId.split(",");
  176. categorie = result.rows.childName;
  177. HTitle["change"] = '"'
  178. + categorie.join('","') + '"';
  179. text = HTitle[tState] + taiQuTitleChart;
  180. //alert("parentId=" + parentId + ";childId="+ childId + ";dateTime=" + dateTime);
  181. parentId = urlParams["dept_id"];
  182. rendChart();
  183. interval = outoRendChart(interval, n,
  184. rendChart);
  185. }, "json");
  186. }
  187. }
  188. //初始化
  189. $(function() {
  190. //初始化界面
  191. init();
  192. getInitParams();
  193. });
  194. function rendChart() {
  195. loadChart(parentId, childId, getNowDateTime(), "5");
  196. }
  197. /********************************************************************************************************************/
  198. function loadChart(compId, childId, date, typeId) {
  199. $.post(path+ "ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getChartInfo",{comId : compId,childId : childId,typeId : typeId,date : date},function(result) {
  200. var leArr = [];
  201. var xArr = [];
  202. var sArr = [ {name : '访问来源',type : 'pie',selectedMode : 'single',radius : [ "20%", "50%" ],x : '20%',width : '40%',funnelAlign : 'right',
  203. itemStyle : {
  204. normal : {
  205. label : {
  206. position : 'inner'
  207. },
  208. labelLine : {
  209. show : false
  210. }
  211. }
  212. },
  213. data : []
  214. },
  215. {name : '访问来源',type : 'pie',radius : [ "60%", "80%" ],x : '60%',width : '35%',funnelAlign : 'left',data : []} ]
  216. var opParams = null;
  217. if (result.length > 0) {
  218. opParams = loadData(leArr, xArr, sArr,
  219. result,date);
  220. } else {
  221. opParams = {title : "",//标题
  222. unit : "单位:条",//单位
  223. leArr : leArr,//图例
  224. xArr : xArr,//x轴
  225. sArr : sArr
  226. //主数据
  227. };
  228. }
  229. //创建图表并加载图表数据
  230. chart=getEchart($("#container"),getOption,opParams,chart);
  231. //监听窗口大小变化
  232. $(window).resize(function(){
  233. chart.resize();
  234. });
  235. }, "json");
  236. $("#title").html(text);
  237. };
  238. //拼接echart图表的数据
  239. function loadData(leArr, xArr, sArr, result,date) {
  240. for (var index = 0, len = result.length; index < len; index++) {
  241. leArr.push(categorie[index])
  242. //console.log("==="+JSON.stringify(result[index]));
  243. //console.log("===TQ_TD_COUNT=="+(changeQ(result[index]["TQ_TD_COUNT"])- changeQ(result[index]["TQ_UNRECOVERED"])));
  244. //console.log("===TQ_UNRECOVERED=="+result[index]["TQ_UNRECOVERED"]);
  245. sArr[0].data.push({
  246. //图表数据
  247. name : categorie[index],
  248. value : changeQ(result[index]["TQ_TD_COUNT"])
  249. });
  250. sArr[1].data.push({
  251. //图表数据
  252. name : categorie[index] + "以恢复",
  253. value : changeQ(result[index]["TQ_TD_COUNT"])
  254. - changeQ(result[index]["TQ_UNRECOVERED"])
  255. });
  256. sArr[1].data.push({
  257. //图表数据
  258. name : categorie[index] + "未恢复",
  259. value : changeQ(result[index]["TQ_UNRECOVERED"])
  260. });
  261. }
  262. return {
  263. title : "",//标题
  264. unit : "单位:条",//单位
  265. leArr : leArr,//图例
  266. xArr : xArr,//x轴
  267. sArr : sArr
  268. //主数据
  269. };
  270. }
  271. </script>
  272. </body>
  273. </html>