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 6f256411
authored
Jul 14, 2023
by
匡雅琴
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
饼图接口联调
1 parent
165aee7c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
74 deletions
src/api/modules/solar.js
src/components/Legend.vue
src/utils/util.js
src/views/home/solar/StorageContent.vue
src/views/home/solar/purchaseProgress.vue
src/views/home/solar/purchasePropertion.vue
src/api/modules/solar.js
View file @
6f25641
...
@@ -50,6 +50,11 @@ const getUsedWarehousing = params => {
...
@@ -50,6 +50,11 @@ const getUsedWarehousing = params => {
return
window
.
$HTTP
.
get
(
'solarfilm/getUsedWarehousing'
,
params
)
return
window
.
$HTTP
.
get
(
'solarfilm/getUsedWarehousing'
,
params
)
}
}
// 总体----获取商品采购进度占比
const
getBugProgress
=
params
=>
{
return
window
.
$HTTP
.
get
(
'solarfilm/getBugProgress'
,
params
)
}
export
default
{
export
default
{
getAllGoodsRatio
,
getAllGoodsRatio
,
getAllOpenBuyTrend
,
getAllOpenBuyTrend
,
...
@@ -59,5 +64,6 @@ export default {
...
@@ -59,5 +64,6 @@ export default {
getMerchantGoodsRatio
,
getMerchantGoodsRatio
,
getMerchantPurchase
,
getMerchantPurchase
,
getMerchantPurchaseTrend
,
getMerchantPurchaseTrend
,
getUsedWarehousing
getUsedWarehousing
,
getBugProgress
}
}
src/components/Legend.vue
View file @
6f25641
...
@@ -11,7 +11,9 @@
...
@@ -11,7 +11,9 @@
<
template
v-else
>
<
template
v-else
>
<div
class=
"flex item-content"
>
<div
class=
"flex item-content"
>
<div
v-show=
"itm.hasIcon"
>
{{
itm
.
hasIcon
}}
</div>
<div
v-show=
"itm.hasIcon"
>
{{
itm
.
hasIcon
}}
</div>
<div>
{{
itm
.
type
==
'number'
?
numAddSymbol
(
item
[
itm
.
name
])
:
item
[
itm
.
name
]
}}
</div>
<div
v-if=
"itm.type == 'number'"
>
{{
numAddSymbol
(
item
[
itm
.
name
])
}}
</div>
<div
v-else-if=
"itm.type == 'decimal'"
>
{{
toPercent
(
item
[
itm
.
name
])
}}
</div>
<div
v-else
>
{{
item
[
itm
.
name
]
}}
</div>
</div>
</div>
</
template
>
</
template
>
</div>
</div>
...
...
src/utils/util.js
View file @
6f25641
...
@@ -29,7 +29,7 @@ Date.prototype.format = function (fmt) {
...
@@ -29,7 +29,7 @@ Date.prototype.format = function (fmt) {
const
throttle
=
(
fn
,
delay
=
1000
)
=>
{
const
throttle
=
(
fn
,
delay
=
1000
)
=>
{
// 距离上一次的执行时间
// 距离上一次的执行时间
let
lastTime
=
0
let
lastTime
=
0
return
function
()
{
return
function
()
{
const
_this
=
this
const
_this
=
this
const
_arguments
=
arguments
const
_arguments
=
arguments
const
now
=
new
Date
().
getTime
()
const
now
=
new
Date
().
getTime
()
...
@@ -134,6 +134,12 @@ const deepClone = obj => {
...
@@ -134,6 +134,12 @@ const deepClone = obj => {
}
}
throw
new
Error
(
"Unable to clone obj! Its type isn't supported."
)
throw
new
Error
(
"Unable to clone obj! Its type isn't supported."
)
}
}
// 数字转百分数
const
toPercent
=
num
=>
{
let
str
=
Number
(
num
).
toFixed
(
0
)
str
+=
'%'
return
str
}
const
utils
=
{
const
utils
=
{
getParams
,
getParams
,
getQuery
,
getQuery
,
...
@@ -146,7 +152,8 @@ const utils = {
...
@@ -146,7 +152,8 @@ const utils = {
getNMonth
,
getNMonth
,
debounce
,
debounce
,
setChartFontSize
,
setChartFontSize
,
deepClone
deepClone
,
toPercent
}
}
Object
.
keys
(
utils
).
map
(
key
=>
{
Object
.
keys
(
utils
).
map
(
key
=>
{
...
...
src/views/home/solar/StorageContent.vue
View file @
6f25641
...
@@ -47,6 +47,7 @@ export default {
...
@@ -47,6 +47,7 @@ export default {
this
.
openMessage
(
'获取所有门店入库失败'
)
this
.
openMessage
(
'获取所有门店入库失败'
)
return
return
}
}
this
.
listData
=
res
.
data
.
dataList
||
[]
})
})
}
}
}
}
...
...
src/views/home/solar/purchaseProgress.vue
View file @
6f25641
...
@@ -7,9 +7,10 @@
...
@@ -7,9 +7,10 @@
<
script
>
<
script
>
import
RightViewContent
from
'./RightViewContent.vue'
import
RightViewContent
from
'./RightViewContent.vue'
import
{
changeMixin
}
from
'@/mixins'
export
default
{
export
default
{
name
:
'PurchaseProgress'
,
name
:
'PurchaseProgress'
,
mixins
:
[
changeMixin
],
components
:
{
components
:
{
RightViewContent
RightViewContent
},
},
...
@@ -19,37 +20,22 @@ export default {
...
@@ -19,37 +20,22 @@ export default {
// 采购进度饼图结构
// 采购进度饼图结构
progressChart
:
{
progressChart
:
{
id
:
'progress'
,
id
:
'progress'
,
keys
:
[
'
isDelivery'
,
'price
'
],
keys
:
[
'
progress'
,
'purchaseamount
'
],
height
:
'15.34vh'
,
height
:
'15.34vh'
,
colors
:
[
'#4FA0FF'
,
'#7CFFB2'
,
'#FDF006'
]
colors
:
[
'#4FA0FF'
,
'#7CFFB2'
,
'#FDF006'
]
},
},
// 采购进度数据
// 采购进度数据
progressData
:
[
progressData
:
[],
{
isDelivery
:
'已发货'
,
per
:
0.36
,
price
:
4568
},
{
isDelivery
:
'未发货'
,
per
:
0.25
,
price
:
4568
},
{
isDelivery
:
'已入库'
,
per
:
0.44
,
price
:
4568
}
],
progressLegend
:
[
progressLegend
:
[
{
{
name
:
'
isDelivery
'
name
:
'
progress
'
},
},
{
{
name
:
'per'
name
:
'rate'
,
type
:
'decimal'
},
},
{
{
name
:
'p
rice
'
,
name
:
'p
urchaseamount
'
,
hasIcon
:
'¥'
,
hasIcon
:
'¥'
,
type
:
'number'
type
:
'number'
}
}
...
@@ -61,9 +47,19 @@ export default {
...
@@ -61,9 +47,19 @@ export default {
methods
:
{
methods
:
{
init
()
{
init
()
{
this
.
getBugProgress
()
},
},
// 获取商品采购进度占比
getBugProgress
()
{
this
.
api
.
solar
.
getBugProgress
({
year
:
2023
}).
then
(
res
=>
{
console
.
log
(
res
,
'000'
)
if
(
!
res
.
code
===
'0'
)
{
this
.
openMessage
(
'获取采购进度占比失败'
)
return
}
this
.
progressData
=
res
.
data
.
dataList
||
[]
})
}
}
}
}
}
</
script
>
</
script
>
...
...
src/views/home/solar/purchasePropertion.vue
View file @
6f25641
<
template
>
<
template
>
<div
class=
"purchase-propertion-box"
>
<div
class=
"purchase-propertion-box"
>
<box-title
title=
"商城采购额商品占比"
></box-title>
<box-title
title=
"商城采购额商品占比"
></box-title>
<RightViewContent
class=
"content-box"
:chart=
"propertionChart"
:listData=
"propertionData"
:legentList=
"propertionLegend"
:legendColors=
"propertion
LegendC
olors"
></RightViewContent>
<RightViewContent
class=
"content-box"
:chart=
"propertionChart"
:listData=
"propertionData"
:legentList=
"propertionLegend"
:legendColors=
"propertion
Chart.c
olors"
></RightViewContent>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
RightViewContent
from
'./RightViewContent.vue'
import
RightViewContent
from
'./RightViewContent.vue'
import
{
changeMixin
}
from
'@/mixins'
export
default
{
export
default
{
name
:
'PurchasePropertion'
,
name
:
'PurchasePropertion'
,
mixins
:
[
changeMixin
],
components
:
{
components
:
{
RightViewContent
RightViewContent
},
},
...
@@ -19,74 +20,51 @@ export default {
...
@@ -19,74 +20,51 @@ export default {
// 采购占比饼图结构
// 采购占比饼图结构
propertionChart
:
{
propertionChart
:
{
id
:
'propertion'
,
id
:
'propertion'
,
keys
:
[
'
name'
,
'per
'
],
keys
:
[
'
goodsname'
,
'purchaseamount
'
],
height
:
'15.34vh'
,
height
:
'15.34vh'
,
colors
:
[
'#16E193'
,
'#747DFF'
,
'#E588FF'
,
'#34AFFF'
,
'#FFC200'
,
'#EB6001'
]
colors
:
[
'#16E193'
,
'#747DFF'
,
'#E588FF'
,
'#34AFFF'
,
'#FFC200'
,
'#EB6001'
]
},
},
// 采购占比数据
// 采购占比数据
propertionData
:
[
propertionData
:
[],
{
name
:
'商品1'
,
per
:
0.36
,
price
:
4568
,
averagePrice
:
668
},
{
name
:
'商品2'
,
per
:
0.2
,
price
:
4568
,
averagePrice
:
668
},
{
name
:
'商品3'
,
per
:
0.16
,
price
:
4568
,
averagePrice
:
668
},
{
name
:
'品1发货'
,
per
:
0.1
,
price
:
4568
,
averagePrice
:
668
},
{
name
:
'商品5'
,
per
:
0.09
,
price
:
4568
,
averagePrice
:
668
},
{
name
:
'商品6'
,
per
:
0.09
,
price
:
4568
,
averagePrice
:
668
}
],
propertionLegend
:
[
propertionLegend
:
[
{
{
name
:
'name'
name
:
'
goods
name'
},
},
{
{
name
:
'per'
name
:
'per'
},
},
{
{
name
:
'p
rice
'
,
name
:
'p
urchaseamount
'
,
hasIcon
:
'¥'
,
hasIcon
:
'¥'
,
type
:
'number'
type
:
'number'
},
},
{
{
name
:
'aver
ageP
rice'
,
name
:
'aver
p
rice'
,
hasIcon
:
'均价¥'
,
hasIcon
:
'均价¥'
,
type
:
'number'
type
:
'number'
}
}
],
],
propertionLegendColors
:
[
'#16E193'
,
'#747DFF'
,
'#E588FF'
,
'#34AFFF'
,
'#FFC200'
,
'#EB6001'
]
}
}
},
},
mounted
()
{},
mounted
()
{},
methods
:
{}
methods
:
{
init
()
{
this
.
getAllGoodsRatio
()
},
// 获取商品采购占比
getAllGoodsRatio
()
{
this
.
api
.
solar
.
getAllGoodsRatio
({
year
:
2023
}).
then
(
res
=>
{
console
.
log
(
res
,
'000'
)
if
(
!
res
.
code
===
'0'
)
{
this
.
openMessage
(
'获取商品采购占比失败'
)
return
}
this
.
propertionData
=
res
.
data
.
dataList
[
0
].
shopgoodsRatioList
||
[]
})
}
}
}
}
</
script
>
</
script
>
...
...
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