    <!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('同步解析日志列表')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse ">
                <form id="formId" class="form-horizontal m">
                    <div class="row">
                        <div class="form-group col-sm-5">
                            <label class="control-label col-sm-3">创建时间：</label>
                            <div class="input-daterange input-group col-sm-9">
                                <input type="text" class="input-sm form-control" id="datetimepicker-startTime" name="params[beginCreateTime]" placeholder="yyyy-MM-dd"/>
                                <span class="input-group-addon">到</span>
                                <input type="text" class="input-sm form-control" id="datetimepicker-endTime" name="params[endCreateTime]" placeholder="yyyy-MM-dd"/>
                            </div>
                        </div>
                        <div class="form-group col-sm-5">
                            <label class="control-label col-sm-2  ">类型：</label>
                            <div class="col-sm-7 ">
                                <select class="form-control " name="syncType" th:with="type=${@dict.getType('sync_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group col-sm-2 row ">
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </div>
                    </div>


                    <!--<div class="select-list">-->
                        <!--<ul>-->
                            <!--<li class="select-time">-->
                                <!--<p>创建时间：</p>-->
                                <!--<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCreateTime]"/>-->
                                <!--<span>-</span>-->
                                <!--<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endCreateTime]"/>-->
                            <!--</li>-->
                            <!--<li>-->
                                <!--<p>类型：</p>-->
                                <!--<select name="syncType" th:with="type=${@dict.getType('sync_type')}">-->
                                    <!--<option value="">所有</option>-->
                                    <!--<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
                                <!--</select>-->
                            <!--</li>-->
                            <!--<li>-->
                                <!--<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>-->
                                <!--<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>-->
                            <!--</li>-->
                        <!--</ul>-->
                    <!--</div>-->
                </form>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">

                <a class="btn btn-success" onclick="reSyncUser()" shiro:hasPermission="sync.synclog.resyncuser">
                    <i class="fa fa-repeat"></i> 重新解析DIY销售
                </a>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('sync:synclog:edit')}]];
        var removeFlag = [[${@permission.hasPermi('sync:synclog:remove')}]];
        var typeDatas = [[${@dict.getType('sync_type')}]];
        var prefix = ctx + "sync/synclog";

        $(function() {
            var options = {
                url: prefix + "/list",
                updateUrl: prefix + "/faildetail/{id}",
                modalName: "同步解析日志",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'packageId', 
                    title : '解析的包id',
                    visible: false
                },
                {
                    field : 'successCount', 
                    title : '成功条数'
                },
                {
                    field : 'faileCount', 
                    title : '失败条数'
                },
                {
                    field : 'totalCount', 
                    title : '总数'
                },
                {
                    field : 'createTime', 
                    title : '创建时间'
                },
                {
                    field : 'syncType',
                    title : '解析的类型',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(typeDatas, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.packageId + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        $("#datetimepicker-startTime").datetimepicker({
            format: 'yyyy-mm-dd',
            minView: "month",
            todayBtn:  true,
            autoclose: true,
            endDate : new Date(),
        }).on('changeDate', function(event) {
            event.preventDefault();
            event.stopPropagation();
            var startTime = event.date;
            $('#datetimepicker-endTime').datetimepicker('setStartDate', startTime);
        });
        $("#datetimepicker-endTime").datetimepicker({
            format: 'yyyy-mm-dd',
            minView: "month",
            todayBtn:  true,
            autoclose: true,
            endDate : new Date(),
        }).on('changeDate', function(event) {
            event.preventDefault();
            event.stopPropagation();
            var endTime = event.date;
            $("#datetimepicker-startTime").datetimepicker('setEndDate', endTime);
        });

        function reSyncUser(){

            $.ajax({
                url: ctx+"/sync/synclog/reSyncUser",
                type: "get"
            })
            $.modal.msgSuccess("解析已成功请稍后查看解析日志");
        }
    </script>
</body>
</html>