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/jsGridCRMInfoFaqInfo.js

606 lines
26 KiB
JavaScript

//两端去空格函数
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); }
function $(id) {
return document.getElementById(id);
}
function initWinScreen() {
var winScreenHeight = 0;
var winScreenWidth = 0;
if (window.screen.height) {
winScreenHeight = window.screen.height;
}
if (window.screen.width) {
winScreenWidth = window.screen.width;
}
if (winScreenWidth >= 1440 && winScreenWidth >= 900) {
document.getElementById("Panel1").style.height = "400px";
}
else if (winScreenWidth >= 1366 && winScreenWidth >= 768) {
document.getElementById("Panel1").style.height = "310px";
}
else if (winScreenWidth >= 1024 && winScreenWidth >= 768) {
document.getElementById("Panel1").style.height = "270px";
}
}
//蒙板
function dialog()
{
this.width=450;
this.height=360;
this.title_height=20;
this.html='';
this.title='';
var self = this;
var bgObj,msgObj,titleObj;
this.close=function()
{
document.body.removeChild(document.getElementById("bgDiv"));
document.getElementById("msgDiv").removeChild(document.getElementById("msgTitle"));
document.body.removeChild(document.getElementById("msgDiv"));
}
this.show=function()
{
var msgw,msgh,bordercolor;
msgw=self.width;
msgh=self.height;
bordercolor="#336699";
titlecolor="#99CCFF";
var sWidth,sHeight;
sWidth=document.body.offsetWidth;
sHeight=screen.height;
bgObj=document.createElement("div");
bgObj.setAttribute('id','bgDiv');
bgObj.style.position="absolute";
bgObj.style.top="0";
bgObj.style.background="#777";
bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
bgObj.style.opacity="0.6";
bgObj.style.left="0";
bgObj.style.width=sWidth + "px";
bgObj.style.height=sHeight + "px";
bgObj.style.zIndex = "10000";
document.body.appendChild(bgObj);
msgObj=document.createElement("div")
msgObj.setAttribute("id","msgDiv");
msgObj.setAttribute("align","center");
msgObj.style.background="white";
msgObj.style.border="1px solid " + bordercolor;
msgObj.style.position = "absolute";
msgObj.style.left = "50%";
msgObj.style.top = "30%";
msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
msgObj.style.marginLeft = "-225px" ;
msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px";
msgObj.style.width = msgw + "px";
msgObj.style.height =msgh + "px";
msgObj.style.textAlign = "center";
msgObj.style.lineHeight ="25px";
msgObj.style.zIndex = "10001";
titleObj=document.createElement("h4");
titleObj.setAttribute("id","msgTitle");
titleObj.setAttribute("align","center");
titleObj.style.margin="0";
titleObj.style.padding="3px";
titleObj.style.background=bordercolor;
titleObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
titleObj.style.opacity="0.75";
titleObj.style.border="1px solid " + bordercolor;
titleObj.style.height=self.title_height+"px";
titleObj.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
titleObj.style.color="white";
titleObj.style.cursor="pointer";
titleObj.innerHTML=self.title;
//titleObj.onclick=function(){self.close();}
document.body.appendChild(msgObj);
document.getElementById("msgDiv").appendChild(titleObj);
var txt=document.createElement("div");
txt.style.margin="1em 0"
txt.setAttribute("id","msgTxt");
txt.innerHTML=self.html;
document.getElementById("msgDiv").appendChild(txt);
}
}
function msgBox()
{
var dg=new dialog();
dg.html="程序正在提交,请稍等!";
//dg.html+="<input type=button onclick='new dialog().close();' value='确定'>";
dg.width=200;
dg.height=100;
dg.title="标题";
dg.show();
}
function QueryString()
{
var name,value,i;//构造参数对象并初始化
var str=location.href;//获得浏览器地址栏URL串
var num=str.indexOf("?")
str=str.substr(num+1);//截取“?”后面的参数串
var arrtmp=str.split("&");//将各参数分离形成参数数组
for(i=0;i < arrtmp.length;i++)
{
num=arrtmp[i].indexOf("=");
if(num>0)
{
name=arrtmp[i].substring(0,num);//取得参数名称
value=arrtmp[i].substr(num+1);//取得参数值
this[name]=value;//定义对象属性并初始化
}
}
}
function ShowDetailUpdate()
{
var asid = mygrid_log.getSelectedRowId();
if(asid==null || asid=="")
{
alert("请先选择要操作的数据!");
}
else
{
var selectedId = mygrid_log.getSelectedRowId();
var qs = new QueryString();//调用:
//var URLs = "ExchangesUnitInfo.aspx?handle=edit&id="+selectedId;//+qs.id;
var URLs = "../shipping/ExchangesUnitEdit.aspx?handle=edit&id="+selectedId;
ret = window.open(URLs,"_blank", "height=600, width=1000,center:yes,help:no,toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=no");
}
}
function ShowDetailDel()
{
var asid = mygrid_log.getSelectedRowId();
if(asid==null || asid=="")
{
alert("请先选择要操作的数据!");
}
else
{
if(confirm('确定删除吗?'))
{
$("hid_id").value = mygrid_log.getSelectedRowId();
document.getElementById("btDel").click();
}
}
}
function ShowDetailFresh()
{
document.getElementById("ibFresh").click();
}
//回车键控制
document.onkeypress=function()
{
if(event.keyCode==13)
{
if(event.srcElement.tagName== 'TEXTAREA')
{
return true;
}
//window.event.keyCode=9;
return false;
}
}
//
function getIsNum(x) {
var str = x.value.trim();
if (str == "0") {
return;
}
else if (str == "") {
str = 0;
x.value = 0;
}
else {
var bl = IsNumFormat(str);
if (!bl) {
alert("数值格式错误!");
x.focus();
x.select();
}
}
}
function setOK() {
var loaderX = dhtmlxAjax.getSync("../CRM/CRMInfoFaqListGridSource.aspx?handle=setok&val=" + newGuid() + "&gids=" + $("hdGID").value);
var bl = loaderX.xmlDoc.responseText;
if (!bl) {
alert("操作出错!");
}
else {
document.getElementById('ibEnter').setAttribute('disabled', 'disabled');
document.getElementById('tbEnter').setAttribute('disabled', 'disabled');
document.getElementById('dlInfoShipper').setAttribute('disabled', 'disabled');
document.getElementById('Panel1').setAttribute('disabled', 'disabled');
document.getElementById('Panel2').setAttribute('disabled', 'disabled');
document.getElementById('Panel3').setAttribute('disabled', 'disabled');
document.getElementById('imgAdd').setAttribute('disabled', 'disabled');
document.getElementById('tbPROBLEMCONTENT').setAttribute('disabled', 'disabled');
document.getElementById('ibFresh').setAttribute('disabled', 'disabled');
window.opener.location.reload();
//document.getElementById('btLOCKFLAG1').removeAttribute('disabled');
}
}
//是否为数字2
function IsNum2(val) {
var re = /^[0-9]*[1-9][0-9]*$/;
if (!re.test(val)) {
return false;
} else {
return true;
}
}
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 IsNumFormat(val) {
var re = /^[-\+]?\d+(\.\d+)?$/;
if (!re.test(val)) {
return false;
}
else {
if (val.toString().indexOf(".") > 0) {
val.toString().replace("-", "");
val.toString().replace("+", "");
if (val.toString().substr(0, 1) == "0" && val.toString().substr(0, 2) != "0.") {
return false;
}
}
else {
var re1 = /^[-\+]+[1-9]+[0-9]*]*$/;
if (!re1.test(val)) {
re1 = /^[1-9]+[0-9]*]*$/;
if (!re1.test(val)) {
return false;
}
}
}
return true;
}
}
//
function getIsNum(x) {
var str = x.value.trim();
if (str == "0") {
return;
}
else if (str == "") {
str = 0;
x.value = 0;
}
else {
var bl = IsNumFormat(str);
if (!bl) {
alert("数值格式错误!");
x.focus();
x.select();
}
}
}
var comboSHORTNAME; //潜在客户
var comboPORTLOAD; //启运港
var comboPORTDISCHARGE; //卸货港交货地
var comboGOODSNAME; //货物描述类型
var comboFAQREPLYMAN; //
function initComboSHORTNAME()//潜在客户
{
comboSHORTNAME = dhtmlXComboFromSelect("ddlSHORTNAME");
comboSHORTNAME.loadXML("CRMClientVisitListGridSource.aspx?handle=getshortname");
}
function initComboSHORTNAME2()//潜在客户
{
if ($("hdEnabled").value == "false" || $("hdISLINKID").value == "1") {
comboSHORTNAME.disable(true);
}
//
comboSHORTNAME.setOptionWidth(200);
comboSHORTNAME.attachEvent("onChange", function() {
comboSHORTNAME.setComboText($("hd_comboSHORTNAME").value);
});
comboSHORTNAME.attachEvent("onBlur", function() {
var s1 = comboSHORTNAME.getComboText().trim();
var s2 = s1.indexOf("|");
if (s1 == "") {
$("hd_comboSHORTNAME").value = "";
comboSHORTNAME.setComboText($("hd_comboSHORTNAME").value);
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboSHORTNAME.setComboText(s3);
$("hd_comboSHORTNAME").value = s3;
}
else {
comboSHORTNAME.setComboText($("hd_comboSHORTNAME").value);
}
}
});
comboSHORTNAME.setComboText($("hd_comboSHORTNAME").value);
comboSHORTNAME.attachEvent("onKeyPressed", function(keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function() {
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboSHORTNAME").value.trim();
if ("" != comboSHORTNAME.getComboText().trim()) {
while ("undefined" != typeof comboSHORTNAME.getOptionByIndex(filterCount)) {
var comboValue = comboSHORTNAME.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboSHORTNAME.getComboText().trim().toUpperCase();
$("hd_comboSHORTNAME").value = comboSHORTNAME.getComboText().trim().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboSHORTNAME.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("hd_comboSHORTNAME").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
});
comboSHORTNAME.attachEvent("onSelectionChange", function() {
$("hd_comboSHORTNAME").value = comboSHORTNAME.getComboText().trim();
});
}
function initComboPORTLOAD()//启运港==装货港
{
comboPORTLOAD = dhtmlXComboFromSelect("ddlPORTLOAD");
comboPORTLOAD.loadXML("../FeeCodes/TCodeLoadportAdapter.aspx?mask=0&pos=0");
}
function initComboPORTLOAD2()//启运港==装货港
{
if ($("hdEnabled").value == "false") {
comboPORTLOAD.disable(true);
}
//
comboPORTLOAD.setOptionWidth(200);
comboPORTLOAD.attachEvent("onChange", function() {
comboPORTLOAD.setComboText($("hd_comboPORTLOAD").value);
});
comboPORTLOAD.attachEvent("onBlur", function() {
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();
});
}
function initComboPORTDISCHARGE()//卸货港
{
comboPORTDISCHARGE = dhtmlXComboFromSelect("ddlPORTDISCHARGE");
}
function initComboPORTDISCHARGE2()//卸货港
{
if ($("hdEnabled").value == "false") {
comboPORTDISCHARGE.disable(true);
}
//
comboPORTDISCHARGE.setOptionWidth(200);
comboPORTDISCHARGE.attachEvent("onOpen", function() {
if (comboPORTDISCHARGE.getOptionByIndex(0) == null) {
comboPORTDISCHARGE.loadXML("../FeeCodes/TCodeDisportAdapter.aspx?mask=0&pos=0&strSel=");
}
});
comboPORTDISCHARGE.attachEvent("onChange", function() {
$("hd_comboPORTDISCHARGE").value = comboPORTDISCHARGE.getComboText().trim().toUpperCase(); //comboPORTDISCHARGE.getSelectedText();
comboPORTDISCHARGE.setComboText($("hd_comboPORTDISCHARGE").value);
});
comboPORTDISCHARGE.attachEvent("onBlur", function() {
comboPORTDISCHARGE.setComboText($("hd_comboPORTDISCHARGE").value);
});
comboPORTDISCHARGE.setComboText($("hd_comboPORTDISCHARGE").value);
//检索
//comboPORTDISCHARGE.enableFilteringMode(true);
comboPORTDISCHARGE.attachEvent("onKeyPressed", function(keyCode) {
var arrayArg = new Array();
setTimeout(function() {
var filterCount = 0;
if ("" != comboPORTDISCHARGE.getComboText().trim()) {
var enterValue = comboPORTDISCHARGE.getComboText().toUpperCase();
comboPORTDISCHARGE.loadXML("../FeeCodes/TCodeDisportAdapter.aspx?mask=0&pos=0&strSel=" + enterValue);
}
}, 10);
});
comboPORTDISCHARGE.attachEvent("onSelectionChange", function() {
$("hd_comboPORTDISCHARGE").value = comboPORTDISCHARGE.getComboText().trim();
});
}
function initComboFAQREPLYMAN()//揽货人
{
//生成
comboFAQREPLYMAN = dhtmlXComboFromSelect("ddlFAQREPLYMAN");
comboFAQREPLYMAN.loadXML("CRMInfoFaqListGridSource.aspx?handle=getfaqreplyman");
}
function initComboFAQREPLYMAN2()//揽货人
{
if ($("hdEnabled").value == "false") {
comboFAQREPLYMAN.disable(true);
}
//
comboFAQREPLYMAN.setOptionWidth(200);
comboFAQREPLYMAN.attachEvent("onChange", function () {
comboFAQREPLYMAN.setComboText($("hd_comboFAQREPLYMAN").value);
});
comboFAQREPLYMAN.attachEvent("onBlur", function () {
var s1 = comboFAQREPLYMAN.getComboText();
var s2 = s1.indexOf("|");
if (s1 == "") {
$("hd_comboFAQREPLYMAN").value = "";
comboFAQREPLYMAN.setComboText($("hd_comboFAQREPLYMAN").value);
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboFAQREPLYMAN.setComboText(s3);
$("hd_comboFAQREPLYMAN").value = s3;
}
else {
comboFAQREPLYMAN.setComboText($("hd_comboFAQREPLYMAN").value);
}
}
});
comboFAQREPLYMAN.setComboText($("hd_comboFAQREPLYMAN").value);
comboFAQREPLYMAN.attachEvent("onKeyPressed", function (keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function () {
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboFAQREPLYMAN").value;
if ("" != comboFAQREPLYMAN.getComboText()) {
while ("undefined" != typeof comboFAQREPLYMAN.getOptionByIndex(filterCount)) {
var comboValue = comboFAQREPLYMAN.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboFAQREPLYMAN.getComboText().toUpperCase();
$("hd_comboFAQREPLYMAN").value = comboFAQREPLYMAN.getComboText().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboFAQREPLYMAN.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("hd_comboFAQREPLYMAN").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
});
comboFAQREPLYMAN.attachEvent("onSelectionChange", function () {
$("hd_comboFAQREPLYMAN").value = comboFAQREPLYMAN.getComboText();
});
}
//
function getonload() {
initComboSHORTNAME2();
initComboPORTLOAD2();
initComboPORTDISCHARGE2();
initComboFAQREPLYMAN2();
}
//
function getonload2() {
initComboSHORTNAME();
initComboPORTLOAD();
initComboPORTDISCHARGE();
initComboFAQREPLYMAN();
}
//
function copyToClipBoard() {
var loaderX = dhtmlxAjax.getSync("../CRM/CRMInfoFaqListGridSource.aspx?handle=copyto&val=" + newGuid() + "&gids=" + $("hdGID").value);
var s = loaderX.xmlDoc.responseText;
////复制到剪切板js代码
////alert(s);
// if (window.clipboardData) {
window.clipboardData.setData("Text", s);
//alert("已经复制到剪切板!"+ "\n" + s);
// } else if (navigator.userAgent.indexOf("Opera") != -1) {
// window.location = s;
// } else if (window.netscape) {
// try {
// netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
// } catch (e) {
// alert("被浏览器拒绝!\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");
// }
// var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
// if (!clip)
// return;
// var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
// if (!trans)
// return;
// trans.addDataFlavor('text/unicode');
// var str = new Object();
// var len = new Object();
// var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
// var copytext = s;
// str.data = copytext;
// trans.setTransferData("text/unicode", str, copytext.length * 2);
// var clipid = Components.interfaces.nsIClipboard;
// if (!clip)
// return false;
// clip.setData(trans, null, clipid.kGlobalClipboard);
// //alert("已经复制到剪切板!" + "\n" + s)
// }
}
//回车键控制
document.onkeypress = function() {
if (event.keyCode == 13) {
if (event.srcElement.tagName == 'TEXTAREA') {
return true;
}
//window.event.keyCode=9;
return false;
}
}
function setEnter() {
if ($("tbPROBLEMCONTENT").value == "") {
alert("内容不允许为空!");
return;
}
if ($("hd_comboFAQREPLYMAN").value == "") {
alert("询价人不允许为空!");
return;
}
msgBox();
document.getElementById("btnEnter").click();
}