<!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('待审核列表')" />
</head>
<body class="gray-bg">
<input type="hidden"  id="id" th:value="${state}" class="form-control" readonly/>

<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>
                            <!-- <input type="text" name="shenqinglaiyuan"/>-->
                            <select name="shenqinglaiyuan">
                                <option></option>
                                <optgroup  th:each="dict:${diction}">
                                    <option  th:tips="${dict}" th:text="${dict}"></option>
                                </optgroup>
                            </select>
                        </li>

                        <li>
                            <p>经营者：</p>
                            <input type="text" name="jingyingren"/>
                        </li>
                        <li>
                            <p style="width: 105px">个体工商户名称：</p>
                            <input type="text" name="codename"/>
                        </li>

                        <li class="select-time">
                            <p style="width: 95px">审核通过日期：</p>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="hangye1"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="hangye2"/>
                        </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-primary btn-rounded btn-sm" onclick="toDownloadExcel()" >
                                <i class="fa fa-download"></i> 导出
                            </a>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="toDownMonth()"><i class="fa fa-download"></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" data-mobile-responsive="true"></table>
        </div>

    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:gtgsyw:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:gtgsyw:remove')}]];
    var auditFlag = [[${@permission.hasPermi('system:gtgsyw:audit')}]];
    var giveupFlag = [[${@permission.hasPermi('system:gtgsyw:giveup')}]];
    var prefix = ctx + "system/gtgsyw";

    function toDownloadExcel(formId){
        $.modal.confirm("导出当前" + $.table._option.modalName + "吗？", function () {
            var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
            $.modal.loading("正在导出数据，请稍后...");
            $.post($.table._option.exportUrl, $("#" + currentId).serializeArray(), function (result) {
                if (result.code == web_status.SUCCESS) {
                    window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
                } else if (result.code == web_status.WARNING) {
                    $.modal.alertWarning(result.msg)
                } else {
                    $.modal.alertError(result.msg);
                }
                $.modal.closeLoading();
            });
        });
    }
    $(function() {
        var flg=$("#id").val();

        var options = {
            url: prefix + "/list/"+flg,
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export/"+flg,
            shenheUrl: prefix+"/audit/{id}",
            giveupUrl: prefix + "/export/{id}",
            sortName: "shenqingdate",
            sortOrder: "desc",
            modalName: "审核通过",
            columns: [{
                checkbox: true
            },
                {
                    title: '序号',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field : 'shenqinglaiyuan',
                    title : '申请来源'
                },
                {
                    field : 'xinyongcode',
                    title : '统一社会信用代码'
                },
                {
                    field : 'jingyingren',
                    title : '经营者'
                },
                {
                    field : 'nsxzq',
                    title : '个体工商户名称'
                },

                {
                    field : 'shenqingdate',
                    title : '申请时间'
                },
                {
                    field : 'shenherenname',
                    title : '审核人'
                },
                {
                    field : 'updatetime',
                    title : '审核通过时间',
                    sortable: true,
                    sortOrder:"desc"
                },{

                    field : 'isprint',
                    title : '是否打印正本',
                    formatter: function (value, row, index) {
                        return typesIsPrint(row);
                    }
                },{
                    field : 'printtime',
                    title : '正本打印时间'
                },{
                    field : 'isprintF',
                    title : '是否打印副本',
                    formatter: function (value, row, index) {
                        return typesisprintF(row);
                    }
                },{
                    field : 'printtimeF',
                    title : '副本打印时间'
                },{
                    title : '档案管理',
                    formatter: function (value, row, index) {
                        return download(row);
                    }
                },

                {
                    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.shenhe(\'' + row.id + '\')"><i class="fa fa-edit"></i>详细</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });


    /*是否打印正文*/
    function typesIsPrint(row) {
        if (row.isprint == 0) {
            return '<div class="tubiao" >未打印</div>'
        } else if (row.isprint == 1) {
            return '<div class="tubiao" >已打印</div>';
        }
    }


    /*是否打印副文*/
    function typesisprintF(row) {
        if (row.isprintF == 0) {
            return '<div class="tubiao" >未打印</div>'
        } else if (row.isprintF == 1) {
            return '<div class="tubiao" >已打印</div>';
        }
    }
    //下载档案
    function download (row) {
        return '<a  class="btn btn-success btn-xs" onclick="load(\'' + row.id + '\')"><i class="fa fa-edit"></i>档案</a>'
    }

    function load(id) {
        var url= prefix + "/download/"+id;
        $.modal.open1("下载档案", url, '550', '500');

    }
    function toDownMonth() {
        if($("#startTime").val()==''||$("#endTime").val()==''){
            $.modal.msgError("请选择时间段进行下载!");
        }else {
            window.location.href=prefix+"/toPdfZip?start="+$("#startTime").val()+"&end="+$("#endTime").val()
        }
    }

</script>



</body>
</html>
