function FindParam(url111, name) {
var url = url111; //获取url中"?"符后的字串
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.substr(url.indexOf("?") + 1);
strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
}
return theRequest[name];
}
/**
* 跟随元素显示 follow_id:跟随元素id, title:弹出层标题,可空, htmlContent:显示的HTML片段
*/
function followAlertHtml(follow_id, title, htmlContent) {
if (!follow_id) {} else {
if (!htmlContent) {
return;
}
var dialog = null;
if (title == null || title == "") {
title = false;
}
$('#' + follow_id).hover(function() {
dialog = artDialog({
// id : 'follow',
title: title,
fixed: false,
// cancel: true,
// cancelVal:"关闭",
lock: false,
padding: '0',
content: htmlContent,
follow: document.getElementById(follow_id),
});
dialog.flag = false;
/**
* for(var i in dialog){ console.log(i); }
*/
}, function() {
closeFollowDialog(dialog);
});
}
}
/**
* 跟随元素显示 follow_dom:跟随dom元素, title:弹出层标题,可空, htmlContent:显示的HTML片段
*/
function followAlertHtmlByDom(follow_dom, title, htmlContent) {
if (!follow_dom) {} else {
if (!htmlContent) {
return;
}
var dialog = null;
if (title == null || title == "") {
title = false;
}
$(follow_dom).hover(function() {
dialog = artDialog({
// id : 'follow',
title: title,
fixed: false,
// cancel: true,
// cancelVal:"关闭",
lock: false,
padding: '0',
content: htmlContent,
follow: follow_dom
});
dialog.flag = false;
}, function() {
closeFollowDialog(dialog);
});
}
}
function followAjaxAlterHtmlByDom(follow_dom, title, helpHaShCode) {
if (!follow_dom) {} else {
if (!helpHaShCode) {
return;
}
var htmlContent = null;
$
.ajax({
url: "/service?ssServ=queryHelpByHaHex",
type: "POST",
data: {
helpHaHex: helpHaShCode
},
async: false,
success: function(data) {
htmlContent = '
' +
'代码:' +
helpHaShCode +
'
' +
data +
'';
}
});
var dialog = null;
if (title == null || title == "") {
title = false;
}
$(follow_dom).hover(function() {
dialog = artDialog({
// id : 'follow',
title: title,
fixed: false,
// cancel: true,
// cancelVal:"关闭",
lock: false,
padding: '0',
content: htmlContent,
follow: follow_dom
});
dialog.flag = false;
}, function() {
closeFollowDialog(dialog);
});
}
}
function followAlertHtml1(follow_id, title, htmlContent) {
if (!follow_id) {} else {
if (!htmlContent) {
return;
}
var dialog = null;
if (title == null || title == "") {
title = false;
}
$('#' + follow_id).hover(function() {
dialog = artDialog({
// id : 'follow',
title: title,
fixed: false,
// cancel: true,
// cancelVal:"关闭",
lock: false,
padding: '0',
content: htmlContent,
follow: document.getElementById(follow_id)
});
dialog.flag = false;
}, function() {
closeFollowDialog(dialog);
});
}
}
/**
* 跟随元素显示 follow_id:元素id, url:显示的url页面路径, title:弹出层标题,可空 param:传递参数
* ,格式:name1=value1&name2=value2&name3=value3
*/
function followAlertUrlByid(follow_id, title, url, param) {
if (!follow_id) {} else {
if (!url) {
return;
}
var dialog = null;
if (title == null || title == "") {
title = false;
}
$('#' + follow_id).hover(function() {
$.ajax({
// async : false,
url: url,
data: param,
success: function(data) {
if (data != null && data != "") {
dialog = art.dialog({
// id : 'follow1',
title: title,
// cancel: true,
// cancelVal:"关闭",
fixed: false,
lock: false,
overflow: "auto",
padding: '0',
content: data,
follow: document.getElementById(follow_id)
});
}
},
cache: false
});
}, function() {
});
}
}
/**
* 跟随元素显示 follow_object:元素对象(jquery对象), url:显示的url页面路径, title:弹出层标题,可空
* param:传递参数 ,格式:name1=value1&name2=value2&name3=value3
*/
function followAlertUrlByObject(follow_object, title, url, param) {
if (!follow_object) {} else {
if (!url) {
return;
}
var dialog = null;
if (title == null || title == "") {
title = false;
}
$(follow_object).hover(function() {
$.ajax({
// async : false,
url: url,
data: param,
success: function(data) {
if (data != null && data != "") {
dialog = art.dialog({
// id : 'follow_object',
title: title,
// cancel: true,
// cancelVal:"关闭",
fixed: true,
lock: false,
overflow: "auto",
padding: '0',
content: data,
follow: follow_object.get(0)
});
}
},
cache: false
});
dialog.flag = false;
}, function() {
closeFollowDialog(dialog);
});
}
}
/**
* 跟随元素显示 follow_dom:元素对象(dom对象), url:显示的url页面路径, title:弹出层标题,可空 param:传递参数
* ,格式:name1=value1&name2=value2&name3=value3
*/
function followAlertUrlByDom(follow_dom, title, url, param) {
if (!follow_dom) {} else {
if (!url) {
return;
}
var dialog = null;
if (title == null || title == "") {
title = false;
}
$(follow_dom).hover(function() {
$.ajax({
// async : false,
url: url,
data: param,
success: function(data) {
if (data != null && data != "") {
dialog = art.dialog({
// id : 'follow_dom',
title: title,
// cancel: true,
// cancelVal:"关闭",
fixed: true,
lock: false,
overflow: "auto",
padding: '0',
content: data,
follow: follow_dom
});
}
},
cache: false
});
dialog.flag = false;
}, function() {
closeFollowDialog(dialog);
});
}
}
function followAlertHelp(title, url, appName) {
if (!url || appName == null || appName.trim() == "") {
return;
}
$("[wdHelp]").each(
function(i) {
var follow_object = $(this);
var helpCode = $(this).attr("wdHelp");
if (follow_object != null && helpCode != null &&
helpCode.trim() != "") {
followAlertUrlByObject(follow_object, title, url,
"helpCode=" + helpCode + "&appName=" + appName);
}
});
}
function onFollowAlertHelp(follow_dom, title, url, helpCode) {
var param = "helpCode=" + helpCode;
$.ajax({
// async : false,
url: url,
data: param,
success: function(data) {
if (data != null && data != "") {
var dialog = art.dialog({
id: 'follow_dom',
title: title,
// cancel: true,
// cancelVal:"关闭",
fixed: true,
lock: false,
overflow: "auto",
padding: '0',
content: data,
follow: follow_dom
});
if (dialog != null) {
dialog.DOM.wrap.bind('mouseleave', function() {
dialog.close();
});
}
}
},
cache: false
});
}
//右键显示(根据id)
function onRightfollowAlertHtml(follow_id, title, htmlContent) {
if (!follow_id) {} else {
if (!htmlContent) {
return;
}
var dialog = null;
if (title == null || title == "") {
title = false;
}
$('#' + follow_id).bind('contextmenu', function(e) {
return false;
});
$('#' + follow_id).mousedown(function(e) {
if (e.which == 3) { // 1 = 鼠标左键 left; 2 = 鼠标中键; 3 = 鼠标右键
dialog = artDialog({
//id : 'follow',
title: title,
fixed: false,
// cancel: true,
// cancelVal:"关闭",
lock: false,
padding: '0',
content: htmlContent,
follow: document.getElementById(follow_id),
});
dialog.flag = false;
$('#' + follow_id).bind('mouseleave', function(e) {
closeFollowDialog(dialog);
$(this).unbind('mouseleave');
});
}
});
}
}
//右键显示(根据dom元素)
function onRightfollowAjaxAlterHtmlByDom(name, title, helpsize, helpHaShCode,token) {
try {
// var selector = "[name=" + name + "]";
// var follow_dom = document.querySelector(selector);
// if (!follow_dom) return;
// changeImage(selector);
var data = { helpContent: document.querySelector("#helpcontent" + helpHaShCode).innerHTML, helpSize: helpsize ,token:token};
data.title = title;
data.name = name;
data.helpHaShCode = helpHaShCode;
//计算当前页面有效的帮助
var count=0;
//选项卡3级帮助
if(token){
/* 再改,规范 0){
addHelpData(data, true);
var wdDialogId = wd.display.getwdDialogId();
showwdHelpButton(wdDialogId);
}
} catch (e) {
console.log(e)
}
}
function closeFollowDialog(dialog) {
if (dialog != null) {
dialog.DOM.wrap.bind('mouseover', function() {
dialog.flag = true;
});
dialog.DOM.wrap.bind('mouseleave', function() {
dialog.close();
dialog.flag = false;
});
window.setTimeout(function() {
if (!dialog.flag) {
// console.log('flag:'+dialog.flag);
dialog.close();
}
}, 10);
}
}
function getClass(obj, attr) {
if (obj.currentStyle) {
if (attr == "backgroundPosition") {
return obj.currentStyle.backgroundPositionX + " " +
obj.currentStyle.backgroundPositionY;
} else {
return obj.currentStyle[attr];
}
} else {
return document.defaultView.getComputedStyle(obj, null)[attr];
}
}
function changeImage(dom) {
// var domBgUrl = getClass(dom, "backgroundImage");
// domBgUrl = domBgUrl.substring(4, domBgUrl.length - 1);
// domBgUrl = domBgUrl.replace(/http:\/\/([^\s\/])+/, "");
//
// var imgPath = domBgUrl.substring(0, domBgUrl.lastIndexOf("?"));
// if (domBgUrl.lastIndexOf("?") != -1) {
// imgPath = imgPath.substring(0, imgPath.lastIndexOf("/") + 1);// 图片所在的文件位置
// var changeImgStartIndex = domBgUrl.lastIndexOf("=") + 1;
// var changeImg = domBgUrl.substring(parseInt(changeImgStartIndex),
// parseInt(domBgUrl.length));
// changeImg = imgPath + changeImg;
// changeImg = changeImg.replace(/\"/g, "");
// var imgUrl = "url(" + changeImg + ")";// 图片URL
//
// dom.style.backgroundImage = imgUrl;
// }
// dom.style.cursor = "url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSgBBwcHCggKEwoKEygaFhooKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKP/AABEIABoAGgMBEQACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APTvjhbwS3f2mWGN7mw8L63e2czIC9tcRmzMcsZ6o6nkMMEdjQB2Om+PNHub46ff/aNI1JZltnt9QjCATsFZIRMpaF5WV0YRpIzEN04IAB1VAHwB+1H/AMl28Tf9uv8A6SxUAfUfhfwcZ9Zl0zW7++1COx0q60fUor+9lla7+0i2K3URcl1SVInDKHCo8bKgJV3YA7bUvCOkX90s9zb7y9419PG2HjuXa0a0IkVgQVMTY2jAJUHnJyAcJ4N+JFyuh+GNL8iC/wBTfSrN5Td37x3Ny5s1nd0HlsG+Xd8zuoZlcA5U07AfK/7Rt/Bqvxh1rUbMs1tdw2VxEWGCUezhYZHbgikB9t+Lo7vTdf0jXdM0+7vid9hfwWiqWeAq0kchBK7ikiBVyflE8uB8xoAyPFepah4j0G60O38N67ANU22M09xFEqwwSsI5pMiQ8rGzsODyBxQBT8f6Tf33juDyIrxrO8trOymMVs7boftLtOizrxbjZtL5/wBYoULgqDTTA+Tv2nYo4Pjh4jhgjSOKNbVERAAqqLWEAADoKQD/APhoP4n/APQzf+SFr/8AG6AD/hoP4n/9DN/5IWv/AMboAP8AhoP4n/8AQzf+SFr/APG6AOA8U+IdU8Va7dazr119r1K52+bN5ax7tqhF+VQAPlUDgdqAP//Z),auto";
// dom.style.cursor='url("/wd/theme/standard/img/wdHelp_mouse.png")';
// dom.setAttribute("wdHelp_mark","true");
//
//pointer手
var cursor = $(dom).css("cursor");
// $(dom).attr("ceeee",cursor);
if (cursor == "pointer") {
$(dom).addClass("cursor-clickHelp")
} else {
$(dom).addClass("cursor-help");
}
$(dom).children("textarea").each(function(){
changeImage(this);
})
}
function jsCopy(text) {
const isRTL = document.documentElement.getAttribute('dir') == 'rtl';
var fakeElem = document.createElement('textarea');
// Prevent zooming on iOS
fakeElem.style.fontSize = '12pt';
// Reset box model
fakeElem.style.border = '0';
fakeElem.style.padding = '0';
fakeElem.style.margin = '0';
// Move element out of screen horizontally
fakeElem.style.position = 'absolute';
fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
// Move element to the same position vertically
fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
fakeElem.setAttribute('readonly', '');
fakeElem.value = text;
document.body.appendChild(fakeElem);
fakeElem.select();
let succeeded;
try {
succeeded = document.execCommand('copy');
} catch (err) {
succeeded = false;
}
removeFake(fakeElem);
return succeeded;
}
function removeFake(fakeElem) {
if (fakeElem) {
document.body.removeChild(fakeElem);
fakeElem = null;
}
}
var showWdHelp = null;
function showwdHelpButton(wdDialogId){
// console.log(wdDialogId);
var win = wd.topWindow.dhxWins.window(wdDialogId);
// if(win.getFrame().contentWindow.window!=window)
// return;
if(!win)return;
// if(!$(win.button("wdHelp")).is(":hidden"))return;
win.button("wdHelp").show()
win.button("wdHelp").onclick = function() {
var url = wd.display.replaceDynamicParam(wd.topWindow.helpDialogUrl, { dialogid: wdDialogId });
eval(url);
}
}
/**
* 控制帮助按钮显示和隐藏
* 帮助按钮绑定事件
* @param {Object} title
* @param {Object} helpHaShCode
*/
function setupWdHelpIcon(title, helpsize, helpHaShCode) {
var wdDialogId = wd.display.getwdDialogId();
var data = { helpContent: document.querySelector("#helpcontent" + helpHaShCode).innerHTML, helpSize: helpsize, win: wd.topWindow }
data.title = title;
data.name = name;
data.helpHaShCode = helpHaShCode;
if (wdDialogId) {
showwdHelpButton(wdDialogId);
//弹出窗口
} else if (wd.topWindow.wdHelpIcon) { //应用页面
var url = wd.topWindow.document.querySelector("iframe[name=win2]").contentWindow.location.href;
//个人首页
var isgrsy = false;
if (url.indexOf("yeMianEdit") != -1) {
isgrsy = true;
//页面
}
if (isgrsy) {
var $b = $("#helpcontent" + helpHaShCode).parents("[initurl]").first().find(".icon-helpButton").show();
initwdHelpElement($b[0], "click", title, data, helpHaShCode, window);
} else {
wd.topWindow.wdHelpIcon.style.display = "inline";
wd.topWindow.wdHelpIcon.onclick = function() {
var url = wd.display.replaceDynamicParam(wd.topWindow.helpDialogUrl, { dialogid: "" });
eval(url);
}
}
}
addHelpData(data, false);
}
function initwdHelpElement(ele, eventName, title, data, helpHaShCode, environment) {
var win = environment ? environment.window : window
var artDialogFunction = environment ? environment.artDialog : artDialog;
win.wdHelpDailog(ele, eventName, title, data, helpHaShCode);
}
var wdhelpdialogid = null;
var wdhelpTimeOutObj = null;
function wdHelpDailog(ele, eventName, title, data, helpHaShCode) {
$(ele).bind('contextmenu', function(e) {
return false;
});
// console.log(data)
//仅仅右键
// if(eventName=="rightclick"){
$(ele).mouseleave(function(e) {
var helpdiv = wd.topWindow.document.getElementById("wdhelpdialog");
if (helpdiv != null) {
if (!wd.topWindow.helpdialogid) {
wd.topWindow.helpdialogid = [];
}
for (var i = 0; i < wd.topWindow.helpdialogid.length; i++) {
wd.topWindow.clearTimeout(wd.topWindow.helpdialogid[i]);
}
if (!/l.*/i.test(data.helpSize)) {
var timeoutid = wd.topWindow.setTimeout(function() {
if ($(wd.topWindow.document).find("#wdhelpdialog .close").is(":visible") == false) {
$(wd.topWindow.document).find("#wdhelpdialog").remove();
}
}, 1000);
wd.topWindow.helpdialogid.push(timeoutid);
}
}
})
$(ele).mousedown(function(e) {
if (eventName == "rightclick" && e.which != 3) return;
e.stopPropagation();
e.preventDefault();
//防止重复点击
if (wd.topWindow.dhxWins.window(wdhelpdialogid)) {
return
} else {
wdhelpdialogid = null;
}
var params = { show: ["wdhelpdialog"], url: data.helpContent, 'title': title, 'helpHaShCode': helpHaShCode }
wdHelpDailogParams(data, params, this);
var helpContent = data.helpContent + "";
//替换正文class
// help-title 标题行
// help-content 正文默认字体
// help-content-title 帮助标题(文章顶部居中的那个)
// help-content-title1 一级标题
// help-content-title2 二级标题
// help-content-item 项目
//
//
// smallHelp-content 正文默认字体
// smallHelp-content-title 帮助标题(文章顶部居中的那个)
// smallHelp-content-title1 一级标题
// smallHelp-content-title2 二级标题
// smallHelp-content-item 项目
//大窗口
// if (/l.*/i.test(data.helpSize)) {
// helpContent = helpContent.replace(/help\-text/g, "help")
// helpContent = helpContent.replace(/help\-titleText/g, "help-title")
// helpContent = helpContent.replace(/help\-title1Text/g, "help-title1")
// helpContent = helpContent.replace(/help\-title2Text/g, "help-title2")
// helpContent = helpContent.replace(/help\-itemText/g, "help-itemText")
// //
// } else {
// helpContent = helpContent.replace(/help\-text/g, "smallHelp")
// helpContent = helpContent.replace(/help\-titleText/g, "smallHelp-title")
// helpContent = helpContent.replace(/help\-title1Text/g, "smallHelp-title1")
// helpContent = helpContent.replace(/help\-title2Text/g, "smallHelp-title2")
// helpContent = helpContent.replace(/help\-itemText/g, "smallHelp-item")
// }
if (/l.*/i.test(data.helpSize)) {
// helpContent = helpContent.replace(/help\-text/g, "help")
// helpContent = helpContent.replace(/help\-titleText/g, "help-title")
// helpContent = helpContent.replace(/help\-title1Text/g, "help-title1")
// helpContent = helpContent.replace(/help\-title2Text/g, "help-title2")
// helpContent = helpContent.replace(/help\-itemText/g, "help-itemText")
//
} else {
helpContent = helpContent.replace(/class=\"help/g, "class=\"smallHelp")
// helpContent = helpContent.replace(/class=\"help\"/g, "class=\"smallHelp\"")
// helpContent = helpContent.replace(/class=\"help\-title\"/g, "class=\"smallHelp-title\"")
// helpContent = helpContent.replace(/class=\"help\-title1\"/g, "class=\"smallHelp-title1\"")
// helpContent = helpContent.replace(/class=\"help\-title2\"/g, "class=\"smallHelp-title2\"")
// helpContent = helpContent.replace(/class=\"help\-item\"/g, "class=\"smallHelp-item\"")
}
var helpdiv = null;
helpdiv = wd.topWindow.document.getElementById("wdhelpdialog");
if (helpdiv) {
helpdiv.parentNode.removeChild(helpdiv)
}
// if(!wd.topWindow.document.querySelector("#wdhelpcss")){
// $(wd.topWindow.document).find("head").append("");
// }
var closeClass, copyClass, pinClass, helpDivClass, helpTitleClass, contentClass
var styleContent="";
if (/l.*/i.test(data.helpSize)) { //大窗口
closeClass = "icon-close"
copyClass = "icon-key"
pinClass = "lightDialog-fixButton"
helpDivClass = "lightDialog-div"
helpTitleClass = "lightDialog-title hLine"
contentClass = "help-div"
styleContent="";
} else { //小只窗口
closeClass = "invertIcon-close"
copyClass = "invertIcon-key"
pinClass = "invertIcon-unpin"
helpDivClass = "flashMsg-div"
helpTitleClass = "flashMsg-title"
contentClass = ""
}
helpDivClass += " help-size-" + data.helpSize.toLowerCase();
$(wd.topWindow.document.body).append(""
+
""
+""
+styleContent
// + ((data.helpSize.toLowerCase() == "l") ? "" : "
")
+
((data.helpSize.toLowerCase() == "l") ? "" : "
") +
"
" +
"
" + params.title + "
" +
"
" +
"
" +
"
" +
"
" +
"
" +
helpContent +
"
"
)
helpdiv = wd.topWindow.document.getElementById("wdhelpdialog");
// $(helpdiv).css({'width':params.width,
// 'left':params.x,
// 'top':params.y});
// if(params.height)
// $(helpdiv).css({'height':params.height})
function calHelpDislogPos(){
var pos = calPso(ele, helpdiv, params.win ? params.win : window, params.center);
var triangle = helpdiv.querySelector(".triangle");
$(helpdiv).css({ 'opacity':1,'left': pos.left, 'top': (triangle ? 15 : 0) + pos.top });
if(pos.tooRight){
var $tail=$(helpdiv).find(".flashMsg-up");
var tailleft= parseInt($tail.css("left"));
$tail.css({left:pos.dialogwidth+tailleft});
}
}
//calHelpDislogPos();
setTimeout(calHelpDislogPos,500);
// setTimeout(calHelpDislogPos,1000);
// 记时消失
// var timeout = data.helpSize.toLowerCase() == "s" ? 2000 : 4000;
var timeout = 5000;
clearTimeout(wdhelpTimeOutObj);
wdhelpTimeOutObj = setTimeout(function() {
if (top.$("#wdhelpdialog .close").css("display") != "block") {
top.$("#wdhelpdialog").remove();
}
}, timeout);
if (!/l.*/i.test(data.helpSize)) {
$(helpdiv).find(".close").hide();
} else {
$(helpdiv).find(".pin").hide();
}
//表单事件
wd.topWindow.$(helpdiv).on("click", ".close", function() {
var helpdiv = wd.topWindow.document.getElementById("wdhelpdialog");
if (helpdiv) {
helpdiv.parentNode.removeChild(helpdiv)
}
}).on("click", ".copy", function() {
//复制帮助代码
supplyCopy(params.helpHaShCode);
}).on("click", ".pin", function() {
//点击锁定后,显示关闭按钮
$(helpdiv).find(".close").show();
$(this).hide();
}).on("mouseleave", function() {
//鼠标移除后,定时关闭
// if(!wd.topWindow.helpdialogid){
// wd.topWindow.helpdialogid=[];
// }
// for(var i=0;iwinWidth){
result.left=winXY.left + bouding.left-dialogwidth;
result.tooRight=true;
}
}
return result;
}
function wdHelpDailogParams(data, params, ele) {
console.log(data)
if (data.helpTitle) {
params.title = data.helpTitle;
}
//大
if (/l.*/i.test(data.helpSize)) {
// params.width=700;
// params.height=500;
//图钉自动按下
params.pin = true;
params.center = true;
// params.className="help-div";
console.log("大窗口");
//中
} else if (/m.*/i.test(data.helpSize)) {
// params.width=500;
// params.height=200;
// params.className="smallHelp-div";
console.log("中窗口");
//小,默认
} else {
// params.width=300;
// params.height=100;
// params.className="smallHelp-div";
console.log("小窗口");
}
console.log(params)
return params;
}
/**
* 复制文本到粘贴
* @param {Object} val
*/
function supplyCopy(val) {
const isRTL = document.documentElement.getAttribute('dir') == 'rtl';
var fakeElem = document.createElement('textarea');
// Prevent zooming on iOS
fakeElem.style.fontSize = '12pt';
// Reset box model
fakeElem.style.border = '0';
fakeElem.style.padding = '0';
fakeElem.style.margin = '0';
// Move element out of screen horizontally
fakeElem.style.position = 'absolute';
fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
// Move element to the same position vertically
fakeElem.style.top = (window.pageYOffset || document.documentElement.scrollTop) + 'px';
fakeElem.setAttribute('readonly', '');
fakeElem.value = val;
document.body.appendChild(fakeElem);
fakeElem.select();
let succeeded;
try {
succeeded = document.execCommand('copy');
wd.display.alert("复制成功");
} catch (err) {
succeeded = false;
wd.display.alert("复制失败");
}
removeFake(fakeElem);
return succeeded;
}
/**
* 编辑帮助
*/
if (!wd) {
var wd = {}
}
if (!wd.edit) {
wd.edit = {};
}
if (!wd.edit.wdHelp) {
wd.edit.wdHelp = {};
}
wd.edit.wdHelp.show = function() {
if (!wd.wdHelpObj) {
wd.wdHelpObj = new wd.edit.wdHelp.wdHelpFunction().init();
}
wd.wdHelpObj.show();
}
wd.edit.wdHelp.hide = function(real) {
if (!wd.wdHelpObj) {
wd.wdHelpObj = new wd.edit.wdHelp.wdHelpFunction().init();
}
wd.wdHelpObj.hide(real);
}
wd.edit.wdHelp.wdHelpFunction = function() {
this.dialogClassName = "wdHelp";
this.secondClick = false;
this.wdHelpValue = {};
this.init = function() {
return this;
}
this.show = function() {
$("[wdSecondaryTab]").attr("wdSecondaryTab","false").find("#tabOption").show();
var wdHelpElement = this.findWdHelpElement();
// console.log(wdHelpElement);
if (wdHelpElement.length == 0) {
// alert("找不到元素设置帮助信息");
return;
}
for (var i=0;i 0) {
$(chartDiv).animate({ left: "-=" + leftx });
}
// chartDiv.style.marginLeft="-"+chartDiv.offsetWidth;
// var top=this.getTop(ele)
// var left=this.getLeft(ele)
// var xy={x:0,y:0}
// chartDiv.style.left = xy.x+left+ele.offsetWidth+"px"
// chartDiv.style.top = xy.y+top+"px";
// chartDiv.style.left =ele.offsetWidth+"px"
// function FindParam(url,name){
// //获取url中"?"符后的字串
// var theRequest = new Object();
// if (url.indexOf("?") != -1) {
// var str = url.substr(1);
// strs = str.split("&");
// for(var i = 0; i < strs.length; i ++) {
// theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
// }
// }
//
// return theRequest[name];
//
// }
var exist = false;
$.ajax({
url: "/service?ssServ=queryHelpByCode",
type: "POST",
data: {
tokenstring:(group.token|| FindParam(window.location.href, "ssToken")), // , "token")),。Lin
helpElementName: group.name,
resultType: "ajax"
},
async: false,
dataType: "json",
success: function(data) {
if (data) {
exist = true;
// chartDiv.style.background = 'red';
}
}
});
//chartDiv.style.background = 'red';
if (exist)
chartDiv.setAttribute("class", "icon-warningFull " + this.dialogClassName)
$(chartDiv).on("click", (function() {
var helpElementName = group.name;
return function() {
// top.editHelpDialog
// var url= '/service?wdApplication=wd&wdService=queryHelpByCode&wdOutputComponent=440164702'
var pageurl = window.location.href;
// url+="&helpElementName="+helpElementName;
// url+="&tokenstring="+;
//// url+="&pageurl="+pageurl;
// wd.display.showComponent({show:["wdDialog"],hide:[],url:url,title:"编辑帮助",width:500,height:500});
var url = wd.display.replaceDynamicParam(wd.topWindow.editHelpDialog,
{tokenstring:(group.token|| FindParam(location.search, "ssToken")), // , "token")),。Lin
helpElementName: helpElementName
});
eval(url);
}
})())
}
this.buildCheckBox = function(ele) {
var eleName = ele.getAttribute("name")
var result = "";
// result+='';
// result+='';
return result;
}
this.recursionIframe = function(win) {
if (win.parent == top && win.parent == win) {
// var xy = this.getAbsPoint(win);
return { "x": 0, "y": 0, "w": 0, "h": 0 };
}
var winPar = win.parent; // .opener
var iframeArr = winPar.document.getElementsByTagName('IFRAME');
var targetIframe;
for (var i = 0; i < iframeArr.length; i++) {
var iframeElem = iframeArr[i];
if (iframeElem.contentWindow == win) {
targetIframe = iframeElem;
break;
}
}
// alert(targetIframe==null)
// var xy = this.getAbsPoint(targetIframe);
var xy = { x: this.getLeft(targetIframe), y: this.getTop(targetIframe) }
if (winPar.parent != winPar) {
var xy2 = this.recursionIframe(winPar);
xy.x += xy2.x;
xy.y += xy2.y;
}
return xy
}
this.getTop = function(e) {
var offset = e.offsetTop;
if (e.offsetParent != null) offset += this.getTop(e.offsetParent);
return offset;
}
this.getLeft = function(e) {
var offset = e.offsetLeft;
if (e.offsetParent != null) offset += this.getLeft(e.offsetParent);
return offset;
}
/*
* 返回页面所有带wdRecord="true"的元素
*/
this.findWdHelpElement = function() {
var wdRecordList = []
// var selectList2 = document.querySelectorAll("[name]");
// for (var i = 0; i < selectList2.length; i++) {
// if (selectList2[i].clientWidth > 0 && selectList2[i].tagName != "IFRAME") {
// // if(!/^wd.*/.test(selectList2[i].getAttribute("name")))
// var p = selectList2[i].parentNode;
//
// if (p.offsetWidth > 0 && p.getAttribute("name"))
// continue;
//
//
// wdRecordList.push(selectList2[i]);
// }
// }
//输入框
var groups=wd.display.getInputsGroups();
for(var key in groups){
wdRecordList.push(groups[key]);
}
//选项卡:三级帮助 所以不需要name
var iframe=document.querySelector("iframe");
if(iframe&&iframe.tabObj){
var tabList= iframe.tabObj.wdTabList;
for(var i=0;i0){
for(var j=0;j 0) {
var record = {}
var removeEle = this.findDialog()[0];
// console.log(removeEle.record)
removeEle.parentNode.removeChild(removeEle)
}
}
/*获得部件ID:bjid */
getBjid = function() {
var bjid = document.getElementsByName("wdComponentID")[0].value
return bjid
}
/*根据勾选框+元素值生成数据 */
this.getRecordData = function() {
var recordZhi = {};
var dialogList = this.findDialog();
// {"nrid": {value:"440120001400",defualt:true},"bt":{"nrid": {value:"标题",defualt:false} }
for (var i = 0; i < dialogList.length; i++) {
var recordName = dialogList[i].record.getAttribute("name");
var recordValue = dialogList[i].record.value
var recordDefault = dialogList[i].getElementsByTagName("input")[0].checked;
var lastValue = dialogList[i].getElementsByTagName("input")[1].checked;
if (recordDefault || lastValue) {
recordZhi[recordName] = { value: recordValue, default: recordDefault }
}
}
return recordZhi;
}
}
function addHelpData(data, isdialog) {
var a = window.wdHelpData;
if (!a) {
window.wdHelpData = [];
a = window.wdHelpData;
}
for (var i = 0; i < a.length; i++) {
if (a[i].helpHaShCode == data.helpHaShCode) {
a[i] = data;
return;
}
}
if (data.title)
a.push(data);
// if(data.helpContent){
// data.helpContent=data.helpContent.replace(/style=\".*?\"/g,"")
// }
//
console.log(data)
// var topiframe=wd.topWindow.document.querySelector("iframe[name="+wd.topWindow.MenuSetting.target+"]")
// if(isdialog){
// console.log(wd.display.getwdDialogWindows())
// console.log(wd.display.getwdDialogId());
// }else{
// console.log(wd.display.getwdDialogWindows())
//
// console.log(wd.display.getwdDialogId());
// }
//
//
//
// console.log(data);
}
wd.edit.findAllHelpData = function(wdDialogId) {
var result = [];
if (wdDialogId) {
console.log(wdDialogId);
var allWindows = wd.display.getwdDialogWindowObjects(parseInt(wdDialogId));
for (var i = 0; i < allWindows.length; i++) {
if (allWindows[i].wdHelpData) {
result = result.concat(allWindows[i].wdHelpData);
}
}
} else {
var topiframe = wd.topWindow.document.querySelector("iframe[name=" + wd.topWindow.MenuSetting.target + "]")
// console.log(topiframe.contentWindow);
if (topiframe.contentWindow) {
if (topiframe.contentWindow.wdHelpData)
result = result.concat(topiframe.contentWindow.wdHelpData);
var alliframe = topiframe.contentWindow.document.querySelectorAll("iframe");
for (var i = 0; i < alliframe.length; i++) {
if (alliframe[i].contentWindow && alliframe[i].contentWindow.wdHelpData) {
result = result.concat(alliframe[i].contentWindow.wdHelpData);
}
}
}
}
return result;
}
$(function() {
if (window.location.href.indexOf("view") > 0) return;
//非开发模式下隐藏
if (!wd.topWindow.wd.edit)
wd.topWindow.wd.edit = {};
if (!wd.topWindow.wd.edit.findAllHelpData) {
wd.topWindow.wd.edit.findAllHelpData = wd.edit.findAllHelpData;
}
if (!wd.topWindow.IS_ALLOW_EDIT_WDHELP) return;
var wdDialogId = wd.display.getwdDialogId();
//窗口状态
if (wdDialogId) {
if ("0" == window.loginStatus)
return;
var win = wd.topWindow.dhxWins.window(wdDialogId);
//没有提供按钮
if (!win.button("editWdHelp")) return;
win.button("editWdHelp").show();
var editbutton = win.button("editWdHelp");
var savebutton = win.button("editWdHelp_save");
var allWindows = wd.display.getwdDialogWindowObjects(wdDialogId);
for (var i = 0; i < allWindows.length; i++) {
try{
if (allWindows[i].wd && allWindows[i].wd.edit && allWindows[i].wd.edit.wdHelp) {
allWindows[i].wd.edit.wdHelp.hide();
}
}catch(e){
console.error(e);
}
}
editbutton.edit = false;
var thisUrl = win.getFrame().contentWindow.location.href
editbutton.onclick = function() {
var edit = editbutton.edit;
editbutton.edit = !(editbutton.edit ? true : false);
edit = true;
for (var i = 0; i < allWindows.length; i++) {
try{
if (!allWindows[i].wd.edit || !allWindows[i].wd.edit.wdHelp) continue;
allWindows[i].wd.edit.wdHelp.show();
}catch(e){
console.error(e);
}
}
var url = wd.display.replaceDynamicParam(wd.topWindow.editHelpDialog, { tokenstring: FindParam(thisUrl, "ssToken"), helpElementName: "" }); // , "token"),。Lin
eval(url);
this.hide();
savebutton.show()
}
savebutton.onclick = function() {
for (var i = 0; i < allWindows.length; i++) {
try{
if (!allWindows[i].wd.edit || !allWindows[i].wd.edit.wdHelp) continue;
allWindows[i].wd.edit.wdHelp.hide(true);
}catch(e){
console.error(e);
}
}
this.hide();
editbutton.show()
}
//页面状态
} else if (wd.topWindow.editWdHelp) {
var url = wd.topWindow.document.querySelector("iframe[name=win2]").contentWindow.location.href;
var THIS = window;
//个人首页
var isgrsy = false;
if (url.indexOf("yeMianEdit") != -1) {
isgrsy = true;
function initsybjBodyHelp(ele,t){
var mytt;
var myttime=0;
mytt=setInterval(function(){
//console.log(mytt)
myttime++;
if(myttime>10)
clearInterval(mytt);
var $button=$(ele).find(".icon-setHelpButton");
if($button.length==0)
return true;
clearInterval(mytt);
$button.show().on("click", function() {
var thisUrl = $(this).parents("[initurl]").first().attr("initurl");
var url = THIS.wd.display.replaceDynamicParam(wd.topWindow.editHelpDialog, { tokenstring: THIS.FindParam(thisUrl, "ssToken"), helpElementName: "" }); // , "token"),。Lin
eval(url);
})
},t?t:2000);
}
function initGrsyHelp(){
//刷新之后,重新 绑定点击事件
window.gridster.$el.on("click", ".img-header", function() {
var $this1=$(this).parents("[initurl]");
initsybjBodyHelp($this1,10000)
})
THIS.gridster.$widgets.each(function(){
initsybjBodyHelp(this);
})
}
if(THIS.json&&THIS.json!="[]"){
var tt=THIS.setInterval(function(){
try{
console.log(tt);
if( THIS.gridster.$widgets.length==0)
throw "wait wait";
initGrsyHelp();
THIS.clearInterval(tt);
}catch(e){
console.log(e);
}
},3000);
}
$(wd.topWindow.editWdHelp).show();
//页面
} else {
$(wd.topWindow.editWdHelp).show();
setTimeout(function() {
$(wd.topWindow.editWdHelp).show();
}, 5000)
}
var settingClass="largeIcon-setHelp";
var okClass="largeInvertIcon-save";
wd.topWindow.editWdHelp.isSaveButton=false;
wd.topWindow.editWdHelp.setAttribute("class",settingClass);
wd.topWindow.editWdHelp.onclick = function() {
if(isgrsy){
eval(wd.topWindow.editHelpEditTab);
return;
}
if(this.isSaveButton){
THIS.wd.edit.wdHelp.hide();
this.isSaveButton=false;
this.setAttribute("class",settingClass);
}else{
this.setAttribute("class",okClass);
this.isSaveButton=true;
THIS.wd.edit.wdHelp.hide();
THIS.wd.edit.wdHelp.show(wd.topWindow.editWdHelp);
var url="";
if(!isgrsy){
var thisUrl = THIS.location.href;
url= wd.display.replaceDynamicParam(wd.topWindow.editHelpDialog, { tokenstring: FindParam(thisUrl, "ssToken"), helpElementName: "" }); // , "token"),。Lin
eval(url);
}
}
}
// wd.topWindow.editWdHelp.onclick=(function(){
// var thiswindow=window;
// return function(){
// thiswindow.wd.edit.wdHelp.hide();
// thiswindow.wd.edit.wdHelp.show(wd.topWindow.editWdHelp);
// var thisUrl=window.location.href;
// var url=wd.display.replaceDynamicParam(wd.topWindow.editHelpDialog,{tokenstring:FindParam(thisUrl,"token"),helpElementName:""});
// eval(url);
//
// }
// })()
}
})
//刷新单前窗口
function refreshHelpChart(wind) {
//refreshHelpChart(wd.display.getwdDialogOpener())
var wdDialogId = wind.wd.display.getwdDialogId();
//窗口状态
if (wdDialogId) {
var win = wd.topWindow.dhxWins.window(wdDialogId);
var allWindows = wd.display.getwdDialogWindowObjects(wdDialogId);
for (var i = 0; i < allWindows.length; i++) {
if (allWindows[i].wd && allWindows[i].wd.edit && allWindows[i].wd.edit.wdHelp) {
allWindows[i].wd.edit.wdHelp.hide();
allWindows[i].wd.edit.wdHelp.show();
}
}
//页面状态
} else if (wd.topWindow.editWdHelp) {
wind.wd.edit.wdHelp.hide();
wind.wd.edit.wdHelp.show(wd.topWindow.editWdHelp);
}
}