Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
glsk-data-view-pd
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 eb0aeec7
authored
Sep 14, 2023
by
匡雅琴
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
接口调整
1 parent
aee08759
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
273 additions
and
4 deletions
src/views/internal/components/DoubleBarChart.vue
src/views/internal/components/DoubleBarOptions.js
src/views/internal/components/ViewClue.vue
src/views/solarDetail/index.vue
src/views/internal/components/DoubleBarChart.vue
0 → 100644
View file @
eb0aeec
<
template
>
<div>
<div
:id=
"domId"
style=
"width: 100%"
:style=
"
{ height }">
</div>
</div>
</
template
>
<
script
type=
"text/ecmascript-6"
>
import
utils
from
'../../../utils/util'
import
*
as
echarts
from
'echarts'
import
getBarLineOptions
from
'./DoubleBarOptions'
export
default
{
name
:
'DoubleBarChart'
,
props
:
{
height
:
{
type
:
String
},
domId
:
{
type
:
String
,
default
:
'bar-line'
},
dataList
:
{
type
:
Array
,
default
:
()
=>
[]
},
tooltipFormatterObj
:
{
type
:
Array
,
default
:
()
=>
{
return
[
{
label
:
'数量'
,
attrName
:
'num'
},
{
label
:
'环比'
,
attrName
:
'hrate'
,
addSymbol
:
'%'
},
{
label
:
'同比'
,
attrName
:
'trate'
,
addSymbol
:
'%'
}
]
}
}
},
data
()
{
return
{
barLineOptions
:
[],
moveAttr
:
{
// speed: 900,
seriesIndex
:
0
,
dataIndex
:
0
},
timer
:
null
}
},
// created() {
// this.barLineOptions = getBarLineOptions({ tooltipFormatter: this.tooltipFormatter })
// },
mounted
()
{
this
.
barLineDom
=
document
.
getElementById
(
this
.
domId
)
this
[
this
.
domId
]
=
echarts
.
init
(
this
.
barLineDom
)
this
.
chartBindEvent
()
},
methods
:
{
tooltipFormatter
(
obj
)
{
var
_currentItem
=
this
.
dataList
[
obj
[
0
].
dataIndex
]
var
_html
=
''
var
_txt
=
''
this
.
tooltipFormatterObj
.
forEach
(
item
=>
{
_txt
+=
`<div style="display:flex;"><div style="color: #c9c9c9">
${
item
.
label
}
:</div><div style="color: #fff;">
${
utils
.
numAddSymbol
(
_currentItem
[
item
.
attrName
])}${
item
.
addSymbol
||
''
}
</div></div>`
})
_html
+=
`<div style="backdrop-filter: blur(4px);background-color: #051526;border: 2px solid;border-image: linear-gradient(90deg, #074989, #30DCFF, #074989) 1;padding: 10px;">
${
_txt
}
</div>`
return
_html
},
drawBar
(
dataList
)
{
this
.
barLineOptions
=
getBarLineOptions
({
tooltipFormatter
:
this
.
tooltipFormatter
,
seriesData
:
dataList
})
this
.
barLineOptions
.
xAxis
.
data
=
dataList
.
map
(
item
=>
item
.
statMonth
)
this
.
barLineOptions
.
series
[
0
].
data
=
dataList
.
map
(
item
=>
item
.
channel_zx
)
this
.
barLineOptions
.
series
[
1
].
data
=
dataList
.
map
(
item
=>
item
.
channel_qd
)
this
[
this
.
domId
].
setOption
(
this
.
barLineOptions
)
},
chartBindEvent
()
{
// resize
window
.
addEventListener
(
'resize'
,
()
=>
{
this
[
this
.
domId
].
resize
()
})
}
}
}
</
script
>
<
style
scoped
lang=
"scss"
></
style
>
src/views/internal/components/DoubleBarOptions.js
0 → 100644
View file @
eb0aeec
import
*
as
echarts
from
'echarts'
import
utils
from
'../../../utils/util'
function
getBarLineOptions
(
obj
)
{
const
{
tooltipFormatter
,
seriesData
}
=
obj
var
barLineOption
=
{
tooltip
:
{
trigger
:
'axis'
,
borderWidth
:
0
,
padding
:
0
,
backgroundColor
:
'#051526'
,
formatter
:
tooltipFormatter
||
''
},
xAxis
:
{
data
:
[]
},
yAxis
:
{
name
:
''
,
type
:
'value'
,
// min: 0,
// max: 100,
splitLine
:
{
lineStyle
:
{
color
:
'#1d2a38'
}
},
splitNumber
:
4
},
grid
:
{
left
:
'3%'
,
right
:
'2%'
,
top
:
'20%'
,
bottom
:
'6%'
,
containLabel
:
true
},
series
:
[
{
name
:
'bar'
,
type
:
'bar'
,
stack
:
'one'
,
data
:
[],
label
:
{
show
:
true
,
position
:
'top'
,
color
:
'#fff'
,
formatter
:
params
=>
{
params
.
value
?
utils
.
numAddSymbol
(
params
.
value
)
:
''
return
params
.
value
}
},
itemStyle
:
{
barBorderRadius
:
[
2
,
2
,
0
,
0
],
// 柱体圆角
color
:
function
(
params
)
{
// const colorList = [
// ['#22D8FF', '#5C56FF'],
// ['#2AD190', '#00B7DF']
// ]
const
colorList
=
[
'#22D8FF'
,
'#5C56FF'
]
// var colorItem = []
// colorItem = params.dataIndex % 2 === 0 ? colorList[0] : colorList[1]
return
new
echarts
.
graphic
.
LinearGradient
(
0
,
0
,
0
,
1
,
[
{
// 代表渐变色从正上方开始
offset
:
0
,
// offset范围是0~1,用于表示位置,0是指0%处的颜色
color
:
colorList
[
0
]
},
// 柱图渐变色
{
offset
:
1
,
// 指100%处的颜色
color
:
colorList
[
1
]
}
])
}
}
},
{
name
:
'bar2'
,
type
:
'bar'
,
stack
:
'one'
,
min
:
100
,
label
:
{
show
:
true
,
position
:
'top'
,
color
:
'#fff'
,
formatter
:
params
=>
{
params
.
value
?
utils
.
numAddSymbol
(
params
.
value
)
:
''
return
params
.
value
}
},
data
:
[],
itemStyle
:
{
barBorderRadius
:
[
2
,
2
,
0
,
0
],
// 柱体圆角
color
:
function
(
params
)
{
// const colorList = [
// ['#11627A', '#282F7A'],
// ['#145F4E', '#035972']
// ]
const
colorList
=
[
'#11627A'
,
'#282F7A'
]
// var colorItem = []
// colorItem = params.dataIndex % 2 === 0 ? colorList[0] : colorList[1]
return
new
echarts
.
graphic
.
LinearGradient
(
0
,
0
,
0
,
1
,
[
{
// 代表渐变色从正上方开始
offset
:
0
,
// offset范围是0~1,用于表示位置,0是指0%处的颜色
color
:
colorList
[
0
]
},
// 柱图渐变色
{
offset
:
1
,
// 指100%处的颜色
color
:
colorList
[
1
]
}
])
}
}
}
]
}
return
barLineOption
}
export
default
getBarLineOptions
src/views/internal/components/ViewClue.vue
View file @
eb0aeec
...
@@ -12,9 +12,16 @@
...
@@ -12,9 +12,16 @@
<div
class=
"patch-title"
>
月收入趋势
</div>
<div
class=
"patch-title"
>
月收入趋势
</div>
<LineChart
ref=
"monthIncomeChartRef"
domId=
"monthIncomeChart"
:height=
"chartHeight"
valName=
"output"
></LineChart>
<LineChart
ref=
"monthIncomeChartRef"
domId=
"monthIncomeChart"
:height=
"chartHeight"
valName=
"output"
></LineChart>
</div>
</div>
<div
class=
"trend-box"
>
<div
class=
"trend-box
marketing-trend
"
>
<div
class=
"patch-title"
>
销售渠道趋势
</div>
<div
class=
"patch-title"
>
销售渠道趋势
</div>
<BarChart
ref=
"saleChartRef"
domId=
"saleChart"
:height=
"chartHeight"
:colorList=
"colorList"
valueName=
"channel"
></BarChart>
<!--
<BarChart
ref=
"saleChartRef"
domId=
"saleChart"
:height=
"chartHeight"
:colorList=
"colorList"
valueName=
"channel"
></BarChart>
-->
<DoubleBarChart
ref=
"saleChartRef"
domId=
"purchase"
:height=
"chartHeight"
:colorList=
"colorList"
valueName=
"channel"
></DoubleBarChart>
<div
class=
"legend"
>
<div
class=
"legend-item shop"
>
<span
class=
"legend-even"
>
直销
</span>
<span
class=
"legend-odd"
>
渠道
</span>
</div>
</div>
</div>
</div>
<div
class=
"trend-box"
>
<div
class=
"trend-box"
>
<div
class=
"patch-title"
>
按年统计客户销售金额的合理性 -
<PriceSwitch
class=
"rationality"
unit=
""
isObject
:selectList=
"selectList"
@
selectPrice=
"selectRationality"
></PriceSwitch></div>
<div
class=
"patch-title"
>
按年统计客户销售金额的合理性 -
<PriceSwitch
class=
"rationality"
unit=
""
isObject
:selectList=
"selectList"
@
selectPrice=
"selectRationality"
></PriceSwitch></div>
...
@@ -33,6 +40,7 @@
...
@@ -33,6 +40,7 @@
import
BarChart
from
'./BarChart.vue'
import
BarChart
from
'./BarChart.vue'
import
LineChart
from
'./LineCharts.vue'
import
LineChart
from
'./LineCharts.vue'
import
PriceSwitch
from
'./PriceSwitch.vue'
import
PriceSwitch
from
'./PriceSwitch.vue'
import
DoubleBarChart
from
'./DoubleBarChart.vue'
import
{
rationalityList
,
rationalityPriceList
,
serviceList
}
from
'./constant'
import
{
rationalityList
,
rationalityPriceList
,
serviceList
}
from
'./constant'
export
default
{
export
default
{
...
@@ -40,7 +48,8 @@ export default {
...
@@ -40,7 +48,8 @@ export default {
components
:
{
components
:
{
BarChart
,
BarChart
,
LineChart
,
LineChart
,
PriceSwitch
PriceSwitch
,
DoubleBarChart
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -134,6 +143,52 @@ export default {
...
@@ -134,6 +143,52 @@ export default {
flex-direction
:
row
;
flex-direction
:
row
;
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
}
}
.marketing-trend
{
position
:
relative
;
.legend
{
font-size
:
10px
;
display
:
flex
;
position
:
absolute
;
right
:
1.39vw
;
top
:
2.22vh
;
&-item
{
display
:
flex
;
align-items
:
center
;
color
:
#fff
;
margin-right
:
1.67vw
;
&:last-child
{
margin-right
:
0
;
}
img
{
width
:
1.32vw
;
height
:
1vh
;
margin-right
:
0.28vw
;
}
.icon-line
{
width
:
0.98vw
;
height
:
0.56vh
;
}
.legend-even
,
.legend-odd
{
display
:
inline-block
;
width
:
1.83vw
;
height
:
1.33vh
;
line-height
:
1.33vh
;
margin-right
:
0.28vw
;
font-size
:
8px
;
text-align
:
center
;
}
}
.shop
{
.legend-even
{
background-image
:
linear-gradient
(
180deg
,
#22d8ff
0%
,
#5c56ff
100%
);
}
.legend-odd
{
background-image
:
linear-gradient
(
180deg
,
#11627a
0%
,
#282f7a
100%
);
}
}
}
}
.trend-box
{
.trend-box
{
display
:
inline-block
;
display
:
inline-block
;
height
:
23vh
;
height
:
23vh
;
...
...
src/views/solarDetail/index.vue
View file @
eb0aeec
...
@@ -247,7 +247,7 @@ export default {
...
@@ -247,7 +247,7 @@ export default {
},
},
// 获取每个门店的服务中心的采购额和入库情况
// 获取每个门店的服务中心的采购额和入库情况
getMerchantServiceCenter
(
merchantid
)
{
getMerchantServiceCenter
(
merchantid
)
{
this
.
api
.
solar
.
getMerchantServiceCenter
({
year
:
this
.
$store
.
state
.
app
.
solarYear
,
merchantid
:
44208147
}).
then
(
res
=>
{
this
.
api
.
solar
.
getMerchantServiceCenter
({
year
:
this
.
$store
.
state
.
app
.
solarYear
,
merchantid
:
merchantid
}).
then
(
res
=>
{
if
(
!
res
.
code
===
'0'
)
{
if
(
!
res
.
code
===
'0'
)
{
this
.
openMessage
(
'获取每个门店的服务中心的采购额和入库情况失败'
)
this
.
openMessage
(
'获取每个门店的服务中心的采购额和入库情况失败'
)
return
return
...
...
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