Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-chart-show-h5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-chart-show-h5
Commits
88433498
提交
88433498
authored
3月 26, 2021
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
fb5bd4e4
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
44 行增加
和
19 行删除
+44
-19
.config.dev.js
.config.dev.js
+1
-1
weekIncome.vue
src/components/weekIncome.vue
+43
-18
没有找到文件。
.config.dev.js
浏览文件 @
88433498
module
.
exports
=
{
isHttps
:
false
,
domain
:
'localhost'
,
url
:
'http://
172.16.3.11:8011
/'
,
url
:
'http://
data-view.ezijing.com
/'
,
webpack
:
{
externals
:
{
CKEDITOR
:
'window.CKEDITOR'
,
...
...
src/components/weekIncome.vue
浏览文件 @
88433498
...
...
@@ -5,7 +5,7 @@
<
script
>
import
*
as
api
from
'@/api/index'
export
default
{
name
:
'
MonthIncomeTrend
'
,
name
:
'
WeekIncome
'
,
data
()
{
return
{
loading
:
false
,
...
...
@@ -13,29 +13,52 @@ export default {
}
},
computed
:
{
colors
()
{
return
this
.
$store
.
state
.
colors
},
dataset
()
{
const
dimensions
=
[]
const
source
=
{}
const
legend
=
[]
const
axis
=
[]
const
series
=
[]
this
.
response
.
forEach
(
item
=>
{
if
(
!
dimensions
.
includes
(
item
.
week
))
{
dimensions
.
push
(
item
.
week
)
// 类目
if
(
!
legend
.
includes
(
item
.
project_name
))
{
legend
.
push
(
item
.
project_name
)
}
// X 轴
if
(
!
axis
.
includes
(
item
.
week
))
{
axis
.
push
(
item
.
week
)
}
console
.
log
(
item
.
week
)
if
(
!
source
[
item
.
project_name
])
{
source
[
item
.
project_name
]
=
[]
const
temp
=
{
type
:
'bar'
,
name
:
item
.
project_name
,
stack
:
'total'
,
barWidth
:
20
}
const
currentData
=
{
name
:
item
.
project_name
,
value
:
item
.
pay_money
}
// 去除颜色,显示边框
if
([
'当前周预测'
,
'T+1'
,
'T+2'
].
includes
(
item
.
week
))
{
console
.
log
(
temp
)
temp
.
itemStyle
=
{
color
:
'transparent'
,
borderWidth
:
1
,
borderColor
:
'#000'
}
const
borderColor
=
this
.
colors
[
item
.
project_name
]
||
'#000'
currentData
.
itemStyle
=
{
color
:
'transparent'
,
borderWidth
:
1
,
borderType
:
'dashed'
,
borderColor
}
}
series
.
push
(
temp
)
const
serisItem
=
{
type
:
'bar'
,
name
:
item
.
project_name
,
stack
:
'total'
,
barWidth
:
20
,
data
:
[]
}
const
found
=
series
.
find
(
data
=>
data
.
name
===
item
.
project_name
)
if
(
found
)
{
found
.
data
.
push
(
currentData
)
}
else
{
serisItem
.
data
.
push
(
currentData
)
series
.
push
(
serisItem
)
}
source
[
item
.
project_name
].
push
(
item
.
pay_money
)
})
source
.
product
=
dimensions
return
{
dimensions
,
source
,
series
}
// 统计
const
total
=
axis
.
map
(
week
=>
{
return
this
.
response
.
reduce
((
item
,
result
)
=>
{
if
(
item
.
week
===
week
)
{
result
+=
item
.
pay_money
}
return
result
},
0
)
})
// 统计
series
.
push
({
type
:
'bar'
,
name
:
'total'
,
stack
:
'total'
,
barWidth
:
20
,
data
:
total
})
return
{
legend
,
axis
,
series
}
},
option
()
{
return
{
...
...
@@ -47,18 +70,20 @@ export default {
itemWidth
:
13
,
itemHeight
:
13
,
icon
:
'rect'
,
textStyle
:
{
color
:
'#fff'
,
fontSize
:
16
}
textStyle
:
{
color
:
'#fff'
,
fontSize
:
16
},
data
:
this
.
dataset
.
legend
},
yAxis
:
{
type
:
'value'
,
splitLine
:
{
show
:
false
},
axisLabel
:
{
color
:
'#0A7199'
,
formatter
:
value
=>
value
/
10000
}
axisLabel
:
{
color
:
'#0A7199'
,
width
:
40
,
interval
:
0
,
formatter
:
value
=>
value
/
10000
}
},
xAxis
:
{
type
:
'category'
,
axisTick
:
{
show
:
false
},
axisLine
:
{
show
:
false
},
axisLabel
:
{
color
:
'#0A7199'
}
axisLabel
:
{
color
:
'#0A7199'
,
rotate
:
45
},
data
:
this
.
dataset
.
axis
},
series
:
this
.
dataset
.
series
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论