showdetailjob.jsp 11.3 KB
<%@page language="java" contentType="text/html;charset=utf-8" %>
<%@page import="com.ui.contants.ProjectConstant"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!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">
    <link rel="stylesheet" href="<%=basePath %>css/bootstrap.min.css"/>
    <link rel="stylesheet" href="<%=basePath %>css/unicorn.main.css"/>
    <link rel="stylesheet" href="<%=basePath %>css/unicorn.grey.css"/>
    <link rel="stylesheet" href="<%=basePath %>css/jquery-ui.css"/>
    <link rel="stylesheet" href="<%=basePath %>css/bootstrap-responsive.min.css"/>
    <link rel="stylesheet" href="<%=basePath %>css/uniform.css"/>
    <link rel="stylesheet" href="<%=basePath %>css/select2.css"/>
    <script src="<%=basePath %>js/excanvas.min.js" charset="UTF-8" type="text/javascript"></script>
    <script src="<%=basePath %>js/jquery-1.12.0.min.js" charset="UTF-8" type="text/javascript"></script>
    <script src="<%=basePath %>js/jquery-plugin/jquery.extend.js" charset="UTF-8" type="text/javascript"></script>
    <script src="<%=basePath %>js/jquery-ui.custom.js" charset="UTF-8" type="text/javascript"></script>
    <script src="<%=basePath %>/js/bootstrap.min.js"></script>
    <script src="<%=basePath %>/js/unicorn.js"></script>
    <script src="<%=basePath %>js/bootstrap-plugin/datetimepicker/moment-with-locales.js" charset="UTF-8"
            type="text/javascript"></script>
    <script src="<%=basePath %>js/bootstrap-plugin/datetimepicker/bootstrap-datetimepicker.js" charset="UTF-8"
            type="text/javascript"></script>
    <script src="<%=basePath %>js/global.js" charset="UTF-8" type="text/javascript"></script>
    <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.pagination.js" charset="UTF-8"
            type="text/javascript"></script>
    <script src="<%=basePath %>js/bootstrap-plugin/jsquartz/bootstrap.table.js" charset="UTF-8" type="text/javascript"></script>
    <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.dialog.js" charset="UTF-8" type="text/javascript"></script>
    <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.form.js" charset="UTF-8" type="text/javascript"></script>
    <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.panel.js" charset="UTF-8" type="text/javascript"></script>
    <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.alerts.js" charset="UTF-8" type="text/javascript"></script>
    <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.accordion.js" charset="UTF-8"
            type="text/javascript"></script>
    <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.breadcrumb.js" charset="UTF-8"
            type="text/javascript"></script>
    <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.validate.js" charset="UTF-8"
            type="text/javascript"></script>
    <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.form.js" charset="UTF-8" type="text/javascript"></script>
    <script src="<%=basePath %>js/layer/layer.js" charset="UTF-8" type="text/javascript"></script>
    <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.select.js" charset="UTF-8" type="text/javascript"></script>
    <script src="<%=basePath %>js/jstree/jstree.min.js"></script>
    <script src="<%=basePath %>js/jquery.toaster.js"></script>

    <script src="<%=basePath %>js/laydate/laydate.js" charset="UTF-8" type="text/javascript"></script>
    <script>
        var contextPath = '<%=basePath %>';
    </script>
</head>


<body>
<!-- 头部 -->
<div id="head">
</div>
<!-- 右侧具体内容 -->
<div id="content">
    <div class="container-fluid">
        <div class="widget-box">
            <div class="widget-content nopadding">

                <div id="showDetailDiv">
                    <div id="showDetailTable"></div>
                </div>

            </div>
        </div>
    </div>
</div>

<script src="<%=basePath %>script/common/genarate_left_panel.js?v=<%=ProjectConstant.MENU_VERSION %>"></script>
<script>
    $("#li_other").addClass("active open");
    $("#li_crm_job").addClass("active");
</script>
</body>
</html>


