123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>设备损失趋势图</title>
- <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <script type="text/javascript" src="/nwyj/page/cockpit/context.js"></script>
- <!--框架必需start-->
- <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/jquery.js"></script>
- <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/language/cn.js"></script>
- <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/main.js"></script>
- <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/framework.js"></script>
- <link href="/nwyj/scripts/qui/libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
- <link rel="stylesheet" type="text/css" id="skin" prePath="/nwyj/scripts/qui/" scrollerY="false"/>
- <link rel="stylesheet" type="text/css" id="customSkin"/>
- <!--框架必需end-->
- <!--树组件start-->
- <link rel="stylesheet" type="text/css" href="/nwyj/scripts/qui/libs/js/tree/ztree/ztree.css" />
- <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/tree/ztree/ztree.js"></script>
- <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/form/selectTree.js"></script>
- <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/form/listerTree.js"></script>
- <!--树组件end-->
- <link rel="stylesheet" type="text/css" href="/nwyj/page/cockpit/chartPage.css">
- <script type="text/javascript" src="/nwyj/page/cockpit/echarts-2.2.7/build/dist/echarts-all.js"></script>
- <script type="text/javascript" src="/nwyj/page/cockpit/echarts-2.2.7/build/dist/chart/line.js"></script>
- <script type="text/javascript" src=" /nwyj/page/cockpit/cockpit_echart.js"></script>
- <script type="text/javascript" src="/nwyj/page/cockpit/laydate/laydate.js"></script>
- <script type="text/javascript" src="/nwyj/page/cockpit/webgis/util.js"></script>
-
- <link rel="stylesheet" type="text/css" href="/nwyj/css/cockpit/charTitle.css">
- </head>
- <body>
- <div id="title" class="jsc_chartitle"></div>
- <div id="container"></div>
- <div id="choose_content">
- <h2>单位:</h2>
- <div id="compTree" class="selectTree" selWidth="280" asyncMode="true" multiMode="true"></div>
- <h2>电压等级:</h2>
- <div class="selectTree" id="levelTree" selWidth="280" multiMode="true" keepDefaultStyle="true"></div>
- <h2>状态:</h2>
- <ul>
- <li><input type="checkbox" name="state" value="PLON_DAOTA" value1="PLON_BIANXING" data="已恢复" checked="checked" >已恢复<br/></li>
- <li><input type="checkbox" name="state" value="UNRECOVER" value1="" data="未恢复" >未恢复<br/></li>
- </ul>
- <h2>开始时间(YYYY-MM-DD hh:mm:ss):</h2>
- <input id="startTime" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
- <h2>结束时间(YYYY-MM-DD hh:mm:ss):</h2>
- <input id="dataTime" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
- <h2>间隔时间:</h2>
- <select id="selectList" value=""></select><br/>
- <h2>X轴数据(个):</h2>
- <input id="n" type="text">
- <h2 class="_center"><span class="_query_command">查询</span><span class="_rend_command">刷新</span></h2>
- </div>
- <script type="text/javascript">
- /******************************************************查询条件***********************************************************/
- // dept_id//user_id//user_name//dept_name
- var customMadeTool=["search","render","list","enlarge","resource"];//父页面显示的工具栏
- var urlParams=resolveUrl();//主页面传递的参数
- var timer=null;//定时器
- HTitle["fixed"]=urlParams["dept_name"];//固定显示的部门名称
- HTitle["change"]=urlParams["dept_name"];//查询部门的名称
-
-
- var text=HTitle[tState]+equipmentTitleTrend;
-
- var childId="'"+urlParams["dept_id"]+"'";//查询部门的ID
- var parentId=urlParams["parentId"];//父部门ID
- var startTime=defaultStartTime;//默认查询历史的初始时间
- var dateTime=getNowDateTime();//默认查询历史的截止时间
- var interval=intervalTime;//每次增加数据间隔的时间
- var list=intervalList;//选择间隔时间列表
- var n=xn;//x轴显示数据的数量
- var chart=null;//chart对象
- var categorie=[urlParams["dept_name"]];//部门名称
-
- var level=defaultEquipmentLevel;
- var state=equipmentState;
- var series= [];
-
- var deptUrl=deptTreePath;
- var zNodes2 ={"treeNodes":equipmentLevel};
- function init(){
- // 添加额外属性主要用于最初的初始节点
- $("#compTree").attr('params', '{"deptId":"'+urlParams["dept_id"]+'"}');
- // 异步加载请求地址
- $("#compTree").attr('url', deptUrl);
- $.post(deptUrl, {"id" : urlParams["dept_id"]}, function(data) {$("#compTree").data("data", data);$("#compTree").render();}, "json");
- //加载电压级别
- $("#levelTree").data("data",zNodes2);
- $("#levelTree").render();
- //加载刷新时间
- loadSelect($("#selectList"),list);
- //绑定刷新事件
- $("._rend_command").on("click",rend);
- //绑定查询历史
- $("._query_command").on("click",query);
- }
-
-
-
- //获取所有的参数
- function getParam(){
- state=getState(state);//获取恢复状态
- getTime();//获取查询时间
- getDepartment($("#compTree"),equipmentTitleTrend);;//获取查询部门
- level=getLevel($("#levelTree"),level);//获取电压
- interval=getInterval($("#selectList"),interval);//获取间隔时间
- n=getN(n);//获取x轴显示的数据数量
- }
-
- //刷新
- function rend(){
- //移除定时器,一面定时器中为完成的数据在加载后进行二次加载
- timer=removeRendChart(timer);
- //刷新全局参数
- getParam();
- //alert("comId="+comId+"===childId="+childId+"===dateTime="+dateTime+"===interval="+interval+"===n="+n+"===rendState="+rendState);
- loadChart(parentId,childId,getNowDateTime(),interval,n,3);
- //定时刷新数据
- timer=outoRendChart(timer,interval,rendChart);
- }
- /**
- *查询历史记录
- *
- */
- function query(){
- //移除定时器,一面定时器中为完成的数据在加载后进行二次加载
- timer=removeRendChart(timer);
- getParam();
- $.post(path+"ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getHistoryRecords",{startDate:startTime,endDate:dateTime,comId:parentId,typeId:"3"},function(result){
- console.log(JSON.stringify(result));
- //判断是否正确查询到数据
- if(result.state=="FAILURE") throw new Error("查询失败");
- //判断是否存在历史数据
- if(result.rows.length<1){
- alert("此区间段内尚无历史数据");
- loadChart(parentId,childId,getNowDateTime(),interval,n,"3");
- return ;
- }
- var dateStr=getDateStr(result.rows);//拼接历史日期的字符串
- loadHistory(dateStr,3);//加载历史数据
- },"json");
- }
-
- /*
- *初始化加载判断
- */
- function getInitParams(){
- if(loadState["equipmentStrend"]==0){
- loadChart(parentId,childId,getNowDateTime(),interval,n,3);
- timer=outoRendChart(timer,interval,rendChart);
- }else{
- $.post(path+"ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getParentsInfo",{comId:urlParams["dept_id"],count:loadState["equipmentStrend"]},function(result){
- categorie=[];
- HTitle["change"]="";
- childId="'"+result.rows.childId.join("','")+"'";
- categorie=result.rows.childName;
- HTitle["change"]='"'+categorie.join('","')+'"';
- text=HTitle[tState]+equipmentTitleTrend;
- parentId=urlParams["dept_id"];
- //检查查询条件是否合法
- // alert("parentId="+parentId+"===childId="+childId+"===dateTime="+dateTime+"===interval="+interval+"===n="+n+"===rendState="+rendState);
- loadChart(parentId,childId,getNowDateTime(),interval,n,3);
- timer=outoRendChart(timer,interval,rendChart);
- },"json");
- }
- }
-
- //初始化
- $(function(){
- init();
- getInitParams();
- })
-
- /**
- *自动刷新增加数据节点
- *
- */
- function rendChart(){
- var nowTime=getNowTime();
- $.post("/nwyj/ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getChartInfo",{comId:parentId,childId:childId,typeId:3,date:getNowDateTime()},function(result){
- var count=0;
- var tempArr=[];
- for(var item=0;item<categorie.length;item++){
- for(var index=0;index<level.length;index++){
- for(var i=0; i<state.length;i++){
- var temp=null;
- if(state[i].column1=="PLON_DAOTA"){
- if(level[index].column=="500"){
- temp=[count,changeQ(result[changeQ(item)]["PLON_DAOTA_500"])+
- changeQ(result[(item)]["PLON_BIANXING_500"])
- -changeQ(result[changeQ(item)]["UNRECOVER_500"]),false,false]
- }
- if(level[index].column=="200"){
- temp=[count,changeQ(result[changeQ(item)]["PLON_DAOTA_200"])+
- changeQ(result[(item)]["PLON_BIANXING_200"])
- -changeQ(result[changeQ(item)]["UNRECOVER_200"]),false,false]
-
- }
- if(level[index].column=="110"){
- temp=[count,changeQ(result[changeQ(item)]["PLON_DAOTA_110"])+
- changeQ(result[(item)]["PLON_BIANXING_110"])+
- changeQ(result[(item)]["DUANGAN_110"])+
- changeQ(result[(item)]["DAOGAN_110"])
- -changeQ(result[changeQ(item)]["UNRECOVER_110"]),false,false]
- }
- if(level[index].column=="35"){
- temp=[count,changeQ(result[changeQ(item)]["PLON_DAOTA_35"])+
- changeQ(result[(item)]["PLON_BIANXING_35"])+
- changeQ(result[(item)]["DUANGAN_35"])+
- changeQ(result[(item)]["DAOGAN_35"])
- -changeQ(result[changeQ(item)]["UNRECOVER_35"]),false,false]
-
- }
- if(level[index].column=="10"){
- temp=[count,changeQ(result[changeQ(item)]["PLON_DAOTA_10"])+
- changeQ(result[(item)]["PLON_BIANXING_10"])+
- changeQ(result[(item)]["DUANGAN_10"])+
- changeQ(result[(item)]["DAOGAN_10"])
- -changeQ(result[changeQ(item)]["UNRECOVER_10"]),false,false];
- }
- if(level[index].column=="DIYA"){
- temp=[count,changeQ(result[changeQ(item)]["DAUNGAN_DIYA"])+
- changeQ(result[(item)]["DAOGAN_DIYA"])
- -changeQ(result[changeQ(item)]["UNRECOVER_DIYA"]),false,false];
- }
- /* temp=[count,changeQ(result[item][state[i].column1+"_"+level[index].column])
- +changeQ(result[item][state[i].column2+"_"+level[index].column])
- -changeQ(result[item]["UNRECOVER_"+level[index].column]), false,false,nowTime]; */
- }else{
- temp=[count,changeQ(result[item][state[i].column1+"_"+level[index].column]), false, false];
- }
- tempArr.push(temp);
- count++;
- }
- }
-
- }
- tempArr[0].push(nowTime);
- chart.addData(tempArr);
- },"json");
- }
-
-
- /*****************************************************************************************************************/
- //加载历史
- function loadHistory(dateStr,typeId){
- getParam();
- $.post(path+"ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getHistoryInfos",
- {dateStr:dateStr,
- childId:childId,
- comId:parentId,
- typeId:typeId
- },function(result){
- loadData(result);
- },"json");
- }
-
-
- function loadChart(compId,childId,date,timeInterval,n,typeId){
- $.post(path+"ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getChartInfos",{comId:compId,childId:childId,typeId:typeId,date:date,timeInterval:timeInterval,n:n},function(result){
- loadData(result);
- },"json");
- $("#title").html(text) ;
- };
-
- /*****************************************************************************************************************************************************/
- function loadData(result){
- //alert(JSON.stringify({result:result}));
- var leArr=[];
- var xArr=[];
- var sArr=[];
- //console.log("result====="+JSON.stringify(result));
- //console.log("resultthleng====="+result.length);
- xArr=result["xAxisCategories"].substring(result["xAxisCategories"].indexOf("[")+1,result["xAxisCategories"].indexOf("]")).split(",");
- for(var item in categorie){
- for(var index in level){
- for(var i in state){
- var tem= {name:categorie[item]+level[index]["name"]+state[i].name+"线路" ,type: 'line',data:new Array()};//null;
- leArr.push(tem.name);
- for(var data=0;data<result.data.length/categorie.length;data++){
- if(state[i].column1=="PLON_DAOTA"){
- if(level[index].column=="500"){
- tem.data.push({
- //图表数据
- value:changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["PLON_DAOTA_500"])
- +changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["PLON_BIANXING_500"])
- -changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["UNRECOVER_500"])});
- }
- if(level[index].column=="200"){
- tem.data.push({
- //图表数据
- value:changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["PLON_DAOTA_200"])+
- changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["PLON_BIANXING_200"])
- -changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["UNRECOVER_200"])});
-
- }
- if(level[index].column=="110"){
- tem.data.push({
- //图表数据
- value:changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["PLON_DAOTA_110"])+
- changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["PLON_BIANXING_110"])+
- changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["DUANGAN_110"])+
- changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["DAOGAN_110"])
- -changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["UNRECOVER_110"])});
- }
- if(level[index].column=="35"){
- tem.data.push({
- //图表数据
- value:changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["PLON_DAOTA_35"])+
- changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["PLON_BIANXING_35"])+
- changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["DUANGAN_35"])+
- changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["DAOGAN_35"])
- - changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["UNRECOVER_35"])});
-
- }
- if(level[index].column=="10"){
- tem.data.push({
- //图表数据
- value:changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["PLON_DAOTA_10"])+
- changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["PLON_BIANXING_10"])+
- changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["DUANGAN_10"])+
- changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["DAOGAN_10"])
- -changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["UNRECOVER_10"])});
- }
- if(level[index].column=="DIYA"){
- tem.data.push({
- //图表数据
- value:changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["DAUNGAN_DIYA"])+
- changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["DAOGAN_DIYA"])
- -changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["UNRECOVER_DIYA"])});
- }
- /* tem.data.push(changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)][state[i].column1+"_"+level[index].column])
- -changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["UNRECOVER_"+level[index].column])
- ); */
- }else{
- tem.data.push(changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["UNRECOVER_"+level[index].column]));
- }
- }
- sArr.push(tem);
- }
- }
-
- }
-
- var opParams={
- title:"",//标题
- unit:"单位:条",//单位
- leArr:leArr,//图例
- xArr:xArr,//x轴
- sArr:sArr//主数据
- };
- //alert(JSON.stringify(opParams))
- chart=getEchart($("#container"),getOption,opParams);
- //监听窗口大小变化
- $(window).resize(function(){
- chart.resize();
- })
- }
-
-
-
- </script>
- </body>
- </html>
|