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 = ""; 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 = "" + data[iCount].TEMPLETNAME + ""; 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 = ""; 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 = ""; } else { layGroupChildImg.innerHTML = ""; } 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 = ""; 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, """); //输入框中显示双引号问题 outputName = outputName.replace(/\'/g, "'"); //输入框中显示单引号问题 layGroupListShortLI1.innerHTML = ""; 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, """); //输入框中显示双引号问题 outputLink = outputLink.replace(/\'/g, "'"); //输入框中显示单引号问题 layGroupListShortLI2.innerHTML = ""; 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, """); //输入框中显示双引号问题 outputSQL = outputSQL.replace(/\'/g, "'"); //输入框中显示单引号问题 layGroupListLongLI.innerHTML = "
"; 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 = ""; document.getElementById(layGroupListUL.id).appendChild(layGroupListChkLI); layGroupListShortLI1 = document.createElement("li"); var addClass3 = document.createAttribute("class"); addClass3.nodeValue = "layGroupListBodyShortLI"; layGroupListShortLI1.setAttributeNode(addClass3); layGroupListShortLI1.innerHTML = ""; document.getElementById(layGroupListUL.id).appendChild(layGroupListShortLI1); layGroupListShortLI2 = document.createElement("li"); var addClass4 = document.createAttribute("class"); addClass4.nodeValue = "layGroupListBodyShortLI"; layGroupListShortLI2.setAttributeNode(addClass4); layGroupListShortLI2.innerHTML = ""; document.getElementById(layGroupListUL.id).appendChild(layGroupListShortLI2); layGroupListLongLI = document.createElement("li"); var addClass5 = document.createAttribute("class"); addClass5.nodeValue = "layGroupListBodyLongLI"; layGroupListLongLI.setAttributeNode(addClass5); layGroupListLongLI.innerHTML = ""; document.getElementById(layGroupListUL.id).appendChild(layGroupListLongLI); } function fnDeleteLink() { var chkLink = document.getElementsByName("chkLink"); // var itemid = ""; var detailLine; for(var i=0;i