📄 gwp.js
字号:
//控制提交命令,n 当前页面被提交的form名称;nextpage 提交页面名称;
//command 提交执行命令;anexecute 提交是否执行命令
var chknum=0;//用户选择的记录数
var check="";//用户选择的记录主键值
//=======(系统操作)**开始**=======
//页面加载时屏蔽右键菜单
function Document_onLoad(){
//document.oncontextmenu = function() {
// var tagName = event.srcElement.tagName.toLowerCase();
// if (tagName != "input"
// && tagName != "textarrea"
// && tagName != "select") {
// return false;
// }
//};
//document.onclick = function() {return (event.shiftKey == false)};
//document.onkeydown = function () {
// if (event.keyCode == 116 || event.keyCode == 122) {
// event.keyCode = 0;
// event.returnValue = 0;
// }
//};
}
//延时函数,参数为延时毫秒数。
function sleep(milliSeconds){
showModalDialog("../gwp/controller?nextpage=sleep&command=&canexecute=false", milliSeconds, "dialogWidth:15; dialogHeight:1; status:no; center:yes; dialogHide:yes");
}
//取消返回
function cancel_back(){
window.history.go(-1);
}
//关闭
function cancel_close(){
window.close();
}
//退出系统
function quit(){
top.close();
}
//=======(系统操作)**结束**=======
//=======(保存、修改、删除按钮操作)**开始**=======
//调用Cmd,显示页面
function pageshow(n,nextpage,command,canexecute){
document.forms[n].nextpage.value=nextpage;
document.forms[n].command.value=command;
document.forms[n].canexecute.value=canexecute;
document.forms[n].action = "/SEWeb/se/controller"
document.forms[n].submit();
}
function LdapPageshow(n,nextpage,command,canexecute,context){
document.forms[n].nextpage.value=nextpage;
document.forms[n].command.value=command;
document.forms[n].canexecute.value=canexecute;
document.forms[n].context.value = context + document.forms[n].context.value;
document.forms[n].action = "/GWPWEB/gwp/controller"
document.forms[n].submit();
}
//判断checkvalue对象是否有值
function ischecked(){
var els = document.getElementsByName("check");
for (var i = 0; i < els.length; i++){
var el = els.item(i);
if (el.checked){
return true;
}
}
alert("请选中要操作的记录!");
return false;
}
//执行按钮操作前检查是否选中操作记录。
function checkcmd(n,nextpage,command,canexecute){
if(ischecked()){
if(confirm("删除后不可恢复,确认吗?")){
pageshow(n,nextpage,command,canexecute);
}else false;
}else false;
}
function checkUserDepartcmd(n,nextpage,command,canexecute){
if(ischecked()){
if(confirm("删除后不可恢复,确认吗?")){
pageshow(n,nextpage,command,canexecute);
}else false;
}else false;
}
//更新
function InfoModify(n,nextpage,command,canexecute,m){
if(m=='one'){
if(ischeckedOne()){
pageshow(n,nextpage,command,canexecute);
}
}
else{
if(ischecked()){
pageshow(n,nextpage,command,canexecute);
}
}
}
//刷新
function appRefresh(n,nextpage,command,canexecute){
pageshow(n,nextpage,command,canexecute);
parent.frames("top").location = parent.frames("top").location
parent.frames("left").location = parent.frames("left").location
}
//删除
function InfoDelete(n,nextpage,command,canexecute){
checkcmd(n,nextpage,command,canexecute);
}
//选中记录
function ischeckedOne(){
var els = document.getElementsByName("check");
//alert(els.length);
var j=0;
for (var i = 0; i < els.length; i++){
var el = els.item(i);
if (el.checked){
j++;
}
}
if(j==0){
alert("请选中要操作的记录!");
return false;
}
else if(j>1){
alert("请只选择一条记录!");
j==0;
return false;
}
else if(j==1){
return true;
}
}
//判断部门用户,并重新组合成新的字符串传给Command
function deleteCheck(){
var sValue = new Array();
var sRtnValue = new Array();
var j = 0;
var k = 0;
for(i=0;i < document.getElementsByName("check").length;i++){
if(document.all("check").item(i).checked){
sValue[i] = document.all("check").item(i).value;
if(sValue[i].indexOf("U") != -1){
j++;
sRtnValue[j] = sValue[i].substring(1);
hu.innerHTML += "<input type='hidden' name='checkdel' value='" + sRtnValue[j] + "'>";
//window.alert("<input type='hidden' name='checkdel' value='" + sRtnValue[j] + "'>");
}else{
++k;
}
}
}
if (k > 0){
alert("您不能在此处删除部门");
}else{
checkcmd(0,'UserDepartList','delUser','true');
}
}
//删除部门
function delDepart(n,nextpage,command,canexecute){
if(confirm("删除后不可恢复,确认吗?")){
pageshow(n,nextpage,command,canexecute);
}else{
return false;
}
}
//判断部门用户,选择修改页面
function updateCheck(){
var sValue = new Array();
if(ischeckedOne()){
for(i=0;i < document.getElementsByName("check").length;i++){
if(document.all("check").item(i).checked){
sValue[i] = document.all("check").item(i).value;
document.all("checkvalue").value = sValue[i].substring(1);
if(sValue[i].indexOf("U") != -1){
pageshow(0,'UserUpdate','detailUser','true');
}else{
pageshow(0,'DepartUpdate','detailDepartment','true');
}
}
}
}
}
//=======LDAP服务器操作功能 开始=======
//删除LDAP部门
function LDAPdelDepart(n,nextpage,command,canexecute){
if(confirm("删除后不可恢复,确认吗?")){
pageshow(n,nextpage,command,canexecute);
}else{
return false;
}
}
//判断LDAP部门用户,并重新组合成新的字符串传给Command
function LDAPdeleteCheck(){
var sValue = new Array();
var sRtnValue = new Array();
var j = 0;
var k = 0;
for(i=0;i < document.getElementsByName("check").length;i++){
if(document.all("check").item(i).checked){
sValue[i] = document.all("check").item(i).value;
if(sValue[i].indexOf("UID") != -1){
j++;
sRtnValue[j] = sValue[i];
hu.innerHTML += "<input type='hidden' name='checkdel' value='" + sRtnValue[j] + "'>";
//window.alert("<input type='hidden' name='checkdel' value='" + sRtnValue[j] + "'>");
}else{
++k;
}
}
}
if (k > 0){
alert("您不能在此处删除部门");
}else{
checkcmd(0,'LdapList','DeleteLDAPUserCmd','true');
}
}
//判断LDAP部门用户,选择修改页面
function LDAPupdateCheck(){
var sValue = new Array();
if(ischeckedOne()){
for(i=0;i < document.getElementsByName("check").length;i++){
if(document.all("check").item(i).checked){
sValue[i] = document.all("check").item(i).value;
document.all("checkvalue").value = sValue[i];
if(sValue[i].indexOf("UID=") != -1){
pageshow(0,'UpdateLDAPUser','DisplayLDAPUserDetailCmd','true');
}else{
pageshow(0,'UpdateLDAPDepartment','DisplayLDAPDepartmentDetailCmd','true');
}
}
}
}
}
//LDAP用户校验
function LDAPuserDataCheck(n,nextpage,command,canexecute,type){
if(document.all(type + "uid").value.trim() == ""){
alert("用户登录名不可为空!");
document.all(type + "uid").focus();
}else if(document.all(type + "userPassword").value.trim() == ""){
alert("登录密码不可为空!");
document.all(type + "userPassword").focus();
}else if(document.all(type + "cn").value.trim() == ""){
alert("用户姓不可为空!");
document.all(type + "cn").focus();
}else if(document.all(type + "sn").value.trim() == ""){
alert("用户名不可为空!");
document.all(type + "sn").focus();
}else{
pageshow(n,nextpage,command,canexecute);
}
}
//LDAP部门校验
function LDAPdeptDataCheck(n,nextpage,command,canexecute,type){
if(document.all(type + "ou").value.trim() == ""){
alert("部门名称不可为空!");
document.all(type + "ou").focus();
}else{
pageshow(n,nextpage,command,canexecute);
}
}
//用户组校验
function LDAPgroupDataCheck(n,nextpage,command,canexecute,type){
if(document.all(type + "cn").value.trim() == ""){
alert("用户组名称不可为空!");
document.all(type + "cn").focus();
}else{
pageshow(n,nextpage,command,canexecute);
}
}
//=======LDAP服务器操作功能 结束=======
//主键值选择
function checkselect(chk)
{
if (chk.checked){
document.forms[0].checkvalue.value=chk.value;
chknum++;
//主键值累加
check=check+"|"+chk.value;
//alert(chknum+"/"+check);
}else{
chknum--;
//从主键值中删除取消选择的主键。
if(check!=""){
var delstr="|"+chk.value;
check=check.substring(0,check.indexOf(delstr))+check.substring(check.indexOf(delstr)+delstr.length,check.length+1);
}
if(document.forms[0].checkvalue.value==chk.value){
//重置单选值
document.forms[0].checkvalue.value=check.substring(check.lastIndexOf("|")+1,check.length+1);
}
}
}
//执行按钮操作前检查是否选中操作记录。
function checkupdate(n,nextpage,command,canexecute){
if(document.forms[0].checkvalue.value == null || document.forms[0].checkvalue.value == ""){
alert("请选择要操作的记录!");
}else{
pageshow(n,nextpage,command,canexecute);
}
}
//示例保存
function samplesave(n,nextpage,command,canexecute){
if (document.forms[n].Ins_Sample_Name.value == null || document.forms[n].Ins_Sample_Name.value.trim() == ""){
alert("对不起,名称不能为空!");
return;
}
if (document.forms[n].Ins_Sample_Email.value == null || document.forms[n].Ins_Sample_Email.value.trim() == ""){
alert("对不起,电子邮件不能为空!");
return;
}
pageshow(n,nextpage,command,canexecute);
}
//公文交换域对应关系保存
function FieldXmlSave(n,nextpage,command,canexecute){
if (document.forms[n].ModName.value == null || document.forms[n].ModName.value.trim() == ""){
alert("对不起,模块名称不能为空!");
return;
}
if (document.forms[n].FieldName.value == null || document.forms[n].FieldName.value.trim() == ""){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -