<!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="jingyingren"/>
                        </li>
                        <li>
                            <p>身份证：</p>
                            <input type="text" name="jingyingcard"/>
                        </li>
                        <li>
                            <p>个体名称：</p>
                            <input type="text" name="zwzh"/>
                        </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="$.operate.add()" >
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:gtgsyw:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-primary btn-rounded btn-sm" onclick="getList(0,'02')"><i class="fa fa-download"></i> 窗口数据下载(设立)</a>
            <a class="btn btn-primary btn-rounded btn-sm" onclick="getList(1,'02')"><i class="fa fa-download"></i> 云窗在线数据下载(设立)</a>
            <a class="btn btn-primary btn-rounded btn-sm" onclick="getList(0,'03')"><i class="fa fa-download"></i> 窗口数据下载(变更)</a>
            <a class="btn btn-primary btn-rounded btn-sm" onclick="getList(1,'03')"><i class="fa fa-download"></i> 云窗在线数据下载(变更)</a>

        </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/cprint";
    var synUrl = "http://localhost:8080/data.json";

    function getList(id,typeid){
        opList("数据下载",prefix + "/getList?type="+id+"&typeid="+typeid);
    }

    $(function() {
        var flg=$("#id").val();

        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/addinfo",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            shenheUrl: prefix+"/audit/{id}",
            giveupUrl: prefix + "/export/{id}",
            sortName: "shenhedate",
            sortOrder: "desc",
            modalName: "证照打印",
            columns: [{
                checkbox: true
            },
                {
                    field : 'id',
                    title : 'ID',
                    visible: false
                },

                {
                    title: '序号',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field : 'jingyingren',
                    title : '经营者'
                },
                {
                    field : 'xinyongcode',
                    title : '信用代码'
                },
                {
                    field : 'zwzh',
                    title : '个体工商户名称'
                },
                {
                    field : 'shenqinglaiyuan',
                    title : '来源'
                },
                {
                    field : 'shenherenname',
                    title : '审核人'
                },
                {
                    field : 'zhucetime',
                    title : '开业日期',
                    formatter: function (value, row, index) {
                        var date = new Date(Date.parse(value.replace(/-/g, '/')));
                        console.log(value)
                        console.log(date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate())
                        return date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
                    }
                },
                {
                    field : 'shenhedate',
                    title : '下载时间',
                },
                {
                    field : 'isprint',
                    title : '正本打印',
                    formatter: function (value, row, index) {
                        return value == 0 ? '<span class="btn btn-danger btn-xs" href="javascript:;">未打印</span>': '<span class="btn btn-success btn-xs" href="javascript:;">已打印</span>';
                    }
                },
                {
                    field : 'isprintF',
                    title : '副本打印',
                    formatter: function (value, row, index) {
                        return value == 0 ? '<span class="btn btn-danger btn-xs" href="javascript:;">未打印</span>': '<span class="btn btn-success btn-xs" href="javascript:;">已打印</span>';
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        /**  编辑删除原始按钮 **/
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="getInfo(\'' + row.bsid + '\')"><i class="fa fa-edit"></i>详细</a> ');


                        /*  actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                          actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                          actions.push('<a class="btn btn-danger btn-xs ' + giveupFlag + '" href="javascript:void(0)" onclick="$.operate.giveup(\'' + row.id + '\')"><i class="fa fa-remove"></i>不予受理</a>');*/
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    function getInfo(url){
        console.log(prefix + "/getInfo?bsid=" + url);
        options = {
            url: prefix + "/getInfo?bsid=" + url,
            title: "证照信息",
            btn: ['关闭'],
            yes: function (index, layero) {
                $.table.refresh();
                layer.close(index);
            }
        }
        $.modal.openOptions(options);
    }
    // 弹出层全屏
    function opList (title, url, width, height) {
        //如果是移动端，就使用自适应大小弹窗
        if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {
            width = 'auto';
            height = 'auto';
        }
        if ($.common.isEmpty(title)) {
            title = false;
        }
        if ($.common.isEmpty(url)) {
            url = "/404.html";
        }
        if ($.common.isEmpty(width)) {
            width = 800;
        }
        if ($.common.isEmpty(height)) {
            height = ($(window).height() - 50);
        }
        var index = layer.open({
            type: 2,
            area: [width + 'px', height + 'px'],
            fix: false,
            //不固定
            maxmin: true,
            shade: 0.3,
            title: title,
            content: url,
            btn: [],
            // 弹层外区域关闭
            shadeClose: true,
            yes: function (index, layero) {
                var iframeWin = layero.find('iframe')[0];
                console.log(iframeWin);
                // console.log($("#"+$(iframeWin).attr("id")+" table").eq(1).attr("id"));
            },
            cancel: function (index) {
                return true;
            }
        });
    }
</script>



</body>
</html>
