var winPro_def = function () {
|
this.openFullwin = function (url, title, scrollbars, h, w) {
|
openFullwin(url, title, scrollbars, h, w);
|
}
|
function openFullwin(url, title, scrollbars, h, w) {
|
var height = (h == null || h == "") ? (window.screen.availHeight - 30) : h;
|
var width = (w == null || w == "") ? (window.screen.availWidth - 10) : w;
|
|
var top = (window.screen.availHeight - height) / 2 - 50;
|
if (top < 0) top = 0;
|
var left = (window.screen.availWidth - width) / 2 - 8;
|
|
if (left < 0) left = 0;
|
|
if (scrollbars == "" || scrollbars == undefined || scrollbars == null) scrollbars = "auto";
|
var newwin = window.open(url, title, 'height=' + height + ', width=' + width + ',top=' + top + ',left=' + left + ', toolbar=no, menubar=no, scrollbars=' + scrollbars + ', resizable=no,location=no, status=no');
|
//newwin.focus();
|
|
return false;
|
}
|
|
//隐藏当前域的信息
|
function ShowOrHideList(imgBase, tabBase) {
|
var strSrc = document.getElementById(imgBase).src;
|
var struTemp = strSrc.split('/');
|
var imgName = struTemp[struTemp.length - 1];
|
if (imgName == "zoom_minus_icon.gif") {
|
document.getElementById(imgBase).src = strSrc.substring(0, strSrc.length - imgName.length) + "zoom_plus_icon.gif";
|
document.getElementById(tabBase).style.display = "none";
|
}
|
else {
|
document.getElementById(imgBase).src = strSrc.substring(0, strSrc.length - imgName.length) + "zoom_minus_icon.gif";
|
document.getElementById(tabBase).style.display = "block";
|
}
|
|
try {
|
SetHeight();
|
}
|
catch (e)
|
{ }
|
}
|
|
//控制多个相同面板的显示、隐藏【2013-09-14 WQH update】
|
function showorhide(objFid, Name) {
|
//获取浏览器版本
|
var browser = GetBrowser();
|
var browserList = GetBrowserList();
|
|
//如果传入Name 名称,则将其它名称为Name的先隐藏
|
var imgBase, tabBase, imgName, strSrc, struTemp;
|
if (Name != undefined && Name != "") {
|
var objFieds = null;
|
if (browser == "firefox") {
|
objFieds = document.getElementsByName(Name);
|
}
|
else {
|
objFieds = document.all(Name);
|
}
|
for (var i = 0; i < objFieds.length; i++) {
|
//判断是否火狐、谷歌、IE9、IE10浏览器。IE11
|
if (browserList[0] == "msie 10.0;" || browserList[0] == "msie 9.0;" || browser == "ie11") {
|
if (objFid.uniqueID != objFieds[i].childNodes[1].childNodes[0].uniqueID) {
|
imgBase = objFieds[i].childNodes[1].childNodes[1].childNodes[1];
|
tabBase = objFieds[i].childNodes[1].nextSibling.nextSibling;
|
strSrc = imgBase.src;
|
struTemp = strSrc.split('/');
|
imgName = struTemp[struTemp.length - 1];
|
imgBase.src = strSrc.substring(0, strSrc.length - imgName.length) + "zoom_plus_icon.gif";
|
tabBase.style.display = "none";
|
}
|
}
|
else if (browser == "firefox" || browser == "chrome") {
|
if (objFid.id != objFieds[i].children[0].children[0].id) {
|
imgBase = objFieds[i].children[0].children[0].children[0];
|
tabBase = objFieds[i].children[0].nextSibling.nextSibling;
|
strSrc = imgBase.src;
|
struTemp = strSrc.split('/');
|
imgName = struTemp[struTemp.length - 1];
|
imgBase.src = strSrc.substring(0, strSrc.length - imgName.length) + "zoom_plus_icon.gif";
|
tabBase.style.display = "none";
|
}
|
}
|
else {//其他浏览器
|
if (objFid.uniqueID != objFieds[i].childNodes[0].childNodes[0].uniqueID) {
|
imgBase = objFieds[i].childNodes[0].childNodes[0].childNodes[1];
|
tabBase = objFieds[i].childNodes[0].nextSibling;
|
strSrc = imgBase.src;
|
struTemp = strSrc.split('/');
|
imgName = struTemp[struTemp.length - 1];
|
imgBase.src = strSrc.substring(0, strSrc.length - imgName.length) + "zoom_plus_icon.gif";
|
tabBase.style.display = "none";
|
}
|
}
|
}
|
}
|
|
//判断是否火狐、谷歌、IE9、IE10浏览器。
|
if (browser == "firefox" || browser == "chrome" || browserList[0] == "msie 10.0;" || browserList[0] == "msie 9.0;" || browser == "ie11") {
|
imgBase = objFid.parentElement.childNodes[1].childNodes[1];
|
tabBase = objFid.parentElement.nextSibling.nextSibling;
|
}
|
else {//其他浏览器
|
imgBase = objFid.parentElement.childNodes[0].childNodes[1];
|
tabBase = objFid.parentElement.nextSibling;
|
}
|
|
strSrc = imgBase.src;
|
struTemp = strSrc.split('/');
|
imgName = struTemp[struTemp.length - 1];
|
if (imgName == "zoom_minus_icon.gif") {
|
imgBase.src = strSrc.substring(0, strSrc.length - imgName.length) + "zoom_plus_icon.gif";
|
tabBase.style.display = "none";
|
}
|
else {
|
imgBase.src = strSrc.substring(0, strSrc.length - imgName.length) + "zoom_minus_icon.gif";
|
tabBase.style.display = "block";
|
}
|
}
|
|
function ShowMyProgress(url, title) {
|
if (title == undefined || title == "") title = "数据正在处理中......"
|
showPopImg(title, url, 323, 20);
|
}
|
|
function ValidateDate(obj) {
|
var reg = /^\d{4}-((0{0,1}[1-9]{1})|(1[0-2]{1}))-((0{0,1}[1-9]{1})|([1-2]{1}[0-9]{1})|(3[0-1]{1}))$/;
|
var result = true;
|
var vlu = obj.value.split(' ')[0];
|
if (!reg.test(vlu)) {
|
result = false;
|
}
|
else {
|
var arr_hd = vlu.split("-");
|
var dateTmp;
|
dateTmp = new Date(arr_hd[0], parseFloat(arr_hd[1]) - 1, parseFloat(arr_hd[2]));
|
if (dateTmp.getFullYear() != parseFloat(arr_hd[0]) || dateTmp.getMonth() != parseFloat(arr_hd[1]) - 1 || dateTmp.getDate() != parseFloat(arr_hd[2])) {
|
result = false
|
}
|
}
|
return result;
|
}
|
|
//身份证校验
|
|
//这个可以验证15位和18位的身份证,并且包含生日和校验位的验证。
|
//如果有兴趣,还可以加上身份证所在地的验证,就是前6位有些数字合法有些数字不合法。
|
function isIdCardNo(num2) {
|
var num = num2.value;
|
if (num == "") {
|
alert("请输入身份证号!");
|
return false;
|
}
|
num = num.replace(" ", "").toUpperCase();
|
var length = num.length;
|
if (length == 15 || length == 18)//中国大陆
|
{
|
//身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X。
|
if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(num))) {
|
alert('输入的身份证号长度不对,或者号码不符合规定!\n15位号码应全为数字,18位号码末位可以为数字或X。');
|
return false;
|
}
|
//校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
|
//下面分别分析出生日期和校验位
|
var len, re;
|
len = num.length;
|
if (len == 15) {
|
re = new RegExp(/^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/);
|
var arrSplit = num.match(re);
|
|
//检查生日日期是否正确
|
var dtmBirth = new Date('19' + arrSplit[2] + '/' + arrSplit[3] + '/' + arrSplit[4]);
|
var bGoodDay;
|
bGoodDay = (dtmBirth.getYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
|
if (!bGoodDay) {
|
alert('输入的身份证号里出生日期不对!');
|
return false;
|
}
|
else {
|
//将15位身份证转成18位
|
//校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
|
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
|
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
|
var nTemp = 0, i;
|
num = num.substr(0, 6) + '19' + num.substr(6, num.length - 6);
|
for (i = 0; i < 17; i++) {
|
nTemp += num.substr(i, 1) * arrInt[i];
|
}
|
num += arrCh[nTemp % 11];
|
return num;
|
}
|
}
|
if (len == 18) {
|
re = new RegExp(/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/);
|
var arrSplit = num.match(re);
|
|
//检查生日日期是否正确
|
var dtmBirth = new Date(arrSplit[2] + "/" + arrSplit[3] + "/" + arrSplit[4]);
|
var bGoodDay;
|
bGoodDay = (dtmBirth.getFullYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
|
if (!bGoodDay) {
|
|
alert('输入的身份证号里出生日期不对!');
|
return false;
|
}
|
else {
|
//检验18位身份证的校验码是否正确。
|
//校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
|
var valnum;
|
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
|
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
|
var nTemp = 0, i;
|
for (i = 0; i < 17; i++) {
|
nTemp += num.substr(i, 1) * arrInt[i];
|
}
|
valnum = arrCh[nTemp % 11];
|
if (valnum != num.substr(17, 1)) {
|
alert('18位身份证的校验码不正确!应该为:' + valnum);
|
return false;
|
}
|
return num;
|
}
|
}
|
}
|
else if (length >= 7 && length <= 10) {
|
return true;
|
//if (!(/(^[A-Z]{1}\d{7}$)|(^[A-Z]{2}\d{7}$)|(^[A-Z]{1}[1-2]{1}\d{8}$)/.test(num))) {
|
// alert("不符合香港、台湾身份证,请重新输入!");
|
// return false;
|
//}
|
}
|
else {
|
alert('身份证输入错误,请重新输入!');
|
return false;
|
}
|
|
return false;
|
}
|
|
//邮编查询
|
function checkPost(obj) {
|
var str = obj.value;
|
if (str.length != 0) {
|
reg = /^\d{6}$/;
|
if (!reg.test(str)) {
|
alert("邮政编码(" + obj.value + ")输入有误,请重新输入。");
|
return false;
|
}
|
}
|
return true;
|
}
|
|
//只允许输入数字和小数点
|
function clearNoNum(obj) {
|
//先把非数字的都替换掉,除了数字和.
|
obj.value = obj.value.replace(/[^\d.]/g, "");
|
//必须保证第一个为数字而不是.
|
obj.value = obj.value.replace(/^\./g, "");
|
//保证只有出现一个.而没有多个.
|
obj.value = obj.value.replace(/\.{2,}/g, ".");
|
//保证.只出现一次,而不能出现两次以上
|
obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
|
}
|
|
//电话验证
|
function CheckPhone(obj, strTitle, Type) {
|
var value = obj.value;
|
var regMobile = /^(?:1[0-9][0-9])-?\d{5}(\d{3}|\*{3})$/.test(value);
|
var regTel = /^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/.test(value); //带区号的固定电话
|
var regTel1 = /^(\d{7,8})(-(\d{3,}))?$/.test(value); //不带区号的固定电话
|
|
if (Type == "SJ" && regMobile)//手机
|
{
|
return true;
|
}
|
else if (Type == "GH" && (regTel || regTel1))//固话
|
{
|
return true;
|
}
|
else if ((Type != "SJ" && Type != "GH") && (regMobile || regTel || regTel1)) {
|
return true;
|
}
|
else {
|
alert(strTitle + "输入有误,请重新输入。");
|
return false;
|
}
|
}
|
|
//电话验证
|
function CheckPhoneTel(obj, strTitle, Type) {
|
var value = obj.value;
|
var regMobile = /^(?:1[0-9][0-9])-?\d{5}(\d{3}|\*{3})$/.test(value);
|
var regTel = /^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/.test(value); //带区号的固定电话
|
var regTel1 = /^(\d{7,8})(-(\d{3,}))?$/.test(value); //不带区号的固定电话
|
|
if (Type == "SJ" && regMobile)//手机
|
{
|
return true;
|
} else if (Type == "GH" && (regTel || regTel1))//固话
|
{
|
return true;
|
} else if ((Type != "SJ" && Type != "GH") && (regMobile || regTel || regTel1)) {
|
return true;
|
} else {
|
return confirm("您输入的" + strTitle + "不符合中国国内标准,是否继续?");
|
}
|
}
|
|
//校验字段文本
|
function CheckValue(obj, type, strTitle) {
|
if (type == "Num") {
|
if (isNaN(obj.value)) {
|
alert(strTitle + "(" + obj.value + ")输入有误,请重新输入。")
|
return false;
|
}
|
} else if (type == "value") {
|
if (obj.value == "") {
|
alert("请输入" + strTitle + "\r其内容不能为空。");
|
return false;
|
}
|
} else if (type == "date") {
|
if (obj.value != "" && !ValidateDate(obj)) {
|
alert(strTitle + "输入有误,请检查。");
|
return false;
|
}
|
}
|
return true;
|
}
|
|
//校验邮箱
|
function ValidateEmail(value) {
|
var found = value.match(/\w+@.+\..+/);
|
if (found == null) {
|
alert("输入邮箱(" + value + ")有误!");
|
return false;
|
} else {
|
return true;
|
}
|
}
|
|
/*用海类型、用海方式 ↓↓↓↓↓↓↓↓*/
|
|
function emptyList(list) {
|
for (var i = 0; list.length = 0; i++) { list.remove(i) }
|
}
|
|
function getSelectValue(listName) {
|
if (listName.selectedIndex != -1) { return listName.options[listName.selectedIndex].value }
|
else { return '' }
|
}
|
|
//取select下拉列表单文本
|
function getSelectText(listName) {
|
if (listName.selectedIndex != -1) { return listName.options[listName.selectedIndex].innerText }
|
else { return '' }
|
}
|
|
//添加下拉列表Option
|
function addSelectOption(listName, optText, optValue, optSelected) {
|
var oOption = document.createElement("OPTION");
|
listName.options.add(oOption)
|
oOption.innerText = optText
|
oOption.value = optValue
|
oOption.selected = optSelected
|
}
|
|
function onchanageB(objH, purposeB, flag) {
|
var valu = getSelectValue(objH);
|
for (var i = 0; i < purposeB.length; i++) {
|
if (purposeB.options[i].value == valu) {
|
purposeB.options[i].selected = true;
|
}
|
else {
|
purposeB.options[i].selected = false;
|
}
|
}
|
}
|
|
function onchanageH(objA, ddlhide, purposeB, flag) {
|
var valu = getSelectValue(objA);
|
emptyList(ddlhide);
|
|
addSelectOption(ddlhide, "全部", "", true);
|
var selected = false; //以前选中的二类是否在现在选的大类对应的小类里面
|
for (var i = 0; i < purposeB.length; i++) {
|
if (purposeB.options[i].value.substring(0, 1) == valu) {
|
if (purposeB.options[i].selected) selected = true;
|
if (valu != "") {
|
addSelectOption(ddlhide, purposeB.options[i].innerText, purposeB.options[i].value, purposeB.options[i].selected);
|
}
|
}
|
}
|
if (!selected) purposeB.value = ""; //如果不在,则清空二类的值相当于全部
|
}
|
|
/*用海类型、用海方式 ↑↑↑↑↑↑↑↑↑*/
|
|
//清空查询区
|
function ClearSearch(obj) {
|
var selectList = obj.getElementsByTagName("select");
|
var inputList = obj.getElementsByTagName("input");
|
for (var i = 0; i < selectList.length; i++) {
|
var select = selectList[i];
|
if (select.length > 0) {
|
select[0].selected = true;
|
}
|
}
|
for (var j = 0; j < inputList.length; j++) {
|
var input = inputList[j];
|
if (input.type == "text") {
|
input.value = "";
|
}
|
if (input.type == "checkbox") {
|
input.checked = false;
|
}
|
}
|
}
|
|
//dirLevel 例:"../../../"
|
function switchSysBar(dirLevel, TableSink) {
|
if (TableSink != "") { TableSink += "/" }
|
if (document.getElementById("frmTitle").style.display == "none") {
|
document.getElementById("frmTitle").style.display = "";
|
document.getElementById("menuimg").src = dirLevel + "images/" + TableSink + "Menu/close.gif";
|
document.getElementById("menuimg").alt = "隐藏左栏";
|
} else {
|
document.getElementById("frmTitle").style.display = "none";
|
document.getElementById("menuimg").src = dirLevel + "images/" + TableSink + "Menu/open.gif";
|
document.getElementById("menuimg").alt = "开启左栏";
|
}
|
}
|
|
//dirLevel 例:"../../../"
|
function menuonmouseover(dirLevel, TableSink) {
|
if (TableSink != "") { TableSink += "/" }
|
if (document.getElementById("frmTitle").style.display == "none") {
|
document.getElementById("menuimg").src = dirLevel + "images/" + TableSink + "Menu/open_on.gif";
|
} else {
|
document.getElementById("menuimg").src = dirLevel + "images/" + TableSink + "Menu/close_on.gif";
|
}
|
}
|
|
//dirLevel 例:"../../../"
|
function menuonmouseout(dirLevel, TableSink) {
|
if (TableSink != "") { TableSink += "/" }
|
if (document.getElementById("frmTitle").style.display == "none") {
|
document.getElementById("menuimg").src = dirLevel + "images/" + TableSink + "Menu/open.gif";
|
} else {
|
document.getElementById("menuimg").src = dirLevel + "images/" + TableSink + "Menu/close.gif";
|
}
|
}
|
|
function findObj(theObj, theDoc) {
|
var p, i, foundObj;
|
if (!theDoc) theDoc = document;
|
if ((p = theObj.indexOf("?")) > 0 && parent.frames.length) {
|
theDoc = parent.frames[theObj.substring(p + 1)].document;
|
theObj = theObj.substring(0, p);
|
}
|
if (!(foundObj = theDoc[theObj]) && theDoc.all)
|
foundObj = theDoc.all[theObj];
|
for (i = 0; !foundObj && i < theDoc.forms.length; i++)
|
foundObj = theDoc.forms[i][theObj];
|
for (i = 0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
|
foundObj = findObj(theObj, theDoc.layers[i].document);
|
if (!foundObj && document.getElementById)
|
foundObj = document.getElementById(theObj);
|
return foundObj;
|
}
|
};
|
|
var winPro = new winPro_def();
|
|
//点击新增或查看时弹出最大化的新窗口 add ykm 2019/08/01
|
function openFullWindow(url, title) {
|
var height = window.screen.availHeight;
|
var width = window.screen.availWidth;
|
var top = 0;
|
var left = 0;
|
var newwin = window.open(url, title, 'height=' + height + ', width=' + width + ',top=' + top + ',left=' + left + ',toolbar=no, menubar=no, resizable=yes,scrollbars=yes,location=no, status=no');
|
newwin.resizeTo(window.screen.availWidth, window.screen.availHeight);
|
newwin.moveTo(0, 0);
|
return false;
|
}
|