12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- /**
- * 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})},
- 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 = 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)
- }
- });
- }
|