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.
DS7/DSWeb/js/jsGridSeaeAdjustETD.js

832 lines
29 KiB
JavaScript

2 years ago
function TGridCommon(id,formName,headArgs,widthArgs,alignArgs,sortArgs,typeArgs){
var self = this;
var gridObj;//grid object
this.formName = formName;//form name
this.id = id;//TGridCommon object id
this.totalPageCount;//Total Count
this.responseUrl;//Ajax Request Url
this.over = false;
this.menu = null;//Menu object
this.pageShowCount = 15;
var shield;//
this.headArgs = headArgs;//Header
this.widthArgs = widthArgs;//Width
this.alignArgs = alignArgs;//Align
this.sortArgs = sortArgs;//Sort
this.typeArgs = typeArgs;//Type
this.skin;
this.imageUrl;
this.page;
this.pageSwitch;
this.condition;
this.subGridArgs = [];
this.request;
this.sourceType;
this.openUrl;
this.openType;
this.openSet;
this.isDoubleClick = false;
this.isShowHeader = false;
this.searchVal = "";
//find object
this.$ = function(id){
return document.getElementById(id);
};
//initialization grid
this.initGrid = function(){
self.gridObj = new dhtmlXGridObject(self.id);
self.gridObj.setImagePath(self.imageUrl);
self.gridObj.setSkin(self.skin);
self.gridObj.setHeader(self.headArgs.toString());
self.gridObj.setInitWidths(self.widthArgs.toString());
self.gridObj.setColAlign(self.alignArgs.toString());
self.gridObj.setColSorting(self.sortArgs.toString());
self.gridObj.setColTypes(self.typeArgs.toString());
if(self.isShowHeader){
self.gridObj.setNoHeader(self.isShowHeader);
}
self.gridObj.init();
};
//grid bind
this.bind = function(){
//self.responseUrl + "?handle=list&i_page&show_page="+self.pageShowCount.toString()+"&cur_page=1&condition="+self.condition
self.gridObj.load(self.request,self.sourceType);//self.responseUrl + "?handle=list"+self.condition
};
this.showHeader = function(isShow){
self.isShowHeader = isShow;
};
//json load request url
this.setRequest = function(request){
self.request = request;
};
//source type
this.setSourceType = function(strSourceType){
self.sourceType = strSourceType;
};
//skin
this.setSkin = function(strSkin){
self.skin = strSkin;
};
//imageUrl
this.setImageUrl = function(strImageUrl){
self.imageUrl = strImageUrl;
};
//Response Url
this.setResponseUrl = function(url){
self.responseUrl = url;
};
//
this.setIsPage = function(isOpen){
self.pageSwitch = isOpen;
};
//refresh grid
this.refresh = function(){
self.initGrid();
};
//load sub grid
this.clickShowSubGrid = function(subGridObj){
self.gridObj.attachEvent("onRowDblClicked", function(rId,cInd){
subGridObj.bind();
});
};
this.getGridObj = function(){
return self.gridObj;
}
this.setSubGrid = function(subGrid){
self.subGridArgs = subGrid;
};
//window open url
this.setOpenUrl = function(openUrl){
self.openUrl = openUrl;
};
//window open type
this.setOpenType = function(strType){
self.openType = strType;
};
//window open set
this.setOpenSet = function(strSet){
self.openSet = strSet;
};
this.dbclickPop = function(){
//set status
self.isDoubleClick = true;
self.gridObj.attachEvent("onRowDblClicked", function(rId,cInd){
window.open (self.openUrl+rId,self.openType,self.openSet);
});
};
this.clickEvent = function(iMethod){
if(self.gridObj != null){
self.gridObj.attachEvent("onRowDblClicked", function(rId,cInd){
switch(iMethod){//open new windows
case 1:
var openUrl = "../shipping/SeaeAdjustETDGridSource.aspx?handle=edit&id="+rId+$("hdAdjust").value;
break;
case 2://refresh sub grid
for(var i=0;i<self.subGridArgs.length;i++){
var gridObj = self.subGridArgs[i];
gridObj.initGrid();
}
break;
}
});
}else{
alert("Object is null");
}
};
this.clickRefrash = function(){
self.initGrid();
};
this.getGridRowID = function(gridObj){
var selRowID = mygrid_recv.getSelectedRowId();
var selGroup = new Array();
if(selRowID.indexOf(",") > 0){
selGroup = selRowID.split(",");
}else{
if(selRowID != null){
selGroup.push(selRowID);
}
}
return selGroup;
};
this.enableMultiselect = function(bValue){
self.gridObj.enableMultiselect(bValue);
};
this.getObjByClassName = function(eleClassName){
var getEleClass = [];//定义一个数组
var myclass = new RegExp("\\b"+eleClassName+"\\b");//创建一个正则表达式对像
var elem = document.body.all.tags("DIV");//获取文档里所有的元素
for(var h=0;h<elem.length;h++)
{
var classes = elem[h].className;//获取class对像
if (myclass.test(classes)){
getEleClass.push(elem[h]);//正则比较取到想要的CLASS对像
}
}
return getEleClass;//返回数组
}
//get total page count
this.getTotalPage = function(){
var urlVal = self.responseUrl + "?handle=page&val="+self.newGuid()+$("hdAdjust").value;
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
};
//Get Guid
this.newGuid = function(){
var guid = "";
for (var i = 1; i <= 32; i++){
var n = Math.floor(Math.random()*16.0).toString(16);
guid += n;
if((i==8)||(i==12)||(i==16)||(i==20))
guid += "-";
}
return guid.toUpperCase();
};
//初始化页面
this.initPage = function(){
self.pager = new PagerView('pager');
var urlVal = self.responseUrl + "?handle=page&val="+self.newGuid()+$("hdAdjust").value;//alert(self.responseUrl + "?handle=page&val="+self.newGuid());
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
self.totalPageCount = loadVal;
self.pager.itemCount = self.totalPageCount;
self.pager.size = self.pageShowCount;
self.pager.index = 1;
self.pager.onclick = function(index){
document.getElementById('info').innerHTML = '现在翻到第' + index + '页';
self.request = self.responseUrl + "?handle=list&show_page="+self.pager.size.toString()+"&cur_page="+index+$("hdAdjust").value;
setTimeout(function(){
self.initGrid();
self.bind();
if(self.isDoubleClick){
//self.dbclickPop();
}
},300);
};
self.pager.render();
};
//初始化页面
this.initPageByHandle = function(handleName){
self.pager = new PagerView('pager');
var urlVal = "";
if(self.searchVal.length > 1){
urlVal = self.responseUrl + "?handle="+handleName+"page&search="+escape(self.searchVal)+"&val="+self.newGuid()+$("hdAdjust").value;//alert(self.responseUrl + "?handle=page&val="+self.newGuid());
}else{
urlVal = self.responseUrl + "?handle="+handleName+"page&val="+self.newGuid()+$("hdAdjust").value;
}
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
self.totalPageCount = loadVal;
self.pager.itemCount = self.totalPageCount;
self.pager.size = self.pageShowCount;
self.pager.index = 1;
self.pager.onclick = function(index){
document.getElementById('info').innerHTML = '现在翻到第' + index + '页';
if(self.searchVal.length > 1){
self.request = self.responseUrl + "?handle="+handleName+"&show_page="+self.pager.size.toString()+"&cur_page="+index+"&search="+escape(self.searchVal)+$("hdAdjust").value;
}else{
self.request = self.responseUrl + "?handle="+handleName+"&show_page="+self.pager.size.toString()+"&cur_page="+index+$("hdAdjust").value;
}
setTimeout(function(){
self.initGrid();
self.bind();
if(self.isDoubleClick){
//self.dbclickPop();
}
},300);
};
self.pager.render();
};
//save grid column setting change(include: name,width,index)
this.saveColumnSetting = function(){
var colCount = this.gridObj.getColumnsNum();
var jsonFeeObj = "";
jsonFeeObj = "{\"$type\":\"DSWeb.Models.JsonColumnGroupEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",\"ShowCount\":"+pageShowCount+",\"JsonColumnEntities\":[";
var tempGroupJson = "";
for(var i=0;i<colCount;i++){
var tempJson = "";
var rId = this.gridObj.getRowId(i);
tempJson += "\"$type\":\"DSWeb.Models.JsonColumnEntity, DSWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\",";
tempJson += "\"col1\":\"\",";//gid
tempJson += "\"col2\":\""+i.toString()+"\",";//column name
tempJson += "\"col3\":\""+this.gridObj.getColumnLabel(i)+"\",";//column description
tempJson += "\"col4\":\""+i.toString()+"\",";//index
tempJson += "\"col5\":\""+this.gridObj.getColWidth(i)+"\",";//width
tempJson += "\"col6\":-1";
tempJson = "{"+tempJson+"}";
if(i == colCount - 1){
tempGroupJson += tempJson;
}else{
tempGroupJson += tempJson+",";
}
}
jsonFeeObj += tempGroupJson;
jsonFeeObj += "]}";
$("hid_setting").value = jsonFeeObj;
jsonFeeObj = null;
//alert(jsonFeeObj);
var myForm = document.getElementById("form1");
myForm.submit() ;
};
this.initMenu = function(id){
this.$(id).oncontextmenu = function(ev){
showMenu(ev);
return false;
};
document.onmousedown = function(){if(!self.over)hideMenu();};
};
//显示右键菜单
this.showMenu = function(){
self.menu = null;
ev = ev || window.event;
hideMenu();
var e = ev.srcElement || ev.target;
if(e.tagName=="TH") return;
var x = ev.pageX || ev.clientX + document.documentElement.scrollLeft;
var y = ev.pageY || ev.clientY + document.documentElement.scrollTop;
self.menu = document.createElement("DIV");
self.menu.className = "menu";
self.menu.style.left = x+4+"px";
self.menu.style.top = y+"px";
document.body.appendChild(self.menu);
//alert(e.parentNode.getElementsByTagName("DIV")[1].innerHTML);
var dvGroup = e.parentNode.getElementsByTagName("DIV");
var dvGroupCount = dvGroup.length;
var id ="";
if(dvGroupCount == 1){
id = dvGroup[0].innerHTML;
}
if(id.trim().length < 1){
hideMenu();
return;
}
var sname = document.location.pathname.substring(7,location.pathname.length).toString();
var s = "<div class=\"dvMenu\" >修改标题</div><div class=\"dvMenu\" onclick=\"editColumnSetting('dvColumnSet')\">编辑显示</div>";
self.menu.innerHTML = s;
self.menu.onmouseover = function(){self.over=true;};
self.menu.onmouseout = function(){self.over=false;};
};
//hide menu object
this.hideMenu = function(){
if(self.menu){
document.body.removeChild(self.menu);
self.menu = null;
}
};
//IS NUMBER
this.IsNum = function(val){
var re = /^[-\+]?\d+(\.\d+)?$/;
if (!re.test(val)){
return false;
}else{
return true;
}
};
this.setSearch = function(val){
self.searchVal = val;
};
//is exist object
var docEle = function() {
return document.getElementById(arguments[0]) || false;
};
this.openNewDiv = function(){
var m = "mask";
if (docEle(_id)) document.removeChild(docEle(_id));
if (docEle(m)) document.removeChild(docEle(m));
// 新激活图层
var newDiv = document.createElement("div");
newDiv.id = _id;
newDiv.style.position = "absolute";
newDiv.style.zIndex = "9999";
newDiv.style.width = "200px";
newDiv.style.height = "100px";
newDiv.style.top = "100px";
newDiv.style.left = (parseInt(document.body.scrollWidth) - 300) / 2 + "px"; // 屏幕居中
newDiv.style.background = "#EFEFEF";
newDiv.style.border = "1px solid #860001";
newDiv.style.padding = "5px";
newDiv.innerHTML = "<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;您已更改了视图设置 是否保存<br/><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
document.body.appendChild(newDiv);
// mask图层
var newMask = document.createElement("div");
newMask.id = m;
newMask.style.position = "absolute";
newMask.style.zIndex = "1";
newMask.style.width = document.body.scrollWidth + "px";
newMask.style.height = document.body.scrollHeight + "px";
newMask.style.top = "0px";
newMask.style.left = "0px";
newMask.style.background = "#000";
newMask.style.filter = "alpha(opacity=40)";
newMask.style.opacity = "0.40";
document.body.appendChild(newMask);
// 关闭mask和新图层
var saveButton = document.createElement("a");
saveButton.href = "#";
saveButton.innerHTML = "确定";
saveButton.className="regular";
saveButton.onclick = function() {
this.saveColumnSetting();// save user grid column setting
}
newDiv.appendChild(saveButton);
//newDiv.innerHTML += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
var cancelButton = document.createElement("a");
cancelButton.href = "#";
cancelButton.innerHTML = "取消";
cancelButton.className="regular";
cancelButton.onclick = function() {
document.body.removeChild(docEle(_id));
document.body.removeChild(docEle(m));
cancelColumnSet();
return false;
}
newDiv.appendChild(cancelButton);
};
this.cancelColumnSet = function(){
self.gridObj = new dhtmlXGridObject(self.id);
self.gridObj.setImagePath(self.imageUrl);
self.gridObj.setSkin(self.skin);
self.gridObj.setHeader(self.headArgs.toString());
self.gridObj.setInitWidths(self.widthArgs.toString());
self.gridObj.setColAlign(self.alignArgs.toString());
self.gridObj.setColSorting(self.sortArgs.toString());
self.gridObj.setColTypes(self.typeArgs.toString());
self.gridObj.init();
setTimeout(function(){
mygrid_log.load(rspUrl + "?handle=list&show_page="+self.pageShowCount+"&cur_page=1"+$("hdAdjust").value,"json");
},300);
this.initPage();
initMenu();
};
this.getUserGridSetting = function(){
var urlVal = self.responseUrl + "handle=setting&val="+newGuid();
var loader = dhtmlxAjax.getSync(urlVal);
var loadVal = loader.xmlDoc.responseText;
jsonPage = loadVal;
if(IsNum(jsonPage)){
jsonPageObj = null;
}else{
jsonPageObj = eval('(' + loadVal + ')');
}
};
this.editColumnSetting = function(){
hideMenu();
var m = "mask";
if (docEle(_id)) document.removeChild(docEle(_id));
if (docEle(m)) document.removeChild(docEle(m));
// 新激活图层
var newDiv = document.createElement("div");
newDiv.id = _id;
newDiv.style.position = "absolute";
newDiv.style.zIndex = "9999";
newDiv.style.width = "700px";
newDiv.style.height = "340px";
newDiv.style.top = "100px";
newDiv.style.left = (parseInt(document.body.scrollWidth) - 560) / 2 + "px"; // 屏幕居中
newDiv.style.background = "#EFEFEF";
newDiv.style.border = "1px solid #860001";
newDiv.style.padding = "5px";
getUserGridSetting();
var TargeVal = "";
if(jsonPageObj != null){
for(var i=0;i<jsonPageObj.columns.length;i++){
TargeVal += "<option value=\""+jsonPageObj.columns[i].name+"\">"+jsonPageObj.columns[i].description+"</option>";
}
}
var editObj = "<div style=\"float:left\"><select id=\"sel_LogColumns\" multiple=\"multiple\" style=\"width:200px;height:300px;\">"
+ "<option value=\"NAME\">日志名称</option><option value=\"LOGTYPE\">日志类型</option><option value=\"LOGTIME\">日志记录时间</option>"
+ "<option value=\"LOGCONTENT\">日志内容</option><option value=\"USERNAME\">操作人</option></select></div>"
+ "<div style=\"float:left; width:60px;height:210px;margin:0 auto;text-align:center;vertical-align:middle;line-height:300px; padding-top:90px\">"
+ "<div class=\"imgLeftButton\" onmousemove=\"this.className='imgLeftHoverButton'\" onmouseout=\"this.className='imgLeftButton'\" title=\"添加\" onclick=\"add()\"></div>"
+ "<div class=\"imgRightButton\" onmousemove=\"this.className='imgRightHoverButton'\" onmouseout=\"this.className='imgRightButton'\" title=\"移除\" onclick=\"remove()\"></div>"
+ "</div><div style=\"float:left;\"><select id=\"sel_VisiableColumns\" multiple=\"multiple\" style=\"width:200px;height:300px;\">"+TargeVal+"</select></div>"
+ "<div style=\"float:left; width:60px;height:210px;margin:0 auto;text-align:center;vertical-align:middle;line-height:300px; padding-top:90px\">"
+ "<div class=\"imgUpButton\" onmousemove=\"this.className='imgUpHoverButton'\" onmouseout=\"this.className='imgUpButton'\" title=\"向上\" onclick=\"up()\"></div>"
+ "<div class=\"imgDownButton\" onmousemove=\"this.className='imgDownHoverButton'\" onmouseout=\"this.className='imgDownButton'\" title=\"向下\" onclick=\"down()\"></div></div>"
+ "<div><div style=\"float:left\"><input type=\"text\" id=\"txt_rename\" style=\"height:20px;width:110px; \"/></div>"
+ "<div class=\"enterButton\" style=\"width:30px; \" onclick=\"saveRename()\">保存</div></div>"
+ "<div style=\"float:left; width:70px;\"><div class=\"enterButton\" onclick=\"pushRename()\">重命名</div></div>"
+ "<div style=\"float:left;width:100%;padding-left:120px;\"><div class=\"enterButton\" onclick=\"saveColumnHeader()\">保存</div><div class=\"enterButton\" onclick=\"cancelColumnHeader()\">取消</div></div>";
newDiv.innerHTML = editObj;
document.body.appendChild(newDiv);
// mask图层
var newMask = document.createElement("div");
newMask.id = m;
newMask.style.position = "absolute";
newMask.style.zIndex = "1";
newMask.style.width = document.body.scrollWidth + "px";
newMask.style.height = document.body.scrollHeight + "px";
newMask.style.top = "0px";
newMask.style.left = "0px";
newMask.style.background = "#000";
newMask.style.filter = "alpha(opacity=40)";
newMask.style.opacity = "0.40";
document.body.appendChild(newMask);
// 关闭mask和新图层
};
}
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
//pager view
function PagerView(id){
var selfp = this;
this.id = id;
this.container = null;
this.index = 1; // 当前页码, 从1开始
this.size = self.pageShowCount; // 每页显示记录数
this.maxButtons = 9; // 显示的分页按钮数量
this.itemCount = 0; // 记录总数
this.pageCount = 0; // 总页数
/**
* 控件使用者重写本方法, 获取翻页事件, 可用来向服务器端发起AJAX请求.
* @param index: 被点击的页码.
*/
this.onclick = function(index){
};
/**
* 内部方法.
*/
this._onclick = function(index){
selfp.index = index;
selfp.onclick(index);
selfp.render();
};
/**
* 在显示之前计算各种页码变量的值.
*/
this.calculate = function(){
selfp.pageCount = parseInt(Math.ceil(selfp.itemCount / selfp.size));
selfp.index = parseInt(selfp.index);
if(selfp.index > selfp.pageCount){
selfp.index = selfp.pageCount;
}
};
/**
* 渲染分页控件.
*/
this.render = function(){
if(selfp.id != undefined){
var div = document.getElementById(selfp.id);
div.view = selfp;
selfp.container = div;
}
selfp.calculate();
var start, end;
start = Math.max(1, selfp.index - parseInt(selfp.maxButtons/2));
end = Math.min(selfp.pageCount, start + selfp.maxButtons - 1);
start = Math.max(1, end - selfp.maxButtons + 1);
var str = "";
str += "<div class=\"PagerView\">\n";
if(selfp.pageCount > 1){
if(selfp.index != 1){
str += '<a href="javascript://1"><span>|&lt;</span></a>';
str += '<a href="javascript://' + (selfp.index-1) + '"><span>&lt;&lt;</span></a>';
}else{
str += '<span>|&lt;</span>';
str += '<span>&lt;&lt;</span>';
}
}
for(var i=start; i<=end; i++){
if(i == this.index){
str += '<span class="on">' + i + "</span>";
}else{
str += '<a href="javascript://' + i + '"><span>' + i + "</span></a>";
}
}
if(selfp.pageCount > 1){
if(selfp.index != selfp.pageCount){
str += '<a href="javascript://' + (selfp.index+1) + '"><span>&gt;&gt;</span></a>';
str += '<a href="javascript://' + selfp.pageCount + '"><span>&gt;|</span></a>';
}else{
str += '<span>&gt;&gt;</span>';
str += '<span>&gt;|</span>';
}
}
str += ' 一共' + selfp.pageCount + '页, ' + selfp.itemCount + '条记录 '+'&nbsp;&nbsp;&nbsp;每页显示:&nbsp;'+"<select id=\"cusShowCount\" style=\"width:70px;\" onchange=\"changeShowCount('cusShowCount')\">"+selfp.getPageOption()+"</select>";
str += "</div><!-- /.pagerView -->\n";
selfp.container.innerHTML = str;
var a_list = selfp.container.getElementsByTagName('a');
for(var i=0; i<a_list.length; i++){
a_list[i].onclick = function(){
var index = this.getAttribute('href');
if(index != undefined && index != ''){
index = parseInt(index.replace('javascript://', ''));
selfp._onclick(index)
}
return false;
};
}
};
this.getPageOption = function(){
var pageCountArg = new Array();
pageCountArg.push(15);
pageCountArg.push(30);
pageCountArg.push(50);
pageCountArg.push(100);
pageCountArg.push(200);
var optionStr = "";
for(var i = 0;i<pageCountArg.length;i++){
if(self.pageShowCount == parseInt(pageCountArg[i])){
optionStr += "<option value=\""+pageCountArg[i]+"\" selected=\"1\">"+pageCountArg[i]+"</option>";
}else{
optionStr += "<option value=\""+pageCountArg[i]+"\">"+pageCountArg[i]+"</option>";
}
}
return optionStr;
};
}
function el(id){
return document.getElementById(id);
}
function initMenu(gridObj){
el(gridObj).oncontextmenu = function(ev){
showMenu(ev);
return false;
};
document.onmousedown = function(){if(!over)hideMenu();};
};
var over = false;
var menu = null;
function showMenu(ev){
menu = null;
ev = ev || window.event;
hideMenu();
var e = ev.srcElement || ev.target;
if(e.tagName=="TH") return;
var x = ev.pageX || ev.clientX + document.documentElement.scrollLeft;
var y = ev.pageY || ev.clientY + document.documentElement.scrollTop;
menu = document.createElement("DIV");
menu.className = "menu";
menu.style.left = x+4+"px";
menu.style.top = y+"px";
document.body.appendChild(menu);
//alert(e.parentNode.getElementsByTagName("DIV")[1].innerHTML);
var dvGroup = e.parentNode.getElementsByTagName("DIV");
var dvGroupCount = dvGroup.length;
var id ="";
if(dvGroupCount == 1){
id = dvGroup[0].innerHTML;
}
if(id.trim().length < 1){
hideMenu();
return;
}
var sname = document.location.pathname.substring(7,location.pathname.length).toString();
var s = "<div class=\"dvMenu\" onclick=\"editColumnSetting('dvColumnSet')\">编辑显示</div>";
menu.innerHTML = s;
menu.onmouseover = function(){over=true;};
menu.onmouseout = function(){over=false;};
}
function hideMenu(){
if(menu){
document.body.removeChild(menu);
menu = null;
}
}
function editColumnSetting(_id) {
hideMenu();
var m = "mask";
if (docEle(_id)) document.removeChild(docEle(_id));
if (docEle(m)) document.removeChild(docEle(m));
// 新激活图层
var newDiv = document.createElement("div");
newDiv.id = _id;
newDiv.style.position = "absolute";
newDiv.style.zIndex = "9999";
newDiv.style.width = "700px";
newDiv.style.height = "340px";
newDiv.style.top = "100px";
newDiv.style.left = (parseInt(document.body.scrollWidth) - 560) / 2 + "px"; // 屏幕居中
newDiv.style.background = "#EFEFEF";
newDiv.style.border = "1px solid #860001";
newDiv.style.padding = "5px";
getUserGridSetting();
var TargeVal = "";
if(jsonPageObj != null){
for(var i=0;i<jsonPageObj.columns.length;i++){
TargeVal += "<option value=\""+jsonPageObj.columns[i].name+"\">"+jsonPageObj.columns[i].description+"</option>";
}
}
var editObj = "<div style=\"float:left\"><select id=\"sel_LogColumns\" multiple=\"multiple\" style=\"width:200px;height:300px;\">"
+ "<option value=\"NAME\">日志名称</option><option value=\"LOGTYPE\">日志类型</option><option value=\"LOGTIME\">日志记录时间</option>"
+ "<option value=\"LOGCONTENT\">日志内容</option><option value=\"USERNAME\">操作人</option></select></div>"
+ "<div style=\"float:left; width:60px;height:210px;margin:0 auto;text-align:center;vertical-align:middle;line-height:300px; padding-top:90px\">"
+ "<div class=\"imgLeftButton\" onmousemove=\"this.className='imgLeftHoverButton'\" onmouseout=\"this.className='imgLeftButton'\" title=\"添加\" onclick=\"add()\"></div>"
+ "<div class=\"imgRightButton\" onmousemove=\"this.className='imgRightHoverButton'\" onmouseout=\"this.className='imgRightButton'\" title=\"移除\" onclick=\"remove()\"></div>"
+ "</div><div style=\"float:left;\"><select id=\"sel_VisiableColumns\" multiple=\"multiple\" style=\"width:200px;height:300px;\">"+TargeVal+"</select></div>"
+ "<div style=\"float:left; width:60px;height:210px;margin:0 auto;text-align:center;vertical-align:middle;line-height:300px; padding-top:90px\">"
+ "<div class=\"imgUpButton\" onmousemove=\"this.className='imgUpHoverButton'\" onmouseout=\"this.className='imgUpButton'\" title=\"向上\" onclick=\"up()\"></div>"
+ "<div class=\"imgDownButton\" onmousemove=\"this.className='imgDownHoverButton'\" onmouseout=\"this.className='imgDownButton'\" title=\"向下\" onclick=\"down()\"></div></div>"
+ "<div><div style=\"float:left\"><input type=\"text\" id=\"txt_rename\" style=\"height:20px;width:110px; \"/></div>"
+ "<div class=\"enterButton\" style=\"width:30px; \" onclick=\"saveRename()\">保存</div></div>"
+ "<div style=\"float:left; width:70px;\"><div class=\"enterButton\" onclick=\"pushRename()\">重命名</div></div>"
+ "<div style=\"float:left;width:100%;padding-left:120px;\"><div class=\"enterButton\" onclick=\"saveColumnHeader()\">保存</div><div class=\"enterButton\" onclick=\"cancelColumnHeader()\">取消</div></div>";
newDiv.innerHTML = editObj;
document.body.appendChild(newDiv);
// mask图层
var newMask = document.createElement("div");
newMask.id = m;
newMask.style.position = "absolute";
newMask.style.zIndex = "1";
newMask.style.width = document.body.scrollWidth + "px";
newMask.style.height = document.body.scrollHeight + "px";
newMask.style.top = "0px";
newMask.style.left = "0px";
newMask.style.background = "#000";
newMask.style.filter = "alpha(opacity=40)";
newMask.style.opacity = "0.40";
document.body.appendChild(newMask);
// 关闭mask和新图层
}
var docEle = function() {
return document.getElementById(arguments[0]) || false;
}
function openNewDiv(_id) {
var m = "mask";
if (docEle(_id)) document.removeChild(docEle(_id));
if (docEle(m)) document.removeChild(docEle(m));
// 新激活图层
var newDiv = document.createElement("div");
newDiv.id = _id;
newDiv.style.position = "absolute";
newDiv.style.zIndex = "9999";
newDiv.style.width = "200px";
newDiv.style.height = "100px";
newDiv.style.top = "100px";
newDiv.style.left = (parseInt(document.body.scrollWidth) - 300) / 2 + "px"; // 屏幕居中
newDiv.style.background = "#EFEFEF";
newDiv.style.border = "1px solid #860001";
newDiv.style.padding = "5px";
newDiv.innerHTML = "<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;您已更改了视图设置 是否保存<br/><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
document.body.appendChild(newDiv);
// mask图层
var newMask = document.createElement("div");
newMask.id = m;
newMask.style.position = "absolute";
newMask.style.zIndex = "1";
newMask.style.width = document.body.scrollWidth + "px";
newMask.style.height = document.body.scrollHeight + "px";
newMask.style.top = "0px";
newMask.style.left = "0px";
newMask.style.background = "#000";
newMask.style.filter = "alpha(opacity=40)";
newMask.style.opacity = "0.40";
document.body.appendChild(newMask);
// 关闭mask和新图层
var saveButton = document.createElement("a");
saveButton.href = "#";
saveButton.innerHTML = "确定";
saveButton.className="regular";
saveButton.onclick = function() {
change();
//document.body.removeChild(docEle(_id));
//document.body.removeChild(docEle(m));
//return false;
}
newDiv.appendChild(saveButton);
//newDiv.innerHTML += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
var cancelButton = document.createElement("a");
cancelButton.href = "#";
cancelButton.innerHTML = "取消";
cancelButton.className="regular";
cancelButton.onclick = function() {
document.body.removeChild(docEle(_id));
document.body.removeChild(docEle(m));
unSaveGrid();
return false;
}
newDiv.appendChild(cancelButton);
}