* Code for task list.
This commit is contained in:
@@ -2433,7 +2433,7 @@ class projectModel extends model
|
||||
|
||||
$execution->children = array();
|
||||
$execution->grade == 1 ? $parents[$execution->id] = $execution : $children[$execution->parent][] = $execution;
|
||||
if(isset($executionTasks) and isset($executionTasks[$execution->id])) $execution->tasks = $executionTasks[$execution->id];
|
||||
if(isset($executionTasks) and isset($executionTasks[$execution->id])) $execution->tasks = array();
|
||||
}
|
||||
|
||||
/* In the case of the waterfall model, calculate the sub-stage. */
|
||||
|
||||
@@ -129,8 +129,7 @@
|
||||
<tr type = "load-btn-row" parent-id = <?php echo $stage->id;?> >
|
||||
<td></td>
|
||||
<td>
|
||||
<span parent-id = <?php echo $stage->id;?> class = "load-btn" current-page = 1 >加载更多...
|
||||
</span>
|
||||
<span parent-id = <?php echo $stage->id;?> class = "load-btn" current-page = 1 >加载更多...</span>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
@@ -167,32 +166,60 @@ $(function()
|
||||
var $trSelected = $(`tr[row-id = ${$(that).attr('id')}]`);
|
||||
if ($trSelected.hasClass("table-nest-child-hide"))
|
||||
{
|
||||
var param =
|
||||
var that = this;
|
||||
var executionID = $(this).attr('parent-id');
|
||||
var currentPage = 1;
|
||||
var pageSize = 50;
|
||||
|
||||
var link = createLink('task', 'ajaxGetTasksByExecution', 'executionID=' + executionID + '¤tPage=' + currentPage + '&pageSize=' + pageSize);
|
||||
$.get(link, function(data)
|
||||
{
|
||||
'id': $(that).attr('id'),
|
||||
'currentPage': 1,
|
||||
'pageSize': 50,
|
||||
};
|
||||
$('#executionForm').table('initNestedList')
|
||||
var newTasks = JSON.parse(data);
|
||||
executionStats.forEach(item =>
|
||||
{
|
||||
if(item.id === executionID)
|
||||
{
|
||||
Object.assign(item.tasks, newTasks);
|
||||
}
|
||||
|
||||
$('#executionForm').table('initNestedList');
|
||||
return;
|
||||
})
|
||||
})
|
||||
|
||||
$('#executionForm').table('initNestedList');
|
||||
$trSelected.removeClass("table-nest-child-hide");
|
||||
$(`tr[parent-id = ${$(that).attr('id')} ]`).show();
|
||||
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
$trSelected.addClass("table-nest-child-hide");
|
||||
$(`tr[parent-id = ${$(that).attr('id')} ]`).hide();
|
||||
|
||||
}
|
||||
})
|
||||
$('.load-btn').on('click', function ()
|
||||
$('.load-btn').on('click', function ()
|
||||
{
|
||||
var that = this;
|
||||
var param =
|
||||
var executionID = $(this).attr('parent-id');
|
||||
var currentPage = $(this).attr('current-page') + 1;
|
||||
var pageSize = 50;
|
||||
|
||||
var link = createLink('task', 'ajaxGetTasksByExecution', 'executionID=' + executionID + '¤tPage=' + currentPage + '&pageSize=' + pageSize);
|
||||
$.get(link, function(data)
|
||||
{
|
||||
'id' : $(that).attr('parent-id'),
|
||||
'currentPage' : $(that).attr('current-page'),
|
||||
'pageSize':50,
|
||||
}
|
||||
var newTasks = JSON.parse(data);
|
||||
executionStats.forEach(item =>
|
||||
{
|
||||
if(item.id === executionID)
|
||||
{
|
||||
Object.assign(item.tasks, newTasks);
|
||||
}
|
||||
|
||||
$('#executionForm').table('initNestedList');
|
||||
return;
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1758,6 +1758,31 @@ class task extends control
|
||||
echo html::select('task', empty($tasks) ? array('' => '') : $tasks, $taskID, "class='form-control'");
|
||||
}
|
||||
|
||||
public function ajaxGetTasksByExecution($executionID, $pageID, $recPerPage, $maxTaskID = 0)
|
||||
{
|
||||
$tasks = $this->dao->select('*')->from(TABLE_TASK)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('status')->ne('closed')
|
||||
->andWhere('execution')->eq($executionID)
|
||||
//->andWhere('id')->gt('')
|
||||
->limit($recPerPage)
|
||||
->fetchAll('id');
|
||||
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
if($task->parent > 0)
|
||||
{
|
||||
if(isset($tasks[$task->parent]))
|
||||
{
|
||||
$tasks[$task->parent]->children[$task->id] = $task;
|
||||
unset($tasks[$task->id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
die(json_encode($tasks));
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: get the actions of a task. for web app.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user