* Code for stage list.

This commit is contained in:
孙广明
2022-07-11 18:19:27 +08:00
parent 7c8366682c
commit f507af4cd0
3 changed files with 104 additions and 76 deletions
+3
View File
@@ -0,0 +1,3 @@
.table-children {border-left: 2px solid #cbd0db; border-right: 2px solid #cbd0db;}
.table tbody > tr.table-children.table-child-top {border-top: 2px solid #cbd0db;}
.table tbody > tr.table-children.table-child-bottom {border-bottom: 2px solid #cbd0db;}
+58 -75
View File
@@ -1,5 +1,4 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/sortable.html.php';?>
<?php js::set('projectID', $projectID);?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
@@ -52,101 +51,87 @@
</div>
<?php else:?>
<?php $canBatchEdit = common::hasPriv('execution', 'batchEdit'); ?>
<form class='main-table' id='executionForm' method='post' action='<?php echo inLink('batchEdit');?>' data-ride='table' data-nested='true' data-expand-nest-child='false' data-checkable='false' data-enable-empty-nested-row='true' data-replace-id='executionTableList' data-preserve-nested='true'>
<form class='main-table' id='executionForm' method='post' action='<?php echo inLink('batchEdit');?>' data-ride='table' data-nested='true' data-expand-nest-child='false' data-checkable='false' data-enable-empty-nested-row='true' data-replace-id='executionTableList' data-preserve-nested='false'>
<div class="table-header fixed-right">
<table class="table table-from has-sort-head table-fixed table-nested" id="executionList">
<?php $vars = "status=$status&orderBy=%s";?>
<thead>
<tr>
<th class='table-nest-title'>
<?php echo $lang->idAB;?>
</th>
<th class='c-progress'><?php echo $lang->programplan->name;?></th>
<th class='c-progress'><?php echo $lang->execution->owner;?></th>
<th class='c-progress'><?php echo $lang->programplan->status;?></th>
<th class='c-progress'><?php echo $lang->project->progress;?></th>
<th class='c-progress'><?php echo $lang->programplan->begin;?></th>
<th class='c-progress'><?php echo $lang->programplan->end;?></th>
<th class='c-progress'><?php echo $lang->task->estimateAB;?></th>
<th class='c-progress'><?php echo $lang->task->consumedAB;?></th>
<th class='c-progress'><?php echo $lang->task->leftAB;?> </th>
<th class='c-name'><?php echo $lang->programplan->name;?></th>
<th class='c-user'><?php echo $lang->execution->owner;?></th>
<th class='c-status'><?php echo $lang->project->status;?></th>
<th class='c-hours'><?php echo $lang->project->progress;?></th>
<th class='c-date'><?php echo $lang->programplan->begin;?></th>
<th class='c-date'><?php echo $lang->programplan->end;?></th>
<th class='c-hours'><?php echo $lang->task->estimateAB;?></th>
<th class='c-hours'><?php echo $lang->task->consumedAB;?></th>
<th class='c-hours'><?php echo $lang->task->leftAB;?> </th>
<th class='c-progress'><?php echo $lang->execution->burn;?> </th>
<th class='text-center c-actions-6'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody id="executionTableList">
<?php foreach($executionStats as $stage):?>
<?php foreach($executionStats as $execution):?>
<?php
$trClass = '';
$trAttrs = "data-id='$stage->id' data-order='$stage->order' data-parent='$stage->parent'";
$trAttrs .= " data-nested='true'";
$trClass .= $stage->parent == '0' ? ' is-top-level table-nest-child-hide' : ' table-nest-hide';
?>
<tr row-id = <?php echo $stage->id;?> class="row-program table-nest-child-hide" >
<td class='text-left table-nest-title'>
<?php echo $stage->id;?>
</td>
$trAttrs = "data-id='$execution->id' data-order='$execution->order' data-nested='true'";
$trClass .= !empty($execution->children) ? ' is-top-level table-nest-child-hide' : '';
?>
<tr <?php echo $trAttrs;?> class="row-program <?php echo $trClass;?>">
<td>
<?php
$icon = '';
if( /* $stage->hasChild || $stage->hasTask*/ true )
if( /* $execution->hasChild || $execution->hasTask*/ true )
{
$icon = '';
$class = ' table-nest-toggle';
}
?>
<span id = <?php echo $stage->id;?> class="table-nest-icon icon <?php echo $class . $icon;?>"></span>
<?php echo $stage->name;?>
<span id = <?php echo $execution->id;?> class="table-nest-icon icon <?php echo $class . $icon;?>"></span>
<?php echo $execution->name;?>
</td>
<td><?php echo $stage->id;?></td>
<td><?php echo $stage->name;?></td>
<td><?php echo $stage->id;?></td>
<td><?php echo $stage->name;?></td>
<td><?php echo $stage->id;?></td>
<td><?php echo $stage->name;?></td>
<td><?php echo $stage->id;?></td>
<td><?php echo $stage->name;?></td>
<td><?php echo $stage->name;?></td>
<td><?php echo $stage->name;?></td>
<td><?php echo zget($users, $execution->PM);?></td>
<td><?php echo zget($lang->project->statusList, $execution->status);?></td>
<td><?php echo html::ring($execution->hours->progress); ?></td>
<td><?php echo $execution->begin;?></td>
<td><?php echo $execution->end;?></td>
<td class='hours' title='<?php echo $execution->hours->totalEstimate . ' ' . $this->lang->execution->workHour;?>'><?php echo $execution->hours->totalEstimate . $this->lang->execution->workHourUnit;?></td>
<td class='hours' title='<?php echo $execution->hours->totalConsumed . ' ' . $this->lang->execution->workHour;?>'><?php echo $execution->hours->totalConsumed . $this->lang->execution->workHourUnit;?></td>
<td class='hours' title='<?php echo $execution->hours->totalLeft . ' ' . $this->lang->execution->workHour;?>'><?php echo $execution->hours->totalLeft . $this->lang->execution->workHourUnit;?></td>
<td id='spark-<?php echo $execution->id?>' class='sparkline text-left no-padding' values='<?php echo join(',', $execution->burns);?>'></td>
<td></td>
</tr>
<?php if(!empty($stage->tasks)):?>
<?php foreach($stage->tasks as $task):?>
<tr parent-id = <?php echo $stage->id;?> >
<td><?php echo $task->id;?></td>
<td><?php echo $task->name;?></td>
<td><?php echo $task->id;?></td>
<td><?php echo $task->name;?></td>
<td><?php echo $task->id;?></td>
<td><?php echo $task->name;?></td>
<td><?php echo $task->id;?></td>
<td><?php echo $task->name;?></td>
<td><?php echo $task->id;?></td>
<td><?php echo $task->name;?></td>
<td><?php echo $task->name;?></td>
<td><?php echo $task->name;?></td>
<?php if(!empty($execution->children)):?>
<?php foreach($execution->children as $child):?>
<?php
$trClass = '';
$trAttrs = "data-id={$child->id} data-parent={$child->parent}";
$trClass .= " is-nest-child";
if(empty($child->path)) $child->path = $execution->path . "$child->id,";
$trAttrs .= " data-nest-parent='$child->parent' data-order='$child->order' data-nest-path='$child->path'";
?>
<tr <?php echo $trAttrs;?> class='<?php echo $trClass;?>'>
<td>
<?php echo $child->name;?>
</td>
<td><?php echo zget($users, $child->PM);?></td>
<td><?php echo zget($lang->project->statusList, $child->status);?></td>
<td><?php echo html::ring($child->hours->progress); ?></td>
<td><?php echo $child->begin;?></td>
<td><?php echo $child->end;?></td>
<td class='hours' title='<?php echo $child->hours->totalEstimate . ' ' . $this->lang->execution->workHour;?>'><?php echo $child->hours->totalEstimate . $this->lang->execution->workHourUnit;?></td>
<td class='hours' title='<?php echo $child->hours->totalConsumed . ' ' . $this->lang->execution->workHour;?>'><?php echo $child->hours->totalConsumed . $this->lang->execution->workHourUnit;?></td>
<td class='hours' title='<?php echo $child->hours->totalLeft . ' ' . $this->lang->execution->workHour;?>'><?php echo $child->hours->totalLeft . $this->lang->execution->workHourUnit;?></td>
<td id='spark-<?php echo $child->id?>' class='sparkline text-left no-padding' values='<?php echo join(',', $child->burns);?>'></td>
<td></td>
</tr>
<?php endforeach;?>
<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>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<?php endif;?>
<?php endforeach;?>
</tbody>
</table>
<nav class="btn-toolbar pull-right setting"></nav>
</div>
</form>
<?php endif;?>
@@ -159,10 +144,10 @@ $("#<?php echo $status;?>Tab").addClass('btn-active-text');
$(function()
{
$("#executionList").on('click','.table-nest-icon',function(e)
{ /* add event when click expand button */
$("#executionList").on('click','.showmore',function(e)
{ /* add event when click expand button */
var that = e.target;
var $trSelected = $(`tr[row-id = ${$(that).attr('id')}]`);
var $trSelected = $(`tr[data-id = ${$(that).attr('id')}]`);
if ($trSelected.hasClass("table-nest-child-hide"))
{ /* table expand */
var executionID = $(this).attr('id');
@@ -172,7 +157,7 @@ $(function()
$.get(link, function(data)
{
var newTasks = JSON.parse(data);
$trSelected.after("<tr></tr>");
$trSelected.after("<tr><td>111</td></tr>");
/* if (total > 50)
* 在第五十条后加一个tr 包裹一个td 中间含有一个 <span class = 'load-btn'></span>
* 点击事件如下
@@ -192,7 +177,7 @@ $(function()
}
})
$("#executionList").on('click','.load-btn', function(e)
$("#executionList").on('click', '.showmore', function(e)
{
var that = e.target;
var executionID = $(this).attr('parent-id');
@@ -206,7 +191,5 @@ $(function()
console.log('addRow');
}*/
});
</script>
<?php include '../../common/view/footer.html.php';?>
+43 -1
View File
@@ -1760,6 +1760,7 @@ class task extends control
public function ajaxGetTasksByExecution($executionID, $pageID, $recPerPage, $maxTaskID = 0)
{
//总数、更多、最后一条ID,
$tasks = $this->dao->select('*')->from(TABLE_TASK)
->where('deleted')->eq(0)
->andWhere('status')->ne('closed')
@@ -1768,6 +1769,8 @@ class task extends control
->limit($recPerPage)
->fetchAll('id');
$users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
$html = '';
foreach($tasks as $task)
{
if($task->parent > 0)
@@ -1778,9 +1781,48 @@ class task extends control
unset($tasks[$task->id]);
}
}
$parentClass = $task->parent == '-1' ? 'table-nest-child-hide' : '';
$parentID = $task->parent > 0 ? $task->parent : $executionID;
$html .= "<tr row-id=$task->id parent-id=$parentID class='row-program $parentClass'>";
$html .= '<td>';
$html .= $task->id;
$html .= '</td>';
$html .= '<td>';
$html .= $task->name;
$html .= '</td>';
$html .= '<td>';
$html .= zget($users, $task->assignedTo, '');
$html .= '</td>';
$html .= '<td>';
$html .= zget($this->lang->task->statusList, $task->task, '');
$html .= '</td>';
$html .= '<td>';
$html .= '</td>';
$html .= '<td>';
$html .= $task->begin;
$html .= '</td>';
$html .= '<td>';
$html .= $task->end;
$html .= '</td>';
$html .= '<td>';
$html .= $task->consumed;
$html .= '</td>';
$html .= '<td>';
$html .= $task->left;
$html .= '</td>';
$html .= '<td>';
$html .= '燃尽图';
$html .= '</td>';
$html .= '<td>';
$html .= '操作';
$html .= '</td>';
$html .= '</tr>';
}
die(json_encode($tasks));
die(json_encode($html));
}
/**