From a68fe9adcd5178985491b0ae88a9817d345e408d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 18 Dec 2017 10:01:08 +0800 Subject: [PATCH] * finish task 3463. --- module/product/js/browse.js | 41 ++++++++++++++++++++++++ module/product/lang/en.php | 5 +-- module/product/lang/zh-cn.php | 5 +-- module/product/view/browse.html.php | 3 +- module/project/js/story.js | 39 +++++++++++++++++++++++ module/project/js/task.js | 48 +++++++++++++++++++++++++++++ module/project/lang/en.php | 1 + module/project/lang/zh-cn.php | 1 + module/project/view/story.html.php | 3 +- module/project/view/task.html.php | 17 +++++----- 10 files changed, 149 insertions(+), 14 deletions(-) diff --git a/module/product/js/browse.js b/module/product/js/browse.js index 086b549507..d9ae94d9ab 100644 --- a/module/product/js/browse.js +++ b/module/product/js/browse.js @@ -25,8 +25,49 @@ $(function() setTimeout(function(){fixedTheadOfList('#storyList')}, 100); if($('#storyList thead th.w-title').width() < 150) $('#storyList thead th.w-title').width(150); + + $(document).on('click', "#storyList tbody tr", function(){showCheckedSummary();}); + $(document).on('change', "#storyList :checkbox", function(){showCheckedSummary();}); + $(document).on('click', "#datatable-storyList table tr", function(){showCheckedSummary();}); }) +function showCheckedSummary() +{ + var $summary = $('tfoot .table-actions .text:last'); + if(!$summary.hasClass('readed')) + { + taskSummary = $summary.html(); + $summary.addClass('readed'); + } + + var checkedTotal = 0; + var checkedEstimate = 0; + var checkedCase = 0; + $('[name^="storyIDList"]').each(function() + { + if($(this).prop('checked')) + { + checkedTotal += 1; + var taskID = $(this).val(); + $tr = $("#storyList tbody tr[data-id='" + taskID + "']"); + checkedEstimate += Number($tr.data('estimate')); + if(Number($tr.data('cases')) > 0) checkedCase += 1; + } + }); + if(checkedTotal > 0) + { + rate = Math.round(checkedCase / checkedTotal * 10000) / 100 + '' + '%'; + summary = checkedSummary.replace('%total%', checkedTotal) + .replace('%estimate%', checkedEstimate) + .replace('%rate%', rate) + $('tfoot .table-actions .text:last').html(summary); + } + else + { + $('tfoot .table-actions .text:last').html(taskSummary); + } +} + function setQueryBar(queryID, title) { $('#bysearchTab').before("
  • " + title + "
  • "); diff --git a/module/product/lang/en.php b/module/product/lang/en.php index 317f7a2603..b80d3e5ee3 100644 --- a/module/product/lang/en.php +++ b/module/product/lang/en.php @@ -109,8 +109,9 @@ $lang->product->aclList['open'] = "Default (User with {$lang->productCommon} $lang->product->aclList['private'] = "Private {$lang->productCommon} ({$lang->projectCommon} team members only)"; $lang->product->aclList['custom'] = 'Custom (Team members and Whitelist members have access to it.)'; -$lang->product->storySummary = " %s Story(ies), %s hour(s) estimated, case coverage is %s on this page."; -$lang->product->noMatched = '"%s" cannot be found.' . $lang->productCommon; +$lang->product->storySummary = " %s Story(ies), %s hour(s) estimated, case coverage is %s on this page."; +$lang->product->checkedSummary = " %total% Checked, %estimate% hour(s) estimated, case coverage is %rate%."; +$lang->product->noMatched = '"%s" cannot be found.' . $lang->productCommon; $lang->product->mySelects['assignedtome'] = $lang->product->assignedToMe; $lang->product->mySelects['openedbyme'] = $lang->product->openedByMe; diff --git a/module/product/lang/zh-cn.php b/module/product/lang/zh-cn.php index 0871c3fb3b..e5fadf1a90 100644 --- a/module/product/lang/zh-cn.php +++ b/module/product/lang/zh-cn.php @@ -108,8 +108,9 @@ $lang->product->aclList['open'] = "默认设置(有{$lang->productCommon}视 $lang->product->aclList['private'] = "私有{$lang->productCommon}(只有{$lang->productCommon}相关负责人和{$lang->projectCommon}团队成员才能访问)"; $lang->product->aclList['custom'] = '自定义白名单(团队成员和白名单的成员可以访问)'; -$lang->product->storySummary = "本页共 %s 个需求,预计 %s 个工时,用例覆盖率%s。"; -$lang->product->noMatched = '找不到包含"%s"的' . $lang->productCommon; +$lang->product->storySummary = "本页共 %s 个需求,预计 %s 个工时,用例覆盖率%s。"; +$lang->product->checkedSummary = "选中 %total% 个需求,预计 %estimate% 个工时,用例覆盖率%rate%。"; +$lang->product->noMatched = '找不到包含"%s"的' . $lang->productCommon; $lang->product->featureBar['browse']['unclosed'] = $lang->product->unclosed; $lang->product->featureBar['browse']['unplan'] = $lang->product->unplan; diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index b920baa3e2..3c4b2a4b7e 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -141,7 +141,7 @@ - + $value) $this->story->printCell($value, $story, $users, $branches, $storyStages, $modulePairs, $storyTasks, $storyBugs, $storyCases, $useDatatable ? 'datatable' : 'table');?> @@ -323,6 +323,7 @@ +product->checkedSummary);?>