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.
261 lines
11 KiB
JavaScript
261 lines
11 KiB
JavaScript
var commonGridObj_module;
|
|
|
|
function $(id){
|
|
return document.getElementById(id);
|
|
}
|
|
|
|
function createGrid(){
|
|
initLoading();
|
|
//header
|
|
var headerArgs_module = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkAll(commonGridObj_module)\" />","模块英文名称","模块中文名称","模块连接地址","模块图标","模块状态","排序值","父模块","创建人","创建时间","类型");
|
|
//width
|
|
var widthArgs_module = new Array("40","180","120","200","100","60","60","60","100","120","70");
|
|
//column align
|
|
var colAlignArgs_module = new Array("center","left","left","left","left","center","center","center","center","center","center");
|
|
//column sort
|
|
var colSortArgs_module = new Array("na","str","str","str","str","str","str","str","str","str","str");
|
|
//column type
|
|
var colTypeArgs_module = new Array("ch","ro","ro","ro","ro","ch","ro","ro","ro","ro","ro");
|
|
|
|
|
|
commonGridObj_module = new TGridCommon("mygrid_container_module","form1",headerArgs_module,widthArgs_module,colAlignArgs_module,colSortArgs_module,colTypeArgs_module);
|
|
|
|
commonGridObj_module.setResponseUrl("ModuleGridSource.aspx");
|
|
commonGridObj_module.setRequest("ModuleGridSource.aspx?handle=list&show_page=15&cur_page=1&uid="+commonGridObj_module.newGuid());
|
|
commonGridObj_module.setSourceType("json");
|
|
commonGridObj_module.setSkin("xp");
|
|
commonGridObj_module.setImageUrl("../images/");
|
|
commonGridObj_module.initGrid();
|
|
|
|
commonGridObj_module.loadafter = true;
|
|
commonGridObj_module.after = function(){
|
|
finishLoading();
|
|
}
|
|
commonGridObj_module.bind();
|
|
|
|
commonGridObj_module.initPageByHandle("list");
|
|
|
|
commonGridObj_module.getGridObj().attachEvent("onRowSelect", function(id,ind){
|
|
if(ind == 7){
|
|
var openSet = "height=400, width=500, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-400)/2 + ",Left= "+(screen.width-500)/2
|
|
var openType = "_blank";
|
|
|
|
var openUrl = "ModuleManagement.aspx?id="+id+"&handle=edit";
|
|
window.open (openUrl,openType,openSet);
|
|
}else{
|
|
//var rId = commonGridObj_module.getGridObj().getSelectedRowId();
|
|
var openSet = "height=300, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-710)/2 + ",Left= "+(screen.width-800)/2
|
|
var openType = "_blank";
|
|
|
|
var openUrl = "Edit.aspx?id="+id+"&handle=edit";
|
|
window.open (openUrl,openType,openSet);
|
|
}
|
|
});
|
|
|
|
commonGridObj_module.clickEvent = function(){
|
|
commonGridObj_module.getGridObj().attachEvent("onRowSelect", function(id,ind){
|
|
if(ind == 7){
|
|
var openSet = "height=400, width=500, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-400)/2 + ",Left= "+(screen.width-500)/2
|
|
var openType = "_blank";
|
|
|
|
var openUrl = "ModuleManagement.aspx?id="+id+"&handle=edit";
|
|
window.open (openUrl,openType,openSet);
|
|
}else if(ind > 0){
|
|
//var rId = commonGridObj_module.getGridObj().getSelectedRowId();
|
|
var openSet = "height=300, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-710)/2 + ",Left= "+(screen.width-800)/2
|
|
var openType = "_blank";
|
|
|
|
var openUrl = "Edit.aspx?id="+id+"&handle=edit";
|
|
window.open (openUrl,openType,openSet);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function addModule(){
|
|
|
|
var openSet = "height=300, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-300)/2 + ",Left= "+(screen.width-900)/2
|
|
var openType = "_blank";
|
|
|
|
var openUrl = "Edit.aspx?handle=add";
|
|
window.open (openUrl,openType,openSet);
|
|
}
|
|
|
|
function refreshModule(){
|
|
createGrid();
|
|
}
|
|
|
|
function checkAll(gridObj){
|
|
if(gridObj != null){//如果Grid对象存在,则进行全选操作
|
|
if(!gridObj.$("ck_all").checked){//如果全选按钮为选中,则自动将所有列表选择框置1
|
|
for(var i = 0;i<gridObj.getGridObj().getRowsNum();i++){
|
|
var rId = gridObj.getGridObj().getRowId(i);
|
|
gridObj.getGridObj().cellByIndex(i,0).setValue(0);
|
|
}
|
|
}else{//如果全选按钮为选中,则自动将所有列表选择框置0
|
|
for(var i = 0;i<gridObj.getGridObj().getRowsNum();i++){
|
|
var rId = gridObj.getGridObj().getRowId(i);
|
|
gridObj.getGridObj().cellByIndex(i,0).setValue(1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//根据条件查询付费申请信息
|
|
function search(){
|
|
|
|
var _name = $("txt_name").value.trim();
|
|
var _url = $("txt_url").value.trim();
|
|
var _parent = $("txt_parent").value.trim();
|
|
|
|
var searchJson = "";
|
|
//begin
|
|
searchJson +="{";
|
|
searchJson += "[";
|
|
|
|
if(_name != "" || _url != "" || _parent != ""){
|
|
searchJson += "\"name\":\""+_name+"\","
|
|
searchJson += "\"url\":\""+_url+"\","
|
|
searchJson += "\"parent\":\""+_parent+"\""
|
|
}else{
|
|
searchJson += "\"name\":\""+_name+"\","
|
|
searchJson += "\"url\":\""+_url+"\","
|
|
searchJson += "\"parent\":\""+_parent+"\""
|
|
}
|
|
searchJson += "]";
|
|
searchJson +="}";//alert(searchJson);
|
|
|
|
commonGridObj_module.initGrid();
|
|
commonGridObj_module.setRequest("ModuleGridSource.aspx?handle=list&show_page=15&cur_page=1&search="+escape(searchJson)+"&uid="+commonGridObj_module.newGuid());
|
|
commonGridObj_module.bind();
|
|
commonGridObj_module.setSearch(searchJson);
|
|
|
|
commonGridObj_module.initPageByHandle("list");
|
|
|
|
commonGridObj_module.getGridObj().attachEvent("onRowSelect", function(id,ind){
|
|
if(ind == 7){
|
|
var openSet = "height=400, width=500, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-400)/2 + ",Left= "+(screen.width-500)/2
|
|
var openType = "_blank";
|
|
|
|
var openUrl = "ModuleManagement.aspx?id="+id+"&handle=edit";
|
|
window.open (openUrl,openType,openSet);
|
|
}else{
|
|
//var rId = commonGridObj_module.getGridObj().getSelectedRowId();
|
|
var openSet = "height=300, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-710)/2 + ",Left= "+(screen.width-800)/2
|
|
var openType = "_blank";
|
|
|
|
var openUrl = "Edit.aspx?id="+id+"&handle=edit";
|
|
window.open (openUrl,openType,openSet);
|
|
}
|
|
});
|
|
|
|
commonGridObj_module.clickEvent = function(){
|
|
commonGridObj_module.getGridObj().attachEvent("onRowSelect", function(id,ind){
|
|
if(ind == 7){
|
|
var openSet = "height=400, width=500, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-400)/2 + ",Left= "+(screen.width-500)/2
|
|
var openType = "_blank";
|
|
|
|
var openUrl = "ModuleManagement.aspx?id="+id+"&handle=edit";
|
|
window.open (openUrl,openType,openSet);
|
|
}else{
|
|
//var rId = commonGridObj_module.getGridObj().getSelectedRowId();
|
|
var openSet = "height=300, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=1,location=no, status=no,Top= " +(screen.height-710)/2 + ",Left= "+(screen.width-800)/2
|
|
var openType = "_blank";
|
|
|
|
var openUrl = "Edit.aspx?id="+id+"&handle=edit";
|
|
window.open (openUrl,openType,openSet);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function deleteModule(){
|
|
var iDeleteCount = 0;
|
|
var iSuccCount = 0;
|
|
var iFalseCount = 0;
|
|
var isExistAction = 0;
|
|
var delArg = new Array();
|
|
var actionArg = new Array();
|
|
|
|
if(commonGridObj_module != null){
|
|
for(var i = 0;i<commonGridObj_module.getGridObj().getRowsNum();i++){
|
|
var ckbox = commonGridObj_module.getGridObj().cellByIndex(i,0).getValue();
|
|
var rowId = commonGridObj_module.getGridObj().getRowId(i);
|
|
if(ckbox == 1){
|
|
var urlVal = "ModuleGridSource.aspx?handle=validusermod&id="+rowId+"&val="+commonGridObj_module.newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
if(loadVal > 0){
|
|
actionArg.push(rowId);
|
|
}else{
|
|
delArg.push(rowId);
|
|
}
|
|
iDeleteCount++;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(iDeleteCount > 0){
|
|
if(actionArg.length > 0){
|
|
if(window.confirm("模块信息已经指定给客户,删除后被指定客户将不能使用此模块,您确定是否继续删除")){
|
|
for(var j=0;j<actionArg.length;j++){
|
|
var urlVal = "ModuleGridSource.aspx?handle=delete&id="+actionArg[j]+"&val="+commonGridObj_module.newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
if(loadVal > 0){
|
|
iSuccCount++;
|
|
}else{
|
|
iFalseCount++;
|
|
}
|
|
}
|
|
}
|
|
for(var k=0;k<delArg.length;k++){
|
|
var urlVal = "ModuleGridSource.aspx?handle=delete&id="+delArg[k]+"&val="+commonGridObj_module.newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
if(loadVal > 0){
|
|
iSuccCount++;
|
|
}else{
|
|
iFalseCount++;
|
|
}
|
|
}
|
|
}else{
|
|
for(var k=0;k<delArg.length;k++){
|
|
var urlVal = "ModuleGridSource.aspx?handle=delete&id="+delArg[k]+"&val="+commonGridObj_module.newGuid();
|
|
var loader = dhtmlxAjax.getSync(urlVal);
|
|
var loadVal = loader.xmlDoc.responseText;
|
|
|
|
if(loadVal > 0){
|
|
iSuccCount++;
|
|
}else{
|
|
iFalseCount++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if(iDeleteCount > 0){
|
|
alert("删除模块 共 "+iDeleteCount+" 条 删除成功 "+iSuccCount+" 条 删除失败 "+iFalseCount+" 条");
|
|
createGrid();
|
|
}
|
|
}
|
|
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
|
|
|
|
//初始化界面
|
|
function initGrid(){
|
|
$("txt_name").value = "";
|
|
$("txt_url").value = "";
|
|
$("txt_parent").value = "";
|
|
createGrid();
|
|
}
|
|
|
|
function finishLoading(){
|
|
$("progressBar").style.display = "none";
|
|
}
|
|
|
|
function initLoading(){
|
|
$("progressBar").style.display = "";
|
|
}
|