<!DOCTYPE HTML> 
 | 
<html xmlns:th="http://www.thymeleaf.org"> 
 | 
<head> 
 | 
    <meta charset="utf-8"> 
 | 
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 
 | 
    <meta name="renderer" content="webkit|ie-comp|ie-stand"> 
 | 
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
 | 
    <meta name="viewport" 
 | 
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/> 
 | 
    <meta http-equiv="Cache-Control" content="no-siteapp"/> 
 | 
    <!-- 本框架基本脚本和样式 --> 
 | 
    <script type="text/javascript" 
 | 
            th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script> 
 | 
    <script type="text/javascript" th:src="@{/js/systools/MBase.js}"></script> 
 | 
    <title>异步任务</title> 
 | 
</head> 
 | 
<body class=" container-fluid"> 
 | 
  
 | 
<div class="pd-10"> 
 | 
    <!-- 搜索框部分start --> 
 | 
    <div class="row form-head"> 
 | 
        <div class="col-md-4 col-xs-12"> 
 | 
            <!-- 功能按钮部分 --> 
 | 
            <div class=""> 
 | 
                <button onclick="myGrid.delItems('id')" type="button" 
 | 
                        class="btn btn-danger btn-sm"> 
 | 
                    <i class="fa fa-trash"></i>批量删除 
 | 
                </button> 
 | 
                <button onclick="openAdd()" type="button" 
 | 
                        class="btn btn-success btn-sm"> 
 | 
                    <i class="fa fa-plus"></i> 新增 
 | 
                </button> 
 | 
            </div> 
 | 
        </div> 
 | 
        <!-- 功能按钮部分end --> 
 | 
        <div class="col-md-8 col-xs-12"> 
 | 
            <div class="row"> 
 | 
                <div class="col-md-11 col-xs-12" style="text-align: right"> 
 | 
                    <!-- 搜索框部分start --> 
 | 
                    <form class="form-inline" id="serchform"> 
 | 
                        <div class="input-group"> 
 | 
                            <div class="btn-group search-list " data-for="search-text"> 
 | 
                                <button type="button" 
 | 
                                        class="btn btn-default dropdown-toggle searchlist" 
 | 
                                        data-toggle="dropdown"> 
 | 
                                    任务名称<span class="caret "></span> 
 | 
                                </button> 
 | 
                                <ul class="dropdown-menu" role="menu"> 
 | 
                                    <li data-field="taskType"><a>任务名称</a></li> 
 | 
                                </ul> 
 | 
                            </div> 
 | 
                            <div class="form-group mr-20"> 
 | 
                                <input autocomplete="off"   id="search-text" name="taskType" placeholder="输入查询关键词" 
 | 
                                       type="text" class="form-control"> 
 | 
                            </div> 
 | 
                            <div class="form-group mr-20"> 
 | 
                                <button onclick="myGrid.serchData(1)" type="button" 
 | 
                                        class="btn btn-info"> 
 | 
                                    <i class="fa fa-search "></i> 搜索 
 | 
                                </button> 
 | 
                                <button type="reset" class="btn btn-info "> 
 | 
                                    <i class="fa fa-refresh "></i> 重置 
 | 
                                </button> 
 | 
                            </div> 
 | 
                        </div> 
 | 
                    </form> 
 | 
                </div> 
 | 
            </div> 
 | 
        </div> 
 | 
  
 | 
    </div> 
 | 
    <div class="row"> 
 | 
        <!-- 数据表格部分 --> 
 | 
        <table id="mgrid"> 
 | 
            <thead> 
 | 
            <tr> 
 | 
                <th data-checkbox="true"></th> 
 | 
                <th data-formatter="MGrid.indexfn" data-align="center" 
 | 
                    data-width="30px">序号 
 | 
                </th> 
 | 
                <th data-field="handler">处理类全路径</th> 
 | 
                <th data-field="taskType">任务名称</th> 
 | 
                <th data-field="beanUse">是否启用</th> 
 | 
                <th data-field="batchSize">批次大小</th> 
 | 
                <th data-field="startupDelay">延时启动</th> 
 | 
                <th data-field="appFactoryBean">是否运行</th> 
 | 
                <th data-align="center" data-width="150px" data-field="id" 
 | 
                    data-formatter="buidOperate">操作 
 | 
                </th> 
 | 
            </tr> 
 | 
            </thead> 
 | 
        </table> 
 | 
        <!-- 数据表格部分end --> 
 | 
    </div> 
 | 
</div> 
 | 
<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script> 
 | 
<script type="text/javascript"> 
 | 
    //定义表格对象 
 | 
    var myGrid; 
 | 
  
 | 
    $(function () { 
 | 
  
 | 
        var  delPath = basePath + "/developer/asyncConfiguration/del"; 
 | 
        //初始化表格对象 
 | 
        myGrid = MGrid.initGrid({ 
 | 
            url: basePath + "/developer/asyncConfiguration/list",//url数据加载地址,表格初始化后会自动去后台加载数据。 
 | 
            delUrl: delPath 
 | 
        }); 
 | 
  
 | 
    }); 
 | 
  
 | 
    //构建操作栏的按钮 
 | 
    function buidOperate(value, row, index) { 
 | 
        var html = []; 
 | 
        html[0] = '<a onClick="openEdit(\'' + value 
 | 
            + '\')"  title="编辑"  class="toolbar-operation">编辑</a>' 
 | 
  
 | 
        html[1] = '<a onClick="myGrid.delItem(\'' 
 | 
            + value 
 | 
            + '\')" title="删除"  class="toolbar-operation">删除</a>'; 
 | 
        // 根据当前任务的状态判断 
 | 
        var status = row.appFactoryBean; 
 | 
        if ('true' == status) { 
 | 
            html[2] = '<a onClick="runAsync(\'' 
 | 
                + value 
 | 
                + '\')" title="关闭"  class="toolbar-operation">关闭</a>'; 
 | 
        } else { 
 | 
            html[2] = '<a onClick="runAsync(\'' 
 | 
                + value 
 | 
                + '\')" title="开启"  class="toolbar-operation">开启</a>'; 
 | 
        } 
 | 
  
 | 
        return html.join(""); 
 | 
    } 
 | 
  
 | 
    runAsync = function (id) { 
 | 
        MTools.handleItem(basePath + "/developer/asyncConfiguration/run" 
 | 
            + "?id=" + id, "确认改变运行状态?", function () { 
 | 
            myGrid.serchData(); 
 | 
        }); 
 | 
    }; 
 | 
  
 | 
    //打开添加界面 
 | 
    function openAdd() { 
 | 
        layer.open({ 
 | 
            type: 2, 
 | 
            title: "添加生产者", 
 | 
            maxmin: true, 
 | 
            area: [MUI.SIZE_L, '500px'], 
 | 
            content: [basePath + '/developer/asyncConfiguration/toModify'] 
 | 
        }); 
 | 
    } 
 | 
  
 | 
    //打开编辑界面 
 | 
    function openEdit(id) { 
 | 
        layer.open({ 
 | 
            type: 2, 
 | 
            title: "编辑生产者", 
 | 
            area: [MUI.SIZE_L, '500px'], 
 | 
            maxmin: true, 
 | 
            content: [basePath + '/developer/asyncConfiguration/toModify?id=' 
 | 
            + id] 
 | 
        }); 
 | 
    } 
 | 
</script> 
 | 
</body> 
 | 
</html> 
 |