<section class="content-header">
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
        <li class="active">标签、索引反馈日志</li>
    </ol>
</section>
<section class="content">
    <div class="jax-box">
        <form id="formSearch" class="form-inline form-search">
            <div class="form-group">
                <label>案例编号: </label>
                <input type="text" id="contentId" class="form-control" oninput = "value=value.replace(/[^\d]/g,'')">
            </div>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <div class="btn-group">
                <button id="btn_query" type="button" class="btn table-btn-info">
                    <span aria-hidden="true"></span>&nbsp;查 询
                </button>

                <button id="reset_query" type="button" class="btn table-btn-info">
                    <span aria-hidden="true"></span>&nbsp;重置
                </button>
            </div>
        </form>
    </div>


    <div class="jax-box jax-box-table">
        <table id="table" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap"></table>
    </div>

</section>

<script type="text/javascript">
    var columns = [
        {field: 'contentId', title: '案例编号', align : "center"},
       	{field: 'logger', title: '日志', align : "center",formatter:function(value,row, index){
       	    console.log(row)
            return "用户["+row.name+"]反馈案例标签["+row.logger+"]不准确";
            }},
        {field: 'createTime', title: '创建时间', align : "center"},
        {field: 'status', title: '状态', align : "center",formatter: function(value, row, index) {
            return row.status === 1 ? '已解决' : '未解决';
            }},
        {field : 'operation', title : '操作', align : "center", formatter: function(value, row, index) {
            var submitHtml = '<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="editPage('+row.id+',0)">暂不解决</a>';
            var editHtml = '&nbsp;<a class="table-btn table-btn-info" href="javascript:void(0)" onclick="editPage('+row.id+',1)">已解决</a>';
			return submitHtml+editHtml;
       }}
	];
    var options={
        id:"#table",
        url: '[[@{/console/content/getLabelLogger}]]',
        columns:columns,
        toolbar: '#toolbar',
        showRefresh: true,
        queryParams : queryParams
    }
    Core.initTable(options);

	//查询参数
    function queryParams(params) {
        var temp = {
            page : params.limit, //页面大小
            pageSize : params.offset, //页码
            id: $("#contentId").val()
        };
        return temp;
    }

	// 预览
	function previewNews(url) {
		window.open(url, "_blank");
	}

	// 修改
	function editPage(id,status) {
        var msg = "确定更新改状态？";
        Core.confirm(msg, function () {
            Core.postAjax("[[@{/console/content/updateLogger}]]",{"id":id,"status":status},function (data) {
                if(data.ret==0){
                    layer.msg('更新成功！');
                    Core.refreshTable("#table");
                }else{
                    layer.msg(data.msg);
                }
            },"POST");
        })
	//	openWindow("[[@{/console/content/edit}]]?id="+id, "编辑新闻", 1200, 600);
	}

	function openWindow(url, name, iWidth, iHeight){
  		var iWidth;		// 弹出窗口的宽度;
  		var iHeight;	// 弹出窗口的高度;
  		var iTop = (window.screen.availHeight-30-iHeight)/2;	// 获得窗口的垂直位置;
  		var iLeft = (window.screen.availWidth-10-iWidth)/2;		// 获得窗口的水平位置;
  		window.open(url, name,'height='+iHeight+',innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
	}



	$(function () {
		/*查询*/
        $("#btn_query").click(function(){
            Core.refreshTable("#table");
        });

        //重置搜索栏
        $("#reset_query").click(function () {
            $("#contentId").val("");
        });

	});







</script>
