<div class="panel-body" style="margin-top: -25px">
    <form id="query_form" class="form-inline">
        <input id="query_reset" type="reset" style="display:none;"/>
        <#list pageTemplate.tableQuery as block>
        <#if block.blockType =="InputBlock">
        <div class="input-group" style="padding-top: 10px">
            <span class="input-group-addon">${block.title!}</span>
            <input class="form-control" id="${block.id!}" name="${block.name!}">
        </div>
        <#elseif block.blockType =="SelectBlock">
        <#if block.selectType=="select">
        <div class="input-group" style="padding-top: 10px">
            <span class="input-group-addon">${block.title!}</span>
            <div class="form-group">
                <select id="${block.id!}" class="selectpicker" name="${block.name!}">
                    <option value="" selected="selected">未选择</option>
                    <#list block.options as option>
                    <option value="${option.key}">${option.value!}</option>
                    </#list>
                </select>
            </div>
        </div>
        <#else>
        <div class="input-group" style="padding-top: 10px">
            <span class="input-group-addon">${block.title!}</span>
            <div class="form-group">
                <select id="${block.id!}" class="selectpicker" data-live-search="true">
                    <option value="" selected="selected">未选择</option>
                </select>
            </div>
            <input type="hidden" id="shows_${block.id!}" value="${block.toShowNameStr()}">
        </div>
        <script>
            $(window).load(function () {
                $("#${block.id!}").on('shown.bs.select', function (e) {
                    let dataJson = jQuery.parseJSON('${block.toJsonStr()}');
                    $.ajax({
                        data: JSON.stringify(dataJson),
                        type: 'post',
                        url: "${ctx}/block/select/search",
                        dataType: 'json',
                        contentType: 'application/json;charset=UTF-8',
                        success: function (data) {
                            if (data.status != 200) {
                                lightyear.notify("系统繁忙，请尝试重新登陆。", 'danger');
                                return;
                            }
                            let showsArry = $("#shows_${block.id!}").val().split(",");
                            $("#${block.id!}").empty();
                            if (data.body.length > 0) {
                                $("#${block.id!}").append('<option value="" selected="selected">未选择</option>');
                                $.each(data.body, function (i, item) {
                                    let showStr = "";
                                    for (let i = 0, size = showsArry.length; i < size; i++) {
                                        showStr = showStr + item[showsArry[i]];
                                    }
                                    let tempId = '<option  value="' + item.id + '">' + showStr + '</option>';
                                    $("#${block.id!}").append(tempId);
                                });
                            }
                            $('#${block.id!}').selectpicker('refresh');
                        }
                    });
                    $("#${block.id!}").next().next().find('input').attr('id', "searchInput_${block.id!}").bind('input propertychange', function () {
                        dataJson.searchKey = $("#searchInput_${block.id!}").val();
                        $.ajax({
                            data: JSON.stringify(dataJson),
                            type: 'post',
                            url: "${ctx}/block/select/search",
                            dataType: 'json',
                            contentType: 'application/json;charset=UTF-8',
                            success: function (data) {
                                if (data.status != 200) {
                                    lightyear.notify("系统繁忙，请尝试重新登陆。", 'danger');
                                    return;
                                }
                                let showsArry = $("#shows_${block.id!}").val().split(",");
                                $("#${block.id!}").empty();
                                if (data.body.length > 0) {
                                    $("#${block.id!}").append('<option value="" selected="selected">未选择</option>');
                                    $.each(data.body, function (i, item) {
                                        let showStr = "";
                                        for (let i = 0, size = showsArry.length; i < size; i++) {
                                            showStr = showStr + item[showsArry[i]];
                                        }
                                        let tempId = '<option  value="' + item.id + '">' + showStr + '</option>';
                                        $("#${block.id!}").append(tempId);
                                    });
                                }
                                $('#${block.id!}').selectpicker('refresh');
                            }
                        });

                    });
                });
            });
        </script>
    </#if>
    <#elseif block.blockType =="DateBlock">
    <div class="form-group">
        <div class="input-group" style="padding-top: 10px;">
            <input class="form-control date-picker" id="${block.id!}" type="text" name="${block.name!}"
                   placeholder="请选择${block.title!}段">
            <span class="input-group-addon"><i class="mdi mdi-calendar-clock" style="font-size: 22px"></i></span>
        </div>
    </div>
    <#else>
    </#if>
    </#list>
    <div class="input-group" style="padding-top: 10px">
        <button type="button" class="btn btn-primary"
                onclick="search();"><i class="mdi mdi-magnify"></i>查询
        </button>
    </div>
    <div class="input-group" style="padding-top: 10px">
        <button type="button" class="btn btn-info"
                onclick="tableReset('query_form')"><i class="mdi mdi-backup-restore"></i>重置/刷新
        </button>
    </div>
</form>
</div>