table.jsp 6.63 KB
<%@page language="java" contentType="text/html;charset=utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<div id="breadcrumb">
    <a href="#" title="Go to Home" class="tip-bottom"><i
            class="icon-home"></i> Home</a> <a href="#" class="current">Tables</a>
</div>

<div class="container-fluid">
    <div class="widget-box">
        <div class="widget-title">
            <h5>Dynamic table</h5>
        </div>
        <!-- 树 -->
        <div style="margin-top: 45px; float: left;margin-top: 54px;border: dashed;width: 300px;color: #D3D3D3;height: 580px;">
            <div class="widget-title">
                <h5>Tree Title</h5>
            </div>
            <div class="tree_container" style="height: 560px;color: black;overflow:auto">
                <div id="jstree" class="jstree jstree-default" role="tree" aria-multiselectable="true"
                     tabindex="0"></div>
            </div>
        </div>
        <!-- 列表 -->
        <div class="widget-content nopadding" style="margin-left: 300px;">
            <div class="widget-title" style="height: 53px;">
                <div>
                    <div class="form-inline" role="form" id="inBoxQueryDiv"
                         style=" margin-top: 12px;margin-left: 25px;float: left;">
                        <div class="input-group" style="float: left;">
                            <span class="input-group-addon">IP:</span>
                            <input type="text" id="" class="form-control" placeholder=""/>
                        </div>
                        <div class="input-group" style="float: left;">
                            <span class="input-group-addon">IP:</span>
                            <input type="text" id="" class="form-control" placeholder=""/>
                        </div>
                        <button id="submit" class="btn btn-default">搜索</button>
                    </div>
                    <button id="addBtn" class="btn btn-primary" style="margin-top: 12px;margin-left: 500px;">新增</button>
                </div>
            </div>
            <div id="table"></div>
        </div>
    </div>
</div>
<script>
    $(function () {
        var data = [];
        for (var i = 0; i < 20; i++) {
            data.push({
                moName: i,
                moHostIp: "用户" + i,
                moType: i % 3 == 0 ? 0 : 1,
                moStatus: "normal"
            });
        }
        $("#table").table({
            striped: true,
            panelClass: "panel-success",
            pagination: true,
            columns: [{
                title: "监控网元",
                field: "moName"
            }, {
                title: "主机地址",
                field: "moHostIp"
            }, {
                title: "网元类型",
                field: "moType"
            }, {
                title: "网元状态",
                field: "moStatus"
            }, {
                title: "操作",
                formatter: function (value, rowData, rowIndex) {
                    var div = $("<div>");
                    var editBtn = $("<button>").addClass("btn btn-inverse btn-mini").html("修改").appendTo(div);
                    //修改
                    editBtn.click(function () {
                        editTemplate(rowData.inboxTemplateId);
                    });
                    div.append("&nbsp;");
                    var delBtn = $("<button>").addClass("btn btn-danger btn-mini").html("删除").appendTo(div);
                    delBtn.click(function () {

                    });
                    return div;
                }
            }],
            data: data
        });

    });

</script>

<script type="text/javascript" src="<%=basePath %>/script/yoho.type.tree.js"></script>


<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 300px">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="myModalLabel">
                    添加类型
                </h4>
            </div>
            <div class="modal-body">
                <div id="modal_type_add">
                    <div class="input-group" style="padding-bottom: 5px">
                        <span class="input-group-addon" style="width: 100px">父节点:</span>
                        <input type="text" id="tx_new_type_parent" width="50" readonly="true" class="form-control"
                               placeholder=""/>
                    </div>
                    <div class="input-group" style="padding-bottom: 5px">
                        <span class="input-group-addon" style="width: 100px">Name:</span>
                        <input type="text" id="tx_new_type_name" width="50" class="form-control" placeholder=""/>
                    </div>
                    <div class="input-group" style="padding-bottom: 5px">
                        <span class="input-group-addon" style="width: 100px">子节点:</span>
                        <input type="checkbox" id="cb_new_type_isleaf" style="margin-left: 30px" name="appName"
                               value="JAVA">
                    </div>
                </div>
                <div id="modal_type_update">
                    <div class="input-group" style="padding-bottom: 5px">
                        <span class="input-group-addon" style="width: 100px">原名称:</span>
                        <input type="text" id="tx_update_type_name_old" readonly="true" class="form-control"
                               placeholder=""/>
                    </div>
                    <div class="input-group" style="padding-bottom: 5px">
                        <span class="input-group-addon" style="width: 100px">新名称:</span>
                        <input type="text" id="tx_update_type_name_new" class="form-control" placeholder=""/>
                    </div>
                </div>
                <div id="modal_type_del">
                    确认删除该类型节点?
                </div>
            </div>
            <div class="modal-footer">
                <input type="hidden" id="tx_type_action"/>
                <input type="hidden" id="tx_type_id"/>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" id="btn4type" class="btn btn-primary">确认</button>
            </div>
        </div>
    </div>
</div>