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.

185 lines
7.2 KiB
JavaScript

12 months ago
var commonGridObj_feetemplate;
var pressRecord;
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");
//column align
var colAlignArgs_feetemplate = new Array("center","center","center","center","center","center");
//column sort
var colSortArgs_feetemplate = new Array("na","str","str","str","str","str");
//column type
var colTypeArgs_feetemplate = new Array("ch","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("../SeaiFee/WmsRateGridSource.aspx");
commonGridObj_feetemplate.setRequest("../SeaiFee/WmsRateGridSource.aspx?handle=getratelist&show_page=15&cur_page=1&custid="+$("h_custid").value);
commonGridObj_feetemplate.setSourceType("json");
commonGridObj_feetemplate.setSkin("xp");
commonGridObj_feetemplate.setImageUrl("../images/");
commonGridObj_feetemplate.initGrid();
commonGridObj_feetemplate.bind();
commonGridObj_feetemplate.initPageByGID("getratelist");//
commonGridObj_feetemplate.isClickEventEvent = true;
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 searchJson = SearchJson(id);
var openUrl = "../SeaiFee/WmsRateEdit.aspx?handle=edit&search="+escape(searchJson);
window.open (openUrl,openType,openSet);
});
commonGridObj_feetemplate.getGridObj().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 searchJson = SearchJson(id);
var openUrl = "../SeaiFee/WmsRateEdit.aspx?handle=edit&search="+escape(searchJson);
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 CusJson() //添加费率条件
{
var cusid = $("h_custid").value;
var cusname = $("h_cusname").value;
var searchJson = "";
searchJson +="{";
searchJson += "[";
searchJson += "\"cusid\":\""+cusid+"\",";
searchJson += "\"cus\":\""+cusname+"\"";
searchJson += "]";
searchJson +="}";
return searchJson;
}
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 cusjson = CusJson();
var openUrl = "../SeaiFee/WmsRateEdit.aspx?handle=add&cusjoin="+escape(cusjson);
window.open (openUrl,openType,openSet);
}
function refreshList(){
createGrid();
}
function deleteTemplate(){
var iCount = 0;
var iDelCount = 0;
var iFailure = 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 searchJson = SearchJsonRow(i);
var url = "../SeaiFee/WmsRateGridSource.aspx?handle=deleterate&search="+escape(searchJson);
var loader = dhtmlxAjax.getSync(url);
var deleteState = parseInt(loader.xmlDoc.responseText);
if(deleteState == 1){
iDelCount++;
}
else
{
iFailure++;
}
iCount++;
}
}
if (iCount>0){
alert("提交仓储费率删除 "+iCount+" 条 成功 "+iDelCount+" 条 失败 "+iFailure+" 条");
}
}
}
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);
}
}
}
function SearchJson(id) {//编辑费率条件
var rowIndex = commonGridObj_feetemplate.getGridObj().getRowIndex(id);
var customer=commonGridObj_feetemplate.getGridObj().cellByIndex(rowIndex,1).getValue().trim();
var no=commonGridObj_feetemplate.getGridObj().cellByIndex(rowIndex,2).getValue().trim();
var beginetd=commonGridObj_feetemplate.getGridObj().cellByIndex(rowIndex,3).getValue().trim();
var endetd=commonGridObj_feetemplate.getGridObj().cellByIndex(rowIndex,4).getValue().trim();
var goods=commonGridObj_feetemplate.getGridObj().cellByIndex(rowIndex,5).getValue().trim();
var cusid = $("h_custid").value;
var cusname = $("h_cusname").value;
var searchJson = "";
searchJson +="{";
searchJson += "[";
searchJson += "\"cusid\":\""+cusid+"\",";
searchJson += "\"cus\":\""+cusname+"\",";
searchJson += "\"no\":\""+no+"\",";
searchJson += "\"bt\":\""+beginetd+"\",";
searchJson += "\"et\":\""+endetd+"\",";
searchJson += "\"goods\":\""+goods+"\"";
searchJson += "]";
searchJson +="}";
return searchJson;
}
function SearchJsonRow(rowIndex) {//删除费率条件
var no=commonGridObj_feetemplate.getGridObj().cellByIndex(rowIndex,2).getValue().trim();
var goods=commonGridObj_feetemplate.getGridObj().cellByIndex(rowIndex,5).getValue().trim();
var cusid = $("h_custid").value;
var searchJson = "";
searchJson +="{";
searchJson += "[";
searchJson += "\"cusid\":\""+cusid+"\",";
searchJson += "\"no\":\""+no+"\",";
searchJson += "\"goods\":\""+goods+"\"";
searchJson += "]";
searchJson +="}";
return searchJson;
}