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 d7814cad
authored
Jul 23, 2022
by
王志慧
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
jiejuechongtu
2 parents
3a5ae479
25065fe5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
64 deletions
src/components/LineChart.vue
src/components/ViewTabs.vue
src/views/afterSales/analyze.vue
src/components/LineChart.vue
View file @
d7814ca
...
@@ -163,8 +163,9 @@ export default {
...
@@ -163,8 +163,9 @@ export default {
})
})
var
seriesDate
=
this
.
dataList
.
map
(
item
=>
+
item
.
num
)
var
seriesDate
=
this
.
dataList
.
map
(
item
=>
+
item
.
num
)
this
.
lineOptions
.
series
[
0
].
data
=
seriesDate
this
.
lineOptions
.
series
[
0
].
data
=
seriesDate
this
.
lineOptions
.
yAxis
.
min
=
Math
.
min
(...
seriesDate
)
this
.
lineOptions
.
yAxis
.
scale
=
true
this
.
lineOptions
.
yAxis
.
max
=
Math
.
max
(...
seriesDate
)
// this.lineOptions.yAxis.min = Math.min(...seriesDate)
// this.lineOptions.yAxis.max = Math.max(...seriesDate)
this
[
this
.
domId
].
setOption
(
this
.
lineOptions
)
this
[
this
.
domId
].
setOption
(
this
.
lineOptions
)
// 默认展示tooltip
// 默认展示tooltip
this
.
chartAction
()
this
.
chartAction
()
...
...
src/components/ViewTabs.vue
View file @
d7814ca
...
@@ -102,11 +102,11 @@ import * as echarts from 'echarts'
...
@@ -102,11 +102,11 @@ import * as echarts from 'echarts'
export
default
{
export
default
{
name
:
'ViewTabs'
,
name
:
'ViewTabs'
,
mixins
:
[
changeMixin
],
mixins
:
[
changeMixin
],
data
()
{
data
()
{
return
{
return
{
tabs
,
tabs
,
tabHead
:
[],
tabHead
:
[],
tabTitle
:
'客户总数'
,
tabTitle
:
'客户总数'
,
tabType
:
'total'
,
tabType
:
'total'
,
tabIndex
:
0
,
tabIndex
:
0
,
delayTimer
:
3000
,
delayTimer
:
3000
,
...
@@ -126,10 +126,9 @@ export default {
...
@@ -126,10 +126,9 @@ export default {
updata
:
Date
.
now
()
updata
:
Date
.
now
()
}
}
},
},
mounted
()
{
mounted
()
{},
},
methods
:
{
methods
:
{
init
(
params
)
{
init
(
params
)
{
this
.
isGroup
=
true
this
.
isGroup
=
true
let
req
=
{
let
req
=
{
queryType
:
params
.
reportType
||
0
queryType
:
params
.
reportType
||
0
...
@@ -144,20 +143,22 @@ export default {
...
@@ -144,20 +143,22 @@ export default {
this
.
getOverallbase
(
'publiccus'
)
this
.
getOverallbase
(
'publiccus'
)
this
.
getOveralltrend
(
'total'
)
this
.
getOveralltrend
(
'total'
)
},
},
changeType
(
type
)
{
changeType
(
type
)
{
let
title
=
{
let
title
=
{
'total'
:
'客户总数'
,
total
:
'客户总数'
,
'wechat'
:
'企微客户数'
,
wechat
:
'企微客户数'
,
'wechatGroup'
:
'企微群数'
,
wechatGroup
:
'企微群数'
,
'applet'
:
'小程序客户数'
,
applet
:
'小程序客户数'
,
'publiccus'
:
'公众号客户数'
publiccus
:
'公众号客户数'
}
}
this
.
tabTitle
=
title
[
type
]
this
.
tabTitle
=
title
[
type
]
this
.
tabType
=
type
this
.
tabType
=
type
this
.
getOveralltrend
(
type
)
this
.
getOveralltrend
(
type
)
},
},
getOverallbase
(
queryItem
)
{
getOverallbase
(
queryItem
)
{
let
{
req
:
{
queryType
}
}
=
this
let
{
req
:
{
queryType
}
}
=
this
const
params
=
{
const
params
=
{
queryItem
,
queryItem
,
queryType
,
queryType
,
...
@@ -192,65 +193,66 @@ export default {
...
@@ -192,65 +193,66 @@ export default {
}
}
}
}
this
.
pageData
[
queryItem
]
=
dataList
this
.
pageData
[
queryItem
]
=
dataList
}
}
})
})
},
},
ObjectToArray
(
obj
)
{
ObjectToArray
(
obj
)
{
let
arr
=
[]
let
arr
=
[]
if
(
obj
&&
obj
!==
'null'
)
{
if
(
obj
&&
obj
!==
'null'
)
{
obj
=
obj
.
replace
(
'null'
,
'"未知"'
)
obj
=
obj
.
replace
(
'null'
,
'"未知"'
)
let
item
=
JSON
.
parse
(
obj
)
let
item
=
JSON
.
parse
(
obj
)
if
(
Array
.
isArray
(
item
))
item
.
map
(
e
=>
{
if
(
Array
.
isArray
(
item
))
Object
.
keys
(
e
).
map
(
name
=>
arr
.
push
({
name
,
num
:
e
[
name
]
}))
item
.
map
(
e
=>
{
})
Object
.
keys
(
e
).
map
(
name
=>
arr
.
push
({
name
,
num
:
e
[
name
]
}))
})
else
Object
.
keys
(
item
).
map
(
name
=>
arr
.
push
({
name
,
num
:
item
[
name
]
}))
else
Object
.
keys
(
item
).
map
(
name
=>
arr
.
push
({
name
,
num
:
item
[
name
]
}))
}
}
return
arr
return
arr
},
},
getOveralltrend
(
queryItem
)
{
getOveralltrend
(
queryItem
)
{
let
{
req
:
{
queryType
}
}
=
this
let
{
req
:
{
queryType
}
}
=
this
const
params
=
{
const
params
=
{
queryItem
,
queryItem
,
queryType
,
queryType
,
querystartTime
:
queryType
==
1
?
this
.
getNDate
(
-
30
)
:
this
.
getNMonth
(
-
12
),
querystartTime
:
queryType
==
1
?
this
.
getNDate
(
-
30
)
:
this
.
getNMonth
(
-
12
),
queryendTime
:
queryType
==
1
?
this
.
getNDate
(
-
1
)
:
this
.
getNMonth
(
-
1
),
queryendTime
:
queryType
==
1
?
this
.
getNDate
(
-
1
)
:
this
.
getNMonth
(
-
1
)
}
}
this
.
api
.
overview
[
this
.
isGroup
?
'getBrandOveralltrend'
:
'getMerchantOveralltrend'
](
params
).
then
(({
data
,
code
})
=>
{
this
.
api
.
overview
[
this
.
isGroup
?
'getBrandOveralltrend'
:
'getMerchantOveralltrend'
](
params
)
this
.
flag
=
true
.
then
(({
data
,
code
})
=>
{
if
(
code
==
0
)
{
this
.
flag
=
true
if
(
!
data
.
dataList
.
map
(
item
=>
item
.
totalNum
).
every
(
item
=>
item
===
0
))
{
if
(
code
==
0
)
{
this
.
isEmpty
=
false
if
(
!
data
.
dataList
.
map
(
item
=>
item
.
totalNum
).
every
(
item
=>
item
===
0
))
{
this
.
$nextTick
(()
=>
{
this
.
isEmpty
=
false
this
.
canvas
=
echarts
.
init
(
this
.
$refs
.
canvas
)
this
.
$nextTick
(()
=>
{
this
.
lineData
=
data
.
dataList
this
.
canvas
=
echarts
.
init
(
this
.
$refs
.
canvas
)
this
.
draw
(
data
.
dataList
,
queryType
)
this
.
draw
(
data
.
dataList
,
queryType
)
})
})
}
}
}
})
}
.
catch
(()
=>
{
}).
catch
(()
=>
{
this
.
flag
=
true
this
.
flag
=
true
})
})
},
},
chartAction
()
{
chartAction
()
{
this
.
canvas
.
dispatchAction
({
this
.
canvas
.
dispatchAction
({
type
:
'showTip'
,
type
:
'showTip'
,
seriesIndex
:
0
,
seriesIndex
:
0
,
dataIndex
:
this
.
lineData
.
length
-
1
dataIndex
:
this
.
lineData
.
length
-
1
})
})
},
},
draw
(
lineData
,
queryType
)
{
draw
(
lineData
,
queryType
)
{
let
data
=
[],
let
data
=
[],
Min
=
0
,
Min
=
0
,
xData
=
[],
xData
=
[],
title
=
{
title
=
{
'total'
:
'客户总数'
,
total
:
'客户总数'
,
'wechat'
:
'企微客户数'
,
wechat
:
'企微客户数'
,
'wechatGroup'
:
'企微群数'
,
wechatGroup
:
'企微群数'
,
'applet'
:
'小程序客户数'
,
applet
:
'小程序客户数'
,
'publiccus'
:
'公众号客户数'
publiccus
:
'公众号客户数'
},
},
{
tabType
}
=
this
{
tabType
}
=
this
lineData
.
map
(
e
=>
{
lineData
.
map
(
e
=>
{
...
@@ -297,10 +299,11 @@ export default {
...
@@ -297,10 +299,11 @@ export default {
},
},
yAxis
:
{
yAxis
:
{
type
:
'value'
,
type
:
'value'
,
min
:
Min
,
// min: Min,
scale
:
true
,
splitLine
:
{
splitLine
:
{
lineStyle
:
{
lineStyle
:
{
color
:
'rgba(96,98,102,0.2)'
color
:
'rgba(96,98,102,0.2)'
}
}
},
},
axisLabel
:
{
axisLabel
:
{
...
@@ -327,16 +330,16 @@ export default {
...
@@ -327,16 +330,16 @@ export default {
y
:
0
,
y
:
0
,
x2
:
0
,
x2
:
0
,
y2
:
1
,
y2
:
1
,
colorStops
:
[
colorStops
:
[
{
{
offset
:
0
,
offset
:
0
,
color
:
'rgba(254, 84, 0, 0.3)'
color
:
'rgba(254, 84, 0, 0.3)'
},
},
{
{
offset
:
1
,
offset
:
1
,
color
:
'rgba(254, 84, 0, 0.01)'
color
:
'rgba(254, 84, 0, 0.01)'
}
}
]
]
}
}
},
},
data
data
...
...
src/views/afterSales/analyze.vue
View file @
d7814ca
...
@@ -48,7 +48,8 @@ export default {
...
@@ -48,7 +48,8 @@ export default {
barData
:
[],
barData
:
[],
key
:
'重要价值'
,
key
:
'重要价值'
,
isBrand
:
false
,
isBrand
:
false
,
brandName
:
''
brandName
:
''
,
currentData
:
{}
}
}
},
},
mounted
()
{},
mounted
()
{},
...
@@ -60,6 +61,22 @@ export default {
...
@@ -60,6 +61,22 @@ export default {
this
.
barChart
.
resize
()
this
.
barChart
.
resize
()
})
})
this
.
option
=
{
this
.
option
=
{
tooltip
:
{
trigger
:
'axis'
,
axisPointer
:
{
type
:
'shadow'
,
shadowStyle
:
{
color
:
'rgba(235,96,1,0.30'
}
},
borderWidth
:
0
,
backgroundColor
:
'rgba(68,68,68,0.80)'
,
confine
:
true
,
textStyle
:
{
color
:
'#FFFFFF'
,
fontSize
:
8
}
},
grid
:
{
grid
:
{
left
:
'3%'
,
left
:
'3%'
,
right
:
'4%'
,
right
:
'4%'
,
...
@@ -94,7 +111,7 @@ export default {
...
@@ -94,7 +111,7 @@ export default {
// data: [120, 200, 150, 80, 70, 110, 130, 300],
// data: [120, 200, 150, 80, 70, 110, 130, 300],
data
:
this
.
barData
.
reverse
(),
data
:
this
.
barData
.
reverse
(),
type
:
'bar'
,
type
:
'bar'
,
barWidth
:
1
2
,
barWidth
:
1
8
,
itemStyle
:
{
itemStyle
:
{
normal
:
{
normal
:
{
label
:
{
label
:
{
...
@@ -103,7 +120,7 @@ export default {
...
@@ -103,7 +120,7 @@ export default {
textStyle
:
{
textStyle
:
{
fontSize
:
'12'
,
fontSize
:
'12'
,
color
:
'#fff'
,
color
:
'#fff'
,
height
:
'1
2
'
,
height
:
'1
8
'
,
padding
:
[
1
,
0
,
0
,
0
]
padding
:
[
1
,
0
,
0
,
0
]
}
}
},
},
...
@@ -124,9 +141,16 @@ export default {
...
@@ -124,9 +141,16 @@ export default {
}
}
this
.
barChart
.
clear
()
this
.
barChart
.
clear
()
this
.
barChart
.
setOption
(
this
.
option
)
this
.
barChart
.
setOption
(
this
.
option
)
this
.
chartAction
()
// 鼠标划入
// 鼠标划入
this
.
barChart
.
on
(
'mouseover'
,
data
=>
{
this
.
barChart
.
on
(
'mouseover'
,
data
=>
{
this
.
initPieData
(
data
.
name
)
this
.
initPieData
(
data
.
name
)
console
.
log
(
data
)
this
.
currentData
=
data
})
this
.
barChart
.
on
(
'globalout'
,
()
=>
{
this
.
chartAction
(
this
.
currentData
.
dataIndex
)
this
.
initPieData
(
this
.
currentData
.
name
)
})
})
},
},
getValueType
()
{
getValueType
()
{
...
@@ -178,6 +202,13 @@ export default {
...
@@ -178,6 +202,13 @@ export default {
this
.
brandName
=
newVal
.
brand
.
name
this
.
brandName
=
newVal
.
brand
.
name
}
}
this
.
getValueType
()
this
.
getValueType
()
},
chartAction
(
index
=
7
)
{
this
.
barChart
.
dispatchAction
({
type
:
'showTip'
,
seriesIndex
:
0
,
dataIndex
:
index
})
}
}
}
}
}
}
...
...
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