<!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">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>是否成功：</p>
                                <select name="isSuccess" th:with="type=${@dict.getType('sys_success')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>

                            <li>
                                <p>种类：</p>
                                <select name="form" th:with="type=${@dict.getType('wx_send_message_form')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>创建时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
                            </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">

            </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 successDict = [[${@dict.getType('sys_success')}]];//销售人员等级
        var messageForm = [[${@dict.getType('wx_send_message_form')}]];
        var prefix = ctx + "wxmessage";


        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "企业微信发送消息历史记录",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id', 
                    title : 'null',
                    visible: false
                },
                {
                    field : 'toUser', 
                    title : '发送给的用户',
                    width : '100px',
                    formatter:function (value, row, index) {
                        // return $.table.tooltip(value,15)
                        return '<div style="width: 300px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" title='+value+'>'+value+'</div>'
                    }
                },
                {
                    field : 'isSuccess', 
                    title : '是否发送成功',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(successDict, value);
                    },
                    width : '100px'
                },
                {
                    field : 'sendText', 
                    title : '发送的文本',
                    width : '200px'
                },
                    {
                        field : 'form',
                        title : '种类',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(messageForm, value);
                        },
                        width : '100px'
                    },
                {
                    field : 'type', 
                    title : '类型',
                    visible:false,
                    width : '100px'
                },
                {
                    field : 'createTime',
                    title : '创建时间',
                    width : '150px'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看</a> ');
                        return actions.join('');
                    },
                    width : '300px'
                }]
            };
            $.table.init(options);

            $('#date').datetimepicker({
                forceParse: 0,//设置为0，时间不会跳转1899，会显示当前时间。
                language: 'zh-CN',//显示中文
                format: 'yyyy-mm-dd',//显示格式
                minView: "month",//设置只显示到月份
                initialDate: new Date(),//初始化当前日期
                autoclose: true,//选中自动关闭
                todayBtn: true//显示今日按钮
            })
        });
    </script>
</body>
</html>