列表

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<!-- 導入jquery核心類庫 -->
<script type="text/javascript"
    src="${pageContext.request.contextPath }/js/jquery-1.8.3.js"></script>
<!-- 導入easyui類庫 -->
<link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath }/js/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath }/js/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath }/js/easyui/ext/portal.css">
<link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath }/css/default.css">    
<script type="text/javascript"
    src="${pageContext.request.contextPath }/js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript"
    src="${pageContext.request.contextPath }/js/easyui/ext/jquery.portal.js"></script>
<script type="text/javascript"
    src="${pageContext.request.contextPath }/js/easyui/ext/jquery.cookie.js"></script>
<script
    src="${pageContext.request.contextPath }/js/easyui/locale/easyui-lang-zh_CN.js"
    type="text/javascript"></script>
<!-- 導入ztree類庫 -->
<link rel="stylesheet"
    href="${pageContext.request.contextPath }/js/ztree/zTreeStyle.css"
    type="text/css" />
<script
    src="${pageContext.request.contextPath }/js/ztree/jquery.ztree.all-3.5.js"
    type="text/javascript"></script>    
<script type="text/javascript">
    $(function(){
        // 受權樹初始化
        var setting = {
            data : {
                key : {
                    title : "t"
                },
                simpleData : {
                    enable : true
                }
            },
            check : {//啓用ztree插件勾選效果 
                enable : true,
            }
        };
        
        $.ajax({
            url : '${pageContext.request.contextPath}/functionAction_list.action',
            type : 'POST',
            dataType : 'text',
            success : function(data) {
                var zNodes = eval("(" + data + ")");
                $.fn.zTree.init($("#functionTree"), setting, zNodes);
            },
            error : function(msg) {
                alert('樹加載異常!');
            }
        });
        
        // 點擊保存
        $('#save').click(function(){
            var v = $("#roleForm").form("validate");
            if(v){
                //在提交表單以前,使用ztree提供的方式獲取選中的節點
                var treeObj = $.fn.zTree.getZTreeObj("functionTree");//得到ztree對象
                var nodes = treeObj.getCheckedNodes(true);//在提交表單以前將選中的checkbox收集
                var array = new Array();
                for(var i=0;i<nodes.length;i++){
                    var id = nodes[i].id;
                    array.push(id);
                }
                var ids = array.join(",");
                //在提交表單以前,將ids字符串賦值給隱藏域
                $("input[name=functionIds]").val(ids);
                $("#roleForm").submit();
            }
        });
    });
</script>    
</head>
<body class="easyui-layout">
        <div region="north" style="height:31px;overflow:hidden;" split="false" border="false" >
            <div class="datagrid-toolbar">
                <a id="save" icon="icon-save" href="#" class="easyui-linkbutton" plain="true" >保存</a>
            </div>
        </div>
        <div region="center" style="overflow:auto;padding:5px;" border="false">
            <form id="roleForm" method="post" action="{pageContext.request.contextPath}/roleAction_save.action">
                <input type="hidden" name="functionIds">
                <table class="table-edit" width="80%" align="center">
                    <tr class="title">
                        <td colspan="2">角色信息</td>
                    </tr>
                    <tr>
                        <td width="200">關鍵字</td>
                        <td>
                            <input type="text" name="code" class="easyui-validatebox" data-options="required:true" />                        
                        </td>
                    </tr>
                    <tr>
                        <td>名稱</td>
                        <td><input type="text" name="name" class="easyui-validatebox" data-options="required:true" /></td>
                    </tr>
                    <tr>
                        <td>描述</td>
                        <td>
                            <textarea name="description" rows="4" cols="60"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td>受權</td>
                        <td>
                            <ul id="functionTree" class="ztree"></ul>
                        </td>
                    </tr>
                    </table>
            </form>
        </div>
</body>
</html>javascript

 

 

 

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<!-- 導入jquery核心類庫 -->
<script type="text/javascript"
    src="${pageContext.request.contextPath }/js/jquery-1.8.3.js"></script>
<!-- 導入easyui類庫 -->
<link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath }/js/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath }/js/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath }/js/easyui/ext/portal.css">
<link rel="stylesheet" type="text/css"
    href="${pageContext.request.contextPath }/css/default.css">    
<script type="text/javascript"
    src="${pageContext.request.contextPath }/js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript"
    src="${pageContext.request.contextPath }/js/easyui/ext/jquery.portal.js"></script>
<script type="text/javascript"
    src="${pageContext.request.contextPath }/js/easyui/ext/jquery.cookie.js"></script>
<script
    src="${pageContext.request.contextPath }/js/easyui/locale/easyui-lang-zh_CN.js"
    type="text/javascript"></script>    
<script type="text/javascript">
    $(function(){
        $("body").css({visibility:"visible"});
        // 註冊按鈕事件
        $('#reset').click(function() {
            $('#form').form("clear");
        });
        // 註冊全部下拉控件
        $("select").combobox( {
            width : 155,
            listWidth : 180,
            editable : true
        });
        // 註冊ajax查詢
        $('#ajax').click(function() {
            var elWin = $("#list").get(0).contentWindow;
            elWin.$('#grid').datagrid( {
                pagination : true,
                url : "${pageContext.request.contextPath}/json/users.json"
            });
        });
    });
</script>    
</head>
<body class="easyui-layout" style="visibility:hidden;">
    <div region="east" title="查詢條件" icon="icon-forward" style="width:180px;overflow:auto;" split="false" border="true" >
        <div class="datagrid-toolbar">    
            <a id="reset" href="#" class="easyui-linkbutton" plain="true" icon="icon-reload">重置</a>
        </div>
        
        <form id="form" method="post" >
            <table class="table-edit" width="100%" >                
                <tr><td>
                    <b>用戶名</b><span class="operator"><a name="username-opt" opt="all"></a></span>
                    <input type="text" id="username" name="username"/>
                </td></tr>
                <tr><td>
                    <b>性別</b><span class="operator"><a name="gender-opt" opt="all"></a></span>
                    <select id="gender" name="gender" >
                        <option value=""></option>
                        <option value="0">女</option>
                        <option value="1">男</option>
                    </select>
                </td></tr>
                <tr><td>
                    <b>生日</b><span class="operator"><a name="birthday-opt" opt="date"></a></span>
                    <input type="text" id="birthday" name="birthday" value="1977-11-11" class="easyui-datebox" /><br/>
                    <input type="text" id="_birthday2" name="_birthday2" value="1988-11-11" class="easyui-datebox" />
                </td></tr>css

            </table>
        </form>
        
        <div class="datagrid-toolbar">    
            <a id="ajax" href="#" class="easyui-linkbutton" plain="true" icon="icon-search">查詢</a>
        </div>
    </div>
    <div region="center" style="overflow:hidden;" border="false">
        <iframe id="list" src="${pageContext.request.contextPath }/page_admin_userlist.action" scrolling="no" style="width:100%;height:100%;border:0;"></iframe>
    </div>
</body>
</html>html

相關文章
相關標籤/搜索