* finish task #3584.

This commit is contained in:
wangyidong
2018-01-04 14:12:02 +08:00
parent b5f462607c
commit 8a9ad3f23a
15 changed files with 107 additions and 14 deletions
+4 -1
View File
@@ -179,7 +179,7 @@ class bug extends control
* @access public
* @return void
*/
public function report($productID, $browseType, $branchID, $moduleID)
public function report($productID, $browseType, $branchID, $moduleID, $chartType = '')
{
$this->loadModel('report');
$this->view->charts = array();
@@ -191,6 +191,7 @@ class bug extends control
$chartFunc = 'getDataOf' . $chart;
$chartData = $this->bug->$chartFunc();
$chartOption = $this->lang->bug->report->$chart;
if(!empty($chartType)) $chartOption->type = $chartType;
$this->bug->mergeChartOption($chart);
$this->view->charts[$chart] = $chartOption;
@@ -204,7 +205,9 @@ class bug extends control
$this->view->position[] = $this->lang->bug->reportChart;
$this->view->productID = $productID;
$this->view->browseType = $browseType;
$this->view->branchID = $branchID;
$this->view->moduleID = $moduleID;
$this->view->chartType = $chartType;
$this->view->checkedCharts = $this->post->charts ? join(',', $this->post->charts) : '';
$this->display();
}
+6
View File
@@ -12,3 +12,9 @@ $(function()
fixedTableHead('.table-wrapper');
$(window).resize(resizeChartTable);
});
function changeChartType(type)
{
$('form').attr('action', createLink('bug', 'report', 'productID=' + productID + '&browseType=' + browseType + '&branchID=' + branchID + '&moduleID=' + moduleID + '&chartType=' + type));
$('form').find('#submit').click();
}
+11 -2
View File
@@ -40,8 +40,13 @@
<div class='panel panel-sm'>
<div class='panel-heading'>
<strong>
<?php echo $lang->bug->report->common;?>
<span><?php echo $lang->report->notice->help?></span>
<?php echo $lang->bug->report->common;?>
<div class="btn-group">
<?php foreach($lang->report->typeList as $type => $typeName):?>
<?php echo html::a("javascript:changeChartType(\"$type\")", $typeName, '', "class='btn btn-sm " . ($type == $chartType ? 'active' : '') . "'")?>
<?php endforeach;?>
</div>
<span><?php echo $lang->report->notice->help?></span>
</strong>
</div>
<table class='table active-disabled'>
@@ -81,4 +86,8 @@
</div>
</div>
</div>
<?php js::set('productID', $productID);?>
<?php js::set('browseType', $browseType);?>
<?php js::set('branchID', $branchID);?>
<?php js::set('moduleID', $moduleID);?>
<?php include '../../common/view/footer.html.php';?>
+15
View File
@@ -82,6 +82,21 @@ if($config->debug)
chart = $canvas.barChart(data, options);
}
else if(chartType === 'line')
{
var labels = [], dataset = {label: $table.find('thead .chart-label').text(), color: nextAccentColor().toCssStr(), data: []};
var $rows = $table.find('tbody > tr').each(function(idx)
{
var $row = $(this);
labels.push($row.find('.chart-label').text());
dataset.data.push(parseInt($row.find('.chart-value').text()));
});
var data = {labels: labels, datasets: [dataset]};
if(labels.length) options.barValueSpacing = 5;
chart = $canvas.lineChart(data, options);
}
if(chart !== null) $table.data('zui.chart', chart);
});
+5
View File
@@ -75,6 +75,11 @@ $lang->report->unplanned = 'Unplanned';
$lang->report->workday = 'Hours/Day';
$lang->report->diffDays = 'Man-Day';
$lang->report->typeList[''] = 'Default';
$lang->report->typeList['pie'] = 'Pie';
$lang->report->typeList['bar'] = 'Bar';
$lang->report->typeList['line'] = 'Line';
$lang->report->conditions = 'Filter by:';
$lang->report->closedProduct = 'Closed ' . $lang->productCommon;
$lang->report->overduePlan = 'Overdue Plan';
+5
View File
@@ -75,6 +75,11 @@ $lang->report->unplanned = '未计划';
$lang->report->workday = '每天工时';
$lang->report->diffDays = '工作日天数';
$lang->report->typeList[''] = '默认';
$lang->report->typeList['pie'] = '饼图';
$lang->report->typeList['bar'] = '柱状图';
$lang->report->typeList['line'] = '折线图';
$lang->report->conditions = '筛选条件:';
$lang->report->closedProduct = '关闭' . $lang->productCommon;
$lang->report->overduePlan = '过期计划';
+4 -2
View File
@@ -1330,7 +1330,7 @@ class story extends control
* @access public
* @return void
*/
public function report($productID, $browseType, $branchID, $moduleID)
public function report($productID, $browseType, $branchID, $moduleID, $chartType = '')
{
$this->loadModel('report');
$this->view->charts = array();
@@ -1342,9 +1342,9 @@ class story extends control
$chartFunc = 'getDataOf' . $chart;
$chartData = $this->story->$chartFunc();
$chartOption = $this->lang->story->report->$chart;
if(!empty($chartType)) $chartOption->type = $chartType;
$this->story->mergeChartOption($chart);
$this->view->charts[$chart] = $chartOption;
$this->view->datas[$chart] = $this->report->computePercent($chartData);
}
@@ -1356,8 +1356,10 @@ class story extends control
$this->view->position[] = $this->products[$productID];
$this->view->position[] = $this->lang->story->reportChart;
$this->view->productID = $productID;
$this->view->branchID = $branchID;
$this->view->browseType = $browseType;
$this->view->moduleID = $moduleID;
$this->view->chartType = $chartType;
$this->view->checkedCharts = $this->post->charts ? join(',', $this->post->charts) : '';
$this->display();
}
+6
View File
@@ -12,3 +12,9 @@ $(function()
fixedTableHead('.table-wrapper');
$(window).resize(resizeChartTable);
});
function changeChartType(type)
{
$('form').attr('action', createLink('story', 'report', 'productID=' + productID + '&browseType=' + browseType + '&branchID=' + branchID + '&moduleID=' + moduleID + '&chartType=' + type));
$('form').find('#submit').click();
}
+11 -2
View File
@@ -40,8 +40,13 @@
<div class='panel panel-sm'>
<div class='panel-heading'>
<strong>
<?php echo $lang->story->report->common;?>
<span><?php echo $lang->report->notice->help;?></span>
<?php echo $lang->story->report->common;?>
<div class="btn-group">
<?php foreach($lang->report->typeList as $type => $typeName):?>
<?php echo html::a("javascript:changeChartType(\"$type\")", $typeName, '', "class='btn btn-sm " . ($type == $chartType ? 'active' : '') . "'")?>
<?php endforeach;?>
</div>
<span><?php echo $lang->report->notice->help;?></span>
</strong>
</div>
<table class='table active-disabled'>
@@ -80,4 +85,8 @@
</div>
</div>
</div>
<?php js::set('productID', $productID);?>
<?php js::set('browseType', $browseType);?>
<?php js::set('branchID', $branchID);?>
<?php js::set('moduleID', $moduleID);?>
<?php include '../../common/view/footer.html.php';?>
+3 -2
View File
@@ -1160,9 +1160,8 @@ class task extends control
* @access public
* @return void
*/
public function report($projectID, $browseType = 'all')
public function report($projectID, $browseType = 'all', $chartType = '')
{
$this->loadModel('report');
$this->view->charts = array();
@@ -1173,6 +1172,7 @@ class task extends control
$chartFunc = 'getDataOf' . $chart;
$chartData = $this->task->$chartFunc();
$chartOption = $this->lang->task->report->$chart;
if(!empty($chartType)) $chartOption->type = $chartType;
$this->task->mergeChartOption($chart);
$this->view->charts[$chart] = $chartOption;
@@ -1187,6 +1187,7 @@ class task extends control
$this->view->position[] = $this->lang->task->report->common;
$this->view->projectID = $projectID;
$this->view->browseType = $browseType;
$this->view->chartType = $chartType;
$this->view->checkedCharts = $this->post->charts ? join(',', $this->post->charts) : '';
$this->display();
+6
View File
@@ -12,3 +12,9 @@ $(function()
fixedTableHead('.table-wrapper');
$(window).resize(resizeChartTable);
});
function changeChartType(type)
{
$('form').attr('action', createLink('task', 'report', 'projectID=' + projectID + '&browseType=' + browseType + '&chartType=' + type));
$('form').find('#submit').click();
}
+9 -2
View File
@@ -40,8 +40,13 @@
<div class='panel panel-sm'>
<div class='panel-heading'>
<strong>
<?php echo $lang->task->report->common;?>
<span><?php echo $lang->report->notice->help?></span>
<?php echo $lang->task->report->common;?>
<div class="btn-group">
<?php foreach($lang->report->typeList as $type => $typeName):?>
<?php echo html::a("javascript:changeChartType(\"$type\")", $typeName, '', "class='btn btn-sm " . ($type == $chartType ? 'active' : '') . "'")?>
<?php endforeach;?>
</div>
<span><?php echo $lang->report->notice->help?></span>
</strong>
</div>
<table class='table active-disabled'>
@@ -82,4 +87,6 @@
</div>
</div>
</div>
<?php js::set('projectID', $projectID);?>
<?php js::set('browseType', $browseType);?>
<?php include '../../common/view/footer.html.php';?>
+4 -1
View File
@@ -317,7 +317,7 @@ class testtask extends control
* @access public
* @return void
*/
public function report($productID, $taskID, $browseType, $branchID, $moduleID)
public function report($productID, $taskID, $browseType, $branchID, $moduleID = 0, $chartType = '')
{
$this->loadModel('report');
$this->view->charts = array();
@@ -332,6 +332,7 @@ class testtask extends control
$chartFunc = 'getDataOf' . $chart;
$chartData = isset($bugInfo[$chart]) ? $bugInfo[$chart] : $this->testtask->$chartFunc($taskID);
$chartOption = $this->testtask->mergeChartOption($chart);
if(!empty($chartType)) $chartOption->type = $chartType;
$this->view->charts[$chart] = $chartOption;
$this->view->datas[$chart] = $this->report->computePercent($chartData);
@@ -346,6 +347,8 @@ class testtask extends control
$this->view->taskID = $taskID;
$this->view->browseType = $browseType;
$this->view->moduleID = $moduleID;
$this->view->branchID = $branchID;
$this->view->chartType = $chartType;
$this->view->checkedCharts = $this->post->charts ? join(',', $this->post->charts) : '';
$this->display();
+6
View File
@@ -12,3 +12,9 @@ $(function()
fixedTableHead('.table-wrapper');
$(window).resize(resizeChartTable);
});
function changeChartType(type)
{
$('form').attr('action', createLink('testtask', 'report', 'productID=' + productID + '&taskID=' + taskID + '&browseType=' + browseType + '&branchID=' + branchID + '&moduleID=' + moduleID + '&chartType=' + type));
$('form').find('#submit').click();
}
+12 -2
View File
@@ -40,8 +40,13 @@
<div class='panel panel-sm'>
<div class='panel-heading'>
<strong>
<?php echo $lang->testtask->report->common;?>
<span><?php echo $lang->report->notice->help?></span>
<?php echo $lang->testtask->report->common;?>
<div class="btn-group">
<?php foreach($lang->report->typeList as $type => $typeName):?>
<?php echo html::a("javascript:changeChartType(\"$type\")", $typeName, '', "class='btn btn-sm " . ($type == $chartType ? 'active' : '') . "'")?>
<?php endforeach;?>
</div>
<span><?php echo $lang->report->notice->help?></span>
</strong>
</div>
<table class='table active-disabled'>
@@ -81,4 +86,9 @@
</div>
</div>
</div>
<?php js::set('productID', $productID);?>
<?php js::set('browseType', $browseType);?>
<?php js::set('branchID', $branchID);?>
<?php js::set('moduleID', $moduleID);?>
<?php js::set('taskID', $taskID);?>
<?php include '../../common/view/footer.html.php';?>