From 2a58ea8ede8379b66228972fb316931756ccc227 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 12 May 2025 11:23:40 +0800 Subject: [PATCH] [sync story #73341] Sync code to this branch from feature/deliverable. --- lib/zin/wg/gantt/js/v1.js | 47 +++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/lib/zin/wg/gantt/js/v1.js b/lib/zin/wg/gantt/js/v1.js index 36e93384e0..40cafe10fc 100644 --- a/lib/zin/wg/gantt/js/v1.js +++ b/lib/zin/wg/gantt/js/v1.js @@ -270,7 +270,6 @@ function validateResources(id) let status = task.status; let type = task.type; let statusLang = ganttLang.taskStatusList['wait']; - flag = true; /* Check status. */ if(status !== statusLang && type != 'point') @@ -292,32 +291,26 @@ function validateResources(id) if(type == 'point') itemID = task.id.split("-")[2]; /* Check data. */ - let postData = { - 'id' : itemID, - 'startDate' : from.toLocaleDateString('en-CA'), - 'endDate' : to.toLocaleDateString('en-CA'), - 'type' : type - }; - /* Sync Close. */ - $.ajax({ - url: $.createLink('programplan', 'ajaxResponseGanttDragEvent'), - dataType: "json", - data: postData, - type: "post", - success: function(response) - { - if(response.result == 'fail' && response.message) - { - zui.Messager.show({content: response.message, type: 'danger-outline', icon: 'exclamation-sign'}); - flag = false; - } - else - { - gantt.updateTask(task.id, task); - if(task.parent) changeParentTask(task, task.parent); - } - } - }); + const postData = 'id=' + itemID + '&startDate=' + from.toLocaleDateString('en-CA') + '&endDate=' + to.toLocaleDateString('en-CA') + '&type=' +type; + + const xhr = new XMLHttpRequest(); + xhr.open('POST', $.createLink('programplan', 'ajaxResponseGanttDragEvent'), false); // 同步模式 + xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + xhr.send(postData); + + let flag = true; + const response = JSON.parse(xhr.responseText); + if(response.result == 'fail' && response.message) + { + zui.Messager.show({content: response.message, type: 'danger-outline', icon: 'exclamation-sign'}); + flag = false; + } + else + { + gantt.updateTask(task.id, task); + if(task.parent) changeParentTask(task, task.parent); + } return flag; }