`
$('.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= `
'
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+ `
`
}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();
}