From 8547224a197a4fc95bf2f30aee722ea5300ff5f0 Mon Sep 17 00:00:00 2001 From: luosongbai <15272473386@163.com> Date: Sat, 12 Feb 2022 13:49:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9C=8B=E6=9D=BF=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/main.html | 3 + web/pages/modeltable.html | 84 +++- web/src/fixedTable2.js | 176 ++++++++ web/src/puble.js | 720 --------------------------------- web/src/x.min.js | 7 + web/srczip/logic/modeltable.js | 7 + web/static/css/style.css | 91 ++++- 7 files changed, 354 insertions(+), 734 deletions(-) create mode 100644 web/src/fixedTable2.js delete mode 100644 web/src/puble.js diff --git a/web/main.html b/web/main.html index 4eb54a6..05640c7 100644 --- a/web/main.html +++ b/web/main.html @@ -36,6 +36,9 @@ + + + diff --git a/web/pages/modeltable.html b/web/pages/modeltable.html index 54535ac..59cc538 100644 --- a/web/pages/modeltable.html +++ b/web/pages/modeltable.html @@ -37,7 +37,7 @@
- + {{# if(d.cat === "event"){ }} @@ -125,8 +118,81 @@ {{# }); }} {{# } }}
-
+
--> +
+ + + + + {{# layui.each(d.titledata, function(indexs, items) { }} + + {{# }); }} + + + + + {{# if(d.cat === "event"){ }} + {{# layui.each(d.condata, function(indexs, items) { }} + + {{# layui.each(items, function(indexss, itemss) { }} + + {{# }); }} + + {{# }); }} + {{# } else if( d.cat == "scatter"){ }} + {{# layui.each(d.condata, function(indexs, items) { }} + + + + {{# layui.each(items.data, function(indexss, itemss){ }} + + {{# }); }} + + {{# }); }} + {{# } else if(d.cat === "retention"){ }} + + {{# layui.each(d.condata, function(indexs, items) { }} + + + + {{# layui.each(items.data, function(indexss, itemss){ }} + + {{# }); }} + + {{# }); }} + {{# } else if(d.cat === "ltv"){ }} + {{# layui.each(d.condata, function(indexs, items) { }} + + {{# layui.each(items, function(indexss, itemss){ }} + + {{# }); }} + + {{# }); }} + {{# } else if(d.cat === "user_property"){ }} + {{# layui.each(d.condata, function(indexs, items) { }} + + + + + {{# }); }} + + {{# } }} + + + +
{{items}}
{{itemss}}
{{items.date}}{{items.d0}} +

{{itemss.n}}

+

{{itemss.p}}

+
{{items.date}}{{items.d0}} + {{# if(itemss.p == '-'){ }} +

{{itemss.p}}

+ {{# } else { }} +

{{itemss.p}}%

+ {{# } }} + +
{{itemss}}
{{indexs}}{{items}}
+
diff --git a/web/src/fixedTable2.js b/web/src/fixedTable2.js new file mode 100644 index 0000000..7893d44 --- /dev/null +++ b/web/src/fixedTable2.js @@ -0,0 +1,176 @@ +/** + * @param {Object} fixedCount锛氳鍐荤粨鐨勫垪鏁帮紙浠庡乏鍒板彸锛� + * 涓嶄紶鐨勮瘽锛岄粯璁や笉鍐荤粨鍒楋紱 + * 鑻ュ€间笉涓烘暟瀛楃被鍨嬫垨鑰呭ぇ浜庤〃鏍煎垪鏁板垯鎻愰啋鎶ラ敊 + */ + 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("鍐荤粨鐨勫垪鏁颁笉鑳藉皬浜�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(); + // 涓烘暣涓鍣ㄦ坊鍔犳粴鍔ㄤ簨浠� + this.setScroll(); + // 璋冩暣涓€娆″昂瀵� + this.adjustTableSize(); + }, + buildHtml: function() { + var _this = this; + // 涓鸿〃鏍兼瘡涓崟鍏冩牸娣诲姞绱㈠紩 + var $theadTrs = this.$table.find("thead>tr"); + var fixedHeadHtml = ""; // 鍐荤粨琛ㄥごhtml浠g爜 + $theadTrs.each(function(trIndex, tr) { + var $ths = $(tr).find("th"); + var trHtml = ""; + $ths.each(function(thIndex, th) { + $(th).attr("adjust", trIndex + "-" + thIndex); + if (thIndex < _this.fixedCount) { + trHtml += $(th).prop("outerHTML"); + } + }); + trHtml += ""; + fixedHeadHtml += trHtml; + }); + var $tbodyTrs = this.$table.find("tbody>tr"); + var fixedBodyHtml = ""; // 鍐荤粨琛ㄤ綋html浠g爜 + $tbodyTrs.each(function(trIndex, tr) { + var $tds = $(tr).find("td"); + var trHtml = ""; + $tds.each(function(tdIndex, td) { + $(td).attr("adjust", trIndex + "-" + tdIndex); + if (tdIndex < _this.fixedCount) { + trHtml += $(td).prop("outerHTML"); + } + }); + trHtml += ""; + fixedBodyHtml += trHtml; + }); + + /**鎷艰html缁撴瀯**/ + // 鎷艰〃鏍肩埗绾х粨鏋� + var tableParentHtml = ` +
+
+ `; + this.$table.wrap(tableParentHtml); + // 鎷煎喕缁撹〃澶�.table-head>#headTable + var tableHeadHtml = ` +
+ + ` + + this.$table.find("thead").html() + ` + +
+
+ `; + $("#table-view-" + this.tableId).append(tableHeadHtml); + if (this.fixedCount > 0) { + // 鎷煎喕缁撳垪鍜屽喕缁撹〃澶村叕鍏辫〃澶�.table-head-fixed>#fixedHeadTable + var tableHeadFixedHtml = ` +
+ + ` + + fixedHeadHtml + ` + +
+
+ `; + $("#table-view-" + this.tableId).append(tableHeadFixedHtml); + // 鎷煎喕缁撳垪鐨勮〃鏍�.table-fixed>#fixedTable + var tableFixedHtml = ` +
+ + ` + + fixedHeadHtml + ` + + ` + + fixedBodyHtml + ` + +
+
+ `; + $("#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) { // 涓婁笅婊氬姩浜� + $(this).find(".table-head-fixed").css("top", scrollTop + "px"); + $(this).find(".table-head").css("top", scrollTop + "px"); + } + if (oldScrollLeft != scrollLeft) { // 宸﹀彸婊氬姩浜� + $(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); + }); + // 鍒楀喕缁撹〃鏍艰〃澶撮儴鍒嗗昂瀵歌绠� + $("#table-view-" + this.tableId).find("#fixedTable th").each(function(index, copyEl) { + alterThSize(copyEl); + }); + // 鍒楀喕缁撹〃鏍艰〃浣撻儴鍒嗗昂瀵歌绠� + $("#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() { + // 绉婚櫎灞炴€� + this.$table.find("th, td").removeAttr("adjust"); + // 鎷庡嚭table + $("#table-view-" + this.tableId).after(this.$table); + $("#table-view-" + this.tableId).remove(); + } +} \ No newline at end of file diff --git a/web/src/puble.js b/web/src/puble.js deleted file mode 100644 index 931d0d0..0000000 --- a/web/src/puble.js +++ /dev/null @@ -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 += '' - }else { - sele += '' - } - } - $("#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 + ""+ScreenArr[i]['title']+"" - }else{ - screentitArr = ""+ScreenArr[i]['title']+"
" - } - } - for(let i in ScreenArr){ - if(ScreenArr[i]['Category'].length > 0){ - if(whole){ - whole= whole+ `
`+ ScreenArr[i]['title'] +`
` - }else { - whole= `
`+ ScreenArr[i]['title'] +`
` - } - } - for(let j in ScreenArr[i]['Category']){ - screenid = screenid + '
'+ ScreenArr[i]["Category"][j]["title"] +'
' - } - if(whole){ - whole = whole + screenid+'
' - } - screenid = '';//清空screenid,进行下次赋值 - } - - var Divpush = `
-
- - - -
-
-
`+screentitArr+`
-
-
`+whole+`
` - - $('.Screen').append(Divpush); - -} -//单击筛选tab事件 -function switchnav(id){ - var whole,screenid; - if(id && id != 0){ - $("#zhuanghu_xila .xian").remove(); - $("#nav"+id).append("
"); - $("#zhuanghu_xila .zhuang_conetnt").empty(); - - if(ScreenArr[id]['Category'].length > 0){ - whole= `
`+ ScreenArr[id]['title'] +`
` - } - for(let j in ScreenArr[id]['Category']){ - if(screenid){ - screenid = screenid + '
'+ ScreenArr[id]['Category'][j]['title'] +'
' - }else { - screenid = '
'+ ScreenArr[id]['Category'][j]['title'] +'
' - } - } - whole = whole + screenid+'
' - screenid = '';//清空screenid,进行下次赋值 - }else { - $("#zhuanghu_xila .xian").remove(); - $("#nav"+id).append("
"); - $("#zhuanghu_xila .zhuang_conetnt").empty(); - for(let i in ScreenArr){ - if(ScreenArr[i]['Category'].length > 0){ - if(whole){ - whole= whole+ `
`+ ScreenArr[i]['title'] +`
` - }else { - whole= `
`+ ScreenArr[i]['title'] +`
` - } - } - for(let j in ScreenArr[i]['Category']){ - if(screenid){ - screenid = screenid + '
'+ ScreenArr[i]['Category'][j]['title'] +'
' - }else { - screenid = '
'+ ScreenArr[i]['Category'][j]['title'] +'
' - } - } - if(whole){ - whole = whole + screenid+'
' - } - 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+ `
`+ ScreenArr[i]['title'] +`
` - }else { - whole= `
`+ ScreenArr[i]['title'] +`
` - } - } - for(let j in ScreenArr[i]['Category']){ - if(ScreenArr[i]['Category'][j]['title'].indexOf(txt) != -1){ - if(screenid){ - screenid = screenid + '
'+ ScreenArr[i]['Category'][j]['title'] +'
' - }else { - screenid = '
'+ ScreenArr[i]['Category'][j]['title'] +'
' - } - } - } - if(whole){ - whole = whole + screenid+'
' - } - screenid = '';//清空screenid,进行下次赋值 - } - - - - whole = whole + screenid+'
' - 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 +=`
  • - - `+ TabOperationData[i]['tanchuang'][j]['title'] +` -
  • ` - } - } - } - - $('#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(); -} \ No newline at end of file diff --git a/web/src/x.min.js b/web/src/x.min.js index 0b4d716..9904974 100644 --- a/web/src/x.min.js +++ b/web/src/x.min.js @@ -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); + } }) diff --git a/web/srczip/logic/modeltable.js b/web/srczip/logic/modeltable.js index ee09a41..22641bc 100644 --- a/web/srczip/logic/modeltable.js +++ b/web/srczip/logic/modeltable.js @@ -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); + } }) diff --git a/web/static/css/style.css b/web/static/css/style.css index 2e2f9f9..7bdc268 100644 --- a/web/static/css/style.css +++ b/web/static/css/style.css @@ -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; }