/** * Created by Mai on 2017/3/8. */ // 获取用户全部项目数据 var GetAllProjectData = function (callback) { $.ajax({ type:"POST", url: '/pm/api/getProjects', data: {'data': JSON.stringify({"user_id": userID, "compilation": compilationData._id})}, dataType: 'json', cache: false, timeout: 50000, success: function(result){ if (result.error === 0) { callback(result.data); //Tree = $.fn.treeTable.init(table, ProjTreeSetting, result.data); } else { alert('error: ' + result.message); } }, error: function(jqXHR, textStatus, errorThrown){ alert('error ' + textStatus + " " + errorThrown); } }); } // 更新数据到服务器 var UpdateProjectData = function (updateData, callback) { $.ajax({ type:"POST", url: '/pm/api/updateProjects', data: {'data': JSON.stringify({"user_id": userID, "updateData": updateData})}, dataType: 'json', cache: false, timeout: 50000, success: function(result){ if (result.error === 0) { callback(result.data); } else { alert('error: ' + result.message); } }, error: function(jqXHR, textStatus, errorThrown){ alert('error ' + textStatus + " " + errorThrown); } }); }; // 重命名项目 var RenameProject_ajax = function(projId, newName, callback) { $.ajax({ type: "POST", url: '/pm/api/renameProject', data: {'data': JSON.stringify({"user_id": userID, "id": projId, "newName": newName})}, dataType: 'json', cache: false, timeout: 15000, success: function(result){ if (result.error === 0) { callback(); } else { alert('error' + result.message); } }, error: function(iqXHR, textStatus, errorThrown){ alert('error ' + textStatus + " " + errorThrown) } }); }; // 打开项目前,提交数据 var BeforeOpenProject = function (projId, updateData, callback) { $.ajax({ type: "POST", url: '/pm/api/beforeOpenProject', data: {'data': JSON.stringify({"user_id": userID, "proj_id": projId, "updateData": updateData})}, dataType: 'json', cache: false, timeout: 15000, success: function (result) { if (result.error === 0) { callback(); } else { alert('error' + result.message); } }, error: function(iqXHR, textStatus, errorThrown){ alert('error ' + textStatus + " " + errorThrown) } }); } function moveProjects(data,callback) { CommonAjax.post( '/pm/api/moveProject',data,callback) }