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.

114 lines
4.8 KiB
JavaScript

10 months ago
var commonGridObj_feetemplate;
function $(id){
return document.getElementById(id);
}
function createGrid(){
//header
var headerArgs_feetemplate = new Array("<input type=\"checkbox\" id=\"ck_all\" onclick=\"checkall()\" />","业务种类","费用类型","模板系统名称","模板中文名称","创建人","创建时间","备注");
//width
var widthArgs_feetemplate = new Array("40","100","80","120","120","120","120","120");
//column align
var colAlignArgs_feetemplate = new Array("center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_feetemplate = new Array("na","str","str","str","str","str","str","str");
//column type
var colTypeArgs_feetemplate = new Array("ch","ro","ro","ro","ro","ro","ro","ro");
commonGridObj_feetemplate = new TGridCommon("mygrid_container_feetemplate","form1",headerArgs_feetemplate,widthArgs_feetemplate,colAlignArgs_feetemplate,colSortArgs_feetemplate,colTypeArgs_feetemplate);
commonGridObj_feetemplate.setResponseUrl("FeeTemplateGridSource.aspx");
commonGridObj_feetemplate.setRequest("FeeTemplateGridSource.aspx?handle=templatelist&show_page=15&cur_page=1&uid="+commonGridObj_feetemplate.newGuid());
commonGridObj_feetemplate.setSourceType("json");
commonGridObj_feetemplate.setSkin("xp");
commonGridObj_feetemplate.setImageUrl("../images/");
commonGridObj_feetemplate.initGrid();
commonGridObj_feetemplate.bind();
commonGridObj_feetemplate.initPageByGID("templatelist");
commonGridObj_feetemplate.getGridObj().attachEvent("onRowSelect", function(id,ind){
var openSet = "height=490, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-490)/2 + ",Left= "+(screen.width-800)/2
var openType = "_blank";
var openUrl = "FeeTemplateSetEdit.aspx?handle=edit&id="+id;
window.open (openUrl,openType,openSet);
});
commonGridObj_feetemplate.clickEvent = function(){
commonGridObj_feetemplate.getGridObj().attachEvent("onRowSelect", function(id,ind){
var openSet = "height=490, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-490)/2 + ",Left= "+(screen.width-800)/2
var openType = "_blank";
var openUrl = "FeeTemplateSetEdit.aspx?handle=edit&id="+id;
window.open (openUrl,openType,openSet);
});
}
commonGridObj_feetemplate.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){ if(stage == 0){ if(cInd != 0){ return false; }else{ return true; } } });
}
function addFeeTemplate(){
var openSet = "height=490, width=800, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-490)/2 + ",Left= "+(screen.width-800)/2
var openType = "_blank";
var openUrl = "FeeTemplateSetEdit.aspx?handle=add";
window.open (openUrl,openType,openSet);
}
function refreshList(){
createGrid();
}
function deleteTemplate(){
var iCount = 0;
var iDelCount = 0;
if(commonGridObj_feetemplate != null){
if(window.confirm("您确定要将选中的费用模板删除")){
for(var i=0;i<commonGridObj_feetemplate.getGridObj().getRowsNum();i++){
var gID = commonGridObj_feetemplate.getGridObj().getRowId(i);
var rowIndex = commonGridObj_feetemplate.getGridObj().getRowIndex(gID);
var isCheckState = commonGridObj_feetemplate.getGridObj().cellByIndex(rowIndex,0).getValue();
if(isCheckState == 1){
var url = "FeeTemplateGridSource.aspx?handle=deletetemplate&id="+gID+"&uid="+commonGridObj_feetemplate.newGuid();
var loader = dhtmlxAjax.getSync(url);
var deleteState = parseInt(loader.xmlDoc.responseText);
if(deleteState == 1){
iDelCount++;
}
iCount++;
}
}
}
}
createGrid();
}
//全选框
function checkall(){
var checkStatus = $("ck_all").checked;
if(checkStatus == 1){
var iCount = commonGridObj_feetemplate.getGridObj().getRowsNum();
for(var i=0;i < iCount;i++){
commonGridObj_feetemplate.getGridObj().cellByIndex(i,0).setValue(1);
}
}else{
var iCount = commonGridObj_feetemplate.getGridObj().getRowsNum();
for(var i=0;i < iCount;i++){
commonGridObj_feetemplate.getGridObj().cellByIndex(i,0).setValue(0);
}
}
}