var isLoadSelect = true;// 表示是否是加载的时候选择tab
|
var isLast="";//保存刷新系统前最后选择的页卡
|
var myFresh={}//关闭页卡获取面板和格线内容是否有改变。
|
var tabindex=0;//多个页卡的元素,用来区分页卡
|
myFresh.panel=new Array();//关闭页卡获取面板内容是否有改变。
|
myFresh.grids={};//关闭页卡获取格线内容是否有改变。
|
myFresh.formType=0;//关闭页卡排除的窗体类型。
|
myFresh.clickNode=false;//表示点击了树节点
|
var copyLink=new Array();//复制对应单据的链接=--- 2018-9-4 17:48:59 xin
|
var hostUrlCopy="";//复制链接用到
|
var copyUrl=""; //复制链接用到
|
var panelHeight=0;//tabs页卡里面的panel高度
|
var tabWidth=0;//设置页卡内容里的页卡(496窗体页卡)的宽度
|
//针对切换页卡后滚动条被置顶的问题设置两个属性 xin 2020-10-14 09:33:04
|
var scrollMap = new scrollTopMap();
|
var subPageScrollHeight=0;
|
var gridFileInputRow={};//针对格线附件控件的属性 xin 2022-3-1 09:19:18
|
var gridFileInputVal;//针对格线附件控件的值 xin 2022-3-1 09:20:43
|
var isFileInputImage;//针对附件控件图片放大 xin 2022-3-1 09:20:43
|
var treeTab=[];
|
//---end
|
myFresh.type=0;
|
$( function() {
|
$("#nagigation").tabs( {
|
tools : [ {
|
iconCls :'icon-back',
|
handler : function() {
|
$('body').layout('collapse', 'west');
|
}
|
} ],
|
border :true
|
});
|
|
$('#homePageTree')
|
.tree(
|
{
|
animate :true,
|
dnd :false,
|
cascadeCheck :true,
|
url :'/getUserMenu.do?menuId=1',
|
onBeforeExpand : function(node, param) {
|
$('#homePageTree').tree('options').url = "/getUserMenu.do?menuId="
|
+ node.id;
|
},
|
onClick : function(node) {
|
var obj = node.attributes;
|
if (obj.formid == "" || obj.formid == "null")
|
return;
|
addTab('', obj.formid, obj.formtype);
|
},
|
onMouseDown : function(node) {// hq添加新函数
|
// clickNode=node;
|
},
|
onMyDorpStart : function() {
|
// if(clickNode!=null)
|
// $('#homePageTree').tree('collapse',clickNode.target);
|
},
|
onDblClick : function(node) {
|
$('#homePageTree').tree('toggle', node.target);
|
}
|
});
|
|
$('#homeJumpHelp')
|
.tree(
|
{
|
animate :true,
|
dnd :false,
|
cascadeCheck :true,
|
url :'/getUserMenu.do?menuId=1',
|
onBeforeExpand : function(node, param) {
|
$('#homeJumpHelp').tree('options').url = "/getUserMenu.do?menuId="
|
+ node.id;
|
},
|
onClick : function(node) {
|
var obj = node.attributes;
|
if (obj.formid == "" || obj.formid == "null")
|
return;
|
var dbid=$.cookie('dbid');
|
var hostUrl=$("#hostURL").val();
|
var url=hostUrl+"/app/"+dbid+"/0/cnzh/"+obj.formid+"/"+obj.formtype+"/help.jsp";
|
$("#helpIframe").attr("src",url);
|
},
|
onMouseDown : function(node) {// hq添加新函数
|
},
|
onMyDorpStart : function() {
|
},
|
onDblClick : function(node) {
|
$('#homeJumpHelp').tree('toggle', node.target);
|
}
|
});
|
|
|
$('#homePageTree2')
|
.tree(
|
{
|
animate :true,
|
dnd :false,
|
cascadeCheck :true,
|
url :'/getChildWebMenuTree.do?menuid=0',
|
onBeforeExpand : function(node, param) {
|
$('#homePageTree2').tree('options').url = "/getChildWebMenuTree.do?menuid="
|
+ node.id;
|
},
|
onClick : function(node) {
|
var obj = node.attributes;
|
if (obj.formid == "" || obj.formid == "null")
|
return;
|
addTab('', obj.formid, obj.formtype);
|
},
|
onDblClick : function(node) {
|
$('#homePageTree2').tree('toggle', node.target);
|
}
|
});
|
$('#flowChartTree')
|
.tree(
|
{
|
animate :true,
|
dnd :false,
|
cascadeCheck :true,
|
url :'/getChildWebMenu2.do',
|
onBeforeExpand : function(node, param) {
|
var obj = node.attributes;
|
$('#flowChartTree').tree('options').url = "/getChildWebMenu2.do?rowid="
|
+ obj.rowid;
|
},
|
onClick : function(node) {
|
var obj = node.attributes;
|
$.post("/checkHasFlowchart.do?rowid=" + obj.rowid,
|
"", function(d) {
|
if ($.trim(d) == "true") {
|
addTab(node.text + "-流程图", '', '',
|
'',
|
"/mxgraph/showFlowChart.jsp?rowid="
|
+ obj.rowid, "", {
|
isFlowChart :true
|
});
|
} else {
|
alert("该节点没有配置流程图!");
|
}
|
|
});
|
},
|
onDblClick : function(node) {
|
$('#flowChartTree').tree('toggle', node.target);
|
}
|
});
|
$('#home-tabs').tabs(
|
{
|
onSelect : function(tt, index) {//当用户选择一个标签页面板(tab panel)时触发。
|
tabindex = index;
|
//----解决页卡切换后 滚动条被置顶的问题 xin 2020-10-14 09:18:13
|
var val = scrollMap.get(tabindex);
|
if (val!=null && val!=0) {
|
$("#home-tabs > div").eq(1).children("div").eq(tabindex).find("iframe")[0].contentWindow.scrollTo(0,val);
|
}
|
//------end
|
lastTabs = $.grep(lastTabs, function(n, i) {
|
return n != tt;
|
}); // 移除 tt
|
lastTabs.push(tt); // 重新压入,保证 最新的在最上面
|
|
var sTab = $("#home-tabs").tabs("getTab", index);
|
if (!isLoadSelect) {// 在循环添加cookie里面的tab改变改值
|
/* 第一次点击加载 */
|
// var info=$.cookie("lastSelectedTab");
|
tabWidth=(this.clientWidth-100);//针对496窗体页卡获取宽度
|
myFresh.formType=$(sTab).find('iframe').attr("type");
|
var sContent = $(sTab.panel("options").content);
|
if (isLast && isLast != ""
|
&& isLast == sContent.attr("id")) {
|
} else {
|
var url = sContent.attr("url");
|
if (url && url != "") {
|
sContent.attr("src", url).attr("url", "");
|
$("#home-tabs").tabs("update", {
|
tab : sTab,
|
options : {
|
content : sContent[0]
|
}
|
});
|
}
|
}
|
$.cookie("lastSelectedTab", $($.parseHTML(tt)).attr(
|
"frameid"));// 设置最后选择的选项卡到cookie
|
panelHeight=sTab[0].clientHeight;//panel面板高度
|
}
|
if(treeTab.length>0){
|
let iframe = $(sTab).find('iframe');
|
let name = iframe[0].id;
|
let index = $.inArray(name, treeTab);
|
if (index != -1) {
|
$(iframe).attr('src', $(iframe).attr('src'));
|
treeTab.splice(index, 1);
|
}
|
}
|
// var grid=$("#home-tabs > div").eq(1).children("div").eq(tabindex).find("iframe")[0].contentWindow.Grids;
|
// if(grid!=undefined&&grid[0]){
|
// grid[0].SetScrollTop (grid.currScrollTop);
|
// }
|
// if (sTab){
|
// var iframe=$(sTab).find('iframe');
|
// var type=iframe.attr("type");
|
// if (type!=null && type==496){
|
// $(iframe).attr('src', $(iframe).attr('src')); //刷新
|
// }
|
// }
|
},
|
onBeforeClose : function(title, index) {//当一个标签页面板(tab panel)被关闭前触发,返回 false 就取消关闭动作。
|
var target = this;
|
if (myFresh.panel[index] != 2 && myFresh.panel[index] != 1
|
&& myFresh.panel[index] != 16
|
&& myFresh.panel[index] != 22
|
&& myFresh.panel[index] != 20
|
&& myFresh.panel[index] != 18
|
&& myFresh.panel[index] != 38
|
&& myFresh.panel[index] != 3
|
&& myFresh.panel[index] != 10) {
|
if (myFresh.panel[index + '-t']
|
|| getGrid(myFresh.grids)) {
|
$.messager.confirm('确认',
|
'页面内容已有改动,关闭操作将会丢失数据,您确定要关闭当前页面吗?',
|
function(r) {
|
if (r) {
|
var opts = $(target)
|
.tabs('options');
|
var bc = opts.onBeforeClose;
|
opts.onBeforeClose = function() {
|
};
|
$(target).tabs('close', index);
|
opts.onBeforeClose = bc;
|
delCTab($($.parseHTML(title)).attr(
|
"frameid"));
|
myFresh.panel[index+'-t']=false;
|
}
|
});
|
return false; // 阻止关闭
|
} else {
|
delCTab($($.parseHTML(title)).attr("frameid"));
|
}
|
} else {
|
delCTab($($.parseHTML(title)).attr("frameid"));
|
}
|
myFresh.formType = (myFresh.Type == 0 ? myFresh.formType
|
: myFresh.Type);
|
myFresh.Type = 0;
|
},
|
onAdd:function(title,index){//当一个新的标签页面板(tab panel)被添加时触发复制链接。
|
var titleCopy=(title.indexOf("-")!=-1?title.split("-")[0].split("=")[1].replace(/\"/g, ""):title);
|
copyLink[index]=hostUrlCopy+"?"+encodeText(copyUrl+"&formname="+titleCopy);//复制对应单据的链接地址-----赋值 2018-9-4 17:48:59 xin
|
copyUrl="";
|
|
},
|
onUnselect:function(title,index) {//当用户未选择一个标签页面板(tab panel)时触发
|
//解决页卡切换后 滚动条被置顶的问题 xin 2020-10-14 09:50:44
|
if (tabindex > 0) {
|
scrollMap.put(index, subPageScrollHeight);
|
}
|
|
// var grid=$("#home-tabs > div").eq(1).children("div").eq(tabindex).find("iframe")[0].contentWindow.Grids;
|
// if(grid!=undefined&&grid[0]){
|
// grid[0].currScrollTop=grid[0].GetScrollTop();
|
// }
|
},
|
onClose:function(title,index){//当用户关闭一个标签页面板(tab panel)时触发。
|
|
}
|
});
|
try{
|
index = getCookieIndex();
|
}catch(e){}
|
setTimeout("eachCTab()", 1000);//刷新后执行加载之前打开没关闭的页卡
|
$("#home_north .easyui-menubutton").hover( function() {
|
$(this).find(".l-btn-text").css("color", "black");
|
}, function() {
|
$(this).find(".l-btn-text").css("color", "#EBEBEB");
|
});
|
$('.menu').hover( function() {
|
if (this.id=='mm2'){
|
$('#home_north #homehelp').find('.l-btn-text').css('color', 'black');
|
}else{
|
$('#home_north #shortcuts').find('.l-btn-text').css('color', 'black');
|
}
|
},function(){
|
$('#home_north .easyui-menubutton').find('.l-btn-text').css('color', '#EBEBEB');
|
});
|
doAddContextMenu2tab();
|
tabContextMenuEvent();
|
//智能小助手 2019-12-19 09:41:17
|
var Dom = {
|
helpIcon: $('.help-icon-container'), // 帮助按钮
|
helpContent: $('.ai-container'), // 帮助内容层
|
helpCloseIcon: $('i.close-dialog'), //帮助内容层关闭按钮
|
msgsList: $('.ai-content .msgs-ul'), //帮助内容层关闭按钮
|
repairLayout: $('#repairLayout'), // 解决布局等问题开关
|
reloadLayout: $('#reloadLayout') //
|
}
|
initHelpPosition();
|
var isDrag = false;
|
// 图标的显隐
|
Dom.helpIcon.on('mouseup', function () {
|
if (isDrag) return;
|
$(this).fadeOut(300);
|
setTimeout(function () {
|
Dom.helpContent.fadeIn();
|
},300)
|
});
|
Dom.helpCloseIcon.on('click', function () {
|
Dom.helpContent.fadeOut(300);
|
setTimeout(function () {
|
Dom.helpIcon.fadeIn();
|
},300)
|
});
|
// 帮助图标拖动
|
Dom.helpIcon.on('mousedown', function (ev) {
|
var disX = ev.clientX - Dom.helpIcon.offset().left;
|
var disY = ev.clientY - Dom.helpIcon.offset().top;
|
var height = $(document).height() - Dom.helpIcon.height();
|
var width = $(document).width() - Dom.helpIcon.width();
|
var extentX = 0;
|
var extentY = 0;
|
Dom.helpIcon.css('cursor','move');
|
$(document).on('mousemove', function (ev) {
|
isDrag = true;
|
extentX = ev.clientX - disX;
|
extentY = ev.clientY - disY;
|
// 限制可移动范围
|
extentX < 0 ? extentX = 0 : '';
|
extentX > width ? extentX = width : '';
|
extentY < 0 ? extentY = 0 : '';
|
extentY > height ? extentY = height : '';
|
Dom.helpIcon.css('left',extentX);
|
Dom.helpIcon.css('top',extentY);
|
});
|
$(document).on('mouseup',function () {
|
$(this).off();
|
if (isDrag){
|
// 存储位置
|
var positionX = extentX;
|
var positionY = extentY;
|
localStorage.setItem('helpPositionX', positionX);
|
localStorage.setItem('helpPositionY', positionY);
|
// console.log('ddd',positionX,positionY);
|
}
|
isDrag = false;
|
Dom.helpIcon.css('cursor','pointer');
|
})
|
$(document).on(' mouseout',function () {
|
$(this).off();
|
})
|
});
|
Dom.repairLayout.on('click',function () {
|
// 在这里发送请求处理布局等问题
|
var Tab = $("#home-tabs").tabs("getTab", tabindex);
|
var loading=$(Tab).find("div");
|
var iframe=$(Tab).find('iframe');
|
var formid=iframe.attr("src");
|
if(formid.indexOf('app/')!=-1){
|
if(formid.indexOf('/app')==0){
|
//有些情况是以/app开始 by danaus 2021-9-15
|
formid=formid.split('/')[5];
|
}else{
|
//有些页面是以app/开始,需要区分
|
formid=formid.split('/')[4];
|
}
|
}else{//待办事宜进入-xin 2020-3-18 13:49:34
|
try{
|
formid=formid.toLowerCase().replace(/\s+/g,"");
|
if(formid.indexOf('formid=')!=-1){
|
formid=formid.split('formid=')[1];
|
formid=formid.split('&')[0];
|
}
|
}catch(e){
|
formid=0;
|
}
|
}
|
if(isNaN(formid)){
|
$(iframe).attr('src', $(iframe).attr('src')); //刷新
|
var str = '<li class="msgs-li">\n' +
|
' <i class="iconfont icon-kefu1 avator"></i>\n' +
|
' <div class="msg-content">\n' +
|
' 当前页面不能操作,请进入具体功能页面操作生成!\n' +
|
' </div>\n' +
|
' </li>';
|
Dom.msgsList.append(str);
|
return;
|
}
|
$.ajax({
|
url: '/buildv2.do?formID='+formid,
|
dataType: 'html',
|
beforeSend: function() {
|
$(loading).show();
|
//showLoading();
|
},
|
complete: function() {
|
$(loading).hide();
|
//closeLoading();
|
},
|
success: function(data) {
|
var icon="error";
|
var hider=false;
|
if(data!=null&&data.indexOf("成功")>0){
|
data='生成成功,即将打开页面!';
|
icon="info";
|
hider=3000;
|
}
|
$.toast({
|
text: data, // Text that is to be shown in the toast
|
//text:'生成成功,即将打开页面!',
|
// heading: '提示', // Optional heading to be shown on the toast
|
|
icon: icon, // Type of toast icon
|
showHideTransition: 'fade', // fade, slide or plain
|
allowToastClose: true, // Boolean value true or false
|
hideAfter: hider, // false to make it sticky or number representing the miliseconds as time after which toast needs to be hidden
|
stack: 5, // false if there should be only one toast at a time or a number representing the maximum number of toasts to be shown at a time
|
position: 'mid-center', // bottom-left or bottom-right or bottom-center or top-left or top-right or top-center or mid-center or an object representing the left, right, top, bottom values
|
|
textAlign: 'left', // Text alignment i.e. left, right or center
|
loader: true, // Whether to show loader or not. True by default
|
loaderBg: '#9ec600', // Background color of the toast loader
|
beforeShow: function () {
|
}, // will be triggered before the toast is shown
|
afterShown: function () {
|
}, // will be triggered after the toat has been shown
|
beforeHide: function () {
|
}, // will be triggered before the toast gets hidden
|
afterHidden: function () {
|
$(iframe).attr('src', $(iframe).attr('src')); //刷新
|
replyMsg();
|
} // will be triggered after the toast has been hidden
|
});
|
},
|
error: function (xhr, ajaxOptions, thrownError) {
|
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
}
|
});
|
// console.log('发送请求');
|
});
|
Dom.reloadLayout.on('click', function () {
|
// 在这里发送请求处理布局等问题
|
var Tab = $("#home-tabs").tabs("getTab", tabindex);
|
var loading = $(Tab).find("div");
|
var iframe = $(Tab).find('iframe');
|
var formid = iframe.attr("src");
|
if (formid.indexOf('app/') != -1) {
|
if (formid.indexOf('/app') == 0) {
|
//有些情况是以/app开始 by danaus 2021-9-15
|
formid = formid.split('/')[5];
|
} else {
|
//有些页面是以app/开始,需要区分
|
formid = formid.split('/')[4];
|
}
|
} else {//待办事宜进入-xin 2020-3-18 13:49:34
|
try {
|
formid = formid.toLowerCase().replace(/\s+/g, "");
|
if (formid.indexOf('formid=') != -1) {
|
formid = formid.split('formid=')[1];
|
formid = formid.split('&')[0];
|
}
|
} catch (e) {
|
formid = 0;
|
}
|
}
|
if (isNaN(formid)) {
|
$(iframe).attr('src', $(iframe).attr('src')); //刷新
|
var str = '<li class="msgs-li">\n' +
|
' <i class="iconfont icon-kefu1 avator"></i>\n' +
|
' <div class="msg-content">\n' +
|
' 当前页面不能操作,请进入具体功能页面操作生成!\n' +
|
' </div>\n' +
|
' </li>';
|
Dom.msgsList.append(str);
|
return;
|
}
|
$.ajax({
|
url: '/grid/clearCookie.do?cookieType=PC&formid=' + formid,
|
dataType: 'html',
|
beforeSend: function () {
|
$(loading).show();
|
//showLoading();
|
},
|
complete: function () {
|
$(loading).hide();
|
//closeLoading();
|
},
|
success: function (data) {
|
var icon = "error";
|
var hider = false;
|
if (data != null && data.indexOf("成功") > 0) {
|
data = '还原成功,刷新当前页面!';
|
icon = "info";
|
hider = 3000;
|
}
|
$.toast({
|
text: data, // Text that is to be shown in the toast
|
//text:'生成成功,即将打开页面!',
|
// heading: '提示', // Optional heading to be shown on the toast
|
|
icon: icon, // Type of toast icon
|
showHideTransition: 'fade', // fade, slide or plain
|
allowToastClose: true, // Boolean value true or false
|
hideAfter: hider, // false to make it sticky or number representing the miliseconds as time after which toast needs to be hidden
|
stack: 5, // false if there should be only one toast at a time or a number representing the maximum number of toasts to be shown at a time
|
position: 'mid-center', // bottom-left or bottom-right or bottom-center or top-left or top-right or top-center or mid-center or an object representing the left, right, top, bottom values
|
|
textAlign: 'left', // Text alignment i.e. left, right or center
|
loader: true, // Whether to show loader or not. True by default
|
loaderBg: '#9ec600', // Background color of the toast loader
|
beforeShow: function () {
|
}, // will be triggered before the toast is shown
|
afterShown: function () {
|
}, // will be triggered after the toat has been shown
|
beforeHide: function () {
|
}, // will be triggered before the toast gets hidden
|
afterHidden: function () {
|
$(iframe).attr('src', $(iframe).attr('src')); //刷新
|
replyMsg();
|
} // will be triggered after the toast has been hidden
|
});
|
},
|
error: function (xhr, ajaxOptions, thrownError) {
|
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
}
|
});
|
// console.log('发送请求');
|
})
|
|
// 初始化帮助图标的位置
|
function initHelpPosition() {
|
var positionX = localStorage.getItem('helpPositionX');
|
var positionY = localStorage.getItem('helpPositionY');
|
Dom.helpIcon.fadeIn(2000);
|
if (positionX && positionY) {
|
Dom.helpIcon.css({
|
left: parseInt(positionX),
|
top: parseInt(positionY)
|
});
|
}
|
}
|
function replyMsg() {
|
var str = '<li class="msgs-li">\n' +
|
' <i class="iconfont icon-kefu1 avator"></i>\n' +
|
' <div class="msg-content">\n' +
|
' 是否解决了您的问题?如果没有请联系我们的人工客服!\n' +
|
' </div>\n' +
|
' </li>';
|
Dom.msgsList.append(str);
|
}
|
});
|
|
index = 0;
|
var rot="";
|
var changFrame = "";// 更改的框架名称 特指父框架
|
var thisFrame = "";// 创建页卡时的框架名称 特指子框架
|
var postToThis = "";// 接受字段 父页面
|
var panelToPost = "";// 所需字段 子页面
|
var panel_onlyOne="";
|
var T_Grid = "";
|
var lastTabs = new Array(); // 当用户关闭tab时,自动切换到前一个tab不至于让用户看到空的界面。
|
|
function addTab(title, formId, formType, para, url, id, obj) {
|
var flag = checkSession();//session失效后弹出登录框,flag为true时表示已经失效
|
if(flag){
|
return;
|
}
|
var encode = true;
|
if (obj) {
|
if (typeof (obj.encode) != "undefined") {
|
encode = obj.encode;
|
}
|
}
|
if ($.trim(formId + "").length > 0) {
|
checkFormIdExsist(formId, function(d) {
|
if (d.exists) {
|
if(para==undefined||para==""){
|
para="";
|
para+=d.query_string;
|
|
}else{
|
para+=(d.query_string==""?d.query_string:" and ( "+d.query_string+" )");
|
}
|
addTab$(d.menuname, formId, formType, para, true, url, "",encode, obj);
|
} else {
|
alert("在系统菜单里没有该功能号的设置!");
|
}
|
});
|
} else {
|
if (typeof (obj) == 'undefined' || typeof (obj.encode) == "undefined") {
|
encode = false;
|
}
|
addTab$(title, '', formType, '', false, url, id, encode, obj);
|
}
|
}
|
/** **tabs右键菜单start*** */
|
function doAddContextMenu2tab() {
|
$("body").on('contextmenu',".tabs-inner", function(e) {
|
$('#tabContextMenu').menu('show', {
|
left :e.pageX,
|
top :e.pageY
|
});
|
var title = $(this).find("span.tabs-title").html();
|
$('#tabContextMenu').data("currTitle", title);
|
return false;
|
});
|
}
|
|
var sysTabTitle = "桌面";
|
function tabContextMenuEvent() {
|
$("#tabclose").click( function() {// 关闭当前
|
// var t = getCt();
|
// if(sysTabTitle!=t){
|
// closeTabByFrameId($(t).attr("frameid"));
|
// }
|
var ct = getCt();
|
var t;
|
$('#home-tabs').find(".tabs li").each( function() {
|
t = $(this).find(".tabs-title").html();
|
if (t == ct) {
|
$(this).find('.tabs-close').click();
|
}
|
});
|
});
|
$("#tabcloseall").click( function() {// 关闭所有
|
// var t;
|
// $('#home-tabs').find(".tabs li").each(function(){
|
// t=$(this).find(".tabs-title").html();
|
// if(sysTabTitle!=t){
|
// closeTabByFrameId($(t).attr("frameid"));
|
// }
|
// });
|
$("#home-tabs").find(".tabs-close").each( function(i) {
|
$(this).click();
|
});
|
});
|
$("#tabcloseother").click( function() {// 除此之外关闭所有
|
var ct = getCt();
|
var t;
|
$('#home-tabs').find(".tabs li").each( function() {
|
t = $(this).find(".tabs-title").html();
|
if (sysTabTitle != t && t != ct) {
|
// closeTabByFrameId($(t).attr("frameid"));
|
$(this).find('.tabs-close').click();
|
}
|
});
|
});
|
|
$("#tabcloseleft").click( function() {// 关闭左侧
|
var prev = $('#home-tabs').find(".tabs .tabs-selected")
|
.prevAll();
|
var ct = getCt();
|
var t;
|
prev.each( function() {
|
t = $(this).find(".tabs-title").html();
|
if (sysTabTitle != t && t != ct) {
|
$(this).find('.tabs-close').click();
|
//closeTabByFrameId($(t).attr("frameid"));
|
}
|
});
|
});
|
|
$("#tabcloseright").click( function() {// 关闭右侧
|
var next = $('#home-tabs').find(".tabs .tabs-selected")
|
.nextAll();//.tabs('getSelected')
|
var ct = getCt();
|
var t;
|
next.each( function() {
|
t = $(this).find(".tabs-title").html();
|
if (sysTabTitle != t && t != ct) {
|
$(this).find('.tabs-close').click();
|
//closeTabByFrameId($(t).attr("frameid"));
|
}
|
});
|
});
|
}
|
function getCt() {
|
return $('#tabContextMenu').data("currTitle");
|
}
|
/**
|
* 获取当前页卡格线是否有内容改动
|
* @param grids
|
* @returns
|
*/
|
function getGrid(grids){
|
try{
|
if(grids!=null){
|
for(var g=0;g<grids.length;g++){
|
if(grids[g].checkData()){
|
return grids[g].checkData();
|
break;
|
}
|
}
|
}
|
}catch(e){
|
return false;
|
}
|
return false;
|
}
|
/** **tabs右键菜单end*** */
|
function openByFormId(obj) {// 打开选项卡通过formid
|
if (!obj || !obj.formId || !obj.formType) {
|
alert("功能号(formId)、功能类型(formType)必须传递!");
|
return;
|
}
|
// alert($);
|
// var tempObj = $.extends({parameter:"",encode:true},obj);
|
// alert(tempObj.parameter);
|
}
|
var title4operaOld = null;// 解决opera 3点返回值后不选择选项卡
|
var title4operaNew = null;
|
function addTab$(title, formId, formType, para, isFunc, url, id, isEncode,
|
paraObj) {
|
var tabCount = $('#home-tabs').tabs('tabs').length;
|
if (tabCount > 20) {
|
$.messager.alert("系统提示", '您当前打开了太多的页面,如果继续打开,会造成程序运行缓慢,无法流畅操作!',
|
"error");
|
}
|
if (tabCount > 20)
|
return;
|
var undf = "undefined";
|
if (typeof (id) != undf && $.trim(id) != "") {
|
thisFrame = id;
|
} else {
|
index++;
|
thisFrame = "home_ye" + index;
|
}
|
if (isFunc) {
|
|
// 调用拿选项卡标题的方法
|
title = getT(para, formType, formId, title);
|
var ti = title;
|
if (ti.length > 10)
|
ti = title.substring(0, 10) + "..";
|
title = "<a title=\"" + title + "\" frameid=\"" + thisFrame + "\">"
|
+ ti + "</a>";
|
}
|
if (undefined == url || $.trim(url) == "") {
|
url = "/app" + spellPath + formId + "/" + formType + "/index.jsp";
|
copyUrl=url;
|
if (para != undefined && para != null && para.length > 0) {
|
para = $.trim(para);
|
if (true == isEncode){
|
url += "?" + encodeText(para);
|
copyUrl=url;//复制链接用到
|
}else{
|
copyUrl=url+ "?" + encodeText(para);//复制链接用到
|
url += "?" + para;
|
}
|
}
|
} else {
|
copyUrl=url;
|
if (!isFunc && true == isEncode){
|
url = encodeURL(url);
|
copyUrl=encodeURL(url);
|
}
|
}
|
if (title.indexOf("frameid=") == -1
|
&& (typeof (paraObj) == undf
|
|| typeof (paraObj.isFlowChart) == undf || !paraObj.isFlowChart)) {
|
title += "<span class='hidden'>" + Math.round(Math.random() * 100000)
|
+ "</span>";
|
}
|
if (typeof (paraObj) != undf) {
|
if (typeof (paraObj.isFlowChart) != undf) {// 如果是isFlowChart类型的每次选择都刷新
|
var tab = $("#home-tabs").tabs("getTab", title);
|
if (tab != null) {
|
$("#home-tabs").tabs("select", title);
|
var selectt = $("#home-tabs").tabs("getSelected");
|
$("#home-tabs").tabs("update", {
|
tab :selectt,
|
options : {
|
content :selectt.panel("options").content
|
}
|
});
|
return;
|
}
|
}
|
}
|
/* 解决首次打开cookie里面保存的选项卡时不加载 */
|
var urlt = "";
|
if (isLoadSelect) {// 首次加载
|
urlt = url;
|
//url = "";//by danaus 15/9/8 处理加载最后tab时空白问题
|
}
|
/* end */
|
//var tid=Math.round(Math.random()*10000)
|
|
//设置新页卡的高度为指定高度px(不能使用 100%),如果不设置指定高度px,遇到 chrome 低版本时(如 for xp )时页面只显示上半截 ,Added by Johns Wang,2018-12-04
|
var iFrameHeight = $('#home-tabs').height() ;
|
//var barHeight = window.innerHeight - document.body.clientHeight ;
|
//AI智能小手指loading xin 2019-12-20 15:11:59
|
var loading="<div id=\"ailoading\" class=\"ailoading\" style=\"display: none\"><p class=\"ailoadingMsg\">AI小助手解决中,请稍等...</p></div>"
|
$('#home-tabs').tabs('add', {
|
title :title,
|
content :loading+"<iframe pframe='"+ changFrame+ "' posttothis='"+ postToThis+ "' paneltopost='"+ panelToPost+ "" +
|
"' t_grid='"+ T_Grid+ "' panel_onlyone='"+ panel_onlyOne+ "' id='"+ thisFrame+ "' name='"+ thisFrame+ "" +
|
"' type=\""+formType+"\" src=\""+ url + "\" url=\""+ urlt + "\" frameborder='0' width='100%' height='" + (parseInt(iFrameHeight)-40) + "px' " +
|
"onload='toScrollFrameM(\"#"+thisFrame+"\");'></iframe>",
|
closable :true
|
});
|
changFrame = "";
|
panelToPost = "";
|
postToThis = "";
|
T_Grid = "";
|
if (isFunc) {
|
addCTab(thisFrame, title, url,formType);
|
setCookieIndex(index);
|
}
|
let treeArr = [2, 3, 4, 9, 17, 20, 30, 238, 497];//特殊窗体
|
if ($.inArray(parseInt(formType), treeArr) != -1) {//是特殊窗体 xin 2022-4-16 17:31:56
|
treeTab.push(thisFrame);
|
}
|
}
|
|
var para1="";
|
function formNum(num){
|
para1=num;
|
}
|
|
// TW_跟据窗体类型加载选项卡的标题:功能名+功能号+列表+(详情)+(单号)
|
function getT(para, formType, formId, title) {
|
var oddnum;// 单号
|
var numid = parent.numId;//在encode.js中取值
|
if(numid.indexOf("doccode")!=-1 && numid.trim()!="''" && numid.length<20){
|
if(numid.substring(numid.indexOf("doccode")+8,numid.indexOf("doccode")+10)!="''"){
|
oddnum = numid.substring(numid.indexOf("'")+1,numid.length-1);
|
}
|
}
|
if(para1!="" && para1!=null){
|
oddnum=para1;
|
}
|
if ($.trim(para).length > 3 && para1=="") {
|
oddnum = para.substring(para.indexOf("'") + 1, para.length - 1);// 因为单号存在para这个条件语句里面,所以要从里面截取出来
|
}
|
para1=""
|
if (formType == 5 || formType == 8 || formType == 16 || formType == 496
|
|| formType == 498) {
|
if (oddnum != null) {
|
title = $.trim(title) + "-明细-" + formId + "-" + oddnum;
|
} else {
|
title = $.trim(title) + "-明细-" + formId;
|
}
|
} else if (formType == 1 || formType == 15 || formType == 17
|
|| formType == 18 || formType == 497 || formType == 499
|
|| formType == 7 || formType == 10 || formType == 9) {
|
title = $.trim(title) + "-列表-" + formId;
|
} else {
|
title = $.trim(title) + "-" + formId;
|
}
|
return title;
|
}
|
// TW
|
|
function resetTabName(t) {
|
var tab = getTabSelected();
|
if (tab == null)
|
return;
|
var ti = t;
|
if (t.length > 10)
|
ti = t.substring(0, 10) + "..";
|
var frameid = $(getTabSelected().panel("options").title).attr("frameid");
|
$("#home-tabs .tabs-selected .tabs-title")
|
.html(
|
"<a title=\"" + t + "\" frameid=\"" + frameid + "\">" + ti
|
+ "</a>");
|
}
|
function closeTab(fun) {
|
// var t=getTabSelected().panel("options").title;
|
// $("#home-tabs").tabs("close",t);
|
$('#home-tabs').find('.tabs-selected').find('.tabs-close').click();// pengbei
|
// add
|
if (typeof fun == "function") {
|
fun();
|
} else if (typeof fun != "undefined") {
|
alert(fun);
|
}
|
}
|
function closeTabByFrameId(id) {
|
$("#home-tabs").find(".tabs-title>a").each(
|
function() {
|
if (id == $(this).attr("frameid")) {
|
var t = $(this);
|
$("#home-tabs").tabs(
|
"close",
|
"<a title=\"" + t.attr("title") + "\" frameid=\""
|
+ id + "\">" + t.text() + "</a>");
|
return false;
|
}
|
});
|
}
|
|
function getIframeAttr(str) {
|
var v_ = "";
|
var select = getTabSelected();
|
if (select != null) {
|
v_ = select.find("iframe").attr(str);
|
}
|
return v_;
|
}
|
function getTabSelected() {
|
return $("#home-tabs").tabs("getSelected");
|
}
|
|
function selectTab(info){
|
//$("#home-tabs").find(".tabs-title>a").each(function(){
|
// if(info==$(this).attr("frameid")){
|
// var t=$(this);
|
//$("#home-tabs").tabs("select","<a title=\""+t.attr("title")+"\" frameid=\""+info+"\">"+t.text()+"</a>");
|
// $(this).click();
|
// return false;
|
// }
|
//});
|
$("#home-tabs a[frameid='"+info+"']").click();
|
}
|
var topFrame = {// 兼容旧系统parent.topFrame.funcLink
|
funcLink : function(f, t, sf, lf, lk, sd, ld, isp, ef, mes, ref, clo,
|
autoSave,sortid,messageTip) {
|
var tempFrame = getTabSelected().find("iframe")[0];
|
tempFrame.contentWindow.funcLink(f, t, sf, lf, lk, sd, ld, isp, ef,
|
mes, ref, clo, autoSave,sortid,messageTip);
|
}
|
};
|
//---------------解决页卡切换后 滚动条被置顶的问题 xin 2020-10-14 09:16:55
|
$(window).scroll(function(){
|
//父页面值
|
if ($(document).scrollTop() > 0) {
|
parent.subPageScrollHeight = $(document).scrollTop();
|
}
|
});
|
function scrollTopMap() {
|
var struct = function(key, value) {
|
this.key = key;
|
this.value = value
|
};
|
var put = function(key, value) {
|
for (var i = 0; i < this.arr.length; i++) {
|
if (this.arr[i].key === key) {
|
this.arr[i].value = value;
|
return
|
}
|
}
|
this.arr[this.arr.length] = new struct(key, value)
|
};
|
var get = function(key) {
|
for (var i = 0; i < this.arr.length; i++) {
|
if (this.arr[i].key === key) {
|
return this.arr[i].value
|
}
|
}
|
return null
|
};
|
var remove = function(key) {
|
var v;
|
for (var i = 0; i < this.arr.length; i++) {
|
v = this.arr.pop();
|
if (v.key === key) {
|
continue
|
}
|
this.arr.unshift(v)
|
}
|
};
|
var getAllValues = function() {
|
var tmp = new Array();
|
for (var i = 0; i < this.arr.length; i++) {
|
tmp[i] = this.arr[i].value
|
}
|
return tmp
|
};
|
var getAllKeys = function() {
|
var tmp = new Array();
|
for (var i = 0; i < this.arr.length; i++) {
|
tmp[i] = this.arr[i].key
|
}
|
return tmp
|
};
|
var size = function() {
|
return this.arr.length
|
};
|
var isEmpty = function() {
|
return this.arr.length <= 0
|
};
|
var removeAll = function() {
|
this.arr = []
|
};
|
this.getFirstValue = function() {
|
return this.arr[0].value
|
};
|
this.getFirstKey = function() {
|
return this.arr[0].key
|
};
|
this.arr = new Array();
|
this.get = get;
|
this.put = put;
|
this.remove = remove;
|
this.size = size;
|
this.isEmpty = isEmpty;
|
this.removeAll = removeAll;
|
this.getAllValues = getAllValues;
|
this.getAllKeys = getAllKeys;
|
};
|
//----------------------------end
|