Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcxy-manage-shell
Project
Overview
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
姜雷
dcxy-manage-shell
Commits
fde83b97
Commit
fde83b97
authored
Apr 18, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 'test'
修改数据首页展现 See merge request
!7
parents
c37cda26
d660e9b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
58 deletions
+101
-58
CustomerRecharge.vue
...ontainers/Dashboard/CustomerRecharge/CustomerRecharge.vue
+6
-6
chart.vue
src/containers/Dashboard/CustomerRecharge/chart.vue
+95
-52
No files found.
src/containers/Dashboard/CustomerRecharge/CustomerRecharge.vue
View file @
fde83b97
...
@@ -28,14 +28,14 @@
...
@@ -28,14 +28,14 @@
</el-radio-group>
</el-radio-group>
</div>
</div>
<div
class=
"Dashboard-title"
>
会员充值数据
<div
class=
"Dashboard-title"
>
会员充值数据
<div
class=
"CustomerRecha
n
geChart-tip"
>
<div
class=
"CustomerRecha
r
geChart-tip"
>
<span
<span
class=
"CustomerRecha
n
ge-tooltip"
class=
"CustomerRecha
r
ge-tooltip"
style=
"background-color:#4e82fb;"
style=
"background-color:#4e82fb;"
></span>
累计充值:
></span>
累计充值:
<span
style=
"color:#f00;"
>
{{
rechargeCount
&&
rechargeCount
.
rechargeMoney
?
(
rechargeCount
.
rechargeMoney
).
toFixed
(
2
)
:
'0.00'
}}
元
</span>
<span
style=
"color:#f00;"
>
{{
rechargeCount
&&
rechargeCount
.
rechargeMoney
?
(
rechargeCount
.
rechargeMoney
).
toFixed
(
2
)
:
'0.00'
}}
元
</span>
<span
<span
class=
"CustomerRecha
n
ge-tooltip"
class=
"CustomerRecha
r
ge-tooltip"
style=
"background-color:#26c9a8;"
style=
"background-color:#26c9a8;"
></span>
充值人数:
></span>
充值人数:
<span
style=
"color:#f00;"
>
{{
rechargeCount
&&
rechargeCount
.
rechargeMen
?
rechargeCount
.
rechargeMen
:
0
}}
人
</span>
<span
style=
"color:#f00;"
>
{{
rechargeCount
&&
rechargeCount
.
rechargeMen
?
rechargeCount
.
rechargeMen
:
0
}}
人
</span>
...
@@ -50,7 +50,7 @@ import Chart from './chart';
...
@@ -50,7 +50,7 @@ import Chart from './chart';
import
{
mapGetters
,
mapActions
}
from
'vuex'
;
import
{
mapGetters
,
mapActions
}
from
'vuex'
;
export
default
{
export
default
{
name
:
'CustomerRecha
n
ge'
,
name
:
'CustomerRecha
r
ge'
,
components
:
{
components
:
{
Chart
,
Chart
,
},
},
...
@@ -82,7 +82,7 @@ export default {
...
@@ -82,7 +82,7 @@ export default {
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
}
}
.CustomerRecha
n
geChart-tip
{
.CustomerRecha
r
geChart-tip
{
position
:
absolute
;
position
:
absolute
;
right
:
0
;
right
:
0
;
top
:
50px
;
top
:
50px
;
...
@@ -91,7 +91,7 @@ export default {
...
@@ -91,7 +91,7 @@ export default {
font-size
:
14px
;
font-size
:
14px
;
font-weight
:
normal
;
font-weight
:
normal
;
text-align
:
center
;
text-align
:
center
;
.CustomerRecha
n
ge-tooltip
{
.CustomerRecha
r
ge-tooltip
{
display
:
inline-block
;
display
:
inline-block
;
width
:
10px
;
width
:
10px
;
height
:
5px
;
height
:
5px
;
...
...
src/containers/Dashboard/CustomerRecharge/chart.vue
View file @
fde83b97
<
template
>
<
template
>
<div
class=
"CustomerRechangeChart"
>
<div
class=
"CustomerRechargeChart"
>
<div
id=
'CustomerRechargeChart'
></div>
<div
id=
'CustomerRechangeChart'
></div>
<div
id=
'CustomerRechangeSlider'
></div>
<div
id=
'CustomerRechangeSlider'
></div>
</div>
</div>
</
template
>
</
template
>
...
@@ -13,8 +12,60 @@ import chartMixin from '../chartMixin';
...
@@ -13,8 +12,60 @@ import chartMixin from '../chartMixin';
import
DataSet
from
'@antv/data-set'
;
import
DataSet
from
'@antv/data-set'
;
import
_
from
'lodash'
;
import
_
from
'lodash'
;
const
Shape
=
G2
.
Shape
;
const
Util
=
G2
.
Util
;
const
Global
=
G2
.
Global
;
function
getRectRange
(
points
,
step
)
{
var
xValues
=
[];
var
yValues
=
[];
for
(
var
i
=
0
,
len
=
points
.
length
;
i
<
len
;
i
++
)
{
var
point
=
points
[
i
];
xValues
.
push
(
point
.
x
);
yValues
.
push
(
point
.
y
-
step
);
}
var
xMin
=
Math
.
min
.
apply
(
null
,
xValues
);
var
yMin
=
Math
.
min
.
apply
(
null
,
yValues
);
var
xMax
=
Math
.
max
.
apply
(
null
,
xValues
);
var
yMax
=
Math
.
max
.
apply
(
null
,
yValues
);
return
{
x
:
xMin
,
y
:
yMin
,
width
:
xMax
-
xMin
,
height
:
yMax
-
yMin
,
};
}
// 左侧柱子
Shape
.
registerShape
(
'interval'
,
'left'
,
{
draw
:
function
draw
(
cfg
,
container
)
{
var
points
=
this
.
parsePoints
(
cfg
.
points
);
var
style
=
Util
.
mix
(
Global
.
shape
.
interval
,
cfg
.
style
,
{
fill
:
cfg
.
color
});
var
rectCfg
=
getRectRange
(
points
,
cfg
.
size
);
// cfg.size 对应 .size(25)
return
container
.
addShape
(
'rect'
,
{
className
:
'interval'
,
attrs
:
Util
.
mix
(
rectCfg
,
style
),
});
},
});
// 右侧柱子
Shape
.
registerShape
(
'interval'
,
'right'
,
{
draw
:
function
draw
(
cfg
,
container
)
{
var
points
=
this
.
parsePoints
(
cfg
.
points
);
var
style
=
Util
.
mix
(
Global
.
shape
.
interval
,
cfg
.
style
,
{
fill
:
cfg
.
color
});
var
rectCfg
=
getRectRange
(
points
,
-
cfg
.
size
/
2
);
// cfg.size 对应 .size(25
return
container
.
addShape
(
'rect'
,
{
className
:
'interval'
,
attrs
:
Util
.
mix
(
rectCfg
,
style
),
});
},
});
export
default
{
export
default
{
name
:
'CustomerRecha
n
geChart'
,
name
:
'CustomerRecha
r
geChart'
,
mixins
:
[
chartMixin
],
mixins
:
[
chartMixin
],
props
:
{
props
:
{
rechargeCount
:
{
rechargeCount
:
{
...
@@ -24,14 +75,14 @@ export default {
...
@@ -24,14 +75,14 @@ export default {
data
()
{
data
()
{
return
{
return
{
demoList
:
[
demoList
:
[
{
areaName
:
'bvs'
,
rechargeMoney
:
13.45
},
{
areaName
:
'bvs'
,
rechargeMoney
:
13.45
,
rechargeMen
:
12
},
{
areaName
:
'gsn'
,
rechargeMoney
:
23.45
},
{
areaName
:
'gsn'
,
rechargeMoney
:
23.45
,
rechargeMen
:
13
},
{
areaName
:
'dsf'
,
rechargeMoney
:
12.45
},
{
areaName
:
'dsf'
,
rechargeMoney
:
12.45
,
rechargeMen
:
16
},
{
areaName
:
'bzx'
,
rechargeMoney
:
45.45
},
{
areaName
:
'bzx'
,
rechargeMoney
:
45.45
,
rechargeMen
:
63
},
{
areaName
:
'bvmf'
,
rechargeMoney
:
3213.454
},
{
areaName
:
'bvmf'
,
rechargeMoney
:
3213.454
,
rechargeMen
:
32
},
{
areaName
:
'swer'
,
rechargeMoney
:
256
},
{
areaName
:
'swer'
,
rechargeMoney
:
256
,
rechargeMen
:
125
},
{
areaName
:
'cvsdf'
,
rechargeMoney
:
541
},
{
areaName
:
'cvsdf'
,
rechargeMoney
:
541
,
rechargeMen
:
14
},
{
areaName
:
'cvsdf'
,
rechargeMoney
:
10.15
},
{
areaName
:
'cvsdf'
,
rechargeMoney
:
10.15
,
rechargeMen
:
574
},
],
],
slider
:
null
,
slider
:
null
,
sliderDom
:
null
,
sliderDom
:
null
,
...
@@ -51,24 +102,6 @@ export default {
...
@@ -51,24 +102,6 @@ export default {
const
dv
=
this
.
ds
.
createView
().
source
(
this
.
data
);
const
dv
=
this
.
ds
.
createView
().
source
(
this
.
data
);
this
.
dv
=
dv
;
this
.
dv
=
dv
;
dv
.
transform
({
dv
.
transform
({
type
:
'fold'
,
fields
:
[
'rechargeMoney'
,
'rechargeMen'
],
// 展开字段集
key
:
'key'
,
// key字段
value
:
'value'
,
// value字段
retains
:
[
'areaName'
],
}).
transform
({
type
:
'map'
,
callback
(
row
)
{
if
(
row
.
key
===
'rechargeMoney'
)
{
row
.
key
=
'充值金额'
;
}
if
(
row
.
key
===
'rechargeMen'
)
{
row
.
key
=
'充值人数'
;
}
return
row
;
},
});
dv
.
transform
({
type
:
'filter'
,
type
:
'filter'
,
callback
:
obj
=>
{
callback
:
obj
=>
{
if
(
if
(
...
@@ -87,51 +120,60 @@ export default {
...
@@ -87,51 +120,60 @@ export default {
);
);
},
},
});
});
this
.
chart
=
new
G2
.
Chart
({
this
.
chart
=
new
G2
.
Chart
({
container
:
'CustomerRecha
n
geChart'
,
container
:
'CustomerRecha
r
geChart'
,
forceFit
:
true
,
forceFit
:
true
,
height
:
this
.
height
,
height
:
this
.
height
,
padding
:
[
50
,
50
,
50
,
120
],
padding
:
[
50
,
50
,
50
,
120
],
});
});
this
.
chart
.
source
(
dv
);
this
.
chart
.
axis
(
'areaName'
,
{
this
.
chart
.
source
(
dv
,
{
label
:
{
rechargeMoney
:
{
offset
:
5
,
alias
:
'充值金额'
,
},
rechargeMen
:
{
alias
:
'充值人数'
,
},
},
});
});
this
.
chart
.
axis
(
'value'
);
this
.
chart
.
axis
(
'rechargeMoney'
,
{
grid
:
null
,
});
this
.
chart
.
axis
(
'rechargeMen'
);
this
.
chart
.
coord
().
transpose
();
this
.
chart
.
coord
().
transpose
();
this
.
chart
.
legend
(
false
);
this
.
chart
// 坐标系及着色
this
.
chartGeom
=
this
.
chart
.
interval
()
.
interval
()
.
position
(
'areaName*value'
)
.
position
(
'areaName*rechargeMoney'
)
.
color
(
'key'
,
[
'#4e82fb'
,
'#26c9a8'
])
.
color
(
'#4e82fb'
)
.
adjust
([
.
shape
(
'left'
)
{
.
size
(
10
);
type
:
'dodge'
,
this
.
chart
marginRatio
:
0.2
,
.
interval
()
},
.
position
(
'areaName*rechargeMen'
)
]);
.
shape
(
'right'
)
.
color
(
'#26c9a8'
)
.
size
(
10
);
this
.
chart
.
legend
(
false
);
this
.
chart
.
render
();
this
.
chart
.
render
();
this
.
initSlider
();
this
.
initSlider
();
},
},
initSlider
()
{
initSlider
()
{
const
wrapDom
=
document
.
getElementById
(
'CustomerRecha
n
geChart'
);
const
wrapDom
=
document
.
getElementById
(
'CustomerRecha
r
geChart'
);
let
height
=
wrapDom
.
clientHeight
;
let
height
=
wrapDom
.
clientHeight
;
// const arrLength = this.data.length;
// const arrLength = this.data.length;
// let spanNum = 4 / arrLength;
// let spanNum = 4 / arrLength;
this
.
sliderDom
=
document
.
getElementById
(
'CustomerRechangeSlider'
);
this
.
sliderDom
=
document
.
getElementById
(
'CustomerRechangeSlider'
);
this
.
sliderDom
.
style
=
`height:
${
height
}
px`
;
this
.
sliderDom
.
style
=
`height:
${
height
}
px`
;
this
.
slider
=
new
Slider
({
this
.
slider
=
new
Slider
({
container
:
this
.
sliderDom
,
// dom 容器 id 或者 dom 容器对象
container
:
this
.
sliderDom
,
// dom 容器 id 或者 dom 容器对象
width
:
26
,
// slider 的宽度,默认为 'auto',即自适应宽度
width
:
26
,
// slider 的宽度,默认为 'auto',即自适应宽度
height
:
height
,
// slider 的高度,默认为 '26px'
height
:
height
,
// slider 的高度,默认为 '26px'
xAxis
:
'value'
,
// 背景图的横轴对应字段,同时为数据筛选的字段
padding
:
[
50
,
0
,
50
,
0
],
xAxis
:
'rechargeMen'
,
// 背景图的横轴对应字段,同时为数据筛选的字段
yAxis
:
'areaName'
,
// 背景图的纵轴对应字段
yAxis
:
'areaName'
,
// 背景图的纵轴对应字段
startRadio
:
this
.
ds
.
state
.
startRadio
,
// 新增
startRadio
:
this
.
ds
.
state
.
startRadio
,
// 新增
endRadio
:
this
.
ds
.
state
.
endRadio
,
// 新增
endRadio
:
this
.
ds
.
state
.
endRadio
,
// 新增
...
@@ -153,7 +195,7 @@ export default {
...
@@ -153,7 +195,7 @@ export default {
this
.
slider
.
render
();
// 渲染
this
.
slider
.
render
();
// 渲染
},
},
updateSlider
()
{
updateSlider
()
{
const
wrapDom
=
document
.
getElementById
(
'CustomerRecha
n
geChart'
);
const
wrapDom
=
document
.
getElementById
(
'CustomerRecha
r
geChart'
);
let
height
=
wrapDom
.
clientHeight
;
let
height
=
wrapDom
.
clientHeight
;
let
dom
=
this
.
sliderDom
;
let
dom
=
this
.
sliderDom
;
...
@@ -165,6 +207,7 @@ export default {
...
@@ -165,6 +207,7 @@ export default {
container
:
this
.
sliderDom
,
container
:
this
.
sliderDom
,
width
:
26
,
width
:
26
,
height
:
height
,
height
:
height
,
padding
:
[
50
,
0
,
50
,
0
],
xAxis
:
'value'
,
xAxis
:
'value'
,
yAxis
:
'areaName'
,
yAxis
:
'areaName'
,
startRadio
:
this
.
ds
.
state
.
startRadio
,
startRadio
:
this
.
ds
.
state
.
startRadio
,
...
@@ -204,7 +247,7 @@ export default {
...
@@ -204,7 +247,7 @@ export default {
</
script
>
</
script
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
.CustomerRecha
n
geChart
{
.CustomerRecha
r
geChart
{
position
:
relative
;
position
:
relative
;
#CustomerRechangeSlider
{
#CustomerRechangeSlider
{
margin-left
:
-30px
;
margin-left
:
-30px
;
...
...
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