Commit 0f1934ea authored by 胡斌's avatar 胡斌

合并刘娜代码

parent 38de5b19
<%@tag pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<%--数据来源,渠道,业务筛选项 --%>
<%--------------------------------------------------数据来源筛选项 --------------------------------------------------%>
<div id="StatsDataSource" class="slide-menu-option">
<label for="">数据来源</label>
<div class="checkbox-inline"> <label> <input type="checkbox" name="allDataSourceStats" id="allDataSourceStats" checked> 全选 </label> </div>
<div id="statsDataSourceSelectArea">
<c:forEach var="datasources" items="${datasourceList}">
<div class="checkbox-inline">
<label>
<input type="checkbox" name="datasourceStats" class="datasourceStats" title="${datasources.dataSourceName}" value="${datasources.dataSourceId}" checked>${datasources.dataSourceName}
</label>
</div>
</c:forEach>
</div>
</div>
<%--------------------------------------------------渠道筛选项---- --------------------------------------------------%>
<div id="StatsChannel" class="slide-menu-option">
<label id="statsChannel" for="">渠道</label>
<div class="checkbox-inline"><label><input type="checkbox" name="allChannelStats" id="allChannelStats" checked> 全选</label></div>
<div id="ChannelSelectAreaStats">
<c:forEach var="channels" items="${channelList}">
<div class="checkbox-inline">
<input type="checkbox" name="channelStats" class="channelStats" title="${channels.channelName}" value="${channels.channelId}" checked>${channels.channelName}
</div>
</c:forEach>
</div>
</div>
<%--------------------------------------------------业务筛选项---- --------------------------------------------------%>
<div id="StatsBusiness" class="slide-menu-option">
<label id="statsBusiness" for="">业务</label>
<div class="checkbox-inline"><label> <input type="checkbox" name="allBusinessStats" id="allBusinessStats" checked> 全选 </label></div>
<div id="businessSelectAreaStats">
<c:forEach items="${businessList}" varStatus="index" step="2">
<div class="checkbox-inline">
<label>
<input type="checkbox" class="businessStats" title="${businessList[index.index+1]}" value="${businessList[index.index]}" checked>${businessList[index.index+1]}
</label>
</div>
</c:forEach>
</div>
</div>
<%--------------------------------------------------数据来源JS代码块 --------------------------------------------------%>
<script type="text/javascript">
$("#allDataSourceStats").click(function(){
if($("#allDataSourceStats").attr("checked") == "checked"){//全选
$(".datasourceStats").attr("checked","checked");
statsDatasourceChange();
}else{//不全选
$(".datasourceStats").attr("checked",false);
statsDatasourceChange();
}
});
$(".datasourceStats").click(function(){
var clickFlag=true;//是否全部选中
$(".datasourceStats").each(function(){
if($(this).attr("checked") == null||$(this).attr("checked") == false){ clickFlag=false; }
});
$("#allDataSourceStats").attr("checked",clickFlag);
statsDatasourceChange();
});
//返回结果为一个数组,数组中包含选中的数据源类型
function getStatsDataSourceCheckedValues(){
var statsDataSourceArray=new Array();
var i=0;
$(".datasourceStats:checked").each(function(){
statsDataSourceArray[i]=$(this).val();
i++;
});
//if($("#allDataSourceStats").attr("checked") == "checked"&&statsDataSourceArray.length>0){statsDataSourceArray[0]+=",-1";}
return statsDataSourceArray;
}
//返回结果为逗号分隔的ID字串
function getStatsDataSourceCheckedValuesString(){
var statsDataSourceStr="";
var dataSourceArray=getStatsDataSourceCheckedValues();
for(var i=0;i<dataSourceArray.length;i++){
if(i==dataSourceArray.length-1){
statsDataSourceStr+=dataSourceArray[i];
}else{
statsDataSourceStr+=dataSourceArray[i]+",";
}
}
//if($("#allDataSourceStats").attr("checked") == "checked"&&statsDataSourceStr.length>0){statsDataSourceStr+=",-1";}
return statsDataSourceStr;
}
//返回结果为一个数组,数组中包含选中的数据源类型
function getStatsDataSourceCheckedTexts(){
var statsDataSourceArray=new Array();
var i=0;
$(".datasourceStats:checked").each(function(){
statsDataSourceArray[i]=$(this).text();
i++;
});
return statsDataSourceArray;
}
//返回结果为逗号分隔的ID字串
function getStatsDataSourceCheckedTextsString(){
var statsDataSourceStr="";
var dataSourceArray=getStatsDataSourceCheckedTexts();
for(var i=0;i<dataSourceArray.length;i++){
if(i==dataSourceArray.length-1){
statsDataSourceStr+=dataSourceArray[i];
}else{
statsDataSourceStr+=dataSourceArray[i]+",";
}
}
return statsDataSourceStr;
}
//返回结果为一个数组,数组中包含选中的数据源类型的标题
function getStatsDataSourceCheckedTitles(){
var statsDataSourceArray=new Array();
var i=0;
$(".datasourceStats:checked").each(function(){
statsDataSourceArray[i]=$(this).attr("title");
i++;
});
var statsDataSourceTitles="";
for(i=0;i<statsDataSourceArray.length;i++){
if(i==statsDataSourceArray.length-1){
statsDataSourceTitles += statsDataSourceArray[i];
}else{
statsDataSourceTitles += statsDataSourceArray[i]+" ";
}
}
return statsDataSourceTitles;
}
//数据来源,渠道,业务三级联动重置
function statsDataSourceReset(){
$("#allDataSourceStats").attr("checked","ckecked");
$(".datasourceStats").attr("checked","checked");
statsDatasourceChange();
}
</script>
<%--------------------------------------------------渠道JS代码块 --------------------------------------------------%>
<script type="text/javascript">
$("#allChannelStats").click(function(){
if($("#allChannelStats").attr("checked") == "checked"){//全选
$(".channelStats").attr("checked","checked");
statsChannelChange();
}else{//不全选
$(".channelStats").attr("checked",false);
statsChannelChange();
}
});
$(".channelStats").click(function(){
var clickFlag=true;//是否全部选中
$(".channelStats").each(function(){
if($(this).attr("checked") == null||$(this).attr("checked") == false){ clickFlag=false; }
});
$("#allChannelStats").attr("checked",clickFlag);
statsChannelChange();
});
//返回结果为一个数组,数组中包含选中的渠道类型
function getStatsChannelCheckedValues(){
var statsChannelArray=new Array();
var i=0;
$(".channelStats:checked").each(function(){
statsChannelArray[i]=$(this).val();
i++;
});
//if($("#allChannelStats").attr("checked") == "checked"&&statsChannelArray.length>0){statsChannelArray[0]+=",-1";}
return statsChannelArray;
}
//返回结果为逗号分隔的ID字串
function getStatsChannelCheckedValuesString(){
var statsChannelStr="";
var statsChannelArray=getStatsChannelCheckedValues();
for(var i=0;i<statsChannelArray.length;i++){
if(i==statsChannelArray.length-1){
statsChannelStr+=statsChannelArray[i];
}else{
statsChannelStr+=statsChannelArray[i]+",";
}
}
//if($("#allChannelStats").attr("checked") == "checked"&&statsChannelStr.length>0){statsChannelStr+=",-1";}
return statsChannelStr;
}
//返回结果为一个数组,数组中包含选中的渠道类型
function getStatsChannelCheckedTexts(){
var statsChannelArray=new Array();
var i=0;
$(".channelStats:checked").each(function(){
statsChannelArray[i]=$(this).text();
i++;
});
return statsChannelArray;
}
//返回结果为逗号分隔的ID字串
function getStatsChannelCheckedTextsString(){
var statsChannelStr="";
var statsChannelArray=getStatsChannelCheckedTexts();
for(var i=0;i<statsChannelArray.length;i++){
if(i==statsChannelArray.length-1){
statsChannelStr+=statsChannelArray[i];
}else{
statsChannelStr+=statsChannelArray[i]+",";
}
}
return statsChannelStr;
}
//返回结果为逗号分隔的渠道名称字串
function getStatsChannelCheckedTitles(){
var statsChannelArray=new Array();
var i=0;
$(".channelStats:checked").each(function(){
statsChannelArray[i]=$(this).attr("title");
i++;
});
var statsChannelTitles="";
for(var i=0;i<statsChannelArray.length;i++){
if(i==statsChannelArray.length-1){
statsChannelTitles+=statsChannelArray[i];
}else{
statsChannelTitles+=statsChannelArray[i]+" ";
}
}
return statsChannelTitles;
}
</script>
<%--------------------------------------------------业务JS代码块 --------------------------------------------------%>
<script type="text/javascript">
$("#allBusinessStats").click(function(){
if($("#allBusinessStats").attr("checked") == "checked"){//全选
$(".businessStats").attr("checked","checked");
}else{//不全选
$(".businessStats").attr("checked",false);
$(".businessStats").attr("disabled",false);
}
});
$(".businessStats").click(function(){
var clickFlag=true;//是否全部选中
$(".businessStats").each(function(){
if($(this).attr("checked") == null||$(this).attr("checked") == false){ clickFlag=false; }
});
$("#allBusinessStats").attr("checked",clickFlag);
});
//返回结果为一个数组,数组中包含选中的渠道类型
function getStatsBusinessCheckedValues(){
var statsBusinessArray=new Array();
var i=0;
$(".businessStats:checked").each(function(){
statsBusinessArray[i]=$(this).val();
i++;
});
//if($("#allBusinessStats").attr("checked") == "checked"&&statsBusinessArray.length>0){statsBusinessArray[0]+=",-1";}
return statsBusinessArray;
}
//返回结果为逗号分隔的ID字串
function getStatsBusinessCheckedValuesString(){
var statsBusinessStr="";
var statsBusinessArray=getStatsBusinessCheckedValues();
for(var i=0;i<statsBusinessArray.length;i++){
if(i==statsBusinessArray.length-1){
statsBusinessStr+=statsBusinessArray[i];
}else{
statsBusinessStr+=statsBusinessArray[i]+",";
}
}
//if($("#allBusinessStats").attr("checked") == "checked"&&statsBusinessStr.length>0){statsBusinessStr+=",-1";}
return statsBusinessStr;
}
////返回结果为逗号分隔的业务title
function getStatsBusinessCheckedTitlesString(){
var statsBusinessArray=new Array();
var i=0;
$(".businessStats:checked").each(function(){
statsBusinessArray[i]=$(this).attr("title");
i++;
});
var statsBusinessTitles="";
for(var i=0;i<statsBusinessArray.length;i++){
if(i==statsBusinessArray.length-1){
statsBusinessTitles+=statsBusinessArray[i];
}else{
statsBusinessTitles+=statsBusinessArray[i]+" ";
}
}
return statsBusinessTitles;
}
</script>
<%--------------------------------------------------数据来源变化--------------------------------------------------%>
<script type="text/javascript">
function statsDatasourceChange(){
$("#businessSelectAreaStats").empty();
var timestamp = Date.parse(new Date());
var dataSourceIds = getStatsDataSourceCheckedValuesString();
if(dataSourceIds==""){dataSourceIds="0";}
$.ajax({
type : 'GET',
contentType : 'application/json',
url: '${ctx}/MonitorOperation/FailureStatisticsCriteria/datasource_select/'+dataSourceIds+'/'+timestamp,
async: false ,
dataType : 'text',
beforeSend: function(data) {},
success: function(data) {
for(var i=0;i<data.length;i++){
if(data[i]=='\"'){
data=data.replace('\"','\'');
}
}
data=eval("("+data+")");//获取从后台返回的数据,通常是Json格式
if(data == null || data == ""){
statsChannelChange();
$("#ChannelSelectAreaStats").empty();
}
else{
$("#allChannelStats").attr("checked",true);
$("#ChannelSelectAreaStats").empty();
for(var t=0;t<data.length;t++){
$("#ChannelSelectAreaStats").append('<div class="checkbox-inline"><label><input type="checkbox" name="channelStats" class="channelStats" title="'+data[t].channelName+'" value="'+data[t].channelId+'" checked>'+data[t].channelName+'</label></div>');
}
statsChannelChange();
}
$(".channelStats").click(function(){
var clickFlag=true;//是否全部选中
$(".channelStats").each(function(){
if($(this).attr("checked") == null||$(this).attr("checked") == false){ clickFlag=false; }
});
$("#allChannelStats").attr("checked",clickFlag);
statsChannelChange();
});
}
});
}
<%--------------------------------------------------渠道数据来源变化--------------------------------------------------%>
function statsChannelChange(){
var timestamp = Date.parse(new Date());
var dataSourceIds = getStatsDataSourceCheckedValuesString();
var channelIds = getStatsChannelCheckedValuesString();
if(channelIds==""){channelIds="0";}
$.ajax({
type : 'GET',
contentType : 'application/json',
url: '${ctx}/MonitorOperation/FailureStatisticsCriteria/channel_select/'+dataSourceIds+'/channelId/'+channelIds+'/'+timestamp,
dataType : 'text',
beforeSend: function(data) {},
success: function(data) {
for(var i=0;i<data.length;i++){
if(data[i]=='\"'){
data=data.replace('\"','\'');
}
}
data=eval("("+data+")");//获取从后台返回的数据,通常是Json格式
if(data == null || data == ""){
$("#businessSelectAreaStats").empty();
}else{
$("#allBusinessStats").attr("checked",true);
$("#businessSelectAreaStats").show();
$("#businessSelectAreaStats").empty();
for(var t=0;t<data.length;t=t+2){
$("#businessSelectAreaStats").append('<div class="checkbox-inline"><label><input type="checkbox" name="businessStats" class="businessStats" title="'+data[t+1]+'" value="'+data[t]+'" checked>'+data[t+1]+'</label></div>');
}
}
$(".businessStats").click(function(){
var clickFlag=true;//是否全部选中
$(".businessStats").each(function(){
if($(this).attr("checked") == null||$(this).attr("checked") == false){ clickFlag=false; }
});
$("#allBusinessStats").attr("checked",clickFlag);
});
}
});
}
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment