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
3641660f
Commit
3641660f
authored
Jul 12, 2023
by
leon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: fix datazoom default bug
parent
832d71d0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
31 deletions
+69
-31
HorizontalBar.vue
components/HorizontalBar/HorizontalBar.vue
+10
-5
LineMixBar.vue
components/LineMixBar/LineMixBar.vue
+8
-4
NormalBar.vue
components/NormalBar/NormalBar.vue
+8
-4
NormalLine.vue
components/NormalLine/NormalLine.vue
+8
-4
NormalTabs.vue
components/NormalTabs/NormalTabs.vue
+1
-1
echartElementData.js
mixins/echartElementData.js
+10
-6
fullscreen.vue
pages/fullscreen/fullscreen.vue
+24
-7
No files found.
components/HorizontalBar/HorizontalBar.vue
View file @
3641660f
...
...
@@ -128,10 +128,6 @@ export default {
this
.
$nextTick
().
then
(()
=>
{
const
{
categories
,
series
,
preview
,
images
}
=
this
.
elementData
.
dataList
var
count
=
categories
.
length
if
(
count
<
this
.
elementInfo
.
dataZoom
.
count
)
{
this
.
elementInfo
.
dataZoom
.
start
=
0
this
.
elementInfo
.
dataZoom
.
end
=
100
}
if
(
this
.
labelShow
)
{
// 处理初始状态时,数值显示的数量是否超过了配置的最大值
if
(
this
.
elementInfo
.
dataZoom
&&
this
.
elementInfo
.
dataZoom
.
show
)
{
...
...
@@ -164,7 +160,16 @@ export default {
show
:
false
}
]
)
)
if
(
categories
.
length
<
this
.
elementInfo
.
dataZoom
.
count
)
{
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.start'
,
0
)
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.end'
,
100
)
}
else
{
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.start'
,
this
.
elementInfo
.
dataZoom
.
start
)
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.end'
,
this
.
elementInfo
.
dataZoom
.
end
)
}
if
(
chart
&&
chart
.
getOption
())
{
const
option
=
chart
.
getOption
()
option
.
series
=
dealSeries
...
...
components/LineMixBar/LineMixBar.vue
View file @
3641660f
...
...
@@ -106,10 +106,6 @@
this
.
$nextTick
().
then
(()
=>
{
const
{
categories
,
series
}
=
this
.
elementData
.
dataList
var
count
=
categories
.
length
if
(
count
<
this
.
elementInfo
.
dataZoom
.
count
)
{
this
.
elementInfo
.
dataZoom
.
start
=
0
this
.
elementInfo
.
dataZoom
.
end
=
100
}
if
(
this
.
labelShow
)
{
// 处理初始状态时,数值显示的数量是否超过了配置的最大值
if
(
this
.
elementInfo
.
dataZoom
&&
this
.
elementInfo
.
dataZoom
.
show
)
{
...
...
@@ -124,6 +120,14 @@
this
.
$set
(
this
.
ec
.
option
,
'xAxis.data'
,
categories
)
this
.
$set
(
this
.
ec
.
option
,
'series'
,
dealSeries
)
this
.
$set
(
this
.
ec
.
option
,
'dataZoom'
,
this
.
elementInfo
.
dataZoom
&&
this
.
elementInfo
.
dataZoom
.
show
?
[{...
this
.
elementInfo
.
dataZoom
,...
DATAZOOM_DEFAULT
}]
:
[{
show
:
false
}])
if
(
categories
.
length
<
this
.
elementInfo
.
dataZoom
.
count
)
{
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.start'
,
0
)
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.end'
,
100
)
}
else
{
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.start'
,
this
.
elementInfo
.
dataZoom
.
start
)
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.end'
,
this
.
elementInfo
.
dataZoom
.
end
)
}
if
(
chart
)
{
const
option
=
chart
.
getOption
()
option
.
series
=
dealSeries
...
...
components/NormalBar/NormalBar.vue
View file @
3641660f
...
...
@@ -98,10 +98,6 @@
this
.
$nextTick
().
then
(()
=>
{
const
{
categories
,
series
}
=
this
.
elementData
.
dataList
var
count
=
categories
.
length
if
(
count
<
this
.
elementInfo
.
dataZoom
.
count
)
{
this
.
elementInfo
.
dataZoom
.
start
=
0
this
.
elementInfo
.
dataZoom
.
end
=
100
}
if
(
this
.
labelShow
)
{
// 处理初始状态时,数值显示的数量是否超过了配置的最大值
if
(
this
.
elementInfo
.
dataZoom
&&
this
.
elementInfo
.
dataZoom
.
show
)
{
...
...
@@ -116,6 +112,14 @@
this
.
$set
(
this
.
ec
.
option
,
'xAxis.data'
,
categories
)
this
.
$set
(
this
.
ec
.
option
,
'series'
,
dealSeries
)
this
.
$set
(
this
.
ec
.
option
,
'dataZoom'
,
this
.
elementInfo
.
dataZoom
&&
this
.
elementInfo
.
dataZoom
.
show
?
[{...
this
.
elementInfo
.
dataZoom
,...
DATAZOOM_DEFAULT
}]
:
[{
show
:
false
}])
if
(
categories
.
length
<
this
.
elementInfo
.
dataZoom
.
count
)
{
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.start'
,
0
)
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.end'
,
100
)
}
else
{
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.start'
,
this
.
elementInfo
.
dataZoom
.
start
)
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.end'
,
this
.
elementInfo
.
dataZoom
.
end
)
}
if
(
chart
)
{
const
option
=
chart
.
getOption
()
option
.
series
=
dealSeries
...
...
components/NormalLine/NormalLine.vue
View file @
3641660f
...
...
@@ -97,10 +97,6 @@
this
.
$nextTick
().
then
(()
=>
{
const
{
categories
,
series
}
=
this
.
elementData
.
dataList
var
count
=
categories
.
length
if
(
count
<
this
.
elementInfo
.
dataZoom
.
count
)
{
this
.
elementInfo
.
dataZoom
.
start
=
0
this
.
elementInfo
.
dataZoom
.
end
=
100
}
if
(
this
.
labelShow
)
{
// 处理初始状态时,数值显示的数量是否超过了配置的最大值
if
(
this
.
elementInfo
.
dataZoom
&&
this
.
elementInfo
.
dataZoom
.
show
)
{
...
...
@@ -115,6 +111,14 @@
this
.
$set
(
this
.
ec
.
option
,
'xAxis.data'
,
categories
)
this
.
$set
(
this
.
ec
.
option
,
'series'
,
dealSeries
)
this
.
$set
(
this
.
ec
.
option
,
'dataZoom'
,
this
.
elementInfo
.
dataZoom
&&
this
.
elementInfo
.
dataZoom
.
show
?
[{...
this
.
elementInfo
.
dataZoom
,...
DATAZOOM_DEFAULT
}]
:
[{
show
:
false
}])
if
(
categories
.
length
<
this
.
elementInfo
.
dataZoom
.
count
)
{
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.start'
,
0
)
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.end'
,
100
)
}
else
{
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.start'
,
this
.
elementInfo
.
dataZoom
.
start
)
this
.
$set
(
this
.
ec
.
option
,
'dataZoom.end'
,
this
.
elementInfo
.
dataZoom
.
end
)
}
if
(
chart
)
{
// 重新setOption,使得设置的formatter生效
chart
.
setOption
({
...
...
components/NormalTabs/NormalTabs.vue
View file @
3641660f
...
...
@@ -35,7 +35,7 @@
</
template
>
<u-dropdown
v-if=
"elementInfo.option.tabs.type === 'dropdown'"
:title-size=
"getFontSize()"
ref=
"uDropdown"
:active-color=
"elementInfo.option.tabs.color"
:inactive-color=
"elementInfo.option.tabs.color"
>
:active-color=
"elementInfo.option.tabs.color"
:inactive-color=
"elementInfo.option.tabs.color"
:menu-icon-size=
"getFontSize()"
:height=
"elementInfo.height"
>
<u-dropdown-item
v-model=
"tabsValue"
:title=
"getSelectLabel(tabsValue)"
>
<view
class=
"slot-content"
:style=
"{'background-color': elementInfo.option.tabs.itemBackgroundColor}"
v-for=
"(item, index) in elementData.dataList.series"
:key=
"index"
>
<view
class=
"drop-item"
@
click=
"handleDropdownValue(item)"
...
...
mixins/echartElementData.js
View file @
3641660f
...
...
@@ -32,7 +32,7 @@ export default {
*/
async
handleDynamicData
(
value
)
{
const
that
=
this
let
{
dataUrl
,
dataMethod
,
dataFormatter
,
dataProcessing
}
=
{
...
value
}
let
{
dataUrl
,
dataMethod
,
dataFormatter
,
dataProcessing
,
dataConfig
}
=
{
...
value
}
if
(
value
.
queryFormatter
)
dataFormatter
=
{...
dataFormatter
,
...
value
.
queryFormatter
}
dataUrl
=
dataUrl
.
replace
(
/^
(\/(
dashboardCharts|dashboardAPI
))?
/
,
''
)
dataFormatter
=
that
.
$u
.
common
.
filterRequestParams
({...
dataFormatter
})
...
...
@@ -41,6 +41,8 @@ export default {
})
if
(
dataProcessing
)
{
that
.
elementData
.
dataList
=
that
.
$u
.
common
.
converFunction
(
dataProcessing
,
res
.
data
,
value
.
queryFormatter
)
}
else
if
(
dataConfig
&&
dataConfig
.
value
&&
dataConfig
.
value
.
length
)
{
that
.
elementData
.
dataList
=
that
.
$u
.
charts
.
parseChartData
(
res
.
data
,
that
.
elementInfo
)
}
else
{
that
.
elementData
.
dataList
=
JSON
.
parse
(
JSON
.
stringify
(
res
.
data
.
Result
))
}
...
...
@@ -50,9 +52,11 @@ export default {
*/
handlePublicData
(
value
)
{
if
(
!
this
.
vuex_globalData
)
return
const
{
dataProcessing
}
=
{
...
value
}
const
{
dataProcessing
,
dataConfig
}
=
{
...
value
}
if
(
dataProcessing
)
{
this
.
elementData
.
dataList
=
this
.
$u
.
common
.
converFunction
(
dataProcessing
,
this
.
vuex_globalData
,
value
.
queryFormatter
)
}
else
if
(
dataConfig
&&
dataConfig
.
value
&&
dataConfig
.
value
.
length
)
{
this
.
elementData
.
dataList
=
this
.
$u
.
charts
.
parseChartData
(
this
.
vuex_globalData
,
this
.
elementInfo
)
}
else
{
this
.
elementData
.
dataList
=
this
.
vuex_globalData
}
...
...
@@ -91,7 +95,7 @@ export default {
message
.
warning
(
Msg
)
}
},
clearTimer
()
{
clearInterval
(
this
.
timer
)
this
.
timer
=
null
...
...
@@ -130,7 +134,7 @@ export default {
that
.
handleStaticData
(
newVal
)
}
else
if
(
newVal
.
dataType
===
'dynamic'
)
{
that
.
handleDynamicData
(
newVal
)
if
(
newVal
.
dataPolling
)
{
if
(
newVal
.
dataPolling
&&
newVal
.
dataPollingInterval
>
0
)
{
that
.
timer
=
setInterval
(()
=>
{
that
.
handleDynamicData
(
newVal
)
},
newVal
.
dataPollingInterval
*
1000
)
...
...
@@ -141,7 +145,7 @@ export default {
that
.
handlePublicData
(
newVal
)
}
else
if
(
newVal
.
dataType
===
'dataSet'
)
{
that
.
handleDataSet
(
newVal
)
if
(
newVal
.
dataPolling
)
{
if
(
newVal
.
dataPolling
&&
newVal
.
dataPollingInterval
>
0
)
{
that
.
timer
=
setInterval
(()
=>
{
that
.
handleDataSet
(
newVal
)
},
newVal
.
dataPollingInterval
*
1000
)
...
...
@@ -150,7 +154,7 @@ export default {
}
}
else
if
(
newVal
.
dataType
===
'viewConfig'
)
{
that
.
handleViewConfig
(
newVal
)
if
(
newVal
.
dataPolling
)
{
if
(
newVal
.
dataPolling
&&
newVal
.
dataPollingInterval
>
0
)
{
that
.
timer
=
setInterval
(()
=>
{
that
.
handleViewConfig
(
newVal
)
},
newVal
.
dataPollingInterval
*
1000
)
...
...
pages/fullscreen/fullscreen.vue
View file @
3641660f
<
template
>
<view
class=
"wrapper"
:class=
"
{'tabs-layout': showTabs}" :style="{width: `${theStyle.width - theStyle.left}px`, left:`${theStyle.left}px`}">
<!-- 普通选项卡 -->
<NormalTabs
v-if=
"showTabs"
:elementInfo=
"tabsElement"
:style=
"
{width: `${theStyle.width - theStyle.left}px`}"
>
</NormalTabs>
<view
:style=
"
{height: `${theStyle.height}px`, width: `${theStyle.width - theStyle.left}px`}">
<!-- 普通选项卡 -->
<view
v-if=
"showTabs"
style=
"position: fixed;top: 0;"
:style=
"
{
width: `${parseInt(tabsElement.width * scale)}px`,
height: `${parseInt(tabsElement.height * (scale > 1 ? 1 : scale))}px`,
left: `${parseInt(tabsElement.left * scale)}px`,
zIndex: 10
}"
>
<NormalTabs
:elementInfo=
"tabsElement"
></NormalTabs>
</view>
<view
:style=
"
{'margin-top': `${tabsElement.height * (scale > 1 ? 1 : scale)}px`, height: `${theStyle.height}px`, width: `${theStyle.width - theStyle.left}px`, zIndex: 9}">
<!-- 普通柱状图 -->
<NormalBar
v-if=
"element.type == 'NormalBar'"
:elementInfo=
"element"
></NormalBar>
<!-- 普通折线图 -->
...
...
@@ -42,6 +50,15 @@
left
:
safeArea
.
left
}
},
scale
()
{
let
info
=
JSON
.
parse
(
uni
.
getStorageSync
(
'reportInfo'
))
if
(
JSON
.
stringify
(
info
)
==
"{}"
)
{
return
}
const
{
windowWidth
}
=
uni
.
getSystemInfoSync
()
const
{
width
,
height
}
=
info
.
info
return
windowWidth
/
width
}
},
onLoad
(
option
)
{
this
.
element
=
JSON
.
parse
(
decodeURIComponent
(
option
.
element
))
...
...
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