Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
ec-report-refactor
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lihuizhen
ec-report-refactor
Commits
252e0a04
Commit
252e0a04
authored
Jan 27, 2022
by
Jenny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: canvas 画布坐标显示
parent
84475c0a
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
188 additions
and
194 deletions
+188
-194
BarMixMap.vue
components/BarMixMap/BarMixMap.vue
+7
-10
ChinaMap.vue
components/ChinaMap/ChinaMap.vue
+7
-10
DashboardProgress.vue
components/DashboardProgress/DashboardProgress.vue
+6
-9
HorizontalBar.vue
components/HorizontalBar/HorizontalBar.vue
+7
-10
LineMixBar.vue
components/LineMixBar/LineMixBar.vue
+7
-10
NormalBar.vue
components/NormalBar/NormalBar.vue
+7
-10
NormalGauge.vue
components/NormalGauge/NormalGauge.vue
+7
-10
NormalLine.vue
components/NormalLine/NormalLine.vue
+7
-10
NormalPie.vue
components/NormalPie/NormalPie.vue
+7
-10
NormalProgress.vue
components/NormalProgress/NormalProgress.vue
+43
-40
NormalRadar.vue
components/NormalRadar/NormalRadar.vue
+7
-10
echartElementData.js
mixins/echartElementData.js
+0
-10
index.vue
pages/index/index.vue
+75
-43
common.scss
static/style/common.scss
+1
-2
No files found.
components/BarMixMap/BarMixMap.vue
View file @
252e0a04
<
template
>
<
template
>
<view>
<uni-ec-canvas
<uni-ec-canvas
class=
"uni-ec-canvas"
class=
"uni-ec-canvas"
id=
"bar-mix-map"
id=
"bar-mix-map"
ref=
"barMixMapCanvas"
ref=
"barMixMapCanvas"
canvas-id=
"bar-mix-map-chart"
canvas-id=
"bar-mix-map-chart"
:ec=
"ec"
:ec=
"ec"
:style=
"[elStyleObject]"
></uni-ec-canvas>
></uni-ec-canvas>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
...
...
components/ChinaMap/ChinaMap.vue
View file @
252e0a04
<
template
>
<
template
>
<view>
<uni-ec-canvas
<uni-ec-canvas
class=
"uni-ec-canvas"
class=
"uni-ec-canvas"
id=
"china-map"
id=
"china-map"
ref=
"chinaMapCanvas"
ref=
"chinaMapCanvas"
canvas-id=
"china-map-chart"
canvas-id=
"china-map-chart"
:ec=
"ec"
:ec=
"ec"
:style=
"[elStyleObject]"
></uni-ec-canvas>
></uni-ec-canvas>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
...
...
components/DashboardProgress/DashboardProgress.vue
View file @
252e0a04
<
template
>
<
template
>
<view>
<uni-ec-canvas
<uni-ec-canvas
class=
"uni-ec-canvas"
class=
"uni-ec-canvas"
id=
"dashboard-progress"
id=
"dashboard-progress"
ref=
"dashboardProgressCanvas"
ref=
"dashboardProgressCanvas"
canvas-id=
"dashboard-progress-chart"
canvas-id=
"dashboard-progress-chart"
:ec=
"ec"
:ec=
"ec"
:style=
"[elStyleObject]"
></uni-ec-canvas>
></uni-ec-canvas>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
...
...
components/HorizontalBar/HorizontalBar.vue
View file @
252e0a04
<
template
>
<
template
>
<view>
<uni-ec-canvas
<uni-ec-canvas
class=
"uni-ec-canvas"
class=
"uni-ec-canvas"
id=
"horizontal-bar"
id=
"horizontal-bar"
ref=
"horizontalBarCanvas"
ref=
"horizontalBarCanvas"
canvas-id=
"horizontal-bar-chart"
canvas-id=
"horizontal-bar-chart"
:ec=
"ec"
:ec=
"ec"
:style=
"[elStyleObject]"
></uni-ec-canvas>
></uni-ec-canvas>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
...
...
components/LineMixBar/LineMixBar.vue
View file @
252e0a04
<
template
>
<
template
>
<view>
<uni-ec-canvas
<uni-ec-canvas
class=
"uni-ec-canvas"
class=
"uni-ec-canvas"
id=
"line-mix-bar"
id=
"line-mix-bar"
ref=
"lineMixBarCanvas"
ref=
"lineMixBarCanvas"
canvas-id=
"line-mix-bar-chart"
canvas-id=
"line-mix-bar-chart"
:ec=
"ec"
:ec=
"ec"
:style=
"[elStyleObject]"
></uni-ec-canvas>
></uni-ec-canvas>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
...
...
components/NormalBar/NormalBar.vue
View file @
252e0a04
<
template
>
<
template
>
<view>
<uni-ec-canvas
<uni-ec-canvas
class=
"uni-ec-canvas"
class=
"uni-ec-canvas"
id=
"normal-bar"
id=
"normal-bar"
ref=
"normalbarCanvas"
ref=
"normalbarCanvas"
canvas-id=
"normal-bar-chart"
canvas-id=
"normal-bar-chart"
:ec=
"ec"
:ec=
"ec"
:style=
"[elStyleObject]"
></uni-ec-canvas>
></uni-ec-canvas>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
...
...
components/NormalGauge/NormalGauge.vue
View file @
252e0a04
<
template
>
<
template
>
<view>
<uni-ec-canvas
<uni-ec-canvas
class=
"uni-ec-canvas"
class=
"uni-ec-canvas"
id=
"normal-gauge"
id=
"normal-gauge"
ref=
"normalGaugeCanvas"
ref=
"normalGaugeCanvas"
canvas-id=
"normal-gauge-chart"
canvas-id=
"normal-gauge-chart"
:ec=
"ec"
:ec=
"ec"
:style=
"[elStyleObject]"
></uni-ec-canvas>
></uni-ec-canvas>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
...
...
components/NormalLine/NormalLine.vue
View file @
252e0a04
<
template
>
<
template
>
<view>
<uni-ec-canvas
<uni-ec-canvas
class=
"uni-ec-canvas"
class=
"uni-ec-canvas"
id=
"normal-line"
id=
"normal-line"
ref=
"normalLineCanvas"
ref=
"normalLineCanvas"
canvas-id=
"normal-line-chart"
canvas-id=
"normal-line-chart"
:ec=
"ec"
:ec=
"ec"
:style=
"[elStyleObject]"
></uni-ec-canvas>
></uni-ec-canvas>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
...
...
components/NormalPie/NormalPie.vue
View file @
252e0a04
<
template
>
<
template
>
<view>
<uni-ec-canvas
<uni-ec-canvas
class=
"uni-ec-canvas"
class=
"uni-ec-canvas"
id=
"normal-pie"
id=
"normal-pie"
ref=
"normalPieCanvas"
ref=
"normalPieCanvas"
canvas-id=
"normal-pie-chart"
canvas-id=
"normal-pie-chart"
:ec=
"ec"
:ec=
"ec"
:style=
"[elStyleObject]"
></uni-ec-canvas>
></uni-ec-canvas>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
...
...
components/NormalProgress/NormalProgress.vue
View file @
252e0a04
...
@@ -9,7 +9,8 @@
...
@@ -9,7 +9,8 @@
:inactive-color="elementInfo.option.progress.trailColor"
:inactive-color="elementInfo.option.progress.trailColor"
:round="elementInfo.option.progress.strokeLinecap == 'round' ? true : false"
:round="elementInfo.option.progress.strokeLinecap == 'round' ? true : false"
:percent="elementInfo.data.dataList.endVal"
:percent="elementInfo.data.dataList.endVal"
:show-percent="elementInfo.option.progress.showInfo">
:show-percent="elementInfo.option.progress.showInfo"
>
</u-line-progress>
</u-line-progress>
<u-circle-progress
<u-circle-progress
class=
"u-circle"
class=
"u-circle"
...
@@ -19,10 +20,11 @@
...
@@ -19,10 +20,11 @@
:active-color=
"elementInfo.option.progress.strokeColor"
:active-color=
"elementInfo.option.progress.strokeColor"
:inactive-color=
"elementInfo.option.progress.trailColor"
:inactive-color=
"elementInfo.option.progress.trailColor"
:percent=
"elementInfo.data.dataList.endVal"
:percent=
"elementInfo.data.dataList.endVal"
:bg-color=
"00000000"
>
:bg-color=
"00000000"
>
<view
class=
"u-progress-text"
>
{{
elementInfo
.
data
.
dataList
.
endVal
}}
%
</view>
<view
class=
"u-progress-text"
>
{{
elementInfo
.
data
.
dataList
.
endVal
}}
%
</view>
</u-circle-progress>
</u-circle-progress>
<DashboardProgress
v-if=
"elementInfo.option.progress.type === 'dashboard'"
:elementInfo=
"elementInfo"
></DashboardProgress>
<DashboardProgress
style=
"height: 100%;"
v-if=
"elementInfo.option.progress.type === 'dashboard'"
:elementInfo=
"elementInfo"
></DashboardProgress>
</view>
</view>
</
template
>
</
template
>
...
@@ -45,6 +47,7 @@ export default {
...
@@ -45,6 +47,7 @@ export default {
<
style
>
<
style
>
.container
{
.container
{
width
:
100%
;
width
:
100%
;
height
:
100%
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
justify-content
:
center
;
justify-content
:
center
;
...
...
components/NormalRadar/NormalRadar.vue
View file @
252e0a04
<
template
>
<
template
>
<view>
<uni-ec-canvas
<uni-ec-canvas
class=
"uni-ec-canvas"
class=
"uni-ec-canvas"
id=
"normalra-dar"
id=
"normalra-dar"
ref=
"normalRadarCanvas"
ref=
"normalRadarCanvas"
canvas-id=
"normalra-dar-chart"
canvas-id=
"normalra-dar-chart"
:ec=
"ec"
:ec=
"ec"
:style=
"[elStyleObject]"
></uni-ec-canvas>
></uni-ec-canvas>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
...
...
mixins/echartElementData.js
View file @
252e0a04
...
@@ -11,16 +11,6 @@ export default {
...
@@ -11,16 +11,6 @@ export default {
required
:
true
required
:
true
}
}
},
},
computed
:
{
elStyleObject
()
{
const
{
windowWidth
}
=
uni
.
getSystemInfoSync
()
const
{
width
,
height
}
=
this
.
elementInfo
return
{
'width'
:
`
${
width
>
windowWidth
?
'100%'
:
width
+
'px'
}
`
,
'height'
:
`
${
width
>
windowWidth
?
height
/
width
*
windowWidth
:
height
}
px`
}
}
},
methods
:
{
methods
:
{
/**
/**
* 静态数据
* 静态数据
...
...
pages/index/index.vue
View file @
252e0a04
...
@@ -3,8 +3,22 @@
...
@@ -3,8 +3,22 @@
class=
"canvas"
class=
"canvas"
:style=
"[styleObject]"
:style=
"[styleObject]"
>
>
<view
v-for=
"element in reportData"
:key=
"item.id"
>
<view
class=
"viewport-wrapper"
:style=
"
{
<template
v-if=
"!element.hide"
>
width: `${reportInfo.width * scale}px`,
height: `${reportInfo.height * scale}px`
}">
<template
v-for=
"(element, index) in reportData"
>
<view
class=
"view-element"
v-if=
"!element.hide"
:key=
"element.id"
:style=
"
{
width: `${element.width * scale}px`,
height: `${element.height * scale}px`,
transform: `translate(${element.left * scale}px, ${element.top * scale}px)`,
zIndex: index + 1
}"
>
<!-- 普通柱状图 -->
<!-- 普通柱状图 -->
<NormalBar
v-if=
"element.type == 'NormalBar'"
:elementInfo=
"element"
></NormalBar>
<NormalBar
v-if=
"element.type == 'NormalBar'"
:elementInfo=
"element"
></NormalBar>
<!-- 普通折线图 -->
<!-- 普通折线图 -->
...
@@ -41,6 +55,7 @@
...
@@ -41,6 +55,7 @@
<RemoteImage
v-if=
"element.type == 'RemoteImage'"
:elementInfo=
"element"
></RemoteImage>
<RemoteImage
v-if=
"element.type == 'RemoteImage'"
:elementInfo=
"element"
></RemoteImage>
<!-- 普通表格 -->
<!-- 普通表格 -->
<NormalTable
v-if=
"element.type == 'NormalTable'"
:elementInfo=
"element"
></NormalTable>
<NormalTable
v-if=
"element.type == 'NormalTable'"
:elementInfo=
"element"
></NormalTable>
</view>
</
template
>
</
template
>
</view>
</view>
</view>
</view>
...
@@ -52,7 +67,7 @@
...
@@ -52,7 +67,7 @@
return
{
return
{
reportInfo
:
{},
reportInfo
:
{},
reportData
:
[],
reportData
:
[],
time
r
:
null
time
name
:
null
}
}
},
},
computed
:
{
computed
:
{
...
@@ -64,6 +79,11 @@
...
@@ -64,6 +79,11 @@
'background-color'
:
backgroundColor
,
'background-color'
:
backgroundColor
,
...
params
...
params
}
}
},
scale
()
{
const
{
windowWidth
}
=
uni
.
getSystemInfoSync
()
const
{
width
,
height
}
=
this
.
reportInfo
return
windowWidth
/
width
}
}
},
},
onLoad
()
{
onLoad
()
{
...
@@ -89,7 +109,7 @@
...
@@ -89,7 +109,7 @@
onUnload
()
{
onUnload
()
{
// 移除监听事件
// 移除监听事件
uni
.
$off
(
'handleLinkParams'
)
uni
.
$off
(
'handleLinkParams'
)
clearInterval
(
this
.
time
r
)
clearInterval
(
this
.
time
name
)
},
},
methods
:
{
methods
:
{
//检查是否登录
//检查是否登录
...
@@ -127,14 +147,14 @@
...
@@ -127,14 +147,14 @@
* 获取页面报表配置
* 获取页面报表配置
*/
*/
async
getReportList
()
{
async
getReportList
()
{
clearInterval
(
this
.
time
r
)
clearInterval
(
this
.
time
name
)
let
res
=
await
this
.
$u
.
api
.
getReportList
({
id
:
'61cd2ba1c06bffbdae442c4f'
})
let
res
=
await
this
.
$u
.
api
.
getReportList
({
id
:
'61cd2ba1c06bffbdae442c4f'
})
const
{
Status
,
Result
:
{
info
,
list
}
}
=
res
.
data
const
{
Status
,
Result
:
{
info
,
list
}
}
=
res
.
data
if
(
Status
===
'true'
)
{
if
(
Status
===
'true'
)
{
if
(
info
.
dataUrl
)
{
if
(
info
.
dataUrl
)
{
this
.
getGlobalData
(
info
)
this
.
getGlobalData
(
info
)
if
(
info
.
dataPollingInterval
)
{
if
(
info
.
dataPollingInterval
)
{
this
.
time
r
=
setInterval
(()
=>
{
this
.
time
name
=
setInterval
(()
=>
{
this
.
getGlobalData
(
info
)
this
.
getGlobalData
(
info
)
},
parseInt
(
info
.
dataPollingInterval
)
*
1000
)
},
parseInt
(
info
.
dataPollingInterval
)
*
1000
)
}
}
...
@@ -186,11 +206,23 @@
...
@@ -186,11 +206,23 @@
.canvas
{
.canvas
{
position
:
relative
;
position
:
relative
;
height
:
100%
;
height
:
100%
;
padding
:
20rpx
;
user-select
:
none
;
user-select
:
none
;
overflow
:
auto
;
overflow
:
auto
;
background-repeat
:
no-repeat
;
background-repeat
:
no-repeat
;
background-size
:
cover
;
background-size
:
cover
;
background-position
:
center
;
background-position
:
center
;
}
}
.viewport-wrapper
{
position
:
relative
;
}
.view-element
{
position
:
absolute
;
top
:
0
;
right
:
0
;
bottom
:
0
;
left
:
0
;
will-change
:
transform
;
user-select
:
none
;
cursor
:
move
;
}
</
style
>
</
style
>
static/style/common.scss
View file @
252e0a04
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
.uni-ec-canvas
{
.uni-ec-canvas
{
width
:
100%
;
width
:
100%
;
height
:
750rpx
;
height
:
100%
;
display
:block
;
display
:block
;
margin
:
20rpx
auto
;
}
}
\ No newline at end of file
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