<!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/>
    <input type="hidden"  id="id" th:value="${diction}" 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>个体工商户名称：</p>
                                <input type="text" name="codename"/>
                            </li>
                            <li class="select-time">
                                <p>申请日期：</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-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() {
            var flg=$("#id").val();
            var column=[{
                    checkbox: true
                },

                    {
                        title: '序号',
                        formatter: function (value, row, index) {
                            return $.table.serialNumber(index);
                        }
                    },
                {
                        field : 'shenqinglaiyuan',
                        title : '申请来源'
                }];

            column.push(  {
                        field : 'jingyingren',
                        title : '经营者'
                    },
                    {
                        field : 'nsxzq',
                        title : '个体工商户名称'
                    },

                    {
                        field : 'shenqingdate',
                        title : '申请时间'
                    });
                    if(flg==3){
                        column.push({
                            field : 'shenherenname',
                                title : '审核人'
                        })
                    }


            column.push(   {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        /**  编辑删除原始按钮 **/
                        if(flg==0){
                            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> ');

                        }else if(flg==1){
                            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> ');

                        }else if(flg==2){
                            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> ');

                        }else if(flg==3){
                            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('');
                    }
                });
            var options = {
                url: prefix + "/list/" + flg,
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                shenheUrl: prefix + "/audit/{id}",
                giveupUrl: prefix + "/export/{id}",
                modalName: "待审核",
                sortName: "shen_qing_date",
                sortOrder: "asc",
                columns: column,
            };

            $.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');

        }

    </script>
</body>
</html>
