<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../common/common.jsp" %>
<title>品牌植入分析</title>
<script type="text/javascript">
$(function(){
	$.resetText();
    $(".text").input();
    //产品名称下拉
    var productNameSelect = $('select[name="productName"]').select2({
    	placeholder: "请输入对标产品",
    	allowClear: true,
    	width:'150px',
    	ajax:{
    		url: 'benchmarking_list.do',
    		dataType:'json',
    		quietMillis:100,
    		data:function(params){
    			return {
    				productName : params.term,
    				pageNo : params.page || 1,
    				type: $("#type").val(),
    				ids: $("#ids").val(),
    				pageSize : 20
    			}
    		},
    		processResults: function (data, params) {
    			params.page = params.page || 1;
    			return {
    		        results: data.results,
    		        pagination: {
    		          more: (params.page * 20) < data.total
    		        }
    		    };
    		},
    		cache: true
    	}
    });
});
function addBenchBrand(o){
	var param = "${ids}", type = "${type}", productId = $("#productId").val(), startDate = $("#startDate").val(), endDate = $("#endDate").val() , day = $("#day").val();
	if(isEmpty(productId)){
		top.alert("请选择新的对标产品 !");
		return;
	}
	if(isEmpty(param)){
		param = productId;
	}else{
	    param = param + '|' + productId;
	}
	top.window.location.href='benchmarking.do?type='+type+'&ids='+encodeURI(param)+'&startDate='+startDate+'&endDate='+endDate+'&day='+day;
}

</script>
<script type="text/javascript" src="${staticPath}js/analysis/benchmark.js"></script>
</head>
<body>
<div class="" style="overflow: hidden;">
	 <div class="">
	      <c:choose>
			<c:when test="${type == 0}">产品：</c:when>
			<c:otherwise>栏目</c:otherwise>
		  </c:choose>
          <select id="productId" name="productName">
             <option value=""></option>
          </select>
     </div>
     <input type="hidden" name="type" id="type" value="${type}"/>
     <input type="hidden" name="ids" id="ids" value="${ids}"/>
     <input type="hidden" name="startDate" id="startDate" value="${startDate}"/>
     <input type="hidden" name="endDate" id="endDate" value="${endDate}"/>
     <input type="hidden" name="day" id="day" value="${day}"/>
</div>
<div class="open-fixed-buttons">
	<a href="javascript:addBenchBrand();" class="btn-radius">确定</a>
	<a href="javascript:top.$.closeWindow();" class="btn-radius">关闭</a>
</div>
</body>
</html>