<script>
    $(function () {
        var currentPage=1;
        /*var args = new Object();
        args = GetUrlParms();*/
        var jobname1 ="${jobname}";
        var jobgroup1 = "${jobgroup}";
        var module1 = "${module}";

        var queryData = {}
        $("#showDetailDiv #showDetailTable").table(
            {
                url: contextPath+"/job/getJobProcessDetail.do",
                queryParams: {
                    "jobName": jobname1,
                    "jobGroup": jobgroup1,
                    "module": module1
                },
                dataType: "json",
                type: "POST",
                contentType: "application/json; charset=utf-8",
                currentPage: currentPage,
                title: "任务执行情况",
                panelClass: "panel-primary",
                striped: true,
                pagination: true,
                pageSize: 10,
                loadFilter: function (data) {
                    return data.data;
                },
                columns: [
                    {
                        title: "任务Id",
                        field: "jobId"

                    },
                    {
                        title: "任务名称",
                        field: "jobName"

                    },
                    {
                        title: "任务所属组",
                        field: "jobGroup"
                    },
                    {
                        title: "任务所属模块",
                        field: "module"
                    },
                    {
                        title: "调度器名称",
                        field: "schedulerName"
                    },
                    {
                        title: "调度器实例",
                        field: "schedulerInstanceId"
                    },
                    {
                        title: "执行结果",
                        field: "result"
                    },
                    {
                        title: "本次执行开始时间",
                        field: "startTime"
                    },
                    {
                        title: "本次执行结束时间",
                        field: "endTime"
                    },

                    {
                        title: "任务执行器",
                        field: "processor"
                    },
                    {
                        title: "任务执行上下文",
                        field: "context"
                    },
                    {
                        title: "附加信息",
                        field: "message",
                        formatter: function (value, rowData, rowIndex) {
                            var messageinfo = "";
                            if (typeof (rowData.message) == "string") {
                                if ((rowData.message).length > 200) {
                                    messageinfo = rowData.message
                                            .substring(0, 200)
                                        + "...";
                                } else {
                                    messageinfo = rowData.message;
                                }
                                return messageinfo;
                            }
                        }
                    },
                    {
                        title: "操作",
                        formatter: function (value, rowData, rowIndex) {
                            var div = $("<div>");

                           // if (rowData.status == 0) {//已暂停,可以开启
                                var openBtn = $("<button>").addClass(
                                    "btn btn-xs btn-success").html(
                                    "重新执行").appendTo(div);
                                div.append("&nbsp;");
                                openBtn.click(function () {//开启变为待执行状态
                                    retrySchedule(rowData, this,
                                        "确定重新执行吗", "确定重新执行任务么");
                                });
                          //  }
                            div.append("&nbsp;");
                            div.append("&nbsp;");
                            return div;
                        }
                    }]
            });
    });

    function retrySchedule(job, obj, title, meg) {

        var dialog = $("<div>").appendTo($("body"));
        var jobInfo ={
            "id" : job.jobId,
            "jobGroup" : job.jobGroup,
            "module" : job.module
        };
        dialog.dialog({
            title: title,
            backdrop: "static",
            content: meg,
            buttons: [{
                text: "否",
                className: "btn-danger",
                onclick: function () {
                    $(dialog).dialog("hide");
                }
            }, {
                text: "是",
                className: "btn-success",
                onclick: function () {
                    $(dialog).dialog("hide");
                    $.ajax({
                        url: contextPath+"/job/rescheduleJob.do",
                        type: 'post',
                        contentType: "application/json; charset=utf-8",
                        data: JSON.stringify(jobInfo),
                        dataType: "json",
                        success: function (data) {

                            if (!data || data.code != 200) {
                                var dialog = $("<div>").appendTo($("body"));
                                dialog.dialog({
                                    title: "重试失败",
                                    backdrop: "static",
                                    content: "重试失败",
                                    buttons: [{
                                        text: "确定",
                                        className: "btn-danger",
                                        onclick: function () {
                                            $(dialog).dialog("hide");
                                        }
                                    }]
                                });
                            }
                            $("#showDetailTable").table("load");
                        }
                    });
                }
            }]
        });
    }

   /* function GetUrlParms() {
        var args = new Object();
        var url = location.search.substring(1);//获取查询串
        var query = decodeURI(url);
        var pairs = query.split("&");//在处断开
        for (var i = 0; i < pairs.length; i++) {
            var pos = pairs[i].indexOf('=');//查找name=value
            if (pos == -1)
                continue;//如果没有找到就跳过
            var argname = pairs[i].substring(0, pos);//提取name
            var value = pairs[i].substring(pos + 1);//提取value
            args[argname] = unescape(value);//存为属性
        }
        return args;
    }*/
</script>