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.

362 lines
15 KiB
JavaScript

11 months ago
var commonGridObj_feetemplate;
var commonGridObj_fee;
function $(id){
return document.getElementById(id);
}
function createTemplateGrid(){
//header
var headerArgs_feetemplate = new Array("","业务种类","费用类型","模板系统名称","模板中文名称","创建人","创建时间","备注");
//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("../ParameterSet/CodeFeeTemplateSetGridSource.aspx");
var type = parseInt($("h_type").value);
commonGridObj_feetemplate.setRequest("../ParameterSet/CodeFeeTemplateSetGridSource.aspx?handle=poptemplate&show_page=15&cur_page=1&type=" + type + "&hid_sel=" + escape($("hid_sel").value) + "&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("poptemplate","&type="+type+"&hid_sel=" + escape($("hid_sel").value));
commonGridObj_feetemplate.getGridObj().attachEvent("onRowSelect", function(id,ind){
$("h_templateid").value = id;
createFeeGrid();
});
commonGridObj_feetemplate.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){
$("h_templateid").value = rId;
var cacheName = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}else{
$("h_cachename").value = commonGridObj_feetemplate.newGuid();
cacheName = "&cachename="+$("h_cachename").value.trim();
}
var orderRowIndex = commonGridObj_feetemplate.getGridObj().getRowIndex(rId);
var checkBox = commonGridObj_feetemplate.getGridObj().cellByIndex(orderRowIndex,0).getValue();
var url = "";
var parentObj = window.parent.opener.location;//alert(parentObj);
var oldUrl = parentObj.href;
if(checkBox == 1){//模板选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "../ParameterSet/CodeFeeTemplateSetGridSource.aspx?handle=checktemplate&op=check&id="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_feetemplate.newGuid()+cacheName;
}else{
url = "../ParameterSet/CodeFeeTemplateSetGridSource.aspx?handle=checktemplate&op=check&id="+rId+"&val="+commonGridObj_feetemplate.newGuid()+cacheName;
}
}else{//模板取消选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "../ParameterSet/CodeFeeTemplateSetGridSource.aspx?handle=checktemplate&op=uncheck&id="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_feetemplate.newGuid()+cacheName;
}else{
url = "../ParameterSet/CodeFeeTemplateSetGridSource.aspx?handle=checktemplate&op=uncheck&id="+rId+"&val="+commonGridObj_feetemplate.newGuid()+cacheName;
}
}
var loader = dhtmlxAjax.getSync(url);
var cacheTotal = "";
var cacheTotalObj = null;
var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
var cacheState = parseInt(cacheVal);
createFeeGrid();
});
commonGridObj_feetemplate.clickEvent = function(){
commonGridObj_feetemplate.getGridObj().attachEvent("onRowSelect", function(id,ind){
$("h_templateid").value = id;
createFeeGrid();
});
}
}
function createFeeGrid(){
//header
var headerArgs_fee = new Array("","费用名称","结算对象类型","客户名称","标准","单价","币别","汇率","备注");
//width
var widthArgs_fee= new Array("40","150","100","100","50","120","50","120","120");
//column align
var colAlignArgs_fee = new Array("center","center","center","center","center","center","center","center","center");
//column sort
var colSortArgs_fee = new Array("na","str","str","str","str","str","str","str","str");
//column type
var colTypeArgs_fee = new Array("ch","co","co","co","co","ed","co","co","txt");
commonGridObj_fee = new TGridCommon("mygrid_container_fee","form1",headerArgs_fee,widthArgs_fee,colAlignArgs_fee,colSortArgs_fee,colTypeArgs_fee);
commonGridObj_fee.setResponseUrl("../ParameterSet/CodeFeeTemplateSetGridSource.aspx");
var templateID = $("h_templateid").value;
var cacheName = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}else{
$("h_cachename").value = commonGridObj_feetemplate.newGuid();
cacheName = "&cachename="+$("h_cachename").value.trim();
}
commonGridObj_fee.setRequest("../ParameterSet/CodeFeeTemplateSetGridSource.aspx?handle=popfee&id="+templateID+"&uid="+commonGridObj_fee.newGuid()+cacheName);
commonGridObj_fee.setSourceType("json");
commonGridObj_fee.setSkin("xp");
commonGridObj_fee.setImageUrl("../images/");
commonGridObj_fee.initGrid();
commonGridObj_fee.loadafter = true;
commonGridObj_fee.after = function(){
finishLoading();
};
commonGridObj_fee.bind();
commonGridObj_fee.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){
if(stage == 0){
if(cInd == 0){
return true;
}else{
return false;
}
}
});
commonGridObj_fee.getGridObj().attachEvent("onCheckbox", function(rId,cInd,state){
var cacheName = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}else{
$("h_cachename").value = commonGridObj_fee.newGuid();
cacheName = "&cachename="+$("h_cachename").value.trim();
}
var orderRowIndex = commonGridObj_fee.getGridObj().getRowIndex(rId);
var checkBox = commonGridObj_fee.getGridObj().cellByIndex(orderRowIndex,0).getValue();
var url = "";
var parentObj = window.parent.opener.location;//alert(parentObj);
var oldUrl = parentObj.href;
if(checkBox == 1){//模板选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "../ParameterSet/CodeFeeTemplateSetGridSource.aspx?handle=checkfee&op=check&detailid="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_fee.newGuid()+cacheName;
}else{
url = "../ParameterSet/CodeFeeTemplateSetGridSource.aspx?handle=checkfee&op=check&detailid="+rId+"&val="+commonGridObj_fee.newGuid()+cacheName;
}
}else{//模板取消选中状态
if(oldUrl.indexOf("&cachename") > 0){
oldCacheName = oldUrl.substring(oldUrl.indexOf("&cachename=")+11,oldUrl.indexOf("&type"));
url = "../ParameterSet/CodeFeeTemplateSetGridSource.aspx?handle=checkfee&op=uncheck&detailid="+rId+"&oldcache="+oldCacheName+"&val="+commonGridObj_fee.newGuid()+cacheName;
}else{
url = "../ParameterSet/CodeFeeTemplateSetGridSource.aspx?handle=checkfee&op=uncheck&detailid="+rId+"&val="+commonGridObj_fee.newGuid()+cacheName;
}
}
var loader = dhtmlxAjax.getSync(url);
var cacheTotal = "";
var cacheTotalObj = null;
var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
var cacheState = parseInt(cacheVal);
//createFeeGrid();
});
}
function importFee(){
initLoading();
var url = "";
var oldCacheName = "";
var cacheName = "";
var newUrl = "";
if($("h_cachename").value.trim() != ""){
cacheName = "&cachename="+$("h_cachename").value.trim();
}else{
$("h_cachename").value = commonGridObj_feetemplate.newGuid();
cacheName = "&cachename="+$("h_cachename").value.trim();
}
var type = parseInt($("h_type").value);
var parentObj = window.parent.opener.location;//alert(parentObj);
var oldUrl = parentObj.href;
if(oldUrl.indexOf("&cachename") > 0){
newUrl = oldUrl.substring(0,oldUrl.indexOf("&cachename"))+cacheName+"&type="+type + "&hid_sel=" + escape($("hid_sel").value);
oldCacheName = newUrl.substring(newUrl.indexOf("&cachename=")+11,newUrl.indexOf("&type"));
url = "../ParameterSet/CodeFeeTemplateSetGridSource.aspx?handle=importfee"+cacheName+"&oldcache="+oldCacheName+"&uid="+commonGridObj_feetemplate.newGuid();
}else{
newUrl = oldUrl+cacheName+"&type="+type + "&hid_sel=" + escape($("hid_sel").value);
url = "../ParameterSet/CodeFeeTemplateSetGridSource.aspx?handle=importfee"+cacheName+"&uid="+commonGridObj_feetemplate.newGuid();
}
var loader = dhtmlxAjax.getSync(url);
var cacheTotal = "";
var cacheTotalObj = null;
var cacheVal = loader.xmlDoc.responseText;//alert(opInfo);
var cacheState = parseInt(cacheVal);
if(cacheState == 1){
window.parent.opener.location.href = window.parent.opener.location.href;
parentObj.href = newUrl;
finishLoading();
window.close();
}
}
function cancelImport(){
window.close();
}
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }
function initLoading(){
$("progressBar").style.display = "";
}
function finishLoading(){
$("progressBar").style.display = "none";
}
function ShowDetailFresh() {
var dg = new dialog();
dg.html = "程序正在执行,请稍等!";
//dg.html+="<input type=button onclick='new dialog().close();' value='确定'>";
dg.width = 200;
dg.height = 100;
dg.title = "标题";
dg.show();
//
setTimeout(function () {
$("hid_sel").value = " and 1=1";
//业务类型
if ($("ddlBSTYPE").value.trim() != "") {
if ($("ddlBSTYPE").value.trim() != "all") {
$("hid_sel").value += " and OPTYPE=" + $("ddlBSTYPE").value.trim();
}
}
//收付类型
// if ($("h_type").value.trim() != "") {
// $("hid_sel").value += " and FEETYPE=" + $("h_type").value.trim();
// }
//系统名称
if ($("tbNAME").value.trim() != "") {
$("hid_sel").value += " and ([NAME] like '%" + $("tbNAME").value.trim() + "%' or DESCRIPTION like '%" + $("tbNAME").value.trim() + "%')";
}
//
createTemplateGrid();
dg.close();
}, 2000);
}
//
function initSearch() {
$("ddlBSTYPE").value = "all";//业务类型
$("tbNAME").value = "";//系统名称
$("hid_sel").value = " and 1<0";
}
function dialog() {
this.width = 450;
this.height = 360;
this.title_height = 20;
this.html = '';
this.title = '';
var self = this;
var bgObj, msgObj, titleObj;
this.close = function () {
document.body.removeChild(document.getElementById("bgDiv"));
document.getElementById("msgDiv").removeChild(document.getElementById("msgTitle"));
document.body.removeChild(document.getElementById("msgDiv"));
}
this.show = function () {
var msgw, msgh, bordercolor;
msgw = self.width;
msgh = self.height;
bordercolor = "#336699";
titlecolor = "#99CCFF";
var sWidth, sHeight;
sWidth = document.body.offsetWidth;
sHeight = screen.height;
bgObj = document.createElement("div");
bgObj.setAttribute('id', 'bgDiv');
bgObj.style.position = "absolute";
bgObj.style.top = "0";
bgObj.style.background = "#777";
bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
bgObj.style.opacity = "0.6";
bgObj.style.left = "0";
bgObj.style.width = sWidth + "px";
bgObj.style.height = sHeight + "px";
bgObj.style.zIndex = "10000";
document.body.appendChild(bgObj);
msgObj = document.createElement("div")
msgObj.setAttribute("id", "msgDiv");
msgObj.setAttribute("align", "center");
msgObj.style.background = "white";
msgObj.style.border = "1px solid " + bordercolor;
msgObj.style.position = "absolute";
msgObj.style.left = "50%";
msgObj.style.top = "30%";
msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
msgObj.style.marginLeft = "-225px";
msgObj.style.marginTop = -75 + document.documentElement.scrollTop + "px";
msgObj.style.width = msgw + "px";
msgObj.style.height = msgh + "px";
msgObj.style.textAlign = "center";
msgObj.style.lineHeight = "25px";
msgObj.style.zIndex = "10001";
titleObj = document.createElement("h4");
titleObj.setAttribute("id", "msgTitle");
titleObj.setAttribute("align", "center");
titleObj.style.margin = "0";
titleObj.style.padding = "3px";
titleObj.style.background = bordercolor;
titleObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
titleObj.style.opacity = "0.75";
titleObj.style.border = "1px solid " + bordercolor;
titleObj.style.height = self.title_height + "px";
titleObj.style.font = "12px Verdana, Geneva, Arial, Helvetica, sans-serif";
titleObj.style.color = "white";
titleObj.style.cursor = "pointer";
titleObj.innerHTML = self.title;
//titleObj.onclick=function(){self.close();}
document.body.appendChild(msgObj);
document.getElementById("msgDiv").appendChild(titleObj);
var txt = document.createElement("div");
txt.style.margin = "1em 0"
txt.setAttribute("id", "msgTxt");
txt.innerHTML = self.html;
document.getElementById("msgDiv").appendChild(txt);
}
}
function msgBox() {
var dg = new dialog();
dg.html = "程序正在提交,请稍等!";
//dg.html+="<input type=button onclick='new dialog().close();' value='确定'>";
dg.width = 200;
dg.height = 100;
dg.title = "标题";
dg.show();
}