123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- /**
- * 用于框架调用的一些方法 2016/8/9 康国前加
- * 调用方法:1.引用次js
- * 2.用 $.方法名 使用方法,如:$.indexOpenSelfWindow(workUrl);
- */
- ;(function($,window,document,undefined) {
- var _this = this;
- _this.url = null;
- $.extend({
- /**
- * 本页面加载workUrl
- */
- indexOpenSelfWindow : function(workUrl){
- // var sessionID = top.com.sinosoft.lz.system.user.LoginInfo.getSessionID();
- // var cookie = $.getCookie(sessionID+"openerror");
- //console.log("cookie:"+cookie);
- //if("error"!=cookie){
- //console.log(sessionID+"openerror:正确");
- //页面至顶
- top.window.scrollTo(0,0);
- //调用frameWork页面的方法
- top.parent.frameWorkShowLoading();
- //加载框架iframe
- $(top.parent.document.body).find("#frmright").attr('src',workUrl);
- /*}else{
- //console.log(sessionID+"openerror:错误");
- top.window.location = '../';
- }*/
- },
- /**
- * 新建页面加载workUrl,保留框架
- */
- indexOpenNextWindow : function(workUrl){
- //alert(workUrl);
- //var userInfoStr = top.com.sinosoft.lz.system.user.LoginInfo.getUserInfo();
- _this.url = workUrl;
- window.open("/nwyj/page/frameWork.html");
- //opener.fatherParam={"name":userInfoStr,"idxWorkUrl":workUrl};
- },
-
- /**
- * 新建页面加载workUrl,不保留框架
- */
- noIndexOpenNextWindow : function(workUrl){
- /*var sessionID = top.com.sinosoft.lz.system.user.LoginInfo.getSessionID();
- var cookie = $.getCookie(sessionID+"openerror");
- //console.log("cookie:"+cookie);
- if("error"!=cookie){*/
- //var userInfoStr = top.com.sinosoft.lz.system.user.LoginInfo.getUserInfo();
- _this.url = workUrl;
- window.open("/nwyj/page/singlePage.html");
- //opener.fatherParam={"name":userInfoStr,"idxWorkUrl":workUrl};
- /*}else{
- //console.log(sessionID+"openerror:错误");
- top.window.location = '../';
- }*/
- },
-
- /**
- * 给新建窗口页面传参数
- */
- paramsToNextWindow : function(){
- var userInfoStr = top.com.sinosoft.lz.system.user.LoginInfo.getUserInfo();
- return {"name":userInfoStr,"idxWorkUrl":_this.url};
- },
-
- /**
- * 当页面失效时,在父窗口执行方法
- */
- reSetTopWindow : function(){
- //top.window.location = "../";
- },
- /**
- * 记录用户点击菜单次数
- */
- indexUserClickNum : function(menu_id,user_id){
- // $.ajax({
- // url : $.pathname() + '/ws/sys/SysCustomMenuService/setUserClickNum/',
- // type : 'post',
- // data : {
- // menu_id:menu_id,
- // user_id:user_id
- // },
- // dataType : 'text',
- // async:false,
- // success : function(data) {
- // //console.log(user_id+"点击了"+menu_id+"====="+data);
- // },
- // error : function(e) {
- // }
- // });
- },
- /**
- * 清除浏览器所有cookies
- */
- clearAllCookies : function (){
- var keys = document.cookie.match(/[^=;]+(?=\=)/g);
- if(keys){
- for(var i=keys.length;i--;){
- document.cookie = keys[i]+'=;expires='+new Date(0).toUTCString();
- }
- }
- },
- //设置cookie
- setCookie:function(key,value){
- var Then = allGetServerTime();
- Then.setTime(Then.getTime() + 1866240000000);
- document.cookie = key+"=" + value + ";expires="+Then.toGMTString();
- },
-
- //删除cookie
- getCookie : function (key){
- var cookieString = new String(document.cookie);
- //console.log("cookieString:"+cookieString);
- var cookieArr = cookieString.split(";");
- //console.log("cookieArr:"+cookieArr);
- for(var i=0; i<cookieArr.length;i++ ){
- if(cookieArr[i].indexOf(key)>-1){
- //console.log("cookieArr[i]"+cookieArr[i]);
- return cookieArr[i].split("=")[1];
- }
- }
- return null;
- },
-
- //删除cookie
- removeCookie:function(key){
- var Then = allGetServerTime();
- Then.setTime(Then.getTime() + 1866240000000);
- document.cookie = key+"=;expires="+Then.toGMTString();
- },
-
- /**
- * 全屏显示
- * @param dom
- */
- indexFullScreen : function(dom) {
- //非全屏时,进入全屏
- var el = document.documentElement;
- var rfs = el.requestFullScreen || el.webkitRequestFullScreen ||
- el.mozRequestFullScreen || el.msRequestFullScreen;
- if(typeof rfs != "undefined" && rfs) {
- rfs.call(el);
- } else if(typeof window.ActiveXObject != "undefined") {
- var wscript = new ActiveXObject("WScript.Shell");
- if(wscript != null) {
- wscript.SendKeys("{F11}");
- }
- }
- },
- /**
- * 退出全屏
- */
- indexExitFullScreen : function() {
- //全屏时,退出全屏
- var el = document,
- cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.mozCancelFullScreen || el.exitFullScreen,
- wscript;
- if (typeof cfs != "undefined" && cfs) {
- cfs.call(el);
- return ;
- }
- if (typeof window.ActiveXObject != "undefined") {
- wscript = new ActiveXObject("WScript.Shell");
- if (wscript != null) {
- wscript.SendKeys("{F11}");
-
- }
- }
- },
-
- indexDownloadFile : function(name,realName){
-
- },
- doEvalClick : function(url){
- $.indexOpenSelfWindow(url);
- top.Dialog.close();
- },
- doExamineClick : function(url){//考试
- window.open(url);
- top.Dialog.close();
- },
-
- addFrameTabs : function(arr){
- for(var i=0;i<arr.length;i++){
- var currentClass = "";
- if(i==0) currentClass = "positionTabCurrent";
- var $tab = $('<div class=" positiontitab positionTab '+currentClass+'" data-src="'+arr[i].url+'" >' +arr[i].name+'</div>');
- $("#positionMsg").append($tab);
- }
- },
- removeFrameTabs : function(){
- $(".positionTab").remove();
- },
- exportExcel : function(url,params,destFileName,fileExt){
-
- $.ajax({
- url :url,
- type : 'post',
- timeout : 150000,
- data : params,
- async:false,
- dataType : 'text',
- success : function(data){
- var fileUrl = $.pathname() +"/page/business/em/evaluate/inAndOutExcel/getExcel.jsp?exportContent="
- + data + "&fileExt="+fileExt+"&destFileName=" + encodeURI(encodeURI(destFileName));
- window.open(fileUrl);
- },
- error : function(e){
- top.Dialog.alert("导出Excel失败");
- }
- });
- }
-
- });
- })(jQuery,window,document);
|