留存分析添加显示设置
This commit is contained in:
parent
ab6c4e46c2
commit
56d7825141
@ -24,6 +24,11 @@
|
|||||||
<div class="analysis-navigation-bar-right-img analysis-navigation-bar-right-img-baobiao" title="报表">
|
<div class="analysis-navigation-bar-right-img analysis-navigation-bar-right-img-baobiao" title="报表">
|
||||||
<img src="./static/img/baobiao2.png">
|
<img src="./static/img/baobiao2.png">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="analysis-navigation-bar-right-img" title="返回">
|
||||||
|
<img src="./static/img/baobiao2.png">
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -116,8 +121,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="analtsis-condition-right-box">
|
<div class="analtsis-condition-right-box">
|
||||||
<!-- <div class="analtsis-condition">指标</div>
|
<!-- <div class="analtsis-condition">指标</div> -->
|
||||||
<div class="analtsis-condition">分组</div> -->
|
<div class="analtsis-condition" >显示设置</div>
|
||||||
<div class="analtsis-chart-switch-box">
|
<div class="analtsis-chart-switch-box">
|
||||||
<div class="analtsis-chart-switch select-chart" title="数据报表"> <i class="iconfont" style="font-size: 18px; "></i> </div>
|
<div class="analtsis-chart-switch select-chart" title="数据报表"> <i class="iconfont" style="font-size: 18px; "></i> </div>
|
||||||
<div class="analtsis-chart-switch " title="第N日留存"> <i class="iconfont" style="font-size: 18px; "></i> </div>
|
<div class="analtsis-chart-switch " title="第N日留存"> <i class="iconfont" style="font-size: 18px; "></i> </div>
|
||||||
@ -129,7 +134,7 @@
|
|||||||
<!-- 统计图 -->
|
<!-- 统计图 -->
|
||||||
<div class="analysis-echarts" id="analysis-echarts" style="display: none;"></div>
|
<div class="analysis-echarts" id="analysis-echarts" style="display: none;"></div>
|
||||||
|
|
||||||
<div class="table-div-box">
|
<div class="table-div-box" id="table-div-box">
|
||||||
<table class="table-fenxi-box">
|
<table class="table-fenxi-box">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="table-fenxi-th">
|
<tr class="table-fenxi-th">
|
||||||
@ -152,6 +157,35 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="showsetup-box">
|
||||||
|
<div class="showsetup-box-zz"></div>
|
||||||
|
<div class="showsetup-down-box">
|
||||||
|
<form class="layui-form" action="">
|
||||||
|
<div class="showsetup-radio-box">
|
||||||
|
<input type="radio" name="showsetup" value="all" title="全部显示" checked="" lay-filter="showsetup">
|
||||||
|
</div>
|
||||||
|
<div class="showsetup-radio-box">
|
||||||
|
<input type="radio" name="showsetup" value="date" title="仅显示关键日期" lay-filter="showsetup">
|
||||||
|
</div>
|
||||||
|
<span class="showsetup-bianji showsetup-edit">编辑</span>
|
||||||
|
<span class="showsetup-bianji showsetup-wancheng">完成</span>
|
||||||
|
|
||||||
|
<div class="showsetup-bianji-show-box-type">
|
||||||
|
<div class="showsetup-bianji-show-box">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="showsetup-bianji-input-box-type">
|
||||||
|
<div class="showsetup-bianji-input-box">
|
||||||
|
<textarea rows="2" placeholder="多数值之间请用逗号分隔,当日输入0">0,1,7,14,30</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script id="table-fenxi-th-dot" type="text/html">
|
<script id="table-fenxi-th-dot" type="text/html">
|
||||||
{{# layui.each(d, function(index, item){ }}
|
{{# layui.each(d, function(index, item){ }}
|
||||||
{{# if(item == "第0日"){ }}
|
{{# if(item == "第0日"){ }}
|
||||||
@ -176,3 +210,14 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{{# }); }}
|
{{# }); }}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script id="showsetup-bianji-show-box-dot" type="text/html">
|
||||||
|
{{# layui.each(d, function(index, item){ }}
|
||||||
|
{{# if(item == "0"){ }}
|
||||||
|
<div>当日</div>
|
||||||
|
{{# } else { }}
|
||||||
|
<div> {{item}}日 </div>
|
||||||
|
{{# } }}
|
||||||
|
{{# }); }}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
200
web/src/x.min.js
vendored
200
web/src/x.min.js
vendored
@ -700,7 +700,7 @@ var X = window.X || {
|
|||||||
};
|
};
|
||||||
|
|
||||||
X.eventsmall = function(data,callback){
|
X.eventsmall = function(data,callback){
|
||||||
var date,num,wowtype,chain_ratiotype; //时间,当天数量
|
var date,num,wowtype="",chain_ratiotype=""; //时间,当天数量
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
// for(let i in data){
|
// for(let i in data){
|
||||||
// if(data[i]['groups']['length'] == 0){
|
// if(data[i]['groups']['length'] == 0){
|
||||||
@ -711,17 +711,21 @@ var X = window.X || {
|
|||||||
var length = data[0]['date_range'].length - 1;
|
var length = data[0]['date_range'].length - 1;
|
||||||
date = data[0]['date_range'][length];
|
date = data[0]['date_range'][length];
|
||||||
num = data[0]['values'][0][length];
|
num = data[0]['values'][0][length];
|
||||||
|
if(data[0]['wow']){
|
||||||
if(data[0]['wow'] >= 0){
|
if(data[0]['wow'] >= 0){
|
||||||
wowtype = '+'
|
wowtype = '+'
|
||||||
}else{
|
}else{
|
||||||
wowtype = '-'
|
wowtype = '-'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data[0]['chain_ratio']){
|
||||||
if(data[0]['chain_ratio'] >= 0){
|
if(data[0]['chain_ratio'] >= 0){
|
||||||
chain_ratiotype = '+'
|
chain_ratiotype = '+'
|
||||||
}else{
|
}else{
|
||||||
chain_ratiotype = '-'
|
chain_ratiotype = '-'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var dataArr = {
|
var dataArr = {
|
||||||
date: date,
|
date: date,
|
||||||
@ -741,6 +745,21 @@ var X = window.X || {
|
|||||||
nname = 'n_outflow';
|
nname = 'n_outflow';
|
||||||
pname = 'p_outflow';
|
pname = 'p_outflow';
|
||||||
}
|
}
|
||||||
|
console.log()
|
||||||
|
if(data['filter_item_type'] != "all" && data['filter_item_type'] != "" && data['filter_item_type']){
|
||||||
|
var filteritem = data['filter_item'];
|
||||||
|
if(data['days'].length >= 7){
|
||||||
|
var filterarr = [];
|
||||||
|
for(let i in data['days']){
|
||||||
|
for(let j in filteritem){
|
||||||
|
if(data['days'][i] == filteritem[j]){
|
||||||
|
filterarr.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var tabledata=[];
|
var tabledata=[];
|
||||||
for(let i in data['summary_values']){
|
for(let i in data['summary_values']){
|
||||||
var arr = {
|
var arr = {
|
||||||
@ -753,19 +772,51 @@ var X = window.X || {
|
|||||||
n:0,
|
n:0,
|
||||||
p:0
|
p:0
|
||||||
}
|
}
|
||||||
|
if(data['filter_item_type'] != "all" && data['filter_item_type'] != "" && data['filter_item_type']){
|
||||||
|
for(let a in filterarr){
|
||||||
|
var index = Number(filterarr[a]);
|
||||||
|
if(j == index){
|
||||||
nrr["n"] = data['summary_values'][i][nname][j];
|
nrr["n"] = data['summary_values'][i][nname][j];
|
||||||
nrr["p"] = data['summary_values'][i][pname][j]
|
nrr["p"] = data['summary_values'][i][pname][j]
|
||||||
arr['data'].push(nrr);
|
arr['data'].push(nrr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
nrr["n"] = data['summary_values'][i][nname][j];
|
||||||
|
nrr["p"] = data['summary_values'][i][pname][j]
|
||||||
|
arr['data'].push(nrr);
|
||||||
|
}
|
||||||
|
// nrr["n"] = data['summary_values'][i][nname][j];
|
||||||
|
// nrr["p"] = data['summary_values'][i][pname][j]
|
||||||
|
// arr['data'].push(nrr);
|
||||||
|
}
|
||||||
tabledata.push(arr);
|
tabledata.push(arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
var titdata = [];
|
var titdata = [];
|
||||||
|
// for(let i in data['days']){
|
||||||
|
// var tit = "第" + i + "日";
|
||||||
|
// titdata.push(tit);
|
||||||
|
// }
|
||||||
|
if(data['filter_item_type'] != "all" && data['filter_item_type'] != "" && data['filter_item_type']){
|
||||||
|
var titarr = [];
|
||||||
|
for(let j in filterarr){
|
||||||
|
var index = Number(filterarr[j]);
|
||||||
|
titarr.push(data['days'][index]);
|
||||||
|
}
|
||||||
|
for(let i in titarr){
|
||||||
|
var tit = "第" + titarr[i] + "日";
|
||||||
|
titdata.push(tit);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
for(let i in data['days']){
|
for(let i in data['days']){
|
||||||
var tit = "第" + i + "日";
|
var tit = "第" + i + "日";
|
||||||
titdata.push(tit);
|
titdata.push(tit);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
titdata.unshift("日期",data.title);
|
titdata.unshift("日期",data.title);
|
||||||
|
console.log(titdata);
|
||||||
|
console.log(tabledata);
|
||||||
var dataArr = {
|
var dataArr = {
|
||||||
titledata:titdata,
|
titledata:titdata,
|
||||||
condata:tabledata,
|
condata:tabledata,
|
||||||
@ -775,7 +826,7 @@ var X = window.X || {
|
|||||||
};
|
};
|
||||||
|
|
||||||
X.retentionchart = function(d,callback){
|
X.retentionchart = function(d,callback){
|
||||||
var nname,pname
|
var nname,pname,wowtype="",chain_ratiotype="";
|
||||||
if(d.retentiontype == 0) {
|
if(d.retentiontype == 0) {
|
||||||
nname = 'n';
|
nname = 'n';
|
||||||
pname = 'p';
|
pname = 'p';
|
||||||
@ -847,6 +898,22 @@ var X = window.X || {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(d['wow']){
|
||||||
|
if(d['wow'] >= 0){
|
||||||
|
wowtype = '+'
|
||||||
|
}else{
|
||||||
|
wowtype = '-'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(d['chain_ratio']){
|
||||||
|
if(d['chain_ratio'] >= 0){
|
||||||
|
chain_ratiotype = '+'
|
||||||
|
}else{
|
||||||
|
chain_ratiotype = '-'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var dataArr = {
|
var dataArr = {
|
||||||
xAxisData:xAxisData,
|
xAxisData:xAxisData,
|
||||||
legenddata:legenddata,
|
legenddata:legenddata,
|
||||||
@ -855,6 +922,8 @@ var X = window.X || {
|
|||||||
sum:sum.toFixed(2),
|
sum:sum.toFixed(2),
|
||||||
mean:mean,
|
mean:mean,
|
||||||
sameday: sameday,
|
sameday: sameday,
|
||||||
|
wowtype:wowtype,
|
||||||
|
chain_ratiotype:chain_ratiotype,
|
||||||
retentiontype:d.retentiontype
|
retentiontype:d.retentiontype
|
||||||
}
|
}
|
||||||
// console.log(dataArr);
|
// console.log(dataArr);
|
||||||
@ -8125,6 +8194,7 @@ var X = window.X || {
|
|||||||
|
|
||||||
X.template("grouped","shushi");
|
X.template("grouped","shushi");
|
||||||
// X.template("toptab","analysis-zhanwei",X.DATA['projectarr']);
|
// X.template("toptab","analysis-zhanwei",X.DATA['projectarr']);
|
||||||
|
|
||||||
var data ={
|
var data ={
|
||||||
"eventView":{
|
"eventView":{
|
||||||
"cksql":"retention",
|
"cksql":"retention",
|
||||||
@ -8137,7 +8207,9 @@ var X = window.X || {
|
|||||||
"startTime":"2021-05-09 00:00:00",
|
"startTime":"2021-05-09 00:00:00",
|
||||||
"statType":"retention",
|
"statType":"retention",
|
||||||
"timeParticleSize":"P1D",
|
"timeParticleSize":"P1D",
|
||||||
"unitNum":7
|
"unitNum":7,
|
||||||
|
"filter_item_type":'all',
|
||||||
|
"filter_item":[]
|
||||||
},
|
},
|
||||||
"events":[
|
"events":[
|
||||||
|
|
||||||
@ -8152,6 +8224,9 @@ var X = window.X || {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 重新渲染控件
|
||||||
|
layui.form.render();
|
||||||
|
|
||||||
// 日期渲染
|
// 日期渲染
|
||||||
X.daterender("#retained-condition-date",function(start, end, label){
|
X.daterender("#retained-condition-date",function(start, end, label){
|
||||||
var startTime = start.format('YYYY-MM-DD')+ " "+ "00:00:00";
|
var startTime = start.format('YYYY-MM-DD')+ " "+ "00:00:00";
|
||||||
@ -8687,6 +8762,29 @@ var X = window.X || {
|
|||||||
//数据报表渲染
|
//数据报表渲染
|
||||||
function retainedtable(d){
|
function retainedtable(d){
|
||||||
var nname,pname
|
var nname,pname
|
||||||
|
|
||||||
|
if(data['eventView']['filter_item_type'] != "all"){
|
||||||
|
var filteritem = data['eventView']['filter_item'];
|
||||||
|
if(d['days'].length >= 7){
|
||||||
|
var filterarr = [];
|
||||||
|
for(let i in d['days']){
|
||||||
|
for(let j in filteritem){
|
||||||
|
if(d['days'][i] == filteritem[j]){
|
||||||
|
filterarr.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// var titarr = [];
|
||||||
|
// var tablearr = [];
|
||||||
|
// for(let i in filterarr){
|
||||||
|
// var index = Number(filterarr[i]) + 2;
|
||||||
|
// titarr.push(titdata[index]);
|
||||||
|
// }
|
||||||
|
// titarr.unshift(titdata[0],titdata[1]);
|
||||||
|
// console.log(titarr);
|
||||||
|
}
|
||||||
|
|
||||||
if(retentiontype == 0) {
|
if(retentiontype == 0) {
|
||||||
nname = 'n';
|
nname = 'n';
|
||||||
pname = 'p';
|
pname = 'p';
|
||||||
@ -8706,20 +8804,48 @@ var X = window.X || {
|
|||||||
n:0,
|
n:0,
|
||||||
p:0
|
p:0
|
||||||
}
|
}
|
||||||
|
if(data['eventView']['filter_item_type'] != "all"){
|
||||||
|
for(let a in filterarr){
|
||||||
|
var index = Number(filterarr[a]);
|
||||||
|
if(j == index){
|
||||||
nrr["n"] = d['summary_values'][i][nname][j];
|
nrr["n"] = d['summary_values'][i][nname][j];
|
||||||
nrr["p"] = d['summary_values'][i][pname][j]
|
nrr["p"] = d['summary_values'][i][pname][j]
|
||||||
arr['data'].push(nrr);
|
arr['data'].push(nrr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
nrr["n"] = d['summary_values'][i][nname][j];
|
||||||
|
nrr["p"] = d['summary_values'][i][pname][j]
|
||||||
|
arr['data'].push(nrr);
|
||||||
|
}
|
||||||
|
}
|
||||||
tabledata.push(arr)
|
tabledata.push(arr)
|
||||||
}
|
}
|
||||||
|
|
||||||
var titdata = [];
|
var titdata = [];
|
||||||
|
if(data['eventView']['filter_item_type'] != "all"){
|
||||||
|
var titarr = [];
|
||||||
|
for(let j in filterarr){
|
||||||
|
var index = Number(filterarr[j]);
|
||||||
|
titarr.push(d['days'][index]);
|
||||||
|
}
|
||||||
|
for(let i in titarr){
|
||||||
|
var tit = "第" + titarr[i] + "日";
|
||||||
|
titdata.push(tit);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
for(let i in d['days']){
|
for(let i in d['days']){
|
||||||
var tit = "第" + i + "日";
|
var tit = "第" + i + "日";
|
||||||
titdata.push(tit);
|
titdata.push(tit);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
titdata.unshift("日期",d.title);
|
titdata.unshift("日期",d.title);
|
||||||
// X.fixedTable=function(id,type,classname,headdata){
|
console.log(titdata);
|
||||||
|
|
||||||
|
|
||||||
|
// X.fixedTable('table-div-box','row-col-fixed','',headdata);
|
||||||
|
|
||||||
|
|
||||||
X.laytpldata("#table-fenxi-th-dot",titdata,".table-fenxi-th");
|
X.laytpldata("#table-fenxi-th-dot",titdata,".table-fenxi-th");
|
||||||
X.laytpldata("#table-fenxi-td-dot",tabledata,".table-fenxi-td");
|
X.laytpldata("#table-fenxi-td-dot",tabledata,".table-fenxi-td");
|
||||||
};
|
};
|
||||||
@ -8947,6 +9073,70 @@ var X = window.X || {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//显示设置
|
||||||
|
$(document).off('click','.analtsis-condition').on('click','.analtsis-condition',function(){
|
||||||
|
var obj = $(this);
|
||||||
|
var offset = obj.offset();
|
||||||
|
// offset.left,offset.top+obj.height()
|
||||||
|
$(".showsetup-box").show();
|
||||||
|
$(".showsetup-down-box").css('top',offset.top+obj.height());
|
||||||
|
$(".showsetup-down-box").css('left',offset.left-211);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).off('click','.showsetup-box-zz').on('click','.showsetup-box-zz',function(){
|
||||||
|
$(".showsetup-box").hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
layui.form.on('radio(showsetup)', function(val){
|
||||||
|
if(val.value == 'date'){
|
||||||
|
$(".showsetup-edit").show();
|
||||||
|
$(".showsetup-bianji-show-box-type").show();
|
||||||
|
var value = $(".showsetup-bianji-input-box textarea").val();
|
||||||
|
var valarr = value.split(',');
|
||||||
|
valarr.sort(function(a, b){return a - b});
|
||||||
|
var listarr = unique(valarr);
|
||||||
|
data['eventView']['filter_item'] = listarr;
|
||||||
|
X.laytpldata("#showsetup-bianji-show-box-dot",listarr,".showsetup-bianji-show-box");
|
||||||
|
}else {
|
||||||
|
$(".showsetup-edit").hide();
|
||||||
|
$(".showsetup-wancheng").hide();
|
||||||
|
$(".showsetup-bianji-show-box-type").hide();
|
||||||
|
$(".showsetup-bianji-input-box-type").hide();
|
||||||
|
|
||||||
|
}
|
||||||
|
data['eventView']['filter_item_type'] = val.value;
|
||||||
|
if(querydata){
|
||||||
|
retainedtable(querydata)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).off('click','.showsetup-edit').on('click','.showsetup-edit',function(){
|
||||||
|
$(".showsetup-edit").hide();
|
||||||
|
$(".showsetup-wancheng").show();
|
||||||
|
$(".showsetup-bianji-show-box-type").hide();
|
||||||
|
$(".showsetup-bianji-input-box-type").show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).off('click','.showsetup-wancheng').on('click','.showsetup-wancheng',function(){
|
||||||
|
$(".showsetup-edit").show();
|
||||||
|
$(".showsetup-wancheng").hide();
|
||||||
|
$(".showsetup-bianji-show-box-type").show();
|
||||||
|
$(".showsetup-bianji-input-box-type").hide();
|
||||||
|
var value = $(".showsetup-bianji-input-box textarea").val();
|
||||||
|
var valarr = value.split(',');
|
||||||
|
valarr.sort(function(a, b){return a - b});
|
||||||
|
var listarr = unique(valarr);
|
||||||
|
data['eventView']['filter_item'] = listarr;
|
||||||
|
X.laytpldata("#showsetup-bianji-show-box-dot",listarr,".showsetup-bianji-show-box");
|
||||||
|
if(querydata){
|
||||||
|
retainedtable(querydata)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function unique (arr) {
|
||||||
|
return Array.from(new Set(arr))
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
@ -9676,8 +9866,6 @@ var X = window.X || {
|
|||||||
desc:tabval['desc'],
|
desc:tabval['desc'],
|
||||||
query:data['query'],
|
query:data['query'],
|
||||||
report_id:data['_id']
|
report_id:data['_id']
|
||||||
// project_id:X.DATA.projectid,
|
|
||||||
// cat: data['query']['eventView']['cksql']
|
|
||||||
}
|
}
|
||||||
X.api('report/edit','post',arr,function(d){
|
X.api('report/edit','post',arr,function(d){
|
||||||
layer.msg(d);
|
layer.msg(d);
|
||||||
|
@ -699,7 +699,7 @@ var X = window.X || {
|
|||||||
};
|
};
|
||||||
|
|
||||||
X.eventsmall = function(data,callback){
|
X.eventsmall = function(data,callback){
|
||||||
var date,num,wowtype,chain_ratiotype; //时间,当天数量
|
var date,num,wowtype="",chain_ratiotype=""; //时间,当天数量
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
// for(let i in data){
|
// for(let i in data){
|
||||||
// if(data[i]['groups']['length'] == 0){
|
// if(data[i]['groups']['length'] == 0){
|
||||||
@ -710,17 +710,21 @@ var X = window.X || {
|
|||||||
var length = data[0]['date_range'].length - 1;
|
var length = data[0]['date_range'].length - 1;
|
||||||
date = data[0]['date_range'][length];
|
date = data[0]['date_range'][length];
|
||||||
num = data[0]['values'][0][length];
|
num = data[0]['values'][0][length];
|
||||||
|
if(data[0]['wow']){
|
||||||
if(data[0]['wow'] >= 0){
|
if(data[0]['wow'] >= 0){
|
||||||
wowtype = '+'
|
wowtype = '+'
|
||||||
}else{
|
}else{
|
||||||
wowtype = '-'
|
wowtype = '-'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data[0]['chain_ratio']){
|
||||||
if(data[0]['chain_ratio'] >= 0){
|
if(data[0]['chain_ratio'] >= 0){
|
||||||
chain_ratiotype = '+'
|
chain_ratiotype = '+'
|
||||||
}else{
|
}else{
|
||||||
chain_ratiotype = '-'
|
chain_ratiotype = '-'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var dataArr = {
|
var dataArr = {
|
||||||
date: date,
|
date: date,
|
||||||
@ -740,6 +744,21 @@ var X = window.X || {
|
|||||||
nname = 'n_outflow';
|
nname = 'n_outflow';
|
||||||
pname = 'p_outflow';
|
pname = 'p_outflow';
|
||||||
}
|
}
|
||||||
|
console.log()
|
||||||
|
if(data['filter_item_type'] != "all" && data['filter_item_type'] != "" && data['filter_item_type']){
|
||||||
|
var filteritem = data['filter_item'];
|
||||||
|
if(data['days'].length >= 7){
|
||||||
|
var filterarr = [];
|
||||||
|
for(let i in data['days']){
|
||||||
|
for(let j in filteritem){
|
||||||
|
if(data['days'][i] == filteritem[j]){
|
||||||
|
filterarr.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var tabledata=[];
|
var tabledata=[];
|
||||||
for(let i in data['summary_values']){
|
for(let i in data['summary_values']){
|
||||||
var arr = {
|
var arr = {
|
||||||
@ -752,19 +771,51 @@ var X = window.X || {
|
|||||||
n:0,
|
n:0,
|
||||||
p:0
|
p:0
|
||||||
}
|
}
|
||||||
|
if(data['filter_item_type'] != "all" && data['filter_item_type'] != "" && data['filter_item_type']){
|
||||||
|
for(let a in filterarr){
|
||||||
|
var index = Number(filterarr[a]);
|
||||||
|
if(j == index){
|
||||||
nrr["n"] = data['summary_values'][i][nname][j];
|
nrr["n"] = data['summary_values'][i][nname][j];
|
||||||
nrr["p"] = data['summary_values'][i][pname][j]
|
nrr["p"] = data['summary_values'][i][pname][j]
|
||||||
arr['data'].push(nrr);
|
arr['data'].push(nrr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
nrr["n"] = data['summary_values'][i][nname][j];
|
||||||
|
nrr["p"] = data['summary_values'][i][pname][j]
|
||||||
|
arr['data'].push(nrr);
|
||||||
|
}
|
||||||
|
// nrr["n"] = data['summary_values'][i][nname][j];
|
||||||
|
// nrr["p"] = data['summary_values'][i][pname][j]
|
||||||
|
// arr['data'].push(nrr);
|
||||||
|
}
|
||||||
tabledata.push(arr);
|
tabledata.push(arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
var titdata = [];
|
var titdata = [];
|
||||||
|
// for(let i in data['days']){
|
||||||
|
// var tit = "第" + i + "日";
|
||||||
|
// titdata.push(tit);
|
||||||
|
// }
|
||||||
|
if(data['filter_item_type'] != "all" && data['filter_item_type'] != "" && data['filter_item_type']){
|
||||||
|
var titarr = [];
|
||||||
|
for(let j in filterarr){
|
||||||
|
var index = Number(filterarr[j]);
|
||||||
|
titarr.push(data['days'][index]);
|
||||||
|
}
|
||||||
|
for(let i in titarr){
|
||||||
|
var tit = "第" + titarr[i] + "日";
|
||||||
|
titdata.push(tit);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
for(let i in data['days']){
|
for(let i in data['days']){
|
||||||
var tit = "第" + i + "日";
|
var tit = "第" + i + "日";
|
||||||
titdata.push(tit);
|
titdata.push(tit);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
titdata.unshift("日期",data.title);
|
titdata.unshift("日期",data.title);
|
||||||
|
console.log(titdata);
|
||||||
|
console.log(tabledata);
|
||||||
var dataArr = {
|
var dataArr = {
|
||||||
titledata:titdata,
|
titledata:titdata,
|
||||||
condata:tabledata,
|
condata:tabledata,
|
||||||
@ -774,7 +825,7 @@ var X = window.X || {
|
|||||||
};
|
};
|
||||||
|
|
||||||
X.retentionchart = function(d,callback){
|
X.retentionchart = function(d,callback){
|
||||||
var nname,pname
|
var nname,pname,wowtype="",chain_ratiotype="";
|
||||||
if(d.retentiontype == 0) {
|
if(d.retentiontype == 0) {
|
||||||
nname = 'n';
|
nname = 'n';
|
||||||
pname = 'p';
|
pname = 'p';
|
||||||
@ -846,6 +897,22 @@ var X = window.X || {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(d['wow']){
|
||||||
|
if(d['wow'] >= 0){
|
||||||
|
wowtype = '+'
|
||||||
|
}else{
|
||||||
|
wowtype = '-'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(d['chain_ratio']){
|
||||||
|
if(d['chain_ratio'] >= 0){
|
||||||
|
chain_ratiotype = '+'
|
||||||
|
}else{
|
||||||
|
chain_ratiotype = '-'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var dataArr = {
|
var dataArr = {
|
||||||
xAxisData:xAxisData,
|
xAxisData:xAxisData,
|
||||||
legenddata:legenddata,
|
legenddata:legenddata,
|
||||||
@ -854,6 +921,8 @@ var X = window.X || {
|
|||||||
sum:sum.toFixed(2),
|
sum:sum.toFixed(2),
|
||||||
mean:mean,
|
mean:mean,
|
||||||
sameday: sameday,
|
sameday: sameday,
|
||||||
|
wowtype:wowtype,
|
||||||
|
chain_ratiotype:chain_ratiotype,
|
||||||
retentiontype:d.retentiontype
|
retentiontype:d.retentiontype
|
||||||
}
|
}
|
||||||
// console.log(dataArr);
|
// console.log(dataArr);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
X.template("grouped","shushi");
|
X.template("grouped","shushi");
|
||||||
// X.template("toptab","analysis-zhanwei",X.DATA['projectarr']);
|
// X.template("toptab","analysis-zhanwei",X.DATA['projectarr']);
|
||||||
|
|
||||||
var data ={
|
var data ={
|
||||||
"eventView":{
|
"eventView":{
|
||||||
"cksql":"retention",
|
"cksql":"retention",
|
||||||
@ -16,7 +17,9 @@
|
|||||||
"startTime":"2021-05-09 00:00:00",
|
"startTime":"2021-05-09 00:00:00",
|
||||||
"statType":"retention",
|
"statType":"retention",
|
||||||
"timeParticleSize":"P1D",
|
"timeParticleSize":"P1D",
|
||||||
"unitNum":7
|
"unitNum":7,
|
||||||
|
"filter_item_type":'all',
|
||||||
|
"filter_item":[]
|
||||||
},
|
},
|
||||||
"events":[
|
"events":[
|
||||||
|
|
||||||
@ -31,6 +34,9 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 重新渲染控件
|
||||||
|
layui.form.render();
|
||||||
|
|
||||||
// 日期渲染
|
// 日期渲染
|
||||||
X.daterender("#retained-condition-date",function(start, end, label){
|
X.daterender("#retained-condition-date",function(start, end, label){
|
||||||
var startTime = start.format('YYYY-MM-DD')+ " "+ "00:00:00";
|
var startTime = start.format('YYYY-MM-DD')+ " "+ "00:00:00";
|
||||||
@ -566,6 +572,29 @@
|
|||||||
//数据报表渲染
|
//数据报表渲染
|
||||||
function retainedtable(d){
|
function retainedtable(d){
|
||||||
var nname,pname
|
var nname,pname
|
||||||
|
|
||||||
|
if(data['eventView']['filter_item_type'] != "all"){
|
||||||
|
var filteritem = data['eventView']['filter_item'];
|
||||||
|
if(d['days'].length >= 7){
|
||||||
|
var filterarr = [];
|
||||||
|
for(let i in d['days']){
|
||||||
|
for(let j in filteritem){
|
||||||
|
if(d['days'][i] == filteritem[j]){
|
||||||
|
filterarr.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// var titarr = [];
|
||||||
|
// var tablearr = [];
|
||||||
|
// for(let i in filterarr){
|
||||||
|
// var index = Number(filterarr[i]) + 2;
|
||||||
|
// titarr.push(titdata[index]);
|
||||||
|
// }
|
||||||
|
// titarr.unshift(titdata[0],titdata[1]);
|
||||||
|
// console.log(titarr);
|
||||||
|
}
|
||||||
|
|
||||||
if(retentiontype == 0) {
|
if(retentiontype == 0) {
|
||||||
nname = 'n';
|
nname = 'n';
|
||||||
pname = 'p';
|
pname = 'p';
|
||||||
@ -585,20 +614,48 @@
|
|||||||
n:0,
|
n:0,
|
||||||
p:0
|
p:0
|
||||||
}
|
}
|
||||||
|
if(data['eventView']['filter_item_type'] != "all"){
|
||||||
|
for(let a in filterarr){
|
||||||
|
var index = Number(filterarr[a]);
|
||||||
|
if(j == index){
|
||||||
nrr["n"] = d['summary_values'][i][nname][j];
|
nrr["n"] = d['summary_values'][i][nname][j];
|
||||||
nrr["p"] = d['summary_values'][i][pname][j]
|
nrr["p"] = d['summary_values'][i][pname][j]
|
||||||
arr['data'].push(nrr);
|
arr['data'].push(nrr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
nrr["n"] = d['summary_values'][i][nname][j];
|
||||||
|
nrr["p"] = d['summary_values'][i][pname][j]
|
||||||
|
arr['data'].push(nrr);
|
||||||
|
}
|
||||||
|
}
|
||||||
tabledata.push(arr)
|
tabledata.push(arr)
|
||||||
}
|
}
|
||||||
|
|
||||||
var titdata = [];
|
var titdata = [];
|
||||||
|
if(data['eventView']['filter_item_type'] != "all"){
|
||||||
|
var titarr = [];
|
||||||
|
for(let j in filterarr){
|
||||||
|
var index = Number(filterarr[j]);
|
||||||
|
titarr.push(d['days'][index]);
|
||||||
|
}
|
||||||
|
for(let i in titarr){
|
||||||
|
var tit = "第" + titarr[i] + "日";
|
||||||
|
titdata.push(tit);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
for(let i in d['days']){
|
for(let i in d['days']){
|
||||||
var tit = "第" + i + "日";
|
var tit = "第" + i + "日";
|
||||||
titdata.push(tit);
|
titdata.push(tit);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
titdata.unshift("日期",d.title);
|
titdata.unshift("日期",d.title);
|
||||||
// X.fixedTable=function(id,type,classname,headdata){
|
console.log(titdata);
|
||||||
|
|
||||||
|
|
||||||
|
// X.fixedTable('table-div-box','row-col-fixed','',headdata);
|
||||||
|
|
||||||
|
|
||||||
X.laytpldata("#table-fenxi-th-dot",titdata,".table-fenxi-th");
|
X.laytpldata("#table-fenxi-th-dot",titdata,".table-fenxi-th");
|
||||||
X.laytpldata("#table-fenxi-td-dot",tabledata,".table-fenxi-td");
|
X.laytpldata("#table-fenxi-td-dot",tabledata,".table-fenxi-td");
|
||||||
};
|
};
|
||||||
@ -826,6 +883,70 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//显示设置
|
||||||
|
$(document).off('click','.analtsis-condition').on('click','.analtsis-condition',function(){
|
||||||
|
var obj = $(this);
|
||||||
|
var offset = obj.offset();
|
||||||
|
// offset.left,offset.top+obj.height()
|
||||||
|
$(".showsetup-box").show();
|
||||||
|
$(".showsetup-down-box").css('top',offset.top+obj.height());
|
||||||
|
$(".showsetup-down-box").css('left',offset.left-211);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).off('click','.showsetup-box-zz').on('click','.showsetup-box-zz',function(){
|
||||||
|
$(".showsetup-box").hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
layui.form.on('radio(showsetup)', function(val){
|
||||||
|
if(val.value == 'date'){
|
||||||
|
$(".showsetup-edit").show();
|
||||||
|
$(".showsetup-bianji-show-box-type").show();
|
||||||
|
var value = $(".showsetup-bianji-input-box textarea").val();
|
||||||
|
var valarr = value.split(',');
|
||||||
|
valarr.sort(function(a, b){return a - b});
|
||||||
|
var listarr = unique(valarr);
|
||||||
|
data['eventView']['filter_item'] = listarr;
|
||||||
|
X.laytpldata("#showsetup-bianji-show-box-dot",listarr,".showsetup-bianji-show-box");
|
||||||
|
}else {
|
||||||
|
$(".showsetup-edit").hide();
|
||||||
|
$(".showsetup-wancheng").hide();
|
||||||
|
$(".showsetup-bianji-show-box-type").hide();
|
||||||
|
$(".showsetup-bianji-input-box-type").hide();
|
||||||
|
|
||||||
|
}
|
||||||
|
data['eventView']['filter_item_type'] = val.value;
|
||||||
|
if(querydata){
|
||||||
|
retainedtable(querydata)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).off('click','.showsetup-edit').on('click','.showsetup-edit',function(){
|
||||||
|
$(".showsetup-edit").hide();
|
||||||
|
$(".showsetup-wancheng").show();
|
||||||
|
$(".showsetup-bianji-show-box-type").hide();
|
||||||
|
$(".showsetup-bianji-input-box-type").show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).off('click','.showsetup-wancheng').on('click','.showsetup-wancheng',function(){
|
||||||
|
$(".showsetup-edit").show();
|
||||||
|
$(".showsetup-wancheng").hide();
|
||||||
|
$(".showsetup-bianji-show-box-type").show();
|
||||||
|
$(".showsetup-bianji-input-box-type").hide();
|
||||||
|
var value = $(".showsetup-bianji-input-box textarea").val();
|
||||||
|
var valarr = value.split(',');
|
||||||
|
valarr.sort(function(a, b){return a - b});
|
||||||
|
var listarr = unique(valarr);
|
||||||
|
data['eventView']['filter_item'] = listarr;
|
||||||
|
X.laytpldata("#showsetup-bianji-show-box-dot",listarr,".showsetup-bianji-show-box");
|
||||||
|
if(querydata){
|
||||||
|
retainedtable(querydata)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function unique (arr) {
|
||||||
|
return Array.from(new Set(arr))
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
@ -28,8 +28,6 @@
|
|||||||
desc:tabval['desc'],
|
desc:tabval['desc'],
|
||||||
query:data['query'],
|
query:data['query'],
|
||||||
report_id:data['_id']
|
report_id:data['_id']
|
||||||
// project_id:X.DATA.projectid,
|
|
||||||
// cat: data['query']['eventView']['cksql']
|
|
||||||
}
|
}
|
||||||
X.api('report/edit','post',arr,function(d){
|
X.api('report/edit','post',arr,function(d){
|
||||||
layer.msg(d);
|
layer.msg(d);
|
||||||
|
@ -324,3 +324,19 @@
|
|||||||
.to-added-baobiao { height: calc(100% - 65px); padding: 4px; overflow-x: hidden; overflow-y: auto; }
|
.to-added-baobiao { height: calc(100% - 65px); padding: 4px; overflow-x: hidden; overflow-y: auto; }
|
||||||
|
|
||||||
|
|
||||||
|
/* 显示设置 */
|
||||||
|
.showsetup-box { display: none; }
|
||||||
|
.showsetup-box-zz { width: 100%; height: 100%; position: fixed; left: 0; top: 0; background-color: rgba(255,255,255,0); }
|
||||||
|
.showsetup-down-box { width: 280px; padding: 8px 0; overflow: auto; position: fixed; background-color: #fff; border-radius: 2px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
|
||||||
|
.showsetup-radio-box { padding: 0 16px; }
|
||||||
|
.showsetup-radio-box i{ font-size: 13px !important; }
|
||||||
|
.showsetup-bianji { position: absolute; right: 20px; top: 50px; color:#3d90ff; font-size: 14px; cursor: pointer; }
|
||||||
|
.showsetup-bianji-show-box { display: flex; flex-wrap: wrap; padding: 16px 0 0 10px; border-top: 1px solid #eef1f7; }
|
||||||
|
.showsetup-bianji-show-box div { display: flex; align-items: center; justify-content: center; min-width: 72px; height: 24px; margin-right: 16px; margin-bottom: 16px; color: #96989b; border: 1px solid #e0e3e7; border-radius: 2px; }
|
||||||
|
.showsetup-bianji-show-box-type { display: none; }
|
||||||
|
.showsetup-bianji-input-box-type { display: none; }
|
||||||
|
.showsetup-bianji-input-box { padding: 10px 16px 0; border-top: 1px solid #eef1f7; }
|
||||||
|
.showsetup-bianji-input-box textarea { max-width: calc(100% - 16px); height: auto; width: calc(100% - 16px); min-height: 32px; padding: 0 8px; color: #42546d; font-size: 14px; line-height: 24px; border: 1px solid #f0f0f0; border-radius: 2px; resize: none; }
|
||||||
|
.showsetup-wancheng { display: none; }
|
||||||
|
.showsetup-edit { display: none; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user