diff --git a/module/screen/config.php b/module/screen/config.php index 777448dd1d..f373b40626 100644 --- a/module/screen/config.php +++ b/module/screen/config.php @@ -4,26 +4,6 @@ $config->screen->builtinChart = array(10018, 10019, 10020, 10021, 10022, 10211, $config->screen->builtinPivot = array(1000, 1001, 1002); $config->screen->phpChart = array(20002, 20004, 20007, 20010, 20011, 20012, 20013); -$config->screen->editCanvasConfig = new stdclass(); -$config->screen->editCanvasConfig->width = 1300; -$config->screen->editCanvasConfig->height = 1080; -$config->screen->editCanvasConfig->filterShow = false; -$config->screen->editCanvasConfig->hueRotate = 0; -$config->screen->editCanvasConfig->saturate = 1; -$config->screen->editCanvasConfig->contrast = 1; -$config->screen->editCanvasConfig->brightness = 1; -$config->screen->editCanvasConfig->opacity = 1; -$config->screen->editCanvasConfig->rotateZ = 0; -$config->screen->editCanvasConfig->rotateX = 0; -$config->screen->editCanvasConfig->rotateY = 0; -$config->screen->editCanvasConfig->skewX = 0; -$config->screen->editCanvasConfig->skewY = 0; -$config->screen->editCanvasConfig->blendMode = 'normal'; -$config->screen->editCanvasConfig->background = '#001028'; -$config->screen->editCanvasConfig->selectColor = true; -$config->screen->editCanvasConfig->chartThemeColor = 'dark'; -$config->screen->editCanvasConfig->previewScaleType = 'scrollY'; - $config->screen->chartConfig = array(); $config->screen->chartConfig['cluBarX'] = '{"category" : "Bars", "categoryName" : "柱状图", "chartFrame" : "echarts", "chartKey" : "VBarCommon", "conKey" : "VCBarCommon", "image" : "bar_x.png", "key" : "BarCommon", "package" : "Charts", "title" : "簇状柱形图", "dataset" : {}}'; $config->screen->chartConfig['cluBarY'] = '{"category" : "Bars", "categoryName" : "柱状图", "chartFrame" : "echarts", "chartKey" : "VBarCrossrange", "conKey" : "VCBarCrossrange", "image" : "bar_y.png", "key" : "BarCrossrange", "package" : "Charts", "title" : "簇状条形图", "dataset" : {}}'; diff --git a/module/screen/model.php b/module/screen/model.php index f6d3c851dc..4a878f32ff 100644 --- a/module/screen/model.php +++ b/module/screen/model.php @@ -97,29 +97,27 @@ class screenModel extends model $this->filter->account = $account; $this->filter->charts = array(); - if(!$screen->builtin or in_array($screen->id, $this->config->screen->builtinScreen)) - { - $scheme = json_decode($screen->scheme); + if(!$screen->builtin or in_array($screen->id, $this->config->screen->builtinScreen)) return $this->genNewChartData($screen, $year, $month, $dept, $account); - foreach($scheme->componentList as $component) - { - if(!empty($component->isGroup)) - { - foreach($component->groupList as $key => $groupComponent) - { - if(isset($groupComponent->key) and $groupComponent->key === 'Select') $groupComponent = $this->buildSelect($groupComponent); - } - } - else - { - if(isset($component->key) and $component->key === 'Select') $component = $this->buildSelect($component); - } - } - - return $scheme; - } - - $editCanvasConfig = $this->config->screen->editCanvasConfig; + $config = new stdclass(); + $config->width = 1300; + $config->height = 1080; + $config->filterShow = false; + $config->hueRotate = 0; + $config->saturate = 1; + $config->contrast = 1; + $config->brightness = 1; + $config->opacity = 1; + $config->rotateZ = 0; + $config->rotateX = 0; + $config->rotateY = 0; + $config->skewX = 0; + $config->skewY = 0; + $config->blendMode = 'normal'; + $config->background = '#001028'; + $config->selectColor = true; + $config->chartThemeColor = 'dark'; + $config->previewScaleType = 'scrollY'; $componentList = json_decode($screen->scheme); if(empty($componentList)) $componentList = array(); @@ -130,17 +128,51 @@ class screenModel extends model if(!isset($component->attr)) continue; $height = $component->attr->y + $component->attr->h; - if($height > $editCanvasConfig->height) $editCanvasConfig->height = $height; + if($height > $config->height) $config->height = $height; } - $editCanvasConfig->height += 50; + $config->height += 50; $chartData = new stdclass(); - $chartData->editCanvasConfig = $editCanvasConfig; - $chartData->componentList = $this->buildComponentList($componentList); + $chartData->editCanvasConfig = $config; + $chartData->componentList = $this->buildComponentList($componentList); + $chartData->requestGlobalConfig = json_decode('{ "requestDataPond": [], "requestOriginUrl": "", "requestInterval": 30, "requestIntervalUnit": "second", "requestParams": { "Body": { "form-data": {}, "x-www-form-urlencoded": {}, "json": "", "xml": "" }, "Header": {}, "Params": {} } }'); return $chartData; } + /** + * Generate chartData of new screen. + * + * @param object $screen + * @param string $year + * @param string $dept + * @param string $account + * @access public + * @return object + */ + public function genNewChartData($screen, $year, $month, $dept, $account) + { + $this->loadModel('pivot'); + $scheme = json_decode($screen->scheme); + + foreach($scheme->componentList as $component) + { + if(!empty($component->isGroup)) + { + foreach($component->groupList as $key => $groupComponent) + { + if(isset($groupComponent->key) and $groupComponent->key === 'Select') $groupComponent = $this->buildSelect($groupComponent); + } + } + else + { + if(isset($component->key) and $component->key === 'Select') $component = $this->buildSelect($component); + } + } + + return $scheme; + } + /** * Generate a component of screen. *