调整排序的一种方法

<%@ page contentType="text/html; charset=gb2312" %>
<%@ taglib uri="epmui.tld" prefix="epmui" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ page import="com.infohold.base.bean.ListBEAN"%>
<html>
<%
ListBEAN listBean = null;
if(request.getAttribute("list") != null) {	
	listBean = (ListBEAN)request.getAttribute("list");
}
int totalSize = 0;
int pageNo = 0;
int pageSize = 0;
if(listBean != null) {
	totalSize = listBean.getTotalSize();
	pageNo = listBean.getPageNo();
	pageSize = listBean.getPageSize();
}
%>
<head>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <jsp:include page="../../Share/head.jsp" flush="true"/>
    <title>外部单位管理</title>
</head>
	<script language="javascript">
	<!--
		function moveMenu(menuid,menuordernum,movetype,rowid){
			var num,prenum,premenuid,nextnum,nextmenuid,maxnum;
			document.getElementById("movetype").value = movetype;	
			num = parseInt(rowid);	
			if(movetype=="up"){
				
				if(num==1){
					alert("当前已经处于第一位!");
				}else{
					
					prenum = document.getElementById("menuorder_"+(num-1)).value;
					premenuid = document.getElementById("menuid_"+(num-1)).value;
					document.getElementById("premenuid").value = premenuid;
					document.getElementById("premenuordernum").value = prenum;
					document.getElementById("nowmenuid").value = menuid;
					document.getElementById("nowmenuordernum").value=menuordernum;
					$('mode').value="updateWbdwForOrder";
					document.getElementById("wbdwform").submit();
				}
			}else{
				maxnum = parseInt(document.getElementById("totalMenus").value);
				if(num>=maxnum){
					alert("已经处于最后了!");
				}else{
					nextnum = document.getElementById("menuorder_"+(num+1)).value;
					nextmenuid = document.getElementById("menuid_"+(num+1)).value;
					document.getElementById("nextmenuid").value = nextmenuid;
					document.getElementById("nextmenuordernum").value = nextnum;
					document.getElementById("nowmenuid").value = menuid;
					document.getElementById("nowmenuordernum").value = menuordernum;
					$('mode').value="updateWbdwForOrder";
					document.getElementById("wbdwform").submit();
				}
			}
		}
	
// --></script>
<script type="text/javascript">
    function gotoadd() {
        location.href = '/comminfo/wbdw/wbdw_add.jsp';
    }
    function todel(thisform) {
     selectcount = getNamedCheckBoxCheckedCount(wbdwform, wbdwform.id, "id");
        if (selectcount == 0) {
            alert("请先选择最少一条你要删除的信息。");
        } else {
            //window.location.href="gzjhzjdetailshow.do?info_type=1&jhzj_bh="+bh;
            if (confirm('你确定要删除选定的记录?')) {
                thisform.mode.value = "dealAction";
                thisform.submit();
            }
            ;
        }
    }
    
    
    function toedit(thisform) {           
       selectcount = getNamedCheckBoxCheckedCount(wbdwform, wbdwform.id, "id");
        if (selectcount == 0) {
            alert("请先选择一条你要进行修改的条目。");
        } else if (selectcount > 1) {
            alert("一次只能选择一条信息进行修改。");
        } else {
            thisform.mode.value = "modifyPage";
            thisform.submit();
        }
        
    }
</script>

<body >
<html:form action="/wbdwAction.do" method="post">
	<input type="hidden" name="mode" >
    <table class="wtable" cellspacing="0" cellpadding="0" width="100%">
        <tr>
            <td valign="top">
