Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
a04262f5
提交
a04262f5
authored
8月 12, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 地图增加下钻上卷
上级
189d46bc
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
98 行增加
和
21 行删除
+98
-21
chart.js
frontend/src/views/chart/chart/chart.js
+2
-1
ChartComponent.vue
frontend/src/views/chart/components/ChartComponent.vue
+23
-14
ChartEdit.vue
frontend/src/views/chart/view/ChartEdit.vue
+73
-6
没有找到文件。
frontend/src/views/chart/chart/chart.js
浏览文件 @
a04262f5
...
@@ -618,7 +618,8 @@ export const BASE_MAP = {
...
@@ -618,7 +618,8 @@ export const BASE_MAP = {
calculable
:
true
,
calculable
:
true
,
inRange
:
{
inRange
:
{
color
:
[
'lightskyblue'
,
'yellow'
,
'orangered'
]
color
:
[
'lightskyblue'
,
'yellow'
,
'orangered'
]
}
},
right
:
0
},
},
// legend: {},
// legend: {},
series
:
[
series
:
[
...
...
frontend/src/views/chart/components/ChartComponent.vue
浏览文件 @
a04262f5
...
@@ -55,7 +55,9 @@ export default {
...
@@ -55,7 +55,9 @@ export default {
left
:
'0px'
,
left
:
'0px'
,
top
:
'0px'
top
:
'0px'
},
},
pointParam
:
null
pointParam
:
null
,
downOrUp
:
false
}
}
},
},
...
@@ -143,19 +145,18 @@ export default {
...
@@ -143,19 +145,18 @@ export default {
const
customAttr
=
JSON
.
parse
(
chart
.
customAttr
)
const
customAttr
=
JSON
.
parse
(
chart
.
customAttr
)
if
(
!
customAttr
.
areaCode
)
return
if
(
!
customAttr
.
areaCode
)
return
if
(
this
.
currentGeoJson
)
{
//
if (this.currentGeoJson) {
this
.
initMapChart
(
this
.
currentGeoJson
,
chart
)
//
this.initMapChart(this.currentGeoJson, chart)
return
//
return
}
//
}
if
(
this
.
$store
.
getters
.
geoMap
[
customAttr
.
areaCode
])
{
//
if (this.$store.getters.geoMap[customAttr.areaCode]) {
this
.
currentGeoJson
=
this
.
$store
.
getters
.
geoMap
[
customAttr
.
areaCode
]
//
this.currentGeoJson = this.$store.getters.geoMap[customAttr.areaCode]
this
.
initMapChart
(
this
.
currentGeoJson
,
chart
)
//
this.initMapChart(this.currentGeoJson, chart)
return
//
return
}
//
}
geoJson
(
customAttr
.
areaCode
).
then
(
res
=>
{
geoJson
(
customAttr
.
areaCode
).
then
(
res
=>
{
// this.initMapChart(res.data, chart)
this
.
initMapChart
(
res
,
chart
)
this
.
initMapChart
(
res
,
chart
)
this
.
$store
.
dispatch
(
'map/setGeo'
,
{
this
.
$store
.
dispatch
(
'map/setGeo'
,
{
...
@@ -163,16 +164,24 @@ export default {
...
@@ -163,16 +164,24 @@ export default {
value
:
res
value
:
res
// value: res.data
// value: res.data
})
})
// this.currentGeoJson = res.data
this
.
currentGeoJson
=
res
this
.
currentGeoJson
=
res
})
})
return
return
}
}
this
.
myEcharts
(
chart_option
)
this
.
myEcharts
(
chart_option
)
},
},
registerDynamicMap
(
areaCode
)
{
geoJson
(
areaCode
).
then
(
res
=>
{
this
.
downOrUp
=
true
this
.
$echarts
.
registerMap
(
'MAP'
,
res
)
})
},
initMapChart
(
geoJson
,
chart
)
{
initMapChart
(
geoJson
,
chart
)
{
// this.$echarts.registerMap('HK', geoJson)
if
(
!
this
.
$echarts
.
getMap
(
'MAP'
)
||
!
this
.
downOrUp
)
{
this
.
$echarts
.
getMap
(
'MAP'
)
||
this
.
$echarts
.
registerMap
(
'MAP'
,
geoJson
)
this
.
$echarts
.
registerMap
(
'MAP'
,
geoJson
)
}
// this.$echarts.getMap('MAP') || this.$echarts.registerMap('MAP', geoJson)
const
base_json
=
JSON
.
parse
(
JSON
.
stringify
(
BASE_MAP
))
const
base_json
=
JSON
.
parse
(
JSON
.
stringify
(
BASE_MAP
))
const
chart_option
=
baseMapOption
(
base_json
,
chart
)
const
chart_option
=
baseMapOption
(
base_json
,
chart
)
this
.
myEcharts
(
chart_option
)
this
.
myEcharts
(
chart_option
)
...
...
frontend/src/views/chart/view/ChartEdit.vue
浏览文件 @
a04262f5
...
@@ -483,7 +483,7 @@
...
@@ -483,7 +483,7 @@
<el-col
style=
"height: 100%;min-width: 500px;border-top: 1px solid #E6E6E6;"
>
<el-col
style=
"height: 100%;min-width: 500px;border-top: 1px solid #E6E6E6;"
>
<el-row
style=
"width: 100%;height: 100%;"
class=
"padding-lr"
>
<el-row
style=
"width: 100%;height: 100%;"
class=
"padding-lr"
>
<div
ref=
"imageWrapper"
style=
"height: 100%"
>
<div
ref=
"imageWrapper"
style=
"height: 100%"
>
<chart-component
v-if=
"httpRequest.status && chart.type && !chart.type.includes('table') && !chart.type.includes('text')"
:chart-id=
"chart.id"
:chart=
"chart"
class=
"chart-class"
@
onChartClick=
"chartClick"
/>
<chart-component
v-if=
"httpRequest.status && chart.type && !chart.type.includes('table') && !chart.type.includes('text')"
ref=
"dynamicChart"
:chart-id=
"chart.id"
:chart=
"chart"
class=
"chart-class"
@
onChartClick=
"chartClick"
/>
<table-normal
v-if=
"httpRequest.status && chart.type && chart.type.includes('table')"
:chart=
"chart"
class=
"table-class"
/>
<table-normal
v-if=
"httpRequest.status && chart.type && chart.type.includes('table')"
:chart=
"chart"
class=
"table-class"
/>
<label-normal
v-if=
"httpRequest.status && chart.type && chart.type.includes('text')"
:chart=
"chart"
class=
"table-class"
/>
<label-normal
v-if=
"httpRequest.status && chart.type && chart.type.includes('text')"
:chart=
"chart"
class=
"table-class"
/>
<div
v-if=
"!httpRequest.status"
class=
"chart-error-class"
>
<div
v-if=
"!httpRequest.status"
class=
"chart-error-class"
>
...
@@ -1444,11 +1444,11 @@ export default {
...
@@ -1444,11 +1444,11 @@ export default {
},
},
initAreas
()
{
initAreas
()
{
let
mapping
//
let mapping
if
((
mapping
=
localStorage
.
getItem
(
'areaMapping'
))
!==
null
)
{
//
if ((mapping = localStorage.getItem('areaMapping')) !== null) {
this
.
places
=
JSON
.
parse
(
mapping
)
//
this.places = JSON.parse(mapping)
return
//
return
}
//
}
Object
.
keys
(
this
.
places
).
length
===
0
&&
areaMapping
().
then
(
res
=>
{
Object
.
keys
(
this
.
places
).
length
===
0
&&
areaMapping
().
then
(
res
=>
{
this
.
places
=
res
.
data
this
.
places
=
res
.
data
localStorage
.
setItem
(
'areaMapping'
,
JSON
.
stringify
(
res
.
data
))
localStorage
.
setItem
(
'areaMapping'
,
JSON
.
stringify
(
res
.
data
))
...
@@ -1513,18 +1513,85 @@ export default {
...
@@ -1513,18 +1513,85 @@ export default {
chartClick
(
param
)
{
chartClick
(
param
)
{
if
(
this
.
drillClickDimensionList
.
length
<
this
.
view
.
drillFields
.
length
-
1
)
{
if
(
this
.
drillClickDimensionList
.
length
<
this
.
view
.
drillFields
.
length
-
1
)
{
this
.
chart
.
type
===
'map'
&&
this
.
sendToChildren
(
param
)
this
.
drillClickDimensionList
.
push
({
dimensionList
:
param
.
data
.
dimensionList
})
this
.
drillClickDimensionList
.
push
({
dimensionList
:
param
.
data
.
dimensionList
})
this
.
getData
(
this
.
param
.
id
)
this
.
getData
(
this
.
param
.
id
)
}
}
},
},
resetDrill
()
{
resetDrill
()
{
const
length
=
this
.
drillClickDimensionList
.
length
this
.
drillClickDimensionList
=
[]
this
.
drillClickDimensionList
=
[]
this
.
backToParent
(
0
,
length
)
this
.
currentAcreaNode
=
null
},
},
drillJump
(
index
)
{
drillJump
(
index
)
{
const
length
=
this
.
drillClickDimensionList
.
length
this
.
drillClickDimensionList
=
this
.
drillClickDimensionList
.
slice
(
0
,
index
)
this
.
drillClickDimensionList
=
this
.
drillClickDimensionList
.
slice
(
0
,
index
)
if
(
this
.
chart
.
type
===
'map'
)
{
this
.
backToParent
(
index
,
length
)
}
this
.
getData
(
this
.
param
.
id
)
this
.
getData
(
this
.
param
.
id
)
},
// 回到父级地图
backToParent
(
index
,
length
)
{
if
(
length
<=
0
)
return
const
times
=
length
-
1
-
index
let
temp
=
times
let
tempNode
=
this
.
currentAcreaNode
while
(
temp
>=
0
)
{
tempNode
=
this
.
findEntityByCode
(
tempNode
.
pcode
,
this
.
places
)
temp
--
}
this
.
currentAcreaNode
=
tempNode
this
.
$refs
.
dynamicChart
&&
this
.
$refs
.
dynamicChart
.
registerDynamicMap
&&
this
.
$refs
.
dynamicChart
.
registerDynamicMap
(
this
.
currentAcreaNode
.
code
)
},
// 切换下一级地图
sendToChildren
(
param
)
{
const
length
=
param
.
data
.
dimensionList
.
length
const
name
=
param
.
data
.
dimensionList
[
length
-
1
].
value
let
aCode
=
null
if
(
this
.
currentAcreaNode
)
{
aCode
=
this
.
currentAcreaNode
.
code
}
// const aCode = this.currentAcreaNode ? this.currentAcreaNode.code : null
const
currentNode
=
this
.
findEntityByCode
(
aCode
||
this
.
view
.
customAttr
.
areaCode
,
this
.
places
)
if
(
currentNode
&&
currentNode
.
children
&&
currentNode
.
children
.
length
>
0
)
{
const
nextNode
=
currentNode
.
children
.
find
(
item
=>
item
.
name
===
name
)
// this.view.customAttr.areaCode = nextNode.code
this
.
currentAcreaNode
=
nextNode
this
.
$refs
.
dynamicChart
&&
this
.
$refs
.
dynamicChart
.
registerDynamicMap
&&
this
.
$refs
.
dynamicChart
.
registerDynamicMap
(
nextNode
.
code
)
}
},
// 根据地名获取areaCode
// findEntityByname(name, array) {
// if (array === null || array.length === 0) array = this.places
// for (let index = 0; index
<
array
.
length
;
index
++
)
{
// const node = array[index]
// if (node.name === name) return node
// if (node.children && node.children.length > 0) {
// const temp = this.findEntityByname(name, node.children)
// if (temp) return temp
// }
// }
// }
findEntityByCode
(
code
,
array
)
{
if
(
array
===
null
||
array
.
length
===
0
)
array
=
this
.
places
for
(
let
index
=
0
;
index
<
array
.
length
;
index
++
)
{
const
node
=
array
[
index
]
if
(
node
.
code
===
code
)
return
node
if
(
node
.
children
&&
node
.
children
.
length
>
0
)
{
const
temp
=
this
.
findEntityByCode
(
code
,
node
.
children
)
if
(
temp
)
return
temp
}
}
}
}
}
}
}
}
</
script
>
</
script
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论