Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
757f7774
提交
757f7774
authored
5月 11, 2022
作者:
junjun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 自定义排序
上级
90df43b6
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
95 行增加
和
39 行删除
+95
-39
ChartViewController.java
...ava/io/dataease/controller/chart/ChartViewController.java
+14
-6
ChartViewService.java
...main/java/io/dataease/service/chart/ChartViewService.java
+0
-0
CustomSortEdit.vue
...end/src/views/chart/components/compare/CustomSortEdit.vue
+12
-29
DimensionItem.vue
...nd/src/views/chart/components/drag-item/DimensionItem.vue
+13
-2
ChartEdit.vue
frontend/src/views/chart/view/ChartEdit.vue
+56
-2
没有找到文件。
backend/src/main/java/io/dataease/controller/chart/ChartViewController.java
浏览文件 @
757f7774
...
@@ -75,8 +75,8 @@ public class ChartViewController {
...
@@ -75,8 +75,8 @@ public class ChartViewController {
@DePermission
(
type
=
DePermissionType
.
PANEL
,
level
=
ResourceAuthLevel
.
PANNEL_LEVEL_VIEW
,
paramIndex
=
1
)
@DePermission
(
type
=
DePermissionType
.
PANEL
,
level
=
ResourceAuthLevel
.
PANNEL_LEVEL_VIEW
,
paramIndex
=
1
)
@ApiOperation
(
"详细信息"
)
@ApiOperation
(
"详细信息"
)
@PostMapping
(
"/get/{id}/{panelId}"
)
@PostMapping
(
"/get/{id}/{panelId}"
)
public
ChartViewDTO
get
(
@PathVariable
String
id
,
@PathVariable
String
panelId
,
@RequestBody
ChartViewRequest
viewRequest
)
{
public
ChartViewDTO
get
(
@PathVariable
String
id
,
@PathVariable
String
panelId
,
@RequestBody
ChartViewRequest
viewRequest
)
{
ChartViewDTO
result
=
chartViewService
.
getOne
(
id
,
viewRequest
.
getQueryFrom
());
ChartViewDTO
result
=
chartViewService
.
getOne
(
id
,
viewRequest
.
getQueryFrom
());
return
result
;
return
result
;
}
}
...
@@ -92,7 +92,7 @@ public class ChartViewController {
...
@@ -92,7 +92,7 @@ public class ChartViewController {
@ApiOperation
(
"数据"
)
@ApiOperation
(
"数据"
)
@PostMapping
(
"/getData/{id}/{panelId}"
)
@PostMapping
(
"/getData/{id}/{panelId}"
)
public
ChartViewDTO
getData
(
@PathVariable
String
id
,
@PathVariable
String
panelId
,
public
ChartViewDTO
getData
(
@PathVariable
String
id
,
@PathVariable
String
panelId
,
@RequestBody
ChartExtRequest
requestList
)
throws
Exception
{
@RequestBody
ChartExtRequest
requestList
)
throws
Exception
{
return
chartViewService
.
getData
(
id
,
requestList
);
return
chartViewService
.
getData
(
id
,
requestList
);
}
}
...
@@ -113,8 +113,8 @@ public class ChartViewController {
...
@@ -113,8 +113,8 @@ public class ChartViewController {
@DePermission
(
type
=
DePermissionType
.
PANEL
,
level
=
ResourceAuthLevel
.
PANNEL_LEVEL_MANAGE
,
paramIndex
=
1
)
@DePermission
(
type
=
DePermissionType
.
PANEL
,
level
=
ResourceAuthLevel
.
PANNEL_LEVEL_MANAGE
,
paramIndex
=
1
)
@ApiOperation
(
"批量复制"
)
@ApiOperation
(
"批量复制"
)
@PostMapping
(
"chartBatchCopy/{panelId}"
)
@PostMapping
(
"chartBatchCopy/{panelId}"
)
public
Map
<
String
,
String
>
chartBatchCopy
(
@RequestBody
ChartCopyBatchRequest
request
,
@PathVariable
String
panelId
)
{
public
Map
<
String
,
String
>
chartBatchCopy
(
@RequestBody
ChartCopyBatchRequest
request
,
@PathVariable
String
panelId
)
{
return
chartViewService
.
chartBatchCopy
(
request
,
panelId
);
return
chartViewService
.
chartBatchCopy
(
request
,
panelId
);
}
}
@ApiIgnore
@ApiIgnore
...
@@ -161,8 +161,16 @@ public class ChartViewController {
...
@@ -161,8 +161,16 @@ public class ChartViewController {
@ApiOperation
(
"校验视图Title"
)
@ApiOperation
(
"校验视图Title"
)
@PostMapping
(
"/checkTitle"
)
@PostMapping
(
"/checkTitle"
)
public
String
checkTitle
(
@RequestBody
ChartViewCacheRequest
request
)
{
public
String
checkTitle
(
@RequestBody
ChartViewCacheRequest
request
)
{
return
chartViewService
.
checkTitle
(
request
);
return
chartViewService
.
checkTitle
(
request
);
}
}
@ApiIgnore
@ApiOperation
(
"获取字段值"
)
@PostMapping
(
"/getFieldData/{id}/{panelId}/{fieldId}"
)
public
List
<
String
>
getFieldData
(
@PathVariable
String
id
,
@PathVariable
String
panelId
,
@PathVariable
String
fieldId
,
@RequestBody
ChartExtRequest
requestList
)
throws
Exception
{
return
chartViewService
.
getFieldData
(
id
,
requestList
,
false
,
fieldId
);
}
}
}
backend/src/main/java/io/dataease/service/chart/ChartViewService.java
浏览文件 @
757f7774
差异被折叠。
点击展开。
frontend/src/views/chart/components/compare/CustomSortEdit.vue
浏览文件 @
757f7774
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
customSort
}
from
'@/views/chart/chart/util
'
import
{
post
}
from
'@/api/dataset/dataset
'
export
default
{
export
default
{
name
:
'CustomSortEdit'
,
name
:
'CustomSortEdit'
,
...
@@ -27,6 +27,10 @@ export default {
...
@@ -27,6 +27,10 @@ export default {
chart
:
{
chart
:
{
type
:
Object
,
type
:
Object
,
required
:
true
required
:
true
},
field
:
{
type
:
Object
,
required
:
true
}
}
},
},
data
()
{
data
()
{
...
@@ -34,6 +38,11 @@ export default {
...
@@ -34,6 +38,11 @@ export default {
sortList
:
[]
sortList
:
[]
}
}
},
},
computed
:
{
panelInfo
()
{
return
this
.
$store
.
state
.
panel
.
panelInfo
}
},
watch
:
{
watch
:
{
chart
()
{
chart
()
{
this
.
init
()
this
.
init
()
...
@@ -44,34 +53,8 @@ export default {
...
@@ -44,34 +53,8 @@ export default {
},
},
methods
:
{
methods
:
{
init
()
{
init
()
{
console
.
log
(
this
.
chart
)
post
(
'/chart/view/getFieldData/'
+
this
.
chart
.
id
+
'/'
+
this
.
panelInfo
.
id
+
'/'
+
this
.
field
.
id
,
{}).
then
(
response
=>
{
const
chart
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
chart
))
this
.
sortList
=
response
.
data
let
customSortData
const
res
=
[]
if
(
Object
.
prototype
.
toString
.
call
(
chart
.
customSort
)
===
'[object Array]'
)
{
customSortData
=
JSON
.
parse
(
JSON
.
stringify
(
chart
.
customSort
))
}
else
{
customSortData
=
JSON
.
parse
(
chart
.
customSort
)
}
if
(
!
customSortData
||
customSortData
.
length
===
0
)
{
if
(
chart
&&
chart
.
data
)
{
const
data
=
chart
.
data
.
datas
data
.
forEach
(
ele
=>
{
res
.
push
(
ele
.
field
)
})
}
}
else
{
if
(
chart
&&
chart
.
data
)
{
const
data
=
chart
.
data
.
datas
const
cus
=
customSort
(
customSortData
,
data
)
cus
.
forEach
(
ele
=>
{
res
.
push
(
ele
.
field
)
})
}
}
// 字段去重
this
.
sortList
=
res
.
filter
(
function
(
item
,
index
,
arr
)
{
return
res
.
indexOf
(
item
,
0
)
===
index
})
})
},
},
onMove
()
{
onMove
()
{
...
...
frontend/src/views/chart/components/drag-item/DimensionItem.vue
浏览文件 @
757f7774
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
<el-dropdown-item
:command=
"beforeSort('none')"
>
{{
$t
(
'chart.none'
)
}}
</el-dropdown-item>
<el-dropdown-item
:command=
"beforeSort('none')"
>
{{
$t
(
'chart.none'
)
}}
</el-dropdown-item>
<el-dropdown-item
:command=
"beforeSort('asc')"
>
{{
$t
(
'chart.asc'
)
}}
</el-dropdown-item>
<el-dropdown-item
:command=
"beforeSort('asc')"
>
{{
$t
(
'chart.asc'
)
}}
</el-dropdown-item>
<el-dropdown-item
:command=
"beforeSort('desc')"
>
{{
$t
(
'chart.desc'
)
}}
</el-dropdown-item>
<el-dropdown-item
:command=
"beforeSort('desc')"
>
{{
$t
(
'chart.desc'
)
}}
</el-dropdown-item>
<el-dropdown-item
v-show=
"false && (item.deType === 0 || item.deType === 5)"
:command=
"beforeSort('custom_sort')"
>
{{
$t
(
'chart.custom_sort'
)
}}
...
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown-menu>
</el-dropdown>
</el-dropdown>
</el-dropdown-item>
</el-dropdown-item>
...
@@ -179,8 +180,18 @@ export default {
...
@@ -179,8 +180,18 @@ export default {
},
},
sort
(
param
)
{
sort
(
param
)
{
// console.log(param)
// console.log(param)
this
.
item
.
sort
=
param
.
type
if
(
param
.
type
===
'custom_sort'
)
{
this
.
$emit
(
'onDimensionItemChange'
,
this
.
item
)
const
item
=
{
index
:
this
.
index
,
sort
:
param
.
type
}
this
.
$emit
(
'onCustomSort'
,
item
)
}
else
{
this
.
item
.
index
=
this
.
index
this
.
item
.
sort
=
param
.
type
this
.
item
.
customSort
=
[]
this
.
$emit
(
'onDimensionItemChange'
,
this
.
item
)
}
},
},
beforeSort
(
type
)
{
beforeSort
(
type
)
{
return
{
return
{
...
...
frontend/src/views/chart/view/ChartEdit.vue
浏览文件 @
757f7774
...
@@ -372,6 +372,7 @@
...
@@ -372,6 +372,7 @@
@
editItemFilter=
"showDimensionEditFilter"
@
editItemFilter=
"showDimensionEditFilter"
@
onNameEdit=
"showRename"
@
onNameEdit=
"showRename"
@
valueFormatter=
"valueFormatter"
@
valueFormatter=
"valueFormatter"
@
onCustomSort=
"onCustomSort"
/>
/>
</transition-group>
</transition-group>
</draggable>
</draggable>
...
@@ -934,6 +935,23 @@
...
@@ -934,6 +935,23 @@
<el-button
type=
"primary"
size=
"mini"
@
click=
"saveValueFormatter"
>
{{
$t
(
'chart.confirm'
)
}}
</el-button>
<el-button
type=
"primary"
size=
"mini"
@
click=
"saveValueFormatter"
>
{{
$t
(
'chart.confirm'
)
}}
</el-button>
</div>
</div>
</el-dialog>
</el-dialog>
<!--自定义排序-->
<el-dialog
v-if=
"showCustomSort"
v-dialogDrag
:title=
"$t('chart.custom_sort')"
:visible=
"showCustomSort"
:show-close=
"false"
width=
"500px"
class=
"dialog-css"
>
<custom-sort-edit
:chart=
"chart"
:field=
"customSortField"
@
onSortChange=
"customSortChange"
/>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
size=
"mini"
@
click=
"closeCustomSort"
>
{{
$t
(
'chart.cancel'
)
}}
</el-button>
<el-button
type=
"primary"
size=
"mini"
@
click=
"saveCustomSort"
>
{{
$t
(
'chart.confirm'
)
}}
</el-button>
</div>
</el-dialog>
</el-row>
</el-row>
</
template
>
</
template
>
...
@@ -996,9 +1014,11 @@ import LabelNormalText from '@/views/chart/components/normal/LabelNormalText'
...
@@ -996,9 +1014,11 @@ import LabelNormalText from '@/views/chart/components/normal/LabelNormalText'
import
{
pluginTypes
}
from
'@/api/chart/chart'
import
{
pluginTypes
}
from
'@/api/chart/chart'
import
ValueFormatterEdit
from
'@/views/chart/components/value-formatter/ValueFormatterEdit'
import
ValueFormatterEdit
from
'@/views/chart/components/value-formatter/ValueFormatterEdit'
import
ChartStyle
from
'@/views/chart/view/ChartStyle'
import
ChartStyle
from
'@/views/chart/view/ChartStyle'
import
CustomSortEdit
from
'@/views/chart/components/compare/CustomSortEdit'
export
default
{
export
default
{
name
:
'ChartEdit'
,
name
:
'ChartEdit'
,
components
:
{
components
:
{
CustomSortEdit
,
ChartStyle
,
ChartStyle
,
ValueFormatterEdit
,
ValueFormatterEdit
,
LabelNormalText
,
LabelNormalText
,
...
@@ -1131,7 +1151,10 @@ export default {
...
@@ -1131,7 +1151,10 @@ export default {
preChartId
:
''
,
preChartId
:
''
,
pluginRenderOptions
:
[],
pluginRenderOptions
:
[],
showValueFormatter
:
false
,
showValueFormatter
:
false
,
valueFormatterItem
:
{}
valueFormatterItem
:
{},
showCustomSort
:
false
,
customSortList
:
[],
customSortField
:
{}
}
}
},
},
...
@@ -1540,7 +1563,6 @@ export default {
...
@@ -1540,7 +1563,6 @@ export default {
const
view
=
this
.
buildParam
(
true
,
'chart'
,
false
,
switchType
)
const
view
=
this
.
buildParam
(
true
,
'chart'
,
false
,
switchType
)
if
(
!
view
)
return
if
(
!
view
)
return
viewEditSave
(
this
.
panelInfo
.
id
,
view
).
then
(()
=>
{
viewEditSave
(
this
.
panelInfo
.
id
,
view
).
then
(()
=>
{
this
.
getData
(
this
.
param
.
id
)
bus
.
$emit
(
'view-in-cache'
,
{
type
:
'propChange'
,
viewId
:
this
.
param
.
id
})
bus
.
$emit
(
'view-in-cache'
,
{
type
:
'propChange'
,
viewId
:
this
.
param
.
id
})
})
})
},
},
...
@@ -1697,6 +1719,11 @@ export default {
...
@@ -1697,6 +1719,11 @@ export default {
return
true
return
true
},
},
onCustomSort
(
item
)
{
this
.
customSortField
=
this
.
view
.
xaxis
[
item
.
index
]
this
.
customSort
()
},
dimensionItemChange
(
item
)
{
dimensionItemChange
(
item
)
{
this
.
calcData
(
true
)
this
.
calcData
(
true
)
},
},
...
@@ -2385,6 +2412,33 @@ export default {
...
@@ -2385,6 +2412,33 @@ export default {
}
}
this
.
calcData
(
true
)
this
.
calcData
(
true
)
this
.
closeValueFormatter
()
this
.
closeValueFormatter
()
},
customSort
()
{
this
.
showCustomSort
=
true
},
customSortChange
(
val
)
{
this
.
customSortList
=
val
},
closeCustomSort
()
{
this
.
showCustomSort
=
false
this
.
customSortField
=
{}
this
.
customSortList
=
[]
},
saveCustomSort
()
{
// 先将所有自定义排序的维度设置为none,再对当前维度赋值
this
.
view
.
xaxis
.
forEach
(
ele
=>
{
if
(
ele
.
sort
===
'custom_sort'
)
{
ele
.
sort
=
'none'
ele
.
customSort
=
[]
}
if
(
ele
.
id
===
this
.
customSortField
.
id
)
{
ele
.
sort
=
'custom_sort'
ele
.
customSort
=
this
.
customSortList
}
})
this
.
calcData
(
true
)
this
.
closeCustomSort
()
}
}
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论