Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
shld-databoard-ui
Project
Project
Details
Activity
Releases
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
潘自豪 Rambo Pan
shld-databoard-ui
Commits
4169eb02
Commit
4169eb02
authored
Sep 21, 2023
by
潘自豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
营业额明细
parent
a435bee0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
577 additions
and
170 deletions
+577
-170
apiList.js
src/module/api/apiList.js
+17
-2
turnover-detail.vue
src/module/databoard/databoard/turnover-detail.vue
+187
-167
turnoverDetail.js
src/module/databoard/databoard/turnoverDetail.js
+363
-0
numUtil.js
src/module/utils/numUtil.js
+10
-1
No files found.
src/module/api/apiList.js
View file @
4169eb02
...
...
@@ -30,7 +30,7 @@ export const getBusinessConditionDatas = (cur_day) => fetch('/api/query/*/action
//明细页营业额汇月 -汇总
export
const
getBusinessConditionDataByMonth
=
(
cur_day
)
=>
fetch
(
'/api/query/*/action/get_business_condition_datas_by_month'
,
{
aux
:
{
cur_day
:
cur_day
S
cur_day
:
cur_day
}
},
'POST'
);
...
...
@@ -53,3 +53,18 @@ export const arMonthlyBar = () => fetch("/api/query/dash_board/action/get_ar_mon
export
const
arCompanyMonthlyBar
=
(
company
)
=>
fetch
(
"/api/query/dash_board/action/get_ar_company_monthly_bar"
,
{
aux
:
{
company
:
company
}},
"POST"
)
// 开票月份 应收账款(结算单位)
export
const
arMonthlyCompanyBar
=
(
month
)
=>
fetch
(
"/api/query/dash_board/action/get_ar_monthly_company_bar"
,
{
aux
:
{
month
:
month
}},
"POST"
)
//明细页营业额汇月 -汇总
export
const
getAllTypeBusinessConditionDatas
=
(
cur_day
)
=>
fetch
(
'/api/query/*/action/get_all_type_business_condition_datas'
,
{
aux
:
{
cur_day
:
cur_day
}
},
'POST'
);
//明细页各种运输类型营业额明细
export
const
getAllTypeBusinessConditionDetailByDay
=
(
cur_day
)
=>
fetch
(
'/api/query/*/action/get_all_type_business_condition_detail_by_day'
,
{
aux
:
{
cur_day
:
cur_day
}
},
'POST'
);
src/module/databoard/databoard/turnover-detail.vue
View file @
4169eb02
<
template
>
<div
class=
"turnover-detail"
>
<div
class=
"card-board"
>
<contrast-card
v-for=
"data in currentData.head"
style=
"height: 100%;width: 20%;"
@
click
.
native=
"selectLegend(data)"
>
<title-content-mark
style=
"color: #369afa;float: left;width: 40%;font-size: 18px"
:title-style=
"
{'font-weight': 'bold'}" :title="data.title" :content="data.amount" isBold/>
<div
style=
"width: 60%; height: 100%; float:left; padding: 2% 2% 0 8%; line-height: 60px; display: flex; align-items: center;font-size: 16px;"
>
<contrast-card
v-for=
"(data,key) in currentData.head"
style=
"height: 100%;width: 20%;"
@
click
.
native=
"selectLegend(data)"
>
<title-content-mark
style=
"color: #369afa;float: left;width: 40%;font-size: 18px"
:title-style=
"
{'font-weight': 'bold'}" :title="key" :content="data.amount" isBold/>
<div
style=
"width: 60%; height: 100%; float:left; padding: 2% 2% 0 8%; line-height: 60px; display: flex; align-items: center;font-size: 16px;"
>
<table-column
style=
"float: left;width: 25%;"
:data=
"data.hb"
name=
"title"
/>
<table-column
style=
"float: left;width: 40%;"
:data=
"data.hb"
name=
"amount"
/>
<table-column
style=
"float: left;width: 35%;"
:data=
"data.hb"
name=
"rate"
cell-style-js=
"var res =
{color: '#5eeef4'}; if(data.indexOf('+') !== -1){res.color = '#fee064'} res;"/>
<table-column
style=
"float: left;width: 35%;"
:data=
"data.hb"
name=
"rate"
cell-style-js=
"var res =
{color: '#5eeef4'}; if(data.indexOf('+') !== -1){res.color = '#fee064'} res;"/>
</div>
</contrast-card>
</div>
<div
class=
"menu"
>
<input
type=
"button"
:class=
"
{'selectedBtn': currentBtn === 'day'}" value="日统计" @click="changeDimension('day')">
<input
type=
"button"
:class=
"
{'selectedBtn': currentBtn === 'month'}" value="月统计" @click="changeDimension('month')">
<input
type=
"button"
:class=
"
{'selectedBtn': currentBtn === 'year'}" value="年统计" @click="changeDimension('year')">
<input
type=
"button"
:class=
"
{'selectedBtn': currentBtn === 'day'}" value="日统计"
@click="changeDimension('day')">
<input
type=
"button"
:class=
"
{'selectedBtn': currentBtn === 'month'}" value="月统计"
@click="changeDimension('month')">
<input
type=
"button"
:class=
"
{'selectedBtn': currentBtn === 'year'}" value="年统计"
@click="changeDimension('year')">
</div>
<div
class=
"chart"
>
<div
ref=
"chart"
style=
"width: 100%;height: 100%;"
@
click=
""
/>
...
...
@@ -26,16 +33,18 @@ import TitleContentMark from "../components/layout/title-content-mark.vue";
import
TableColumn
from
"../components/table/table-column.vue"
;
import
ContrastCard
from
"../components/card/contrast-card.vue"
;
import
*
as
echarts
from
"echarts"
;
import
{
getTrunOverDayDetail
}
from
"./turnoverDetail"
export
default
{
name
:
"TurnoverDetail"
,
name
:
"TurnoverDetail"
,
components
:
{
ContrastCard
,
TableColumn
,
TitleContentMark
},
data
()
{
return
{
today
:
'2023-05-19'
,
currentData
:
{},
mockDataDay
:{
head
:{
"营业额"
:{
mockDataDay
:
{
head
:
{
"营业额"
:
{
title
:
"营业额"
,
amount
:
"20,303"
,
hb
:
[
...
...
@@ -51,7 +60,7 @@ export default {
}
]
},
"汽运营业额"
:{
"汽运营业额"
:
{
title
:
"汽运营业额"
,
amount
:
"10,000"
,
hb
:
[
...
...
@@ -67,7 +76,7 @@ export default {
}
]
},
"水运营业额"
:{
"水运营业额"
:
{
title
:
"水运营业额"
,
amount
:
"20,303"
,
hb
:
[
...
...
@@ -83,7 +92,7 @@ export default {
}
]
},
"铁运营业额"
:{
"铁运营业额"
:
{
title
:
"铁运营业额"
,
amount
:
"303"
,
hb
:
[
...
...
@@ -100,40 +109,40 @@ export default {
]
}
},
detail
:[
{
date
:
'2月1日'
,
'汽运(元)'
:
0
,
'水运(元)'
:
747
,
'铁运(元)'
:
674
},
{
date
:
'2月2日'
,
'汽运(元)'
:
300
,
'水运(元)'
:
786
,
'铁运(元)'
:
848
},
{
date
:
'2月3日'
,
'汽运(元)'
:
500
,
'水运(元)'
:
547
,
'铁运(元)'
:
256
},
{
date
:
'2月4日'
,
'汽运(元)'
:
100
,
'水运(元)'
:
632
,
'铁运(元)'
:
677
},
{
date
:
'2月5日'
,
'汽运(元)'
:
300
,
'水运(元)'
:
167
,
'铁运(元)'
:
176
},
{
date
:
'2月6日'
,
'汽运(元)'
:
800
,
'水运(元)'
:
264
,
'铁运(元)'
:
584
},
{
date
:
'2月7日'
,
'汽运(元)'
:
100
,
'水运(元)'
:
116
,
'铁运(元)'
:
110
},
{
date
:
'2月8日'
,
'汽运(元)'
:
500
,
'水运(元)'
:
527
,
'铁运(元)'
:
610
},
{
date
:
'2月9日'
,
'汽运(元)'
:
1000
,
'水运(元)'
:
277
,
'铁运(元)'
:
625
},
{
date
:
'2月10日'
,
'汽运(元)'
:
358
,
'水运(元)'
:
854
,
'铁运(元)'
:
775
},
{
date
:
'2月11日'
,
'汽运(元)'
:
290
,
'水运(元)'
:
801
,
'铁运(元)'
:
355
},
{
date
:
'2月12日'
,
'汽运(元)'
:
239
,
'水运(元)'
:
648
,
'铁运(元)'
:
837
},
{
date
:
'2月13日'
,
'汽运(元)'
:
413
,
'水运(元)'
:
375
,
'铁运(元)'
:
175
},
{
date
:
'2月14日'
,
'汽运(元)'
:
379
,
'水运(元)'
:
678
,
'铁运(元)'
:
462
},
{
date
:
'2月15日'
,
'汽运(元)'
:
470
,
'水运(元)'
:
787
,
'铁运(元)'
:
707
},
{
date
:
'2月16日'
,
'汽运(元)'
:
893
,
'水运(元)'
:
507
,
'铁运(元)'
:
645
},
{
date
:
'2月17日'
,
'汽运(元)'
:
544
,
'水运(元)'
:
473
,
'铁运(元)'
:
471
},
{
date
:
'2月18日'
,
'汽运(元)'
:
387
,
'水运(元)'
:
799
,
'铁运(元)'
:
615
},
{
date
:
'2月19日'
,
'汽运(元)'
:
123
,
'水运(元)'
:
942
,
'铁运(元)'
:
988
},
{
date
:
'2月20日'
,
'汽运(元)'
:
795
,
'水运(元)'
:
518
,
'铁运(元)'
:
481
},
{
date
:
'2月21日'
,
'汽运(元)'
:
885
,
'水运(元)'
:
917
,
'铁运(元)'
:
716
},
{
date
:
'2月22日'
,
'汽运(元)'
:
327
,
'水运(元)'
:
682
,
'铁运(元)'
:
947
},
{
date
:
'2月23日'
,
'汽运(元)'
:
599
,
'水运(元)'
:
768
,
'铁运(元)'
:
284
},
{
date
:
'2月24日'
,
'汽运(元)'
:
731
,
'水运(元)'
:
665
,
'铁运(元)'
:
408
},
{
date
:
'2月25日'
,
'汽运(元)'
:
569
,
'水运(元)'
:
150
,
'铁运(元)'
:
358
},
{
date
:
'2月26日'
,
'汽运(元)'
:
642
,
'水运(元)'
:
747
,
'铁运(元)'
:
697
},
{
date
:
'2月27日'
,
'汽运(元)'
:
963
,
'水运(元)'
:
674
,
'铁运(元)'
:
532
},
{
date
:
'2月28日'
,
'汽运(元)'
:
522
,
'水运(元)'
:
273
,
'铁运(元)'
:
587
},
detail
:
[
{
"汽运(元)"
:
0
,
"水运(元)"
:
0
,
"铁运(元)"
:
0
,
"date"
:
"2023-05-06"
},
{
date
:
'2月2日'
,
'汽运(元)'
:
300
,
'水运(元)'
:
786
,
'铁运(元)'
:
848
},
{
date
:
'2月3日'
,
'汽运(元)'
:
500
,
'水运(元)'
:
547
,
'铁运(元)'
:
256
},
{
date
:
'2月4日'
,
'汽运(元)'
:
100
,
'水运(元)'
:
632
,
'铁运(元)'
:
677
},
{
date
:
'2月5日'
,
'汽运(元)'
:
300
,
'水运(元)'
:
167
,
'铁运(元)'
:
176
},
{
date
:
'2月6日'
,
'汽运(元)'
:
800
,
'水运(元)'
:
264
,
'铁运(元)'
:
584
},
{
date
:
'2月7日'
,
'汽运(元)'
:
100
,
'水运(元)'
:
116
,
'铁运(元)'
:
110
},
{
date
:
'2月8日'
,
'汽运(元)'
:
500
,
'水运(元)'
:
527
,
'铁运(元)'
:
610
},
{
date
:
'2月9日'
,
'汽运(元)'
:
1000
,
'水运(元)'
:
277
,
'铁运(元)'
:
625
},
{
date
:
'2月10日'
,
'汽运(元)'
:
358
,
'水运(元)'
:
854
,
'铁运(元)'
:
775
},
{
date
:
'2月11日'
,
'汽运(元)'
:
290
,
'水运(元)'
:
801
,
'铁运(元)'
:
355
},
{
date
:
'2月12日'
,
'汽运(元)'
:
239
,
'水运(元)'
:
648
,
'铁运(元)'
:
837
},
{
date
:
'2月13日'
,
'汽运(元)'
:
413
,
'水运(元)'
:
375
,
'铁运(元)'
:
175
},
{
date
:
'2月14日'
,
'汽运(元)'
:
379
,
'水运(元)'
:
678
,
'铁运(元)'
:
462
},
{
date
:
'2月15日'
,
'汽运(元)'
:
470
,
'水运(元)'
:
787
,
'铁运(元)'
:
707
},
{
date
:
'2月16日'
,
'汽运(元)'
:
893
,
'水运(元)'
:
507
,
'铁运(元)'
:
645
},
{
date
:
'2月17日'
,
'汽运(元)'
:
544
,
'水运(元)'
:
473
,
'铁运(元)'
:
471
},
{
date
:
'2月18日'
,
'汽运(元)'
:
387
,
'水运(元)'
:
799
,
'铁运(元)'
:
615
},
{
date
:
'2月19日'
,
'汽运(元)'
:
123
,
'水运(元)'
:
942
,
'铁运(元)'
:
988
},
{
date
:
'2月20日'
,
'汽运(元)'
:
795
,
'水运(元)'
:
518
,
'铁运(元)'
:
481
},
{
date
:
'2月21日'
,
'汽运(元)'
:
885
,
'水运(元)'
:
917
,
'铁运(元)'
:
716
},
{
date
:
'2月22日'
,
'汽运(元)'
:
327
,
'水运(元)'
:
682
,
'铁运(元)'
:
947
},
{
date
:
'2月23日'
,
'汽运(元)'
:
599
,
'水运(元)'
:
768
,
'铁运(元)'
:
284
},
{
date
:
'2月24日'
,
'汽运(元)'
:
731
,
'水运(元)'
:
665
,
'铁运(元)'
:
408
},
{
date
:
'2月25日'
,
'汽运(元)'
:
569
,
'水运(元)'
:
150
,
'铁运(元)'
:
358
},
{
date
:
'2月26日'
,
'汽运(元)'
:
642
,
'水运(元)'
:
747
,
'铁运(元)'
:
697
},
{
date
:
'2月27日'
,
'汽运(元)'
:
963
,
'水运(元)'
:
674
,
'铁运(元)'
:
532
},
{
date
:
'2月28日'
,
'汽运(元)'
:
522
,
'水运(元)'
:
273
,
'铁运(元)'
:
587
},
]
},
mockDataMonth
:{
head
:{
"营业额"
:{
mockDataMonth
:
{
head
:
{
"营业额"
:
{
title
:
"营业额"
,
amount
:
"20,303"
,
hb
:
[
...
...
@@ -149,7 +158,7 @@ export default {
}
]
},
"汽运营业额"
:{
"汽运营业额"
:
{
title
:
"汽运营业额"
,
amount
:
"10,000"
,
hb
:
[
...
...
@@ -165,7 +174,7 @@ export default {
}
]
},
"水运营业额"
:{
"水运营业额"
:
{
title
:
"水运营业额"
,
amount
:
"20,303"
,
hb
:
[
...
...
@@ -181,7 +190,7 @@ export default {
}
]
},
"铁运营业额"
:{
"铁运营业额"
:
{
title
:
"铁运营业额"
,
amount
:
"303"
,
hb
:
[
...
...
@@ -198,24 +207,24 @@ export default {
]
}
},
detail
:[
{
date
:
'1月'
,
'汽运(元)'
:
544
,
'水运(元)'
:
473
,
'铁运(元)'
:
471
},
{
date
:
'2月'
,
'汽运(元)'
:
387
,
'水运(元)'
:
799
,
'铁运(元)'
:
615
},
{
date
:
'3月'
,
'汽运(元)'
:
123
,
'水运(元)'
:
942
,
'铁运(元)'
:
988
},
{
date
:
'4月'
,
'汽运(元)'
:
795
,
'水运(元)'
:
518
,
'铁运(元)'
:
481
},
{
date
:
'5月'
,
'汽运(元)'
:
885
,
'水运(元)'
:
917
,
'铁运(元)'
:
716
},
{
date
:
'6月'
,
'汽运(元)'
:
327
,
'水运(元)'
:
682
,
'铁运(元)'
:
947
},
{
date
:
'7月'
,
'汽运(元)'
:
599
,
'水运(元)'
:
768
,
'铁运(元)'
:
284
},
{
date
:
'8月'
,
'汽运(元)'
:
731
,
'水运(元)'
:
665
,
'铁运(元)'
:
408
},
{
date
:
'9月'
,
'汽运(元)'
:
569
,
'水运(元)'
:
150
,
'铁运(元)'
:
358
},
{
date
:
'10月'
,
'汽运(元)'
:
642
,
'水运(元)'
:
747
,
'铁运(元)'
:
697
},
{
date
:
'11月'
,
'汽运(元)'
:
963
,
'水运(元)'
:
674
,
'铁运(元)'
:
532
},
{
date
:
'12月'
,
'汽运(元)'
:
522
,
'水运(元)'
:
273
,
'铁运(元)'
:
587
},
detail
:
[
{
date
:
'1月'
,
'汽运(元)'
:
544
,
'水运(元)'
:
473
,
'铁运(元)'
:
471
},
{
date
:
'2月'
,
'汽运(元)'
:
387
,
'水运(元)'
:
799
,
'铁运(元)'
:
615
},
{
date
:
'3月'
,
'汽运(元)'
:
123
,
'水运(元)'
:
942
,
'铁运(元)'
:
988
},
{
date
:
'4月'
,
'汽运(元)'
:
795
,
'水运(元)'
:
518
,
'铁运(元)'
:
481
},
{
date
:
'5月'
,
'汽运(元)'
:
885
,
'水运(元)'
:
917
,
'铁运(元)'
:
716
},
{
date
:
'6月'
,
'汽运(元)'
:
327
,
'水运(元)'
:
682
,
'铁运(元)'
:
947
},
{
date
:
'7月'
,
'汽运(元)'
:
599
,
'水运(元)'
:
768
,
'铁运(元)'
:
284
},
{
date
:
'8月'
,
'汽运(元)'
:
731
,
'水运(元)'
:
665
,
'铁运(元)'
:
408
},
{
date
:
'9月'
,
'汽运(元)'
:
569
,
'水运(元)'
:
150
,
'铁运(元)'
:
358
},
{
date
:
'10月'
,
'汽运(元)'
:
642
,
'水运(元)'
:
747
,
'铁运(元)'
:
697
},
{
date
:
'11月'
,
'汽运(元)'
:
963
,
'水运(元)'
:
674
,
'铁运(元)'
:
532
},
{
date
:
'12月'
,
'汽运(元)'
:
522
,
'水运(元)'
:
273
,
'铁运(元)'
:
587
},
]
},
mockDataYear
:{
head
:{
"营业额"
:
{
mockDataYear
:
{
head
:
{
"营业额"
:
{
title
:
"营业额"
,
amount
:
"20,303"
,
hb
:
[
...
...
@@ -226,7 +235,7 @@ export default {
},
]
},
"汽运营业额"
:
{
"汽运营业额"
:
{
title
:
"汽运营业额"
,
amount
:
"10,000"
,
hb
:
[
...
...
@@ -237,7 +246,7 @@ export default {
},
]
},
"水运营业额"
:
{
"水运营业额"
:
{
title
:
"水运营业额"
,
amount
:
"20,303"
,
hb
:
[
...
...
@@ -248,7 +257,7 @@ export default {
},
]
},
"铁运营业额"
:
{
"铁运营业额"
:
{
title
:
"铁运营业额"
,
amount
:
"303"
,
hb
:
[
...
...
@@ -260,15 +269,15 @@ export default {
]
}
},
detail
:[
{
date
:
'2022年'
,
'汽运(元)'
:
544
,
'水运(元)'
:
674
,
'铁运(元)'
:
532
},
{
date
:
'2023年'
,
'汽运(元)'
:
387
,
'水运(元)'
:
273
,
'铁运(元)'
:
587
},
detail
:
[
{
date
:
'2022年'
,
'汽运(元)'
:
544
,
'水运(元)'
:
674
,
'铁运(元)'
:
532
},
{
date
:
'2023年'
,
'汽运(元)'
:
387
,
'水运(元)'
:
273
,
'铁运(元)'
:
587
},
]
},
chart
:
null
,
currentBtn
:
"day"
,
currentLegend
:
'汽运(元)'
,
chartOption
:{
chartOption
:
{
legend
:
{
textStyle
:
{
color
:
'white'
...
...
@@ -344,7 +353,7 @@ export default {
this
.
chart
.
resize
();
}
},
changeDimension
(
dimension
){
changeDimension
(
dimension
)
{
this
.
currentBtn
=
dimension
;
switch
(
dimension
)
{
case
'day'
:
...
...
@@ -363,13 +372,13 @@ export default {
return
;
}
},
refreshChart
(){
refreshChart
()
{
this
.
chartOption
.
dataset
.
source
=
this
.
currentData
.
detail
if
(
this
.
chart
){
if
(
this
.
chart
)
{
this
.
chart
.
setOption
(
this
.
chartOption
);
}
},
selectLegend
(
data
){
selectLegend
(
data
)
{
let
name
;
this
.
chart
.
dispatchAction
({
type
:
'legendAllSelect'
...
...
@@ -389,7 +398,7 @@ export default {
default
:
break
;
}
if
(
name
){
if
(
name
)
{
this
.
chart
.
dispatchAction
({
type
:
'legendInverseSelect'
});
...
...
@@ -397,57 +406,66 @@ export default {
type
:
'legendSelect'
,
name
:
name
})
this
.
chartOption
.
series
[
3
].
encode
=
{
x
:
'date'
,
y
:
name
};
this
.
chartOption
.
series
[
3
].
encode
=
{
x
:
'date'
,
y
:
name
};
this
.
chartOption
.
series
[
3
].
data
=
undefined
;
}
else
{
}
else
{
this
.
chartOption
.
series
[
3
].
data
=
[];
}
this
.
chart
.
setOption
(
this
.
chartOption
);
},
//获取数据
async
getDate
()
{
this
.
currentData
=
await
getTrunOverDayDetail
(
"yye"
,
this
.
today
)
},
mounted
()
{
this
.
currentData
=
this
.
mockDataDay
;
},
async
mounted
()
{
console
.
log
(
"mockDataDay:"
+
JSON
.
stringify
(
this
.
mockDataDay
))
await
this
.
getDate
();
// this.currentData = this.mockDataDay;
this
.
refreshChart
();
setTimeout
(()
=>
{
let
chartDom
=
this
.
$refs
.
chart
;
this
.
chart
=
echarts
.
init
(
chartDom
);
this
.
chart
.
setOption
(
this
.
chartOption
);
window
.
addEventListener
(
'resize'
,
this
.
resizeChart
);
},
500
)
},
500
)
;
},
beforeDestroy
()
{
window
.
removeEventListener
(
"resize"
,
this
.
resizeChart
);
},
props
:{
},
props
:
{},
}
</
script
>
<
style
scoped
>
.turnover-detail
{
.turnover-detail
{
width
:
100%
;
height
:
100%
;
}
.card-board
{
.card-board
{
width
:
100%
;
height
:
25%
;
display
:
flex
;
justify-content
:
space-between
;
padding
:
2rem
;
}
.menu
{
.menu
{
width
:
100%
;
height
:
5%
;
display
:
flex
;
align-items
:
center
;
padding-left
:
5%
;
}
.chart
{
.chart
{
width
:
100%
;
height
:
70%
;
}
input
[
type
=
"button"
]
{
input
[
type
=
"button"
]
{
height
:
80%
;
margin
:
0.5%
;
border
:
none
;
...
...
@@ -457,11 +475,13 @@ input[type="button"]{
color
:
#00c8d6
;
background-color
:
#1234a1
;
}
.selectedBtn
{
.selectedBtn
{
color
:
#1234a1
!important
;
background-color
:
#00c8d6
!important
;
}
.unSelectedBtn
{
.unSelectedBtn
{
color
:
#00c8d6
;
background-color
:
#1234a1
;
}
...
...
src/module/databoard/databoard/turnoverDetail.js
0 → 100644
View file @
4169eb02
import
{
getBusinessConditionDatas
,
getAllTypeBusinessConditionDatas
,
getAllTypeBusinessConditionDetailByDay
}
from
"../../api/apiList"
;
import
{
calc_hb_str
,
calc_tb_str
,
conver_amont
}
from
"../../utils/numUtil"
;
import
moment
from
'moment'
//天维度数据转换
export
const
getTrunOverDayDetail
=
async
function
(
type
,
cur_day
)
{
let
pageData
=
new
Object
();
pageData
.
head
=
await
getHeadDay
(
type
,
cur_day
)
pageData
.
detail
=
await
getDetailDay
(
type
,
cur_day
)
console
.
log
(
"pageData:"
+
JSON
.
stringify
(
pageData
))
return
pageData
;
};
/**
* @param cur_day
*/
export
const
getHeadDay
=
async
function
(
type
,
cur_day
)
{
let
headData
=
new
Object
();
let
res
=
await
reqSumData
(
cur_day
);
headData
.
营业额
=
adapterSumDataDay
(
type
,
res
);
let
transportData
=
await
reqTransportData
(
cur_day
)
headData
.
汽运营业额
=
initSumDataDay
();
headData
.
水运营业额
=
initSumDataDay
();
headData
.
铁运营业额
=
initSumDataDay
();
if
(
transportData
[
10
])
{
headData
.
汽运营业额
=
adapterSumDataDay
(
type
,
transportData
[
10
]);
}
if
(
transportData
[
30
])
{
headData
.
水运营业额
=
adapterSumDataDay
(
type
,
transportData
[
30
]);
}
if
(
transportData
[
20
])
{
headData
.
铁运营业额
=
adapterSumDataDay
(
type
,
transportData
[
20
]);
}
return
headData
;
};
//获取折线图明细
export
const
getDetailDay
=
async
function
(
type
,
cur_day
)
{
let
transportDetail
=
await
reqTransportDetailDayData
(
cur_day
)
return
adapterDetailDataDay
(
type
,
transportDetail
)
};
//获取汇总数据
export
const
reqSumData
=
async
function
(
cur_day
)
{
let
res
=
await
getBusinessConditionDatas
(
cur_day
);
let
data
=
res
.
data
return
data
;
}
//获取汇总数据
export
const
reqTransportData
=
async
function
(
cur_day
)
{
let
res
=
await
getAllTypeBusinessConditionDatas
(
cur_day
);
let
data
=
res
.
data
return
data
;
}
//获取明细数据数据
export
const
reqTransportDetailDayData
=
async
function
(
cur_day
)
{
let
res
=
await
getAllTypeBusinessConditionDetailByDay
(
moment
(
cur_day
).
format
(
'YYYY-MM'
));
let
data
=
res
.
data
return
data
;
}
/**
*日维度汇总
* @param type yye:营业额、cb:成本、ml:毛利
* @param data
*/
export
const
adapterSumDataDay
=
function
(
type
,
data
)
{
let
turnOver
=
new
Object
()
let
hb
=
new
Array
()
if
(
type
==
'yye'
)
{
turnOver
.
title
=
'营业额'
turnOver
.
amount
=
conver_amont
(
data
.
cur_sell_settle_amount
);
//昨日环比
if
(
data
.
pre_sell_settle_amount
)
{
let
yesterday
=
new
Object
()
yesterday
.
title
=
'昨日'
yesterday
.
amount
=
conver_amont
(
data
.
pre_sell_settle_amount
);
yesterday
.
rate
=
calc_hb_str
(
data
.
cur_sell_settle_amount
,
data
.
pre_sell_settle_amount
);
hb
.
push
(
yesterday
)
}
//昨日环比
if
(
data
.
pre_month_sell_settle_amount
)
{
let
premonth
=
new
Object
()
premonth
.
title
=
'上月'
premonth
.
amount
=
conver_amont
(
data
.
pre_month_sell_settle_amount
);
premonth
.
rate
=
calc_tb_str
(
data
.
cur_sell_settle_amount
,
data
.
pre_month_sell_settle_amount
);
hb
.
push
(
premonth
)
}
turnOver
.
hb
=
hb
;
}
if
(
type
==
'cb'
)
{
turnOver
.
title
=
'成本'
turnOver
.
amount
=
conver_amont
(
data
.
cur_buy_settle_amount
);
//昨日环比
if
(
data
.
pre_buy_settle_amount
)
{
let
yesterday
=
new
Object
()
yesterday
.
title
=
'昨日'
yesterday
.
amount
=
conver_amont
(
data
.
pre_buy_settle_amount
);
yesterday
.
rate
=
calc_hb_str
(
data
.
cur_buy_settle_amount
,
data
.
pre_buy_settle_amount
);
hb
.
push
(
yesterday
)
}
//昨日环比
if
(
data
.
pre_month_buy_settle_amount
)
{
let
premonth
=
new
Object
()
premonth
.
title
=
'上月'
premonth
.
amount
=
conver_amont
(
data
.
pre_month_buy_settle_amount
);
premonth
.
rate
=
calc_tb_str
(
data
.
cur_buy_settle_amount
,
data
.
pre_month_buy_settle_amount
);
hb
.
push
(
premonth
)
}
turnOver
.
hb
=
hb
;
}
if
(
type
==
'ml'
)
{
turnOver
.
title
=
'毛利'
turnOver
.
amount
=
conver_amont
(
data
.
cur_gross_profit_amount
);
//昨日环比
if
(
data
.
pre_gross_profit_amount
)
{
let
yesterday
=
new
Object
()
yesterday
.
title
=
'昨日'
yesterday
.
amount
=
conver_amont
(
data
.
pre_gross_profit_amount
);
yesterday
.
rate
=
calc_hb_str
(
data
.
cur_gross_profit_amount
,
data
.
pre_gross_profit_amount
);
hb
.
push
(
yesterday
)
}
//昨日环比
if
(
data
.
pre_month_gross_profit_amount
)
{
let
premonth
=
new
Object
()
premonth
.
title
=
'上月'
premonth
.
amount
=
conver_amont
(
data
.
pre_month_gross_profit_amount
);
premonth
.
rate
=
calc_tb_str
(
data
.
cur_gross_profit_amount
,
data
.
pre_month_gross_profit_amount
);
hb
.
push
(
premonth
)
}
turnOver
.
hb
=
hb
;
}
return
turnOver
;
}
/**
* 初始化汇总数据
* @returns {Object}
*/
export
const
initSumDataDay
=
function
()
{
let
turnOver
=
new
Object
()
turnOver
.
title
=
'营业额'
turnOver
.
amount
=
"0.0"
let
hb
=
new
Array
()
let
yesterday
=
new
Object
()
yesterday
.
title
=
'昨日'
yesterday
.
amount
=
"0.0"
yesterday
.
rate
=
"0.0"
hb
.
push
(
yesterday
)
yesterday
=
new
Object
()
yesterday
.
title
=
'上月'
yesterday
.
amount
=
"0.0"
yesterday
.
rate
=
"0.0"
hb
.
push
(
yesterday
)
turnOver
.
hb
=
hb
return
turnOver
;
}
/**
* 月维度汇总
* @param type
* @param data
*/
export
const
adapterSumDatamonth
=
function
(
type
,
data
)
{
let
turnOver
=
new
Object
()
let
hb
=
new
Array
()
if
(
type
==
'yye'
)
{
turnOver
.
title
=
'营业额'
turnOver
.
amount
=
conver_amont
(
data
.
cur_month_buy_settle_amount
);
//昨日环比
if
(
data
.
pre_month_sell_settle_amount
)
{
let
yesterday
=
new
Object
()
yesterday
.
title
=
'上月'
yesterday
.
amount
=
conver_amont
(
data
.
pre_month_sell_settle_amount
);
yesterday
.
rate
=
calc_hb_str
(
data
.
cur_month_buy_settle_amount
,
data
.
pre_month_sell_settle_amount
);
hb
.
push
(
yesterday
)
}
//昨日环比
if
(
data
.
pre_year_sell_settle_amount
)
{
let
premonth
=
new
Object
()
premonth
.
title
=
'去年'
premonth
.
amount
=
conver_amont
(
data
.
pre_year_sell_settle_amount
);
premonth
.
rate
=
calc_tb_str
(
data
.
cur_sell_settle_amount
,
data
.
pre_year_sell_settle_amount
);
hb
.
push
(
premonth
)
}
turnOver
.
hb
=
hb
;
}
if
(
type
==
'cb'
)
{
turnOver
.
title
=
'成本'
turnOver
.
amount
=
conver_amont
(
data
.
cur_month_buy_settle_amount
);
//上月环比
if
(
data
.
pre_month_buy_settle_amount
)
{
let
yesterday
=
new
Object
()
yesterday
.
title
=
'上月'
yesterday
.
amount
=
conver_amont
(
data
.
pre_month_buy_settle_amount
);
yesterday
.
rate
=
calc_hb_str
(
data
.
cur_month_buy_settle_amount
,
data
.
pre_month_buy_settle_amount
);
hb
.
push
(
yesterday
)
}
//去年环比
if
(
data
.
pre_year_buy_settle_amount
)
{
let
premonth
=
new
Object
()
premonth
.
title
=
'去年'
premonth
.
amount
=
conver_amont
(
data
.
pre_year_buy_settle_amount
);
premonth
.
rate
=
calc_tb_str
(
data
.
cur_month_buy_settle_amount
,
data
.
pre_year_buy_settle_amount
);
hb
.
push
(
premonth
)
}
turnOver
.
hb
=
hb
;
}
if
(
type
==
'ml'
)
{
turnOver
.
title
=
'毛利'
turnOver
.
amount
=
conver_amont
(
data
.
cur_month_gross_profit_amount
);
//昨日环比
if
(
data
.
pre_month_gross_profit_amount
)
{
let
yesterday
=
new
Object
()
yesterday
.
title
=
'上月'
yesterday
.
amount
=
conver_amont
(
data
.
pre_month_gross_profit_amount
);
yesterday
.
rate
=
calc_hb_str
(
data
.
cur_month_gross_profit_amount
,
data
.
pre_month_gross_profit_amount
);
hb
.
push
(
yesterday
)
}
//昨日环比
if
(
data
.
pre_year_gross_profit_amount
)
{
let
premonth
=
new
Object
()
premonth
.
title
=
'去年'
premonth
.
amount
=
conver_amont
(
data
.
pre_year_gross_profit_amount
);
premonth
.
rate
=
calc_tb_str
(
data
.
cur_month_gross_profit_amount
,
data
.
pre_year_gross_profit_amount
);
hb
.
push
(
premonth
)
}
turnOver
.
hb
=
hb
;
}
}
/**
* 月维度汇总
* @param type
* @param data
*/
export
const
adapterSumDataYear
=
function
(
type
,
data
)
{
let
turnOver
=
new
Object
()
let
hb
=
new
Array
()
if
(
type
==
'yye'
)
{
turnOver
.
title
=
'营业额'
turnOver
.
amount
=
conver_amont
(
data
.
cur_year_sell_settle_amount
);
//昨日环比
if
(
data
.
pre_year_sell_settle_amount
)
{
let
yesterday
=
new
Object
()
yesterday
.
title
=
'去年'
yesterday
.
amount
=
conver_amont
(
data
.
pre_year_sell_settle_amount
);
yesterday
.
rate
=
calc_hb_str
(
data
.
cur_year_sell_settle_amount
,
data
.
pre_year_sell_settle_amount
);
hb
.
push
(
yesterday
)
}
turnOver
.
hb
=
hb
;
}
if
(
type
==
'cb'
)
{
turnOver
.
title
=
'成本'
turnOver
.
amount
=
conver_amont
(
data
.
cur_year_buy_settle_amount
);
//上月环比
if
(
data
.
pre_year_buy_settle_amount
)
{
let
yesterday
=
new
Object
()
yesterday
.
title
=
'去年'
yesterday
.
amount
=
conver_amont
(
data
.
pre_year_buy_settle_amount
);
yesterday
.
rate
=
calc_hb_str
(
data
.
cur_year_buy_settle_amount
,
data
.
pre_year_buy_settle_amount
);
hb
.
push
(
yesterday
)
}
turnOver
.
hb
=
hb
;
}
if
(
type
==
'ml'
)
{
turnOver
.
title
=
'毛利'
turnOver
.
amount
=
conver_amont
(
data
.
cur_year_gross_profit_amount
);
//昨日环比
if
(
data
.
pre_year_gross_profit_amount
)
{
let
yesterday
=
new
Object
()
yesterday
.
title
=
'去年'
yesterday
.
amount
=
conver_amont
(
data
.
pre_year_gross_profit_amount
);
yesterday
.
rate
=
calc_hb_str
(
data
.
cur_year_gross_profit_amount
,
data
.
pre_year_gross_profit_amount
);
hb
.
push
(
yesterday
)
}
turnOver
.
hb
=
hb
;
}
}
/**
* 详细数据匹配
* @param type
* @param data
* @returns {any[]}
*/
export
const
adapterDetailDataDay
=
function
(
type
,
data
)
{
let
list
=
new
Array
()
let
detail
=
null
for
(
let
key
in
data
)
{
detail
=
detailConver
(
type
,
data
[
key
])
detail
.
date
=
moment
(
key
).
format
(
'MM月DD日'
);
list
.
push
(
detail
);
}
return
list
;
}
/**
* 详细数据转换
* @param type
* @param detailList
* @returns {Object}
*/
export
const
detailConver
=
function
(
type
,
detailList
)
{
let
detail
=
initDetail
();
console
.
log
(
typeof
detailList
)
for
(
let
det
in
detailList
)
{
let
data
=
detailList
[
det
]
//初始化
if
(
type
==
'yye'
)
{
if
(
data
.
cur_transport_type
==
'10'
)
{
detail
[
'汽运(元)'
]
=
data
.
cur_sell_settle_amount
;
}
if
(
data
.
cur_transport_type
==
'30'
)
{
detail
[
'水运(元)'
]
=
data
.
cur_sell_settle_amount
}
if
(
data
.
cur_transport_type
==
'20'
)
{
detail
[
'铁运(元)'
]
=
data
.
cur_sell_settle_amount
}
}
if
(
type
==
'cb'
)
{
if
(
data
.
cur_transport_type
==
'10'
)
{
detail
[
'汽运(元)'
]
=
data
.
cur_buy_settle_amount
}
if
(
data
.
cur_transport_type
==
'30'
)
{
detail
[
'水运(元)'
]
=
data
.
cur_buy_settle_amount
}
if
(
data
.
cur_transport_type
==
'20'
)
{
detail
[
'铁运(元)'
]
=
data
.
cur_buy_settle_amount
}
}
if
(
type
==
'ml'
)
{
if
(
data
.
cur_transport_type
==
'10'
)
{
detail
[
'汽运(元)'
]
=
data
.
cur_gross_profit_amount
}
if
(
data
.
cur_transport_type
==
'30'
)
{
detail
[
'水运(元)'
]
=
data
.
cur_gross_profit_amount
}
if
(
data
.
cur_transport_type
==
'20'
)
{
detail
[
'铁运(元)'
]
=
data
.
cur_gross_profit_amount
}
}
}
return
detail
;
}
/**
* @returns {{}}
*/
export
const
initDetail
=
function
()
{
let
detail
=
{};
detail
[
'汽运(元)'
]
=
0
detail
[
'水运(元)'
]
=
0
detail
[
'铁运(元)'
]
=
0
return
detail
;
}
src/module/utils/numUtil.js
View file @
4169eb02
...
...
@@ -18,10 +18,19 @@ export const conver_num_rate = function (amont) {
if
(
amont
>
0
)
{
return
"+"
+
amont
+
"%"
}
else
{
return
"-"
+
amont
+
"%"
return
amont
+
"%"
}
};
/**
* 保留两位小数
* @param amont
* @returns {string|*}
*/
export
const
conver_num_retain
=
function
(
amont
)
{
return
formater
(
amont
)
}
//数字金额显示
function
formater
(
data
)
{
...
...
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