Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
b4e493cc
提交
b4e493cc
authored
1月 07, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(competitor): 竞品分析-tab 切换导致 ECharts 的大小不对
初始化的时候获取外层容器的宽度设置,高度固定
上级
c9a2a993
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
51 行增加
和
80 行删除
+51
-80
LineAndBar.vue
src/views/bi/competitor/cmm/LineAndBar.vue
+15
-4
GradientArea.vue
src/views/bi/competitor/components/GradientArea.vue
+24
-17
index.vue
src/views/bi/competitor/index.vue
+12
-3
resize.js
src/views/dashboard/mixins/resize.js
+0
-56
没有找到文件。
src/views/bi/competitor/cmm/LineAndBar.vue
浏览文件 @
b4e493cc
...
@@ -179,12 +179,23 @@ watchEffect(() => {
...
@@ -179,12 +179,23 @@ watchEffect(() => {
onMounted
(()
=>
{
onMounted
(()
=>
{
nextTick
(()
=>
{
nextTick
(()
=>
{
chart
.
value
=
echarts
.
init
(
echartsRef
.
value
)
chart
.
value
=
echarts
.
init
(
echartsRef
.
value
,
null
,
{
width
:
document
.
querySelector
(
'.el-tabs__content'
).
offsetWidth
+
'px'
,
height
:
props
.
height
})
})
})
})
})
useWindowResize
(()
=>
{
chart
.
value
.
resize
()
const
resize
=
()
=>
{
})
chart
.
value
.
resize
({
width
:
document
.
querySelector
(
'.el-tabs__content'
).
offsetWidth
+
'px'
,
height
:
props
.
height
})
}
const
injectMessage
=
inject
(
'activeName'
)
watch
(
injectMessage
,
resize
)
useWindowResize
(
resize
)
onBeforeUnmount
(()
=>
{
onBeforeUnmount
(()
=>
{
if
(
!
chart
.
value
)
{
if
(
!
chart
.
value
)
{
...
...
src/views/bi/competitor/components/GradientArea.vue
浏览文件 @
b4e493cc
...
@@ -42,7 +42,7 @@ const setOptions = () => {
...
@@ -42,7 +42,7 @@ const setOptions = () => {
// 面积图是否切换
// 面积图是否切换
const
seriesResult
=
props
.
chartData
.
series
.
map
(
o
=>
{
const
seriesResult
=
props
.
chartData
.
series
.
map
(
o
=>
{
if
(
!
isArea
.
value
)
{
if
(
!
isArea
.
value
)
{
const
obj
=
{
...
o
}
const
obj
=
{
...
o
}
delete
obj
.
areaStyle
delete
obj
.
areaStyle
delete
obj
.
lineStyle
delete
obj
.
lineStyle
return
obj
return
obj
...
@@ -93,14 +93,6 @@ const setOptions = () => {
...
@@ -93,14 +93,6 @@ const setOptions = () => {
magicType
:
{
magicType
:
{
type
:
[
'stack'
,
'tiled'
]
// 切换图表类型
type
:
[
'stack'
,
'tiled'
]
// 切换图表类型
},
},
myTool1
:
{
show
:
true
,
title
:
'切换表格'
,
icon
:
'path://M5,5 L5,15 L15,15 L15,5 Z M20,5 L20,15 L30,15 L30,5 Z M5,20 L5,30 L15,30 L15,20 Z M20,20 L20,30 L30,30 L30,20 Z'
,
onclick
:
()
=>
{
emits
(
'changeType'
,
'table'
)
}
},
myTool2
:
{
myTool2
:
{
show
:
true
,
show
:
true
,
title
:
'面积/折线图'
,
title
:
'面积/折线图'
,
...
@@ -108,6 +100,14 @@ const setOptions = () => {
...
@@ -108,6 +100,14 @@ const setOptions = () => {
onclick
:
()
=>
{
onclick
:
()
=>
{
isArea
.
value
=
!
isArea
.
value
isArea
.
value
=
!
isArea
.
value
}
}
},
myTool1
:
{
show
:
true
,
title
:
'切换表格'
,
icon
:
'path://M5,5 L5,15 L15,15 L15,5 Z M20,5 L20,15 L30,15 L30,5 Z M5,20 L5,30 L15,30 L15,20 Z M20,20 L20,30 L30,30 L30,20 Z'
,
onclick
:
()
=>
{
emits
(
'changeType'
,
'table'
)
}
}
}
}
}
},
},
...
@@ -141,21 +141,28 @@ watchEffect(() => {
...
@@ -141,21 +141,28 @@ watchEffect(() => {
setOptions
()
setOptions
()
})
})
const
initChart
=
()
=>
{
chart
.
value
=
echarts
.
init
(
echartsRef
.
value
)
}
const
resize
=
()
=>
{
chart
.
value
.
resize
()
}
useWindowResize
(
resize
)
onMounted
(()
=>
{
onMounted
(()
=>
{
nextTick
(()
=>
{
nextTick
(()
=>
{
initChart
()
chart
.
value
=
echarts
.
init
(
echartsRef
.
value
,
null
,
{
width
:
document
.
querySelector
(
'.el-tabs__content'
).
offsetWidth
+
'px'
,
height
:
props
.
height
})
})
})
})
})
const
resize
=
()
=>
{
chart
.
value
.
resize
({
width
:
document
.
querySelector
(
'.el-tabs__content'
).
offsetWidth
+
'px'
,
height
:
props
.
height
})
}
const
injectMessage
=
inject
(
'activeName'
)
watch
(
injectMessage
,
resize
)
useWindowResize
(
resize
)
onBeforeUnmount
(()
=>
{
onBeforeUnmount
(()
=>
{
if
(
!
chart
.
value
)
{
if
(
!
chart
.
value
)
{
return
return
...
...
src/views/bi/competitor/index.vue
浏览文件 @
b4e493cc
...
@@ -4,9 +4,10 @@
...
@@ -4,9 +4,10 @@
class=
"tabs"
>
class=
"tabs"
>
<el-tab-pane
v-for=
"item in list"
<el-tab-pane
v-for=
"item in list"
:label=
"item.name"
:label=
"item.name"
:name=
"item.name"
:name=
"item.name"
>
lazy
>
<keep-alive>
<component
:is=
"item.component"
></component>
<component
:is=
"item.component"
></component>
</keep-alive>
</el-tab-pane>
</el-tab-pane>
</el-tabs>
</el-tabs>
</div>
</div>
...
@@ -23,6 +24,7 @@ const list = ref([
...
@@ -23,6 +24,7 @@ const list = ref([
{
name
:
'生意参谋-竞品'
,
component
:
shallowRef
(
sycmPrd
)
}
{
name
:
'生意参谋-竞品'
,
component
:
shallowRef
(
sycmPrd
)
}
])
])
const
activeName
=
ref
(
list
.
value
[
0
].
name
)
const
activeName
=
ref
(
list
.
value
[
0
].
name
)
provide
(
'activeName'
,
activeName
);
</
script
>
</
script
>
<
style
scoped
<
style
scoped
...
@@ -34,6 +36,7 @@ const activeName = ref(list.value[0].name)
...
@@ -34,6 +36,7 @@ const activeName = ref(list.value[0].name)
padding
:
20px
;
padding
:
20px
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
width
:
100%
;
::v-deep
(
.el-tabs__content
)
{
::v-deep
(
.el-tabs__content
)
{
flex
:
1
;
flex
:
1
;
...
@@ -51,12 +54,18 @@ const activeName = ref(list.value[0].name)
...
@@ -51,12 +54,18 @@ const activeName = ref(list.value[0].name)
flex
:
1
;
flex
:
1
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
width
:
100%
;
.chart_wrap
{
.chart_wrap
{
flex
:
1
;
flex
:
1
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
justify-content
:
space-around
;
justify-content
:
space-around
;
width
:
100%
;
.chart
{
flex
:
1
;
}
}
}
}
}
}
}
...
...
src/views/dashboard/mixins/resize.js
deleted
100644 → 0
浏览文件 @
c9a2a993
import
{
debounce
}
from
'@/utils'
export
default
{
data
()
{
return
{
$_sidebarElm
:
null
,
$_resizeHandler
:
null
}
},
mounted
()
{
this
.
initListener
()
},
activated
()
{
if
(
!
this
.
$_resizeHandler
)
{
// avoid duplication init
this
.
initListener
()
}
// when keep-alive chart activated, auto resize
this
.
resize
()
},
beforeDestroy
()
{
this
.
destroyListener
()
},
deactivated
()
{
this
.
destroyListener
()
},
methods
:
{
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
$_sidebarResizeHandler
(
e
)
{
if
(
e
.
propertyName
===
'width'
)
{
this
.
$_resizeHandler
()
}
},
initListener
()
{
this
.
$_resizeHandler
=
debounce
(()
=>
{
this
.
resize
()
},
100
)
window
.
addEventListener
(
'resize'
,
this
.
$_resizeHandler
)
this
.
$_sidebarElm
=
document
.
getElementsByClassName
(
'sidebar-container'
)[
0
]
this
.
$_sidebarElm
&&
this
.
$_sidebarElm
.
addEventListener
(
'transitionend'
,
this
.
$_sidebarResizeHandler
)
},
destroyListener
()
{
window
.
removeEventListener
(
'resize'
,
this
.
$_resizeHandler
)
this
.
$_resizeHandler
=
null
this
.
$_sidebarElm
&&
this
.
$_sidebarElm
.
removeEventListener
(
'transitionend'
,
this
.
$_sidebarResizeHandler
)
},
resize
()
{
const
{
chart
}
=
this
chart
&&
chart
.
resize
()
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论