<table class="vwTable" width="100%">
                    <tr class="main_tr1" height="24">
                        <td align="left" class="main_td">
                            <b><font class="Top_font2">&nbsp;&nbsp; 当前位置:外部单位管理</font></b>
                        </td>
                    </tr>
                </table>
                <table class="vwTable" cellspacing="0" cellpadding="0" width="100%">
                    <tr class="main_tr2" height=26>
                        <td colspan="2">    &nbsp;&nbsp;
                            <html:button property="button" styleClass="button_s" value="新 增" οnclick="gotoadd()"/>
                            <html:button property="button" styleClass="button_s" value="修 改"
                                         οnclick="toedit(this.form)"/>
                            <html:button property="button" styleClass="button_s" value="删 除"
                                         οnclick="todel(this.form)"/>
                        </td>
                    </tr>
                </table>
                <br>
                <table class="vwTable" border="1">
                    <tr class='MToolBar'>
                        <td width="4%" class="main_td"><div align="center">&nbsp;&nbsp;</div></td>
                        <td class="main_td"><div align="center">外部单位名称</div></td>
                        <td width="32%" class="main_td"><div align="center">操作</div>
                       <html:hidden name="wbdwform" property="totalMenus"/>
                        </td>
                    </tr>
                    
                     <logic:iterate id="row" name="list" property="list" indexId="rowid">
                        <tr class="list_tr" >
                            <td class="main_td" align="center"><html:multibox name="wbdwform" property="id" styleClass="cb">
                            	<bean:write name="row" property="id"/>
                            </html:multibox></td>
                            
                            <td align="center"  class="main_td" >
                     
                            <input type="hidden" name="menuorder_<%=rowid+1%>" id="menuorder_<%=rowid+1%>" value="<bean:write name="row" property="xh" />">
                            <input type="hidden" name="menuid_<%=rowid+1%>" id="menuid_<%=rowid+1%>"
                             value="<bean:write name="row" property="id" />">
                             <bean:write name="row" property="mc" />
                            </td>
                            <td class="main_td" align="center" >
                            <input type="button" class="button_s"  value="上 移"
                                         onClick="moveMenu('<bean:write name="row" property="id" />','<bean:write name="row" property="xh" />','up','<%=rowid+1%>');" />
                             <input type="button" class="button_s" value="下 移"
                                   onClick="moveMenu('<bean:write name="row" property="id" />','<bean:write name="row" property="xh" />','down','<%=rowid+1%>');" /> </td>
                        </tr>
                    </logic:iterate>
               <epmui:epmNavigation form="wbdwform" totalSize="<%=totalSize%>" pageSize="<%=pageSize%>" pageNo="<%=pageNo%>" imagepath="<%=request.getContextPath()%>"></epmui:epmNavigation>
                </table>
              <iframe name="ChildFrame" width="0" height="0"></iframe>
            </td>
        </tr>
    </table>
    <input type="hidden" name="moveflag" id="moveflag" value="1">
	<input type="hidden" name="movetype" id="movetype">
	<input type="hidden" name="premenuid" id="premenuid">
	<input type="hidden" name="premenuordernum" id="premenuordernum">
	<input type="hidden" name="nowmenuid" id="nowmenuid">
	<input type="hidden" name="nowmenuordernum" id="nowmenuordernum">
	<input type="hidden" name="nextmenuid" id="nextmenuid">
	<input type="hidden" name="nextmenuordernum" id="nextmenuordernum">
</html:form>

</body>
</html>

 

 

action:部分

 

public ActionForward updateWbdwForOrder(ActionMapping mapping, ActionForm form,
				HttpServletRequest request, HttpServletResponse response)
				throws Exception {
				WbdwForms wbdwform = (WbdwForms)form;
				String moveflag = wbdwform.getMoveflag();
				String movetype = wbdwform.getMovetype();
				String changeid ="";
				String changexh ="";
				String nowid ="";
				String nowxh="";
					
				if("1".equals(moveflag)){
					if("up".equals(movetype)){
						 nowid = wbdwform.getNowmenuid();
						 nowxh =wbdwform.getNowmenuordernum();
						 changeid= wbdwform.getPremenuid();
						 changexh = wbdwform.getPremenuordernum();
					}else{
						 nowid = wbdwform.getNowmenuid();
						 nowxh =wbdwform.getNowmenuordernum();
						 changeid= wbdwform.getNextmenuid();
						 changexh = wbdwform.getNextmenuordernum();
					}
				}
				service.updateWbdwForOrder(nowid, nowxh, changeid, changexh);
				return mapping.findForward("towbdw");// Constant.Error-出错页面,Constant.info-程序
			
		}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值