* Finish task #71903.

This commit is contained in:
曹延义
2022-10-10 13:57:56 +08:00
parent 0b569126ea
commit f9f8a11b90
3 changed files with 50 additions and 2 deletions
+3
View File
@@ -440,10 +440,12 @@ class productplan extends control
if($plan->branch > 0) $this->view->branchStatus = $this->loadModel('branch')->getById($plan->branch, $plan->product, 'status');
$storyIdList = array();
$modulePairs = $this->loadModel('tree')->getOptionMenu($plan->product, 'story', 0, 'all');
foreach($planStories as $story)
{
if(!isset($modulePairs[$story->module])) $modulePairs += $this->tree->getModulesName($story->module);
$storyIdList[] = $story->id;
}
$this->loadModel('datatable');
@@ -466,6 +468,7 @@ class productplan extends control
$this->view->storyPager = $storyPager;
$this->view->bugPager = $bugPager;
$this->view->canBeChanged = $canBeChanged;
$this->view->storyCases = $storyCases = $this->loadModel('testcase')->getStoryCaseCounts($storyIdList);;
if($this->app->getViewType() == 'json')
{
+42
View File
@@ -84,4 +84,46 @@ $(function()
history.pushState({}, 0, createLink('productplan', 'view', "planID=" + planID + '&type=story&orderBy=' + order));
});
});
$('.table-story').table(
{
statisticCreator: function(table)
{
var $checkedRows = table.getTable().find(table.isDataTable ? '.datatable-row-left.checked' : 'tbody>tr.checked');
var $originTable = table.isDataTable ? table.$.find('.datatable-origin') : null;
var checkedTotal = $checkedRows.length;
if(!checkedTotal) return;
var checkedEstimate = 0;
var checkedCase = 0;
var rateCount = checkedTotal;
$checkedRows.each(function()
{
var $row = $(this);
if($originTable)
{
$row = $originTable.find('tbody>tr[data-id="' + $row.data('id') + '"]');
}
var data = $row.data();
checkedEstimate += data.estimate;
if(data.cases > 0)
{
checkedCase += 1;
}
else if(data.children != undefined && data.children > 0)
{
rateCount -= 1;
}
});
var rate = '0%';
if(rateCount) rate = Math.round(checkedCase / rateCount * 10000 / 100) + '' + '%';
if(checkedTotal == 0) return storySummary;
return checkedSummary.replace('%total%', checkedTotal)
.replace('%estimate%', checkedEstimate.toFixed(1))
.replace('%rate%', rate);
}
});
});
+5 -2
View File
@@ -20,6 +20,9 @@
<?php js::set('storyPageID', $storyPager->pageID);?>
<?php js::set('storyRecPerPage', $storyPager->recPerPage);?>
<?php js::set('storyRecTotal', $storyPager->recTotal);?>
<?php js::set('storySummary', $summary);?>
<?php js::set('storyCommon', $lang->SRCommon);?>
<?php js::set('checkedSummary', str_replace('%storyCommon%', $lang->SRCommon, $lang->product->checkedSummary));?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<?php $browseLink = $this->session->productPlanList ? $this->session->productPlanList : inlink('browse', "planID=$plan->product");?>
@@ -100,7 +103,7 @@
<?php if(common::hasPriv('productplan', 'linkStory')):?>
<div class='linkBox cell hidden'></div>
<?php endif;?>
<form class='main-table table-story' data-ride="<?php echo $this->app->getViewType() == 'xhtml' ? '' : 'table' ?>" method='post' target='hiddenwin' action="<?php echo inlink('batchUnlinkStory', "planID=$plan->id&orderBy=$orderBy");?>">
<form class='main-table table-story' data-ride="" method='post' target='hiddenwin' action="<?php echo inlink('batchUnlinkStory', "planID=$plan->id&orderBy=$orderBy");?>">
<table class='table has-sort-head' id='storyList'>
<?php
$canBatchUnlink = common::hasPriv('productPlan', 'batchUnlinkStory');
@@ -158,7 +161,7 @@
$viewLink = $this->createLink('story', 'view', "storyID=$story->id");
$totalEstimate += $story->estimate;
?>
<tr data-id='<?php echo $story->id;?>'>
<tr data-id='<?php echo $story->id;?>' data-estimate='<?php echo $story->estimate?>' <?php if(!empty($story->children)) echo "data-children=" . count($story->children);?> data-cases='<?php echo zget($storyCases, $story->id, 0);?>'>
<?php if($this->app->getViewType() == 'xhtml'):?>
<td class='c-id text-left'>
<?php printf('%03d', $story->id);?>