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.
D7QUANTAI/DSWeb/js/jsGridPreferencesSet.js

380 lines
14 KiB
JavaScript

//两端去空格函数
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); }
function $(id){
return document.getElementById(id);
}
var comboSubCompany;//公司
var comboPORTLOAD;//启运港
var comboBLFRT;//付费方式
var ComboSERVICE;//运输条款
var comboKGS;//运输条款
function initComboSubCompany()//公司
{
comboSubCompany = dhtmlXComboFromSelect("ddlSubCompany");
comboSubCompany.loadXML("../FeeCodes/CompanysAdapter.aspx?mask=0&pos=0&ISDISABLE=0&ISDELETED=0");
}
function initComboSubCompany2()//公司
{
comboSubCompany.attachEvent("onBlur", function(){
var s1 = comboSubCompany.getComboText().trim();
var s2 = s1.indexOf("|");
if(s1=="")
{
$("hd_comboSubCompany").value="";
comboSubCompany.setComboText($("hd_comboSubCompany").value);
}
else
{
if(s2>0)
{
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0)
{
comboSubCompany.setComboText(s3);
$("hd_comboSubCompany").value=s3;
}
else
{
comboSubCompany.setComboText($("hd_comboSubCompany").value);
}
}
});
comboSubCompany.setComboText($("hd_comboSubCompany").value);
comboSubCompany.attachEvent("onKeyPressed", function(keyCode)
{
if(keyCode!="8")
{
var arrayArg = new Array();
setTimeout(function()
{
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboSubCompany").value.trim();
if("" != comboSubCompany.getComboText().trim())
{
while("undefined" != typeof comboSubCompany.getOptionByIndex(filterCount))
{
var comboValue = comboSubCompany.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboSubCompany.getComboText().trim().toUpperCase();
$("hd_comboSubCompany").value = comboSubCompany.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0)
{
comboSubCompany.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1)
{
$("hd_comboSubCompany").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboSubCompany.attachEvent("onChange", function()
{
$("hd_comboSubCompanyID").value = comboSubCompany.getSelectedValue();
comboSubCompany.setComboText($("hd_comboSubCompany").value);
});
comboSubCompany.attachEvent("onSelectionChange", function () {
$("hd_comboSubCompany").value = comboSubCompany.getComboText().trim();
$("hd_comboSubCompanyID").value = comboSubCompany.getSelectedValue();
//
var s1 = comboSubCompany.getComboText().trim();
var s2 = s1.indexOf("|");
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
//comboSubCompany.setComboText(s3);
$("hd_comboSubCompany").value = s3;
}
//
var loader = dhtmlxAjax.getSync("../FeeCodes/SubCompSeaeDefAdapter.aspx?CORPID=" + $("hd_comboSubCompanyID").value + "&val=" + newGuid());
var stel = loader.xmlDoc.responseText;
if (stel != "") {
var items = new Array();
items = stel.split("&&"); //这里是以换行符作为分界
if (items != null && items.length > 0) {
$("hd_comboPORTLOAD").value = items[0].trim();
$("hd_comboBLFRT").value = items[1].trim();
$("hd_comboSERVICE").value = items[2].trim();
$("hd_kgs").value = items[3].trim();
$("cbISCGOL").checked = false;
if (items[4].trim() == 'True') {
$("cbISCGOL").checked = true;
}
$("cbISADVANCE").checked = false;
if (items[5].trim() == 'True') {
$("cbISADVANCE").checked = true;
}
}
else {
$("hd_comboPORTLOAD").value = "";
$("hd_comboBLFRT").value = "";
$("hd_comboSERVICE").value = "";
$("hd_kgs").value = "";
$("cbISCGOL").checked = false;
$("cbISADVANCE").checked = false;
}
}
else {
$("hd_comboPORTLOAD").value = "";
$("hd_comboBLFRT").value = "";
$("hd_comboSERVICE").value = "";
$("hd_kgs").value = "";
$("cbISCGOL").checked = false;
$("cbISADVANCE").checked = false;
}
initComboPORTLOAD2();
initComboBLFRT2();
initComboSERVICE2();
setValueComboKGS2();
});
}
function setValueComboKGS()
{
comboKGS = dhtmlXComboFromSelect("ddlKGS");
}
function setValueComboKGS2(val) {
comboKGS.setComboText($("hd_kgs").value);
comboKGS.attachEvent("onChange", function () {
$("hd_kgs").value = comboKGS.getComboText().trim();
});
comboKGS.attachEvent("onSelectionChange", function () {
$("hd_kgs").value = comboKGS.getComboText().trim();
});
}
function initComboPORTLOAD()//启运港==装货港
{
comboPORTLOAD = dhtmlXComboFromSelect("ddlPORTLOAD");
comboPORTLOAD.loadXML("../FeeCodes/TCodeLoadportAdapter.aspx?mask=0&pos=0");
}
function initComboPORTLOAD2()//启运港==装货港
{
comboPORTLOAD.attachEvent("onChange", function()
{
//$("hd_comboPORTLOADID").value = comboPORTLOAD.getSelectedValue();
//$("hd_comboPORTLOAD").value = comboPORTLOAD.getComboText().toUpperCase();
//$("tbISSUEPLACE").value = comboPORTLOAD.getComboText().toUpperCase();
comboPORTLOAD.setComboText($("hd_comboPORTLOAD").value);
});
comboPORTLOAD.attachEvent("onBlur", function()
{
var s1 = comboPORTLOAD.getComboText();
if(s1=="")
{
$("hd_comboPORTLOAD").value="";
}
comboPORTLOAD.setComboText($("hd_comboPORTLOAD").value);
});
comboPORTLOAD.setComboText($("hd_comboPORTLOAD").value);
comboPORTLOAD.attachEvent("onKeyPressed", function(keyCode)
{
if(keyCode!="8")
{
var arrayArg = new Array();
setTimeout(function()
{
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboPORTLOAD").value.trim();
if("" != comboPORTLOAD.getComboText().trim())
{
while("undefined" != typeof comboPORTLOAD.getOptionByIndex(filterCount))
{
var comboValue = comboPORTLOAD.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboPORTLOAD.getComboText().trim().toUpperCase();
$("hd_comboPORTLOAD").value = comboPORTLOAD.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0)
{
comboPORTLOAD.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1)
{
$("hd_comboPORTLOAD").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);
}
});
comboPORTLOAD.attachEvent("onSelectionChange", function()
{
$("hd_comboPORTLOAD").value = comboPORTLOAD.getComboText().trim();
$("hd_comboPORTLOADID").value = comboPORTLOAD.getSelectedValue();
});
}
function initComboBLFRT()//付费方式
{
comboBLFRT = dhtmlXComboFromSelect("ddlBLFRT");
comboBLFRT.loadXML("../FeeCodes/TCodeFrtAdapter.aspx?mask=0&pos=0");
}
function initComboBLFRT2()//付费方式
{
comboBLFRT.attachEvent("onChange", function()
{
comboBLFRT.setComboText($("hd_comboBLFRT").value);
});
comboBLFRT.attachEvent("onBlur", function(){
var s1 = comboBLFRT.getComboText().trim();
var s2 = s1.indexOf("|");
if(s1=="")
{
$("hd_comboBLFRT").value="";
comboBLFRT.setComboText($("hd_comboBLFRT").value);
}
else
{
if(s2>0)
{
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0)
{
comboBLFRT.setComboText(s3);
$("hd_comboBLFRT").value=s3;
}
else
{
comboBLFRT.setComboText($("hd_comboBLFRT").value);
}
}
});
comboBLFRT.setComboText($("hd_comboBLFRT").value);
comboBLFRT.attachEvent("onKeyPressed", function(keyCode)
{
if(keyCode!="8")
{
var arrayArg = new Array();
setTimeout(function()
{
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboBLFRT").value.trim();
if("" != comboBLFRT.getComboText().trim())
{
while("undefined" != typeof comboBLFRT.getOptionByIndex(filterCount))
{
var comboValue = comboBLFRT.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboBLFRT.getComboText().trim().toUpperCase();
$("hd_comboBLFRT").value = comboBLFRT.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0)
{
comboBLFRT.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1)
{
$("hd_comboBLFRT").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);}});
comboBLFRT.attachEvent("onSelectionChange", function()
{
$("hd_comboBLFRT").value = comboBLFRT.getComboText().trim();
});
}
function initComboSERVICE()//运输条款
{
comboSERVICE = dhtmlXComboFromSelect("ddlSERVICE");
comboSERVICE.loadXML("../FeeCodes/TCodeServiceAdapter.aspx?mask=0&pos=0");
}
function initComboSERVICE2()//运输条款
{
comboSERVICE.attachEvent("onChange", function()
{
comboSERVICE.setComboText($("hd_comboSERVICE").value);
});
comboSERVICE.attachEvent("onBlur", function(){
var s1 = comboSERVICE.getComboText().trim();
var s2 = s1.indexOf("|");
if(s1=="")
{
$("hd_comboSERVICE").value="";
comboSERVICE.setComboText($("hd_comboSERVICE").value);
}
else
{
if(s2>0)
{
s2=s2+2;
}
var s3 = s1.substring(s2);
if(s2>0)
{
comboSERVICE.setComboText(s3);
$("hd_comboSERVICE").value=s3;
}
else
{
comboSERVICE.setComboText($("hd_comboSERVICE").value);
}
}
});
comboSERVICE.setComboText($("hd_comboSERVICE").value);
comboSERVICE.attachEvent("onKeyPressed", function(keyCode)
{
if(keyCode!="8")
{
var arrayArg = new Array();
setTimeout(function()
{
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboSERVICE").value.trim();
if("" != comboSERVICE.getComboText().trim())
{
while("undefined" != typeof comboSERVICE.getOptionByIndex(filterCount))
{
var comboValue = comboSERVICE.getOptionByIndex(filterCount).text.toUpperCase();//.value;
var enterValue = comboSERVICE.getComboText().trim().toUpperCase();
$("hd_comboSERVICE").value = comboSERVICE.getComboText().trim().toUpperCase();
if(comboValue.indexOf(enterValue) == 0)
{
comboSERVICE.selectOption(filterCount,true,true);
is=filterCount;
break;
}
++filterCount;
}
if(is==-1)
{
$("hd_comboSERVICE").value = ishd;
alert("无此内容,请重新选择!");
}
}
},10);}});
comboSERVICE.attachEvent("onSelectionChange", function()
{
$("hd_comboSERVICE").value = comboSERVICE.getComboText().trim();
});
}
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();
}