Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
uniplat-example
/
intent-example
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
63b2a3c6
authored
Dec 12, 2022
by
罗建民
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
--story=1013170 --user=罗建民 list支持 section
https://www.tapd.cn/56664057/s/1127315
parent
c4d97268
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
160 additions
and
0 deletions
models/Example1.groovy
models/Example1.json
models/Example1.groovy
View file @
63b2a3c6
import
com.qinqinxiaobao.report.uniplat.engine.DO.DataObject
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.models.chart.ChartCustomFunctionContext
import
java.util.stream.Collectors
class
Example1
{
def
model_name
=
"Example1"
...
...
@@ -12,4 +21,93 @@ class Example1 {
def
workflowTitle
(
DataObject
object
,
EnvDataObject
env
,
WorkflowContext
context
)
{
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
models/Example1.json
View file @
63b2a3c6
...
...
@@ -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"
:
[
{
"name"
:
"taskPriorityMapping"
,
...
...
@@ -864,6 +916,15 @@
"showWorkflowList"
,
"startProcessIntent"
],
"topSectionRefs"
:
[
"topSection"
],
"sectionRefs"
:
[
"section"
],
"bottomSectionRefs"
:
[
"bottomSection"
],
"detail_action_visible"
:
true
,
"log_action_visible"
:
false
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment