Merge branch 'zentaobiz38_bi_wangyuting' into 'master'
* Finish task #90970. See merge request easycorp/zentaopms!7411
This commit is contained in:
+60
-21
File diff suppressed because one or more lines are too long
+65
-21
File diff suppressed because one or more lines are too long
+59
-1
@@ -29,6 +29,11 @@ class screenModel extends model
|
||||
{
|
||||
parent::__construct();
|
||||
$this->filter = new stdclass();
|
||||
$this->filter->screen = '';
|
||||
$this->filter->year = '';
|
||||
$this->filter->dept = '';
|
||||
$this->filter->account = '';
|
||||
$this->filter->charts = array();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,7 +319,7 @@ class screenModel extends model
|
||||
switch($key)
|
||||
{
|
||||
case 'year':
|
||||
$conditions[] = $field . ' = ' . $this->filter->$key;
|
||||
$conditions[] = $field . " = '" . $this->filter->$key . "'";
|
||||
break;
|
||||
case 'dept':
|
||||
if($this->filter->dept and !$this->filter->account)
|
||||
@@ -699,6 +704,59 @@ class screenModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build water polo chart.
|
||||
*
|
||||
* @param object $component
|
||||
* @param object $chart
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function buildWaterPolo($component, $chart)
|
||||
{
|
||||
if(!$chart->settings)
|
||||
{
|
||||
$component->request = json_decode('{"requestDataType":0,"requestHttpType":"get","requestUrl":"","requestIntervalUnit":"second","requestContentType":0,"requestParamsBodyType":"none","requestSQLContent":{"sql":"select * from where"},"requestParams":{"Body":{"form-data":{},"x-www-form-urlencoded":{},"json":"","xml":""},"Header":{},"Params":{}}}');
|
||||
$component->events = json_decode('{"baseEvent":{},"advancedEvents":{}}');
|
||||
$component->key = "PieCircle";
|
||||
$component->chartConfig = json_decode('{"key":"WaterPolo","chartKey":"VWaterPolo","conKey":"VCWaterPolo","title":"水球图","category":"Mores","categoryName":"更多","package":"Charts","chartFrame":"common","image":"water_WaterPolo.png"}');
|
||||
$component->option = json_decode('{"type":"nomal","series":[{"type":"liquidFill","radius":"90%","roseType":false}],"backgroundColor":"rgba(0,0,0,0)"}');
|
||||
|
||||
return $this->setComponentDefaults($component);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($chart->sql)
|
||||
{
|
||||
$settings = json_decode($chart->settings);
|
||||
if($settings and isset($settings->metric))
|
||||
{
|
||||
$sourceData = array();
|
||||
|
||||
$sql = $this->setFilterSQL($chart);
|
||||
$results = $this->dao->query($sql)->fetchAll();
|
||||
$group = $settings->group[0]->field;
|
||||
|
||||
$groupCount = array();
|
||||
foreach($results as $result)
|
||||
{
|
||||
if($settings->metric[0]->agg == 'count')
|
||||
{
|
||||
if(!isset($groupCount[$result->$group])) $groupCount[$result->$group] = 0;
|
||||
$groupCount[$result->$group]++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($groupCount as $groupValue => $groupCount) $sourceData[$groupValue] = $groupCount;
|
||||
}
|
||||
$doneData = round((array_sum($sourceData) != 0 and !empty($sourceData['done'])) ? $sourceData['done'] / array_sum($sourceData) : 0, 4);
|
||||
$component->option->dataset = $doneData;
|
||||
}
|
||||
|
||||
return $this->setComponentDefaults($component);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build radar chart.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user