<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title></title>
        <link rel="stylesheet" href="/Public/lib/Juece/bootstrap-3.3.7/dist/css/bootstrap.css">
        <link rel="stylesheet" href="/Public/lib/Juece/bootstrap-table-develop/src/bootstrap-table.css">
        <link rel="stylesheet" href="/Public/lib/Juece/bootstrap-datetimepicker-master/css/bootstrap-datetimepicker.css" />
        <link rel="stylesheet" type="text/css" href="/Public/lib/layer/2.4/skin/layer.css">
        <link rel="stylesheet" type="text/css" href="/Public/lib/Hui-iconfont/1.0.8/iconfont.css"/>
        <link rel="stylesheet" href="/Public/lib/layui/css/layui.css"  media="all">
        <style type="text/css">
        body{
            background-color: #fff;
        }
        </style>
    </head>
    <body>
        <div id="toolbar" class="btn-group" style="">
            <input id="datetime1" size="16" type="text" value="" readonly class="form_datetime form-control" style="width: 150px;float: left;margin-left: 10px;" placeholder="开始日">
            <input id="datetime2" size="16" type="text" value="" readonly class="form_datetime form-control" style="width: 150px;float: left;margin-left: 10px;margin-right: 10px;" placeholder="结束日" >
        </div>
        <div style="float:right;margin-top: 10px;margin-right: 10px;">
            <a class="layui-btn layui-btn-radius layui-btn-primary" href="javascript:location.replace(location.href);" title="刷新" style="text-decoration:none">
        		<i class="Hui-iconfont">&#xe68f;</i> 刷新
        	</a>
        	<a class="layui-btn layui-btn-radius layui-btn-primary" href="javascript:;" onclick="parent.removeIframe()" style="text-decoration:none">
        		<i class="Hui-iconfont">&#xe706;</i> 关闭
        	</a>
        </div>
        <table id="reportTable"></table>
        <script src="/Public/lib/Juece/jquery/jquery-1.11.0.min.js"></script>
        <script src="/Public/lib/Juece/bootstrap-3.3.7/dist/js/bootstrap.min.js"></script>
        <script src="/Public/lib/Juece/bootstrap-table-develop/src/bootstrap-table.js"></script>
        <script src="/Public/lib/Juece/bootstrap-table-develop/src/locale/bootstrap-table-zh-CN.js"></script>
        <script src="/Public/lib/Juece/bootstrap-table-develop/src/extensions/export/bootstrap-table-export.js"></script>
        <script src="/Public/lib/Juece/tableExport.jquery.plugin-master/tableExport.min.js"></script>
        <script src="/Public/lib/Juece/bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js"></script>
        <script src="/Public/lib/Juece/bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
        <script type="text/javascript" src="/Public/lib/layer/2.4/layer.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                /*alert($(window).height());*/
                //调用函数，初始化表格
                initTable();
                //当点击查询按钮的时候执行  
                $("#datetime1,#datetime2").bind("change", initTable);
                //$("#searchText").bind("keyup", initTable);
                $('#button').click(function () {});
            });
            var $table = $('#reportTable');
            function initTable() {
                //先销毁表格  
                $table.bootstrapTable('destroy');
                $table.bootstrapTable({
                    toolbar: '#toolbar',    //工具按钮用哪个容器
                    method : 'get',
                    contentType : "application/x-www-form-urlencoded",
                    url : '<?php echo U('fyxgjilu/all');?>',    //请求地址，返回数据格式可以参照下面data数据格式
                    sortable : false,
                    sortName : 'id',//初始化的时候排序的字段
                    height: $(window).height(),
                    showToggle : false,
                    showExport : false,
                    search : true,
                    pagination: true, //分页
                    showColumns : false,
                    showRefresh : false,
                    buttonsAlign:'right',//刷新按钮位置
                    searchAlign: 'left',
                    exportTypes : ['excel'],
                    //分页方式：client客户端分页，server服务端分页（*）
                    sidePagination: "server",
                    queryParams:queryParams,//请求服务器时所传的参数
                    pageSize:20,//单页记录数
                    pageList:[20,30,50,100,'all'],//分页步进值
                    dataField: "data",//这是返回的json数组的key.默认好像是"rows".这里只有前后端约定好就行
                    exportDataType:$('#exportDataType').val(),
                    icons: { export: 'glyphicon-floppy-disk icon-share',columns: "glyphicon-list"},
                    columns : [
                        {
                            field : "zy_type",
                            title : "资源类型",
                            align : "center",
                            valign : "middle",
                            sortable : "false",
                            formatter :function(value,row,index) { 
                                var a = "客源";
                                return a;
                            }
                        },
                        {
                            field : "bmming",
                            title : "部门",
                            align : "center",
                            valign : "middle",
                            sortable : "false",
                        }, 
                        {
                            field : "ygmingcheng",
                            title : "员工",
                            align : "center",
                            valign : "middle",
                            sortable : "false",
                        },
                        {
                            field : "addtime1",
                            title : "操作时间",
                            align : "center",
                            valign : "middle",
                            sortable : "false"
                        },
                        {
                            field : "cz_type",
                            title : "操作类型",
                            align : "center",
                            valign : "middle",
                            sortable : "false",
                            formatter :function(value,row,index) { 
                                if (value==1) {
                                    var a = "新增";
                                } else if (value==2){
                                    var a = "基础修改";
                                } else if (value==3){
                                    var a = "转为私盘";
                                } else if (value==4){
                                    var a = "转为公盘";
                                } else if (value==5){
                                    var a = "写跟进";
                                } else if (value==6){
                                    var a = "设置全景";
                                } else if (value==7){
                                    var a = "核心修改";
                                } else if (value==8){
                                    var a = "删除";
                                } else if (value==9){
                                    var a = "变更维护人";
                                } else if (value==10){
                                    var a = "变更收钥部门";
                                } else if (value==11){
                                    var a = "变更收钥人";
                                } else if (value==12){
                                    var a = "上传图片";
                                } else if (value==13){
                                    var a = "删除图片";
                                } else if (value==14){
                                    var a = "封盘";
                                } else if (value==15){
                                    var a = "开盘";
                                } else if (value==16){
                                    var a = "写提醒";
                                } else if (value==17){
                                    var a = "写带看";
                                } else if (value==18){
                                    var a = "审核";
                                } else if (value==24){
                                    var a = "变更状态";
                                } else if (value==25){
                                    var a = "设置图片类型";
                                } else if (value==26){
                                    var a = "设置意向房屋";
                                }
                                return a;
                            }
                        },
                        {
                            field : "zy_bianhao",
                            title : "资源编号",
                            align : "center",
                            valign : "middle",
                            sortable : "false",
                            formatter :function(value,row,index) {
                                var zybh = value;
                                if ((row['kyxqqx'] == 1) && value) {
                                    zybh = '<a href="javascript:;" data-href="<?php echo U('Keyuan1/neirong1');?>?id='+row['zy_id']+'&kywhr='+row['kywhr']+'" data-title="'+value+'" onclick="kaidan_tab(this)" style="text-decoration:none;color: blue">'+value+'</a>';
                                }
                                return zybh;
                            }
                        },
                        {
                            field : "neirong",
                            title : "日志内容",
                            align : "center",
                            valign : "middle",
                            sortable : "false",
                            width:400
                        },
                    ],
                    formatNoMatches : function() {
                        return '无符合条件的记录';
                    }
                });
                function queryParams(params){
                    return {
                        pageSize : params.limit, //每一页的数据行数，默认是上面设置的10(pageSize)
                        p : params.offset/params.limit+1, //当前页面,默认是上面设置的1(pageNumber)
                        sortName:this.sortName,
                        sortOrder:this.sortOrder,
                        searchText : this.searchText,
                        datetime1 : $('#datetime1').val(),
                        datetime2 : $('#datetime2').val(),
                        //searchText : $('#searchText').val(),
                        is_ajax : 1,
                    }
                };
                /*//请求成功方法
                function responseHandler(result){
                    var errcode = result.errcode;//在此做了错误代码的判断
                    if(errcode != 0){
                        alert("错误代码" + errcode);
                        return;
                    }
                    //如果没有错误则返回数据，渲染表格
                    return {
                        total : result.dataLength, //总页数,前面的key必须为"total"
                        data : result.rowDatas //行数据，前面的key要与之前设置的dataField的值一致.
                    };
                };*/
            }
        </script>
        <script type="text/javascript">
            $(".form_datetime").datetimepicker({
                format: 'yyyy-mm-dd',
                weekStart: 1,
                autoclose: true,
                startView: 2,
                minView: 2,
                forceParse: false,
                language: 'zh-CN' ,
            });
        </script>
        <script type="text/javascript">
            function kaidan_tab(obj){
                var bStop = false,
                bStopIndex = 0,
                href = $(obj).attr('data-href'),
                title = $(obj).attr("data-title"),
                topWindow = $(window.top.document),
                show_navLi = topWindow.find("#min_title_list li"),
                iframe_box = topWindow.find("#iframe_box");
                //console.log(topWindow);
                if(!href||href==""){
                    return false;
                }if(!title){
                    return false;
                }
                if(title==""){
                    return false;
                }
                show_navLi.each(function() {
                    if($(this).find('span').attr("data-href")==href){
                        bStop=true;
                        bStopIndex=show_navLi.index($(this));
                        return false;
                    }
                });
                if(!bStop){
                    creatIframe(href,title);
                    min_titleList();
                }
                else{
                    show_navLi.removeClass("active").eq(bStopIndex).addClass("active");         
                    iframe_box.find(".show_iframe").hide().eq(bStopIndex).show().find("iframe").attr("src",href);
                }   
            }
            function creatIframe(href,titleName){
                var topWindow=$(window.top.document),
                show_nav=topWindow.find('#min_title_list'),
                iframe_box=topWindow.find('#iframe_box'),
                iframeBox=iframe_box.find('.show_iframe'),
                $tabNav = topWindow.find(".acrossTab"),
                $tabNavWp = topWindow.find(".Hui-tabNav-wp"),
                $tabNavmore =topWindow.find(".Hui-tabNav-more");
                var taballwidth=0;
                show_nav.find('li').removeClass("active");  
                show_nav.append('<li class="active"><span data-href="'+href+'">'+titleName+'</span><i></i><em></em></li>');
                if('function'==typeof $('#min_title_list li').contextMenu){
                    $("#min_title_list li").contextMenu('Huiadminmenu', {
                        bindings: {
                            'closethis': function(t) {
                                var $t = $(t);        
                                if($t.find("i")){
                                    $t.find("i").trigger("click");
                                }
                            },
                            'closeall': function(t) {
                                $("#min_title_list li i").trigger("click");
                            },
                        }
                    });
                }else {} 
                var $tabNavitem = topWindow.find(".acrossTab li");
                if (!$tabNav[0]){return}
                $tabNavitem.each(function(index, element) {
                    taballwidth+=Number(parseFloat($(this).width()+60))
                });
                $tabNav.width(taballwidth+25);
                var w = $tabNavWp.width();
                if(taballwidth+25>w){
                    $tabNavmore.show()}
                else{
                    $tabNavmore.hide();
                    $tabNav.css({left:0})
                } 
                iframeBox.hide();
                iframe_box.append('<div class="show_iframe"><div class="loading"></div><iframe frameborder="0" src='+href+'></iframe></div>');
                var showBox=iframe_box.find('.show_iframe:visible');
                showBox.find('iframe').load(function(){
                    showBox.find('.loading').hide();
                });
            }
        </script>
    </body>
</html>