list.vm 17.3 KB
#set($page_title="列表")
#set($crumbs="首页:/home,列表")

##详情
#set($url_show = "/resource/show.do")
##查询地址
#set($url_list = "/resource/list.do")
##添加
#set($url_save = "/resource/preSave.do")
##删除
#set($url_del = "/resource/del.do")
#set($url_batch_del = "/resource/delBatch.do")
##启用/禁用
#set($url_enable = "/resource/action.do")

<div class="row">
    <div class="col-xs-12">

        <div class="table-header">
            列表
        </div>

        <div class="table-responsive">
            <div id="sample-table-2_wrapper" class="dataTables_wrapper" role="grid">
                <div class="row">
                    <div class="col-sm-6" style="width:100%">
                        <div id="sample-table-2_length" class="">
                            <form action="$url_list" id="form" method="get">
                                <input type="hidden" name="currPage" value="0" />
                                <div class="row">

                                <div class="col-xs-4">
                                    <div class="form-group">
                                        <label class="col-xs-3 control-label text-right">显示数量: </label>
                                        <div class="col-xs-9">
                                            #selectCount($!{model.query.pageSize})
                                        </div>
                                    </div>
                                </div>


                                        <div class="col-xs-4">
                                            <div class="form-group">
                                                <label class="col-xs-3 control-label text-right">资源名称: </label>
                                                <div class="col-xs-9">
                                                    <input type="text" name="param[resourceName]" value="$!{model.query.param.resourceName}" class="form-control"/>
                                                </div>
                                            </div>
                                        </div>

                                        ##<div class="col-xs-4">
                                        ##    <div class="form-group">
                                        ##        <label class="col-xs-3 control-label text-right">资源描述: </label>
                                        ##        <div class="col-xs-9">
                                        ##            <input type="text" name="param[description]" value="$!{model.query.param.description}" class="form-control"/>
                                        ##        </div>
                                        ##    </div>
                                        ##</div>

                                        <div class="col-xs-4">
                                            <div class="form-group">
                                                <label class="col-xs-3 control-label text-right">URL: </label>
                                                <div class="col-xs-9">
                                                    <input type="text" name="param[url]" value="$!{model.query.param.url}" class="form-control"/>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                	<div class="row">
                                        <div class="col-xs-4">
                                            <div class="form-group">
                                                <label class="col-xs-3 control-label text-right">后台系统: </label>
                                                <div class="col-xs-9">
						                           <select id="form-field-3" name="param[navbarId]" value="$!{model.query.param.navbarId}" class="form-control">
						                           		<option value>-请选择-</option>
						                           #foreach($navbar in $navbars)
						                           		<option value="$navbar.id" #if($navbar.id == $!{model.query.param.navbarId}) selected #end>$navbar.projectName</option>
						                           #end
						                        	</select>
						                        </div>
                                            </div>
                                        </div>
                                        <div class="col-xs-4">
                                            <div class="form-group">
                                                <label class="col-xs-3 control-label text-right">类型: </label>
                                                <div class="col-xs-9">
                                                	<select name="param[type]" value="$!{model.query.param.type}" class="form-control">
                                                		<option value>-请选择-</option>
                                                		<option value="1" #if(1 == $!{model.query.param.type}) selected #end>URL</option>
                                                		<option value="2" #if(2 == $!{model.query.param.type}) selected #end>API</option>
                                                		<option value="3" #if(3 == $!{model.query.param.type}) selected #end>FRAGEMENT</option>
                                                	</select>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="col-xs-4">
                                            <div class="form-group">
                                                <label class="col-xs-3 control-label text-right">状态: </label>
                                                <div class="col-xs-9">
                                                	<select name="param[status]" value="$!{model.query.param.status}" class="form-control">
                                                		<option value>-请选择-</option>
                                                		<option value="1" #if(1 == $!{model.query.param.status}) selected #end>启用</option>
                                                		<option value="0" #if(0 == $!{model.query.param.status}) selected #end>停用</option>
                                                		<option value="2" #if(2 == $!{model.query.param.status}) selected #end>未认领</option>
                                                	</select>
                                                </div>
                                            </div>
                                        </div>

                                        ##<div class="col-xs-4">
                                        ##    <div class="form-group">
                                        ##        <label class="col-xs-3 control-label text-right">创建时间: </label>
                                        ##        <div class="col-xs-9">
                                        ##             <input type="text" name="param[created]"  readonly="readonly"
				                        ##               class="form-control  form-time"
				                        ##               onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
				                        ##               value="$!{model.query.param.created}"
				                        ##               id="created"/>
                                        ##            
                                        ##        </div>
                                        ##    </div>
                                        ##</div>
									
                                        ##<div class="col-xs-4">
                                        ##    <div class="form-group">
                                        ##        <label class="col-xs-3 control-label text-right">修改时间: </label>
                                        ##        <div class="col-xs-9">
                                        ##             <input type="text" name="param[modified]"  readonly="readonly"
			                            ##           class="form-control  form-time"
			                            ##           onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"
			                            ##           value="$!{model.query.param.modified}"
			                            ##           id="modified"/>
                                        ##            
                                        ##        </div>
                                        ##    </div>
                                        ##</div>
									
                                        <div class="col-xs-4">
                                            <div class="form-group">
                                                <label class="col-xs-3 control-label text-right">方法: </label>
                                                <div class="col-xs-9">
                                                	<select name="param[method]" value="$!{model.query.param.method}" class="form-control">
                                                		<option value>-请选择-</option>
                                                		<option value="GET" #if("GET" == $!{model.query.param.method}) selected #end>GET</option>
                                                		<option value="POST" #if("POST" == $!{model.query.param.method}) selected #end>POST</option>
                                                		<option value="DELETE" #if("DELETE" == $!{model.query.param.method}) selected #end>DELETE</option>
                                                		<option value="PUT" #if("PUT" == $!{model.query.param.method}) selected #end>PUT</option>
                                                	</select>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                <div class="clearfix">
                                    <span class="pull-right">
                                        <input type="submit" value="查询结果" >
                                        <input type="button" value="重置条件" onclick="cleanForm('form');">
                                    </span>
                                </div>

                            </form>
                        </div>
                    </div>
                </div>
                <form action="$url_batch_del" method="post">
                <table id="sample-table-2" class="table table-striped table-bordered table-hover dataTable" aria-describedby="sample-table-2_info">
                    <thead>
                    <tr role="row">
                            <th>
                                <input type="checkbox" id="selectAll">
                            </th>
                            <th>资源名称</th>
