var commonGridObj_multiple; var comboCustomer;//委托单位 var comboVessel;//船名 var comboVoyno;//航次 function $(id){ return document.getElementById(id); } function createGrid(){ //header var headerArgs_invoice = new Array("","B/L NO.","委托人","承运人","箱数","交货地","业务员","","","申请时间","开出人","开出时间"); //width var widthArgs_invoice = new Array("40","150","120","120","150","150","70","70","70","150","100","150"); //column align var colAlignArgs_invoice = new Array("center","center","center","center","center","center","center","center","center","center","center","center"); //column sort var colSortArgs_invoice = new Array("na","str","str","str","str","str","str","str","str","str","str","str"); //column type var colTypeArgs_invoice = new Array("ch","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro","ro"); commonGridObj_multiple = new TGridCommon("mygrid_container_feesearch","form1",headerArgs_invoice,widthArgs_invoice,colAlignArgs_invoice,colSortArgs_invoice,colTypeArgs_invoice); commonGridObj_multiple.setResponseUrl("InvoiceApplicationGridSource.aspx"); commonGridObj_multiple.setRequest("InvoiceApplicationGridSource.aspx?handle=makeoutapp"); commonGridObj_multiple.setSourceType("json"); commonGridObj_multiple.setSkin("xp"); commonGridObj_multiple.setImageUrl("../images/"); commonGridObj_multiple.initGrid(); commonGridObj_multiple.bind(); // commonGridObj_invoice.getGridObj().attachEvent("onEditCell",function(stage,rId,cInd,nValue,oValue){ // if(stage == 0){ // return false; // } // }); // commonGridObj_invoice.getGridObj().attachEvent("onRowDblClicked", function(rId,cInd){ // var rId = commonGridObj_invoice.getGridObj().getSelectedRowId(); // var openSet = "height=270, width=500, 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?flowid="+rId+"&handle=edit"; // window.open (openUrl,openType,openSet); // }); } function initCombos(){ createComboVessel();//船名 createComboVoyno();//航次 //createComboCustomer();//结算单位 } function createComboCustomer(){//委托单位 comboCustomer = dhtmlXComboFromSelect("sel_customer"); comboCustomer.loadXML("../FeeCodes/WebCrmClientAdapter.aspx?mask=0&pos=0"); comboCustomer.attachEvent("onChange", function(){ comboCustomer.setComboText($("h_customer").value); }); comboCustomer.attachEvent("onBlur", function(){ var s1 = comboCustomer.getComboText().trim(); var s2 = s1.indexOf("|"); if(s2>0){ s2=s2+2; } var s3 = s1.substring(s2); if(s2>0){ comboCustomer.setComboText(s3); $("h_customer").value=s3; } else { comboCustomer.setComboText($("h_customer").value); } }); comboCustomer.setComboText($("h_customer").value); comboCustomer.attachEvent("onKeyPressed", function(keyCode){ if(keyCode!="8"){ var arrayArg = new Array(); setTimeout(function(){ var filterCount = 0; var is = -1; var ishd = $("h_customer").value.trim(); if("" != comboCustomer.getComboText().trim()){ while("undefined" != typeof comboCustomer.getOptionByIndex(filterCount)){ var comboValue = comboCustomer.getOptionByIndex(filterCount).text.toUpperCase();//.value; var enterValue = comboCustomer.getComboText().trim().toUpperCase(); $("h_customer").value = comboCustomer.getComboText().trim().toUpperCase(); if(comboValue.indexOf(enterValue) == 0){ comboCustomer.selectOption(filterCount,true,true); is=filterCount; break; } ++filterCount; } if(is==-1){ $("h_customer").value = ishd; alert("无此内容,请重新选择!"); } } },10); } }); comboCustomer.attachEvent("onSelectionChange", function(){ $("h_customer").value = comboCustomer.getComboText().trim(); }); } function createComboVessel(){ comboVessel = dhtmlXComboFromSelect("sel_vessel"); comboVessel.loadXML("../FeeCodes/TCodeVesselAdapter.aspx?mask=0&pos=0&uid="+newGuid()); var _vessel = $("h_vessel").value; comboVoyno = dhtmlXComboFromSelect("sel_voyno"); if(_vessel != ""){ comboVoyno.loadXML("../FeeCodes/TCodeVoynoAdapter.aspx?mask=0&pos=0&strVESSEL="+_vessel+"&uid="+newGuid()); } comboVessel.setComboText($("h_vessel").value); comboVessel.attachEvent("onKeyPressed", function(keyCode){ if(keyCode!="8"){ var arrayArg = new Array(); setTimeout(function(){ var filterCount = 0; if("" != comboVessel.getComboText().trim()){ while("undefined" != typeof comboVessel.getOptionByIndex(filterCount)){ var comboValue = comboVessel.getOptionByIndex(filterCount).text.toUpperCase();//.value; var enterValue = comboVessel.getComboText().toUpperCase(); $("h_vessel").value = comboVessel.getComboText().toUpperCase(); if(comboValue.indexOf(enterValue) == 0){ comboVessel.selectOption(filterCount,true,true); $("h_vessel").value = comboVessel.getComboText().trim(); break; } ++filterCount; } } },10); } }); comboVessel.attachEvent("onBlur", function(){ $("h_vessel").value = comboVessel.getComboText().trim(); $("h_voyno").value = ""; createComboVoyno(); }); comboVessel.attachEvent("onChange", function(){ comboVessel.setComboText($("h_vessel").value); }); comboVessel.attachEvent("onSelectionChange", function(){ $("h_vessel").value = comboVessel.getComboText().trim(); }); } function createComboVoyno(){ var _vessel; try { _vessel = comboVessel.getSelectedValue().trim();//$("hd_comboVESSEL").value; } catch(e) { _vessel=""; } if(_vessel != ""){ comboVoyno.loadXML("../FeeCodes/TCodeVoynoAdapter.aspx?mask=0&pos=0&strVESSEL="+_vessel); comboVoyno.setComboText($("h_voyno").value); } comboVoyno.attachEvent("onChange", function(){ comboVoyno.setComboText($("h_voyno").value); }); comboVoyno.attachEvent("onKeyPressed", function(keyCode){ if(keyCode!="8"){ var arrayArg = new Array(); setTimeout(function(){ var filterCount = 0; if("" != comboVoyno.getComboText().trim()){ while("undefined" != typeof comboVoyno.getOptionByIndex(filterCount)){ var comboValue = comboVoyno.getOptionByIndex(filterCount).text.toUpperCase();//.value; var enterValue = comboVoyno.getComboText().trim().toUpperCase(); $("h_voyno").value = comboVoyno.getComboText().trim().toUpperCase(); if(comboValue.indexOf(enterValue) == 0){ comboVoyno.selectOption(filterCount,true,true); break; } ++filterCount; } } },10); } }); comboVoyno.attachEvent("onSelectionChange", function(){ $("h_voyno").value = comboVoyno.getComboText().trim(); }); } //Get Guid var 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(); };