b71c23818584d0393f067629d8961d61e8c426fd.svn-base 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934
  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 deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDept_id();
  203. var url = $.pathname() + '/ws/xianlutingyun/XianlutingyunService/getDBNum';
  204. $.ajax({
  205. type: "POST",
  206. url: url,
  207. //async: false,
  208. data: {
  209. user_id:user_id,
  210. role_id:role_id,
  211. company_id:company_id,
  212. deptId : deptId
  213. },
  214. dataType:"text",
  215. success: function(data){
  216. if(!data || data=='0' || data.trim()==''){
  217. $("#daibanshu").text("");
  218. $("#daibanshu").parent().addClass("nodaiban");
  219. }else{
  220. $("#daibanshu").text(parseInt(data));
  221. $("#daibanshu").parent().removeClass("nodaiban");
  222. }
  223. },
  224. error : function(){
  225. //alert("待办数获取错误");
  226. }
  227. });
  228. user_id = null;
  229. company_id = null;
  230. role_id = null;
  231. }
  232. // 初始化加载
  233. var menu = null;
  234. function menuInit(roleids) {
  235. //定时执行,间隔一秒钟
  236. _interval = setInterval(function(){
  237. serverTime = getServerTime();
  238. if(numFlag1==60){//每一小时执行一次
  239. //获取服务器时间
  240. serverTime = getServerTime();
  241. numFlag1 = 0;
  242. }
  243. //通过时间字符串获取下一秒钟的时间,返回字符串
  244. var timeStr = getNowTimeForTimeStr(serverTime);
  245. showTime(timeStr);
  246. if(numFlag==60){//每分钟执行一次
  247. getDBNum();
  248. numFlag = 0;
  249. numFlag1++;
  250. }else{
  251. numFlag++;
  252. }
  253. }, 1000);
  254. $("#close_sys_msg").click(function(){
  255. $(this).parent().parent().hide();
  256. });
  257. // 搜索框获取焦点事件
  258. $("#search_in").live("focus",function(){
  259. // 获取焦点时,将搜索框清空
  260. var val = $(this).val("");
  261. });
  262. // 点击搜索按钮
  263. $("#search_img").live("click",search);
  264. $("#search_in").keydown(function(event){
  265. if(event.which == "13")
  266. search();
  267. });
  268. function search(){
  269. var loginName = top.com.sinosoft.lz.system.user.LoginInfo.getLogin_name();
  270. var name = $("#search_in").val();
  271. if(name==''){
  272. // window.location.href = "/nwyj/page/system/right/SysSearch.jsp";
  273. window.open("/nwyj/page/system/right/SysSearch.jsp");
  274. // $('#frmright', window.parent.document).attr('src',"/nwyj/page/system/right/SysSearch.jsp?");
  275. }else{
  276. //window.location.href = "/nwyj/page/system/right/SearchList.jsp?name="+name;
  277. window.open("/nwyj/page/system/right/SearchList.jsp?name="+name+"&&loginName="+loginName);
  278. // $('#frmright', window.parent.document).attr('src',"/nwyj/page/system/right/SearchList.jsp?name="+name);
  279. }
  280. /* if($("#search_in").val()==""){//打开搜索页面
  281. $(top.document.body).find("#frmright").attr("src","/nwyj/page/system/right/SysSearch.jsp");
  282. }else{//获取值,并跳转收缩结果页面
  283. }*/
  284. //alert($("#search_in").val());
  285. }
  286. // 获取用户功能菜单
  287. var url = $.pathname() + '/ws/sys/SysCustomMenuService/getShowMenuInfoByRoleIds';
  288. var params = {
  289. roleids : roleids
  290. };
  291. $.ajax({
  292. type: "POST",
  293. url: url,
  294. // async: false,
  295. data: params,
  296. success: function(data){
  297. // 一级菜单
  298. menu = data;
  299. var menu1 = '';
  300. if(menu){
  301. // 遍历生成一级菜单
  302. for(var i=0;i<menu.length;i++){
  303. // 调用方法生成二级菜单节点
  304. var menu2 = createSubMenu2(i,menu);
  305. // alert(menu2);
  306. // 获取一级菜单名称
  307. var menu1Name = menu[i].name;
  308. // 获取图片路径
  309. var menu1Img = menu[i].sortno;
  310. var _shownumber = '';
  311. if(menu1Name == "待办"){
  312. _shownumber = '<a href="javascript:;"><div class="daiban" id="daiban"><span class="daibanshu" id="daibanshu">0</span></div></a>';
  313. }
  314. /*var menu1aClass = "";
  315. if(i==0){
  316. menu1aClass = "nowCurrent1";
  317. }*/
  318. // 将二级菜单添加到一级菜单中
  319. 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>';
  320. menu1Name = null;
  321. menu1Img = null;
  322. _shownumber = null;
  323. $("#navbox").append(menu2);
  324. menu2 = null;
  325. }
  326. var list = $("#list");
  327. list.append(menu1);
  328. menu1 = null;
  329. list = null;
  330. $(".yj_menu_hover").eq(0).addClass("nowCurrent1");
  331. }
  332. // 鼠标点击导航栏一级菜单时,显示对应的子菜单
  333. showSubMenu();
  334. // 显示时间
  335. getDBNum();
  336. },
  337. error : function(){
  338. alert("error");
  339. }
  340. });
  341. };
  342. // 生成子二级菜单节点
  343. function createSubMenu2(i,menu){
  344. // 如果没有二级菜单,则返回
  345. if(menu[i].submenu==undefined||menu[i].submenu==""){return '';}
  346. // 否则循环遍历生成二级菜单
  347. var menu22 = '';
  348. for(var j=0;j<menu[i].submenu.length;j++){
  349. // 调用方法生产三级菜单节点
  350. var menu3 = createSubMenu3(i,j,menu);
  351. if(menu3!=""){
  352. // 将三级菜单节点加入二级菜单节点中
  353. 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>';
  354. menu3 = null;
  355. }
  356. }
  357. var menu2 = '<div class="hover_cont submenu'+i+'" id="submenu'+i+'" data_index="'+i+'" style="display:none;"><div class="nav_cont">'+menu22+'</div></div>';
  358. menu22 = null;
  359. return menu2;
  360. }
  361. // 生产子三级菜单节点
  362. function createSubMenu3(i,j,menu){
  363. var loginName = top.com.sinosoft.lz.system.user.LoginInfo.getLogin_name();
  364. console.log(loginName);
  365. // 如果没有三级菜单,则返回
  366. if(menu[i].submenu[j].submenu.length==0){return '';}
  367. // 否则循环遍历生成三级菜单
  368. var menu33 = '';
  369. for(var k=0;k<menu[i].submenu[j].submenu.length;k++){
  370. if("gz1"!=loginName && i==6 && j==0 && menu[i].submenu[j].submenu[k].name=='数据补录'){//只有gz1帐号才能看到系统管理-系统权限-数据补录模块,i=6:系统管理 j=0:系统权限
  371. continue;
  372. }
  373. menu33 = menu33 + '<a href="javascript:;" onclick="openuri('+i+','+j+','+k+')" >'+menu[i].submenu[j].submenu[k].name+'</a>';
  374. }
  375. var menu3= '<div class="nav_li_r">'+menu33+'</div>';
  376. menu33 = null;
  377. return menu3;
  378. }
  379. function openone(i){
  380. var menuUri = menu[i].remark;
  381. var menuID=menu[i].id;
  382. if(menuUri==""||menuUri==null)
  383. {
  384. return
  385. }
  386. //驾驶舱
  387. else if(menuID==6) {//驾驶舱
  388. var browser=navigator.appName;
  389. var b_version=navigator.appVersion;
  390. //navigator.appName=="Microsoft Internet Explorer" && navigator.appVersion.match(new RegExp("Trident\/[7]\.0"))==null
  391. if(browser=="Microsoft Internet Explorer" && b_version.match(new RegExp("Trident\/[5-9]\.0"))==null)
  392. {
  393. top.Dialog.confirm("为了更方便的使用本系统,建议您使用IE9版本的浏览器,请问是否下载IE9版本浏览器",function(){
  394. window.open("/nwyj/upload/IE9-Windows7-x86-chs.rar");
  395. return ;
  396. },function(){
  397. return ;
  398. });
  399. return ;
  400. }
  401. // 获取用户部门
  402. var dept_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  403. // 获取用户Id
  404. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  405. var user_name = top.com.sinosoft.lz.system.user.LoginInfo.getLogin_name();
  406. //父部门id
  407. var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  408. var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
  409. var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  410. //4Atoken值
  411. var ticket = top.com.sinosoft.lz.system.user.LoginInfo.getUserTicket();
  412. var dept_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  413. var saphruserid = top.com.sinosoft.lz.system.user.LoginInfo.getSaphruserid();
  414. 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;
  415. window.open(menuUri,"_blank","");
  416. }else {
  417. if(activeTab){//如果有选项卡,先关闭所有的选项卡
  418. var $item = $("#active_tab_menu .tabContainer .tab_item");
  419. for (var i = 0; i < $item.length; i++) {
  420. var $Id = $item.eq(i).attr("id");
  421. activeTab.close($Id);
  422. }
  423. activeTab = null;
  424. }
  425. if(menuID==2){
  426. setMainIndex();
  427. }else{
  428. $("#main_index_tab").hide();
  429. }
  430. $("#main_index_fixed").hide();
  431. var imgurl = menu[i].sortno;
  432. //document.getElementById("frmright").setAttribute("src", menuUri);
  433. $.indexOpenSelfWindow(menuUri);
  434. $("#currPosition").hide();
  435. $(".nowCurrent1").removeClass("nowCurrent1");
  436. $("#yj_menu_hover_"+i).addClass("nowCurrent1");
  437. //$("#yj_menu_hover_"+menuID).addClaas("nowCurrent1");
  438. $(".hover_cont .nav_li_r a").css("color","#0066CC");
  439. }
  440. };
  441. function openuri(i,j,k){
  442. var menuUri = menu[i].submenu[j].submenu[k].remark;
  443. var menuId = menu[i].submenu[j].submenu[k].id;
  444. var menuName3 = menu[i].submenu[j].submenu[k].name;
  445. var imgurl = menu[i].submenu[j].submenu[k].sortno;
  446. var imgclass = imgurl.substring(imgurl.lastIndexOf("/")+1,imgurl.indexOf(".png"));
  447. if(menuUri==""||menuUri==null||menuUri==undefined){
  448. return;
  449. }else{
  450. var iframe = $("#frmright").get(0).contentWindow;
  451. if(activeTab){//如果有选项卡,先关闭所有的选项卡
  452. var $item = $("#active_tab_menu .tabContainer .tab_item");
  453. for (var i = 0; i < $item.length; i++) {
  454. var $Id = $item.eq(i).attr("id");
  455. activeTab.close($Id);
  456. }
  457. activeTab = null;
  458. }
  459. if("MSIE"==getOs()){
  460. iframe.src = 'about:Tabs';
  461. }else{
  462. iframe.src = 'about:blank';
  463. }
  464. if(iframe.CollectGarbage){
  465. iframe.CollectGarbage();
  466. }
  467. iframe.document.write('');
  468. //iframe.document.clear();
  469. iframe=null;
  470. //记录用户点击次数
  471. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  472. $.indexUserClickNum (user_id,menuId);
  473. user_id = null;
  474. //记录用户点击次数
  475. $("#positionMsg").html("<div id='positionTitle1' class='"+imgclass+"'>"+menuName3+"</div>");
  476. $("#positionMsg #positionTitle1").data("menuid",menuId).data("imgclass",imgclass);
  477. $("#currPosition .changeYQ").remove();
  478. var curSrc = getTabMsg();
  479. menuUri = curSrc!="" && curSrc!=undefined?curSrc:menuUri;
  480. $.indexOpenSelfWindow(menuUri);
  481. //$("#frmright").attr("src",menuUri);
  482. // 隐藏二三极菜单框
  483. hideMenu();
  484. $("#currPosition").show();
  485. $("#main_index_tab").hide();
  486. $("#main_index_fixed").hide();
  487. }
  488. }
  489. function hideMenu(){
  490. $(".nav_li_r").click(function(){
  491. $(this).parent().parent().parent().hide();
  492. });
  493. }
  494. /**
  495. * 获取当前位置页签数据
  496. */
  497. function getTabMsg(){
  498. var curSrc = "";
  499. var $tab = $("#positionMsg .positionTab");
  500. if($tab.length == 0){
  501. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  502. var menuId = $("#positionTitle1").data("menuid");
  503. $.ajax({
  504. type: "POST",
  505. url: "/nwyj/ws/tabyq/PositionTabService/getTabById",
  506. async: false,
  507. data: {
  508. menuId:menuId,
  509. userId:user_id
  510. },
  511. dataType:"json",
  512. success: function(data){
  513. if(data.length>0){
  514. curSrc = tabPosition(data,menuId,"");
  515. }
  516. }
  517. });
  518. }
  519. return curSrc;
  520. }
  521. //创建当前位置页签
  522. function tabPosition(tabjson,menuId,imgclass){
  523. var curId = "";
  524. var __top = $(top.document.body);
  525. var positionText = __top.find("#positionTitle1").text();
  526. imgclass = imgclass==""?__top.find("#positionTitle1").data("imgclass"):imgclass;
  527. __top.find("#positionMsg").html("");
  528. //添加菜单和图标
  529. __top.find("#positionMsg").append("<div id='positionTitle1' class='positiontitab "+imgclass+"'>"+positionText+"</div>");
  530. __top.find("#positionMsg #positionTitle1").data("menuid",menuId).data("imgclass",imgclass);
  531. __top.find("#currPosition .changeYQ").remove();
  532. __top.find("#currPosition").append("<div class='changeYQ' id='changeYQ'><div class='setTabBtn' id='setTabBtn'>设置</div></div>");
  533. $("#changeYQ #setTabBtn").bind("click",setTabBtn);
  534. $("#changeYQ").append(
  535. "<div class='tablistcon' id='tablistcon'>" +
  536. "<div class='tablistcon_div'><ul class='tablistcon_ul'>" +
  537. "</ul></div>" +
  538. "<div class='tab_setbtn'>设为默认</div>" +
  539. "</div>");
  540. for(var i=0;i<tabjson.length;i++){
  541. if(tabjson[i].IS_PARENT==1){//子页签
  542. var PARENT_ID = tabjson[i].PARENT_ID;
  543. 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>");
  544. $("#chlid_con_"+PARENT_ID).append(dom);
  545. }else if(tabjson[i].IS_PARENT==0){//父页签
  546. if(tabjson[i].current){
  547. curId = tabjson[i].YQ_SRC;
  548. __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>");
  549. //添加设置页签的下拉列表
  550. $("#changeYQ ul").append(
  551. "<li class='tablistcon_ul_li'><div class='tabselect tab_selected' data-yqid='"+tabjson[i].FD_OBJECTID+"'>"+tabjson[i].YQ_NAME+"</div>" +
  552. "</li>");
  553. }else{
  554. __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>");
  555. //添加设置页签的下拉列表
  556. $("#changeYQ ul").append(
  557. "<li class='tablistcon_ul_li'><div class='tabselect tab_noselect' data-yqid='"+tabjson[i].FD_OBJECTID+"'>"+tabjson[i].YQ_NAME+"</div>" +
  558. "</li>");
  559. }
  560. }else{
  561. if(tabjson[i].current){
  562. curId = tabjson[i].YQ_SRC;
  563. __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>");
  564. //添加设置页签的下拉列表
  565. $("#changeYQ ul").append(
  566. "<li class='tablistcon_ul_li'><div class='tabselect tab_selected' data-yqid='"+tabjson[i].FD_OBJECTID+"'>"+tabjson[i].YQ_NAME+"</div>" +
  567. "</li>");
  568. }else{
  569. __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>");
  570. //添加设置页签的下拉列表
  571. $("#changeYQ ul").append(
  572. "<li class='tablistcon_ul_li'><div class='tabselect tab_noselect' data-yqid='"+tabjson[i].FD_OBJECTID+"'>"+tabjson[i].YQ_NAME+"</div>" +
  573. "</li>");
  574. }
  575. }
  576. }
  577. __top.find("#positionMsg").append("<div class='clear'></div>");
  578. $("#changeYQ .tabselect").bind("click",selectTab);
  579. $("#changeYQ .tab_setbtn").bind("click",setDefaultTab);
  580. if(menuId=="30400"){
  581. //应急预案列表页面注掉切换页头上那个红色圈圈。
  582. /*getShareNum();
  583. getXiubianNum();*/
  584. }
  585. return curId;
  586. };
  587. function setDefaultTab(){
  588. var tabId = $("#changeYQ .tab_selected").attr("data-yqid");
  589. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  590. var menuId = $("#positionTitle1").data("menuid");
  591. $.ajax({
  592. type: "POST",
  593. url: "/nwyj/ws/tabyq/PositionTabService/addOrUpdateTab",
  594. async: false,
  595. data: {
  596. menuId:menuId,
  597. userId:user_id,
  598. tabId:tabId
  599. },
  600. dataType:"text",
  601. success: function(data){
  602. $("#tablistcon").hide();
  603. }
  604. });
  605. }
  606. /***
  607. * 控制设置页签默认列表显隐
  608. */
  609. function setTabBtn(e){
  610. $("#tablistcon").toggle();
  611. stopPropagation(e);
  612. }
  613. function stopPropagation(e) {
  614. if (e.stopPropagation)
  615. e.stopPropagation();
  616. else
  617. e.cancelBubble = true;
  618. }
  619. /****
  620. * 设置页签默认列表样式切换
  621. */
  622. function selectTab(){
  623. $(".tab_selected").removeClass("tab_selected").addClass("tab_noselect");
  624. $(this).addClass("tab_selected").removeClass("tab_noselect");
  625. }
  626. //判断浏览器的类型
  627. function getOs(){
  628. if(navigator.userAgent.indexOf("MSIE")>0) {
  629. return "MSIE";
  630. } ;
  631. if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){
  632. return "Firefox";
  633. } ;
  634. if(isSafari=navigator.userAgent.indexOf("Safari")>0) {
  635. return "Safari";
  636. } ;
  637. if(isCamino=navigator.userAgent.indexOf("Camino")>0){
  638. return "Camino";
  639. };
  640. if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){
  641. return "Gecko";
  642. } ;
  643. };
  644. //后台返回共享中的预案个数
  645. function getShareNum(){
  646. var parent_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  647. //取系统时间:年月日时分秒
  648. var date = allGetServerTime();
  649. var seperator1 = "";
  650. var month = date.getMonth() + 1;
  651. var strDate = date.getDate();
  652. if (month >= 1 && month <= 9) {
  653. month = "0" + month;
  654. }
  655. if (strDate >= 0 && strDate <= 9) {
  656. strDate = "0" + strDate;
  657. }
  658. var time = date.getFullYear() + seperator1 +"-" + month + "-"+seperator1 + strDate;
  659. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getShareNum/';
  660. var params = {
  661. id : parent_id,
  662. time:time
  663. };
  664. $.ajax({
  665. url : url,
  666. type : 'post',
  667. timeout : 60000,
  668. data : params,
  669. dataType : 'json',
  670. success : function(data){
  671. var num = data.rows[0].NUM;
  672. appendOneDiv(num);
  673. },
  674. error : function(e){
  675. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  676. }
  677. });
  678. }
  679. //后台返回待修编的预案个数
  680. function getXiubianNum(){
  681. var parent_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  682. //取系统时间:年月日时分秒
  683. var date = allGetServerTime();
  684. var seperator1 = "";
  685. var month = date.getMonth() + 1;
  686. var strDate = date.getDate();
  687. if (month >= 1 && month <= 9) {
  688. month = "0" + month;
  689. }
  690. if (strDate >= 0 && strDate <= 9) {
  691. strDate = "0" + strDate;
  692. }
  693. var time = date.getFullYear() + seperator1 +"-" + month + "-"+seperator1 + strDate;
  694. var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getXiubianNum/';
  695. var params = {
  696. id : parent_id,
  697. time:time
  698. };
  699. $.ajax({
  700. url : url,
  701. type : 'post',
  702. timeout : 60000,
  703. data : params,
  704. dataType : 'json',
  705. success : function(data){
  706. var num = data.rows[0].NUM;
  707. appendTwoDiv(num);
  708. },
  709. error : function(e){
  710. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  711. }
  712. });
  713. }
  714. function appendOneDiv(data){
  715. var $dom = $(top.document.body).find(".positionTab").eq(2);
  716. $dom.css("position","relative");
  717. 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>");
  718. $dom.append($div);
  719. }
  720. function appendTwoDiv(data){
  721. var $dom1 = $(top.document.body).find(".positionTab").eq(1);
  722. $dom1.css("position","relative");
  723. 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>");
  724. $dom1.append($div1);
  725. $div1.render();
  726. }
  727. /**
  728. * 加载首页顶部滚动数据
  729. */
  730. function setMainIndex(){
  731. var Corpids = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();//系统登录人的单位id
  732. $.ajax({
  733. url : $.pathname() + "/ws/getNotice/GetNoticeService/getNotice",
  734. data : { corpId : Corpids},
  735. type : 'post',
  736. dataType : 'json',
  737. success : function(data) {
  738. // alert(JSON.stringify(data))
  739. setMainIndexTab(data);
  740. //setMainIndexTab([]);
  741. },
  742. error : function(e) {
  743. return;
  744. //$.messager.alert('访问服务失败!', 'error');
  745. }
  746. });
  747. }
  748. /**
  749. *设置首页顶部滚动条中的数据
  750. */
  751. function setMainIndexTab(myData){
  752. if(myData.length==0){
  753. return;
  754. }
  755. var alertdata = "";
  756. var responsedata = "";
  757. var responseval = "";
  758. var alertval = "";
  759. var alertcol = "";
  760. var responsecol = "";
  761. for(var i=0;i<myData.length;i++){
  762. if(myData[i].isAlert==1){
  763. var rcdn = myData[i].responsecol;
  764. responsecol = rcdn == "29"?"-28px -64px":rcdn == "30"?"-64px -62px":rcdn == "31"?"-102px -63px":rcdn == "32"?"-139px -63px":"";
  765. responsedata = "最新响应信息:"+ myData[i].corpName+" - "+myData[i].writeTime+" - "+myData[i].warningName;
  766. responseval = myData[i].isAlert+"|"+myData[i].fd_objectid;
  767. }
  768. if(myData[i].isAlert==0){
  769. var acdn = myData[i].alertcol;
  770. alertcol = (acdn == "35"?"-32px -20px":(acdn == "36"?"-65px -20px":(acdn == "37"?"-101px -22px":(acdn == "38"?"-139px -20px":""))));
  771. alertdata = "最新预警信息:"+ myData[i].corpName+" - "+myData[i].writeTime+" - "+myData[i].warningName;
  772. alertval = myData[i].isAlert+"|"+myData[i].fd_objectid;
  773. }
  774. }
  775. $("#main_index_tab_cont").html("");
  776. var marhtml = "<marquee id='marqueeid' scrollamount='3' scrolldelay='50' >";
  777. if(alertdata!=""){
  778. marhtml += "<span value="+alertval+" class='aresphref' ><u style='background-position:"+alertcol+";'></u><b>"+alertdata+"</b></span>";
  779. }
  780. marhtml += "&nbsp;&nbsp;&nbsp;&nbsp;";
  781. if(responsedata!=""){
  782. marhtml += "<span value="+responseval+" class='aresphref' ><u style='background-position:"+responsecol+";'></u><b>"+responsedata+"</b></span>";
  783. }
  784. marhtml += "</marquee>";
  785. $("#main_index_tab_cont").append(marhtml);
  786. //$("#main_index_tab").append("<div><marquee id='marqueeid' >"+responsedata+" "+alertdata+"</marquee></div>");
  787. //$("#main_index_tab").append('<div><marquee direction="left" scrollamount="20" scrolldelay="50" >'+responsedata+' '+alertdata+'</marquee></div>');
  788. //$("#main_index_tab").append("<div id='marqueeid'>"+responsedata+" "+alertdata+"</div>");
  789. alertdata = null;
  790. responsedata = null;
  791. responseval = null;
  792. alertval = null;
  793. $("#main_index_tab").show();
  794. $("#marqueeid").bind("mouseover",function(){
  795. this.stop();
  796. });
  797. $("#marqueeid").bind("mouseout",function(){
  798. this.start();
  799. });
  800. $(".aresphref").bind("click",function(){
  801. var value = $(this).attr("value");
  802. var valueArr = value.split("|");
  803. var dddurl = "";
  804. if(valueArr[0]==1){
  805. dddurl = "/nwyj/page/business/em/response/emergencyResponse/WarningView.jsp?fd_id="+valueArr[1];
  806. //$("#frmright").attr("src","/nwyj/page/business/em/response/emergencyResponse/WarningView.jsp?fd_id="+valueArr[1]);
  807. }else{
  808. dddurl = "/nwyj/page/business/em/alert/warning/WarningView.jsp?fd_id="+valueArr[1];
  809. //$("#frmright").attr("src","/nwyj/page/business/em/alert/warning/WarningView.jsp?fd_id="+valueArr[1]);
  810. }
  811. // $.noIndexOpenNextWindow(dddurl);
  812. window.open("/nwyj/page/cockpit/webgis/EventAllInfo.jsp?fd_id="+valueArr[1]+"&dept_id="+top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids());
  813. //alert(top.com.sinosoft.lz.system.user.LoginInfo.getUserInfo());
  814. //跳转页面
  815. /*var dddname = top.com.sinosoft.lz.system.user.LoginInfo.getUserInfo();
  816. //alert(dddname);
  817. var dddopener=window.open("/nwyj/page/frameWork.html");
  818. dddopener.fatherParam={"name":dddname,"idxWorkUrl":dddurl};*/
  819. $(this).remove();
  820. if($("#marqueeid").html()=="&nbsp;&nbsp;&nbsp;&nbsp;"){
  821. $("#marqueeid").remove();
  822. $("#main_index_tab").hide();
  823. }
  824. value = null;
  825. valueArr = null;
  826. dddurl = null;
  827. dddopener = null;
  828. });
  829. /*移除按钮的监听方法 */
  830. $("#main_index_closeimg").bind("mouseenter",function(){
  831. $(this).show().removeClass("cont_close1").addClass("cont_close2");
  832. });
  833. $("#main_index_closeimg").bind("mouseleave",function(){
  834. $(this).show().removeClass("cont_close2").addClass("cont_close1");
  835. });
  836. $("#main_index_closeimg").bind("click",function(){
  837. $(this).parent().hide();
  838. });
  839. $("#main_index_tab").bind("mouseover",function(){
  840. $("#main_index_closeimg").show();
  841. });
  842. $("#main_index_tab").bind("mouseout",function(){
  843. $("#main_index_closeimg").hide();
  844. });
  845. /*移除按钮的监听方法 */
  846. }