* Display no avaliable data when return empty records,stroy#52005, task#110465.

This commit is contained in:
qixinzhi
2024-01-09 13:47:55 +08:00
parent 39eb7f55b4
commit fcfd1606ee
10 changed files with 24 additions and 16 deletions
+4 -3
View File
@@ -102,7 +102,8 @@ class metric extends control
$this->view->dtablePager = $pager;
$this->view->chartTypeList = $this->metric->getChartTypeList($resultHeader);
$this->view->echartOptions = $this->metric->getEchartsOptions($resultHeader, $allResultData);
$this->view->metricRecordType = $this->metric->getMetricRecordType($resultHeader);
$this->view->metricRecordType = $this->metric->getMetricRecordType($current->code, $current->scope);
$this->display();
}
@@ -301,7 +302,7 @@ class metric extends control
$this->view->pagerExtra = $this->metricZen->getPagerExtra($this->view->tableWidth);
$this->view->headerGroup = $this->metric->isHeaderGroup($groupHeader);
$this->view->dtablePager = $pager;
$this->view->metricRecordType = $this->metric->getMetricRecordType($resultHeader);
$this->view->metricRecordType = $this->metric->getMetricRecordType($metric->code, $metric->scope);
$this->view->metric = $metric;
$this->view->chartTypeList = $this->metric->getChartTypeList($resultHeader);
@@ -331,7 +332,7 @@ class metric extends control
$this->view->tableWidth = $this->metricZen->getViewTableWidth($groupHeader);
$this->view->pagerExtra = $this->metricZen->getPagerExtra($this->view->tableWidth);
$this->view->headerGroup = $this->metric->isHeaderGroup($groupHeader);
$this->view->metricRecordType = $this->metric->getMetricRecordType($resultHeader);
$this->view->metricRecordType = $this->metric->getMetricRecordType($metric->code, $metric->scope);
$this->view->viewType = $viewType;
$this->view->metric = $metric;
+2
View File
@@ -53,6 +53,8 @@ i.star {color: var(--color-warning-300);}
.table-and-chart .table-side {flex-shrink: 1; max-width: 50%; border-style: solid; border-width: 1px 0px 1px 1px; border-color: var(--color-gray-300);}
.table-and-chart .chart-side {flex-grow: 1; border: 1px solid var(--color-gray-300); padding: 20px;}
.table-and-chart .chart-center {display:flex; justify-content: center; align-items: center;}
.table-and-chart.no-data {justify-content: center; align-items: center;}
.table-and-chart.no-data span {color: var(--color-gray-400);}
.icon-18 {font-size: 18px;}
.primary-hover-500 {color: var(--color-gray-800)}
+1
View File
@@ -123,6 +123,7 @@ $lang->metric->noDesc = "No description available";
$lang->metric->noFormula = "No calculation rules available";
$lang->metric->noCalc = "The PHP algorithm for this metric has not been implemented yet";
$lang->metric->noSQL = "No SQL";
$lang->metric->noData = "No data available";
$lang->metric->legendBasicInfo = 'Basic Information';
$lang->metric->legendCreateInfo = 'Creation and Editing Information';
+1
View File
@@ -123,6 +123,7 @@ $lang->metric->noDesc = "No description available";
$lang->metric->noFormula = "No calculation rules available";
$lang->metric->noCalc = "The PHP algorithm for this metric has not been implemented yet";
$lang->metric->noSQL = "No SQL";
$lang->metric->noData = "No data available";
$lang->metric->legendBasicInfo = 'Basic Information';
$lang->metric->legendCreateInfo = 'Creation and Editing Information';
+1
View File
@@ -123,6 +123,7 @@ $lang->metric->noDesc = "No description available";
$lang->metric->noFormula = "No calculation rules available";
$lang->metric->noCalc = "The PHP algorithm for this metric has not been implemented yet";
$lang->metric->noSQL = "No SQL";
$lang->metric->noData = "No data available";
$lang->metric->legendBasicInfo = 'Basic Information';
$lang->metric->legendCreateInfo = 'Creation and Editing Information';
+1
View File
@@ -123,6 +123,7 @@ $lang->metric->noDesc = "暂无描述";
$lang->metric->noFormula = "暂无计算规则";
$lang->metric->noCalc = "暂未实现度量项PHP算法";
$lang->metric->noSQL = "暂无";
$lang->metric->noData = "暂时没有数据。";
$lang->metric->legendBasicInfo = '基本信息';
$lang->metric->legendCreateInfo = '创建编辑信息';
+5 -7
View File
@@ -1479,16 +1479,14 @@ class metricModel extends model
* @access public
* @return string|false
*/
public function getMetricRecordType(array|bool $tableData): string|false
public function getMetricRecordType($code, $scope)
{
if(!$tableData) return false;
$fields = array_column($tableData, 'name');
$type = array();
if(in_array('scope', $fields)) $type[] = 'scope';
if(in_array('date', $fields)) $type[] = 'date';
$dateType = $this->getDateTypeByCode($code);
$type[] = $scope == 'system' ? 'system' : 'scope';
if($dateType != 'nodate') $type[] = 'date';
if(empty($type)) $type[] = 'system';
return implode('-', $type);
}
@@ -13,7 +13,7 @@ jsVar('updateTimeTip', $lang->metric->updateTimeTip);
div
(
setClass("table-and-chart table-and-chart-{$viewType}"),
setClass("table-and-chart table-and-chart-{$viewType}" . ($groupData ? '' : ' no-data')),
$groupData ? div
(
setClass('table-side'),
@@ -64,5 +64,6 @@ div
set::tooltip($echartOptions['tooltip'])
)->size('100%', '100%')
)
) : null
) : null,
$groupData ? null : span($lang->metric->noData, setClass('text-md'))
);
+3 -2
View File
@@ -386,7 +386,7 @@ $metricBoxs = div
$fnGenerateQueryForm(),
div
(
setClass('table-and-chart table-and-chart-multiple'),
setClass('table-and-chart table-and-chart-multiple' . ($groupData ? '' : ' no-data')),
$groupData ? div
(
setClass('table-side'),
@@ -436,7 +436,8 @@ $metricBoxs = div
set::tooltip($echartOptions['tooltip'])
)->size('100%', '100%')
)
) : null
) : null,
$groupData ? null : span($lang->metric->noData, setClass('text-md'))
)
);
+3 -2
View File
@@ -344,7 +344,7 @@ div
$fnGenerateQueryForm(),
div
(
setClass('table-and-chart table-and-chart-single'),
setClass('table-and-chart table-and-chart-single' . ($groupData ? '' : ' no-data')),
$groupData ? div
(
setClass('table-side'),
@@ -393,7 +393,8 @@ div
set::tooltip($echartOptions['tooltip'])
)->size('100%', '100%')
)
) : null
) : null,
$groupData ? null : span($lang->metric->noData, setClass('text-md'))
)
)
);