* Finish task #73234,73242.

This commit is contained in:
tanghucheng
2022-10-27 08:09:26 +08:00
parent cf00a736a1
commit d96d6bb803
9 changed files with 64 additions and 11 deletions
+20
View File
@@ -1646,6 +1646,26 @@ class execution extends control
$this->view->linkedBranches = $linkedBranches;
}
if(!$project->division)
{
$products = $this->loadModel('product')->getProducts($projectID);
$branches = $this->project->getBranchesByProject($projectID);
$plans = $this->loadModel('productplan')->getGroupByProduct(array_keys($products), 'skipParent|unexpired');
$linkedBranches = array();
foreach($products as $productID => $product)
{
foreach($branches[$productID] as $branchID => $branch)
{
$linkedBranches[$productID][$branchID] = $branchID;
$productPlans[$productID][$branchID] = isset($plans[$productID][$branchID]) ? $plans[$productID][$branchID] : array();
}
}
$this->view->branches = $branches;
$this->view->linkedBranches = $linkedBranches;
}
if(!empty($_POST))
{
$executionID = $this->execution->create($copyExecutionID);
+9 -7
View File
@@ -124,13 +124,15 @@ function loadBranches(product)
{
if($('#productsBox .input-group:last select:first').val() != 0)
{
var length = $('#productsBox .input-group').size();
$('#productsBox .row').append('<div class="col-sm-4">' + $('#productsBox .col-sm-4:last').html().replace('required', '') + '</div>');
if($('#productsBox .input-group:last select').size() >= 2) $('#productsBox .input-group:last select:last').remove();
$('#productsBox .input-group:last .chosen-container').remove();
$('#productsBox .input-group:last select:first').attr('name', 'products[' + length + ']').attr('id', 'products' + length);
$('#productsBox .input-group:last .chosen').chosen();
if(model !== 'waterfall')
{
var length = $('#productsBox .input-group').size();
$('#productsBox .row').append('<div class="col-sm-4">' + $('#productsBox .col-sm-4:last').html().replace('required', '') + '</div>');
if($('#productsBox .input-group:last select').size() >= 2) $('#productsBox .input-group:last select:last').remove();
$('#productsBox .input-group:last .chosen-container').remove();
$('#productsBox .input-group:last select:first').attr('name', 'products[' + length + ']').attr('id', 'products' + length);
$('#productsBox .input-group:last .chosen').chosen();
}
adjustProductBoxMargin();
}
+8 -1
View File
@@ -339,6 +339,12 @@ class executionModel extends model
$type = 'sprint';
if($project) $type = zget($this->config->execution->modelList, $project->model, 'sprint');
if($project->model == 'waterfall')
{
$this->checkWorkload('create', $_POST['percent'], $project);
if(dao::isError()) return false;
}
$this->config->execution->create->requiredFields .= ',project';
}
@@ -1175,7 +1181,7 @@ class executionModel extends model
}
/* The total workload of the first stage should not exceed 100%. */
if($type == 'create' or (empty($oldExecution) and $oldExecution->grade == 1))
if($type == 'create' or (!empty($oldExecution) and $oldExecution->grade == 1))
{
$oldPercentTotal = $this->dao->select('SUM(t2.percent) as total')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.project=t2.id')
@@ -4616,6 +4622,7 @@ class executionModel extends model
$burns = join(',', $execution->burns);
echo "<tr $trAttrs class='$trClass'>";
if(!empty($execution->division)) echo "<td class='text-center' title='{$execution->productName}'>{$execution->productName}</td>";
echo "<td class='c-name text-left flex sort-handler'>";
if(common::hasPriv('execution', 'batchEdit')) echo "<span id=$execution->id class='table-nest-icon icon table-nest-toggle'></span>";
if($this->config->systemMode == 'new')
+6 -1
View File
@@ -48,6 +48,7 @@
<?php js::set('copyExecutionID', $copyExecutionID);?>
<?php js::set('cancelCopy', $lang->execution->cancelCopy);?>
<?php js::set('copyNoExecution', $lang->execution->copyNoExecution);?>
<?php js::set('model', $project->model);?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
@@ -137,12 +138,14 @@
<td class='text-left' id='productsBox' colspan="3">
<div class='row'>
<?php $i = 0;?>
<?php $class = $project->division ? '' : 'disabled';?>
<?php foreach($products as $product):?>
<?php $hasBranch = ($product->type != 'normal' and isset($branchGroups[$product->id]));?>
<?php foreach($linkedBranches[$product->id] as $branchID => $branch):?>
<div class='col-sm-4'>
<div class="input-group<?php if($hasBranch) echo ' has-branch';?>">
<?php echo html::select("products[$i]", $allProducts, $product->id, "class='form-control chosen' onchange='loadBranches(this)' data-last='" . $product->id . "'");?>
<?php echo html::select("products[$i]", $allProducts, $product->id, "class='form-control chosen' $class onchange='loadBranches(this)' data-last='" . $product->id . "'");?>
<?php if($class) echo html::hidden("products[$i]", $product->id);?>
<span class='input-group-addon fix-border'></span>
<?php if($hasBranch) echo html::select("branch[$i]", $branchGroups[$product->id], $branchID, "class='form-control chosen' onchange=\"loadPlans('#products{$i}', this.value)\"");?>
</div>
@@ -150,12 +153,14 @@
<?php $i++;?>
<?php endforeach;?>
<?php endforeach;?>
<?php if($project->division):?>
<div class='col-sm-4'>
<div class="input-group">
<?php echo html::select("products[$i]", $allProducts, '', "class='form-control chosen' onchange='loadBranches(this)'");?>
<span class='input-group-addon fix-border'></span>
</div>
</div>
<?php endif;?>
</div>
</td>
</tr>
+1
View File
@@ -110,6 +110,7 @@ class programplan extends control
$this->view->title = $this->lang->programplan->browse;
$this->view->position[] = $this->lang->programplan->browse;
$this->view->projectID = $projectID;
$this->view->project = $this->project->getByID($projectID);
$this->view->productID = $this->productID;
$this->view->productList = $this->loadModel('product')->getProductPairsByProject($projectID);
$this->view->type = $type;
+4
View File
@@ -80,6 +80,7 @@ form {display: block; margin-top: 0em; margin-block-end: 1em;}
<?php if($this->app->getModuleName() == 'programplan'):?>
<div class='btn-toolbar pull-left'>
<div class='btn-group'>
<?php if(!empty($project->division) or !empty($project->hasProduct)):?>
<?php $viewName = $productID != 0 ? zget($productList,$productID) : $lang->product->allProduct;?>
<a href='javascript:;' class='btn btn-link btn-limit' data-toggle='dropdown'><span class='text' title='<?php echo $viewName;?>'><?php echo $viewName;?></span> <span class='caret'></span></a>
<ul class='dropdown-menu' style='max-height:240px; max-width: 300px; overflow-y:auto'>
@@ -93,6 +94,9 @@ form {display: block; margin-top: 0em; margin-block-end: 1em;}
}
?>
</ul>
<?php else:?>
<?php echo $lang->programplan->gantt;?>
<?php endif;?>
</div>
</div>
<div class="pull-right btn-toolbar flax">
+11 -2
View File
@@ -1035,10 +1035,19 @@ class project extends control
$this->view->title = $this->lang->execution->allExecutions;
$this->view->position[] = $this->lang->execution->allExecutions;
$executionStats = $this->execution->getStatData($projectID, $status, $productID, 0, $this->cookie->showTask, '', $orderBy, $pager);
$showToggleIcon = false;
$executionStats = $this->execution->getStatData($projectID, $status, $productID, 0, $this->cookie->showTask, '', $orderBy, $pager);
$showToggleIcon = false;
$productNameList = $this->dao->select('t1.id,GROUP_CONCAT(t3.`name`) as productName')->from(TABLE_EXECUTION)->alias('t1')
->leftjoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id=t2.project')
->leftjoin(TABLE_PRODUCT)->alias('t3')->on('t2.product=t3.id')
->where('t1.project')->eq($projectID)
->andWhere('t1.type')->eq('stage')
->groupBy('t1.id')
->fetchPairs();
foreach($executionStats as $execution)
{
$execution->productName = isset($productNameList[$execution->id]) ? $productNameList[$execution->id] : '';
if(!empty($execution->tasks) or !empty($execution->children))
{
$showToggleIcon = true;
+1
View File
@@ -13,6 +13,7 @@ th.table-nest-title .check-all {position: absolute; left: 15px; top: 7px;}
#executionTableList > tr:not(.has-nest-child) .project-type-label {margin-left: 22px;}
.table-statistic {padding-left: 10px;}
td.flex {display: flex; flex-flow: row nowrap; justify-content: flex-start; align-items: center; margin-bottom: 0px;}
th.c-name {width: 80px;}
td.c-name > .project-type-label {flex: 0 0 36px; padding-right: 2px;}
.c-name > a, .table-children .text-left > a, .c-name > span.text-ellipsis { padding-left: 5px; text-overflow: clip;}
span.table-nest-icon.table-nest-toggle {min-width: 22px; max-width: 22px;}
+4
View File
@@ -14,6 +14,7 @@
<?php js::set('checkedExecutions', $lang->execution->checkedExecutions);?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<?php if($project->division):?>
<div class='btn-group'>
<?php $viewName = $productID != 0 ? zget($productList,$productID) : $lang->product->allProduct;?>
<a href='javascript:;' class='btn btn-link btn-limit' data-toggle='dropdown'><span class='text' title='<?php echo $viewName;?>'><?php echo $viewName;?></span> <span class='caret'></span></a>
@@ -30,6 +31,7 @@
?>
</ul>
</div>
<?php endif;?>
<?php common::sortFeatureMenu('execution', 'all');?>
<?php foreach($lang->execution->featureBar['all'] as $key => $label):?>
<?php $label = "<span class='text'>$label</span>";?>
@@ -75,6 +77,7 @@
<?php $vars = "status=$status&orderBy=%s";?>
<thead>
<tr>
<?php if($project->division) echo "<th class='c-name text-center'>{$lang->project->product}</th>";?>
<th class='table-nest-title'>
<div class="flex-between">
<?php echo $lang->nameAB;?>
@@ -97,6 +100,7 @@
</thead>
<tbody id="executionTableList">
<?php foreach($executionStats as $execution):?>
<?php $execution->division = $project->division;?>
<?php $this->execution->printNestedList($execution, false, $users, $productID);?>
<?php endforeach;?>
</tbody>