DS7/DSWeb/PriceSearch/js/searchComboLC.js

320 lines
11 KiB
JavaScript

var comboCARRIER;//船公司
var comboLANE;//航线
var clientAjaxRequestUrl = "../..";
//var clientAjaxRequestUrl = "http://localhost:12646";
//var clientAjaxRequestUrl = "http://hmw028167.chinaw3.com";
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=LC&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 initComboLANE()//航线
{
comboLANE = dhtmlXComboFromSelect("sel_lane");
comboLANE.loadXML(clientAjaxRequestUrl+"/FeeCodes/CrmPriceCarrierAdapter.aspx?mask=0&pos=0&yunjia=tcodelanesadapter&type=LC&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()
{
getlbGG();
//
initcomboCARRIER();//船公司
initcomboCARRIER2();//船公司
}
//-------------------------------------------------------------------------------------------------------------------------------
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 loaderEB = dhtmlxAjax.getSync(urlEB0);
var jsValEB = loaderEB.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 = jsValEB;
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);
}