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

454 lines
17 KiB
JavaScript

//两端去空格函数
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); }
function $(id) {
return document.getElementById(id);
}
function nTabs(thisObj, Num) {
if (thisObj.className == "active") return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for (i = 0; i < tabList.length; i++) {
if (i == Num) {
thisObj.className = "active";
document.getElementById(tabObj + "_Content" + i).style.display = "block";
} else {
tabList[i].className = "normal";
document.getElementById(tabObj + "_Content" + i).style.display = "none";
}
}
}
//document.oncontextmenu=new Function("event.returnValue=false;"); //禁止右键功能,单击右键将无任何反应
//document.onselectstart=new Function("event.returnValue=false;"); //禁止先择,也就是无法复制
var comboSHORTNAME; //潜在客户
var comboCONTACTNAME; //潜在客户联系人
var comboSALE; //揽货人
//initComboSHORTNAME(); initComboCONTACTNAME(); initComboSALE();
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);
}
}
initComboCONTACTNAME3();
});
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 initComboCONTACTNAME()//潜在客户联系人
{
//生成
comboCONTACTNAME = dhtmlXComboFromSelect("ddlCONTACTNAME");
comboCONTACTNAME.loadXML("CRMClientVisitListGridSource.aspx?handle=getcontactname&clientname=" + escape($("hd_comboSHORTNAME").value));
}
function initComboCONTACTNAME3()//潜在客户联系人
{
comboCONTACTNAME.loadXML("CRMClientVisitListGridSource.aspx?handle=getcontactname&clientname=" + escape($("hd_comboSHORTNAME").value));
}
function initComboCONTACTNAME2()//潜在客户联系人
{
if ($("hdEnabled").value == "false") {
comboCONTACTNAME.disable(true);
}
//
comboCONTACTNAME.setOptionWidth(200);
comboCONTACTNAME.attachEvent("onChange", function() {
comboCONTACTNAME.setComboText($("hd_comboCONTACTNAME").value);
});
comboCONTACTNAME.attachEvent("onBlur", function() {
var s1 = comboCONTACTNAME.getComboText();
var s2 = s1.indexOf("|");
if (s1 == "") {
$("hd_comboCONTACTNAME").value = "";
comboCONTACTNAME.setComboText($("hd_comboCONTACTNAME").value);
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboCONTACTNAME.setComboText(s3);
$("hd_comboCONTACTNAME").value = s3;
}
else {
comboCONTACTNAME.setComboText($("hd_comboCONTACTNAME").value);
}
}
});
comboCONTACTNAME.setComboText($("hd_comboCONTACTNAME").value);
comboCONTACTNAME.attachEvent("onKeyPressed", function(keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function() {
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboCONTACTNAME").value;
if ("" != comboCONTACTNAME.getComboText()) {
while ("undefined" != typeof comboCONTACTNAME.getOptionByIndex(filterCount)) {
var comboValue = comboCONTACTNAME.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboCONTACTNAME.getComboText().toUpperCase();
$("hd_comboCONTACTNAME").value = comboCONTACTNAME.getComboText().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboCONTACTNAME.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("hd_comboCONTACTNAME").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
});
comboCONTACTNAME.attachEvent("onSelectionChange", function() {
$("hd_comboCONTACTNAME").value = comboCONTACTNAME.getComboText();
});
}
function initComboSALE()//揽货人
{
//生成
comboSALE = dhtmlXComboFromSelect("ddlSALE");
comboSALE.loadXML("CRMClientAssignListGridSource.aspx?handle=issaleman");
}
function initComboSALE2()//揽货人
{
if ($("hdEnabled").value == "false") {
comboSALE.disable(true);
}
//
comboSALE.setOptionWidth(200);
comboSALE.attachEvent("onChange", function() {
comboSALE.setComboText($("hd_comboSALE").value);
});
comboSALE.attachEvent("onBlur", function() {
var s1 = comboSALE.getComboText();
var s2 = s1.indexOf("|");
if (s1 == "") {
$("hd_comboSALE").value = "";
comboSALE.setComboText($("hd_comboSALE").value);
}
else {
if (s2 > 0) {
s2 = s2 + 2;
}
var s3 = s1.substring(s2);
if (s2 > 0) {
comboSALE.setComboText(s3);
$("hd_comboSALE").value = s3;
}
else {
comboSALE.setComboText($("hd_comboSALE").value);
}
}
});
comboSALE.setComboText($("hd_comboSALE").value);
comboSALE.attachEvent("onKeyPressed", function(keyCode) {
if (keyCode != "8") {
var arrayArg = new Array();
setTimeout(function() {
var filterCount = 0;
var is = -1;
var ishd = $("hd_comboSALE").value;
if ("" != comboSALE.getComboText()) {
while ("undefined" != typeof comboSALE.getOptionByIndex(filterCount)) {
var comboValue = comboSALE.getOptionByIndex(filterCount).text.toUpperCase(); //.value;
var enterValue = comboSALE.getComboText().toUpperCase();
$("hd_comboSALE").value = comboSALE.getComboText().toUpperCase();
if (comboValue.indexOf(enterValue) == 0) {
comboSALE.selectOption(filterCount, true, true);
is = filterCount;
break;
}
++filterCount;
}
if (is == -1) {
$("hd_comboSALE").value = ishd;
alert("无此内容,请重新选择!");
}
}
}, 10);
}
});
comboSALE.attachEvent("onSelectionChange", function() {
$("hd_comboSALE").value = comboSALE.getComboText();
});
}
function printAction() {
var strBSNO = "";
strBSNO = $("hdGid").value;
var printUrl = "";
var companyID = "";
var typeName = "SEAOP";
var dbSourceID = "";
var userID = "";
var url = "../Reports/ReportService.aspx?handle=printwmsin&bsno=" + strBSNO + "&val=" + newGuid();
var loader = dhtmlxAjax.getSync(url);
var reportVal = loader.xmlDoc.responseText;
var reportObj = null;
if (reportVal != "") {
reportObj = eval('(' + reportVal + ')');
if (reportObj.reports.length > 0) {
if (reportObj.reports[0].compid != "") {
companyID = reportObj.reports[0].compid;
}
if (reportObj.reports[0].sourceid != "") {
dbSourceID = reportObj.reports[0].sourceid;
}
if (reportObj.reports[0].compid != "") {
userID = reportObj.reports[0].userid;
}
printUrl = "print://?comp=" + companyID + "&type=" + typeName + "&dbid=" + dbSourceID + "&uid=" + userID; //alert(printUrl);
window.location.href = window.location.href;
location.href = printUrl;
}
} else {
alert("没有要打印的报表");
return;
}
}
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 getonload() {
initComboSHORTNAME2();
initComboCONTACTNAME2();
initComboSALE2();
}
//回车键控制
document.onkeypress = function() {
if (event.keyCode == 13) {
if (event.srcElement.tagName == 'TEXTAREA') {
return true;
}
//window.event.keyCode=9;
return false;
}
}
function imgFreshChangePic() {
var pic1 = document.getElementById("imgFresh");
var start = pic1.src.lastIndexOf("/");
var str = pic1.src.substring(start + 1);
if (str == "btnFresh.gif") {
pic1.src = "../images/icons/progress.gif";
//pic1.alt="我是B图片";
}
else if (str == "progress.gif") {
pic1.src = "../images/icons/btnFresh.gif";
//pic1.alt="我是A图片";
}
}
function ShowDetailFresh() {
comboSHORTNAME.loadXML("CRMClientVisitListGridSource.aspx?handle=getshortname");
comboCONTACTNAME.loadXML("CRMClientVisitListGridSource.aspx?handle=getcontactname&clientname=" + escape(("hd_comboSHORTNAME").value));
comboSALE.loadXML("CRMClientAssignListGridSource.aspx?handle=issaleman");
}
function imgDelChangePic() {
var pic1 = document.getElementById("imgDel");
var start = pic1.src.lastIndexOf("/");
var str = pic1.src.substring(start + 1);
if (str == "remove.gif") {
pic1.src = "../images/delete.gif";
//pic1.alt="我是B图片";
}
else if (str == "delete.gif") {
pic1.src = "../images/icons/remove.gif";
//pic1.alt="我是A图片";
}
}
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 setFaq() {
var URLs = "../CRM/CRMInfoFaqInfo.aspx?handle=add&LINKID=" + escape($("hdLINKID").value);
ret = window.open(URLs, "_blank", "height=700px, width=800px,center:yes,help:no,toolbar=no,menubar=no,scrollbars=yes,resizable=1,location=no,status=no,Top= " + (screen.height / 2 - 400) + ",Left= " + (screen.width / 2 - 400)); //
}
function setQuotation() {
var URLs = "../CRM/CRMClientQuotationInfo.aspx?handle=add&clientgid=" + escape($("hdLINKID").value);
ret = window.open(URLs, "添加提单", "height=700px, width=820px, toolbar=no, menubar=no,scrollbars=no, resizable=0,location=no, status=no,Top= " + (screen.height - 700) / 2 + ",Left= " + (screen.width - 1024) / 2);
}
function setEnter() {
if ($("hd_comboSHORTNAME").value == "" || $("hd_comboSALE").value == "" || $("ddlVISITWAY").value == "" || $("tbVISITDATE").value == "" || $("tbVISITCONTENT").value == "" || $("ddlNEXTACTION").value == "" || $("tbNEXTDATE").value == "" || $("tbNEXTCONTENT").value == "" || $("hd_comboCONTACTNAME").value == "") {
alert("带“*”号的信息都不允许为空!");
return;
}
msgBox();
document.getElementById("btnEnter").click();
}