var comboCARRIER;//船公司 var comboPODLOAD;//启运港 var comboPORTDISCHARGE;//卸货港交货地 var comboDESTINATION;//目的港 var comboLANE; //航线 var clientAjaxRequestUrl = "../.."; //var clientAjaxRequestUrl = "http://localhost:12646"; //var clientAjaxRequestUrl = "http://hmw028167.chinaw3.com"; //两端去空格函数 String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); } function $(id) { return document.getElementById(id); } function initcomboCARRIER(){ //船公司 comboCARRIER = dhtmlXComboFromSelect("sel_carrier"); comboCARRIER.loadXML(clientAjaxRequestUrl+"/FeeCodes/CrmPriceCarrierAdapter.aspx?mask=0&pos=0&yunjia=webcrmclientadapter&type=FCL&companyid="+$("hdCompanyid").value); } function initcomboCARRIER2(){ //船公司 comboCARRIER.setOptionWidth(200); comboCARRIER.attachEvent("onChange", function(){comboCARRIER.setComboText($("hd_comboCARRIER").value);}); comboCARRIER.attachEvent("onBlur", function(){ var s1 = comboCARRIER.getComboText(); var s2 = s1.indexOf("|"); if(s1=="") { $("hd_comboCARRIER").value=""; comboCARRIER.setComboText($("hd_comboCARRIER").value); } else { if(s2>0) { s2=s2+2; } var s3 = s1.substring(s2); if(s2>0) { comboCARRIER.setComboText(s3); $("hd_comboCARRIER").value=s3; } else { comboCARRIER.setComboText($("hd_comboCARRIER").value); } } }); comboCARRIER.setComboText($("hd_comboCARRIER").value); comboCARRIER.attachEvent("onKeyPressed", function(keyCode) { if(keyCode!="8") { var arrayArg = new Array(); setTimeout(function(){ var is = -1; var ishd = $("hd_comboCARRIER").value; var filterCount = 0; if("" != comboCARRIER.getComboText()){ while("undefined" != typeof comboCARRIER.getOptionByIndex(filterCount)){ var comboValue = comboCARRIER.getOptionByIndex(filterCount).text.toUpperCase();//.value; var enterValue = comboCARRIER.getComboText().toUpperCase(); $("hd_comboCARRIER").value = comboCARRIER.getComboText().toUpperCase(); if(comboValue.indexOf(enterValue) == 0){ comboCARRIER.selectOption(filterCount,true,true); is=filterCount; break; } ++filterCount; } if(is==-1) { $("hd_comboCARRIER").value = ishd; alert("无此内容,请重新选择!"); } }},10);}}); comboCARRIER.attachEvent("onSelectionChange", function() { $("hd_comboCARRIER").value = comboCARRIER.getComboText(); }); } function initComboPODLOAD()//启运港==装货港 { comboPODLOAD = dhtmlXComboFromSelect("sel_portload"); comboPODLOAD.loadXML(clientAjaxRequestUrl+"/FeeCodes/CrmPriceCarrierAdapter.aspx?mask=0&pos=0&yunjia=tcodeloadportadapter&type=FCL&companyid="+$("hdCompanyid").value); } function initComboPODLOAD2()//启运港==装货港 { comboPODLOAD.setOptionWidth(200); comboPODLOAD.attachEvent("onChange", function() { comboPODLOAD.setComboText($("hd_comboPODLOAD").value); }); comboPODLOAD.attachEvent("onBlur", function() { var s1 = comboPODLOAD.getComboText(); if(s1=="") { $("hd_comboPODLOAD").value=""; comboPODLOAD.setComboText($("hd_comboPODLOAD").value); } }); comboPODLOAD.setComboText($("hd_comboPODLOAD").value); comboPODLOAD.attachEvent("onKeyPressed", function(keyCode) { if(keyCode!="8") { var arrayArg = new Array(); setTimeout(function() { var filterCount = 0; var is = -1; var ishd = $("hd_comboPODLOAD").value; if("" != comboPODLOAD.getComboText()) { while("undefined" != typeof comboPODLOAD.getOptionByIndex(filterCount)) { var comboValue = comboPODLOAD.getOptionByIndex(filterCount).text.toUpperCase();//.value; var enterValue = comboPODLOAD.getComboText().toUpperCase(); $("hd_comboPODLOAD").value = comboPODLOAD.getComboText().toUpperCase(); if(comboValue.indexOf(enterValue) == 0) { comboPODLOAD.selectOption(filterCount,true,true); is=filterCount; break; } ++filterCount; } if(is==-1) { $("hd_comboPODLOAD").value = ishd; alert("无此内容,请重新选择!"); } } },10); } }); comboPODLOAD.attachEvent("onSelectionChange", function() { $("hd_comboPODLOAD").value = comboPODLOAD.getComboText(); }); } function initComboPORTDISCHARGE()//卸货港 { comboPORTDISCHARGE = dhtmlXComboFromSelect("sel_discharge"); comboPORTDISCHARGE.loadXML(clientAjaxRequestUrl+"/FeeCodes/CrmPriceCarrierAdapter.aspx?mask=0&pos=0&yunjia=tcodedisportadapter&type=FCL&companyid="+$("hdCompanyid").value); } function initComboPORTDISCHARGE2()//卸货港 { comboPORTDISCHARGE.setOptionWidth(200); comboPORTDISCHARGE.attachEvent("onChange", function() { comboPORTDISCHARGE.setComboText($("hd_comboPORTDISCHARGE").value); }); comboPORTDISCHARGE.attachEvent("onBlur", function() { comboPORTDISCHARGE.setComboText($("hd_comboPORTDISCHARGE").value); }); comboPORTDISCHARGE.setComboText($("hd_comboPORTDISCHARGE").value); comboPORTDISCHARGE.attachEvent("onKeyPressed", function(keyCode) { if(keyCode!="8") { var arrayArg = new Array(); setTimeout(function() { var filterCount = 0; var is = -1; var ishd = $("hd_comboPORTDISCHARGE").value; if("" != comboPORTDISCHARGE.getComboText()) { while("undefined" != typeof comboPORTDISCHARGE.getOptionByIndex(filterCount)) { var comboValue = comboPORTDISCHARGE.getOptionByIndex(filterCount).text.toUpperCase();//.value; var enterValue = comboPORTDISCHARGE.getComboText().toUpperCase(); $("hd_comboPORTDISCHARGE").value = comboPORTDISCHARGE.getComboText().toUpperCase(); if(comboValue.indexOf(enterValue) == 0) { comboPORTDISCHARGE.selectOption(filterCount,true,true); is=filterCount; break; } ++filterCount; } if(is==-1) { $("hd_comboPORTDISCHARGE").value = ishd; alert("无此内容,请重新选择!"); } } },10); } }); comboPORTDISCHARGE.attachEvent("onSelectionChange", function() { $("hd_comboPORTDISCHARGE").value = comboPORTDISCHARGE.getComboText(); }); } function initcomboDESTINATION()//目的港 { comboDESTINATION = dhtmlXComboFromSelect("sel_destination"); comboDESTINATION.loadXML(clientAjaxRequestUrl+"/FeeCodes/CrmPriceCarrierAdapter.aspx?mask=0&pos=0&yunjia=destination&type=FCL&companyid="+$("hdCompanyid").value); } function initcomboDESTINATION2()//目的港 { comboDESTINATION.setOptionWidth(200); comboDESTINATION.attachEvent("onChange", function() { comboDESTINATION.setComboText($("hd_comboDESTINATION").value); }); comboDESTINATION.attachEvent("onBlur", function() { comboDESTINATION.setComboText($("hd_comboDESTINATION").value); }); comboDESTINATION.setComboText($("hd_comboDESTINATION").value); comboDESTINATION.attachEvent("onKeyPressed", function(keyCode) { if(keyCode!="8") { var arrayArg = new Array(); setTimeout(function() { var filterCount = 0; var is = -1; var ishd = $("hd_comboDESTINATION").value; if("" != comboDESTINATION.getComboText()) { while("undefined" != typeof comboDESTINATION.getOptionByIndex(filterCount)) { var comboValue = comboDESTINATION.getOptionByIndex(filterCount).text.toUpperCase();//.value; var enterValue = comboDESTINATION.getComboText().toUpperCase(); $("hd_comboDESTINATION").value = comboDESTINATION.getComboText().toUpperCase(); if(comboValue.indexOf(enterValue) == 0) { comboDESTINATION.selectOption(filterCount,true,true); is=filterCount; break; } ++filterCount; } if(is==-1) { $("hd_comboDESTINATION").value = ishd; alert("无此内容,请重新选择!"); } } },10); } }); comboDESTINATION.attachEvent("onSelectionChange", function() { $("hd_comboDESTINATION").value = comboDESTINATION.getComboText(); }); } function initComboLANE()//航线 { comboLANE = dhtmlXComboFromSelect("sel_lane"); comboLANE.loadXML(clientAjaxRequestUrl+"/FeeCodes/CrmPriceCarrierAdapter.aspx?mask=0&pos=0&yunjia=tcodelanesadapter&type=FCL&companyid="+$("hdCompanyid").value); } function initComboLANE2()//航线 { comboLANE.setOptionWidth(200); comboLANE.attachEvent("onChange", function() { comboLANE.setComboText($("hd_comboLANE").value); }); comboLANE.attachEvent("onBlur", function(){ var s1 = comboLANE.getComboText(); var s2 = s1.indexOf("|"); if(s1=="") { $("hd_comboLANE").value=""; comboLANE.setComboText($("hd_comboLANE").value); } else { if(s2>0) { s2=s2+2; } var s3 = s1.substring(s2); if(s2>0) { comboLANE.setComboText(s3); $("hd_comboLANE").value=s3; } else { comboLANE.setComboText($("hd_comboLANE").value); } } }); comboLANE.setComboText($("hd_comboLANE").value); comboLANE.attachEvent("onKeyPressed", function(keyCode) { if(keyCode!="8") { var arrayArg = new Array(); setTimeout(function() { var filterCount = 0; var is = -1; var ishd = $("hd_comboLANE").value; if("" != comboLANE.getComboText()) { while("undefined" != typeof comboLANE.getOptionByIndex(filterCount)) { var comboValue = comboLANE.getOptionByIndex(filterCount).text.toUpperCase();//.value; var enterValue = comboLANE.getComboText().toUpperCase(); $("hd_comboLANE").value = comboLANE.getComboText().toUpperCase(); if(comboValue.indexOf(enterValue) == 0) { comboLANE.selectOption(filterCount,true,true); is=filterCount; break; } ++filterCount; } if(is==-1) { $("hd_comboLANE").value = ishd; alert("无此内容,请重新选择!"); } } },10);}}); comboLANE.attachEvent("onSelectionChange", function() { $("hd_comboLANE").value = comboLANE.getComboText(); }); } function initCombos() { //alert(" 1 "); getlbGG(); // initcomboCARRIER();//船公司 initcomboCARRIER2();//船公司 initComboPODLOAD();//启运港 initComboPODLOAD2();//启运港 initComboPORTDISCHARGE();//卸货港交货地 initComboPORTDISCHARGE2();//卸货港交货地 initcomboDESTINATION();//目的港 initcomboDESTINATION2();//目的港 initComboLANE();//航线 initComboLANE2();//航线 } //------------------------------------------------------------------------------------------------------------------------------- function getlbGG() { var uid = $("hid_id").value; if(uid=="") { document.getElementById('lbGG').style.visibility = "hidden"; document.getElementById('divGG').style.visibility = "hidden"; //document.getElementById('lbGG').setAttribute('disabled','disabled'); //document.getElementById('divGG').setAttribute('disabled','disabled'); } else { var url3 = clientAjaxRequestUrl+"/Message/SysAnnounceClientGridSource.aspx?handle=getlbgg&uid="+newGuid()+"&clientgid="+uid; var loader3 = dhtmlxAjax.getSync(url3); var strAnnounce = loader3.xmlDoc.responseText; //strAnnounce=strAnnounce.replace("/公告/ig","我的信息"); strAnnounce=strAnnounce.substr(2); $("lbGG").value+=strAnnounce; // url3 = clientAjaxRequestUrl+"/Message/SysAnnounceClientGridSource.aspx?handle=getconfig&uid="+newGuid()+"&clientgid="+uid; loader3 = dhtmlxAjax.getSync(url3); strAnnounce = loader3.xmlDoc.responseText; $("hdtimeCount").value=strAnnounce; // recycleCountAnnounceEB($("hdtimeCount").value); } } function ShowDetailGG() { var uid = $("hid_id").value; //如果已打开 var url2 = clientAjaxRequestUrl+"/Message/SysAnnounceClientGridSource.aspx?handle=isclose&uid="+newGuid()+"&clientgid="+uid; var loader2 = dhtmlxAjax.getSync(url2); var strISDELETE = loader2.xmlDoc.responseText; // window.open(clientAjaxRequestUrl+"/Message/SysAnnounceClient.aspx?clientgid="+uid,"_blank","height=500, width=900, center:yes,help:no,toolbar=no,menubar=no,scrollbars=no,resizable=0,location=no,status=no"); } function newGuid() { 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(); } function recycleCountAnnounceEB(timeCountEB) { var uid = $("hid_id").value; var startTimesEB = new Date(); var isShowEB = 0; setInterval(function() { //var frameObjEB = null; //frameObjEB = parent.document.getElementById("FormEBPL").contentWindow; //frameObjEB = document.getElementById("FormEBPL").contentWindow; if(document.getElementById("scrAnnounceEB") == null) { var urlEB0 = "js/popAnnounceEB.js?uid="+newGuid(); var loaderEB0 = dhtmlxAjax.getSync(urlEB0); var jsValEB0 = loaderEB0.xmlDoc.responseText; var oHeadEB = document.getElementsByTagName('HEAD').item(0); var oScriptEB = document.createElement( "script" ); oScriptEB.language = "javascript"; oScriptEB.type = "text/javascript"; oScriptEB.id = "scrAnnounceEB"; oScriptEB.defer = true; oScriptEB.text = jsValEB0; oHeadEB.appendChild(oScriptEB); } var AnnounceCountObjEB = null; var urlEB = clientAjaxRequestUrl+"/Message/SysAnnounceClientGridSource.aspx?handle=getannouncetotal&uid="+newGuid()+"&clientgid="+uid; var loaderEB = dhtmlxAjax.getSync(urlEB); var AnnounceValEB = loaderEB.xmlDoc.responseText; if(AnnounceValEB != "") { AnnounceCountObjEB = eval('(' + AnnounceValEB + ')'); if(AnnounceCountObjEB!=null) { var msgIntervalEB = 3;//AnnounceCountObjEB.totals[0].interval; if(isShowEB==0) { msgIntervalEB = 0; } // if(AnnounceCountObjEB.totals[0].total != 0) { //var oldUrlEB = parent.document.getElementById("FormEBPL").contentWindow.location.href; var oldUrlEB =window.location.href; var doubleUrlEB = 0; if(oldUrlEB.indexOf("//") >= 0) { doubleUrlEB = oldUrlEB.indexOf("//")+2; } var tempUrlEB = oldUrlEB.substring(doubleUrlEB,oldUrlEB.substring(doubleUrlEB,oldUrlEB.length).indexOf("/")+doubleUrlEB); //var newUrlEB = oldUrlEB.substring(0,doubleUrlEB)+tempUrlEB+"/"+"Message/SysAnnounceClient.aspx"; var newUrlEB = clientAjaxRequestUrl+"/Message/SysAnnounceClient.aspx"; //alert(newUrlEB); //$("dvAnnounce").innerText = "公告("+AnnounceCountObjEB.totals[0].total+")"; var currentTimesEB = new Date(); var spaceTimesEB = currentTimesEB.getTime() - startTimesEB.getTime(); var daysEB = Math.floor(spaceTimesEB/(24*3600*1000)); //计算小时 var leaveEB1 = spaceTimesEB%(24*3600*1000); var hoursEB= Math.floor(leaveEB1/(3600*1000)); //计算分钟 var leaveEB2= leaveEB1%(3600*1000); var minutesEB=Math.floor(leaveEB2/(60*1000)); //计算秒数 var leaveEB3=leaveEB2%(60*1000); var secondsEB=Math.round(leaveEB3/1000); //alert(minutesEB+"+"+msgIntervalEB) if(msgIntervalEB > 0) { if(minutesEB >= msgIntervalEB) { startTimesEB = new Date(); isShowEB=1; openPopEB("公告("+AnnounceCountObjEB.totals[0].total+")",AnnounceCountObjEB,AnnounceCountObjEB.totals[0].total,newUrlEB); } } else { isShowEB=1; openPopEB("公告("+AnnounceCountObjEB.totals[0].total+")",AnnounceCountObjEB,AnnounceCountObjEB.totals[0].total,newUrlEB); } } else { //$("dvAnnounce").innerText = "公告("+AnnounceCountObjEB.totals[0].total+")"; } } } },timeCountEB); }