ReportTable.jsp 17.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
<%@ page import="weaver.general.Util" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<html>
<%
    String basePath = request.getContextPath() + "/static/";
    String candonext = (String) request.getParameter("candonext");
    String tableName = Util.null2String(request.getParameter("tableName"));
    String fieldName =  Util.null2String(request.getParameter("fieldName"));
    String modifys =  Util.null2String(request.getParameter("modifys"));
    String pageNumberS =  Util.null2String(request.getParameter("pageNumber"));
    if(pageNumberS.equals("")){
        pageNumberS="1";
    }
    int pageNumber=Integer.parseInt(pageNumberS);
%>
<head>
    <link href="/system/upgradetoe9/js/bootstrap/css/bootstrap.css" rel="stylesheet">
    <script src="/system/upgradetoe9/js/bootstrap/jquery-1.12.4.min.js"
            type="text/javascript"></script>
    <script src="/system/upgradetoe9/js/bootstrap/js/bootstrap.js"></script>
    <link href="/system/upgradetoe9/js/bootstrap/bootstrap-table.css" rel="stylesheet">
    <script src="/system/upgradetoe9/js/bootstrap/bootstrap-table.js"></script>
    <script src="/system/upgradetoe9/js/bootstrap/locale/bootstrap-table-zh-CN.js"></script>
    <script src="/system/upgradetoe9/js/bootstrap/colResizable-1.6.js"></script>
    <script src="/system/upgradetoe9/js/bootstrap/extensions/resizable/bootstrap-table-resizable.js"></script>
    <title> E-cology升级程序</title>
    <style type="text/css">
        .input-group {
            display: inline-table;
            width: 30%;
        }

        .input-group-addon {
            width: 120px;
        }

        th {
            background-color: bisque;
        }

        /*zhongyao */
        td,th{
            text-align: center;
            vertical-align: middle;
        }

        .table-hover > tbody > tr > td:nth-child(2), td:nth-child(4) {
            display: block;
            height: 61px;
            overflow: hidden;
            word-break: keep-all;
            text-overflow: ellipsis;
        }

        .table-hover > tbody > tr > td:nth-child(2), td:nth-child(3), td:nth-child(4) {
            text-align: left;
        }

        .table-hover > tbody > tr {
            height: 61px;
        }

        #mydialogall {
            word-break: break-all;
            white-space: pre-wrap;
            text-decoration: none;
        }

        #mytabdiv {
            table-layout: fixed;
            margin: 0 auto;
            text-align: center;
        }
    </style>
    <script>
        function exportExcel() {
            var tableName = $("#tableName").val();
            var fieldName = $("#fieldName").val();
            var modifys = "";
            $("#modifyRes").find("input:checkbox:checked").each(function (i) {
                var val = $(this).val();
                modifys = modifys + val + "-";
            });
            var url = "ReportDoExcel.jsp";
            $.ajax({
                url: url,
                async: true,
                data:{
                    tableName:tableName,
                    fieldName:fieldName,
                    modifys:modifys
                },
                success: function(){
                    document.getElementById("downiframe").src = "/system/upgradetoe9/report/weaverReport.zip";
                }
            });
        }
    </script>
</head>

<body style="height:100%;width:100%;">
<div id="modal1" class="modal fade" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">信息</h4>
            </div>
            <div class="modal-body">
                <p id="modal1content"></p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">确认</button>
            </div>
        </div>
    </div>
</div>
<br>


<div id="contont" style="margin:0 auto;width: 99%;height: 700px">
    <div style="font-size:18px;height:40px;line-height:40px;background-color:#f8f8f8;"><img
            style="height:40px;line-height:40px;float:left" src="./images/sysadmin_doc_wev8.png"></img><span
            style="height:40px;line-height:40px;float:left">&nbsp;&nbsp;迁移报告已生成,可在下表中搜索迁移结果</span></div>
    <div class="input-group" style="width: 250px;margin-top: 10px;margin-bottom: -30px;margin-right: 30px">
        <span class="input-group-addon">修改对象</span>
        <input type="text" class="form-control" name="tableName" id="tableName" value="<%=tableName%>"/>
    </div>
    <div class="input-group" style="width: 250px;margin-top: 10px;margin-bottom: -30px;margin-right: 30px">
        <span class="input-group-addon">相关字段</span>
        <input type="text" class="form-control" name="fieldName" id="fieldName" value="<%=fieldName%>"/>
    </div>
    <div class="input-group"
         style="width: 350px;margin-top: 0px;margin-bottom: 0px;margin-right: 0px;bottom: 12px;height: 34px;border: 1px solid #ccc;border-radius:3px"
         id="modifyRes">
        <span class="input-group-addon" style="border: 0px solid #ccc;border-right: 1px solid #ccc">修改结果</span>
        <label style="margin-top: 6px;margin-left: 15px">
            <input type="checkbox" value="0" <%if(modifys.contains("0")){ %>checked<%}%>/> 失败
        </label>
        <label style="margin-top: 6px;margin-left: 7px">
            <input type="checkbox" value="1" <%if(modifys.contains("1")){ %>checked<%}%> /> 成功
        </label>
        <label style="margin-top: 6px;margin-left: 7px">
            <input type="checkbox" value="2" <%if(modifys.contains("2")){ %>checked<%}%>/> 不修改</label>
    </div>
    <div class="input-group" style="float:right;margin-right:10px;margin-top: 10px;width:auto">
        <input type="button" class="btn btn-info"
               style="width:120px;background-color:#0070c1;float:right"
               onclick="javascript:exportExcel()" value="导出迁移报表">
        <input type="button" class="btn btn-info"
               style="width:85px;background-color:#0070c1;float:right;margin-right:20px"
               id="btn_add" value="查询">
    </div>

    <div id="mytabdiv" style="width:99%;height:90%;margin-top: -20px;">
        <table id="mytab" class="table-hover" style="width: 100%"></table>
    </div>
    <iframe name="excels" id="excels" src="" style="display:none"></iframe>
    <div class="modal fade" id="mydialogall">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header" id="mydialog"></div>
            </div>
        </div>
    </div>
