Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
gh
/
data-view
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d1aabe1b
authored
Jun 30, 2022
by
王志慧
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'dev_v1.0.0' of
http://192.168.3.233:8090/gh/data-view
into dev_v1.0.0
2 parents
bc8a39f7
e2ca2e40
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
107 deletions
src/components/LineChart.vue
src/views/salesData/trend.vue
src/components/LineChart.vue
View file @
d1aabe1
...
...
@@ -8,7 +8,9 @@
</div>
<div
class=
"rank-block"
>
<div
class=
"rank-line"
v-for=
"(item, index) in rankList"
:key=
"index"
>
<marquee
class=
"line-item"
:direction=
"directionTimer"
:delay=
"delayTimer"
:text=
"item.label"
></marquee>
<div
class=
"line-item"
>
<marquee
:direction=
"directionTimer"
:delay=
"delayTimer"
:text=
"item.label"
></marquee>
</div>
<p
class=
"line-item txt-orange"
>
{{
item
.
value
}}
</p>
</div>
</div>
...
...
@@ -67,9 +69,9 @@ export default {
rankList
:
[],
echartsLine
:
''
,
moveAttr
:
{
speed
:
900
,
//
speed: 900,
seriesIndex
:
0
,
dataIndex
:
-
1
dataIndex
:
0
},
timer
:
null
}
...
...
@@ -81,12 +83,12 @@ export default {
mounted
()
{
this
.
lineDom
=
document
.
getElementById
(
this
.
domId
)
this
.
echartsLine
=
echarts
.
init
(
this
.
lineDom
)
this
[
this
.
domId
]
=
echarts
.
init
(
this
.
lineDom
)
},
methods
:
{
resetRankList
()
{
this
.
rankList
=
new
Array
(
5
).
fill
({
label
:
'-
'
,
value
:
'
-'
})
this
.
rankList
=
new
Array
(
5
).
fill
({
label
:
'-
-'
,
value
:
'-
-'
})
},
tooltipFormatter
(
obj
)
{
var
currentItem
=
this
.
dataList
[
obj
[
0
].
dataIndex
]
...
...
@@ -100,41 +102,44 @@ export default {
return
txt
},
autoMove
()
{
clearInterval
(
this
.
timer
)
this
.
timer
=
setInterval
(()
=>
{
this
.
moveAttr
.
dataIndex
=
this
.
moveAttr
.
dataIndex
+
1
if
(
this
.
moveAttr
.
dataIndex
===
this
.
dataList
.
length
)
{
this
.
moveAttr
.
dataIndex
=
0
}
//
autoMove() {
//
clearInterval(this.timer)
//
this.timer = setInterval(() => {
//
this.moveAttr.dataIndex = this.moveAttr.dataIndex + 1
//
if (this.moveAttr.dataIndex === this.dataList.length) {
//
this.moveAttr.dataIndex = 0
//
}
this
.
chartAction
()
this
.
autoMove
()
this
.
getRankList
(
this
.
moveAttr
.
dataIndex
,
this
.
rankFlag
+
'List'
)
},
this
.
moveAttr
.
speed
)
},
//
this.chartAction()
//
this.autoMove()
//
this.getRankList(this.moveAttr.dataIndex, this.rankFlag + 'List')
//
}, this.moveAttr.speed)
//
},
chartBindEvent
()
{
// resize
window
.
addEventListener
(
'resize'
,
()
=>
{
this
.
echartsLine
.
resize
()
this
[
this
.
domId
]
.
resize
()
})
// 鼠标划入
this
.
lineDom
.
addEventListener
(
'mouseover'
,
()
=>
{
clearInterval
(
this
.
timer
)
this
.
chartAction
(
'downplay
'
)
this
[
this
.
domId
].
on
(
'mouseover'
,
data
=>
{
this
.
moveAttr
.
seriesIndex
=
data
.
dataIndex
this
.
getRankList
(
this
.
moveAttr
.
seriesIndex
,
this
.
rankFlag
+
'List
'
)
})
// 鼠标划出
this
.
lineDom
.
addEventListener
(
'mouseout'
,
()
=>
{
this
.
moveAttr
.
dataIndex
=
-
1
this
.
autoMove
()
this
[
this
.
domId
].
on
(
'mouseout'
,
()
=>
{
console
.
log
(
'0000000000'
)
setTimeout
(()
=>
{
this
.
chartAction
()
},
1000
)
})
},
chartAction
(
type
)
{
this
.
echartsLine
.
dispatchAction
({
console
.
log
(
this
.
moveAttr
,
'???/cwq'
)
this
[
this
.
domId
].
dispatchAction
({
type
:
type
||
'showTip'
,
seriesIndex
:
this
.
moveAttr
.
seriesIndex
,
dataIndex
:
this
.
moveAttr
.
dataIndex
...
...
@@ -150,26 +155,16 @@ export default {
this
.
lineOptions
.
series
[
0
].
data
=
this
.
dataList
.
map
(
item
=>
item
.
num
)
this
.
echartsLine
.
setOption
(
this
.
lineOptions
)
// // 鼠标划入
// this.echartsLine.on('click', data => {
// clearInterval(this.timer)
// this.chartAction('downplay')
// })
this
[
this
.
domId
].
setOption
(
this
.
lineOptions
)
// // 鼠标划出
// this.echartsLine.on('mouseout', () => {
// this.moveAttr.dataIndex = -1
// this.autoMove()
// })
// console.log(this.echartsLine)
this
.
chartBindEvent
()
// 默认展示tooltip
this
.
chartAction
()
this
.
getRankList
(
0
)
this
.
autoMove
()
//
this.autoMove()
},
handleRankChange
(
value
)
{
...
...
@@ -232,6 +227,7 @@ p {
border-left
:
1px
solid
rgba
(
96
,
98
,
102
,
0.4
);
.line-item
{
height
:
1.8vh
;
width
:
100%
;
font-size
:
10px
;
padding-bottom
:
0.6vh
;
}
...
...
src/views/salesData/trend.vue
View file @
d1aabe1
...
...
@@ -3,15 +3,17 @@
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-30 1
4:38:18
* @LastEditTime: 2022-06-30 1
7:04:25
-->
<
template
>
<div>
<div
class=
"title"
>
转化趋势
</div>
<!--
<div
class=
"empty"
>
<div
class=
"title"
>
转化趋势
{{
hasData
}}
</div>
<div
v-if=
"hasData"
style=
"width: 100%"
>
<div
id=
"lineTrend"
:style=
"
{ height: height - 4.1 + 'vh' }">
</div>
</div>
<div
v-else
class=
"empty"
>
<img
src=
"../../assets/images/empty.png"
alt=
""
/>
</div>
-->
<div
id=
"lineTrend"
:style=
"
{ height: height - 4.1 + 'vh' }">
</div>
</div>
</div>
</
template
>
...
...
@@ -27,7 +29,9 @@ export default {
echartsTrend
:
{},
option
:
{},
dataList
:
[],
paramsData
:
[]
paramsData
:
[],
list
:
[
'enter'
,
'stayfile'
,
'test'
,
'placeorder'
,
'success'
],
hasData
:
true
}
},
mounted
()
{
...
...
@@ -41,7 +45,7 @@ export default {
var
params
=
{
req
:
{
corporateGroupName
:
'集团1'
,
queryItem
:
'enter'
,
//
queryItem: 'enter',
querystartTime
:
+
val
.
reportType
===
1
?
this
.
getNDate
(
-
30
)
:
this
.
getNMonth
(
-
12
),
queryendTime
:
+
val
.
reportType
===
1
?
this
.
getNDate
(
-
1
)
:
this
.
getNMonth
(
-
1
),
queryType
:
val
.
reportType
||
0
...
...
@@ -52,37 +56,49 @@ export default {
if
(
brandName
)
{
params
.
req
.
brandName
=
brandName
}
this
.
api
.
sales
[
brandName
?
'storeTransTrend'
:
'saleTransTrend'
](
params
).
then
(
res
=>
{
var
{
code
,
data
}
=
res
console
.
log
(
res
)
switch
(
+
code
)
{
case
0
:
this
.
dataList
=
[]
if
(
!
data
.
dataList
.
map
(
item
=>
item
.
num
).
every
(
item
=>
item
===
0
))
{
this
.
dealList
(
data
.
dataList
)
this
.
$nextTick
(()
=>
{
this
.
draw
()
})
}
break
}
const
api
=
brandName
?
'storeTransTrend'
:
'saleTransTrend'
const
p
=
[]
this
.
list
.
forEach
((
i
,
idx
)
=>
{
p
[
idx
]
=
new
Promise
((
resolve
,
reject
)
=>
{
params
.
req
.
queryItem
=
i
this
.
api
.
sales
[
api
](
params
).
then
(
res
=>
{
resolve
(
res
.
data
.
dataList
)
})
})
})
Promise
.
all
([
p
[
0
],
p
[
1
],
p
[
2
],
p
[
3
],
p
[
4
]]).
then
(
results
=>
{
console
.
log
(
results
)
this
.
dataList
=
results
const
flag
=
results
.
map
(
item
=>
{
if
(
item
.
length
)
{
return
item
.
map
(
i
=>
i
.
num
).
some
(
j
=>
j
!=
0
)
}
else
{
return
false
}
})
console
.
log
(
flag
,
flag
.
every
(
i
=>
!
i
)
)
// this.hasData = !flag.every(i => !i)
this
.
$set
(
this
,
'hasData'
,
!
flag
.
every
(
i
=>
!
i
))
this
.
draw
()
})
},
draw
()
{
this
.
option
=
{
tooltip
:
{
trigger
:
'axis'
,
show
:
true
,
borderWidth
:
0
,
backgroundColor
:
'rgba(68,68,68,0.80)'
,
position
:
[
20
,
20
],
//
position: [20, 20],
textStyle
:
{
color
:
'#FFFFFF'
,
fontSize
:
8
},
extraCssText
:
'width: 60px;'
,
// formatter: this.tooltipFormatter
extraCssText
:
'width: 80px;'
,
formatter
:
e
=>
{
console
.
log
(
e
)
var
txt
=
''
e
.
forEach
(
item
=>
{
if
(
txt
)
{
...
...
@@ -110,83 +126,61 @@ export default {
data
:
[
'Mon'
,
'Tue'
,
'Wed'
,
'Thu'
,
'Fri'
,
'Sat'
,
'Sun'
]
},
yAxis
:
{
type
:
'value'
,
splitLine
:
{
lineStyle
:
{
color
:
'#606266'
}
}
type
:
'value'
},
series
:
[
{
name
:
'客流'
,
type
:
'line'
,
symbol
:
'
non
e'
,
symbol
:
'
circl
e'
,
smooth
:
true
,
showSymbol
:
false
,
stack
:
'Total'
,
data
:
[
120
,
132
,
101
,
134
,
90
,
230
,
210
]
data
:
[]
},
{
name
:
'留档'
,
type
:
'line'
,
symbol
:
'circle'
,
smooth
:
true
,
s
ymbol
:
'none'
,
s
howSymbol
:
false
,
stack
:
'Total'
,
data
:
[
220
,
182
,
191
,
234
,
290
,
330
,
310
]
data
:
[]
},
{
name
:
'试驾'
,
type
:
'line'
,
symbol
:
'
non
e'
,
symbol
:
'
circl
e'
,
smooth
:
true
,
showSymbol
:
false
,
stack
:
'Total'
,
data
:
[
150
,
232
,
201
,
154
,
190
,
330
,
410
]
data
:
[]
},
{
name
:
'订单'
,
type
:
'line'
,
symbol
:
'none'
,
symbol
:
'circle'
,
showSymbol
:
false
,
smooth
:
true
,
stack
:
'Total'
,
data
:
[
320
,
332
,
301
,
334
,
390
,
330
,
320
]
data
:
[]
},
{
name
:
'成交'
,
type
:
'line'
,
symbol
:
'none'
,
symbol
:
'circle'
,
showSymbol
:
false
,
smooth
:
true
,
stack
:
'Total'
,
data
:
[
820
,
932
,
901
,
934
,
1290
,
1330
,
1320
]
data
:
[]
}
// {
// type: 'line',
// itemStyle: {
// color: '#F5AA01'
// },
// // 节点,平滑曲线
// symbol: 'none',
// smooth: true,
// // 折线背景色
// data: []
// }
]
}
this
.
option
.
xAxis
.
data
=
this
.
dataList
.
map
(
item
=>
item
.
statDate
)
this
.
option
.
series
[
0
].
data
=
this
.
dataList
.
map
(
item
=>
item
.
num
)
console
.
log
(
this
.
option
)
this
.
echartsTrend
.
setOption
(
this
.
option
)
},
dealList
(
list
)
{
list
.
forEach
(
item
=>
{
this
.
dataList
.
push
({
num
:
item
.
num
||
0
,
hrate
:
item
.
hrate
||
0
,
trate
:
item
.
trate
||
0
,
statDate
:
item
.
statDate
})
this
.
option
.
xAxis
.
data
=
this
.
dataList
[
0
].
map
(
item
=>
item
.
statDate
)
this
.
list
.
forEach
((
i
,
index
)
=>
{
this
.
option
.
series
[
index
].
data
=
this
.
dataList
[
index
].
map
(
item
=>
item
.
num
)
})
this
.
echartsTrend
.
setOption
(
this
.
option
)
}
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment