1
This commit is contained in:
parent
7e180cf46c
commit
d50c97509f
138
web/src/x.min.js
vendored
138
web/src/x.min.js
vendored
@ -348,7 +348,7 @@ var X = window.X || {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//渲染表格有分页有操作
|
//渲染表格有分页有操作
|
||||||
X.laytabledata = function(id,url,data,arr,height,callback){
|
X.laytabledata = function(id,url,data,arr,height,callback,method){
|
||||||
var loginCache = X.loginCache();
|
var loginCache = X.loginCache();
|
||||||
var token = (loginCache? loginCache.token:"");
|
var token = (loginCache? loginCache.token:"");
|
||||||
token = "Bearer "+token;
|
token = "Bearer "+token;
|
||||||
@ -361,7 +361,14 @@ var X = window.X || {
|
|||||||
if(!height){
|
if(!height){
|
||||||
var height = 'full-20'
|
var height = 'full-20'
|
||||||
}
|
}
|
||||||
|
method = method ? method : "get";
|
||||||
|
// if(method){
|
||||||
|
// method = method;
|
||||||
|
// }else{
|
||||||
|
// method = 'get';
|
||||||
|
// }
|
||||||
layui.table.render({
|
layui.table.render({
|
||||||
|
method: method,
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: token
|
Authorization: token
|
||||||
}
|
}
|
||||||
@ -571,7 +578,7 @@ var X = window.X || {
|
|||||||
'locale': X.DATA.locale,
|
'locale': X.DATA.locale,
|
||||||
ranges: {
|
ranges: {
|
||||||
'今日': [moment(), moment()],
|
'今日': [moment(), moment()],
|
||||||
'昨日': [moment, moment().subtract(1, 'days')],
|
'昨日': [moment(), moment().subtract(1, 'days')],
|
||||||
'最近7日': [moment().subtract(7, 'days'), moment().subtract(0, 'days')],
|
'最近7日': [moment().subtract(7, 'days'), moment().subtract(0, 'days')],
|
||||||
'最近30日': [moment().subtract(30, 'days'), moment().subtract(0, 'days')],
|
'最近30日': [moment().subtract(30, 'days'), moment().subtract(0, 'days')],
|
||||||
'上周': [moment().subtract(1, 'week').startOf('week')+86400000, moment().subtract(1, 'week').endOf('week')+86400000],
|
'上周': [moment().subtract(1, 'week').startOf('week')+86400000, moment().subtract(1, 'week').endOf('week')+86400000],
|
||||||
@ -1400,8 +1407,8 @@ var X = window.X || {
|
|||||||
|
|
||||||
X.laytpldata('#kongjian-dot',X.DATA['ProjectData'],'#kongjian');
|
X.laytpldata('#kongjian-dot',X.DATA['ProjectData'],'#kongjian');
|
||||||
X.DATA['page'] = urlinfo.page;
|
X.DATA['page'] = urlinfo.page;
|
||||||
console.log(urlinfo.page);
|
// console.log(urlinfo.page);
|
||||||
console.log(urlinfo.menu);
|
// console.log(urlinfo.menu);
|
||||||
if(page != urlinfo.page){
|
if(page != urlinfo.page){
|
||||||
X.gourl(urlinfo.page,'conetnt');
|
X.gourl(urlinfo.page,'conetnt');
|
||||||
}
|
}
|
||||||
@ -3420,7 +3427,7 @@ var X = window.X || {
|
|||||||
"formatname":'两位小数'
|
"formatname":'两位小数'
|
||||||
}
|
}
|
||||||
data.events.push(defaultindicator);
|
data.events.push(defaultindicator);
|
||||||
X.laytpldata("#analysis-con-left-screen-list-dot",data.events,".analysis-con-left-screen-list-box");
|
updataindex(data.events);
|
||||||
type2data= retdata
|
type2data= retdata
|
||||||
X.api("data_auth/load_filter_props","post",{event_name:dataArr[0]['category'][0]['event_name']},function(val){
|
X.api("data_auth/load_filter_props","post",{event_name:dataArr[0]['category'][0]['event_name']},function(val){
|
||||||
defaultgroupdata = val;
|
defaultgroupdata = val;
|
||||||
@ -3502,15 +3509,33 @@ var X = window.X || {
|
|||||||
}else {
|
}else {
|
||||||
$(".analysis-overall").hide();
|
$(".analysis-overall").hide();
|
||||||
}
|
}
|
||||||
|
updataindex(d.query.events);
|
||||||
X.laytpldata("#analysis-con-left-screen-list-dot",d.query.events,".analysis-con-left-screen-list-box");
|
|
||||||
X.laytpldata("#analysis-gpmain___3YGfw-dot",d.query.eventView.groupBy,".analysis-gpmain___3YGfw");
|
X.laytpldata("#analysis-gpmain___3YGfw-dot",d.query.eventView.groupBy,".analysis-gpmain___3YGfw");
|
||||||
X.laytpldata("#analysis-overall-situation-list-box-dot",d.query['eventView']['filts'],".analysis-overall-situation-list-box",function(){
|
X.laytpldata("#analysis-overall-situation-list-box-dot",d.query['eventView']['filts'],".analysis-overall-situation-list-box",function(){
|
||||||
renderdate();
|
renderdate();
|
||||||
});
|
});
|
||||||
// analysisdown();
|
// analysisdown();
|
||||||
calculationdata();
|
calculationdata();
|
||||||
}
|
};
|
||||||
|
|
||||||
|
// 更新指标
|
||||||
|
function updataindex(indexdata){
|
||||||
|
X.laytpldata("#analysis-con-left-screen-list-dot",indexdata,".analysis-con-left-screen-list-box",function(){
|
||||||
|
var sidebar = document.getElementById('analysis-con-left-screen-list-box');
|
||||||
|
new Sortable(sidebar, {
|
||||||
|
handle: '.analysis-num', // handle class
|
||||||
|
animation: 150,
|
||||||
|
onUpdate:function(evt){
|
||||||
|
var newIndex = evt.newIndex;
|
||||||
|
var oldIndex = evt.oldIndex;
|
||||||
|
let item = data.events.splice(oldIndex, 1); // arr删除2,把2给item
|
||||||
|
data.events.splice(newIndex, 0, item[0]);
|
||||||
|
console.log(data);
|
||||||
|
updataindex(data.events);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// sql语句显示
|
// sql语句显示
|
||||||
$(document).off('click','.sqlquery').on('click','.sqlquery',function(){
|
$(document).off('click','.sqlquery').on('click','.sqlquery',function(){
|
||||||
@ -3546,7 +3571,7 @@ var X = window.X || {
|
|||||||
var index = $(this).attr("data-index");
|
var index = $(this).attr("data-index");
|
||||||
var arr = data.events[index];
|
var arr = data.events[index];
|
||||||
data.events.push(arr);
|
data.events.push(arr);
|
||||||
X.laytpldata("#analysis-con-left-screen-list-dot",data.events,".analysis-con-left-screen-list-box");
|
updataindex(data.events);
|
||||||
var num = data.events.length;
|
var num = data.events.length;
|
||||||
|
|
||||||
// filtersymbols[num] = filtersymbols[index];
|
// filtersymbols[num] = filtersymbols[index];
|
||||||
@ -3607,7 +3632,7 @@ var X = window.X || {
|
|||||||
$("#analysis-zhibiao-list-type3-"+index).hide();
|
$("#analysis-zhibiao-list-type3-"+index).hide();
|
||||||
data['events'][index]['analysis'] = val.analysis;
|
data['events'][index]['analysis'] = val.analysis;
|
||||||
}
|
}
|
||||||
X.laytpldata("#analysis-con-left-screen-list-dot",data.events,".analysis-con-left-screen-list-box");
|
updataindex(data.events);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -3644,7 +3669,7 @@ var X = window.X || {
|
|||||||
data['events'][index]['filts'][indexs]['comparator_name'] = "是";
|
data['events'][index]['filts'][indexs]['comparator_name'] = "是";
|
||||||
data['events'][index]['filts'][indexs]['comparator'] = 'in';
|
data['events'][index]['filts'][indexs]['comparator'] = 'in';
|
||||||
}
|
}
|
||||||
X.laytpldata("#analysis-con-left-screen-list-dot",data.events,".analysis-con-left-screen-list-box");
|
updataindex(data.events);
|
||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -3686,7 +3711,7 @@ var X = window.X || {
|
|||||||
"tableType": d[0]['id']
|
"tableType": d[0]['id']
|
||||||
} //筛选数据
|
} //筛选数据
|
||||||
data['events'][index]['filts'].push(arr);
|
data['events'][index]['filts'].push(arr);
|
||||||
X.laytpldata("#analysis-con-left-screen-list-dot",data.events,".analysis-con-left-screen-list-box");
|
updataindex(data.events);
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3743,7 +3768,7 @@ var X = window.X || {
|
|||||||
var indexs = $(this).attr("data-indexs");
|
var indexs = $(this).attr("data-indexs");
|
||||||
// filtersymbols[index].splice(indexs,1);
|
// filtersymbols[index].splice(indexs,1);
|
||||||
data.events[index]['filts'].splice(indexs,1);
|
data.events[index]['filts'].splice(indexs,1);
|
||||||
X.laytpldata("#analysis-con-left-screen-list-dot",data.events,".analysis-con-left-screen-list-box");
|
updataindex(data.events);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 添加指标
|
// 添加指标
|
||||||
@ -3765,7 +3790,7 @@ var X = window.X || {
|
|||||||
}
|
}
|
||||||
data['events'].push(defaultindicator);
|
data['events'].push(defaultindicator);
|
||||||
|
|
||||||
X.laytpldata("#analysis-con-left-screen-list-dot",data.events,".analysis-con-left-screen-list-box");
|
updataindex(data.events);
|
||||||
var index = data.events.length - 1;
|
var index = data.events.length - 1;
|
||||||
|
|
||||||
$(".analysis-del").show() //显示删除按钮
|
$(".analysis-del").show() //显示删除按钮
|
||||||
@ -3799,7 +3824,7 @@ var X = window.X || {
|
|||||||
$(".analysis-del").hide(); //隐藏删除按钮
|
$(".analysis-del").hide(); //隐藏删除按钮
|
||||||
$(".analysis-overall").hide();
|
$(".analysis-overall").hide();
|
||||||
}
|
}
|
||||||
X.laytpldata("#analysis-con-left-screen-list-dot",data.events,".analysis-con-left-screen-list-box");
|
updataindex(data.events);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -5982,7 +6007,7 @@ var X = window.X || {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -6031,7 +6056,8 @@ var X = window.X || {
|
|||||||
$("#model-box").html("");
|
$("#model-box").html("");
|
||||||
// 获取报表数据
|
// 获取报表数据
|
||||||
X.pageLogic['dashboard'].gettabledata();
|
X.pageLogic['dashboard'].gettabledata();
|
||||||
var sidebar = document.getElementById('sidebar-box');
|
|
||||||
|
var sidebar = document.getElementById('sidebar-box'+d.spaces[0]['_id']);
|
||||||
new Sortable(sidebar, {
|
new Sortable(sidebar, {
|
||||||
handle: '.tuodong', // handle class
|
handle: '.tuodong', // handle class
|
||||||
animation: 150,
|
animation: 150,
|
||||||
@ -6060,6 +6086,7 @@ var X = window.X || {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
break;//终止循环
|
break;//终止循环
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -13505,16 +13532,23 @@ var X = window.X || {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// X.api('user_label/read','post',{project_id: X.DATA.projectid},function(d){
|
// 标签详情
|
||||||
// console.log(d);
|
$(document).off('click','.label-info-box').on('click','.label-info-box',function(){
|
||||||
// })
|
X.gourl('userlabelinfo','conetnt');
|
||||||
|
});
|
||||||
|
|
||||||
// 监听单行事件
|
// 监听单行事件
|
||||||
layui.table.on('row(userlabeltest)',function(obj){
|
layui.table.on('row(userlabeltest)',function(obj){
|
||||||
var data = obj.data
|
var data = obj.data
|
||||||
console.log(data);
|
// console.log(data);
|
||||||
X.DATA.userlabelid = data._id;
|
X.DATA.userlabelid = data._id;
|
||||||
X.laytpldata('#userlabel-right-box-dot',data,'.userlabel-right-box');
|
|
||||||
|
X.api("user_label/cluster_user_count","post",{cluster_name:data.cluster_name},function(d){
|
||||||
|
data['num'] = d.num;
|
||||||
|
// console.log(d);
|
||||||
|
X.laytpldata('#userlabel-right-box-dot',data,'.userlabel-right-box');
|
||||||
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -13532,11 +13566,14 @@ var X = window.X || {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
// ,{fixed: 'right', title:'操作', toolbar: '#eventattradminbarDemo', width:80}
|
// ,{fixed: 'right', title:'操作', toolbar: '#eventattradminbarDemo', width:80}
|
||||||
]],"&project_id="+X.DATA.projectid,'auto',function(res, curr, count){
|
]],"",'auto',function(res, curr, count){
|
||||||
// console.log(res);
|
// console.log(res);
|
||||||
if(res.data.length > 0){
|
if(res.data.length > 0){
|
||||||
X.DATA.userlabelid = res.data[0]._id;
|
X.DATA.userlabelid = res.data[0]._id;
|
||||||
X.laytpldata('#userlabel-right-box-dot',res.data[0],'.userlabel-right-box');
|
X.api("user_label/cluster_user_count","post",{cluster_name:res.data[0].cluster_name},function(d){
|
||||||
|
res.data[0]['num'] = d.num;
|
||||||
|
X.laytpldata('#userlabel-right-box-dot',res.data[0],'.userlabel-right-box');
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -13784,6 +13821,59 @@ var X = window.X || {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
// srczip/logic/userlabelinfo.js
|
||||||
|
(function(){
|
||||||
|
X.pageLogic['userlabelinfo'] = {
|
||||||
|
init : function(parms){
|
||||||
|
var me = this;
|
||||||
|
var userlabelid = X.DATA.userlabelid;
|
||||||
|
|
||||||
|
var page = 1; //设置首页页码
|
||||||
|
var limit = 10; //设置每页显示条数
|
||||||
|
var total; //总条数
|
||||||
|
|
||||||
|
X.api("user_label/detail","post",{label_id: userlabelid},function(val){
|
||||||
|
X.api("user_label/cluster_user_count","post",{cluster_name:val.cluster_name},function(d){
|
||||||
|
val['num'] = d.num;
|
||||||
|
total = d.num;
|
||||||
|
X.laytpldata('#userlabelinfo-right-box-dot',val,'.userlabel-right-box');
|
||||||
|
cluster_user_list_data(val);
|
||||||
|
|
||||||
|
layui.laypage.render({
|
||||||
|
elem: 'laypage' //注意,这里的 test1 是 ID,不用加 # 号
|
||||||
|
,count: total, //数据总数,从服务端得到
|
||||||
|
limit:limit, //每页条数设置
|
||||||
|
jump: function(obj, first){
|
||||||
|
//obj包含了当前分页的所有参数,比如:
|
||||||
|
// console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
|
||||||
|
// console.log(obj.limit); //得到每页显示的条数
|
||||||
|
page=obj.curr; //改变当前页码
|
||||||
|
limit=obj.limit;
|
||||||
|
//首次不执行
|
||||||
|
if(!first){
|
||||||
|
cluster_user_list_data(val); //加载数据
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
function cluster_user_list_data(val){
|
||||||
|
X.api('user_label/cluster_user_list',"post",{cluster_name: val.cluster_name,page: page,limit: limit},function(d){
|
||||||
|
X.laytpldata("#table-fenxi-th-dot",d.columns,".table-fenxi-th");
|
||||||
|
X.laytpldata("#table-fenxi-td-dot",d.values ,".table-fenxi-td");
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 返回上一页
|
||||||
|
$(document).off("click",".userlabel-right-fanhui").on("click",".userlabel-right-fanhui",function(){
|
||||||
|
X.gourl('userlabel','conetnt');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
// srczip/logic/userpar.js
|
// srczip/logic/userpar.js
|
||||||
(function(){
|
(function(){
|
||||||
X.pageLogic['userpar'] = {
|
X.pageLogic['userpar'] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user