You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

706 lines
36 KiB
JavaScript

var leftImgID = new Array();
var itemNameValue = "";
var itemNameGID = "";
var inputItemNameValue = "";
var inputItemNameGID = "";
var globalID = "";
var globalTitle = "";
var globalTxtID = "";
var groupID = "";
function fnDetailSetting(id, title) {
var _width = 0;
var _height = 0;
globalID = id;
globalTitle = title;
if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
_height = document.documentElement.clientHeight;
_width = document.documentElement.clientWidth;
}
//查询top,left,width,height,url
Ext.Ajax.request({
url: '/MvcShipping/MsMainForm/GetUserMainFormSetInfo',
params: { gid: id },
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
var data = result.data;
var _defaultWidth = data[0].DEFAULTWIDTH;
var _defaultHeight = data[0].DEFAULTHEIGHT;
var _moduleWidth = data[0].MODULEWIDTH;
var _moduleHeight = data[0].MODULEHEIGHT;
var _moduleTop = data[0].MODULETOP;
var _moduleLeft = data[0].MODULELEFT;
var _moduleUrl = data[0].MODULEURL;
document.getElementById("txtLeft").value = _moduleLeft;
document.getElementById("txtTop").value = _moduleTop;
if (_moduleWidth == "0") {
document.getElementById("txtWidth").value = _defaultWidth;
}
else {
document.getElementById("txtWidth").value = _moduleWidth;
}
if (_moduleHeight == "0") {
document.getElementById("txtHeight").value = _defaultHeight;
}
else {
document.getElementById("txtHeight").value = _moduleHeight;
}
document.getElementById("txtURL").value = _moduleUrl;
}
},
scope: this
});
//查询templet
Ext.Ajax.request({
url: '/MvcShipping/MsMainForm/GetUserTemplet',
params: { gid: id },
scope: this,
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
var data = result.data;
var templetLI;
var templetImg;
var templetName;
var activeTempletID;
document.getElementById("layTempletUL").innerHTML = "";
for (var iCount = 0; iCount < data.length; iCount++) {
templetLI = document.createElement("li");
templetLI.id = "layTempletLI" + data[iCount].TEMPLETID;
var addClass1 = document.createAttribute("class");
if (data[iCount].TEMPLETID == data[iCount].SHOWTEMPLETID) {
addClass1.nodeValue = "layTempletLIActive"; //layTempletLI
}
else {
addClass1.nodeValue = "layTempletLI"; //layTempletLIActive
}
templetLI.setAttributeNode(addClass1);
document.getElementById("layTempletUL").appendChild(templetLI);
templetImg = document.createElement("div");
var addClass2 = document.createAttribute("class");
addClass2.nodeValue = "templetImg";
templetImg.setAttributeNode(addClass2);
templetImg.innerHTML = "<a href=\"javascript:void();\"><img src=\"../../../../images/setting/" + data[iCount].TEMPLETTHUMB + "\" class=\"imgStyle\" /></a>";
document.getElementById("layTempletLI" + data[iCount].TEMPLETID).appendChild(templetImg);
templetName = document.createElement("div");
var addClass3 = document.createAttribute("class");
addClass3.nodeValue = "templetName";
templetName.setAttributeNode(addClass3);
templetName.innerHTML = "<a href=\"javascript:void();\" class=\"blackLinkContent\">" + data[iCount].TEMPLETNAME + "</a>";
document.getElementById("layTempletLI" + data[iCount].TEMPLETID).appendChild(templetName);
}
}
}
});
//查询user
Ext.Ajax.request({
url: '/MvcShipping/MsMainForm/GetEmployeeList',
scope: this,
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
var data = result.data;
var templetUserLI;
var templetUserCheck;
var templetUserName;
document.getElementById("layTempletUserUL").innerHTML = "";
for (var iCount = 0; iCount < data.length; iCount++) {
templetUserLI = document.createElement("li");
templetUserLI.id = "layTempletUserLI" + data[iCount].GID;
var addClass1 = document.createAttribute("class");
addClass1.nodeValue = "layTempletUserLI"; //layTempletLI
templetUserLI.setAttributeNode(addClass1);
document.getElementById("layTempletUserUL").appendChild(templetUserLI);
templetUserCheck = document.createElement("div");
var addClass2 = document.createAttribute("class");
addClass2.nodeValue = "templetUserCheck";
templetUserCheck.setAttributeNode(addClass2);
templetUserCheck.innerHTML = "<input type=\"checkbox\" id=\"" + data[iCount].GID + "\" name=\"chkUser\" class=\"chkUserStyle\" />";
document.getElementById(templetUserLI.id).appendChild(templetUserCheck);
templetUserName = document.createElement("div");
var addClass3 = document.createAttribute("class");
addClass3.nodeValue = "templetUserName";
templetUserName.setAttributeNode(addClass3);
templetUserName.innerHTML = data[iCount].SHOWNAME;
document.getElementById(templetUserLI.id).appendChild(templetUserName);
}
//读取使用此功能的用户并打勾
Ext.Ajax.request({
url: '/MvcShipping/MsMainForm/GetEmployeePopedom',
params: { id: id, title: title },
scope: this,
callback: function (options2, success2, response2) {
if (success2) {
var result2 = Ext.JSON.decode(response2.responseText);
var data2 = result2.data;
//var chkUser = document.getElementsByName("chkUser");
for (var jCount = 0; jCount < data2.length; jCount++) {
if (document.getElementById(data2[jCount].GID)) {
document.getElementById(data2[jCount].GID).checked = true;
}
}
}
}
});
}
}
});
//查询detail(分组、组明细)
fnGetUserTemplet(id);
/**/
document.getElementById("maskLayContain").style.width = _width + "px";
document.getElementById("maskLayContain").style.height = _height + "px";
document.getElementById("componantLayContain").style.left = (_width - 680) / 2 + "px";
document.getElementById("componantLayContain").style.top = (_height - 440) / 2 + "px";
document.getElementById("componantLayTitle").innerText = title;
document.getElementById("maskLayContain").style.display = "block";
document.getElementById("componantLayContain").style.display = "block";
}
function fnGetUserTemplet(id) {
document.getElementById("layGroupItemUL").innerHTML = "";
document.getElementById("layGroupList").innerHTML = "";
Ext.Ajax.request({
url: '/MvcShipping/MsMainForm/GetUserTempletItem',
params: { gid: id },
scope: this,
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
var data = result.data;
var layGroupLI;
var layGroupChildUL;
var layGroupChildImg;
var layGroupChildNav;
var gid;
var itemName;
leftImgID.length = 0;
for (var iCount = 0; iCount < data.length; iCount++) {
layGroupLI = document.createElement("li");
layGroupLI.id = "layGroupItemHoverLI" + data[iCount].GID;
var addClass1 = document.createAttribute("class");
if (iCount == 0) {
addClass1.nodeValue = "layGroupItemHoverLI"; //layTempletLI
}
else {
addClass1.nodeValue = "layGroupItemNormalLI"; //layTempletLIActive
}
layGroupLI.setAttributeNode(addClass1);
document.getElementById("layGroupItemUL").appendChild(layGroupLI);
layGroupChildUL = document.createElement("ul");
layGroupChildUL.id = "layGroupChildUL" + data[iCount].GID;
var addClass2 = document.createAttribute("class");
addClass2.nodeValue = "layGroupItemChildUL";
layGroupChildUL.setAttributeNode(addClass2);
document.getElementById("layGroupItemHoverLI" + data[iCount].GID).appendChild(layGroupChildUL);
layGroupChildImg = document.createElement("li");
var addClass3 = document.createAttribute("class");
addClass3.nodeValue = "layGroupItemChildImgLI";
layGroupChildImg.setAttributeNode(addClass3);
leftImgID.push(data[iCount].GID);
if (iCount == 0) {
itemNameGID = data[iCount].GID;
itemNameValue = data[iCount].ITEMNAME;
layGroupChildImg.innerHTML = "<img id=\"layNavImg" + data[iCount].GID + "\" src=\"../../../../images/setting/files01.png\" width=\"16\" height=\"16\" border=\"0\" />";
}
else {
layGroupChildImg.innerHTML = "<img id=\"layNavImg" + data[iCount].GID + "\" src=\"../../../../images/setting/files02.png\" width=\"16\" height=\"16\" border=\"0\" />";
}
document.getElementById("layGroupChildUL" + data[iCount].GID).appendChild(layGroupChildImg);
layGroupChildNav = document.createElement("li");
var addClass4 = document.createAttribute("class");
if (iCount == 0) {
addClass4.nodeValue = "layGroupItemChildNavHoverLI";
}
else {
addClass4.nodeValue = "layGroupItemChildNavNormalLI";
}
var addRel = document.createAttribute("rel");
addRel.nodeValue = id;
var addNodeID = document.createAttribute("nodeid");
addNodeID.nodeValue = data[iCount].GID;
layGroupChildNav.setAttributeNode(addClass4);
layGroupChildNav.setAttributeNode(addRel);
layGroupChildNav.setAttributeNode(addNodeID);
layGroupChildNav.onclick = function () { fnChangeItem(this); }
layGroupChildNav.innerHTML = data[iCount].ITEMNAME;
document.getElementById("layGroupChildUL" + data[iCount].GID).appendChild(layGroupChildNav);
if (iCount == 0) {
//查询分组明细
fnGetUserTempletDetail(id, data[iCount].ITEMNAME);
}
}
}
}
});
}
function fnGetUserTempletDetail(id, itemName) {
document.getElementById("layGroupList").innerHTML = "";
Ext.Ajax.request({
url: '/MvcShipping/MsMainForm/GetUserTempletDetail',
params: { gid: id, itemName: itemName },
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
var data = result.data;
var layGroupListLine;
var layGroupListUL;
var layGroupListChkLI;
var layGroupListShortLI1;
var layGroupListShortLI2;
var layGroupListLongLI;
var nameStr = "<请输入名称>";
var linkStr = "<请输入链接地址>";
var sqlStr = "<请输入查询语句>";
var outputName = "";
var outputLink = "";
var outputSQL = "";
for (var iCount = 0; iCount < data.length; iCount++) {
layGroupListLine = document.createElement("div");
layGroupListLine.id = "layCroupListLineBody" + data[iCount].ITEMID;
var addClass1 = document.createAttribute("class");
addClass1.nodeValue = "layGroupListLineBody";
layGroupListLine.setAttributeNode(addClass1);
document.getElementById("layGroupList").appendChild(layGroupListLine);
layGroupListUL = document.createElement("ul");
layGroupListUL.id = "layGroupListBodyUL" + data[iCount].ITEMID;
var addClass2 = document.createAttribute("class");
addClass2.nodeValue = "layGroupListBodyUL";
layGroupListUL.setAttributeNode(addClass2);
document.getElementById(layGroupListLine.id).appendChild(layGroupListUL);
layGroupListChkLI = document.createElement("li");
var addClass3 = document.createAttribute("class");
addClass3.nodeValue = "layGroupListChkbox";
var addRelChk = document.createAttribute("rel");
addRelChk.nodeValue = data[iCount].ITEMID;
layGroupListChkLI.setAttributeNode(addClass3);
layGroupListChkLI.setAttributeNode(addRelChk);
layGroupListChkLI.innerHTML = "<input type=\"checkbox\" id=\"chkLink" + data[iCount].ITEMID + "\" name=\"chkLink\" rel=\"" + data[iCount].ITEMID + "\" class=\"chkInputTab\" />";
document.getElementById(layGroupListUL.id).appendChild(layGroupListChkLI);
layGroupListShortLI1 = document.createElement("li");
var addClass3 = document.createAttribute("class");
addClass3.nodeValue = "layGroupListBodyShortLI";
layGroupListShortLI1.setAttributeNode(addClass3);
outputName = data[iCount].ITEMNAME;
outputName = outputName.replace(/\"/g, "&#34;"); //输入框中显示双引号问题
outputName = outputName.replace(/\'/g, "&#39;"); //输入框中显示单引号问题
layGroupListShortLI1.innerHTML = "<input type=\"text\" id=\"txtInputTabName" + data[iCount].ITEMID + "\" name=\"txtInputTabName\" class=\"textInputTabShort\" value=\"" + outputName + "\" onblur=\"javascript:fnTextBlur(this, '" + nameStr + "');\" onclick=\"javascript:fnActive(this);\" />";
document.getElementById(layGroupListUL.id).appendChild(layGroupListShortLI1);
layGroupListShortLI2 = document.createElement("li");
var addClass4 = document.createAttribute("class");
addClass4.nodeValue = "layGroupListBodyShortLI";
layGroupListShortLI2.setAttributeNode(addClass4);
outputLink = data[iCount].LINKURL;
outputLink = outputLink.replace(/\"/g, "&#34;"); //输入框中显示双引号问题
outputLink = outputLink.replace(/\'/g, "&#39;"); //输入框中显示单引号问题
layGroupListShortLI2.innerHTML = "<input type=\"text\" id=\"txtInputTabLink" + data[iCount].ITEMID + "\" name=\"txtInputTabLink\" class=\"textInputTabShort\" value=\"" + outputLink + "\" onblur=\"javascript:fnTextBlur(this, '" + linkStr + "');\" onclick=\"javascript:fnActive(this);\" />";
document.getElementById(layGroupListUL.id).appendChild(layGroupListShortLI2);
layGroupListLongLI = document.createElement("li");
var addClass5 = document.createAttribute("class");
addClass5.nodeValue = "layGroupListBodyLongLI";
layGroupListLongLI.setAttributeNode(addClass5);
outputSQL = data[iCount].SQL;
outputSQL = outputSQL.replace(/\"/g, "&#34;"); //输入框中显示双引号问题
outputSQL = outputSQL.replace(/\'/g, "&#39;"); //输入框中显示单引号问题
layGroupListLongLI.innerHTML = "<ul class=\"layGroupListBodyLongChildUL\"><li class=\"layGroupListBodyLongChildTextLI\"><input type=\"text\" id=\"txtInputTabSQL" + data[iCount].ITEMID + "\" name=\"txtInputTabSQL\" class=\"textInputTabLong\" value=\"" + outputSQL + "\" onblur=\"javascript:fnTextBlur(this, '" + sqlStr + "');\" onclick=\"javascript:fnActive(this);\" /></li><li class=\"layGroupListBodyLongChildBtnLI\"><a href=\"javascript:fnShowSQLEditor('txtInputTabSQL" + data[iCount].ITEMID + "');\"><img src=\"../../../../images/setting/edit.png\" width=\"16\" height=\"16\" border=\"0\" alt=\"编辑\" /></a></li></ul>";
document.getElementById(layGroupListUL.id).appendChild(layGroupListLongLI);
}
}
}
});
}
function fnConfirm() {
//保存设置
var txtLeft = document.getElementById("txtLeft").value;
var txtTop = document.getElementById("txtTop").value;
var txtWidth = document.getElementById("txtWidth").value;
var txtHeight = document.getElementById("txtHeight").value;
var txtURL = document.getElementById("txtURL").value;
var chkUser = document.getElementsByName("chkUser");
var userGID = "";
var num = 0;
for (var iCount = 0; iCount < chkUser.length; iCount++) {
userGID = chkUser[iCount].id;
Ext.Ajax.request({
url: '/MvcShipping/MsMainForm/DeleteUserCorrelation',
params: { usergid: userGID },
scope: this
});
}
num = 1;
for (var jCount = 0; jCount < chkUser.length; jCount++) {
if (chkUser[jCount].checked) {
userGID = chkUser[jCount].id;
Ext.Ajax.request({
url: '/MvcShipping/MsMainForm/SaveFormSet',
params: { title: globalTitle, outusergid: userGID, top: txtTop, left: txtLeft, width: txtWidth, height: txtHeight, url: txtURL },
scope: this
});
}
}
document.getElementById("layTitle").innerText = "";
document.getElementById("maskLayContain").style.display = "none";
document.getElementById("componantLayContain").style.display = "none";
}
function fnCancel() {
document.getElementById("layTitle").innerText = "";
document.getElementById("maskLayContain").style.display = "none";
document.getElementById("componantLayContain").style.display = "none";
}
function fnDetail() {
document.getElementById("layPositionContain").style.display = "none";
document.getElementById("layTempletContain").style.display = "none";
document.getElementById("layBtnContain").style.display = "none";
document.getElementById("layMenuContain").style.display = "block";
document.getElementById("layGroupContain").style.display = "block";
}
function fnReturn() {
document.getElementById("layPositionContain").style.display = "block";
document.getElementById("layTempletContain").style.display = "block";
document.getElementById("layBtnContain").style.display = "block";
document.getElementById("layMenuContain").style.display = "none";
document.getElementById("layGroupContain").style.display = "none";
}
function fnChangeItem(obj) {
for (var iCount = 0; iCount < obj.parentNode.parentNode.parentNode.childElementCount; iCount++) {
obj.parentNode.parentNode.parentNode.children[iCount].className = "layGroupItemNormalLI";
obj.parentNode.parentNode.parentNode.children[iCount].children[0].children[1].className = "layGroupItemChildNavNormalLI";
}
for (var iCount = 0; iCount < leftImgID.length; iCount++) {
document.getElementById("layNavImg" + leftImgID[iCount]).src = "../../../../images/setting/files02.png";
}
obj.className = "layGroupItemChildNavHoverLI";
obj.parentNode.parentNode.className = "layGroupItemHoverLI";
obj.parentNode.children[0].children[0].src = "../../../../images/setting/files01.png";
itemNameValue = obj.innerText;
itemNameGID = obj.attributes["nodeid"].value;
fnGetUserTempletDetail(obj.attributes["rel"].value, obj.innerText);
}
function fnCheckUser() {
var chkStatus = document.getElementById("chkAll").checked;
var chkUser = document.getElementsByName("chkUser");
for (var i = 0; i < chkUser.length; i++) {
chkUser[i].checked = chkStatus;
}
}
function fnActive(obj) {
obj.select();
}
function fnTextBlur(obj, value) {
if (obj.value == "") {
obj.value = value;
}
}
function fnInsertItem() {
var _left;
var _top;
var _width = 0;
var _height = 0;
if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
_height = document.documentElement.clientHeight;
_width = document.documentElement.clientWidth;
}
_left=(_width-330)/2;
_top=(_height-260)/2;
document.getElementById("txtGroupNameInput").value = "";
inputItemNameGID = guid();
inputItemNameValue = "";
document.getElementById("maskGroupLayContain").style.width = _width + "px";
document.getElementById("maskGroupLayContain").style.height = _height + "px";
document.getElementById("layGroupNameInputContain").style.left = (_left) + "px";
document.getElementById("layGroupNameInputContain").style.top = (_top + 77) + "px";
document.getElementById("maskGroupLayContain").style.display = "block";
document.getElementById("layGroupNameInputContain").style.display = "block";
}
function fnDeleteItem() {
Ext.Ajax.request({
url: '/MvcShipping/MsMainForm/DeleteItem',
params: { id: itemNameGID, name: itemNameValue },
scope: this,
callback: function (options, success, response) {
if (success) {
//查询detail(分组、组明细)
fnGetUserTemplet(globalID);
}
}
});
}
function fnInsertItemConfirm() {
inputItemNameValue = document.getElementById("txtGroupNameInput").value;
if (inputItemNameValue != "") {
//保存分组
Ext.Ajax.request({
url: '/MvcShipping/MsMainForm/InsertItem',
params: { globalid: globalID, itemid: inputItemNameGID, itemname: inputItemNameValue },
scope: this,
callback: function (options, success, response) {
fnGetUserTemplet(globalID);
}
});
}
else {
//弹出提示框提示输入分组名称
fnShowMsg("请输入分组名称");
}
document.getElementById("maskGroupLayContain").style.display = "none";
document.getElementById("layGroupNameInputContain").style.display = "none";
}
function fnInsertItemCancel() {
document.getElementById("maskGroupLayContain").style.display = "none";
document.getElementById("layGroupNameInputContain").style.display = "none";
}
function fnInsertLink() {
var layGroupListLine;
var layGroupListUL;
var layGroupListChkLI;
var layGroupListShortLI1;
var layGroupListShortLI2;
var layGroupListLongLI;
var nameStr = "<请输入名称>";
var linkStr = "<请输入链接地址>";
var sqlStr = "<请输入查询语句>";
inputItemNameGID = guid();
layGroupListLine = document.createElement("div");
layGroupListLine.id = "layGroupListLineBody" + inputItemNameGID;
var addClass1 = document.createAttribute("class");
addClass1.nodeValue = "layGroupListLineBody";
layGroupListLine.setAttributeNode(addClass1);
document.getElementById("layGroupList").appendChild(layGroupListLine);
layGroupListUL = document.createElement("ul");
layGroupListUL.id = "layGroupListBodyUL" + inputItemNameGID;
var addClass2 = document.createAttribute("class");
addClass2.nodeValue = "layGroupListBodyUL";
layGroupListUL.setAttributeNode(addClass2);
document.getElementById(layGroupListLine.id).appendChild(layGroupListUL);
layGroupListChkLI = document.createElement("li");
var addClass3 = document.createAttribute("class");
addClass3.nodeValue = "layGroupListChkbox";
var addRelChk = document.createAttribute("rel");
addRelChk.nodeValue = itemNameGID;
layGroupListChkLI.setAttributeNode(addClass3);
layGroupListChkLI.setAttributeNode(addRelChk);
layGroupListChkLI.innerHTML = "<input type=\"checkbox\" id=\"chkLink" + inputItemNameGID + "\" name=\"chkLink\" rel=\"" + inputItemNameGID + "\" class=\"chkInputTab\" />";
document.getElementById(layGroupListUL.id).appendChild(layGroupListChkLI);
layGroupListShortLI1 = document.createElement("li");
var addClass3 = document.createAttribute("class");
addClass3.nodeValue = "layGroupListBodyShortLI";
layGroupListShortLI1.setAttributeNode(addClass3);
layGroupListShortLI1.innerHTML = "<input type=\"text\" id=\"txtInputTabName" + inputItemNameGID + "\" name=\"txtInputTabName\" class=\"textInputTabShort\" value=\"" + nameStr + "\" onblur=\"javascript:fnTextBlur(this, '" + nameStr + "');\" onclick=\"javascript:fnActive(this);\" />";
document.getElementById(layGroupListUL.id).appendChild(layGroupListShortLI1);
layGroupListShortLI2 = document.createElement("li");
var addClass4 = document.createAttribute("class");
addClass4.nodeValue = "layGroupListBodyShortLI";
layGroupListShortLI2.setAttributeNode(addClass4);
layGroupListShortLI2.innerHTML = "<input type=\"text\" id=\"txtInputTabLink" + inputItemNameGID + "\" name=\"txtInputTabLink\" class=\"textInputTabShort\" value=\"" + linkStr + "\" onblur=\"javascript:fnTextBlur(this, '" + linkStr + "');\" onclick=\"javascript:fnActive(this);\" />";
document.getElementById(layGroupListUL.id).appendChild(layGroupListShortLI2);
layGroupListLongLI = document.createElement("li");
var addClass5 = document.createAttribute("class");
addClass5.nodeValue = "layGroupListBodyLongLI";
layGroupListLongLI.setAttributeNode(addClass5);
layGroupListLongLI.innerHTML = "<ul class=\"layGroupListBodyLongChildUL\"><li class=\"layGroupListBodyLongChildTextLI\"><input type=\"text\" id=\"txtInputTabSQL" + inputItemNameGID + "\" name=\"txtInputTabSQL\" class=\"textInputTabLong\" value=\"" + sqlStr + "\" onblur=\"javascript:fnTextBlur(this, '" + sqlStr + "');\" onclick=\"javascript:fnActive(this);\" /></li><li class=\"layGroupListBodyLongChildBtnLI\"><a href=\"javascript:fnShowSQLEditor('txtInputTabSQL" + inputItemNameGID + "');\"><img src=\"../../../../images/setting/edit.png\" width=\"16\" height=\"16\" border=\"0\" alt=\"编辑\" /></a></li></ul>";
document.getElementById(layGroupListUL.id).appendChild(layGroupListLongLI);
}
function fnDeleteLink() {
var chkLink = document.getElementsByName("chkLink"); //
var itemid = "";
var detailLine;
for(var i=0;i<chkLink.length;i++)
{
if (chkLink[i].checked) {
detailLine = chkLink[i].id;
detailLine = detailLine.replace(/chkLink/i, "layGroupListLineBody");
itemid = chkLink[i].attributes["rel"].value;
Ext.Ajax.request({
url: '/MvcShipping/MsMainForm/DeleteItemLink',
params: { itemid: itemid },
scope: this
});
document.getElementById("layGroupList").removeChild(document.getElementById(detailLine));
}
}
}
function fnSaveLinks() {
var chkLink = document.getElementsByName("chkLink");
var txtInputTabName = document.getElementsByName("txtInputTabName");
var txtInputTabLink = document.getElementsByName("txtInputTabLink");
var txtInputTabSQL = document.getElementsByName("txtInputTabSQL");
var linkLength = chkLink.length;
var aa = itemNameGID;
var bb = itemNameValue;
var itemid = "";
var itemname = "";
var linkurl = "";
var sql = "";
for (var iCount = 0; iCount < linkLength; iCount++) {
itemid = chkLink[iCount].attributes["rel"].value;
itemname = txtInputTabName[iCount].value;
linkurl = txtInputTabLink[iCount].value;
sql = txtInputTabSQL[iCount].value;
Ext.Ajax.request({
url: '/MvcShipping/MsMainForm/InsertItemLink',
params: { groupid: globalID, parentValue: itemNameValue, inputid: itemid, itemname: itemname, linkurl: linkurl, inquire: sql },
callback: function (options, success, response) {
if (success) {
fnShowMsg("已保存");
}
else {
fnShowMsg("保存失败");
}
},
scope: this
});
}
}
function guid() {
function S4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
}
function fnShowMsg(msg) {
var _winWidth = document.documentElement.clientWidth;
var _winHeight = document.documentElement.clientHeight;
document.getElementById("alertMask").style.width = _winWidth + "px";
document.getElementById("alertMask").style.height = _winHeight + "px";
document.getElementById("alertBg").style.top = (_winHeight - 180) / 2 + "px";
document.getElementById("alertBg").style.left = (_winWidth - 420 - 26) / 2 + "px";
document.getElementById("alertContent").innerText = msg;
document.getElementById("alertMask").style.display = "block";
document.getElementById("alertBg").style.display = "block";
}
function fnHideMsg() {
document.getElementById("alertMask").style.display = "none";
document.getElementById("alertBg").style.display = "none";
}
function fnShowSQLEditor(txtID) {
var txtValue = document.getElementById(txtID).value;
globalTxtID = txtID;
document.getElementById("editListTitleUL").innerHTML = "";
document.getElementById("editListUL").innerHTML = "";
document.getElementById("editListTitleUL").style.width = 400 + "px";
document.getElementById("editListTitle").style.width = 400 + "px";
document.getElementById("editListUL").style.width = 400 + "px";
document.getElementById("editListUL").style.height = 25 + "px";
document.getElementById("editListCollection").style.width = 400 + "px";
if (txtValue != "<请输入查询语句>") {
if (txtValue.indexOf("from") != -1) txtValue = txtValue.replace(/from/g, "\nfrom");
else if (txtValue.indexOf("From") != -1) txtValue = txtValue.replace(/From/g, "\nFrom");
else if (txtValue.indexOf("FROM") != -1) txtValue = txtValue.replace(/FROM/g, "\nFROM");
if (txtValue.indexOf("where") != -1) txtValue = txtValue.replace(/where/g, "\nwhere");
else if (txtValue.indexOf("Where") != -1) txtValue = txtValue.replace(/Where/g, "\nWhere");
else if (txtValue.indexOf("WHERE") != -1) txtValue = txtValue.replace(/WHERE/g, "\nWHERE");
if (txtValue.indexOf("left") != -1) txtValue = txtValue.replace(/left/g, "\nleft");
else if (txtValue.indexOf("Left") != -1) txtValue = txtValue.replace(/Left/g, "\nLeft");
else if (txtValue.indexOf("LEFT") != -1) txtValue = txtValue.replace(/LEFT/g, "\nLEFT");
if (txtValue.indexOf("order") != -1) txtValue = txtValue.replace(/order/g, "\norder");
else if (txtValue.indexOf("Order") != -1) txtValue = txtValue.replace(/Order/g, "\nOrder");
else if (txtValue.indexOf("ORDER") != -1) txtValue = txtValue.replace(/ORDER/g, "\nORDER");
if (txtValue.indexOf("union") != -1) txtValue = txtValue.replace(/union/g, "\nunion");
else if (txtValue.indexOf("Union") != -1) txtValue = txtValue.replace(/Union/g, "\nUnion");
else if (txtValue.indexOf("UNION") != -1) txtValue = txtValue.replace(/UNION/g, "\nUNION");
document.getElementById("txtEdit").value = txtValue;
}
document.getElementById("editMask").style.display = "block";
document.getElementById("editBg").style.display = "block";
document.getElementById("editBg").style.top = (document.documentElement.clientHeight - 500) / 2 + "px";
document.getElementById("editBg").style.left = (document.documentElement.clientWidth - 402) / 2 + "px";
}
function fnHideSQLEditorAndSave() {
var txtValue = document.getElementById("txtEdit").value;
if (txtValue != "") {
if (txtValue.indexOf("\n") != -1) txtValue = txtValue.replace(/\n/g, " ");
else if (txtValue.indexOf("\r") != -1) txtValue = txtValue.replace(/\r/g, " ");
document.getElementById(globalTxtID).value = txtValue;
}
document.getElementById("editMask").style.display = "none";
document.getElementById("editBg").style.display = "none";
}
function fnHideSQLEditor() {
document.getElementById("editMask").style.display = "none";
document.getElementById("editBg").style.display = "none";
}
function fnTestSQLInquire() {
var fieldCount = 0;
var strTitleConstruction = "";
var strConstruction = "";
var txtValue = document.getElementById("txtEdit").value;
if (txtValue != "") {
if (txtValue.indexOf("\n") != -1) txtValue = txtValue.replace(/\n/g, " ");
if (txtValue.indexOf("\r") != -1) txtValue = txtValue.replace(/\r/g, " ");
}
Ext.Ajax.request({
url: '/MvcShipping/MsMainForm/TestItemLink',
params: { sql: txtValue },
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
var data = result;
document.getElementById("editListUL").style.height = (data.length + 1) * 25 + "px";
for (var iCount = 0; iCount < data.length; iCount++) {
//遍历结果集
for (var field in data[iCount]) {
if (field == "fieldCount") {
fieldCount = parseInt(data[iCount][field]);
if (fieldCount > 4) {
document.getElementById("editListTitleUL").style.width = 101 * fieldCount + "px";
document.getElementById("editListTitle").style.width = 101 * fieldCount + "px";
}
document.getElementById("editListUL").style.width = 101 * fieldCount + "px";
document.getElementById("editListCollection").style.width = 101 * fieldCount + "px";
}
else {
if (iCount == 0) {
strTitleConstruction += "<li class=\"editListTitleLI\">" + field + "</li>";
}
strConstruction += "<li class=\"editListLI\">" + data[iCount][field] + "</li>"; ;
}
}
}
document.getElementById("editListTitleUL").innerHTML = strTitleConstruction;
document.getElementById("editListUL").innerHTML = strConstruction;
}
},
scope: this
});
}