From fcb68fef9f6bf8d9d8aabab8e6748518b746fd89 Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Sun, 4 Feb 2024 17:20:49 +0800 Subject: [PATCH] * Fix card option of metric not work with filter. --- module/screen/model.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/module/screen/model.php b/module/screen/model.php index 0a26b30a1c..d60dfe27a0 100644 --- a/module/screen/model.php +++ b/module/screen/model.php @@ -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();