* Code for task #70495.

This commit is contained in:
曹延义
2022-09-27 09:59:14 +08:00
parent 30973efa6a
commit 0911d16112
5 changed files with 58 additions and 21 deletions
+7 -4
View File
@@ -1112,10 +1112,11 @@ class task extends control
*
* @param int $taskID
* @param string $from
* @param string $orderBy
* @access public
* @return void
*/
public function recordEstimate($taskID, $from = '')
public function recordEstimate($taskID, $from = '', $orderBy = '')
{
$this->commonAction($taskID);
@@ -1174,12 +1175,14 @@ class task extends control
$this->session->set('estimateList', $uri, 'execution');
if(isonlybody()) $this->session->set('estimateList', $uri . (strpos($uri, '?') === false ? '?' : '&') . 'onlybody=yes', 'execution');
$task = $this->task->getById($taskID);
$orderBy = 'date,id';
if(!empty($task->team) and $task->mode == 'linear') $orderBy = 'order,date,id';
$task = $this->task->getById($taskID);
if(!empty($task->team) and $task->mode == 'linear' and !$orderBy) $orderBy = 'order_asc';
if(!$orderBy) $orderBy = 'date_asc';
$this->view->title = $this->lang->task->record;
$this->view->task = $task;
$this->view->from = $from;
$this->view->orderBy = $orderBy;
$this->view->efforts = $this->task->getTaskEstimate($taskID, '', '', $orderBy);
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
$this->display();
+3
View File
@@ -18,3 +18,6 @@
.main-header ul.hours:after{content:")"}
.body-modal .main-header>h2 { max-width: 70% !important; margin-right:0px;}
.table-record .form-date {border-right: none;}
.table.has-sort-head thead>tr>th>a:after, .table.has-sort-head thead>tr>th>a:before {top: -7px;}
.table.has-sort-head thead>tr>th>a:hover, .table.has-sort-head thead>tr>th>a:hover:after, .table.has-sort-head thead>tr>th>a:hover:before {color: #000;}
+19 -1
View File
@@ -1,5 +1,24 @@
$(function()
{
/* Set default tab. */
if($.cookie('recordEstimateType') == 'all')
{
$('#recordForm').addClass('hidden');
$('.my-effort, #legendMyEffort').removeClass('active');
$('.all-effort, #legendAllEffort').addClass('active');
}
else
{
$('.my-effort, #legendMyEffort').addClass('active');
$('#recordForm').removeClass('hidden');
}
$.cookie('recordEstimateType', null);
$('.order-btn').on('click', function()
{
$.cookie('recordEstimateType', 'all');
});
/* Hide creation logs when displaying team logs. */
$('#linearefforts .tabs ul > li').click(function()
{
@@ -7,7 +26,6 @@ $(function()
$('#recordForm').toggleClass('hidden', tab == '#legendAllEffort');
});
$('.form-date').datetimepicker('setEndDate', today);
$("#recordForm #submit").click(function(e, confirmed)
+25 -13
View File
@@ -16,9 +16,13 @@ foreach($task->team as $team) $teamOrders[$team->order] = $team->account;
$myOrders = array();
$allEfforts = array();
$recorders = array();
foreach($efforts as $effort)
$index = 0;
$allOrders = array();
$efforts = array_values($efforts);
foreach($efforts as $key => $effort)
{
$order = $effort->order;
$prevEffort = $key > 0 ? $efforts[$key - 1] : null;
$order = (!$prevEffort or $prevEffort->order == $effort->order) ? $index : ++$index;
$account = $effort->account;
$allEfforts[$order][] = $effort;
$recorders[$order][$account] = $account;
@@ -27,22 +31,29 @@ foreach($efforts as $effort)
if(!isset($myOrders[$order])) $myOrders[$order] = 0;
$myOrders[$order] += 1;
}
$allOrders[$order] = $effort->order + 1;
}
?>
<div id='linearefforts'>
<div class='tabs'>
<ul class='nav nav-tabs'>
<li class='active'><a href='#legendMyEffort' data-toggle='tab'><?php echo $lang->task->myEffort;?></a></li>
<li><a href='#legendAllEffort' data-toggle='tab'><?php echo $lang->task->allEffort;?></a></li>
<li class='my-effort'><a href='#legendMyEffort' data-toggle='tab'><?php echo $lang->task->myEffort;?></a></li>
<li class='all-effort'><a href='#legendAllEffort' data-toggle='tab'><?php echo $lang->task->allEffort;?></a></li>
</ul>
<div class='tab-content'>
<div class='tab-pane active' id='legendMyEffort'>
<div class='tab-pane' id='legendMyEffort'>
<?php if(!empty($myOrders)):?>
<table class='table table-bordered table-fixed table-recorded'>
<table class='table table-bordered table-fixed table-recorded has-sort-head'>
<thead>
<tr class='text-center'>
<th class="w-60px"> <?php echo $lang->task->teamOrder;?></th>
<th class="w-120px"><?php echo $lang->task->date;?></th>
<?php
$vars = (isset($objectType) ? "objectType=$objectType&" : '') . "taskID=$task->id&from=$from&orderBy=%s";
$sort = explode(',', $orderBy);
$orderBy = zget($sort, '0', '');
if(!strpos($orderBy, '_')) $orderBy .= '_asc';
?>
<th class="w-60px"><?php common::printOrderLink('order', $orderBy, $vars, $lang->task->teamOrder);?></th>
<th class="w-120px"><?php common::printOrderLink('date', $orderBy, $vars, $lang->task->date);?></th>
<th class="w-120px"><?php echo $lang->task->recordedBy;?></th>
<th><?php echo $lang->task->work;?></th>
<th class="thWidth"><?php echo $lang->task->consumedAB;?></th>
@@ -58,7 +69,7 @@ foreach($efforts as $effort)
<?php if($effort->account != $this->app->user->account) continue;?>
<tr class="text-center">
<?php if(!$showOrder):?>
<td rowspan='<?php echo $count;?>'><?php echo $order + 1;?></td>
<td rowspan='<?php echo $count;?>'><?php echo $allOrders[$order];?></td>
<?php $showOrder = true;?>
<?php endif;?>
<td><?php echo $effort->date;?></td>
@@ -84,11 +95,12 @@ foreach($efforts as $effort)
<?php endif;?>
</div>
<div class='tab-pane' id='legendAllEffort'>
<table class='table table-bordered table-fixed table-recorded'>
<table class='table table-bordered table-fixed table-recorded has-sort-head'>
<thead>
<tr class='text-center'>
<th class="w-60px"> <?php echo $lang->task->teamOrder;?></th>
<th class="w-120px"><?php echo $lang->task->date;?></th>
<?php $vars = (isset($objectType) ? "objectType=$objectType&" : '') . "taskID=$task->id&from=$from&orderBy=%s";?>
<th class="w-60px order-btn"><?php common::printOrderLink('order', $orderBy, $vars, $lang->task->teamOrder);?></th>
<th class="w-120px order-btn"><?php common::printOrderLink('date', $orderBy, $vars, $lang->task->date);?></th>
<th class="w-120px"><?php echo $lang->task->recordedBy;?></th>
<th><?php echo $lang->task->work;?></th>
<th class="thWidth"><?php echo $lang->task->consumedAB;?></th>
@@ -103,7 +115,7 @@ foreach($efforts as $effort)
<?php foreach($allEfforts[$order] as $effort):?>
<tr class="text-center">
<?php if(!$showOrder):?>
<td rowspan='<?php echo $count;?>'><?php echo $order + 1;?></td>
<td rowspan='<?php echo $count;?>'><?php echo $allOrders[$order];?></td>
<?php $showOrder = true;?>
<?php endif;?>
<td><?php echo $effort->date;?></td>
+4 -3
View File
@@ -56,10 +56,11 @@ if(!empty($members) && $task->mode == 'linear')
<?php if(!empty($task->team) and $task->mode == 'linear'):?>
<?php include __DIR__ . '/lineareffort.html.php';?>
<?php else:?>
<table class='table table-bordered table-fixed table-recorded'>
<table class='table table-bordered table-fixed table-recorded has-sort-head'>
<thead>
<tr class='text-center'>
<th class="w-120px"><?php echo $lang->task->date;?></th>
<?php $vars = "taskID=$task->id&from=$from&orderBy=%s";?>
<th class="w-120px"><?php common::printOrderLink('date', !strpos($orderBy, ',') ? $orderBy : 'date_asc', $vars, $lang->task->date);?></th>
<th class="w-120px"><?php echo $lang->task->recordedBy;?></th>
<th><?php echo $lang->task->work;?></th>
<th class="thWidth"><?php echo $lang->task->consumed;?></th>
@@ -100,7 +101,7 @@ if(!empty($members) && $task->mode == 'linear')
</div>
</div>
<?php else:?>
<form id="recordForm" method='post' target='hiddenwin'>
<form id="recordForm" class='hidden' method='post' target='hiddenwin'>
<?php
$readonly = '';
$left = '';