Merge branch 'sprint/gantt_upgrade' of https://gitlab.zcorp.cc/easycorp/zentaopms into sprint/max40_gantt_upgrade
This commit is contained in:
@@ -330,7 +330,7 @@ class programplanModel extends model
|
||||
}
|
||||
|
||||
$datas['data'] = isset($datas['data']) ? array_values($datas['data']) : array();
|
||||
// a($datas['data']);exit;
|
||||
|
||||
return $returnJson ? json_encode($datas) : $datas;
|
||||
}
|
||||
|
||||
@@ -361,6 +361,7 @@ class programplanModel extends model
|
||||
$tasksGroup = $this->dao->select('*')->from(TABLE_TASK)->where('deleted')->eq(0)->andWhere('execution')->in($planIdList)->fetchGroup('assignedTo','id');
|
||||
$users = $this->loadModel('user')->getPairs('noletter');
|
||||
|
||||
$tasksMap = array();
|
||||
foreach($tasksGroup as $group => $tasks)
|
||||
{
|
||||
foreach($tasks as $id => $task)
|
||||
@@ -382,6 +383,8 @@ class programplanModel extends model
|
||||
$taskGroups[$account][$id]->realname = $member->realname;
|
||||
}
|
||||
}
|
||||
|
||||
$tasksMap[$task->id] = $task;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,21 +410,18 @@ class programplanModel extends model
|
||||
$dataGroup->parent = 0;
|
||||
$dataGroup->open = true;
|
||||
$dataGroup->progress = '';
|
||||
$dataGroup->start_date = '';
|
||||
$dataGroup->endDate = '';
|
||||
$dataGroup->duration = 0;
|
||||
//TODO
|
||||
$dataGroup->start_date = '03-11-2021';
|
||||
$dataGroup->endDate = '2021-12-01';
|
||||
$dataGroup->duration = 1;
|
||||
//TODO
|
||||
$dataGroup->taskProgress = '';
|
||||
|
||||
$groupKey = $groupID . $group;
|
||||
$datas['data'][$groupKey] = $dataGroup;
|
||||
|
||||
foreach($tasks as $taskID => $task)
|
||||
{
|
||||
// if($task->parent > 0 and $task->assignedTo)
|
||||
// {
|
||||
// $a = $task->parent;
|
||||
// a($tasksGroup[$task->assignedTo]);
|
||||
// a($task->parent);exit;
|
||||
// }
|
||||
$execution = zget($plans, $task->execution, array());
|
||||
|
||||
$priIcon = sprintf($taskPri, $task->pri, $task->pri, $task->pri);
|
||||
@@ -451,7 +451,7 @@ class programplanModel extends model
|
||||
$data->realBegan = $realBegan;
|
||||
$data->realEnd = $realEnd;
|
||||
$data->pri = $task->pri;
|
||||
$data->parent = ($task->parent > 0 and $task->assignedTo != '') ? $task->parent : $groupID;
|
||||
$data->parent = ($task->parent > 0 and $task->assignedTo != '' and !empty($tasksMap[$task->parent]->assignedTo)) ? $task->parent : $groupID;
|
||||
$data->open = true;
|
||||
$progress = $task->consumed ? round($task->consumed / ($task->left + $task->consumed), 3) : 0;
|
||||
$data->progress = $progress;
|
||||
@@ -460,35 +460,21 @@ class programplanModel extends model
|
||||
$data->endDate = $end;
|
||||
$data->duration = 0;
|
||||
|
||||
/* If multi task then show the teams. */
|
||||
// if($task->mode == 'multi' and !empty($taskTeams[$task->id]))
|
||||
// {
|
||||
// $teams = array_keys($taskTeams[$task->id]);
|
||||
// $assigneds = array();
|
||||
// foreach($teams as $assignedTo) $assigneds[] = zget($users, $assignedTo);
|
||||
// $data->owner_id = join(',', $assigneds);
|
||||
// }
|
||||
|
||||
if($data->endDate > $data->start_date) $data->duration = helper::diffDate($data->endDate, $data->start_date) + 1;
|
||||
if($data->start_date) $data->start_date = date('d-m-Y', strtotime($data->start_date));
|
||||
if($data->start_date == '' or $data->endDate == '') $data->duration = 0;
|
||||
|
||||
if(strpos($selectCustom, 'task') !== false) $datas['data'][$data->id] = $data;
|
||||
|
||||
foreach($stageIndex as $index => $stage)
|
||||
if(isset($stageIndex[$groupKey]['totalConsumed']))
|
||||
{
|
||||
if($stage['planID'] == $task->execution)
|
||||
{
|
||||
$stageIndex[$index]['progress']['totalConsumed'] += $task->consumed;
|
||||
$stageIndex[$index]['progress']['totalReal'] += ($task->left + $task->consumed);
|
||||
|
||||
$parent = $stage['parent'];
|
||||
if(isset($stageIndex[$parent]))
|
||||
{
|
||||
$stageIndex[$parent]['progress']['totalConsumed'] += $task->consumed;
|
||||
$stageIndex[$parent]['progress']['totalReal'] += ($task->left + $task->consumed);
|
||||
}
|
||||
}
|
||||
$stageIndex[$groupKey]['totalConsumed'] += $task->consumed;
|
||||
$stageIndex[$groupKey]['totalReal'] += $task->left + $task->consumed;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stageIndex[$groupKey]['totalConsumed'] = $task->consumed;
|
||||
$stageIndex[$groupKey]['totalReal'] = $task->left + $task->consumed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -496,7 +482,7 @@ class programplanModel extends model
|
||||
/* Calculate the progress of the phase. */
|
||||
foreach($stageIndex as $index => $stage)
|
||||
{
|
||||
$progress = empty($stage['progress']['totalConsumed']) ? 0 : round($stage['progress']['totalConsumed'] / $stage['progress']['totalReal'], 3);
|
||||
$progress = empty($stage['totalReal']) ? 0 : round($stage['totalConsumed'] / $stage['totalReal'], 3);
|
||||
$datas['data'][$index]->progress = $progress;
|
||||
|
||||
$progress = ($progress * 100) . '%';
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
* @version $Id: gantt.html.php 4903 2013-06-26 05:32:59Z wyd621@gmail.com $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
|
||||
?>
|
||||
<?php chdir(__DIR__);?>
|
||||
<?php include '../../common/view/gantt.html.php';?>
|
||||
@@ -72,6 +71,7 @@ form {display: block; margin-top: 0em; margin-block-end: 1em;}
|
||||
<?php js::set('dateDetails', $dateDetails);?>
|
||||
<?php js::set('module', $app->rawModule);?>
|
||||
<?php js::set('method', $app->rawMethod);?>
|
||||
<?php js::set('ganttType', $ganttType);?>
|
||||
<?php js::set('canGanttEdit', common::hasPriv('programplan', 'ganttEdit'));?>
|
||||
<div id='mainContent' class='main-content load-indicator' data-loading='<?php echo $lang->programplan->exporting;?>'>
|
||||
<form class="main-form form-ajax not-watch">
|
||||
@@ -423,21 +423,25 @@ function validateResources(id)
|
||||
};
|
||||
var link = createLink('programplan', 'ajaxSaveTaskDrag');
|
||||
/* Sync Close. */
|
||||
$.ajaxSettings.async = false;
|
||||
$.post(link, postData, function(response)
|
||||
{
|
||||
response = JSON.parse(response);
|
||||
if(response.result == 'fail' && response.message)
|
||||
$.ajax({
|
||||
url: link,
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: postData,
|
||||
type: "post",
|
||||
success: function(response)
|
||||
{
|
||||
new $.zui.Messager(response.message, {
|
||||
type: 'danger',
|
||||
icon: 'exclamation-sign'
|
||||
}).show();
|
||||
flag = false;
|
||||
response = JSON.parse(response);
|
||||
if(response.result == 'fail' && response.message)
|
||||
{
|
||||
new $.zui.Messager(response.message, {
|
||||
type: 'danger',
|
||||
icon: 'exclamation-sign'
|
||||
}).show();
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
})
|
||||
/* Sync Open. */
|
||||
$.ajaxSettings.async = true;
|
||||
});
|
||||
|
||||
return flag;
|
||||
}
|
||||
@@ -498,8 +502,8 @@ $(function()
|
||||
}
|
||||
},
|
||||
{name: 'taskProgress', align: 'center', resize: true, width: 60},
|
||||
{name: 'realBegan', align: 'center', resize: true, width: 80},
|
||||
{name: 'realEnd', align: 'center', width: 80}
|
||||
{name: 'realBegan', align: 'center', resize: true, width: 150},
|
||||
{name: 'realEnd', align: 'center', width: 150}
|
||||
];
|
||||
|
||||
gantt.locale.labels.column_text = <?php echo json_encode($typeHtml);?>;
|
||||
@@ -617,12 +621,17 @@ $(function()
|
||||
gantt.attachEvent('onTaskClick', function(id, e)
|
||||
{
|
||||
if($(e.srcElement).hasClass('gantt_close') || $(e.srcElement).hasClass('gantt_open')) return false;
|
||||
|
||||
/* The id of task item is like executionID-taskID. e.g. 1507-37829, 37829 is task id. */
|
||||
var position = id.indexOf('-');
|
||||
if(position < 0) return;
|
||||
|
||||
var taskID = parseInt(id.substring(position + 1));
|
||||
if(ganttType == 'assignedTo')
|
||||
{
|
||||
taskID = id;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The id of task item is like executionID-taskID. e.g. 1507-37829, 37829 is task id. */
|
||||
var position = id.indexOf('-');
|
||||
if(position < 0) return;
|
||||
var taskID = parseInt(id.substring(position + 1));
|
||||
}
|
||||
|
||||
if(!isNaN(taskID) && taskID > 0) taskModalTrigger.show({url: createLink('task', 'view', 'taskID=' + taskID, 'html', true)});
|
||||
});
|
||||
|
||||
@@ -3898,6 +3898,7 @@ class taskModel extends model
|
||||
public function saveTaskDrag($objectID, $objectType)
|
||||
{
|
||||
$post = fixer::input('post')->get();
|
||||
$post->end_date = date('Y-m-d', strtotime('-1 day', strtotime($post->end_date)));
|
||||
if($objectType == 'task')
|
||||
{
|
||||
$objectData = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq($objectID)->fetch();
|
||||
@@ -3935,7 +3936,7 @@ class taskModel extends model
|
||||
}
|
||||
|
||||
$updateStartArg = !empty($objectData->realStarted) ? 'realStarted' : 'estStarted';
|
||||
$updateEndArg = strpos($objectData->status, 'closed, done') !== false ? 'finishedDate' : 'deadline';
|
||||
$updateEndArg = (!empty($objectData->finishedDate) and in_array($objectData->status, array('done', 'closed'))) ? 'finishedDate' : 'deadline';
|
||||
$this->dao->update(TABLE_TASK)
|
||||
->set($updateStartArg)->eq($post->start_date)
|
||||
->set($updateEndArg)->eq($post->end_date)
|
||||
|
||||
Reference in New Issue
Block a user