97 lines
3.5 KiB
JavaScript
97 lines
3.5 KiB
JavaScript
(function(){
|
|
X.pageLogic['newwenjian'] = {
|
|
init : function(){
|
|
var comboTree1,comboTree2
|
|
comboTree1 = $('#newwenjianjustAnotherInputBox1').comboTree({
|
|
source : X.DATA.KanBanData,
|
|
isMultiple: false
|
|
});
|
|
// comboTree2 = $('#newwenjianjustAnotherInputBox2').comboTree({
|
|
// source : X.DATA.ProjectData,
|
|
// isMultiple: false
|
|
// });
|
|
|
|
var ProjectData = X.DATA.ProjectData;
|
|
console.log(ProjectData)
|
|
var data = [];
|
|
var spaceid = '';//获取项目空间id
|
|
for(let i in ProjectData){
|
|
var arr = {};
|
|
arr['title'] = ProjectData[i]['name'],
|
|
arr['id'] = ProjectData[i]['_id']
|
|
data.push(arr);
|
|
}
|
|
X.laydropdown("#newwenjianjustAnotherInputBox2",data,function(d){
|
|
spaceid = d.id;
|
|
$("#newwenjianjustAnotherInputBox2").val(d.title);
|
|
// console.log(d);
|
|
})
|
|
|
|
|
|
// 取消
|
|
$(".newwenjian-but-box .newwenjian-qx").click(function(){
|
|
layer.closeAll();
|
|
})
|
|
|
|
// 关闭图标
|
|
$(".newwenjian-top .newwenjian-cha").click(function(){
|
|
layer.closeAll();
|
|
})
|
|
|
|
$(".newwenjian-tab-box .newwenjian-tab div").click(function(){
|
|
$(".newwenjian-tab-box .newwenjian-tab div").removeClass('tabdata');
|
|
$(this).addClass('tabdata');
|
|
if($(this).html() == "我的看板"){
|
|
$("#newwenjianjustAnotherInputBox2").hide();
|
|
}else {
|
|
$("#newwenjianjustAnotherInputBox2").show();
|
|
}
|
|
$("#newwenjianjustAnotherInputBox2").val("");
|
|
})
|
|
|
|
// 确定
|
|
$(".newwenjian-but-box .newwenjian-qd").click(function(){
|
|
|
|
var txt = $(".newwenjianname-txt").val();
|
|
var type ='kanban';
|
|
var id = '';//没有默认传看板
|
|
if($('#newwenjianjustAnotherInputBox2').css("display") != 'none'){
|
|
if($('#newwenjianjustAnotherInputBox2').val() != ""){
|
|
var Addlocation = $('#newwenjianjustAnotherInputBox2').val();
|
|
}
|
|
type = "space";
|
|
}
|
|
|
|
if(type != "kanban"){
|
|
if(Addlocation){
|
|
id = X.pageLogic.newkanban.matchingid(Addlocation,type);
|
|
}else {
|
|
alert('请选择添加的位置');
|
|
return;
|
|
}
|
|
}else {
|
|
spaceid = X.DATA.projectid; //当选择看板时pid等于项目id
|
|
}
|
|
|
|
var data = {
|
|
'name': txt,
|
|
'project_id': X.DATA.projectid,
|
|
'cat': type,
|
|
'pid':spaceid
|
|
}
|
|
// return;
|
|
X.api('folder/create',"post",data,function(d){
|
|
// if(d.msg == "ok"){
|
|
layer.msg(d,function(){
|
|
X.pageLogic.dashboard.freshMenu(X.DATA.projectid);//刷新侧边栏
|
|
layer.closeAll();
|
|
});
|
|
// }
|
|
})
|
|
|
|
});
|
|
|
|
|
|
}
|
|
};
|
|
})(); |