240 lines
11 KiB
JavaScript
240 lines
11 KiB
JavaScript
(function(){
|
|
X.pageLogic['routeanalysis'] = {
|
|
init : function(){
|
|
var eventdata = {};
|
|
X.api("data_auth/my_event","get",{},function(d){
|
|
eventdata['list'] = d;
|
|
})
|
|
|
|
var data = {
|
|
"eventView":{
|
|
"col_limit":10,
|
|
"startTime":"2021-06-22 00:00:00",
|
|
"recent_day":"1-7",
|
|
"session_interval":30,
|
|
"session_type":"minute",
|
|
"endTime":"2021-06-28 23:59:59"
|
|
},
|
|
"events":{
|
|
"by_fields":[
|
|
|
|
],
|
|
"event_names":[],
|
|
"source_event":{
|
|
"event_name":"complete_activity",
|
|
"event_Desc":"complete_activity",
|
|
"source_type":"initial_event",
|
|
"filts": [],
|
|
"relation":'and'
|
|
},
|
|
"user_filter":{
|
|
"filterType":"COMPOUND",
|
|
"filts":[]
|
|
}
|
|
}
|
|
}
|
|
|
|
X.template("route","event-roue-event",data['events']['source_event']);
|
|
|
|
// 日期渲染
|
|
X.daterender("#route-condition-date",function(start, end, label){
|
|
var startTime = start.format('YYYY-MM-DD')+ " "+ "00:00:00";
|
|
var endTime = end.format('YYYY-MM-DD')+ " "+ "23:59:59";
|
|
data['eventView']['startTime'] = startTime;
|
|
data['eventView']['endTime'] = endTime;
|
|
retaineddata();
|
|
})
|
|
|
|
var time = $("#route-condition-date").val();
|
|
var timearr = time.split(" ");
|
|
data['eventView']['startTime'] = timearr[0] + " "+"00:00:00";
|
|
data['eventView']['endTime'] = timearr[2]+" "+"23:59:59";
|
|
|
|
$(document).off('click','.eventsplit').on('click','.eventsplit',function(){
|
|
var routeevent = X['DATA']['routeevent'];
|
|
console.log(routeevent);
|
|
if( routeevent && routeevent.length > data['events']['by_fields'].length){
|
|
var arr = {
|
|
"eventName": routeevent[data['events']['by_fields'].length]['id'],
|
|
"eventDesc": routeevent[data['events']['by_fields'].length]['title'],
|
|
"field":"rmbmoney",
|
|
"fieDesc":"rmbmoney",
|
|
"range":"",
|
|
"range_type":"def",
|
|
"table_type":"event"
|
|
};
|
|
data['events']['by_fields'].push(arr);
|
|
X.laytpldata("#eventsplit-box-dot",data['events']['by_fields'],".eventsplit-box");
|
|
|
|
X.api("data_auth/load_filter_props","post",{event_name:routeevent[data['events']['by_fields'].length]['id']},function(val){
|
|
console.log(val);
|
|
// defaultgroupdata = val;
|
|
groupitemeventsdata.push(val);
|
|
})
|
|
|
|
}
|
|
})
|
|
|
|
$(document).off('click','.route-action-right').on('click','.route-action-right',function(){
|
|
var index = $(this).attr('data-index');
|
|
data['events']['by_fields'].splice(index,1);
|
|
X.laytpldata("#eventsplit-box-dot",data['events']['by_fields'],".eventsplit-box");
|
|
})
|
|
|
|
$(document).off('click','.participate-box').on('click','.participate-box',function(){
|
|
var obj = $(this);
|
|
var offset = obj.offset();
|
|
X.querycriteriapop(eventdata,'participate',offset.left,offset.top+obj.height(),function(val){
|
|
var selectdata = []; //选中事件的id数组
|
|
// var selectdescdata = []; //选中事件的别名数组
|
|
for(let i in val){
|
|
selectdata.push(val[i]['event_name']);
|
|
// selectdescdata.push(val[i]['event_desc']);
|
|
}
|
|
eventdata['select'] = selectdata;
|
|
data['event_names'] = selectdata;
|
|
$('.participate-num').html(selectdata.length);
|
|
|
|
for(let i in val){
|
|
var arr = {
|
|
title: val[i]['event_desc']
|
|
,id: val[i]['event_name']
|
|
}
|
|
if(X.DATA['routeevent']){
|
|
X.DATA['routeevent'].push(arr);
|
|
}else {
|
|
X.DATA['routeevent'] = [];
|
|
X.DATA['routeevent'].push(arr);
|
|
}
|
|
}
|
|
})
|
|
})
|
|
var groupitemeventsdata = [];
|
|
$(document).off('click','.route-ant-select-selector1').on('click','.route-ant-select-selector1',function(){
|
|
var obj = $(this);
|
|
var offset = obj.offset();
|
|
var index = obj.attr('data-index');
|
|
X.querycriteriapop(X.DATA['routeevent'],'dropdownlist',offset.left,offset.top+obj.height(),function(val){
|
|
obj.html(val.title);
|
|
data['events']['by_fields'][index]['eventDesc'] = val.title;
|
|
data['events']['by_fields'][index]['eventName'] = val.id;
|
|
X.api("data_auth/load_filter_props","post",{event_name:val.id},function(val){
|
|
console.log(val);
|
|
// defaultgroupdata = val;
|
|
groupitemeventsdata.push(val);
|
|
})
|
|
})
|
|
})
|
|
|
|
// 过滤数据
|
|
function filteringdata(){
|
|
var screentypedata;
|
|
if(groupitemeventsdata.length>1){
|
|
for(var i =0; i < groupitemeventsdata.length - 1; i++){
|
|
if(i == 0){
|
|
X.groupintersection(groupitemeventsdata[i] , groupitemeventsdata[Number(i) + Number(1)],function(d){
|
|
screentypedata = d;
|
|
});
|
|
}else {
|
|
X.groupintersection(screentypedata , groupitemeventsdata[Number(i) + Number(1)],function(d){
|
|
screentypedata = d;
|
|
})
|
|
}
|
|
}
|
|
}else {
|
|
screentypedata = groupitemeventsdata[0];
|
|
}
|
|
return screentypedata;
|
|
}
|
|
|
|
$(document).off('click','.route-ant-select-selector2').on('click','.route-ant-select-selector2',function(){
|
|
var obj = $(this);
|
|
var offset = obj.offset();
|
|
var index = obj.attr('data-index');
|
|
|
|
X.querycriteriapop(filteringdata(),'category',offset.left,offset.top+obj.height(),function(val){
|
|
console.log(val);
|
|
obj.html(val.title);
|
|
// data['events']['by_fields'][index]['eventDesc'] = val.title;
|
|
// data['events']['by_fields'][index]['eventName'] = val.id;
|
|
})
|
|
})
|
|
|
|
$(document).off('click','.analysis-overall-situation-add').on('click','.analysis-overall-situation-add',function(){
|
|
var drr={
|
|
"columnName":'asdasd',//事件中文显示
|
|
"column_id":'asdasd',//事件id
|
|
'data_type':'asdasd',//类型
|
|
'comparator_name':'等于',//默认等于
|
|
"comparator_id":'==',//符号id
|
|
"ftv":[],//条件
|
|
"strftv":'',//显示条件
|
|
"section":[-1,1],//区间
|
|
"table_type":'asdasd'
|
|
};
|
|
data['events']['user_filter']['filts'].push(drr);
|
|
if(data['events']['user_filter']['filts'].length > 1){
|
|
$(".analysis-overall-situation-left-guanxi").show();
|
|
}else{
|
|
$(".analysis-overall-situation-left-guanxi").hide();
|
|
}
|
|
X.template("globalfilter","xinwei-whole",data['events']['user_filter']['filts'],function(){
|
|
// analysisdown();
|
|
});
|
|
})
|
|
|
|
$(document).off('click','.analysis-overall-situation-del').on('click','.analysis-overall-situation-del',function(){
|
|
var index = $(this).attr('data-index');
|
|
data['events']['user_filter']['filts'].splice(index,1);
|
|
// filtsftvdata.splice(index,1);
|
|
if(data['events']['user_filter']['filts'].length > 1){
|
|
$(".analysis-overall-situation-left-guanxi").show();
|
|
}else{
|
|
$(".analysis-overall-situation-left-guanxi").hide();
|
|
}
|
|
X.template("globalfilter","xinwei-whole",data['events']['user_filter']['filts'],function(){
|
|
// analysisdown();
|
|
});
|
|
})
|
|
|
|
$(document).off('click','.analysis-shaix-initial-event').on('click','.analysis-shaix-initial-event',function(){
|
|
addscreen(0)
|
|
})
|
|
|
|
$(document).off('click','.analysis-zhibiao-updata-initial-event').on('click','.analysis-zhibiao-updata-initial-event',function(){
|
|
addscreen(0)
|
|
})
|
|
|
|
// 添加筛选项
|
|
function addscreen(index){
|
|
X.api('data_auth/load_filter_props',"post",{event_name:data['events']['source_event']["event_name"]},function(d){
|
|
var arr = {
|
|
"columnDesc":d[0]['category'][0]['title'],//事件中文显示
|
|
"columnName":d[0]['category'][0]['id'],//事件id
|
|
"comparator_name":d[0]['category'][0]['category'][0]['title'],//选择符号中文显示
|
|
"comparator":d[0]['category'][0]['category'][0]['id'],//符号id
|
|
"data_type":d[0]['category'][0]['data_type'],
|
|
"ftv":'',//条件
|
|
"strftv":'',//字符串显示条件
|
|
"tableType": d[0]['id']
|
|
} //筛选数据
|
|
data['events']['source_event']['filts'].push(arr);
|
|
X.template("route","event-roue-event",data['events']['source_event']); //更新事件
|
|
// screentypearr[index] = d;
|
|
// filtersymbols.push(d[0]['category'][0]["category"]);
|
|
})
|
|
}
|
|
|
|
$(document).off('click','.analysis-con-left-screen-list-right-screen-qh-tit').on('click','.analysis-con-left-screen-list-right-screen-qh-tit',function(){
|
|
if($(this).html() == '或'){
|
|
$(this).html('且');
|
|
data['events']["source_event"]['relation'] = 'or';
|
|
}else{
|
|
$(this).html('或');
|
|
data['events']["source_event"]['relation'] = 'and';
|
|
}
|
|
})
|
|
|
|
}
|
|
};
|
|
})(); |