macro.vm 3.9 KB

#*自定义宏*#

##分页
#macro(showPage $page)
<input  type="hidden" name="currentPage" id="currentPage" value="${page.currentPage}"/>
#if($page != "")
<div>
    <ul class="pagination pull-right"  style="margin:0px;">
    	<li class="prev #if($page.isFirstPage())disabled#end" title="前一页">
    		#set ( $tmpCurr = $page.currentPage - 1 )
    		<a href="#if($page.isFirstPage())javascript:void(0)#else javascript:XUI.form.page(${tmpCurr},globalValidator)#end">
    			<i class="icon-double-angle-left"></i>
    		</a>
    	</li>
    	#foreach($index in $!{webUtils.pageSplit($page.currentPage,$page.pageCount,6)})
    		#set( $i = $index )
    		  <li #if($index == ($page.currentPage)) class="active" #end><a href="javascript:XUI.form.page($i,globalValidator)">$index</a></li>
    	#end
    	<li class="next #if($page.isLastPage())disabled#end" title="后一页">
    		#set ( $tmpCurr = $page.currentPage + 1 )
    		<a href="#if($page.isLastPage())javascript:void(0)#else javascript:XUI.form.page(${tmpCurr},globalValidator)#end">
    			<i class="icon-double-angle-right"></i>
    		</a>
    	</li>
    </ul>
</div>
<div style="float:right;">
    <span style="line-height: 33px;" class="pull-left">显示数量<select id="pageSize" name="pageSize" value="${page.pageSize}" onchange="$('#queryBtn').click()">
    		                                    #if(${page.pageSize}==10)
            										 <option value="10" selected >10</option>
            									#else
    												<option value="10">10</option>
    											#end
    											#if(${page.pageSize}==15)
            										 <option value="15" selected >15</option>
            									#else
    												<option value="15">15</option>
    										    #end
    											#if(${page.pageSize}==20)
            										 <option value="20" selected >20</option>
            									#else
    												<option value="20" >20</option>
    											#end
    										    #if(${page.pageSize}==25)
            										 <option value="25" selected >25</option>
            									#else
    												<option value="25">25</option>
												#end
												#if(${page.pageSize}==30)
            										 <option value="30" selected >30</option>
            									#else
    												<option value="30">30</option>
                                                #end
                                                #if(${page.pageSize}==40)
                                                     <option value="40" selected >40</option>
                                                #else
                                                    <option value="40">50</option>
                                                #end
                                                #if(${page.pageSize}==50)
                                                     <option value="50" selected >50</option>
                                                #else
                                                    <option value="50">50</option>
                                                #end
                                                #if(${page.pageSize}==100)
                                                     <option value="100" selected >100</option>
                                                #else
                                                    <option value="100">100</option>
                                                #end
    		                                </select>
									#set($currentPage=${page.currPage}+1)
    								 查询出<strong>${page.totalCount}</strong>条数据,共<strong>${page.pageCount}</strong>页,当前第<strong>${page.currentPage}</strong>页
    </span>
</div>
#end
#end


##排序
#macro(sorting $obj $field)
#if($obj && $obj.orderField == $field)
 class="sorting_$obj.orderFieldType" data-orderFieldType="$obj.orderFieldNextType" 
#else
 class="sorting" data-orderFieldType="DESC" 
#end
 data-orderField="$field" 
#end