You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

368 lines
11 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@page import="com.zky.para.Para"%>
<%@include file="/auth.jsp"%>
<%@page import="java.util.Date"%>
<%@page language="java" pageEncoding="utf-8" %>
<jsp:useBean id="getPara" scope="application" class="com.zky.para.SyncPara"/>
<%
if (request.getParameter("clearsession") != null) {
session.removeAttribute("menu_tree");
}
String operate = request.getParameter("operate");
String menuitem = "";
String companyid = "";
String areaid = "";
String menuitemname = "";
String disabled = "";
MenuTree tree = (MenuTree) request.getSession().getAttribute("menu_tree");
if (tree != null) {
companyid = tree.getCompanyId();
areaid=tree.getAreaId();
menuitem = tree.getTreeId();
menuitemname = tree.getTreeName();
}
else{
companyid = Common.convertNull(request.getParameter("companyid"));
areaid=Common.convertNull(request.getParameter("areaid"));
}
if (operate.equals("getMenuTree")) {
disabled = "disabled";
}
%>
<html>
<head>
<title>菜单管理</title>
<link href="../css/font.css" rel="stylesheet" type="text/css">
<link href="../css/xtree.css" rel="stylesheet" type="text/css">
<style type="text/css">
select
{
width:155px;
}
</style>
<script src="../js/check.js"></script>
<script src="../js/setSelectValue.js"></script>
<script src="../js/xtree.js"></script>
<script>
var treeSize = <%=tree==null?0:1%>;
function check() {
if (form1.menuitem.value == "") {
alert("请输入菜单编码!");
form1.menuitem.focus();
return;
}
if (form1.menuitemname.value == "") {
alert("请输入菜单名称!");
form1.menuitemname.focus();
return;
}
if (form1.companyid.value == "") {
alert("请选择所属市州!");
form1.companyid.focus();
return;
}
form1.operate.value="newMenuTree";
form1.button1.disabled=true;
form1.button2.disabled=true;
form1.submit();
}
function saveMenu() {
if (treeSize==0) {
alert("菜单不完整,无法保存!");
return false;
}
if (form1.menuitemname.value == "") {
alert("请输入菜单名称!");
form1.menuitemname.focus();
return;
}
if (!confirm("您确定要保存当前菜单吗!")) {
return false;
}
form1.button1.disabled=true;
form1.button2.disabled=true;
form1.operate.value="saveTree";
form1.submit();
}
</script>
</head>
<body>
<form name="form1" method="post" action="/servlet/MenuManage">
<input type="hidden" name="operate" value="<%=operate%>"/>
<input type="hidden" name="preMenuitem" value="<%=menuitem%>"/>
<input type="hidden" name="companyidQ" value="<%=request.getParameter("companyidQ")%>"/>
<input type="hidden" name="areaidQ" value="<%=request.getParameter("areaidQ")%>"/>
<input type="hidden" name="menuitemQ" value="<%=request.getParameter("menuitemQ")%>"/>
<input type="hidden" name="menuitemnameQ" value="<%=request.getParameter("menuitemnameQ")%>"/>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="box">
<tr>
<td valign="top"><table width="100%" height="23" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="25%" background="/images/tab_search_01.jpg"><table width="100%" height="23" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="6%" align="right"><img src="/images/little_red.jpg" width="12" height="12"></td>
<td width="94%" class="font12b">&nbsp;<b>菜单管理</b></td>
</tr>
</table></td>
<td width="75%" background="/images/tab_search_03.jpg"><img src="/images/tab_search_02.jpg" width="12" height="23"></td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="d8e9fe" class="table02">
<tr bgcolor="#FFFFFF" height="35px">
<td class="cell1">菜单编码</td>
<td class="cell2">
<input type="text" name="menuitem" value="<%=menuitem%>" <%=disabled%> maxlength="10"><font style="color: red;">*</font>
</td>
<td class="cell1">菜单名称</td>
<td class="cell2">
<input type="text" name="menuitemname" value="<%=menuitemname%>" onblur="checkLength(this,30);"><font style="color: red;">*</font>
</td>
</tr>
<tr bgcolor="#FFFFFF" height="35px">
<td class="cell1">所属市州</td>
<td class="cell2">
<select class='aselect' <%=disabled%> onChange="selectChange(1);" name="companyid" setValue="<%=companyid%>">
<%
if (companyid.equals("")){
out.println(Para.getSj(getPara));
if (!companyid.equals("")){
%>
<script>
form1.companyid.value='<%=companyid%>';
</script>
<%
}
}else{
out.println(getPara.getSelectParaFilter("tab_framework","frameworkid","frameworkname","frameworkid",companyid));
}
%>
</select>
</td>
<td class="cell1"></td>
<td class="cell2"></td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="d8e9fe" class="table02" style="margin:0px auto;">
<tr bgcolor="#FFFFFF">
<td valign="top" width="50%">
<table width="99%" cellpadding='3' cellspacing='1' bgcolor='#999999'>
<tr height="30px">
<td style="BACKGROUND-COLOR:#ffffff">
<%
if (tree!=null) {
out.println(tree);
} else {
%>
<center>
<a href="javascript:check();">请建立新菜单</a>
</center>
<%
}
%>
</td>
</tr>
</table>
</td>
<td valign="top" width="50%">
<div id="operDiv" style="OVERFLOW:hidden;">
<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' bgcolor='#999999'>
<tr height='30'>
<td class='cell2' width="100">选中节点</td>
<td class='cell2'><input type="text" name="menuname" readonly/>
<a id="delete" href="javascript:deleteNode()">删除</a>
<input type="hidden" name="menuid">
<input type="hidden" name="upmenuid">
<input type="hidden" name="type">
</td>
</tr>
<tr height='30' id="menu">
<td class='cell2' width="100"><a href="javascript:moveNode()">移动到..</a></td>
<td class='cell2'>
<select name="toMenuid"></select>
</td>
<tr height='30' id="func">
<td class='cell2' width="100"><a href="javascript:addNode('funcid','1')">增加功能点</a></td>
<td class='cell2'>
<select name="funcid"></select>
</td>
</tr>
<tr height='30' id="submenu">
<td class='cell2' width="100"><a href="javascript:addNode('submenuid','0')">增加文件夹</a></td>
<td class='cell2'>
<select name="subMenuid"></select>
</td>
</table>
</div>
</td>
</tr>
</table>
<table width="100%" align="center">
<tr align="center" height="40px" valign="middle">
<td>
<input type="button" name="button1" style="background:url(../images1/bc1.png); width:60px; height:22px; border:none;cursor: pointer;" onClick="saveMenu();"/>&nbsp;&nbsp;
<input type="button" name="button2" style="background:url(../images1/fh.png); width:60px; height:22px; border:none; cursor: pointer;" onClick="history.back();"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<%@include file="/foot.jsp"%>
</body>
</html>
<script>
//type菜单节点类型0分枝1叶子
function oper(menuid,menuname,upmenuid,type) {
form1.menuname.value=menuname;
form1.menuid.value=menuid;
form1.upmenuid.value = upmenuid;
form1.type.value = type;
if (upmenuid=="") {
document.all.menu.style.display="none";
} else {
document.all.menu.style.display="block";
}
if (type == "1") {
document.all.menu.style.display = "block";
document.all.submenu.style.display = "none";
document.all.func.style.display = "none";
} else {
document.all.menu.style.display = "none";
document.all.submenu.style.display = "block";
document.all.func.style.display = "block";
}
var date = new Date();
var url = "/servlet/MenuManage?operate=getOperList&menuid="+menuid+"&type="+type+"&upmenuid="+upmenuid+"&random="+date.valueOf();
var callback = setOptions;
executeXhr(callback, url);
}
function setOptions() {
if (req.readyState == 4) {
if (req.status == 200) {
if (req.responseText!="") {
var xmlObj = req.responseXML;
if (xmlObj) {
var options = xmlObj.getElementsByTagName("options");
buildOptions(options[0],"toMenuid");
buildOptions(options[1],"subMenuid");
buildOptions(options[2],"funcid");
}
}
} else {
alert("There was a problem retrieving the XML data:" + req.statusText);
}
}
}
function moveNode() {
var menuid = form1.menuid.value;
var menuname = form1.menuname.value;
var type = form1.type.value;
var upmenuid = form1.upmenuid.value;
var tomenuid = form1.toMenuid.value;
if (upmenuid==tomenuid) {
return;
}
var menuitem = eval("tree" + menuid);
var tomenuitem = eval("tree" + tomenuid);
menuitem.remove();
eval("tree"+menuid+"=new WebFXTreeItem(menuname,\"javascript:oper('"+ menuid +"','"+ menuname +"','"+ tomenuid +"','"+ type +"')\")");
tomenuitem.add(eval("tree" + menuid));
var url = "/servlet/MenuManage?operate=moveNode&menuid=" + menuid +"&upmenuid="+upmenuid +"&tomenuid=" + tomenuid;
var callback = ready;
executeXhr(callback, url);
}
function addNode(objName,type) {
var upmenuid = form1.menuid.value;
if (menuid != "") {
var menuname="",menuid="",pos=-1;
var obj = document.getElementById(objName);
for (var i=0; i<obj.length; i++) {
if (obj[i].selected==true) {
menuname = obj.options[i].text;
menuid = obj.options[i].value;
pos = i;
break;
}
}
if (pos == -1) {
alert(type=="1"?"请选择一个功能点!":"请选择一个文件夹!");
return;
}
var url = "/servlet/MenuManage?operate=addNode&menuid=" + menuid + "&menuname="+ menuname +"&type="+ type +"&upmenuid="+upmenuid;
var callback = ready;
executeXhr(callback, url);
var menuitem = eval("tree" + upmenuid);
eval("tree"+menuid+"=new WebFXTreeItem(menuname,\"javascript:oper('"+ menuid +"','"+ menuname +"','"+ upmenuid +"','"+ type +"')\")");
menuitem.add(eval("tree"+menuid));
removeOption(obj,pos);
} else {
alert("请选择一个节点!");
}
}
function removeOption(obj, pos) {
for (var i=pos; i<obj.length-1; i++) {
obj.options[i].text=obj.options[i+1].text;
obj.options[i].value=obj.options[i+1].value;
}
obj.length --;
}
function deleteNode() {
var menuid = form1.menuid.value;
var upmenuid = form1.upmenuid.value;
if (menuid != "") {
if (form1.upmenuid.value=="") {
alert("不能删除根节点!");
return;
}
if (!confirm("您确定要删除该节点吗?")) {
return;
}
var url = "/servlet/MenuManage?operate=removeNode&menuid=" + menuid + "&upmenuid="+upmenuid;
var callback = ready;
executeXhr(callback, url);
var menuitem = eval("tree" + menuid);
menuitem.remove();
form1.menuid.value = "";
form1.menuname.value = "";
} else {
alert("请选择一个节点!");
}
}
function ready() {
if (req.readyState == 4) {
if (req.status == 200) {
if (req.responseText!="") {
alert(req.responseText);
}
} else {
alert("There was a problem retrieving the XML data:" + req.statusText);
}
}
}
function selectChange(i){
if(i==1){
form1.areaid.value="";
}
if(i==2){
form1.deptid.value="";
}
form1.action = "/manage/MenuEdit.jsp";
form1.submit();
}
</script>
<script src="../js/ajaxUtils.js"></script>