diff --git a/web/pages/projectadmin.html b/web/pages/projectadmin.html index 44e54d9..8e0d90d 100644 --- a/web/pages/projectadmin.html +++ b/web/pages/projectadmin.html @@ -94,7 +94,7 @@ {{# if(item.is_authz === true){ }}
删除
{{# } else { }} -
编辑
+
添加
{{# } }} diff --git a/web/src/x.min.js b/web/src/x.min.js index 10a53be..7e591c6 100644 --- a/web/src/x.min.js +++ b/web/src/x.min.js @@ -427,6 +427,21 @@ var X = window.X || { }); }; + //定义一个比较器--升序排列 + X.compare=function(propertyName) { + return function(object1, object2) { + var value1 = object1[propertyName]; + var value2 = object2[propertyName]; + if(value2 < value1) { + return 1; + } else if(value2 > value1) { + return -1; + } else { + return 0; + } + } + }; + X.eventtable=function(data,callback){ var titledata,condata = []; for(let i in data){ @@ -785,66 +800,87 @@ var X = window.X || { $(function(){ - //拦截所有class里有ajax-content的链接,由直接跳转修改为ajax跳转 - $('body').on("click",".ajax-content",function(){ - var href = $(this).attr('href'); - var id = $(this).attr('data-id'); - X.gourl(href,id); - return false; - }); - //设置主页,如果hash里有值的话,设置为hash的值,方便复制url传播 - var hash = getHashParms(); - setContentByUrl(hash.page || 'login'); + //拦截所有class里有ajax-content的链接,由直接跳转修改为ajax跳转 + $('body').on("click",".ajax-content",function(){ + var href = $(this).attr('href'); + var id = $(this).attr('data-id'); + X.gourl(href,id); + return false; + }); + //设置主页,如果hash里有值的话,设置为hash的值,方便复制url传播 + var hash = getHashParms(); + setContentByUrl(hash.page || 'login'); - $(document).keydown(function (event) { - if (event.keyCode == 116) { - event.preventDefault(); //阻止默认刷新 - console.log('刷新'); + var n = window.event.screenX - window.screenLeft; + var b = n > document.documentElement.scrollWidth-20; + if(b && window.event.clientY < 0 || window.event.altKey){ + //页面关闭 + console.log('页面关闭'); + }else{ + //页面刷新 + console.log('页面刷新111'); var query = window.location.href; var querys = query.split("="); - if(querys[1]){ + console.log(querys[1]); + if(querys[1] != undefined && querys[1] != 'login'){ $("#conetnt").html(""); - var gourl = querys[1]; - X.gourl(gourl,'conetnt'); + X.gourl('dashboard'); } - return false; } - }); + // $(document).keydown(function (event) { + // if (event.keyCode == 116) { + // event.preventDefault(); //阻止默认刷新 + // console.log('刷新'); + // var query = window.location.href; + // var querys = query.split("="); + // if(querys[1]){ + // $("#conetnt").html(""); + // var gourl = querys[1]; + // X.gourl(gourl,'conetnt'); + // } + // return false; + // } + // }); }); })(); // srczip/base/visibleChange.js (function(){ + X.pageLogic['visibleChange'] = { + init : function(parms){ + var observer = new IntersectionObserver(function(changes){ + changes.forEach(function(item,index){ + var callback = $(item.target).data('_visibleChangeCall'); + if(item.intersectionRatio > 0){ + //target:被观察的目标元素,是一个 DOM 节点对象 + callback && callback.call( item.target,1); + }else{ + callback && callback.call( item.target,0); + } + }); + }); - // $('.table').visibleChange(function(isShow){ - // if(isShow==1){ - // //被看见了 - // }else{ - // //看不见了 - // } - // }); + $.fn.visibleChange = function(callback) { + this.each(function(){ + $(this).data('_visibleChangeCall',callback); + observer.observe( this ); + }); + return this; + }; - var observer = new IntersectionObserver(function(changes){ - changes.forEach(function(item,index){ - var callback = $(item.target).data('_visibleChangeCall'); - if(item.intersectionRatio > 0){ - //target:被观察的目标元素,是一个 DOM 节点对象 - callback && callback.call( item.target,1); - }else{ - callback && callback.call( item.target,0); - } - }); - }); - - $.fn.visibleChange = function(callback) { - this.each(function(){ - $(this).data('_visibleChangeCall',callback); - observer.observe( this ); - }); - return this; - }; + $('.layui-col').visibleChange(function(isShow){ + if(isShow==1){ + //被看见了 + console.log(111); + }else{ + //看不见了 + console.log(222); + } + }); + } + }; })(); // srczip/logic/addexistuser.js (function(){ @@ -3692,7 +3728,7 @@ var X = window.X || { //更新报表 $(document).off('click','.model-gengx').on('click','.model-gengx',function(){ var id = $(this).attr('data-id'); - console.log(id); + // console.log(id); X.api('dashboard/','post',{id:X.DATA['dashboard_id']},function(d){ return; X.pageLogic['dashboard'].fillmodeldata(d[id]); @@ -3904,18 +3940,6 @@ var X = window.X || { //画统计图和添加移入移出事件 morefeatures:function(eventdata){ - // $(".layui-card").mouseenter(function () { - // var classname = $(this).attr('class'); - // if(classname.indexOf("tool-show") == -1){ - // $(this).addClass('tool-show'); - // } - // }); - // $(".layui-card").mouseleave(function () { - // var classname = $(this).attr('class'); - // if(classname.indexOf("tool-show") != -1){ - // $(this).removeClass('tool-show'); - // } - // }); var dropdownlist = [ {title:'表格',id:'table'}, {title:'图形',id:'echarts'} @@ -3990,11 +4014,11 @@ var X = window.X || { }; myChart.setOption(option,true); } + }, // 获取表格数据 gettabledata:function(){ - $("#model-box").html("");//清空表格数据 X.api('dashboard/','post',{id:X.DATA['dashboard_id']},function(d){ var modellist=[]; @@ -4006,12 +4030,11 @@ var X = window.X || { modellist.push(arr); } - modellist.sort( X.pageLogic['dashboard'].compare("sort")); + modellist.sort( X.compare("sort") ); for(let i in modellist){ for(let z in d){ if(modellist[i]['sort'] == d[z]['sort'] && modellist[i]['report_id'] == d[z]['report_id']){ //渲染模板和数据 - console.log(d[z]); X.laytpldata("#kanban-model-box-dot",d[z],null,function(html){ $('#model-box').append(html); X.pageLogic['dashboard'].fillmodeldata(d[z]); @@ -4023,22 +4046,6 @@ var X = window.X || { }) }, - //定义一个比较器--升序排列 - compare:function(propertyName) { - // console.log(propertyName) - return function(object1, object2) { - var value1 = object1[propertyName]; - var value2 = object2[propertyName]; - if(value2 < value1) { - return 1; - } else if(value2 > value1) { - return -1; - } else { - return 0; - } - } - } - }; })(); @@ -4220,7 +4227,7 @@ var X = window.X || { $(document).off('click','.analysis-navigation-bar-right-img-baobiao').on('click','.analysis-navigation-bar-right-img-baobiao',function(){ X.parametersopen(data['eventView']['cksql'],'savedbaobiao','rt',function(d){ - console.log(d); + // console.log(d); if(d){ data = d.query; type2data = data.cachedata.type2data; @@ -4302,7 +4309,8 @@ var X = window.X || { var offset = obj.offset(); var index = obj.attr("data-index"); if(type2data.length >0){ - X.querycriteriapop(type2data[index],'dropdownlist',offset.left,offset.top+obj.height(),function(val){ + // console.log(type2data); + X.querycriteriapop(type2data[0],'dropdownlist',offset.left,offset.top+obj.height(),function(val){ if(val != undefined){ $("#analysis-zhibiao-list-type2-"+index).html(val.title); @@ -4403,7 +4411,7 @@ var X = window.X || { var index = obj.attr("data-index"); var indexs = obj.attr("data-indexs"); X.querycriteriapop(screentypearr[index],'category',offset.left,offset.top+obj.height(),function(val){ - console.log(val); + // console.log(val); var htmlstring = val.title; obj.html(htmlstring); filtersymbols[indexs] = val.category; @@ -4482,8 +4490,7 @@ var X = window.X || { data.eventView.groupBy[index]['column_id'] = val.id; data.eventView.groupBy[index]['data_type'] = val.type; data.eventView.groupBy[index]['table_type'] = val.table_type; - }) - + }); }) // 时间粒度 @@ -4495,7 +4502,7 @@ var X = window.X || { {'title':'30日','id':'30'}, ] X.laydropdown('.analtsis-timeParticleSize',timeParticleSizearr,function(d){ - console.log(d); + // console.log(d); $(".analtsis-timeParticleSize").html(d.title); data['eventView']['unitNum'] = parseInt(d.id); retaineddata(); @@ -6020,28 +6027,28 @@ var X = window.X || { }); // 修改报表类型 - $(document).off('click','.to-added-table').on('click','.to-added-table',function(){ - var obj = $(this); - var id = obj.attr("data-id"); - for(let i in submitdata){ - if(submitdata[i]['report_id'] == id){ - submitdata[i]['graph_type'] = 'table'; - layer.msg('修改为表格展示',{time: 1000}); - } - } - }); + // $(document).off('click','.to-added-table').on('click','.to-added-table',function(){ + // var obj = $(this); + // var id = obj.attr("data-id"); + // for(let i in submitdata){ + // if(submitdata[i]['report_id'] == id){ + // submitdata[i]['graph_type'] = 'table'; + // layer.msg('修改为表格展示',{time: 1000}); + // } + // } + // }); - $(document).off('click','.to-added-chart').on('click','.to-added-chart',function(){ - var obj = $(this); - var id = obj.attr("data-id"); - console.log(id); - for(let i in submitdata){ - if(submitdata[i]['report_id'] == id){ - submitdata[i]['graph_type'] = 'echarts'; - layer.msg('修改为图表展示',{time: 1000}); - } - } - }); + // $(document).off('click','.to-added-chart').on('click','.to-added-chart',function(){ + // var obj = $(this); + // var id = obj.attr("data-id"); + // console.log(id); + // for(let i in submitdata){ + // if(submitdata[i]['report_id'] == id){ + // submitdata[i]['graph_type'] = 'echarts'; + // layer.msg('修改为图表展示',{time: 1000}); + // } + // } + // }); $(document).off('click','.kanbanadmin-menu').on('click','.kanbanadmin-menu',function(){ var obj = $(this); @@ -6084,6 +6091,8 @@ var X = window.X || { }; submitdata.push(arr); } + submitdata.sort( X.compare("sort") ); + console.log(submitdata); }; $(document).off('click','.to-added-del').on('click','.to-added-del',function(){ diff --git a/web/srczip/base/ajaxpage.js b/web/srczip/base/ajaxpage.js index dfc19cd..fb538ac 100644 --- a/web/srczip/base/ajaxpage.js +++ b/web/srczip/base/ajaxpage.js @@ -51,32 +51,48 @@ $(function(){ - //拦截所有class里有ajax-content的链接,由直接跳转修改为ajax跳转 - $('body').on("click",".ajax-content",function(){ - var href = $(this).attr('href'); - var id = $(this).attr('data-id'); - X.gourl(href,id); - return false; - }); - //设置主页,如果hash里有值的话,设置为hash的值,方便复制url传播 - var hash = getHashParms(); - setContentByUrl(hash.page || 'login'); + //拦截所有class里有ajax-content的链接,由直接跳转修改为ajax跳转 + $('body').on("click",".ajax-content",function(){ + var href = $(this).attr('href'); + var id = $(this).attr('data-id'); + X.gourl(href,id); + return false; + }); + //设置主页,如果hash里有值的话,设置为hash的值,方便复制url传播 + var hash = getHashParms(); + setContentByUrl(hash.page || 'login'); - $(document).keydown(function (event) { - if (event.keyCode == 116) { - event.preventDefault(); //阻止默认刷新 - console.log('刷新'); + var n = window.event.screenX - window.screenLeft; + var b = n > document.documentElement.scrollWidth-20; + if(b && window.event.clientY < 0 || window.event.altKey){ + //页面关闭 + console.log('页面关闭'); + }else{ + //页面刷新 + console.log('页面刷新111'); var query = window.location.href; var querys = query.split("="); - if(querys[1]){ + console.log(querys[1]); + if(querys[1] != undefined && querys[1] != 'login'){ $("#conetnt").html(""); - var gourl = querys[1]; - X.gourl(gourl,'conetnt'); + X.gourl('dashboard'); } - return false; } - }); + // $(document).keydown(function (event) { + // if (event.keyCode == 116) { + // event.preventDefault(); //阻止默认刷新 + // console.log('刷新'); + // var query = window.location.href; + // var querys = query.split("="); + // if(querys[1]){ + // $("#conetnt").html(""); + // var gourl = querys[1]; + // X.gourl(gourl,'conetnt'); + // } + // return false; + // } + // }); }); diff --git a/web/srczip/base/visibleChange.js b/web/srczip/base/visibleChange.js index 190a4bd..fc8bdfd 100644 --- a/web/srczip/base/visibleChange.js +++ b/web/srczip/base/visibleChange.js @@ -1,30 +1,35 @@ (function(){ + X.pageLogic['visibleChange'] = { + init : function(parms){ + var observer = new IntersectionObserver(function(changes){ + changes.forEach(function(item,index){ + var callback = $(item.target).data('_visibleChangeCall'); + if(item.intersectionRatio > 0){ + //target:被观察的目标元素,是一个 DOM 节点对象 + callback && callback.call( item.target,1); + }else{ + callback && callback.call( item.target,0); + } + }); + }); - // $('.table').visibleChange(function(isShow){ - // if(isShow==1){ - // //被看见了 - // }else{ - // //看不见了 - // } - // }); + $.fn.visibleChange = function(callback) { + this.each(function(){ + $(this).data('_visibleChangeCall',callback); + observer.observe( this ); + }); + return this; + }; - var observer = new IntersectionObserver(function(changes){ - changes.forEach(function(item,index){ - var callback = $(item.target).data('_visibleChangeCall'); - if(item.intersectionRatio > 0){ - //target:被观察的目标元素,是一个 DOM 节点对象 - callback && callback.call( item.target,1); - }else{ - callback && callback.call( item.target,0); - } - }); - }); - - $.fn.visibleChange = function(callback) { - this.each(function(){ - $(this).data('_visibleChangeCall',callback); - observer.observe( this ); - }); - return this; - }; + $('.layui-col').visibleChange(function(isShow){ + if(isShow==1){ + //被看见了 + console.log(111); + }else{ + //看不见了 + console.log(222); + } + }); + } + }; })(); \ No newline at end of file diff --git a/web/srczip/common.js b/web/srczip/common.js index 320a411..7fa2e2f 100644 --- a/web/srczip/common.js +++ b/web/srczip/common.js @@ -426,6 +426,21 @@ var X = window.X || { }); }; + //定义一个比较器--升序排列 + X.compare=function(propertyName) { + return function(object1, object2) { + var value1 = object1[propertyName]; + var value2 = object2[propertyName]; + if(value2 < value1) { + return 1; + } else if(value2 > value1) { + return -1; + } else { + return 0; + } + } + }; + X.eventtable=function(data,callback){ var titledata,condata = []; for(let i in data){ diff --git a/web/srczip/logic/dashboard.js b/web/srczip/logic/dashboard.js index a285886..813c4f7 100644 --- a/web/srczip/logic/dashboard.js +++ b/web/srczip/logic/dashboard.js @@ -243,7 +243,7 @@ //更新报表 $(document).off('click','.model-gengx').on('click','.model-gengx',function(){ var id = $(this).attr('data-id'); - console.log(id); + // console.log(id); X.api('dashboard/','post',{id:X.DATA['dashboard_id']},function(d){ return; X.pageLogic['dashboard'].fillmodeldata(d[id]); @@ -455,18 +455,6 @@ //画统计图和添加移入移出事件 morefeatures:function(eventdata){ - // $(".layui-card").mouseenter(function () { - // var classname = $(this).attr('class'); - // if(classname.indexOf("tool-show") == -1){ - // $(this).addClass('tool-show'); - // } - // }); - // $(".layui-card").mouseleave(function () { - // var classname = $(this).attr('class'); - // if(classname.indexOf("tool-show") != -1){ - // $(this).removeClass('tool-show'); - // } - // }); var dropdownlist = [ {title:'表格',id:'table'}, {title:'图形',id:'echarts'} @@ -541,11 +529,11 @@ }; myChart.setOption(option,true); } + }, // 获取表格数据 gettabledata:function(){ - $("#model-box").html("");//清空表格数据 X.api('dashboard/','post',{id:X.DATA['dashboard_id']},function(d){ var modellist=[]; @@ -557,12 +545,11 @@ modellist.push(arr); } - modellist.sort( X.pageLogic['dashboard'].compare("sort")); + modellist.sort( X.compare("sort") ); for(let i in modellist){ for(let z in d){ if(modellist[i]['sort'] == d[z]['sort'] && modellist[i]['report_id'] == d[z]['report_id']){ //渲染模板和数据 - console.log(d[z]); X.laytpldata("#kanban-model-box-dot",d[z],null,function(html){ $('#model-box').append(html); X.pageLogic['dashboard'].fillmodeldata(d[z]); @@ -574,21 +561,5 @@ }) }, - //定义一个比较器--升序排列 - compare:function(propertyName) { - // console.log(propertyName) - return function(object1, object2) { - var value1 = object1[propertyName]; - var value2 = object2[propertyName]; - if(value2 < value1) { - return 1; - } else if(value2 > value1) { - return -1; - } else { - return 0; - } - } - } - }; })(); diff --git a/web/srczip/logic/distribution.js b/web/srczip/logic/distribution.js index e177219..a495fe6 100644 --- a/web/srczip/logic/distribution.js +++ b/web/srczip/logic/distribution.js @@ -49,7 +49,7 @@ $(document).off('click','.analysis-navigation-bar-right-img-baobiao').on('click','.analysis-navigation-bar-right-img-baobiao',function(){ X.parametersopen(data['eventView']['cksql'],'savedbaobiao','rt',function(d){ - console.log(d); + // console.log(d); if(d){ data = d.query; type2data = data.cachedata.type2data; @@ -131,7 +131,8 @@ var offset = obj.offset(); var index = obj.attr("data-index"); if(type2data.length >0){ - X.querycriteriapop(type2data[index],'dropdownlist',offset.left,offset.top+obj.height(),function(val){ + // console.log(type2data); + X.querycriteriapop(type2data[0],'dropdownlist',offset.left,offset.top+obj.height(),function(val){ if(val != undefined){ $("#analysis-zhibiao-list-type2-"+index).html(val.title); @@ -232,7 +233,7 @@ var index = obj.attr("data-index"); var indexs = obj.attr("data-indexs"); X.querycriteriapop(screentypearr[index],'category',offset.left,offset.top+obj.height(),function(val){ - console.log(val); + // console.log(val); var htmlstring = val.title; obj.html(htmlstring); filtersymbols[indexs] = val.category; @@ -311,8 +312,7 @@ data.eventView.groupBy[index]['column_id'] = val.id; data.eventView.groupBy[index]['data_type'] = val.type; data.eventView.groupBy[index]['table_type'] = val.table_type; - }) - + }); }) // 时间粒度 @@ -324,7 +324,7 @@ {'title':'30日','id':'30'}, ] X.laydropdown('.analtsis-timeParticleSize',timeParticleSizearr,function(d){ - console.log(d); + // console.log(d); $(".analtsis-timeParticleSize").html(d.title); data['eventView']['unitNum'] = parseInt(d.id); retaineddata(); diff --git a/web/srczip/logic/kanbanadmin.js b/web/srczip/logic/kanbanadmin.js index 5c4a9b9..00f6c47 100644 --- a/web/srczip/logic/kanbanadmin.js +++ b/web/srczip/logic/kanbanadmin.js @@ -79,28 +79,28 @@ }); // 修改报表类型 - $(document).off('click','.to-added-table').on('click','.to-added-table',function(){ - var obj = $(this); - var id = obj.attr("data-id"); - for(let i in submitdata){ - if(submitdata[i]['report_id'] == id){ - submitdata[i]['graph_type'] = 'table'; - layer.msg('修改为表格展示',{time: 1000}); - } - } - }); + // $(document).off('click','.to-added-table').on('click','.to-added-table',function(){ + // var obj = $(this); + // var id = obj.attr("data-id"); + // for(let i in submitdata){ + // if(submitdata[i]['report_id'] == id){ + // submitdata[i]['graph_type'] = 'table'; + // layer.msg('修改为表格展示',{time: 1000}); + // } + // } + // }); - $(document).off('click','.to-added-chart').on('click','.to-added-chart',function(){ - var obj = $(this); - var id = obj.attr("data-id"); - console.log(id); - for(let i in submitdata){ - if(submitdata[i]['report_id'] == id){ - submitdata[i]['graph_type'] = 'echarts'; - layer.msg('修改为图表展示',{time: 1000}); - } - } - }); + // $(document).off('click','.to-added-chart').on('click','.to-added-chart',function(){ + // var obj = $(this); + // var id = obj.attr("data-id"); + // console.log(id); + // for(let i in submitdata){ + // if(submitdata[i]['report_id'] == id){ + // submitdata[i]['graph_type'] = 'echarts'; + // layer.msg('修改为图表展示',{time: 1000}); + // } + // } + // }); $(document).off('click','.kanbanadmin-menu').on('click','.kanbanadmin-menu',function(){ var obj = $(this); @@ -143,6 +143,8 @@ }; submitdata.push(arr); } + submitdata.sort( X.compare("sort") ); + console.log(submitdata); }; $(document).off('click','.to-added-del').on('click','.to-added-del',function(){