</div>
<div id='labelText' style='color:black;line-height:1.2;white-space:nowrap;top:0px;left:0px;position:fixed;display:none;visibility:visible;'>

</div>
<iframe name="downiframe" id="downiframe" src="" style="display:none" ></iframe>
</body>
<script type="text/javascript">
    var mypageNumber;
    $(document).ready(function () {
        initall();
        //点击每页显示数
        $(document).on("click", ".page-list .btn-group .dropdown-menu li", function () {
            search();
        });
        $(document).on("mouseenter", ".table-hover > tbody > tr>td:nth-child(2),td:nth-child(4)", function (e) {
            var showDiv = $(this).html();
            $("body").append("<div class='div_toop'>" + showDiv + "</div>");//将要显示的内容添加到 新建 div标签中 并追加到 body 中
            showDiv = showDiv.substring(0,showDiv.length);
            $("#labelText").html(showDiv.replace('&nbsp;',''));
            var divwidth = 500;
            var labelwidth =$("#labelText").width();
            if(labelwidth>0){
                $(".div_toop").addClass("label label-info");
            }
            if(labelwidth==0){
                divwidth=0;
            }else if(labelwidth<440){
                divwidth = labelwidth+10;
            }
            $(".div_toop").css({
                "display": "block",
                "width": divwidth,
                "background-color": "#fff",
                "color":"#000",
                "fontWeight": "300",
                "word-break": "break-all",
                "white-space": "pre-wrap",
                "text-decoration": "none",
                "text-align":"left",
                //设置 div 内容位置
                "top": (e.pageY + 10) + "px",
                "position": "absolute",
                "left": (e.pageX - 100) + "px",
                "display":"none"
            });
            if(showDiv.replace('&nbsp;','').length>0){
                $(".div_toop").css({
                    "border":"solid 1px #000",
                });
                setTimeout(function(){
                    $(".div_toop").show("normal");
                },1500);
            }

        });
        $(document).on("mouseleave", ".table-hover > tbody > tr>td:nth-child(2),td:nth-child(4)", function (e) {
            $(".div_toop").remove();//移除对象
        });
        $(document).on("mousemove", ".table-hover > tbody > tr>td:nth-child(2),td:nth-child(4)", function (e) {
            $(".div_toop")
                .css({
                    //设置 div 内容位置
                    "top": (e.pageY + 10) + "px",
                    "position": "absolute",
                    "left": (e.pageX - 100) + "px"
                });
        });
        $(document).on("dblclick", ".table-hover > tbody > tr>td:nth-child(2),td:nth-child(4)", function (e) {
            $("#mydialog").html($(this).html());
            $("#mydialogall").modal("show");
        });


        $("#mytab").colResizable();
        resizeWin();
    });

    function resizeWin() {
        $(window).resize(function () {
            var tableName= $("#tableName").val().trim();
            var fieldName= $("#fieldName").val().trim();
            var modifys = "";
            $("#modifyRes").find("input:checkbox:checked").each(function (i) {
                var val = $(this).val();
                modifys = modifys + val + "-";
            });
            location.href="/system/upgradetoe9/ReportTable.jsp?tableName="+tableName+"&fieldName="+fieldName+"&modifys="+modifys+"&pageNumber="+mypageNumber;
        });
    }

    function initall() {
        var candonext = "<%=candonext%>";
        $(parent.document.getElementById("refreshbutton")).css("display", "none");
        if (candonext == "0") {
            $(parent.document.getElementById("nextbutton")).css("display", "");
            $(parent.document.getElementById("nextbutton")).attr("disabled", false);
        } else {
            $(parent.document.getElementById("nextbutton")).css("display", "none");
        }
        //初始化
        init();
        $("#mytabdiv").css("width", "99%");
		$(".fixed-table-body").css("overflow-x", "hidden");
    };

    //根据窗口调整表格高度
    $(window).resize(function () {
        $('#mytab').bootstrapTable('resetView', {});
        $("#mytabdiv").css("height", "60%");
    })

    function init() {
        //生成用户数据
        $('#mytab').bootstrapTable({
            method: 'get',
            url: "MigrationReportOperation.jsp",//要请求数据的文件路径
            toolbar: '#toolbar',                //工具按钮用哪个容器
            //表格高度
            striped: true,                      //是否显示行间隔色
            cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
            //设置为 true 会在表格底部显示分页条。
            pagination: true,
            sortable: false,                     //是否启用排序
            sortOrder: "asc",                   //排序方式
            sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)
            dataLocale: "zh-CN", //表格汉化
            pageNumber: 1,                       //初始化加载第一页,默认第一页
            pageSize: 10,                       //每页的记录行数(*)
            toolbarAlign: "right",
            pageList: [10],        //可供选择的每页的行数(*)
            //search: true,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
            strictSearch: true,
            // showColumns: true,                  //是否显示所有的列
            //showRefresh: true,                  //是否显示刷新按钮
            minimumCountColumns: 2,             //最少允许的列数
            clickToSelect: true,                //是否启用点击选中行
            //height:500,                        //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
            dataType: 'json',
            uniqueId: "id",                     //每一行的唯一标识,一般为主键列
            height: getHeight(),
            //是否显示刷新按钮
            showRefresh: false,
            //是否显示内容列下拉框。
            showColumns: false,
            //是否显示右上角的搜索搜索框
            search: false,
            pageNumber:<%=pageNumber%>,
            width: 2000,
            queryParams: function queryParams(params) {
                mypageNumber=this.pageNumber;
                var modifys = "";
                $("#modifyRes").find("input:checkbox:checked").each(function (i) {
                    var val = $(this).val();
                    modifys = modifys + val + "-";
                });
                var param = {
                    pageIndex: this.pageNumber,
                    pageSize: this.pageSize,
                    tableName: $("#tableName").val().trim(),
                    fieldName: $("#fieldName").val().trim(),
                    'myname': 'weaver@_ecolo',
                    'modifys': modifys,
                };
                return param;
            },

            strictSearch: true,
            // showColumns: true,                  //是否显示所有的列
            //showRefresh: true,                  //是否显示刷新按钮
            minimumCountColumns: 2,             //最少允许的列数
            clickToSelect: true,                //是否启用点击选中行
            //height:500,                        //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
            //uniqueId: "id",                     //每一行的唯一标识,一般为主键列
            // showToggle:true,                    //是否显示详细视图和列表视图的切换按钮
            // cardView: false,                    //是否显示详细视图
            // detailView: false,                   //是否显示父子表
            columns: [
                {
                    field: 'MODIFYTYPE',
                    title: '执行类型',
                    width: "10%",
                    valign: 'middle',
                }, {
                    field: 'MODIFYNAME',
                    title: '修改对象',
                    width: "15%",
                    valign: 'middle',
                }, {
                    field: 'MODIFYFIELDNAME',
                    title: '相关字段',
                    width: "10%",
                    valign: 'middle',
                }, {
                    field: 'MODIFYCONTENT',
                    title: '修改内容',
                    width: "30%",
                    valign: 'middle',
                }, {
                    field: 'MODIFYSTATUS',
                    title: '修改结果',
                    width: "10%",
                    valign: 'middle',
                }, {
                    field: 'TYPE',
                    title: '修改类型',
                    width: "10%",
                    valign: 'middle',

                }, {
                    field: 'ERRORLOG',
                    title: '错误信息',
                    width: "30%",
                    valign: 'middle',
                    visible: false

                }, {
                    field: 'MODIFYTIME',
                    title: '修改时间',
                    width: "15%",
                    valign: 'middle',
                }

            ],
            onPostBody: resizetd247,
        });
    }

    //获取table的高度
    function getHeight() {
        return $(window).height() - 233;
    }

    function resizetd247() {
        $(".table-hover > tbody > tr>td:nth-child(2),td:nth-child(4)").css("width", "100%");
        $(".page-number").bind("click", function () {
            search();
        });
        $(".page-first").bind("click", function () {
            search();
        });
        // 点击上一页
        $(".page-pre").bind("click", function () {
            search();
        });
        //点击下一页
        $(".page-next").bind("click", function () {
            search();
        });

        $(".page-last").bind("click", function () {
            search();
        });

        $(".table-hover > tbody > tr > td:nth-child(2), td:nth-child(4)").css("padding-top", "18px");

    }

    $("#btn_add").click(function () {
        $("#mytab").bootstrapTable('selectPage', 1);
        search();
    });

    function search() {
        $("#mytab").bootstrapTable('refresh');
    }
</script>
</html>