##                            <th>资源描述</th>
                            <th>模块</th>
                            <th>URL</th>
                            <th>类型</th>
                            <th>状态</th>
##                            <th>创建时间</th>
##                            <th>修改时间</th>
                            <th>方法</th>
                        <th><i class="icon-time bigger-110 hidden-480"></i>操作</th>
                    </tr>
                    </thead>


                    <tbody role="alert" aria-live="polite" aria-relevant="all">
                    #foreach($obj in $!{model.list})
                    <tr>
                        <td>
                            <input type="checkbox" name="ids" value="$!{obj.id}"/>
                        </td>
                        <td>
                            <span title="$!{obj.description}">
                            $!{obj.resourceName}
                            </span>
                        </td>
##                        <td>
##                            $!{obj.description}
##                        </td>
                        <td>
                            $!{obj.navbar.projectName}
                        </td>
                        <td>
                            $!{obj.url}
                        </td>
                        <td>
                            #if($!{obj.type} == 2) API #elseif($!{obj.type} == 3) FRAGEMENT #else URL #end
                        </td>
                        <td>
                            #if($!{obj.status} == 0)停用#else
                                #if($!{obj.status} == 2)
                                    未认领
                                #else
                                启用
                                #end
                            #end
                        </td>
##                        <td>
##                        	$!{dateFormatUtils.format($!{obj.created},"yyyy-MM-dd HH:mm:ss")}
##                        </td>
##                        <td>
##                        	$!{dateFormatUtils.format($!{obj.modified},"yyyy-MM-dd HH:mm:ss")}
##                        </td>
                        <td>
                            $!{obj.method}
                        </td>
                        <td>
                            <div class="action-buttons">
                            	<a class="green" href="${url_show}?id=${obj.id}">
                                    <i class="fa fa-pencil "></i>查看
                                </a>
                                <a class="green" href="${url_save}?id=${obj.id}">
                                    <i class="fa fa-pencil "></i>修改
                                </a>

                            #if(${obj.status}==2)
                                <a class="blue" href="${url_enable}?id=${obj.id}&enable=1" onclick="return confirm('确定要认领!');">
                                    <i class="fa fa-trash  "></i>认领
                                </a>
                            #elseif(${obj.status}==0)
                                <a class="blue" href="${url_enable}?id=${obj.id}&enable=1" onclick="return confirm('确定要启用!');">
                                    <i class="fa fa-trash  "></i>启用
                                </a>
                            #else
                                <a class="red" href="${url_enable}?id=${obj.id}&enable=0" onclick="return confirm('确定要禁用!');">
                                    <i class="fa fa-trash  "></i>禁用
                                </a>
                            #end
                            #if(${obj.status}!=2)
                            <a class="blue" href="${url_enable}?id=${obj.id}&enable=2" onclick="return confirm('确定要取消认领?');">
                                <i class="fa fa-trash  "></i>取消认领
                            </a>
                            #end
                                <a class="red" href="${url_del}?id=${obj.id}" onclick="return confirm('确定要删除!删除后将不可恢复!');">
                                    <i class="fa fa-trash  "></i>删除
                                </a>
                            </div>
                        </td>

                    </tr>
                    #end
                    </tbody>
                </table>
                <div class="row">
                    <div class="col-sm-6">
                        <input  type="submit" value="批量删除"class="btn btn-danger btn-sm ">
                        <a  href="$url_save" class="btn btn-success btn-sm ">添加</a>
##                        <a diliAnchor="批量删除" diliAnchorTxt="批量删除" href="$url_save" class="btn btn-success btn-sm ">添加</a>
                    </div>
                    <div class="col-sm-6">
                        <div class="dataTables_paginate paging_bootstrap">
                            <div class="pull-right">
                                #page($!{model.totalPage},$!{model.currPage})
                            </div>
                            <span class="pull-right" style="line-height: 33px;">
                                #set($tmpPage = $model.currPage + 1)
                                查询出$!{model.totalSize}条数据,共$!{model.totalPage}页,当前第$!{tmpPage}页
                            </span>
                        </div>
                    </div>
                </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    jQuery(function($) {

        $('table th input:checkbox').on('click' , function(){
            var that = this;
            $(this).closest('table').find('tr > td:first-child input:checkbox')
                    .each(function(){
                        this.checked = that.checked;
                        $(this).closest('tr').toggleClass('selected');
                    });

        });
    })
    
      function cleanForm(id) {
		var form = $("#" + id);
		
		form.find("input[type=text]").each(function() {
			var obj = $(this);
			obj.val("");
		});
		
		form.find("select").each(function() {
			var obj = $(this);
			obj.val("20");
		});
		
		
		$("input[class='form-control  form-time']").each(function() {
			var obj = $(this);
			obj.val("");
		});
	}
	
</script>

<script src="$!{webUtils.getAssetsPath("/ace1.3/assets/js/diligrp.form.js")}"></script>
<script src="$!{webUtils.getAssetsPath('/date/WdatePicker.js')}"></script>