修改看板报表

This commit is contained in:
罗松柏 2022-02-12 13:49:30 +08:00
parent 9572eab890
commit 8547224a19
7 changed files with 354 additions and 734 deletions

View File

@ -36,6 +36,9 @@
<!-- table -->
<script src="./src/FixedTable.js" type="text/javascript"></script>
<script charset="utf-8" src="./src/fixedTable2.js" type="text/javascript"></script>
<script src="./src/mmGrid.js" type="text/javascript"></script>
<script src="./src/mmPaginator.js" type="text/javascript"></script>

View File

@ -37,7 +37,7 @@
<div class="table_box_big">
<div class="table_box">
<table>
<!-- <table>
<thead>
<tr class="table-fenxi-th">
{{# layui.each(d.titledata, function(indexs, items) { }}
@ -49,13 +49,6 @@
<div class="table_tbody_box">
<table class="table-fenxi-box">
<!-- <thead>
<tr class="table-fenxi-th">
{{# layui.each(d.titledata, function(indexs, items) { }}
<th>{{items}}</th>
{{# }); }}
</tr>
</thead> -->
{{# if(d.cat === "event"){ }}
<tbody class="table-fenxi-td">
@ -125,8 +118,81 @@
{{# }); }}
{{# } }}
</table>
</div>
</div> -->
<div class="table_tbody_box">
<table id="dataTableMul{{d.id}}" class="table table-bordered table-fenxi-box">
<thead>
<tr>
{{# layui.each(d.titledata, function(indexs, items) { }}
<th>{{items}}</th>
{{# }); }}
</tr>
</thead>
<tbody class="table-fenxi-td">
{{# if(d.cat === "event"){ }}
{{# layui.each(d.condata, function(indexs, items) { }}
<tr>
{{# layui.each(items, function(indexss, itemss) { }}
<td>{{itemss}}</td>
{{# }); }}
</tr>
{{# }); }}
{{# } else if( d.cat == "scatter"){ }}
{{# layui.each(d.condata, function(indexs, items) { }}
<tr >
<td>{{items.date}}</td>
<td>{{items.d0}}</td>
{{# layui.each(items.data, function(indexss, itemss){ }}
<td>
<p>{{itemss.n}}</p>
<p>{{itemss.p}}</p>
</td>
{{# }); }}
</tr>
{{# }); }}
{{# } else if(d.cat === "retention"){ }}
{{# layui.each(d.condata, function(indexs, items) { }}
<tr >
<td>{{items.date}}</td>
<td>{{items.d0}}</td>
{{# layui.each(items.data, function(indexss, itemss){ }}
<td>
{{# if(itemss.p == '-'){ }}
<p>{{itemss.p}}</p>
{{# } else { }}
<p>{{itemss.p}}%</p>
{{# } }}
</td>
{{# }); }}
</tr>
{{# }); }}
{{# } else if(d.cat === "ltv"){ }}
{{# layui.each(d.condata, function(indexs, items) { }}
<tr >
{{# layui.each(items, function(indexss, itemss){ }}
<td>{{itemss}}</td>
{{# }); }}
</tr>
{{# }); }}
{{# } else if(d.cat === "user_property"){ }}
{{# layui.each(d.condata, function(indexs, items) { }}
<tr>
<td>{{indexs}}</td>
<td>{{items}}</td>
</tr>
{{# }); }}
{{# } }}
</tbody>
</table>
</div>
</div>
</div>

176
web/src/fixedTable2.js Normal file
View File

@ -0,0 +1,176 @@
/**
* @param {Object} fixedCount锛氳鍐荤粨鐨勫垪鏁帮紙浠庡乏鍒板彸锛<EFBFBD>
* 涓嶄紶鐨勮瘽锛岄粯璁や笉鍐荤粨鍒楋紱
* 鑻ュ间笉涓烘暟瀛楃被鍨嬫垨鑰呭ぇ浜庤鏍煎垪鏁板垯鎻愰啋鎶ラ敊
*/
function FixedTable(tableId, fixedCount) {
this.tableId = tableId;
this.$table = $("#" + tableId);
if (typeof fixedCount != "undefined") {
if (typeof fixedCount != "number") {
throw new Error("鍐荤粨鐨勫垪鏁颁笉鏄暟瀛楃被鍨嬶紝璇锋鏌ワ紒");
} else if (fixedCount < 0) {
throw new Error("鍐荤粨鐨勫垪鏁颁笉鑳藉皬浜<E79AAC>0锛岃妫€鏌ワ紒");
} else if (fixedCount >= this.$table.find("thead tr:eq(0) th").length) {
throw new Error("鍐荤粨鐨勫垪鏁颁笉鑳借秴杩囪〃鏍肩殑鎬诲垪鏁帮紝璇锋鏌ワ紒");
} else {
this.fixedCount = fixedCount;
}
} else {
this.fixedCount = 0;
}
this.init();
}
FixedTable.prototype = {
constructor: FixedTable,
init: function() {
// 鎷艰html缁撴瀯
this.buildHtml();
// 涓烘暣涓鍣ㄦ坊鍔犳粴鍔ㄤ簨浠<E7B0A8>
this.setScroll();
// 璋冩暣涓€娆″昂瀵<E69882>
this.adjustTableSize();
},
buildHtml: function() {
var _this = this;
// 涓鸿〃鏍兼瘡涓崟鍏冩牸娣诲姞绱㈠紩
var $theadTrs = this.$table.find("thead>tr");
var fixedHeadHtml = ""; // 鍐荤粨琛ㄥごhtml浠
$theadTrs.each(function(trIndex, tr) {
var $ths = $(tr).find("th");
var trHtml = "<tr>";
$ths.each(function(thIndex, th) {
$(th).attr("adjust", trIndex + "-" + thIndex);
if (thIndex < _this.fixedCount) {
trHtml += $(th).prop("outerHTML");
}
});
trHtml += "</tr>";
fixedHeadHtml += trHtml;
});
var $tbodyTrs = this.$table.find("tbody>tr");
var fixedBodyHtml = ""; // 鍐荤粨琛ㄤ綋html浠
$tbodyTrs.each(function(trIndex, tr) {
var $tds = $(tr).find("td");
var trHtml = "<tr>";
$tds.each(function(tdIndex, td) {
$(td).attr("adjust", trIndex + "-" + tdIndex);
if (tdIndex < _this.fixedCount) {
trHtml += $(td).prop("outerHTML");
}
});
trHtml += "</tr>";
fixedBodyHtml += trHtml;
});
/**鎷艰html缁撴瀯**/
// 鎷艰〃鏍肩埗绾х粨鏋<E7B2A8>
var tableParentHtml = `
<div id="table-view-` + this.tableId + `" class="table-view">
</div>
`;
this.$table.wrap(tableParentHtml);
// 鎷煎喕缁撹〃澶<E38083>.table-head>#headTable
var tableHeadHtml = `
<div class="table-head">
<table id="headTable" class="table table-bordered table-striped mb0">
<thead>` +
this.$table.find("thead").html() + `
</thead>
</table>
</div>
`;
$("#table-view-" + this.tableId).append(tableHeadHtml);
if (this.fixedCount > 0) {
// 鎷煎喕缁撳垪鍜屽喕缁撹〃澶村叕鍏辫〃澶<E38083>.table-head-fixed>#fixedHeadTable
var tableHeadFixedHtml = `
<div class="table-head-fixed">
<table id="fixedHeadTable" class="table table-bordered table-striped mb0">
<thead>` +
fixedHeadHtml + `
</thead>
</table>
</div>
`;
$("#table-view-" + this.tableId).append(tableHeadFixedHtml);
// 鎷煎喕缁撳垪鐨勮〃鏍<E38083>.table-fixed>#fixedTable
var tableFixedHtml = `
<div class="table-fixed">
<table id="fixedTable" class="table table-bordered table-striped mb0">
<thead>` +
fixedHeadHtml + `
</thead>
<tbody>` +
fixedBodyHtml + `
</tbody>
</table>
</div>
`;
$("#table-view-" + this.tableId).append(tableFixedHtml);
}
},
setScroll: function() {
var oldScrollTop = 0, oldScrollLeft = 0;
$("#table-view-" + this.tableId).scroll(function() {
var scrollTop = $(this).scrollTop();
var scrollLeft = $(this).scrollLeft();
if (oldScrollTop != scrollTop) { // 涓婁笅婊氬姩浜<E5A7A9>
$(this).find(".table-head-fixed").css("top", scrollTop + "px");
$(this).find(".table-head").css("top", scrollTop + "px");
}
if (oldScrollLeft != scrollLeft) { // 宸﹀彸婊氬姩浜<E5A7A9>
$(this).find(".table-head-fixed").css("left", scrollLeft + "px");
$(this).find(".table-fixed").css("left", scrollLeft + "px");
}
oldScrollTop = scrollTop;
oldScrollLeft = scrollLeft;
});
},
adjustTableSize: function() {
var _this = this;
// 琛ㄥご鍐荤粨涓斿垪鍐荤粨琛ㄦ牸琛ㄥご閮ㄥ垎灏哄璁$畻
$("#table-view-" + this.tableId).find("#fixedHeadTable th").each(function(index, copyEl) {
alterThSize(copyEl);
});
// 琛ㄥご鍐荤粨琛ㄦ牸琛ㄥご閮ㄥ垎灏哄璁$畻
$("#table-view-" + this.tableId).find("#headTable th").each(function(index, copyEl) {
alterThSize(copyEl);
});
// 鍒楀喕缁撹〃鏍艰〃澶撮儴鍒嗗昂瀵歌绠<EE85B8>
$("#table-view-" + this.tableId).find("#fixedTable th").each(function(index, copyEl) {
alterThSize(copyEl);
});
// 鍒楀喕缁撹〃鏍艰〃浣撻儴鍒嗗昂瀵歌绠<EE85B8>
$("#table-view-" + this.tableId).find("#fixedTable td").each(function(index, copyEl) {
alertTdSize(copyEl);
});
function alterThSize(copyEl) {
var adjust = $(copyEl).attr('adjust');
var dataTdWidth = _this.$table.find("th[adjust=" + adjust + "]").css('width');
var dataTdHeight = _this.$table.find("th[adjust=" + adjust + "]").css('height');
$(copyEl).attr("style", "min-width: " + dataTdWidth + "; height: " + dataTdHeight + ";");
}
function alertTdSize(copyEl) {
var adjust = $(copyEl).attr('adjust');
var dataTdWidth = _this.$table.find("td[adjust=" + adjust + "]").css('width');
var dataTdHeight = _this.$table.find("td[adjust=" + adjust + "]").css('height');
$(copyEl).attr("style", "min-width: " + dataTdWidth + "; height: " + dataTdHeight + ";");
}
},
destory: function() {
// 绉婚櫎灞炴€<E782B4>
this.$table.find("th, td").removeAttr("adjust");
// 鎷庡嚭table
$("#table-view-" + this.tableId).after(this.$table);
$("#table-view-" + this.tableId).remove();
}
}

View File

@ -1,720 +0,0 @@
//筛选条件
var ScreenArr=[
{
'title':'全部',
'id':'0',
'Category':[]
},
{
'title':'用户属性',
'id':'1',
'Category':[
{'title':'账户ID','id':'10','type':'string'},
{'title':'访客ID','id':'11','type':'string'},
{'title':'注册时间','id':'12','type':'time'},
{'title':'来源渠道','id':'13','type':'time'},
]
},
// {
// 'title':'测试',
// 'id':'2',
// 'Category':[
// {'title':'账户ID','id':'20','type':'string'},
// {'title':'访客ID','id':'21','type':'string'},
// {'title':'注册时间','id':'22','type':'time'},
// {'title':'来源渠道','id':'23','type':'time'},
// ]
// }
]
var ScreentwoArr = [
{'title':'等于','id':'0','default':false},
{'title':'不等于','id':'1','default':false},
{'title':'包括','id':'2','default':true},
{'title':'不包括','id':'3','default':false},
{'title':'有值','id':'4','default':false},
{'title':'无值','id':'5','default':false},
{'title':'正则匹配','id':'6','default':false},
{'title':'正则不匹配','id':'7','default':false},
]
//显示隐藏控件
function moveaction(x){
$('#'+x+' '+".control").show();
}
function outaction(x){
$('#'+x+' '+".control").hide();
}
function emptytxt(){
$("#zhuanghu_txt").val('');
$(".qingkomg").hide();
switchnav(0);
}
$("#search").click(function(){
$("#mask_box").show();
$("#search_pop").show();
var sele =''
for(let i in ScreentwoArr){
if(ScreentwoArr[i]['default']){
sele += '<option value="'+ScreentwoArr[i]['id']+'" selected="">'+ ScreentwoArr[i]['title'] +'</option>'
}else {
sele += '<option value="'+ScreentwoArr[i]['id']+'">'+ ScreentwoArr[i]['title'] +'</option>'
}
}
$("#judge_box").append(sele);//添加内容
})
$("#mask_box").click(function(){
console.log($(".Screen").html())
if($(".Screen").html() == '' || $(".Screen").html() == undefined){
$("#mask_box").hide();
$("#search_pop").hide();
}else {
$(".Screen").hide();
$(".Screen").empty();
}
})
$("#judge_box").click(function(){
if($("#judge_box_con").css('display') == 'none'){
$("#judge_box_con").show();
}else {
$("#judge_box_con").hide();
}
})
var popid = ''//弹出层id
function guanbitanchuang(){
if(popid == "kanban"){
$('#kanban').animate({width:'0px'});
}else if( popid == "TabOperation_box"){
$("#"+popid).hide();
$(tabbut).parents("a").removeClass("category2");
$(tabbut).parents("a").addClass("category");
}else {
$("#"+popid).slideUp("slow");
}
$('#zhezhao_bg').hide();
popid = '';
}
$("#chuangjian").click(function(){
popid = 'newskanban_box';
$("#newskanban_box").show();
$("#newskanban_box").slideDown("slow");
$('#zhezhao_bg').show();
})
$("#kanbanbtn").click(function(){
popid = 'kanban'
$("#kanban").show();
$("#kanban").animate({width:"560px"},500);
$('#zhezhao_bg').show();
})
//搜索里的条件选择点击事件
$("#zhanghu_box").click(function(){
$(".Screen").empty();
var obj = $("#zhanghu_box");
var offset = obj.offset()
$(".Screen").css('display','block');
Screenfun(offset.left,offset.top+obj.height());
// console.log(offset);
// console.log(offset.left+obj.width());
// console.log(offset.top+obj.height());
// if($("#zhuanghu_xila").css('display') == 'none'){
// $("#zhuanghu_xila").show();
// }else {
// $("#zhuanghu_xila").hide();
// }
})
//筛选条件
var ScreenArr=[
{
'title':'全部',
'id':'0',
'Category':[]
},
{
'title':'用户属性',
'id':'1',
'Category':[
{'title':'账户ID','id':'10','type':'string'},
{'title':'访客ID','id':'11','type':'string'},
{'title':'注册时间','id':'12','type':'time'},
{'title':'来源渠道','id':'13','type':'time'},
]
},
]
//筛选方法deviationleft向左偏移deviationtop向右偏移
function Screenfun(deviationleft, deviationtop){
var screentitArr,screenid,whole; //筛选tab,筛选单行内容,整体内容
for(let i in ScreenArr){
if(screentitArr ){
screentitArr = screentitArr + "<span id='nav"+i+"' onclick='switchnav("+ i +")'>"+ScreenArr[i]['title']+"</span>"
}else{
screentitArr = "<span id='nav"+i+"' onclick='switchnav("+ i +")'>"+ScreenArr[i]['title']+"<div class='xian'></div></span>"
}
}
for(let i in ScreenArr){
if(ScreenArr[i]['Category'].length > 0){
if(whole){
whole= whole+ `<div class="zhuang_conetnt_tit">`+ ScreenArr[i]['title'] +`</div><div class="ta-pso-lines">`
}else {
whole= `<div class="zhuang_conetnt_tit">`+ ScreenArr[i]['title'] +`</div><div class="ta-pso-lines">`
}
}
for(let j in ScreenArr[i]['Category']){
screenid = screenid + '<div class="ta-pso-line" onclick="ScreenClick('+ ScreenArr[i]["Category"][j]["id"] +')">'+ ScreenArr[i]["Category"][j]["title"] +'</div>'
}
if(whole){
whole = whole + screenid+'</div>'
}
screenid = '';//清空screenid进行下次赋值
}
var Divpush = `<div class="zhuanghu_xila" id='zhuanghu_xila' style='top:`+deviationtop+`px; left:`+ deviationleft +`px;'>
<div class="zhuanghu_ss">
<img src="./layui/images/fangdaj.png">
<input type="text" placeholder="请输入搜索" id="zhuanghu_txt" onchange="querytab()">
<img src="./layui/images/cha.png" onclick="emptytxt()" class="qingkomg">
</div>
<div class="zhuang_tab_box">
<div class="zhuang_tab">`+screentitArr+`</div>
</div>
<div class="zhuang_conetnt">`+whole+`</div></div>`
$('.Screen').append(Divpush);
}
//单击筛选tab事件
function switchnav(id){
var whole,screenid;
if(id && id != 0){
$("#zhuanghu_xila .xian").remove();
$("#nav"+id).append("<div class='xian'></div>");
$("#zhuanghu_xila .zhuang_conetnt").empty();
if(ScreenArr[id]['Category'].length > 0){
whole= `<div class="zhuang_conetnt_tit">`+ ScreenArr[id]['title'] +`</div><div class="ta-pso-lines">`
}
for(let j in ScreenArr[id]['Category']){
if(screenid){
screenid = screenid + '<div class="ta-pso-line" onclick="ScreenClick('+ ScreenArr[id]["Category"][j]["id"] +')">'+ ScreenArr[id]['Category'][j]['title'] +'</div>'
}else {
screenid = '<div class="ta-pso-line" onclick="ScreenClick('+ ScreenArr[id]["Category"][j]["id"] +')">'+ ScreenArr[id]['Category'][j]['title'] +'</div>'
}
}
whole = whole + screenid+'</div>'
screenid = '';//清空screenid进行下次赋值
}else {
$("#zhuanghu_xila .xian").remove();
$("#nav"+id).append("<div class='xian'></div>");
$("#zhuanghu_xila .zhuang_conetnt").empty();
for(let i in ScreenArr){
if(ScreenArr[i]['Category'].length > 0){
if(whole){
whole= whole+ `<div class="zhuang_conetnt_tit">`+ ScreenArr[i]['title'] +`</div><div class="ta-pso-lines">`
}else {
whole= `<div class="zhuang_conetnt_tit">`+ ScreenArr[i]['title'] +`</div><div class="ta-pso-lines">`
}
}
for(let j in ScreenArr[i]['Category']){
if(screenid){
screenid = screenid + '<div class="ta-pso-line" onclick="ScreenClick('+ ScreenArr[i]["Category"][j]["id"] +')">'+ ScreenArr[i]['Category'][j]['title'] +'</div>'
}else {
screenid = '<div class="ta-pso-line" onclick="ScreenClick('+ ScreenArr[i]["Category"][j]["id"] +')">'+ ScreenArr[i]['Category'][j]['title'] +'</div>'
}
}
if(whole){
whole = whole + screenid+'</div>'
}
screenid = '';//清空screenid进行下次赋值
}
}
$('.zhuang_conetnt').append(whole);
}
function querytab(){
var txt = $("#zhuanghu_txt").val();
console.log(txt);
if(txt == ""){
$(".qingkomg").hide();
}else {
$(".qingkomg").show();
}
var whole,screenid;
$("#zhuanghu_xila .zhuang_conetnt").empty();
for(let i in ScreenArr){
if(ScreenArr[i]['Category'].length > 0){
if(whole){
whole= whole+ `<div class="zhuang_conetnt_tit">`+ ScreenArr[i]['title'] +`</div><div class="ta-pso-lines">`
}else {
whole= `<div class="zhuang_conetnt_tit">`+ ScreenArr[i]['title'] +`</div><div class="ta-pso-lines">`
}
}
for(let j in ScreenArr[i]['Category']){
if(ScreenArr[i]['Category'][j]['title'].indexOf(txt) != -1){
if(screenid){
screenid = screenid + '<div class="ta-pso-line" onclick="ScreenClick('+ ScreenArr[i]["Category"][j]["id"] +')">'+ ScreenArr[i]['Category'][j]['title'] +'</div>'
}else {
screenid = '<div class="ta-pso-line" onclick="ScreenClick('+ ScreenArr[i]["Category"][j]["id"] +')">'+ ScreenArr[i]['Category'][j]['title'] +'</div>'
}
}
}
if(whole){
whole = whole + screenid+'</div>'
}
screenid = '';//清空screenid进行下次赋值
}
whole = whole + screenid+'</div>'
screenid = '';//清空screenid进行下次赋值
$('.zhuang_conetnt').append(whole);
}
function ScreenClick(id){
$("#zhuanghu_xila").hide();
$("#zhuanghu_xila").empty();
var judge_boxtxt = $('#judge_box').val();
var data ={};
for(let i in ScreenArr){
for(let j in ScreenArr[i]['Category']){
if(ScreenArr[i]['Category'][j]['id'] == id){
data = ScreenArr[i]['Category'][j];
break;
}
}
}
if(data['type'] == 'time'){
$(".judge_box").hide();
$(".search_txt").hide();
$(".time-box").show();
}else {
$(".judge_box").show();
if(judge_boxtxt == 4 || judge_boxtxt == 5){
$("#judge_input").val('');
$("#judge_input").hide();
}else {
$(".search_txt").show();
}
$(".time-box").hide();
}
$("#zhanghu_box span").html(data['title']);
$("#zhanghu_box").attr('title',data['title']);
$(".Screen").hide();
$(".Screen").empty();
}
$("#judge_box").change(function(){
var judgeid = $(this).val();
if(judgeid == 4 || judgeid == 5){
$('#judge_input').css('display','none')
}else {
$('#judge_input').css('display','block')
}
})
var locale = {
"format": 'YYYY-MM-DD',
"separator": " - ",
"applyLabel": "应用",
"cancelLabel": "取消",
"fromLabel": "起始时间",
"toLabel": "结束时间'",
"customRangeLabel": "自定义",
"weekLabel": "W",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"firstDay": 1
};
$('.timechoice').daterangepicker({
'locale': locale,
ranges: {
'今日': [moment(), moment()],
'昨日': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'最近7日': [moment().subtract(6, 'days'), moment()],
'最近30日': [moment().subtract(29, 'days'), moment()],
'上周': [moment().subtract(1, 'week').startOf('week'), moment().subtract(1, 'week').endOf('week')],
'本周': [moment().startOf('week'), moment()],
'本月': [moment().startOf('month'), moment().endOf('month')],
'上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')
]
},
"alwaysShowCalendars": true,
"startDate": moment().subtract(29, 'days'),
"endDate": new Date(),
"opens": "right",
}, function (start, end, label) {
// console.log(moment().subtract(1, 'month'))
// console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')');
});
// 侧边栏导航
//看板数组
var KanBanData = [
{
'title':'共享给我的','id':'share','type':'ordinary','Category': [
{'title': '共享给我的测试1','id':'share_0' },
{'title': '共享给我的测试2','id':'share_1' }
]
},
{
"title":'未分组','id':'Ungrouped','type':'ordinary','Category':[
{'title':'未分组测试1','id':'Ungrouped_0'},
{'title':'未分组测试2','id':'Ungrouped_1'},
]
},
{
"title":'创建文件夹','id':'establish','type':'file','Category':[
{'title':'创建测试1','id':'establish_0'},
{'title':'创建测试2','id':'establish_2'},
]
}
]
// 项目数组
var ProjectData = [
{
"title":'DEMO空间',
'id':'demo',
'type':'ordinary',
'Category':[
{'title':'测试2','id':'ceshi_2','type':'ordinary','Category':[]},
{'title':'测试3','id':'ceshi_3','type':'ordinary','Category':[]},
{'title':'测试4','id':'ceshi_4','type':'ordinary','Category':[]},
{'title':'测试5','id':'ceshi_5','type':'ordinary','Category':[]},
]
},
{
"title":'未分组','id':'ceshi','type':'ordinary','Category':[
{'title':'测试1','id':'ceshi_0','type':'file','Category':[
{'title':'测试7','id':'ceshi_7','type':'ordinary'},
]},
{'title':'测试6','id':'ceshi_6','type':'ordinary','Category':[]},
]
}
]
$('.category').on("mouseover",function(){
// "鼠标移入时想要的效果"
$(this).addClass("classa");
});
$('.category').on("mouseout",function(){
// "鼠标移出事想要的效果"
$(this).removeClass("classa");
});
$(".layui-left-dd").on("mouseover",function(){
console.log(1111)
$(this).addClass("onlevel");
})
$('.layui-left-dd').on("mouseout",function(){
// "鼠标移出事想要的效果"
$(this).removeClass("onlevel");
});
var TabOperationData = [
{'type':'kanban','tanchuang':[
{'title':'重命名','img':'xiugai.png','click':'modifyname'},
{'title':'移动至','img':'yidong.png','click':'move'},
{'title':'复制看板','img':'fuzhi.png','click':'copy'},
{'title':'删除看板','img':'del.png','click':'del'},
]},
{'type':'wenjian','tanchuang':[
{'title':'重新命名','img':'xiugai.png','click':'modifyname'},
{'title':'删除文件夹','img':'del.png','click':'del'},
]},
{'type':'baobiao','tanchuang':[
{'title':'复制看板','img':'fuzhi.png','click':'copy'}
]},
]
var tabbut=''
//二级导航操作按钮
function TabOperation(e,type,id,name){
$("#TabOperation").empty();
var lihtml =''
for(let i in TabOperationData){
if(TabOperationData[i]['type'] == type){
for(let j in TabOperationData[i]['tanchuang']){
lihtml +=`<li onclick="TabOperationtab('`+ id +`','`+TabOperationData[i]['tanchuang'][j]['click']+`','`+ name +`')">
<img src="./layui/images/`+ TabOperationData[i]['tanchuang'][j]['img'] +`"/>
<span>`+ TabOperationData[i]['tanchuang'][j]['title'] +`</span>
</li>`
}
}
}
$('#TabOperation').append(lihtml);
var obj = $(e).offset();
$(e).parents("a").removeClass("category");
$(e).parents("a").addClass("category2");
popid = 'TabOperation_box';
tabbut = e
$('#zhezhao_bg').show();
$(".TabOperation_box").show();
$(".TabOperation_box").css('top',obj.top+$(e).height())
$(".TabOperation_box").css('left',obj.left-90)
}
$("#modifyname-cha").click(function(){
$(".modifyname-bg").hide();
})
var SelectTabId
// 侧边栏操作事件
function TabOperationtab(id,type,name){
$("#"+popid).hide();
$(tabbut).parents("a").removeClass("category2");
$(tabbut).parents("a").addClass("category");
SelectTabId = id
if(type == 'modifyname'){
$("#modifyname-txt").val(name);
$('.modifyname-bg').show();
$("#modifynameid").val(id);
}else if(type == 'move'){
var comboTree1
comboTree1 = $('.justAnotherInputBox1').comboTree({
source : KanBanData,
isMultiple: false
});
$('.yidong-bg').show();
$("#yidongid").val(id);
}else if(type == 'copy'){
var comboTree1
$("#copyname-txt").val(name);
comboTree1 = $('.justAnotherInputBox1').comboTree({
source : KanBanData,
isMultiple: false
});
$('.copy-bg').show();
$("#copyid").val(id);
}else {
$("#del-tit").html(name);
$('.del-bg').show();
$("#delid").val(id);
}
$("#zhezhao_bg").hide();
}
$("#modifyname-qx").click(function(){
// 取消
$(".modifyname-bg").hide();
Emptydata()
})
$("#modifyname-qd").click(function(){
// 确定
var text = $("#modifyname-txt").val();
var id = $("#modifynameid").val();
$(".modifyname-bg").hide();
Emptydata();
})
$("#yidong-qx").click(function(){
$(".yidong-bg ").hide();
Emptydata('yidongkanban','yidong')
})
$("#yidong-qd").click(function(){
// 确定
if(choicetype == "kanban"){
var txt = $('.justAnotherInputBox1').val();
}else {
var txt = $('.justAnotherInputBox2').val();
}
var id = $("#yidongid").val(); //需要移动的id
var yidongid = MatchingId(txt);//移动到的id
$(".yidong-bg").hide();
Emptydata('yidongkanban','yidong')
})
$("#yidong-cha").click(function(){
$(".yidong-bg").hide();
Emptydata('yidongkanban','yidong')
})
$("#copy-qx").click(function(){
$(".copy-bg ").hide();
Emptydata('copykanban','copy')
})
$("#copy-qd").click(function(){
// 确定
var title = $("#copy-cha").val();//看板名
if(choicetype == "kanban"){
var txt = $('.justAnotherInputBox1').val(); //移动的位置
}else {
var txt = $('.justAnotherInputBox2').val();
}
var id = $("#copyid").val(); //需要移动的id
var yidongid = MatchingId(txt);//移动到的id
$(".copy-bg").hide();
Emptydata('copykanban','copy')
})
$("#copy-cha").click(function(){
$(".copy-bg").hide();
Emptydata('copykanban','copy')
})
$("#del-qx").click(function(){
$(".del-bg").hide();
Emptydata()
})
$("#del-qd").click(function(){
var id = $("#delid").val();
$(".del-bg").hide();
Emptydata();
// SelectTabId
})
function Emptydata(id,boxname){
SelectTabId = '';
choicetype = '';
tabdata(id,boxname)
}
var choicetype='kanban' //选择的位置
function tabdata(id,boxname){
$("."+boxname+'-tab div').removeClass('tabdata');
$("#"+id).addClass('tabdata');
var comboTree1,comboTree2;
if(boxname != "newwenjian"){
if(id.indexOf("kanban")>=0){
$(".justAnotherInputBox1").show();
$(".justAnotherInputBox2").hide();
comboTree1 = $('.justAnotherInputBox1').comboTree({
source : KanBanData,
isMultiple: false
});
choicetype='kanban'
}else {
$(".justAnotherInputBox1").hide();
$(".justAnotherInputBox2").show();
comboTree2 = $('.justAnotherInputBox2').comboTree({
source : ProjectData,
isMultiple: false
});
choicetype='xiangmu'
}
}else {
if(id.indexOf("kanban")>=0){
$(".justAnotherInputBox1").hide();
$(".justAnotherInputBox2").hide();
comboTree1 = $('.justAnotherInputBox1').comboTree({
source : KanBanData,
isMultiple: false
});
choicetype='kanban'
}else {
$(".justAnotherInputBox1").hide();
$(".justAnotherInputBox2").show();
comboTree2 = $('.justAnotherInputBox2').comboTree({
source : ProjectData,
isMultiple: false
});
choicetype='xiangmu'
}
}
}
// 根据侧边栏中文名匹配对应id
function MatchingId(name){
var id ='';
var data=[];
if(choicetype == 'kanban'){
data = KanBanData;
}else {
data = ProjectData;
}
for(let i in data){
if(data[i]['title'] == name){
id = data[i]['id']
}else {
if(data[i]['Category'].length > 0){
for(let j in data[i]['Category']){
if(data[i]['Category'][j]['title'] == name){
id = data[i]['Category'][j]['id']
}
}
}else {
continue;
}
}
}
return id;
}
// 新建看板
// function newkanban(){
// var comboTree1 = $('.justAnotherInputBox1').comboTree({
// source : KanBanData,
// isMultiple: false
// });
// $(".new-bg").show();
// }
$("#new-cha").click(function(){
$("#newname-txt").val('')
$(".new-bg").hide();
Emptydata('newkanban','new')
})
$("#new-qx").click(function(){
$("#newname-txt").val('')
$(".new-bg").hide();
Emptydata('newkanban','new')
})
$("#new-qd").click(function(){
var txt = $("#newname-txt").val();
if(choicetype == "kanban"){
var Addlocation = $('.justAnotherInputBox1').val(); //移动的位置
}else {
var Addlocation = $('.justAnotherInputBox2').val();
}
var positionid = MatchingId(Addlocation);//移动到的id
$(".new-bg").hide();
Emptydata('newkanban','new')
})
// 新建文件夹
function newwenjian(){
$(".newwenjian-bg").show();
}
$("#newwenjian-cha").click(function(){
$("#newwenjianname-txt").val('')
$(".newwenjian-bg").hide();
Emptydata('newwenjiankanban','newwenjian')
})
$("#newwenjian-qx").click(function(){
$("#newwenjianname-txt").val('')
$(".newwenjian-bg").hide();
Emptydata('newwenjiankanban','newwenjian')
})
$("#newwenjian-qd").click(function(){
var txt = $("#newwenjianname-txt").val();
if(choicetype == "kanban"){
var Addlocation = ''; //移动的位置
}else {
var Addlocation = $('.justAnotherInputBox2').val();
}
var positionid
if(positionid != ""){
positionid = MatchingId(Addlocation);//移动到的id
}
// $(".newwenjian-bg").hide();
Emptydata('newwenjiankanban','newwenjian')
})
// 创建空间
function establishkongjian(){
$(".kongjian-bg").show();
}

7
web/src/x.min.js vendored
View File

@ -10934,6 +10934,8 @@ var X = window.X || {
this.callback = parms.callback;
var data = parms;
X.laytpldata("#kanban-model-modify-table-dot",data,"model"+data.id,function(html){
// if(data.modeltype == 'table' && data.modelsize != "small"){
@ -10979,6 +10981,11 @@ var X = window.X || {
// }else {
$("#conent-box"+data.id).html(html);
// }
if(data.modeltype == "table" && data.modelsize != "small"){
var tableMul;
var id = 'dataTableMul'+data['id'];
tableMul = new FixedTable(id, 2);
}
})

View File

@ -6,6 +6,8 @@
this.callback = parms.callback;
var data = parms;
X.laytpldata("#kanban-model-modify-table-dot",data,"model"+data.id,function(html){
// if(data.modeltype == 'table' && data.modelsize != "small"){
@ -51,6 +53,11 @@
// }else {
$("#conent-box"+data.id).html(html);
// }
if(data.modeltype == "table" && data.modelsize != "small"){
var tableMul;
var id = 'dataTableMul'+data['id'];
tableMul = new FixedTable(id, 2);
}
})

View File

@ -820,18 +820,20 @@ label:not(.form-check-label):not(.custom-file-label) { font-weight: 400; }
.customname-content-box { position: relative; top: 66px; }
.table_box_big {
overflow-x: scroll;
overflow-y: hidden;
/* overflow-x: scroll;
overflow-y: hidden; */
position: relative;
height: 300px;
width: 100%;
}
.table_box {
overflow: hidden;
position: absolute;
width: 100%;
}
.table_tbody_box {
height: 250px;
overflow: scroll;
height: 300px;
/* overflow: scroll; */
}
.table-fenxi-th th{
background-color: #f0f2f5;
@ -843,9 +845,88 @@ label:not(.form-check-label):not(.custom-file-label) { font-weight: 400; }
font-size: 13px;
font-weight: 400;
border-right: 1px solid #e6e6e6;
border-bottom: 1px solid #f0f2f5;
border-bottom: 1px solid #f0f2f5;
}
.table-view .table th, .table-view .table td {
white-space: nowrap;
text-align: center;
}
.table-view .table tbody tr td:hover{
background: #3ea7fd;
color: #fff;
}
.table-bordered tr td { border-right: 1px solid #e6e6e6; border-left: 1px solid #e6e6e6; border-bottom: 1px solid #e6e6e6; }
.table-view {
position: relative;
overflow: auto;
box-shadow: 0px 1px 1px #dad8d8;
max-height: 300px;
max-width: 100%;
}
.table-head-fixed {
position: absolute;
top: 0;
left: 0;
z-index: 3;
}
.table-head-fixed table, .table-head table {
background-color: var(--head-bgcolor);
color: var(--head-color);
}
.table-head-fixed tr th {
background-color: #f0f2f5;
min-width: 100px;
max-width: 200px;
padding: 10px 16px;
color: #202d3f;
font-size: 13px;
font-weight: 400;
border-right: 1px solid #e6e6e6;
border-bottom: 1px solid #f0f2f5;
}
.table-bordered tr th {
background-color: #f0f2f5;
min-width: 100px;
max-width: 200px;
padding: 10px 16px;
color: #202d3f;
font-size: 13px;
font-weight: 400;
border-right: 1px solid #e6e6e6;
border-bottom: 1px solid #f0f2f5;
}
.table-head {
position: absolute;
top: 0;
left: 0;
z-index: 1;
width: 100%;
}
.table-fixed::-webkit-scrollbar {
display: none;
}
.table-fixed {
position: absolute;
top: 0;
left: 0;
background-color: #fff;
z-index: 2;
overflow-y: auto;
box-shadow: rgb(205, 205, 205) 1px 1px 5px;
}
.none{display: none;}
.datarightsedit-txt-input { width: 420px; height: 400px; padding: 10px 15px; resize:none; border: 1px solid #f0f0f0; }
.datarightsedit-txt-input2 { width: 420px; height: 150px; padding: 10px 15px; resize:none; border: 1px solid #f0f0f0; }
.datarightsedit-txt-input3 { width: 420px; height: 150px; padding: 10px 15px; resize:none; border: 1px solid #f0f0f0; }