Commit 63b2a3c6 by 罗建民

--story=1013170 --user=罗建民 list支持 section https://www.tapd.cn/56664057/s/1127315

parent c4d97268
Showing with 160 additions and 0 deletions
import com.qinqinxiaobao.report.uniplat.engine.DO.DataObject import com.qinqinxiaobao.report.uniplat.engine.DO.DataObject
import com.qinqinxiaobao.report.uniplat.engine.DO.EnvDataObject import com.qinqinxiaobao.report.uniplat.engine.DO.EnvDataObject
import com.qinqinxiaobao.report.uniplat.engine.DataList
import com.qinqinxiaobao.report.uniplat.list.serialize.filters.ModelFilters
import com.qinqinxiaobao.report.uniplat.models.field.SQLBuilder
import com.qinqinxiaobao.report.uniplat.models.field.SqlBuilderGenerator
import com.qinqinxiaobao.report.uniplat.models.field.sql.SqlClauseBuilder
import com.qinqinxiaobao.report.uniplat.models.field.sql.SqlStatement
import com.qinqinxiaobao.report.uniplat.workflow.dto.WorkflowContext import com.qinqinxiaobao.report.uniplat.workflow.dto.WorkflowContext
import com.qinqinxiaobao.report.uniplat.models.chart.ChartCustomFunctionContext
import java.util.stream.Collectors
class Example1 { class Example1 {
def model_name = "Example1" def model_name = "Example1"
...@@ -12,4 +21,93 @@ class Example1 { ...@@ -12,4 +21,93 @@ class Example1 {
def workflowTitle(DataObject object, EnvDataObject env, WorkflowContext context) { def workflowTitle(DataObject object, EnvDataObject env, WorkflowContext context) {
return "数据解析测试" return "数据解析测试"
} }
def chartFuncTest1(ChartCustomFunctionContext ctx) {
return [
title: [
text: "顶部1",
],
tooltip: [:],
legend: [
data: ["数量"]
],
xAxis: [
data: ["测试1", "测试2"]
],
yAxis: [:],
series: [
[
name: "数量",
type: "bar",
data: [55, 45]
]
]
]
}
def chartFuncTest2(ChartCustomFunctionContext ctx) {
return [
title : [
text: '顶部2'
],
series: [
name : '访问来源',
type : 'pie',
radius: '55%',
data : [
[value: 235, name: '视频广告'],
[value: 274, name: '联盟广告'],
[value: 310, name: '邮件营销'],
[value: 335, name: '直接访问'],
[value: 400, name: '搜索引擎']
]
]
]
}
def chartFuncTest3(ChartCustomFunctionContext ctx) {
def filters = ctx.filters
def sqlBuilderGenerator = new SqlBuilderGenerator(ctx.dataModel)
def sQLBuilder = sqlBuilderGenerator.addModelFilters(filters).generate()
def sqlStatement = sQLBuilder.getListSqlStatement(List.of())
def dataList = ctx.dataModel.queryDataListWithParams(sqlStatement.getSql(), sqlStatement.getParams())
return [
title : [
text: '与筛选项有关的section'
],
tooltip: [],
legend : [
data: ['id']
],
xAxis : [
data: Arrays.stream(dataList.getList()).map(dataObject -> String.format("id%s", dataObject.getKeyFieldValue())).collect(Collectors.toList())
],
yAxis: [:],
series : [
name: '数量',
type: 'line',
data: Arrays.stream(dataList.getList()).map(dataObject -> dataObject.getKeyFieldValue()).collect(Collectors.toList())
]
]
}
def chartFuncTest4(ChartCustomFunctionContext ctx) {
return [
title : [
text: '顶部2'
],
series: [
name : '访问来源',
type : 'pie',
radius: '55%',
data : [
[value: 235, name: '视频广告'],
[value: 274, name: '联盟广告'],
[value: 310, name: '邮件营销'],
[value: 335, name: '直接访问'],
[value: 400, name: '搜索引擎']
]
]
]
}
} }
\ No newline at end of file
...@@ -534,6 +534,58 @@ ...@@ -534,6 +534,58 @@
} }
} }
], ],
"sectionDefs": [
{
"name": "topSection",
"label": "顶部Section",
"chartGroups": [
{
"name": "顶部1",
"title": "顶部1",
"when": "1",
"optionFunc": "chartFuncTest1",
"span": 6
},
{
"name": "顶部2",
"title": "顶部2",
"when": "1",
"optionFunc": "chartFuncTest2",
"span": 6
}
],
"actions": []
},
{
"name": "section",
"label": "section",
"chartGroups": [
{
"name": "chart",
"title": "chart",
"when": "1",
"optionFunc": "chartFuncTest3",
"span": 12
}
],
"actions": [],
"relatedWithFilter": true
},
{
"name": "bottomSection",
"label": "底部section",
"chartGroups": [
{
"name": "底部",
"title": "底部",
"when": "1",
"optionFunc": "chartFuncTest4",
"span": 12
}
],
"actions": []
}
],
"mapping_defs": [ "mapping_defs": [
{ {
"name": "taskPriorityMapping", "name": "taskPriorityMapping",
...@@ -864,6 +916,15 @@ ...@@ -864,6 +916,15 @@
"showWorkflowList", "showWorkflowList",
"startProcessIntent" "startProcessIntent"
], ],
"topSectionRefs": [
"topSection"
],
"sectionRefs": [
"section"
],
"bottomSectionRefs": [
"bottomSection"
],
"detail_action_visible": true, "detail_action_visible": true,
"log_action_visible": false "log_action_visible": false
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment