dbc6e1d81b6722ba8eb4194d685d2e8e08c1e9dd.svn-base 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911
  1. // 监听浏览器窗口大小的改变,样式进行相应的调整
  2. var wid = window.screen.width-50;
  3. $(window).resize(function() {
  4. var wwww = $(window).width();
  5. if(wwww <= wid){
  6. $("html").css({"min-width":wid+"px","height":"100%","overflow":"auto","overflow-x":""});
  7. }else{
  8. $("html").css({"width":"100%","height":"100%","overflow":"scroll","overflow-x":"hidden"});
  9. }
  10. wwww = null;
  11. });
  12. //获取后台服务器时间
  13. var serverTime;
  14. //用于记录定时器次数,从而执行方法获取待办数量
  15. var numFlag = 0;
  16. //用于记录定时器次数,从而执行方法获取待办数量
  17. var numFlag1 = 0;
  18. var _interval;//定时器对象
  19. function showSubMenu(){
  20. var time = null;
  21. var box = $("#navbox");
  22. var lista = $(".yj_menu_hover");
  23. /*
  24. for(var i=0,j=lista.length;i<j;i++){
  25. if(lista.eq(i).hasClass("nowCurrent")){
  26. olda = i;
  27. }
  28. }*/
  29. var box_show = function(hei){
  30. box.stop().animate({
  31. height:hei,
  32. opacity:1
  33. },50);
  34. };
  35. var box_hide = function(){
  36. box.stop().animate({
  37. height:0,
  38. opacity:0
  39. },50);
  40. };
  41. lista.hover(function(){
  42. lista.removeClass("nowCurrent");
  43. $(this).addClass("nowCurrent");
  44. clearTimeout(time);
  45. var index = $(this).attr("data_index");
  46. box.find(".hover_cont").hide();
  47. $("#submenu"+index).show();
  48. var _height = $("#submenu"+index).height()+54;
  49. box_show(_height);
  50. },function(){
  51. time = setTimeout(function(){
  52. box.find(".hover_cont").hide();
  53. box_hide();
  54. },0);
  55. lista.removeClass("nowCurrent");
  56. //lista.eq(olda).addClass("nowCurrent");
  57. });
  58. box.find(".hover_cont").hover(function(){
  59. var _index = $(this).attr("data_index");
  60. lista.removeClass("nowCurrent");
  61. $("#yj_menu_hover_"+_index).addClass("nowCurrent");
  62. clearTimeout(time);
  63. $(this).show();
  64. var _height = $(this).height()+54;
  65. box_show(_height);
  66. },function(){
  67. time = setTimeout(function(){
  68. $(this).hide();
  69. box_hide();
  70. },0);
  71. lista.removeClass("nowCurrent");
  72. //lista.eq(olda).addClass("nowCurrent");
  73. });
  74. /*
  75. // 鼠标悬停显示下拉菜单
  76. $($menu).parent().on("mouseenter",function(){
  77. $(".hover_cont").hide();
  78. $(this).find(".yj_menu_hover").css("background-color","#0f4a8b");
  79. $(this).find(".hover_cont").show();
  80. });
  81. $($menu).parent().on("mouseleave",function(){
  82. $(this).find(".yj_menu_hover").css("background-color","");
  83. $(this).find(".hover_cont").hide();
  84. });*/
  85. // 点击三级菜单,变色以显示访问记录
  86. $(".hover_cont .nav_li_r a").on("click",function(){
  87. $(".nowCurrent1").removeClass("nowCurrent1");
  88. var _index = $(this).parent().parent().parent().parent().attr("data_index");
  89. $("#yj_menu_hover_"+_index).addClass("nowCurrent1");
  90. $(".hover_cont .nav_li_r a").css("color","#0066CC");
  91. $(this).css("color","#9700ad");
  92. });
  93. $(".hover_cont .nav_li_r a").on("mouseover",function(){
  94. $(this).css({"background-color":"#ddd"});
  95. });
  96. $(".hover_cont .nav_li_r a").on("mouseout",function(){
  97. $(this).css("background-color","");
  98. });
  99. $menu = null;
  100. }
  101. /********************************************平台日期时间 start**************************************************/
  102. function showTime(timestr){
  103. if($("#time").text()==""){
  104. $("#time").html("<font size=2pt color=ffffff>"+timestr+"</font>");
  105. }else{
  106. $("#time font").text(timestr);
  107. }
  108. }
  109. /**
  110. * 字符串转时间(yyyy-MM-dd HH:mm:ss)
  111. * result (分钟)
  112. */
  113. String.prototype.stringToDate = function(){
  114. return new Date(Date.parse(this.replace(/-/g, "/")));
  115. };
  116. /**
  117. * 获取服务器时间
  118. * @returns {String}
  119. */
  120. function getServerTime(){
  121. var nowTime = "";
  122. $.ajax({//后台获取系统当前时间
  123. url :'/nwyj/ws/response/responseService/getNowTime',
  124. type : 'post',
  125. dataType : 'text',
  126. async : false,
  127. timeout : 6000,
  128. success : function(result){
  129. nowTime=result;
  130. },error : function(e){
  131. return;
  132. }
  133. });
  134. return nowTime;
  135. }
  136. /**
  137. * 通过日期时间字符串获取下一秒时间
  138. * 返回字符串
  139. * @param timeStr
  140. */
  141. function getNowTimeForTimeStr(timeStr){
  142. timeStr = timeStr.stringToDate();
  143. var newDate = Date.parse(timeStr)+1000;
  144. var result = getFormatDateByLong(newDate,"yyyy年MM月dd日 hh:mm:ss");
  145. serverTime = getFormatDateByLong(newDate,"yyyy-MM-dd hh:mm:ss");
  146. return result;
  147. }
  148. //扩展Date的format方法
  149. Date.prototype.format = function (format) {
  150. var o = {
  151. "M+": this.getMonth() + 1,
  152. "d+": this.getDate(),
  153. "h+": this.getHours(),
  154. "m+": this.getMinutes(),
  155. "s+": this.getSeconds(),
  156. "q+": Math.floor((this.getMonth() + 3) / 3),
  157. "S": this.getMilliseconds()
  158. };
  159. if (/(y+)/.test(format)) {
  160. format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  161. }
  162. for (var k in o) {
  163. if (new RegExp("(" + k + ")").test(format)) {
  164. format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
  165. }
  166. }
  167. return format;
  168. };
  169. /**
  170. *转换long值为日期字符串
  171. * @param l long值
  172. * @param pattern 格式字符串,例如:yyyy-MM-dd hh:mm:ss
  173. * @return 符合要求的日期字符串
  174. */
  175. function getFormatDateByLong(l, pattern) {
  176. return getFormatDate(new Date(l), pattern);
  177. }
  178. /**
  179. *转换日期对象为日期字符串
  180. * @param l long值
  181. * @param pattern 格式字符串,例如:yyyy-MM-dd hh:mm:ss
  182. * @return 符合要求的日期字符串
  183. */
  184. function getFormatDate(date, pattern) {
  185. if (date == undefined) {
  186. date = new Date();
  187. }
  188. if (pattern == undefined) {
  189. pattern = "yyyy-MM-dd hh:mm:ss";
  190. }
  191. return date.format(pattern);
  192. }
  193. //浏览器关闭时清除定时器
  194. window.unload = function(){
  195. clearInterval(_interval);
  196. };
  197. /********************************************平台日期时间 end**************************************************/
  198. function getDBNum(){
  199. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  200. var company_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  201. var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
  202. var url = $.pathname() + '/ws/xianlutingyun/XianlutingyunService/getDBNum';
  203. $.ajax({
  204. type: "POST",
  205. url: url,
  206. //async: false,
  207. data: {
  208. user_id:user_id,
  209. role_id:role_id,
  210. company_id:company_id
  211. },
  212. dataType:"text",
  213. success: function(data){
  214. if(!data || data=='0' || data.trim()==''){
  215. $("#daibanshu").text("");
  216. $("#daibanshu").parent().addClass("nodaiban");
  217. }else{
  218. $("#daibanshu").text(parseInt(data));
  219. $("#daibanshu").parent().removeClass("nodaiban");
  220. }
  221. },
  222. error : function(){
  223. //alert("待办数获取错误");
  224. }
  225. });
  226. user_id = null;
  227. company_id = null;
  228. role_id = null;
  229. }
  230. // 初始化加载
  231. var menu = null;
  232. function menuInit(roleids) {
  233. //定时执行,间隔一秒钟
  234. _interval = setInterval(function(){
  235. serverTime = getServerTime();
  236. if(numFlag1==60){//每一小时执行一次
  237. //获取服务器时间
  238. serverTime = getServerTime();
  239. numFlag1 = 0;
  240. }
  241. //通过时间字符串获取下一秒钟的时间,返回字符串
  242. var timeStr = getNowTimeForTimeStr(serverTime);
  243. showTime(timeStr);
  244. if(numFlag==60){//每分钟执行一次
  245. getDBNum();
  246. numFlag = 0;
  247. numFlag1++;
  248. }else{
  249. numFlag++;
  250. }
  251. }, 1000);
  252. $("#close_sys_msg").click(function(){
  253. $(this).parent().parent().hide();
  254. });
  255. // 搜索框获取焦点事件
  256. $("#search_in").live("focus",function(){
  257. // 获取焦点时,将搜索框清空
  258. var val = $(this).val("");
  259. });
  260. // 点击搜索按钮
  261. $("#search_img").live("click",search);
  262. $("#search_in").keydown(function(event){
  263. if(event.which == "13")
  264. search();
  265. });
  266. function search(){
  267. var loginName = top.com.sinosoft.lz.system.user.LoginInfo.getLogin_name();
  268. var name = $("#search_in").val();
  269. if(name==''){
  270. // window.location.href = "/nwyj/page/system/right/SysSearch.jsp";
  271. window.open("/nwyj/page/system/right/SysSearch.jsp");
  272. // $('#frmright', window.parent.document).attr('src',"/nwyj/page/system/right/SysSearch.jsp?");
  273. }else{
  274. //window.location.href = "/nwyj/page/system/right/SearchList.jsp?name="+name;
  275. window.open("/nwyj/page/system/right/SearchList.jsp?name="+name+"&&loginName="+loginName);
  276. // $('#frmright', window.parent.document).attr('src',"/nwyj/page/system/right/SearchList.jsp?name="+name);
  277. }
  278. /* if($("#search_in").val()==""){//打开搜索页面
  279. $(top.document.body).find("#frmright").attr("src","/nwyj/page/system/right/SysSearch.jsp");
  280. }else{//获取值,并跳转收缩结果页面
  281. }*/
  282. //alert($("#search_in").val());
  283. }
  284. // 获取用户功能菜单
  285. var url = $.pathname() + '/ws/sys/SysCustomMenuService/getShowMenuInfoByRoleIds';
  286. var params = {
  287. roleids : roleids
  288. };
  289. $.ajax({
  290. type: "POST",
  291. url: url,
  292. // async: false,
  293. data: params,
  294. success: function(data){
  295. // 一级菜单
  296. menu = data;
  297. var menu1 = '';
  298. if(menu){
  299. // 遍历生成一级菜单
  300. for(var i=0;i<menu.length;i++){
  301. // 调用方法生成二级菜单节点
  302. var menu2 = createSubMenu2(i,menu);
  303. // alert(menu2);
  304. // 获取一级菜单名称
  305. var menu1Name = menu[i].name;
  306. // 获取图片路径
  307. var menu1Img = menu[i].sortno;
  308. var _shownumber = '';
  309. if(menu1Name == "待办"){
  310. _shownumber = '<a href="javascript:;"><div class="daiban" id="daiban"><span class="daibanshu" id="daibanshu">0</span></div></a>';
  311. }
  312. /*var menu1aClass = "";
  313. if(i==0){
  314. menu1aClass = "nowCurrent1";
  315. }*/
  316. // 将二级菜单添加到一级菜单中
  317. menu1 = menu1 + '<li>'+_shownumber+'<a href="javascript:;" class="yj_menu_hover " id="yj_menu_hover_'+i+'" data_index="'+i+'" onclick="javascript:openone('+i+');" ><img src="'+menu1Img+'"><span>'+menu1Name+'</span></a></li>';
  318. menu1Name = null;
  319. menu1Img = null;
  320. _shownumber = null;
  321. $("#navbox").append(menu2);
  322. menu2 = null;
  323. }
  324. var list = $("#list");
  325. list.append(menu1);
  326. menu1 = null;
  327. list = null;
  328. $(".yj_menu_hover").eq(0).addClass("nowCurrent1");
  329. }
  330. // 鼠标点击导航栏一级菜单时,显示对应的子菜单
  331. showSubMenu();
  332. // 显示时间
  333. getDBNum();
  334. },
  335. error : function(){
  336. alert("error");
  337. }
  338. });
  339. };
  340. // 生成子二级菜单节点
  341. function createSubMenu2(i,menu){
  342. // 如果没有二级菜单,则返回
  343. if(menu[i].submenu==undefined||menu[i].submenu==""){return '';}
  344. // 否则循环遍历生成二级菜单
  345. var menu22 = '';
  346. for(var j=0;j<menu[i].submenu.length;j++){
  347. // 调用方法生产三级菜单节点
  348. var menu3 = createSubMenu3(i,j,menu);
  349. if(menu3!=""){
  350. // 将三级菜单节点加入二级菜单节点中
  351. menu22 = menu22 + '<div class="nav_li"><div class="nav_li_l"><span class="fas">'+menu[i].submenu[j].name+'</span><span class="verticalLine">|</span></div>'+menu3+'</div>';
  352. menu3 = null;
  353. }
  354. }
  355. var menu2 = '<div class="hover_cont submenu'+i+'" id="submenu'+i+'" data_index="'+i+'" style="display:none;"><div class="nav_cont">'+menu22+'</div></div>';
  356. menu22 = null;
  357. return menu2;
  358. }
  359. // 生产子三级菜单节点
  360. function createSubMenu3(i,j,menu){
  361. // 如果没有三级菜单,则返回
  362. if(menu[i].submenu[j].submenu.length==0){return '';}
  363. // 否则循环遍历生成三级菜单
  364. var menu33 = '';
  365. for(var k=0;k<menu[i].submenu[j].submenu.length;k++){
  366. menu33 = menu33 + '<a href="javascript:;" onclick="openuri('+i+','+j+','+k+')" >'+menu[i].submenu[j].submenu[k].name+'</a>';
  367. }
  368. var menu3= '<div class="nav_li_r">'+menu33+'</div>';
  369. menu33 = null;
  370. return menu3;
  371. }
  372. function openone(i){
  373. var menuUri = menu[i].remark;
  374. var menuID=menu[i].id;
  375. if(menuUri==""||menuUri==null)
  376. {
  377. return
  378. }
  379. //驾驶舱
  380. else if(menuID==6) {//驾驶舱
  381. var browser=navigator.appName;
  382. var b_version=navigator.appVersion;
  383. //navigator.appName=="Microsoft Internet Explorer" && navigator.appVersion.match(new RegExp("Trident\/[7]\.0"))==null
  384. if(browser=="Microsoft Internet Explorer" && b_version.match(new RegExp("Trident\/[5-9]\.0"))==null)
  385. {
  386. top.Dialog.confirm("为了更方便的使用本系统,建议您使用IE9版本的浏览器,请问是否下载IE9版本浏览器",function(){
  387. window.open("/nwyj/upload/IE9-Windows7-x86-chs.rar");
  388. return ;
  389. },function(){
  390. return ;
  391. });
  392. return ;
  393. }
  394. // 获取用户部门
  395. var dept_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  396. // 获取用户Id
  397. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  398. var user_name = top.com.sinosoft.lz.system.user.LoginInfo.getLogin_name();
  399. //父部门id
  400. var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  401. var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
  402. var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  403. //4Atoken值
  404. var ticket = top.com.sinosoft.lz.system.user.LoginInfo.getUserTicket();
  405. var dept_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  406. var saphruserid = top.com.sinosoft.lz.system.user.LoginInfo.getSaphruserid();
  407. menuUri = menuUri+"?dept_id="+dept_id+"&&user_id="+user_id+"&&real_name="+realName+"&&user_name="+encodeURI(user_name)+"&&dept_name="+encodeURI(dept_name)+"&&parentId="+parentId+"&&role_id="+encodeURI(role_id)+"&&saphruserid="+encodeURI(saphruserid)+"&&token="+ticket;
  408. window.open(menuUri,"_blank","");
  409. }else {
  410. if(menuID==2){
  411. setMainIndex();
  412. }else{
  413. $("#main_index_tab").hide();
  414. }
  415. $("#main_index_fixed").hide();
  416. var imgurl = menu[i].sortno;
  417. //document.getElementById("frmright").setAttribute("src", menuUri);
  418. $.indexOpenSelfWindow(menuUri);
  419. $("#currPosition").hide();
  420. $(".nowCurrent1").removeClass("nowCurrent1");
  421. $("#yj_menu_hover_"+i).addClass("nowCurrent1");
  422. //$("#yj_menu_hover_"+menuID).addClaas("nowCurrent1");
  423. $(".hover_cont .nav_li_r a").css("color","#0066CC");
  424. }
  425. };
  426. function openuri(i,j,k){
  427. var menuUri = menu[i].submenu[j].submenu[k].remark;
  428. var menuId = menu[i].submenu[j].submenu[k].id;
  429. var menuName3 = menu[i].submenu[j].submenu[k].name;
  430. var imgurl = menu[i].submenu[j].submenu[k].sortno;
  431. var imgclass = imgurl.substring(imgurl.lastIndexOf("/")+1,imgurl.indexOf(".png"));
  432. if(menuUri==""||menuUri==null||menuUri==undefined){
  433. return;
  434. }else{
  435. var iframe = $("#frmright").get(0).contentWindow;
  436. if("MSIE"==getOs()){
  437. iframe.src = 'about:Tabs';
  438. }else{
  439. iframe.src = 'about:blank';
  440. }
  441. if(iframe.CollectGarbage){
  442. iframe.CollectGarbage();
  443. }
  444. iframe.document.write('');
  445. //iframe.document.clear();
  446. iframe=null;
  447. //记录用户点击次数
  448. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  449. $.indexUserClickNum (user_id,menuId);
  450. user_id = null;
  451. //记录用户点击次数
  452. $("#positionMsg").html("<div id='positionTitle1' class='"+imgclass+"'>"+menuName3+"</div>");
  453. $("#positionMsg #positionTitle1").data("menuid",menuId).data("imgclass",imgclass);
  454. $("#currPosition .changeYQ").remove();
  455. var curSrc = getTabMsg();
  456. menuUri = curSrc!="" && curSrc!=undefined?curSrc:menuUri;
  457. $.indexOpenSelfWindow(menuUri);
  458. //$("#frmright").attr("src",menuUri);
  459. // 隐藏二三极菜单框
  460. hideMenu();
  461. $("#currPosition").show();
  462. $("#main_index_tab").hide();
  463. $("#main_index_fixed").hide();
  464. }
  465. }
  466. function hideMenu(){
  467. $(".nav_li_r").click(function(){
  468. $(this).parent().parent().parent().hide();
  469. });
  470. }
  471. /**
  472. * 获取当前位置页签数据
  473. */
  474. function getTabMsg(){
  475. var curSrc = "";
  476. var $tab = $("#positionMsg .positionTab");
  477. if($tab.length == 0){
  478. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  479. var menuId = $("#positionTitle1").data("menuid");
  480. $.ajax({
  481. type: "POST",
  482. url: "/nwyj/ws/tabyq/PositionTabService/getTabById",
  483. async: false,
  484. data: {
  485. menuId:menuId,
  486. userId:user_id
  487. },
  488. dataType:"json",
  489. success: function(data){
  490. if(data.length>0){
  491. curSrc = tabPosition(data,menuId,"");
  492. }
  493. }
  494. });
  495. }
  496. return curSrc;
  497. }
  498. //创建当前位置页签
  499. function tabPosition(tabjson,menuId,imgclass){
  500. var curId = "";
  501. var __top = $(top.document.body);
  502. var positionText = __top.find("#positionTitle1").text();
  503. imgclass = imgclass==""?__top.find("#positionTitle1").data("imgclass"):imgclass;
  504. __top.find("#positionMsg").html("");
  505. //添加菜单和图标
  506. __top.find("#positionMsg").append("<div id='positionTitle1' class='positiontitab "+imgclass+"'>"+positionText+"</div>");
  507. __top.find("#positionMsg #positionTitle1").data("menuid",menuId).data("imgclass",imgclass);
  508. __top.find("#currPosition .changeYQ").remove();
  509. __top.find("#currPosition").append("<div class='changeYQ' id='changeYQ'><div class='setTabBtn' id='setTabBtn'>设置</div></div>");
  510. $("#changeYQ #setTabBtn").bind("click",setTabBtn);
  511. $("#changeYQ").append(
  512. "<div class='tablistcon' id='tablistcon'>" +
  513. "<div class='tablistcon_div'><ul class='tablistcon_ul'>" +
  514. "</ul></div>" +
  515. "<div class='tab_setbtn'>设为默认</div>" +
  516. "</div>");
  517. for(var i=0;i<tabjson.length;i++){
  518. if(tabjson[i].IS_PARENT==1){//子页签
  519. var PARENT_ID = tabjson[i].PARENT_ID;
  520. var dom = $("<div class=' positiontitab positionTab positionTabChild' id='"+tabjson[i].YQ_ID+"' data-tabId='"+tabjson[i].FD_OBJECTID+"' data-index='"+0+"' data-src='"+tabjson[i].YQ_SRC+"'>"+tabjson[i].YQ_NAME+"</div>");
  521. $("#chlid_con_"+PARENT_ID).append(dom);
  522. }else if(tabjson[i].IS_PARENT==0){//父页签
  523. if(tabjson[i].current){
  524. curId = tabjson[i].YQ_SRC;
  525. __top.find("#positionMsg").append("<div class=' positiontitab positionTab positionTabCurrent positionTabParent hasChild' id='"+tabjson[i].YQ_ID+"' data-tabId='"+tabjson[i].FD_OBJECTID+"' data-index='"+0+"' data-src='"+tabjson[i].YQ_SRC+"'><div>"+tabjson[i].YQ_NAME+"</div><div class='chlid_con' id='chlid_con_"+tabjson[i].YQ_ID+"'></div></div>");
  526. //添加设置页签的下拉列表
  527. $("#changeYQ ul").append(
  528. "<li class='tablistcon_ul_li'><div class='tabselect tab_selected' data-yqid='"+tabjson[i].FD_OBJECTID+"'>"+tabjson[i].YQ_NAME+"</div>" +
  529. "</li>");
  530. }else{
  531. __top.find("#positionMsg").append("<div class=' positiontitab positionTab positionTabParent' data-tabId='"+tabjson[i].FD_OBJECTID+"' data-index='"+i+"' id='"+tabjson[i].YQ_ID+"' data-src='"+tabjson[i].YQ_SRC+"'>"+tabjson[i].YQ_NAME+"</div>");
  532. //添加设置页签的下拉列表
  533. $("#changeYQ ul").append(
  534. "<li class='tablistcon_ul_li'><div class='tabselect tab_noselect' data-yqid='"+tabjson[i].FD_OBJECTID+"'>"+tabjson[i].YQ_NAME+"</div>" +
  535. "</li>");
  536. }
  537. }else{
  538. if(tabjson[i].current){
  539. curId = tabjson[i].YQ_SRC;
  540. __top.find("#positionMsg").append("<div class=' positiontitab positionTab positionTabCurrent' id='"+tabjson[i].YQ_ID+"' data-tabId='"+tabjson[i].FD_OBJECTID+"' data-index='"+0+"' data-src='"+tabjson[i].YQ_SRC+"'>"+tabjson[i].YQ_NAME+"</div>");
  541. //添加设置页签的下拉列表
  542. $("#changeYQ ul").append(
  543. "<li class='tablistcon_ul_li'><div class='tabselect tab_selected' data-yqid='"+tabjson[i].FD_OBJECTID+"'>"+tabjson[i].YQ_NAME+"</div>" +
  544. "</li>");
  545. }else{
  546. __top.find("#positionMsg").append("<div class=' positiontitab positionTab' data-tabId='"+tabjson[i].FD_OBJECTID+"' data-index='"+i+"' id='"+tabjson[i].YQ_ID+"' data-src='"+tabjson[i].YQ_SRC+"'>"+tabjson[i].YQ_NAME+"</div>");
  547. //添加设置页签的下拉列表
  548. $("#changeYQ ul").append(
  549. "<li class='tablistcon_ul_li'><div class='tabselect tab_noselect' data-yqid='"+tabjson[i].FD_OBJECTID+"'>"+tabjson[i].YQ_NAME+"</div>" +
  550. "</li>");
  551. }
  552. }
  553. }
  554. __top.find("#positionMsg").append("<div class='clear'></div>");
  555. $("#changeYQ .tabselect").bind("click",selectTab);
  556. $("#changeYQ .tab_setbtn").bind("click",setDefaultTab);
  557. if(menuId=="30400"){
  558. //应急预案列表页面注掉切换页头上那个红色圈圈。
  559. /*getShareNum();
  560. getXiubianNum();*/
  561. }
  562. return curId;
  563. };
  564. function setDefaultTab(){
  565. var tabId = $("#changeYQ .tab_selected").attr("data-yqid");
  566. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  567. var menuId = $("#positionTitle1").data("menuid");
  568. $.ajax({
  569. type: "POST",
  570. url: "/nwyj/ws/tabyq/PositionTabService/addOrUpdateTab",
  571. async: false,
  572. data: {
  573. menuId:menuId,
  574. userId:user_id,
  575. tabId:tabId
  576. },
  577. dataType:"text",
  578. success: function(data){
  579. $("#tablistcon").hide();
  580. }
  581. });
  582. }
  583. /***
  584. * 控制设置页签默认列表显隐
  585. */
  586. function setTabBtn(e){
  587. $("#tablistcon").toggle();
  588. stopPropagation(e);
  589. }
  590. function stopPropagation(e) {
  591. if (e.stopPropagation)
  592. e.stopPropagation();
  593. else
  594. e.cancelBubble = true;
  595. }
  596. /****
  597. * 设置页签默认列表样式切换
  598. */
  599. function selectTab(){
  600. $(".tab_selected").removeClass("tab_selected").addClass("tab_noselect");
  601. $(this).addClass("tab_selected").removeClass("tab_noselect");
  602. }
  603. //判断浏览器的类型
  604. function getOs(){
  605. if(navigator.userAgent.indexOf("MSIE")>0) {
  606. return "MSIE";
  607. } ;
  608. if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){
  609. return "Firefox";
  610. } ;
  611. if(isSafari=navigator.userAgent.indexOf("Safari")>0) {
  612. return "Safari";
  613. } ;
  614. if(isCamino=navigator.userAgent.indexOf("Camino")>0){
  615. return "Camino";
  616. };
  617. if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){
  618. return "Gecko";
  619. } ;
  620. };
  621. //后台返回共享中的预案个数
  622. function getShareNum(){
  623. var parent_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  624. //取系统时间:年月日时分秒
  625. var date = allGetServerTime();
  626. var seperator1 = "";
  627. var month = date.getMonth() + 1;
  628. var strDate = date.getDate();
  629. if (month >= 1 && month <= 9) {
  630. month = "0" + month;
  631. }
  632. if (strDate >= 0 && strDate <= 9) {
  633. strDate = "0" + strDate;
  634. }
  635. var time = date.getFullYear() + seperator1 +"-" + month + "-"+seperator1 + strDate;
  636. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getShareNum/';
  637. var params = {
  638. id : parent_id,
  639. time:time
  640. };
  641. $.ajax({
  642. url : url,
  643. type : 'post',
  644. timeout : 60000,
  645. data : params,
  646. dataType : 'json',
  647. success : function(data){
  648. var num = data.rows[0].NUM;
  649. appendOneDiv(num);
  650. },
  651. error : function(e){
  652. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  653. }
  654. });
  655. }
  656. //后台返回待修编的预案个数
  657. function getXiubianNum(){
  658. var parent_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  659. //取系统时间:年月日时分秒
  660. var date = allGetServerTime();
  661. var seperator1 = "";
  662. var month = date.getMonth() + 1;
  663. var strDate = date.getDate();
  664. if (month >= 1 && month <= 9) {
  665. month = "0" + month;
  666. }
  667. if (strDate >= 0 && strDate <= 9) {
  668. strDate = "0" + strDate;
  669. }
  670. var time = date.getFullYear() + seperator1 +"-" + month + "-"+seperator1 + strDate;
  671. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getXiubianNum/';
  672. var params = {
  673. id : parent_id,
  674. time:time
  675. };
  676. $.ajax({
  677. url : url,
  678. type : 'post',
  679. timeout : 60000,
  680. data : params,
  681. dataType : 'json',
  682. success : function(data){
  683. var num = data.rows[0].NUM;
  684. appendTwoDiv(num);
  685. },
  686. error : function(e){
  687. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  688. }
  689. });
  690. }
  691. function appendOneDiv(data){
  692. var $dom = $(top.document.body).find(".positionTab").eq(2);
  693. $dom.css("position","relative");
  694. var $div = $("<div id= 'daixiubian' style='position: absolute; right: -18px; top: 0px; background-color: #f00; border-radius: 25px; width: 20px; height: 20px; text-align: center; line-height: 20px; color: #fff;' > "+data+"</div>");
  695. $dom.append($div);
  696. }
  697. function appendTwoDiv(data){
  698. var $dom1 = $(top.document.body).find(".positionTab").eq(1);
  699. $dom1.css("position","relative");
  700. var $div1 = $("<div class='aaaa' id= 'gongxiang' style='position: absolute; right: -18px; top: 0px; background-color: #f00; border-radius: 25px; width: 20px; height: 20px; text-align: center; line-height: 20px; color: #fff;' >"+data+"</div>");
  701. $dom1.append($div1);
  702. $div1.render();
  703. }
  704. /**
  705. * 加载首页顶部滚动数据
  706. */
  707. function setMainIndex(){
  708. var Corpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();//系统登录人的单位id
  709. $.ajax({
  710. url : $.pathname() + "/ws/getNotice/GetNoticeService/getNotice",
  711. data : { corpId : Corpids},
  712. type : 'post',
  713. dataType : 'json',
  714. success : function(data) {
  715. // alert(JSON.stringify(data))
  716. setMainIndexTab(data);
  717. //setMainIndexTab([]);
  718. },
  719. error : function(e) {
  720. return;
  721. //$.messager.alert('访问服务失败!', 'error');
  722. }
  723. });
  724. }
  725. /**
  726. *设置首页顶部滚动条中的数据
  727. */
  728. function setMainIndexTab(myData){
  729. if(myData.length==0){
  730. return;
  731. }
  732. var alertdata = "";
  733. var responsedata = "";
  734. var responseval = "";
  735. var alertval = "";
  736. var alertcol = "";
  737. var responsecol = "";
  738. for(var i=0;i<myData.length;i++){
  739. if(myData[i].isAlert==1){
  740. var rcdn = myData[i].responsecol;
  741. responsecol = rcdn == "29"?"-28px -64px":rcdn == "30"?"-64px -62px":rcdn == "31"?"-102px -63px":rcdn == "32"?"-139px -63px":"";
  742. responsedata = "最新响应信息:"+ myData[i].corpName+" - "+myData[i].writeTime+" - "+myData[i].warningName;
  743. responseval = myData[i].isAlert+"|"+myData[i].fd_objectid;
  744. }
  745. if(myData[i].isAlert==0){
  746. var acdn = myData[i].alertcol;
  747. alertcol = (acdn == "35"?"-32px -20px":(acdn == "36"?"-65px -20px":(acdn == "37"?"-101px -22px":(acdn == "38"?"-139px -20px":""))));
  748. alertdata = "最新预警信息:"+ myData[i].corpName+" - "+myData[i].writeTime+" - "+myData[i].warningName;
  749. alertval = myData[i].isAlert+"|"+myData[i].fd_objectid;
  750. }
  751. }
  752. $("#main_index_tab_cont").html("");
  753. var marhtml = "<marquee id='marqueeid' scrollamount='3' scrolldelay='50' >";
  754. if(alertdata!=""){
  755. marhtml += "<span value="+alertval+" class='aresphref' ><u style='background-position:"+alertcol+";'></u><b>"+alertdata+"</b></span>";
  756. }
  757. marhtml += "&nbsp;&nbsp;&nbsp;&nbsp;";
  758. if(responsedata!=""){
  759. marhtml += "<span value="+responseval+" class='aresphref' ><u style='background-position:"+responsecol+";'></u><b>"+responsedata+"</b></span>";
  760. }
  761. marhtml += "</marquee>";
  762. $("#main_index_tab_cont").append(marhtml);
  763. //$("#main_index_tab").append("<div><marquee id='marqueeid' >"+responsedata+" "+alertdata+"</marquee></div>");
  764. //$("#main_index_tab").append('<div><marquee direction="left" scrollamount="20" scrolldelay="50" >'+responsedata+' '+alertdata+'</marquee></div>');
  765. //$("#main_index_tab").append("<div id='marqueeid'>"+responsedata+" "+alertdata+"</div>");
  766. alertdata = null;
  767. responsedata = null;
  768. responseval = null;
  769. alertval = null;
  770. $("#main_index_tab").show();
  771. $("#marqueeid").bind("mouseover",function(){
  772. this.stop();
  773. });
  774. $("#marqueeid").bind("mouseout",function(){
  775. this.start();
  776. });
  777. $(".aresphref").bind("click",function(){
  778. var value = $(this).attr("value");
  779. var valueArr = value.split("|");
  780. var dddurl = "";
  781. if(valueArr[0]==1){
  782. dddurl = "/nwyj/page/business/em/response/emergencyResponse/WarningView.jsp?fd_id="+valueArr[1];
  783. //$("#frmright").attr("src","/nwyj/page/business/em/response/emergencyResponse/WarningView.jsp?fd_id="+valueArr[1]);
  784. }else{
  785. dddurl = "/nwyj/page/business/em/alert/warning/WarningView.jsp?fd_id="+valueArr[1];
  786. //$("#frmright").attr("src","/nwyj/page/business/em/alert/warning/WarningView.jsp?fd_id="+valueArr[1]);
  787. }
  788. // $.noIndexOpenNextWindow(dddurl);
  789. window.open("/nwyj/page/cockpit/webgis/EventAllInfo.jsp?fd_id="+valueArr[1]+"&dept_id="+top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids());
  790. //alert(top.com.sinosoft.lz.system.user.LoginInfo.getUserInfo());
  791. //跳转页面
  792. /*var dddname = top.com.sinosoft.lz.system.user.LoginInfo.getUserInfo();
  793. //alert(dddname);
  794. var dddopener=window.open("/nwyj/page/frameWork.html");
  795. dddopener.fatherParam={"name":dddname,"idxWorkUrl":dddurl};*/
  796. $(this).remove();
  797. if($("#marqueeid").html()=="&nbsp;&nbsp;&nbsp;&nbsp;"){
  798. $("#marqueeid").remove();
  799. $("#main_index_tab").hide();
  800. }
  801. value = null;
  802. valueArr = null;
  803. dddurl = null;
  804. dddopener = null;
  805. });
  806. /*移除按钮的监听方法 */
  807. $("#main_index_closeimg").bind("mouseenter",function(){
  808. $(this).show().removeClass("cont_close1").addClass("cont_close2");
  809. });
  810. $("#main_index_closeimg").bind("mouseleave",function(){
  811. $(this).show().removeClass("cont_close2").addClass("cont_close1");
  812. });
  813. $("#main_index_closeimg").bind("click",function(){
  814. $(this).parent().hide();
  815. });
  816. $("#main_index_tab").bind("mouseover",function(){
  817. $("#main_index_closeimg").show();
  818. });
  819. $("#main_index_tab").bind("mouseout",function(){
  820. $("#main_index_closeimg").hide();
  821. });
  822. /*移除按钮的监听方法 */
  823. }