123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- /**
- * 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 GetAllUnitProjectData = function (params, callback) {
- $.ajax({
- type:"POST",
- url: '/pm/api/getAllUnitProjects',
- data: {'data': params},
- 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, errCB) {
- const tenderCount = updateData.filter(item => item.updateType === 'new' && item.updateData.projType === projectType.tender).length;
- $.ajax({
- type:"POST",
- url: '/pm/api/updateProjects',
- data: {'data': JSON.stringify({"user_id": userID, "updateData": updateData, tenderCount})},
- dataType: 'json',
- cache: false,
- timeout: 50000,
- success: function(result){
- if (result.error === 0) {
- callback(result.data);
- } else {
- if (errCB) {
- errCB();
- }
- alert(result.message);
- }
- },
- error: function(jqXHR, textStatus, errorThrown){
- if (errCB) {
- errCB();
- }
- 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)
- }
|