* Fix card option of metric not work with filter.
This commit is contained in:
+16
-9
@@ -458,7 +458,7 @@ class screenModel extends model
|
||||
|
||||
$chartOption = $this->getMetricChartOption($metric, $resultHeader, $resultData, $component);
|
||||
$tableOption = $this->getMetricTableOption($metric, $resultHeader, $resultData, $filterParams);
|
||||
$card = $this->getMetricCardOption($metric, $resultData);
|
||||
$card = $this->getMetricCardOption($metric, $resultData, $component);
|
||||
|
||||
list($component, $typeChanged) = $this->initMetricComponent($metric, $component);
|
||||
|
||||
@@ -2034,18 +2034,25 @@ class screenModel extends model
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getMetricCardOption(object $metric, $resultData): object
|
||||
public function getMetricCardOption(object $metric, $resultData, $component = null): object
|
||||
{
|
||||
$this->loadModel('metric');
|
||||
|
||||
$option = new stdclass();
|
||||
$option->displayType = 'normal';
|
||||
$option->cardType = 'A';
|
||||
$option->dateType = $metric->dateType;
|
||||
$option->bgColor = '#26292EFF';
|
||||
$option->border = array('color' => '#515458FF', 'width' => 1, 'radius' => 2);
|
||||
$option->scope = $metric->scope;
|
||||
$option->objectPairs = array();
|
||||
if(empty($component))
|
||||
{
|
||||
$option->displayType = 'normal';
|
||||
$option->cardType = 'A';
|
||||
$option->dateType = $metric->dateType;
|
||||
$option->bgColor = '#26292EFF';
|
||||
$option->border = array('color' => '#515458FF', 'width' => 1, 'radius' => 2);
|
||||
$option->scope = $metric->scope;
|
||||
$option->objectPairs = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$option = $component->option->card;
|
||||
}
|
||||
$option->data = $resultData;
|
||||
$option->filterValue = (is_array($option->data) && !empty($option->data)) ? current($option->data) : array();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user