Merge branch 'feature/task-report' into feature/task-report-merge

This commit is contained in:
qixinzhi
2025-07-07 08:12:21 +00:00
4 changed files with 85 additions and 20 deletions
+1 -1
View File
@@ -194,7 +194,7 @@ class screen extends control
$this->screen->filter->month = $month;
$this->screen->filter->dept = $dept;
$this->screen->filter->account = $account;
$this->screen->setSelectFilter($sourceID, $selectFilter);
$this->filter->charts = $this->screenZen->setSelectFilter($sourceID, $selectFilter);
$type = $this->screen->getChartType($type);
-19
View File
@@ -1894,25 +1894,6 @@ class screenModel extends model
}
}
/**
* Set select filter.
*
* @param string $sourceID
* @param array $filters
* @access public
* @return void
*/
public function setSelectFilter($sourceID, $filters)
{
if(empty($filters)) return;
foreach($filters as $filter)
{
if(!isset($this->filter->charts[$sourceID])) $this->filter->charts[$sourceID] = array();
$this->filter->charts[$sourceID][$filter['type']] = $filter['field'];
}
}
/**
* Set SQL filter
*
@@ -0,0 +1,61 @@
#!/usr/bin/env php
<?php
declare(strict_types = 1);
/**
title=测试 screenModel->getAxisRotateOption();
timeout=0
cid=1
- 判断折线图x轴旋转角度 @30
- 判断折线图y轴旋转角度 @30
- 判断折线图仅设置x轴旋转时x轴旋转角度 @30
- 判断折线图仅设置x轴旋转时y轴旋转角度 @0
- 判断雷达图是否设置x轴旋转角度 @0
- 判断雷达图是否设置y轴旋转角度 @0
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/screen.unittest.class.php';
$screen = new screenTest();
global $tester;
$chart1 = new stdClass();
$chart1->type = 'line';
$chart1->settings = json_encode(array(array('rotateX' => 'use', 'rotateY' => 'use')));
$component = new stdClass();
$component->chartConfig = new stdClass();
$component = $screen->getAxisRotateOption($chart1, $component);
r($component->chartConfig->xAxis->axisLabel->rotate) && p('') && e('30'); // 判断折线图x轴旋转角度
r($component->chartConfig->yAxis->axisLabel->rotate) && p('') && e('30'); // 判断折线图y轴旋转角度
$chart2 = new stdClass();
$chart2->type = 'line';
$chart2->settings = json_encode(array(array('rotateX' => 'use')));
$component = new stdClass();
$component->chartConfig = new stdClass();
$component = $screen->getAxisRotateOption($chart2, $component);
r($component->chartConfig->xAxis->axisLabel->rotate) && p('') && e('30'); // 判断折线图仅设置x轴旋转时x轴旋转角度
r($component->chartConfig->yAxis->axisLabel->rotate) && p('') && e('0'); // 判断折线图仅设置x轴旋转时y轴旋转角度
$chart3 = new stdClass();
$chart3->type = 'radar';
$chart3->settings = json_encode(array(array('rotateX' => 'use')));
$component = new stdClass();
$component->chartConfig = new stdClass();
$component = $screen->getAxisRotateOption($chart3, $component);
r(isset($component->chartConfig->xAxis->axisLabel->rotate)) && p('') && e('0'); // 判断雷达图是否设置x轴旋转角度
r(isset($component->chartConfig->yAxis->axisLabel->rotate)) && p('') && e('0'); // 判断雷达图是否设置y轴旋转角度
+23
View File
@@ -45,4 +45,27 @@ class screenZen extends screen
return $screens;
}
/**
* Set select filter.
*
* @param string $sourceID
* @param array $filters
* @access protected
* @return array
*/
protected function setSelectFilter($sourceID, $filters)
{
if(empty($filters)) return;
$chartFilters = array();
foreach($filters as $filter)
{
if(!isset($chartFilters[$sourceID])) $chartFilters[$sourceID] = array();
$chartFilters[$sourceID][$filter['type']] = $filter['field'];
}
return $chartFilters;
}
}