📄 gwp.js
字号:
alert("对不起,域名不能为空!");
return;
}
if (document.forms[n].XmlTag.value == null || document.forms[n].XmlTag.value.trim() == ""){
alert("对不起,XML标签不能为空!");
return;
}
pageshow(n,nextpage,command,canexecute);
}
//下级功能树显示
function openAppDialog(id){
document.forms[0].checkvalue.value=id;
pageshow(0,'ApplicationList','ApplicationList','true');
}
function openDictDialog(id){
document.forms[0].checkvalue.value=id;
pageshow(0,'DictionaryList','DictionaryList','true');
}
function openGroupDialog(id){
document.forms[0].GroupID.value=id;
pageshow(0,'UserList','userListCmd','true');
}
function openDeptDialog(id){
document.forms[0].ParentID.value=id;
pageshow(0,'UserDepartList','commListCmd','true');
}
//选择应用树保存
function btnOkApp(n,objName,nextpage,command,canexecute,type){
var sRtnValue = "";
var sValue = "";
for(i=0;i < document.getElementsByName("check").length;i++){
if(document.all("check").item(i).checked){
sValue = sValue + document.all("check").item(i).value + ",";
}
}
if(sValue.length > 0){
sRtnValue = sValue.substr(0,sValue.length - 1);
}
opener.document.all.item(objName).value=sRtnValue;
opener.document.all.item("nextpage").value=nextpage;
opener.document.all.item("command").value=command;
opener.document.all.item("canexecute").value=canexecute;
opener.document.all.item("type").value=type;
window.close();
opener.document.forms[n].submit();
}
//=======(保存、修改、删除按钮操作)**结束**=======
//=======(弹出对话框,并返回以","分割的字符串)**开始**=======
//弹出对话框
function ShowDialog(objName,URL){
var rtnValue;
rtnValue = window.showModalDialog(URL,"","dialogWidth:300px;dialogHeight:400px;center:1;status:0;scroll:1");
if(rtnValue!=null) {
document.all.item(objName).value = rtnValue;
return true;
}else{
return false;
}
}
//角色赋值应用树
function setPurview(n,nextpage,command,canexecute,type){
if(document.forms[n].checkvalue.value==null||document.forms[n].checkvalue.value==""){
alert("请您选择一条记录!");
return;
}
if(check.lastIndexOf("|")>0){
alert("对不起,请您选择一条记录!");
return;
}
var val=document.forms[n].checkvalue.value;
var url="../gwp/controller?nextpage="+nextpage+"&command="+command+"&canexecute="+canexecute+"&checkvalue="+val+"&type="+type;
window.open(url,"应用选择","width=400,height=500,vscrollbars=yes");
}
//确定按钮 返回所有的选择结果组成的以“,”分割的字符串
function btnOk(){
var sRtnValue = "";
var sValue = "";
var ss = "";
if(document.all("check")!=null){
for(i=0;i < document.getElementsByName("check").length;i++){
if(document.all("check").item(i).checked){
ss = document.all("check").item(i).value;
if(ss.indexOf("|") != -1){
if(ss.indexOf("*") != -1){
ss= ss.substring(1,ss.indexOf("|"));
}else{
ss= ss.substring(0,ss.indexOf("|"));
}
}
sValue=sValue+ss+",";
}
}
if(sValue.length > 0){
sRtnValue = sValue.substr(0,sValue.length - 1);
}
window.returnValue = sRtnValue;
}
window.close();
}
//角色分配给用户、部门、组
function assignRole(n,nextpage,command,canexecute,field,select,selecttype,type,parentid,asstype){
if(document.forms[n].checkvalue.value==null||document.forms[n].checkvalue.value==""){
alert("请您选择一条记录!");
return;
}
if(check.lastIndexOf("|")>0){
alert("对不起,请您选择一条记录!");
return;
}
var checkvalue=document.forms[n].checkvalue.value;
if(ShowDialog(field,'../gwp/controller?nextpage='+nextpage+'&command='+command+'&canexecute='+canexecute+'&type='+select+'&selectType='+selecttype+'&dept_id='+parentid+"&assocType="+asstype+"&checkvalue="+checkvalue)){
document.all.item('type').value=type;
document.all.item('command').value="RoleAssignByType";
document.all.item('nextpage').value="RoleList";
document.all.item('canexecute').value="true";
document.forms[n].submit();
}
}
//收回部门、用户、小组的角色
function getRole(n,nextpage,command,canexecute){
if(document.forms[n].checkvalue.value==null||document.forms[n].checkvalue.value==""){
alert("请您选择一条记录!");
return;
}
if(check.lastIndexOf("|")>0){
alert("对不起,请您选择一条记录!");
return;
}
pageshow(n,nextpage,command,canexecute);
}
//用户、组、部门选择角色
function allSelectRole(){
var sValue = new Array();
if(ischeckedOne()){
if(document.all("check")!=null){
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){
document.all("checkvalue").value = sValue[i].substring(1);
if(ShowDialog('roles','../gwp/controller?nextpage=RoleSelect&command=RoleSelect&canexecute=true&type=3&checkvalue='+sValue[i].substring(1))){
//if(document.all.item("roles").value!=null&&document.all.item("roles").value.length>0){
pageshow(0,'UserDepartList','AddUserRole','true');
}
}else if(sValue[i].indexOf("D") != -1){
document.all("checkvalue").value = sValue[i].substring(1);
if(ShowDialog('roles','../gwp/controller?nextpage=RoleSelect&command=RoleSelect&canexecute=true&type=2&checkvalue='+sValue[i].substring(1))){
pageshow(0,'UserDepartList','AddDepartRole','true');
}
}else{
document.all("checkvalue").value = sValue[i].substring(1);
if(ShowDialog('roles','../gwp/controller?nextpage=RoleSelect&command=RoleSelect&canexecute=true&type=4&checkvalue='+sValue[i])){
pageshow(0,'GroupList','AddGroupRole','true');
}
}
}
}
}
}
}
//用户组添加用户
function addUserDialog(){
if(ShowDialog('user','../gwp/controller?command=UserTreeCmd&nextpage=TreeSelect&type=0&selectType=1&canexecute=true&dept_id=10000')){
pageshow(0,'UserList','AddGroupUser','true');
}
}
//=======(弹出对话框,并返回以,分割的字符串)**结束**=======
//=======(分页显示)**开始**=======
//上一页
function uppage(n,nextpage,command,canexecute){
var now=document.all.item("nowpage").value;
if(now!=null){
var up=parseInt(now);
if(!isNaN(up)){
if(now-1<=0){
up=1;
}else{
up=now-1;
}
document.all.item("nowpage").value=up;
pageshow(n,nextpage,command,canexecute);
}
}
}
//下一页
function nextpage(n,nextpage,command,canexecute){
var now=document.all.item("nowpage").value;
var all=document.all.item("allpage").value;
if(now!=null&&all!=null){
var next=parseInt(now);
if(!isNaN(next)){
if(!isNaN(parseInt(all))){
if(next+1>parseInt(all)){
next=parseInt(all);
}else{
next+=1;
}
document.all.item("nowpage").value=next;
pageshow(n,nextpage,command,canexecute);
}
}
}
}
//至第几页
function gotopage(n,nextpage,command,canexecute){
var now=document.all.item("nowpage").value;
var all=document.all.item("allpage").value;
var go=document.all.item("gopage").value;
if(!isNaN(parseInt(go))){
if(go!=null&&now!=null&&all!=null){
if(!isNaN(parseInt(all))&&parseInt(go)>parseInt(all)){
document.all.item("nowpage").value=parseInt(all);
pageshow(n,nextpage,command,canexecute);
return;
}
if(parseInt(go)<1){
document.all.item("nowpage").value="1";
pageshow(n,nextpage,command,canexecute);
return;
}
document.all.item("nowpage").value=parseInt(go);
pageshow(n,nextpage,command,canexecute);
}
}
}
//=======(分页显示)**结束**=======
//=======(数据校验)**开始**=======
//应用数据校验
function appDataCheck(n,nextpage,command,canexecute){
if(document.all("Ins_AppName").value.trim() == ""){
alert("应用名称不可为空!");
document.all("Ins_AppName").focus();
}else{
pageshow(n,nextpage,command,canexecute);
}
}
//字典数据校验
function dictDataCheck(n,nextpage,command,canexecute){
if(document.all("Ins_Name").value.trim() == ""){
alert("名称不可为空!");
document.all("Ins_Name").focus();
}else if(document.all("Ins_Value").value.trim() == ""){
alert("编码不可为空!");
document.all("Ins_Value").focus();
}else{
pageshow(n,nextpage,command,canexecute);
}
}
//日志查询校验
function logDataCheck(n,nextpage,command,canexecute){
if(document.all.item("Ins_StartDate").value.trim() == "" && document.all.item("Ins_EndDate").value.trim() == ""){
alert("起始时间或终止时间不可为空!请您重新填写!");
//document.all("Ins_StartDate").focus();
}else{
pageshow(n,nextpage,command,canexecute);
}
}
//角色校验
function roleDataCheck(n,nextpage,command,canexecute){
if(document.all("Ins_RoleName").value.trim() == ""){
alert("角色名称不可为空!");
document.all("Ins_RoleName").focus();
}else{
pageshow(n,nextpage,command,canexecute);
}
}
//用户组校验
function groupDataCheck(n,nextpage,command,canexecute,type){
if(document.all(type + "GroupName").value.trim() == ""){
alert("用户组名称不可为空!");
document.all(type + "GroupName").focus();
}else{
pageshow(n,nextpage,command,canexecute);
}
}
//部门校验
function deptDataCheck(n,nextpage,command,canexecute,type){
if(document.all(type + "Dept_Name").value.trim() == ""){
alert("部门名称不可为空!");
document.all(type + "Dept_Name").focus();
}else{
pageshow(n,nextpage,command,canexecute);
}
}
//用户校验
function userDataCheck(n,nextpage,command,canexecute,type){
if(document.all(type + "Login_Name").value.trim() == ""){
alert("用户登录名不可为空!");
document.all(type + "Login_Name").focus();
}else if(document.all(type + "PassWord").value.trim() == ""){
alert("登录密码不可为空!");
document.all(type + "PassWord").focus();
}else if(document.all(type + "FamilyName").value.trim() == ""){
alert("用户姓不可为空!");
document.all(type + "FamilyName").focus();
}else if(document.all(type + "Name").vauserPassword() == ""){
alert("用户名不可为空!");
document.all(type + "Name").focus();
}else{
pageshow(n,nextpage,command,canexecute);
}
}
//登陆名校验
function isRegister(sName){
var register=document.all(sName).value.trim();
var inchars = "_.1234567890abcdefghigklmnopqrstuvwxyzABCDEPGHIGKLMNOPQRSTUVWXYZ";
for (i=0;i< register.length;i++){
regChar=register.charAt(i)
if (inchars.indexOf(regChar, 0) == -1){
alert("登录名和密码必须为数字、26字母、下划线与小数点!");
document.all(sName).focus();
return false;
}
}
}
//数字校验
function isNum(sName){
var numNo=document.all(sName).value.trim();
var inChars = "1234567890";
for (i=0;i<numNo.length;i++){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -