66ae436461e44127c3ee37133741b7ab3e93aedc.svn-base 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297
  1. /**
  2. * 显示的视图专题
  3. */
  4. var layoutNumber=null;
  5. var cockpit=null;
  6. var de=new Base64();
  7. var dataSourceState=1;
  8. /**
  9. * 解析的参数
  10. */
  11. var urlJson=new Util().resolveUrl();
  12. /**
  13. * 工具类
  14. */
  15. var util=new Util();
  16. /**
  17. *
  18. */
  19. var number=null;
  20. var style="style1";
  21. var styleId=null;
  22. $(function(){
  23. //IE浏览器默认全屏
  24. defaultFullScreen();
  25. //进入页面获取通知单号
  26. $.post(url["http_path"]+"ws/ChartServiceImpl/ChartServiceImpl/getResentWarnningNumberInfo",{compId:urlJson["dept_id"]},function(result){
  27. if(result.rows[0]["RELEASE_RELIEVE_DATE"]!=undefined ||result.rows[1]["RELEASE_RELIEVE_DATE"]!=undefined){
  28. number=result.rows[0]["RELEASE_RELIEVE_DATE"]> result.rows[1]["RELEASE_RELIEVE_DATE"]?result.rows[0]["EARLY_WARNING_ID"]:result.rows[1]["EARLY_WARNING_ID"];
  29. }
  30. init();
  31. showView();
  32. },"json");
  33. });
  34. /**
  35. * 默认全屏操作
  36. */
  37. function defaultFullScreen(){
  38. util.isFullScreen(function(){util.fullScreen();},function(){});
  39. }
  40. /**
  41. * 初始化操作
  42. */
  43. function init(){
  44. cockpit=new Cockpit();
  45. //创建右侧视图容器
  46. $("#i_index_rcontent").find(".c_index_contenthw").each(function(){
  47. cockpit.createMainView($(this));
  48. });
  49. /**
  50. * 加载默认
  51. */
  52. loadDefalutStyle();
  53. //生成样式列表
  54. /* cockpit.createStyleList("",pageStle);*/
  55. //生成左侧头部工具栏
  56. //util.isRole(urlJson["role_id"],de.decode(role["admin"]))||util.isRole(urlJson["role_id"],de.decode(role["sale"]));
  57. cockpit.createTextBar($("#i_index_left_head"),cockpit.getTextBarParam(util.isRole(urlJson["role_id"], de.decode(role["admin"]))||util.isRole(urlJson["role_id"], de.decode(role["sale"]))));
  58. //为左侧工具栏绑定事件
  59. cockpit.bindClickOnTextBar($("#i_index_left_head").find(".c_index_left_head_content"),cockpit.getTextBarParam(util.isRole(urlJson["role_id"], de.decode(role["admin"]))||util.isRole(urlJson["role_id"], de.decode(role["sale"]))));
  60. //生成左侧视图布局列表
  61. //cockpit.createList($("#i_index_left_content"));
  62. //左侧工具栏展开与关闭参数
  63. var barList=[{firstName:"设置",secondtName:"关闭",firstIcon:"c_index_open_list c_index_24_24",secondIcon:"",fn:fn_open_list},
  64. {firstName:"放大",secondtName:"缩小",firstIcon:"c_index_fangda c_index_24_24",secondIcon:"c_index_suoxiao",fn:fn_open_large},
  65. {firstName:"刷新",secondtName:"刷新",firstIcon:"c_index_rend c_index_24_24",secondIcon:"",fn:fn_open_rend}
  66. /* {firstName:"打印",secondtName:"打印",firstIcon:"c_index_fangda c_index_18_18",secondIcon:"c_index_suoxiao",fn:function(contentId){alert("打印");printDom(contentId);}}*/
  67. ];
  68. //生成左侧工具条与设为常用的方法栏
  69. cockpit.createBarList(barList);
  70. //展开和关闭左侧
  71. openAndCloseLeftAside();
  72. $(document).on("click",function(){
  73. if($(".c_index_selectList").size()==0)return;
  74. $(".c_index_selectList").animate({height:"0px"},"1000",function(){
  75. $(".c_index_selectList").remove();
  76. });
  77. });
  78. //判断是否为IE浏览器,如果不是不加载GIS
  79. if ((navigator.userAgent.indexOf('MSIE') >= 0)
  80. && (navigator.userAgent.indexOf('Opera') < 0)){
  81. $("#gis").attr({src:"/nwyj/page/cockpit/webgis/gis.html"+window.location.search});
  82. }else{
  83. //信息提示,不是IE浏览器,不支持GIS展示。
  84. $("#i_index_main_content").empty();
  85. $("#i_index_main_content").append("<div style='top: 50%;left: 50%; margin-left: -100px;margin-top: 15px;height: 30px; width: 250px;color: #00FFE4; position: absolute; font-size: 16px'>不是IE浏览器,不支持GIS展示</div>");
  86. }
  87. }
  88. /**
  89. * 加载默认风格
  90. */
  91. function loadDefalutStyle(){
  92. $.post(url["http_path"]+"ws/MaticServiceImpl/MaticServiceImpl/getDefaultStyle",{userId:urlJson["user_id"]},function(result){
  93. if(result.rows.length>0){
  94. style=result.rows[0]["STYLE"];
  95. styleId=result.rows[0]["FD_OBJECTID"];
  96. }
  97. /**
  98. * 加载默认专题
  99. */
  100. loadDefalut();
  101. },"json");
  102. }
  103. /**
  104. * 加载默认布局
  105. */
  106. function loadDefalut(){
  107. $.post(url["http_path"]+"ws/MaticServiceImpl/MaticServiceImpl/getDefaultLayoutInfo",{screenId:'2',userId:urlJson["user_id"]},function(result){
  108. if(result.total>0){
  109. layoutNumber=result.data;
  110. loadPages(result.rows[0].rows);
  111. }
  112. cockpit.createList($("#i_index_left_content"));
  113. },"json");
  114. }
  115. /**
  116. * 加载默认布局
  117. */
  118. function Cockpit(){}
  119. /**
  120. * 生成样式列表
  121. * @param $dom 存放样式列表的容器
  122. * @param jsonParam 样式列表的数据
  123. */
  124. Cockpit.prototype.createStyleList=function($dom,jsonParam){
  125. if(jsonParam == undefined)throw new Error("createStyleList参数数据不存在");
  126. if($dom==null || typeof $dom==undefined ||$dom=="")
  127. $("body").append("<div id='i_index_styleContent' class='c_index_styleContent'></div>");
  128. var htmlStr="<div><ul>";
  129. for(var item in jsonParam){
  130. htmlStr+="<li data="+item+">"+jsonParam[item].name+"</li>";
  131. }
  132. htmlStr+="</ul></div>";
  133. $("#i_index_left_head").append(htmlStr);
  134. };
  135. /**
  136. * 生成左侧的工具条[{text1:"编辑",text2:"取消编辑",icon1:"".icon2:"",fn1:"",fn:"";}];
  137. * @param $dom 追加节点的父类容器
  138. * @param arrParam 追加节点的参数
  139. */
  140. Cockpit.prototype.createTextBar=function($dom,arrParam){
  141. if(arrParam==undefined || arrParam.length==0)
  142. throw new Error("左侧标题数组为空");
  143. var htmlStr="<div class='c_index_left_head_content'><div id='bi_index_changeLayout' title='切换视图' class='bc_index_changeLayout c_index_changestyle'></div><ul class='c_index_left_head_ul'>";
  144. for(var index=0,len=arrParam.length;index<len;index++){
  145. htmlStr+="<li class='c_index_left_head_li' ><div class='"+arrParam[index]["icon1"]+"' title='"+arrParam[index]["text1"]+"'></div></li>";
  146. }
  147. htmlStr+="</ul><div id='i_index_left_head_list' class='c_index_left_head_list'></div></div>";
  148. $dom.append(htmlStr);
  149. $("#bi_index_changeLayout").data("state","0").on("click",function(){
  150. changeLayoutView($(this).data("state"));
  151. //$(this).data("state",(parseInt($(this).data("state"))+1)%3);
  152. $(this).data("state",(parseInt($(this).data("state"))+1)%2);
  153. });
  154. };
  155. /**
  156. * 切换布局状态
  157. */
  158. function changeLayoutView(state){
  159. /* if(state==0){
  160. showGis();
  161. }else if(state==1){
  162. showViewAndGis();
  163. }else if(state==2){
  164. showView();
  165. }*/
  166. // window.open("/nwyj/page/cockpit/webgis/webgis.html"+window.location.search, "gis地图", "", "");
  167. // window.open("/nwyj/page/cockpit/baidu_map/webgis.html"+window.location.search, "百度地图", "", "");
  168. if(myBrowser().brow == "IE"){
  169. window.open("/nwyj/page/cockpit/webgis/webgis.html"+window.location.search, "gis地图", "", "");
  170. }else{
  171. window.open("/nwyj/page/cockpit/baidu_map/webgis.html"+window.location.search, "百度地图", "", "");
  172. };
  173. }
  174. /**
  175. * 显示GIS
  176. */
  177. function showGis(){
  178. $("#i_index_content3").css({left:"0px",right:"0px",width:"100%",height:"100%"});
  179. $("#i_index_content1").css({width:"0%",height:"0%"});
  180. $("#i_index_content2").css({width:"0%",height:"0%"});
  181. $("#i_index_content4").css({width:"0%",height:"0%"});
  182. $("#i_index_content5").css({width:"0%",height:"0%"});
  183. }
  184. /**
  185. * 显示视图
  186. */
  187. function showView(){
  188. $("#i_index_content3").css({left:"0",right:"0",width:"0%",height:"0%"});
  189. $("#i_index_content1").css({width:"50%",height:"50%"});
  190. $("#i_index_content2").css({width:"50%",height:"50%"});
  191. $("#i_index_content4").css({width:"50%",height:"50%"});
  192. $("#i_index_content5").css({width:"50%",height:"50%"});
  193. }
  194. /**
  195. * 显示GIS和视图
  196. */
  197. function showViewAndGis(){
  198. $("#i_index_content3").css({left:"25%",right:"25%",width:"50%",height:"100%"});
  199. $("#i_index_content1").css({width:"25%",height:"50%"});
  200. $("#i_index_content2").css({width:"25%",height:"50%"});
  201. $("#i_index_content4").css({width:"25%",height:"50%"});
  202. $("#i_index_content5").css({width:"25%",height:"50%"});
  203. }
  204. /**
  205. * 绑定左侧头部的文字事件
  206. * 全屏,退出全屏,修改,解除修改,增加保存
  207. * @param $dom
  208. * @param arrParam
  209. */
  210. Cockpit.prototype.bindClickOnTextBar=function($dom,arrParam){
  211. $dom.find("li").each(function(index,item){
  212. $(this).data("state","1");
  213. $(this).on("click",function(){
  214. if($(this).data("state")==1){
  215. $(this).data("state","2");
  216. arrParam[index].fn1();
  217. $(this).find("div").addClass(arrParam[index]["icon2"]);
  218. }else{
  219. $(this).data("state","1");
  220. arrParam[index].fn2();
  221. $(this).find("div").removeClass(arrParam[index]["icon2"]);
  222. }
  223. });
  224. });
  225. };
  226. /**
  227. * 获取左侧工具条的参数
  228. * @returns {Array}
  229. */
  230. Cockpit.prototype.getTextBarParam=function(flag){
  231. if(!flag){
  232. return [
  233. {text1:"全屏",text2:"退出全屏",icon1:"c_index_16_16 c_index_screen",icon2:"c_index_exitscreen",fn1:function(){util.fullScreenOpration();},fn2:function(){util.fullScreenOpration();}},
  234. {text1:"风格列表",text2:"风格列表",icon1:"c_index_16_16 c_index_style",icon2:"c_index_style1",fn1:function(){openStyleList(pageStyle);},fn2:closeListStyle},
  235. {text1:"人工数据源",text2:"系统数据源",icon1:"c_index_60_30 c_index_system",icon2:"c_index_people",
  236. fn1:function(){dataSourceState=0;changeDataSource();},
  237. fn2:function(){dataSourceState=1;changeDataSource();}}
  238. ];
  239. }else{
  240. return [
  241. {text1:"编辑",text2:"取消编辑",icon1:"c_index_16_16 c_index_edit",icon2:"c_index_cancle_edit",fn1:bindIndexEdit,fn2:function(){cockpit.createList($("#i_index_left_content"));}},
  242. {text1:"全屏",text2:"退出全屏",icon1:"c_index_16_16 c_index_screen",icon2:"c_index_exitscreen",fn1:function(){util.fullScreenOpration();},fn2:function(){util.fullScreenOpration();}},
  243. {text1:"增加",text2:"保存",icon1:"c_index_16_16 c_index_add",icon2:"c_index_index_save",fn1:function(){ showView();indexAddView();},fn2:function(){indexSaveView();}},
  244. {text1:"风格列表",text2:"风格列表",icon1:"c_index_16_16 c_index_style",icon2:"c_index_style1",fn1:function(){openStyleList(pageStyle);},fn2:closeListStyle},
  245. {text1:"人工数据源",text2:"系统数据源",icon1:"c_index_60_30 c_index_system",icon2:"c_index_people",
  246. fn1:function(){dataSourceState=0;changeDataSource();},
  247. fn2:function(){dataSourceState=1;changeDataSource();}}
  248. ];
  249. }
  250. };
  251. /**
  252. * 关闭风格列表
  253. */
  254. function closeListStyle(){
  255. var $dom = $("#i_index_left_head").find(".c_index_styleList");
  256. if($dom.size()>0)$dom.remove();
  257. }
  258. /**
  259. * 展开风格列表方法
  260. */
  261. function openStyleList(jsonParam){
  262. var $dom = $("#i_index_left_head_list").find(".c_index_styleList");
  263. if($dom.size()>0)$dom.remove();
  264. $dom=null;
  265. var htmlStr="<div class='c_index_styleList'><h2 class='c_index_styleList_head'>选择风格类型:</h2><ul>";
  266. for(var item in jsonParam){
  267. htmlStr+="<li data='"+item+"'><div title='"+jsonParam[item]["name"]+"' class='c_index_styleItem "+jsonParam[item]["iconClass"]+"'></div></li>";
  268. }
  269. $("#i_index_left_head_list").append(htmlStr);
  270. $("#i_index_left_head_list").find(".c_index_styleList").find("li").each(function(){
  271. $(this).on("click",function(){
  272. var _style=$(this).attr("data");
  273. style=_style;
  274. changeAllViewStle(_style);
  275. if(styleId!=null){
  276. editUserSelfStyle(styleId,_style);
  277. }else{
  278. saveUserSelfStyle(urlJson["user_id"],_style);
  279. }
  280. return false;
  281. }).on("mouseenter",function(){
  282. var $this=$(this).find("div");
  283. $(this).find("div").addClass("c_moveIn_li").animate({"background-size":"25px",opacity:0.5},"300",function(){
  284. $this.animate({"background-size":"30px",opacity:1},"300");
  285. });
  286. return false;
  287. }).on("mouseleave",function(){
  288. $(this).find("div").removeClass("c_moveIn_li");
  289. return false;
  290. });
  291. });
  292. };
  293. /**
  294. * 保存用户自定义样式列表
  295. */
  296. function saveUserSelfStyle(userId,style){
  297. $.post(url["http_path"]+"ws/MaticServiceImpl/MaticServiceImpl/saveDefaultStyle",{userId:userId,style:style},function(result){
  298. },"json");
  299. }
  300. /**
  301. * 修改用户自定义样式列表
  302. */
  303. function editUserSelfStyle(styleId,style){
  304. $.post(url["http_path"]+"ws/MaticServiceImpl/MaticServiceImpl/editDefaultStyle",{styleId:styleId,style:style},function(result){
  305. },"json");
  306. }
  307. /**
  308. * 加载通知单
  309. */
  310. function loadTongZhiDanData(){
  311. var startTime=param+"-01-01 00:00:00";
  312. var endTime=parseInt(param)+1+"-01-01 23:59:59";
  313. $.post(url["http_path"]+"ws/ChartServiceImpl/ChartServiceImpl/getWarnningNumberInfo",{startTime:startTime,endTime:endTime,compId:urlJson["dept_id"]},function(result){
  314. },"json");
  315. }
  316. /**
  317. * 选择系统数据源
  318. */
  319. function changePeoDataSource(){
  320. var $dom = $("#i_index_left_head_list").find(".c_index_numberContent");
  321. if($dom.size()>0)$dom.remove();
  322. var htmlStr="<div class='c_index_numberContent'><ul>";
  323. htmlStr+="<li><div class='c_index_numberContent_left c_index_year'>起始日期:</div><div class='c_index_numberContent_center'><input type='text' id='i_start_date' class='date dt c_date' dateFmt='yyyy-MM-dd' truetype='date' value='"+getDate(1).startTime+"'/></div>";
  324. htmlStr+="<li><div class='c_index_numberContent_left c_index_year'>截止日期:</div><div class='c_index_numberContent_center'><input type='text' id='i_end_date' class='date dt c_date' dateFmt='yyyy-MM-dd' truetype='date' value='"+getDate(1).endTime+"'/></div>";
  325. htmlStr+="<li><div class='c_index_numberContent_left'>预警单号:</div><div class='c_index_numberContent_center'><div type='input' id='i_index_select_yujingtongzhidan' class='c_index_tongzhidan'/><div id='bi_index_yujingtongzhidan' class='icon_select2 c_index_select'></div></div><div class='c_index_numberContent_right'><div id='bi_index_yujingdanhao_okay' class='c_index_display icon_index_okay c_button_div'></div></div>";
  326. htmlStr+="<li><div class='c_index_numberContent_left'>响应单号:</div><div class='c_index_numberContent_center '><div type='input' id='i_index_select_xiangyingtongzhidan' class='c_index_tongzhidan'/><div id='bi_index_xiangyingtongzhidan' class='icon_select2 c_index_select'></div></div><div class='c_index_numberContent_right'><div id='bi_index_xiangyingdanhao_okay' class='c_index_display icon_index_okay c_button_div'></div></div>";
  327. htmlStr+="</ul></div>";
  328. $("#i_index_left_head_list").append(htmlStr);
  329. $("#i_start_date").render();
  330. $("#i_end_date").render();
  331. $("#i_index_left_content").css({top:"150px"});
  332. loadResentWarnningNumber();
  333. $("#bi_index_xiangyingtongzhidan").on("click",function(){
  334. destorySelectList($(this));
  335. createXiangYingDan();
  336. return false;
  337. });
  338. $("#bi_index_yujingtongzhidan").on("click",function(){
  339. destorySelectList($(this));
  340. createYuJingDan();
  341. return false;
  342. });
  343. $("#bi_index_yujingdanhao_okay").on("click",function(){
  344. number=$("#i_index_select_yujingtongzhidan").text();
  345. changeAllViewData(number);
  346. });
  347. $("#bi_index_xiangyingdanhao_okay").on("click",function(){
  348. number=$("#i_index_select_xiangyingtongzhidan").text();
  349. changeAllViewData(number);
  350. });
  351. $("#bi_index_yujingdanhao_okay").click();
  352. $("#bi_index_xiangyingdanhao_okay").click();
  353. }
  354. /**
  355. * 销毁响应单号的选择列表
  356. */
  357. function destorySelectList($dom){
  358. $("body").not($dom).find(".c_index_selectList").each(function(){
  359. var _this=$(this);
  360. _this.animate({height:"0px"},"1000",function(){
  361. _this.remove();
  362. });
  363. });
  364. }
  365. /**
  366. * 加载响应通知单列表
  367. */
  368. function createXiangYingDan($dom){
  369. var start=$("#i_start_date").val();
  370. var end=$("#i_end_date").val();
  371. //if(end<start) top.Dialog.alert("截止时间大于起始时间,请您从新选择时间段",function(){});
  372. //alert(Date.parse(start));
  373. if(Date.parse(end)<Date.parse(start)) top.Dialog.alert("截止时间小于起始时间,请您从新选择时间段",function(){});
  374. $.post(url["http_path"]+"ws/ChartServiceImpl/ChartServiceImpl/getWarnningNumberInfo",{type:1,startTime:start+" 00:00:00",endTime:end+" 23:59:59",compId:urlJson["dept_id"]},function(result){
  375. if(result.rows.length==0)top.Dialog.alert("此时间段内尚未发布响应",function(){});
  376. createSelectList($("#i_index_select_xiangyingtongzhidan"),result.rows,"EARLY_WARNING_ID");
  377. $("#i_index_select_xiangyingtongzhidan").find("li").on("click",function(){
  378. $("#i_index_select_xiangyingtongzhidan").text($(this).text()).attr("title",$(this).text());
  379. $("#i_index_select_xiangyingtongzhidan").find(".c_index_selectList").remove();
  380. });
  381. },"json");
  382. };
  383. /**
  384. * 加载预警通知单列表
  385. */
  386. function createYuJingDan(){
  387. var start=$("#i_start_date").val();
  388. var end=$("#i_end_date").val();
  389. $.post(url["http_path"]+"ws/ChartServiceImpl/ChartServiceImpl/getWarnningNumberInfo",{type:0,startTime:start+" 00:00:00",endTime:end+" 23:59:59",compId:urlJson["dept_id"]},function(result){
  390. if(result.rows.length==0) top.Dialog.alert("此时间段内尚未发布预警",function(){});
  391. createSelectList($("#i_index_select_yujingtongzhidan"),result.rows,"EARLY_WARNING_ID");
  392. $("#i_index_select_yujingtongzhidan").find("li").on("click",function(){
  393. $("#i_index_select_yujingtongzhidan").text($(this).text()).attr("title",$(this).text());
  394. $("#i_index_select_yujingtongzhidan").find(".c_index_selectList").remove();
  395. });
  396. },"json");
  397. }
  398. /**
  399. * 初始化加载响应列表和预警列表的数据
  400. */
  401. function loadResentWarnningNumber(){
  402. $.ajax({
  403. url:url["http_path"]+"ws/ChartServiceImpl/ChartServiceImpl/getResentWarnningNumberInfo",
  404. data:{compId:urlJson["dept_id"]},
  405. type : 'post',
  406. dataType:"json",
  407. async:false,
  408. success:function(result){
  409. if(result.rows[0]["RELEASE_RELIEVE_DATE"]!=undefined ||result.rows[1]["RELEASE_RELIEVE_DATE"]!=undefined){
  410. number=result.rows[0]["RELEASE_RELIEVE_DATE"]> result.rows[1]["RELEASE_RELIEVE_DATE"]?result.rows[0]["EARLY_WARNING_ID"]:result.rows[1]["EARLY_WARNING_ID"];
  411. }
  412. if(result.rows[0]["EARLY_WARNING_ID"]==undefined){
  413. if($("#i_index_select_xiangyingtongzhidan").size()>0){
  414. $("#i_index_select_xiangyingtongzhidan").text("本年度尚未发布响应预警").attr({title:"本年度尚未发布响应预警"});
  415. }
  416. }else{
  417. if($("#i_index_select_xiangyingtongzhidan").size()>0){
  418. $("#i_index_select_xiangyingtongzhidan").text(result.rows[0]["EARLY_WARNING_ID"]).attr({title:result.rows[0]["EARLY_WARNING_ID"]});
  419. }
  420. }
  421. if(result.rows[1]["EARLY_WARNING_ID"]==undefined){
  422. if($("#i_index_select_yujingtongzhidan").size()>0){
  423. $("#i_index_select_yujingtongzhidan").text("本年度尚未发布响应预警").attr({title:"本年度尚未发布响应预警"});
  424. }
  425. }else{
  426. if($("#i_index_select_yujingtongzhidan").size()>0){
  427. $("#i_index_select_yujingtongzhidan").text(result.rows[1]["EARLY_WARNING_ID"]).attr({title:result.rows[1]["EARLY_WARNING_ID"]});
  428. }
  429. }
  430. },error:function(e){
  431. }
  432. });
  433. /*
  434. $.post(url["http_path"]+"ws/ChartServiceImpl/ChartServiceImpl/getResentWarnningNumberInfo",{compId:urlJson["dept_id"]},function(result){
  435. if(result.rows[0]["RELEASE_RELIEVE_DATE"]!=undefined ||result.rows[1]["RELEASE_RELIEVE_DATE"]!=undefined){
  436. number=result.rows[0]["RELEASE_RELIEVE_DATE"]> result.rows[1]["RELEASE_RELIEVE_DATE"]?result.rows[0]["EARLY_WARNING_ID"]:result.rows[1]["EARLY_WARNING_ID"];
  437. }
  438. if(result.rows[0]["EARLY_WARNING_ID"]==undefined){
  439. if($("#i_index_select_xiangyingtongzhidan").size()>0){
  440. $("#i_index_select_xiangyingtongzhidan").text("本年度尚未发布响应预警").attr({title:"本年度尚未发布响应预警"});
  441. }
  442. }else{
  443. if($("#i_index_select_xiangyingtongzhidan").size()>0){
  444. $("#i_index_select_xiangyingtongzhidan").text(result.rows[0]["EARLY_WARNING_ID"]).attr({title:result.rows[0]["EARLY_WARNING_ID"]});
  445. }
  446. }
  447. if(result.rows[1]["EARLY_WARNING_ID"]==undefined){
  448. if($("#i_index_select_yujingtongzhidan").size()>0){
  449. $("#i_index_select_yujingtongzhidan").text("本年度尚未发布响应预警").attr({title:"本年度尚未发布响应预警"});
  450. }
  451. }else{
  452. if($("#i_index_select_yujingtongzhidan").size()>0){
  453. $("#i_index_select_yujingtongzhidan").text(result.rows[1]["EARLY_WARNING_ID"]).attr({title:result.rows[1]["EARLY_WARNING_ID"]});
  454. }
  455. }
  456. },"json"); */
  457. }
  458. /**
  459. * 生成日期列表
  460. */
  461. function createDateList($dom){
  462. var year=getYear();
  463. var arrTemp=[];
  464. for(var index=0,len=parseInt(year)-startYear+1;index<len;index++){
  465. arrTemp.push({year:startYear+index});
  466. }
  467. createSelectList($dom,arrTemp,"year");
  468. $dom.find("li").on("click",function(){
  469. $dom.text($(this).text());
  470. $dom.find(".c_index_selectList").remove();
  471. ;
  472. });
  473. }
  474. /**
  475. * @param $dom 插入节点的富容器
  476. * @param arrParam 插入节点的数据
  477. * @param label 插入数据指定的标签
  478. */
  479. function createSelectList($dom,arrParam,label){
  480. var $domtemp=$dom.find(".c_index_selectList");
  481. if($domtemp.size()>0)
  482. $domtemp.remove();
  483. $domtemp=null;
  484. var htmlStr="<div class='c_index_selectList'><ul>";
  485. for(var index=0,len=arrParam.length;index<len;index++){
  486. htmlStr+="<li title='"+arrParam[index][label]+"'>"+arrParam[index][label]+"</li>";
  487. }
  488. htmlStr+="</ul></div>";
  489. $htmlStr=$(htmlStr);
  490. $dom.append($htmlStr);
  491. $dom.find(".c_index_selectList").find("li").each(function(){
  492. $(this).on("mouseenter",function(){
  493. $(this).addClass("c_number_color");
  494. }).on("mouseleave",function(){
  495. $(this).removeClass("c_number_color");
  496. });
  497. });
  498. }
  499. /**
  500. * 弹窗动画
  501. */
  502. /**
  503. * 绑定确定按钮点击事件
  504. */
  505. function bindEventOnOkayButton(){
  506. $(".icon_index_okay").on("mouseenter",function(){
  507. $(this).addClass("icon_index_okay2");
  508. }).on("mouseleave",function(){
  509. $(this).removeClass("icon_index_okay2");
  510. });
  511. $(".icon_index_cancle").on("mouseenter",function(){
  512. $(this).addClass("icon_index_cancle2");
  513. }).on("mouseleave",function(){
  514. $(this).removeClass("icon_index_cancle2");
  515. });
  516. }
  517. /**
  518. * 选择人工数据源
  519. */
  520. function changeSysDataSource(){
  521. var $dom = $(".c_index_left_maincontent").find(".c_index_numberContent");
  522. if($dom.size()>0)$dom.remove();
  523. $("#i_index_left_content").css({top:"40px"});
  524. $("#i_index_main").find(".c_index_list").find("iframe").each(function(){
  525. if($(this).get(0).contentWindow.changeSysData!=undefined){
  526. $(this).get(0).contentWindow.changeSysData(number);
  527. }
  528. });
  529. }
  530. /**
  531. * 切换所有视图的风格
  532. */
  533. function changeAllViewStle(key){
  534. $("#i_index_main").find(".c_index_list").find("iframe").each(function(){
  535. if($(this).get(0).contentWindow.rendPage!=undefined){
  536. $(this).get(0).contentWindow.rendPage(key);
  537. }
  538. });
  539. }
  540. /**
  541. *切换所有的数据
  542. */
  543. function changeAllViewData(number){
  544. if(dataSourceState==0){
  545. $("#i_index_main").find(".c_index_list").find("iframe").each(function(){
  546. if($(this).get(0).contentWindow.rendPageData!=undefined){
  547. $(this).get(0).contentWindow.rendPageData(number);
  548. }
  549. });
  550. }else{
  551. changeSysDataSource();
  552. }
  553. };
  554. function changeDataSource(){
  555. if(dataSourceState==0){
  556. changePeoDataSource();
  557. $("#i_index_main").find(".c_index_list").find("iframe").each(function(){
  558. if($(this).get(0).contentWindow.rendPageData!=undefined){
  559. $(this).get(0).contentWindow.rendPageData(number);
  560. }
  561. });
  562. }else{
  563. changeSysDataSource();
  564. }
  565. }
  566. /**
  567. * 展开和关闭侧栏
  568. */
  569. function openAndCloseLeftAside(){
  570. $("#i_index_left_switch").data("state",1);
  571. /**
  572. * 绑定鼠标点击事件
  573. */
  574. $("#i_index_left_switch").on("click",function(){
  575. if($("#i_index_left_switch").data("state")==1){
  576. //$(".c_index_system").parent().data("state",1);
  577. //$(".c_index_system").removeClass("c_index_people");
  578. $("#i_index_left div").hide();
  579. //$(".c_index_styleList").remove();
  580. //changeSysDataSource();
  581. /*$(".c_index_numberContent").hide();
  582. $(".c_index_styleList").hide();*/
  583. //$(".c_index_style").parent().data("state",1);
  584. /* $("#i_index_lcontent").css({"margin-left":"-300"});*/
  585. $("#i_index_rcontent").css({left:"15px"});
  586. $("#i_index_left_switch").css({left:"0px"});
  587. $("#i_index_left_switch").addClass("icon_index_aside_open");
  588. /*$("#i_index_left").off("mouseenter").off("mouseleave");*/
  589. $("#i_index_left_switch").data("state",2);
  590. /*$(".c_index_numberContent").css({display:"none"});
  591. $(".c_index_styleList").css({display:"none"});*/
  592. }else{
  593. /* $("#i_index_left").css({display:"inline-block"});*/
  594. $("#i_index_left div").css({display:"inline-block"});
  595. $("#i_index_left_head_list").css({display:"block"});
  596. $("#i_index_rcontent").css({left:"285px"});
  597. $("#i_index_left_switch").css({left:"262px"});
  598. $("#i_index_left_switch").removeClass("icon_index_aside_open");
  599. $("#i_index_left_switch").data("state",1);
  600. }
  601. });
  602. /* $("#i_index_left_switch").hide();
  603. mouseEnterAndLeave();
  604. */
  605. }
  606. /**
  607. * 鼠标移入移出事件
  608. */
  609. function mouseEnterAndLeave(){
  610. $("#i_index_left").on("mouseenter",function(){
  611. /*if($("#i_index_left_switch").data("state")==1){*/
  612. $("#i_index_left_switch").show();
  613. /*}*/
  614. }).on("mouseleave",function(){
  615. /*if($("#i_index_left_switch").data("state")==1){*/
  616. $("#i_index_left_switch").hide();
  617. /*}*/
  618. });
  619. }
  620. /**
  621. * 增加视图
  622. */
  623. function indexAddView(){
  624. $("#i_index_rcontent").find(".c_index_list").each(function(){
  625. $(this).attr("fd_objectid","000000");
  626. $(this).find(".c_index_view5").find("iframe").attr({"src":"about:blank"});
  627. });
  628. }
  629. /**
  630. * 保存视图
  631. */
  632. function indexSaveView(param){
  633. /**
  634. * 弹窗保存
  635. */
  636. function fn1(text){
  637. var temp=indexGetAddViewParam();
  638. var saveView={name:text,
  639. userId:urlJson["user_id"],
  640. roleId:urlJson["role_id"],
  641. conId:temp.conId,
  642. maticId:temp.maticId,
  643. screenState:2};
  644. $.post(url["http_path"]+"ws/MaticServiceImpl/MaticServiceImpl/saveViewInfo",saveView,function(result){
  645. cockpit.createList($("#i_index_left_content"));
  646. temp();
  647. },"json");
  648. alt.destory();
  649. return;
  650. }
  651. function temp(){
  652. changeLayoutView((parseInt($("#bi_index_changeLayout").data("state"))+2)%3);
  653. }
  654. function fn2(text){
  655. /*temp();*/
  656. alt.destory();
  657. top.destoryIframeContent("i_index_maticlist");
  658. }
  659. var alt=new Alert({ok:fn1,cancle:fn2},
  660. {text:"视图名称: ",input:true});
  661. //创建节点
  662. alt.create("");
  663. }
  664. /**
  665. * 获取保存视图的参数
  666. */
  667. function indexGetAddViewParam(){
  668. var conId=[];
  669. var maticId=[];
  670. /*{"TM_URL":"page/cockpit/equipment_loss/equipment_loss_chart.html",
  671. "FD_OBJECTID":"0000005","UPDATEDATE":"0",
  672. "TM_AREAID":"0002",
  673. "AREA_NAME":"设备受损区",
  674. "TM_NAME":"设备损失统计图",
  675. "TM_USE":"1",
  676. "TM_IMGURL":"_icon_url_bar",
  677. "TM_LAYERID":"61","SC_DEPT_ID":"0","TM_BEX":"0","IS_DEL":"0"};*/
  678. $("#i_index_rcontent").find(".c_index_list").each(function(){
  679. conId.push($(this).attr("id"));
  680. if($(this).attr("fd_objectid")==undefined){
  681. maticId.push("0000");
  682. }else{
  683. maticId.push($(this).attr("fd_objectid"));
  684. }
  685. });
  686. return {conId:conId.join("-"),maticId:maticId.join("-")};
  687. }
  688. /**
  689. * 绑定编辑事件
  690. * @returns
  691. */
  692. function bindIndexEdit(){
  693. //判断是否为客户自定义的视图,如果为默认视图绑定客户自定义视图的事件
  694. if($("#i_index_left_content").find("ul[data='V_OFTEN']").size()>0){
  695. $("#i_index_left_content").find("ul[data='V_OFTEN']").eq(0).find(".c_index_list_item_li").each(function(){
  696. $(this).on("mouseenter",createIndeEdit).on("mouseleave",deleteIndexEdit);
  697. });
  698. }
  699. if(util.isRole(urlJson["role_id"], de.decode(role["admin"]))){
  700. if($("#i_index_left_content").find("ul[data='V_SYSTEM']").size()>0){
  701. $("#i_index_left_content").find("ul[data='V_SYSTEM']").eq(0).find(".c_index_list_item_li").each(function(){
  702. $(this).on("mouseenter",createIndeEdit).on("mouseleave",deleteIndexEdit);
  703. });
  704. }
  705. return false;
  706. }
  707. //判断是否为默认的视图,如果为默认视图绑定默认视图的事件
  708. if($("#i_index_left_content").find("ul[data='V_SYSTEM']").size()>0){
  709. createIndexSetOften(function(arrParam){
  710. $("#i_index_left_content").find("ul[data='V_SYSTEM']").eq(0).find(".c_index_list_item_li").each(function(){
  711. $(this).find("div.c_index_list_item_text").addClass("c_index_list_item_textAftershowBar");
  712. if(arrParam.indexOf($(this).data("data")["FD_OBJECTID"])>-1){
  713. $(this).append("<div class='c_index_list_item_showBar'><div class='c_index_list_item_often'></div></div>");
  714. }else{
  715. $(this).append("<div class='c_index_list_item_showBar'><div class='c_index_list_item_unoften'></div></div>");
  716. }
  717. });
  718. setOftenLayoutAndView();
  719. });
  720. }
  721. return false;
  722. }
  723. /**
  724. * 设置为常用视图
  725. */
  726. function setOftenLayoutAndView(){
  727. $("#i_index_left_content").find(".c_index_list_item_unoften").each(function(){
  728. $(this).on("click",function(){
  729. $.post("/nwyj/ws/MaticServiceImpl/MaticServiceImpl/setOftenLayoutAndViewInfo",
  730. {screenState:"2",userId:urlJson["user_id"],fd_objectId:$(this).parents(".c_index_list_item_li").data("data")["FD_OBJECTID"]},function(result){
  731. cockpit.createList($("#i_index_left_content"));
  732. },"json");
  733. });
  734. });
  735. return false;
  736. }
  737. /**
  738. * 删除编辑事件生成的节点
  739. */
  740. function deleteIndexEdit(){
  741. $(this).find(".c_index_list_item_text").removeClass("c_index_list_item_textAftershowBar");
  742. if($(this).find(".c_index_list_item_showBar").size()>0){
  743. $(this).find(".c_index_list_item_showBar").remove();
  744. }
  745. }
  746. /**
  747. * 增加编辑事件节点,修改,删除,设为默认,并未节点绑定事件
  748. */
  749. function createIndeEdit(){
  750. var arrParam=[{text:"设为默认",icon:"c_index_18_18 icon_index_edit_setdefault",fn:setDefaultLayoutAndView},
  751. {text:"删除",icon:"c_index_18_18 icon_index_edit_delete",fn:deleteLayoutAndView},
  752. {text:"修改",icon:"c_index_18_18 icon_index_edit_edit",fn:editLayoutAndView}
  753. ];
  754. indexEdit($(this),arrParam);
  755. }
  756. /**
  757. * 修改专题和视图
  758. */
  759. function editLayoutAndView($dom){
  760. var $tempdom =$dom.parents(".c_index_list_item_li");
  761. $tempdom.find(".c_index_list_item_text").find("span").hide();
  762. $tempdom.find(".c_index_list_item_text").prepend("<div class='c_edit_layoutItem_content'><input type='text' class='c_index_layoutItem_text' title='视图名称不超过30个汉字' value='"
  763. +$tempdom.find(".c_index_list_item_text").find("span").text()+"' id='i_index_layoutItem_text'/><div class='c_index_layoutItem_save icon_index_edit_save' id='i_index_layoutItem_save'/></div>");
  764. /* $("#i_index_layoutItem_text").on("focus",function(e){
  765. //$(this).get(0).value="";
  766. return false;
  767. });*/
  768. $("#i_index_layoutItem_text").on("click",function(){return false;});
  769. $("#i_index_layoutItem_save").on("click",function(e){
  770. editAndSaveLayoutAndView();
  771. return false;});
  772. }
  773. /**
  774. * 修改并保存布局与视图
  775. */
  776. function editAndSaveLayoutAndView(){
  777. var $tempdom=$("#i_index_layoutItem_save").parents("li.c_index_list_item_li");
  778. var objectId=$("#i_index_layoutItem_save").parents("li.c_index_list_item_li").data("data")["FD_OBJECTID"];
  779. var name=$("#i_index_layoutItem_text").val();
  780. var temp=indexGetAddViewParam();
  781. var saveView={
  782. userId:urlJson["user_id"],
  783. objectId:objectId,
  784. conId:temp.conId,
  785. name:name,
  786. maticId:temp.maticId,
  787. screenState:2};
  788. top.Dialog.confirm("是否修改专题视图",function(){
  789. $.post("/nwyj/ws/MaticServiceImpl/MaticServiceImpl/editLayouAndViewInfo",saveView,function(result){
  790. cockpit.createList($("#i_index_left_content"));
  791. bindIndexEdit();
  792. },"json");
  793. },function(){
  794. $tempdom.find(".c_index_list_item_text").find("span").show();
  795. $tempdom.find(".c_index_list_item_text").find(".c_edit_layoutItem_content").remove();
  796. });
  797. }
  798. /**
  799. * 设为常用视图专题
  800. */
  801. function createIndexSetOften(fn,state){
  802. if(state==1){
  803. top.Dialog.confirm("是否设为常用专题",function(){
  804. $.post("/nwyj/ws/MaticServiceImpl/MaticServiceImpl/getOftenLayoutAndViewInfo",{screenState:"2",userId:urlJson["user_id"]},function(result){
  805. fn(result.rows.join("-"));
  806. },"json");
  807. },function(){});
  808. }else{
  809. $.post("/nwyj/ws/MaticServiceImpl/MaticServiceImpl/getOftenLayoutAndViewInfo",{screenState:"2",userId:urlJson["user_id"]},function(result){
  810. fn(result.rows.join("-"));
  811. },"json");
  812. }
  813. };
  814. /**
  815. *设置默认布局
  816. */
  817. function setDefaultLayoutAndView($dom){
  818. var cockpitID=$dom.parents(".c_index_list_item_li").data("data")["FD_OBJECTID"];
  819. top.Dialog.confirm("是否设为默认专题",function(){
  820. $.post(url["http_path"]+"ws/MaticServiceImpl/MaticServiceImpl/setDefaultViewInfo",{screenState:"2",fd_objectid:cockpitID,userId:urlJson["user_id"],roleId:urlJson["role_id"]},function(result){
  821. },"json");
  822. },function(){});
  823. }
  824. /**
  825. * 删除布局
  826. */
  827. function deleteLayoutAndView($dom){
  828. var cockpitID=$dom.parents(".c_index_list_item_li").data("data")["FD_OBJECTID"];
  829. top.Dialog.confirm("是否删除视图",function(){
  830. $.post(url["http_path"]+"ws/MaticServiceImpl/MaticServiceImpl/deleteViewInfo",{screenState:"2",fd_objectid:cockpitID},function(result){
  831. cockpit.createList($("#i_index_left_content"));
  832. },"json");
  833. },function(){});
  834. }
  835. /**
  836. * 追加编辑事件触发的节点
  837. */
  838. function indexEdit($dom,arrParam){
  839. if($dom.find(".c_index_list_item_showBar").size()>0){
  840. $dom.find(".c_index_list_item_showBar").remove();
  841. }
  842. $dom.find(".c_index_list_item_text").addClass("c_index_list_item_textAftershowBar");
  843. var htmlStr="<div class='c_index_list_item_showBar'><ul>";
  844. for(var index=0,len=arrParam.length;index<len;index++){
  845. htmlStr+="<li><div class='"+arrParam[index]["icon"]+"' title='"+arrParam[index]["text"]+"'></div></li>";
  846. };
  847. $dom.append(htmlStr);
  848. $dom.find(".c_index_list_item_showBar").find("li").each(function(i,item){
  849. $(this).on("click",function(){
  850. arrParam[i].fn($(this));
  851. return false;
  852. });
  853. });
  854. /* $dom.find(".c_index_list_item_showBar").find("ul").eq(1).find("li").each(function(i,item){
  855. $(this).on("click",function(){
  856. arrParam[i].fn($(this));
  857. });
  858. });*/
  859. }
  860. /**
  861. * 填充单个视图
  862. * @param $dom 视图容器
  863. */
  864. Cockpit.prototype.createMainView=function($dom){
  865. var htmlStr=
  866. '<div class="aaaaa"></div><div class="c_index_view1 c_index_view c_view_pic_zs "></div><div class="c_index_view2 c_index_view c_view_pic_zx" ></div><div class="c_index_view3 c_index_view c_view_pic_ys "></div>'+
  867. '<div class="c_index_view4 c_index_view c_view_pic_yx"></div><div class="c_index_viewh1 c_view_pic_sz"></div><div class="c_index_viewh2 c_view_pic_sy"></div>'+
  868. '<div class="c_index_viewv1 c_view_pic_hs"></div><div class="c_index_viewv2 c_view_pic_hx"></div><div class="c_index_view5"><iframe src="" name="" class="c_view_iframeContent" marginwidth="0px" marginheight="0px"></div>';
  869. $dom.append(htmlStr);
  870. htmlStr=null;
  871. };
  872. /**
  873. * 鼠标移入移出生成工具条列表
  874. * @param arrParam
  875. */
  876. //[{firstName:"展开",secondtName:"",firstIcon:"",secondIcon:"",fn:null}];
  877. Cockpit.prototype.createBarList=function(arrParam){
  878. $("#i_index_rcontent").find(".c_index_list").on("mouseenter",function(){
  879. var _this=this;
  880. if($(this).find(".c_list_content").size()>0){
  881. $(this).find(".c_list_content").remove();
  882. }
  883. var htmlStr="<div class='c_list_content'><ul>";
  884. for(var index=0,len=arrParam.length;index<len;index++){
  885. htmlStr+="<li ><div class='"+arrParam[index]["firstIcon"]+"' title="+arrParam[index]["firstName"]+"></div></li>";
  886. }
  887. htmlStr+="</ul></div>";
  888. $(_this).append(htmlStr);
  889. onClickList($(_this),arrParam);
  890. }).on("mouseleave",function(){
  891. if($(this).find(".c_list_content").size()>0){
  892. $(this).find(".c_list_content").remove();
  893. }
  894. $domContent=null;
  895. });
  896. };
  897. /**
  898. * 展开选择菜单列表
  899. * @param contentId 容器ID
  900. */
  901. function fn_open_list(contentId){
  902. if($("body").find("#i_index_maticlist").size()>0){
  903. $("body").find("#i_index_maticlist").remove();
  904. }
  905. var htmlStr="<div id='i_index_maticlist' class='c_index_maticlist'>";
  906. htmlStr +="<iframe id='i_index_iframe' name='i_index_iframe' class='c_index_iframe' scrolling='no' src='"+url["http_path"]+"page/cockpit/maticList/maticListZym.html?contentId="+contentId+"&&dept_id="+urlJson["dept_id"]+"' name='test' frameborder='0' >您的浏览器不支持框架,请升级您的浏览器以便正常访问脚本之家</iframe>";
  907. htmlStr+="</div>";
  908. $("body").append(htmlStr);
  909. }
  910. /**
  911. * 放大和缩小功能
  912. * @param contentId 容器ID
  913. * fangdaState:1为缩小状态,2为放大状态
  914. */
  915. function fn_open_large(contentId){
  916. if($("#"+contentId).data("fangdaState")==undefined || $("#"+contentId).data("fangdaState")==1){
  917. $("#"+contentId).data("cssWH",{"width":Math.round(parseInt($("#"+contentId).css("width"))/parseInt($("#"+contentId).parent().css("width"))*100)+"%",
  918. "height":Math.round(parseInt($("#"+contentId).css("height"))/parseInt($("#"+contentId).parent().css("height"))*100)+"%"});
  919. $("#"+contentId).addClass("c_index_large").css({"width":"100%","height":"100%"}).data("fangdaState","2");
  920. }else{
  921. $("#"+contentId).removeClass("c_index_large").css($("#"+contentId).data("cssWH")).data("fangdaState","1");
  922. }
  923. }
  924. /**
  925. * 刷新功能
  926. * @param contentId 容器ID
  927. */
  928. function fn_open_rend(contentId){
  929. var frame = $("#"+contentId).find("iframe").get(0);
  930. frame.contentWindow.document.location.reload();
  931. };
  932. /*function printDom(contentId){
  933. $($("#"+contentId).find("iframe").get(0).contentWindow.document).find("body").jqprint();
  934. var iframeWindow=$("#"+contentId).find("iframe").get(0).contentWindow;
  935. if(iframeWindow!=undefined || iframeWindow!=null){
  936. if($("#i_iframe_print").size()>0){
  937. $("#i_iframe_print").remove();
  938. }
  939. var $iframe=$('<iframe id="i_iframe_print" src="/nwyj/page/cockpit/print.html" style="width:400px;height:400px;" marginwidth="0px" marginheight="0px">');
  940. $iframe.appendTo($("body"));
  941. var opener=$iframe.get(0).contentWindow;
  942. $(opener).on("load",function(){
  943. var canvas=opener.document.querySelector("canvas");
  944. html2canvas($(iframeWindow.document).find("html"), {canvas:canvas,removeContainer:false,allowTaint:false}).then(function(canvas) {
  945. opener.print();
  946. });
  947. });
  948. }else{
  949. alert("iframeweikong");
  950. }
  951. }*/
  952. /**height:inherit
  953. * 关闭父容器的iframe容器
  954. * @param contentId
  955. * @returns
  956. */
  957. function destoryIframeContent(contentId){
  958. if($("#"+contentId).size()>0){
  959. $("#"+contentId).remove();
  960. }
  961. }
  962. /**
  963. * 改变视图容器的链接地址
  964. */
  965. function changeSite(id,jsonParam){
  966. var $dom=$("#"+id);
  967. $dom.attr("fd_objectid",jsonParam["FD_OBJECTID"]);
  968. /* if(jsonParam["TM_URL"].indexOf("http://")==0){*/
  969. loadPage($dom.find(".c_index_view5").find("iframe"),jsonParam["TM_URL"]);
  970. /* }else{
  971. loadPage($dom.find(".c_index_view5").find("iframe"),url.path+jsonParam["TM_URL"]);
  972. }*/
  973. }
  974. /**
  975. * loadPage
  976. */
  977. function loadPage($dom,siteString){
  978. var param={style:style,title:urlJson["dept_name"],number:number};
  979. if(siteString.indexOf("http://")==0){
  980. $dom.parent().css({top:"30px"});
  981. handleOutWebsite($dom, siteString);
  982. //$dom.attr("src",siteString);
  983. }else{
  984. $dom.parent().css({top:"6px"});
  985. param.dataSourceState=dataSourceState;
  986. /* alert(JSON.stringify(param));*/
  987. $dom.attr("src",url.path+siteString+window.location.search+"&&"+encodeURI($.param(param)));
  988. }
  989. }
  990. function handleOutWebsite($dom,siteString){
  991. // debugger;
  992. if(XMLContext[siteString.trim()]==undefined){
  993. $dom.attr("src",siteString);
  994. return;
  995. }
  996. XMLContext[siteString.trim()]($dom,siteString);
  997. }
  998. /**
  999. * 方法汇总
  1000. */
  1001. /**
  1002. * 给工具条绑定点击事件
  1003. */
  1004. function onClickList($dom,arrParam){
  1005. $dom.find("li").each(function(i){
  1006. $(this).data("data",arrParam[i]).data("state",1);
  1007. //绑定点击事件
  1008. $(this).on("click",function(){
  1009. if( $(this).data("state")==1){
  1010. $(this).find("div").addClass($(this).data("data")["secondIcon"]);
  1011. $(this).data("state")==2;
  1012. }else{
  1013. $(this).find("div").removeClass($(this).data("data")["secondIcon"]);
  1014. }
  1015. $(this).data("state",1);
  1016. $(this).data("state",2);
  1017. $(this).data("data").fn($(this).parents("div[id^='i_index_content']").attr("id"));
  1018. });
  1019. });
  1020. }
  1021. /**
  1022. * 创建左侧视图选择列表
  1023. */
  1024. Cockpit.prototype.createList=function($dom,arrParam){
  1025. /* {"SL_NAME":"2015雨雪冰冻灾害演练因灾损失统计","SL_PARAMENT":[{"column":"50%","SCREEN_STATE":"1","IS_COMMONUSE":"0",
  1026. "SL_USERID":"R002105430214","FD_OBJECTID":"1018",
  1027. "UPDATEDATE":"2015-12-19 23:10:19.247","IS_USE":"","TM_BEX":"0","IS_DEL":"0","SL_LAYOUTID":"0"}
  1028. }*/
  1029. $.post(url["http_path"]+"ws/MaticServiceImpl/MaticServiceImpl/getLayoutInfo",{screenId:"2",userId:urlJson["user_id"],roleId:urlJson["role_id"]},function(result){
  1030. if(result["state"]=="SUCCESS"){
  1031. var arrResult=[];
  1032. if(result.rows.length>1){
  1033. if(result.rows[0]["name"]=="R002105430214"){
  1034. arrResult.push(result.rows[1]);
  1035. arrResult.push(result.rows[0]);
  1036. }else{
  1037. arrResult.push(result.rows[0]);
  1038. arrResult.push(result.rows[1]);
  1039. }
  1040. }else{
  1041. arrResult=result.rows;
  1042. }
  1043. cockpit.createUlList($dom, arrResult, viewListClick);
  1044. /***
  1045. *
  1046. * 再次加载列表时绑定事件
  1047. *
  1048. *
  1049. * **/
  1050. if($(".c_index_edit").parent().data("state")==2){
  1051. bindIndexEdit();
  1052. }
  1053. }else{
  1054. top.Dialog.alert("加载数据失败",function(){});
  1055. }
  1056. ;
  1057. },"json");
  1058. };
  1059. /**
  1060. * 创建ul-li列表
  1061. * @param $dom
  1062. * @param arrParam
  1063. * @param fn
  1064. */
  1065. Cockpit.prototype.createUlList=function($dom,arrParam,fn){
  1066. $dom.empty();
  1067. if(arrParam.length==0)
  1068. $dom.append("<div>目前尚无列表数据</div>");
  1069. for(var index=0 ,len=arrParam.length;index<len;index++){
  1070. if(arrParam[index].rows.length==0)
  1071. continue;
  1072. var ulTitle=null;
  1073. var type=null;
  1074. if(arrParam[index]["name"]=="R002105430214"){
  1075. ulTitle="默认专题";
  1076. type="V_SYSTEM";
  1077. }else{
  1078. ulTitle="常用专题";
  1079. type="V_OFTEN";
  1080. }
  1081. if($dom.find("ul").size()==0){
  1082. $dom.append("<div class='c_index_list_ul1_headz icon_index_list_ul1_headz'></div>" +
  1083. "<div class='c_index_list_ul1_headc icon_index_list_ul1_headc'></div>" +
  1084. "<div><div class='c_index_list_ul1_heady icon_index_list_ul1_heady'></div>" +
  1085. "<div class='c_index_list_ul_head1'>"+ulTitle+"</div>");
  1086. }else{
  1087. $dom.append("<div class='c_index_list_ul1_headz icon_index_list_ul2_headz'></div>" +
  1088. "<div class='c_index_list_ul1_headc icon_index_list_ul2_headc'></div>" +
  1089. "<div class='c_index_list_ul1_heady icon_index_list_ul2_heady'></div>" +
  1090. "<div class='c_index_list_ul_head1 c_index_list_ul_head2'>"+ulTitle+"</div>");
  1091. }
  1092. this.createUlLi($dom,arrParam[index].rows,type,fn);
  1093. }
  1094. };
  1095. /**
  1096. * 点击视图列表加载布局
  1097. * @param jsonParam
  1098. */
  1099. function viewListClick(jsonParam){
  1100. /**
  1101. * 判断是否为增加视图状态
  1102. * 如果为增加视图状态则恢复常规状态
  1103. */
  1104. if($(".c_index_add").size()>0 && $(".c_index_add").parent().data("state")==2){
  1105. $(".c_index_add").parent().data("state",($(".c_index_add").parent().data("state")+1)%2);
  1106. $(".c_index_add").removeClass("c_index_index_save");
  1107. }
  1108. /**
  1109. * 加载页面
  1110. */
  1111. layoutNumber=jsonParam["FD_OBJECTID"];
  1112. $.post(url["http_path"]+"ws/MaticServiceImpl/MaticServiceImpl/getViewInfo",{fd_objectid:jsonParam["FD_OBJECTID"]},function(result){
  1113. /*indexAddView();*/
  1114. loadPages(result.rows);
  1115. },"json");
  1116. }
  1117. /**
  1118. * 加载四张页面
  1119. * @param 四张布局的参数
  1120. */
  1121. function loadPages(arrParam){
  1122. $("#i_index_rcontent").find(".c_index_list").each(function(){
  1123. var flag=true;
  1124. for(var index=0,len=arrParam.length;index<len;index++){
  1125. if($(this).attr("id")==arrParam[index]["OL_CONID"]){
  1126. $(this).attr("fd_objectid",arrParam[index]["OL_MATICID"]);
  1127. $(this).find("iframe").attr("name",$(this).attr("id"));
  1128. loadPage($(this).find("iframe"),arrParam[index]["TM_URL"]);
  1129. flag=false;
  1130. continue;
  1131. };
  1132. };
  1133. if(flag)$(this).find("iframe").attr("src","about:blank").removeAttr("name");
  1134. });
  1135. }
  1136. /**
  1137. * @param $dom 追加节点的容器
  1138. * @param arrParam 追加节点的数据
  1139. * @param fn 追加节点的回调函数
  1140. */
  1141. Cockpit.prototype.createUlLi=function($dom,arrParam,type,fn){
  1142. if(arrParam.length==0)
  1143. throw new Error("创建列表的数组长度为0");
  1144. var ulStr="<ul class='c_index_left_content_ul' data="+type+">";
  1145. for(var index=0,len=arrParam.length;index<len;index++){
  1146. ulStr+="<li class='c_index_list_item_li'><div class='c_index_list_item_text'><span title='"+arrParam[index]["SL_NAME"]+"'>"+arrParam[index]["SL_NAME"]+"</span></div></li>";
  1147. }
  1148. ulStr+="</ul>";
  1149. $dom.append(ulStr);
  1150. if((typeof fn)!="function"){
  1151. return;
  1152. }
  1153. $dom.find("ul").last().find("li").each(function(i){
  1154. if(layoutNumber!=null && layoutNumber==arrParam[i]["FD_OBJECTID"]){
  1155. $(this).addClass("c_click_view_item");
  1156. }
  1157. $(this).data("data",arrParam[i]).on("click",function(){
  1158. fn($(this).data("data"));
  1159. if($dom.find("li.c_click_view_item").size()>0){
  1160. $dom.find("li.c_click_view_item").removeClass("c_click_view_item");
  1161. }
  1162. $(this).addClass("c_click_view_item");
  1163. });
  1164. });
  1165. $dom.find(".c_index_list_item_li").on("mouseenter",function(){
  1166. $(this).addClass("c_index_list_item_li_hover");
  1167. //var $dom=$(this).find("span");
  1168. /* $(this).find("span").animate({"margin":"-80px",opacity:0.1},"400",function(){
  1169. $dom.css({"margin-left": "180px"});
  1170. $dom.animate({"margin":"0px",opacity:1},"400");
  1171. });*/
  1172. }).on("mouseleave",function(){
  1173. $(this).removeClass("c_index_list_item_li_hover");
  1174. });
  1175. };
  1176. function getYear(){
  1177. var date=allGetServerTime();
  1178. return date.getFullYear();
  1179. }