Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz-Vue-R7-Res
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7前端标准模板
iBiz-Vue-R7-Res
提交
f1c4e773
提交
f1c4e773
编写于
6月 19, 2020
作者:
tony001
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
首页导航调整
上级
b37ddff1
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
98 行增加
和
31 行删除
+98
-31
app-breadcrumb.vue
src/components/app-breadcrumb/app-breadcrumb.vue
+80
-31
navdata-service.ts
src/service/app/navdata-service.ts
+18
-0
未找到文件。
src/components/app-breadcrumb/app-breadcrumb.vue
浏览文件 @
f1c4e773
<
template
>
<el-breadcrumb
class=
"app-breadcrumb"
separator=
"/"
>
<transition-group
name=
"breadcrumb"
>
<el-breadcrumb-item
v-for=
"(item, index) in breadcrumbs"
:key=
"item.id"
>
<span
v-if=
"index === breadcrumbs.length-1"
class=
"no-redirect"
>
{{
item
.
title
}}
<span
v-if=
"item.isselected === true"
>
<dropdown
trigger=
'click'
@
on-click=
"selectNavData($event,item)"
>
<span
class=
"app-breadcrumb-selected"
>
<i
class=
"el-icon-caret-bottom"
></i>
</span>
<dropdown-menu
slot=
'list'
>
<dropdown-item
v-for=
"(dataitem) in getPreNavData(item)"
:name=
"dataitem.srfkey"
:key=
"dataitem.srfkey"
>
<span
:class=
"
{'curselected':isCurSelected(item,dataitem)}">
{{
dataitem
.
srfmajortext
}}
</span>
</dropdown-item>
</dropdown-menu>
</dropdown>
<template
v-if=
"Object.is(this.navModel,'route')"
>
<el-breadcrumb-item
v-for=
"(item, index) in breadcrumbs"
:key=
"item.id"
>
<span
v-if=
"index === breadcrumbs.length-1"
class=
"no-redirect"
>
{{
item
.
title
}}
<span
v-if=
"item.isselected === true"
>
<dropdown
trigger=
'click'
@
on-click=
"selectNavData($event,item)"
>
<span
class=
"app-breadcrumb-selected"
>
<i
class=
"el-icon-caret-bottom"
></i>
</span>
<dropdown-menu
slot=
'list'
>
<dropdown-item
v-for=
"(dataitem) in getPreNavData(item)"
:name=
"dataitem.srfkey"
:key=
"dataitem.srfkey"
>
<span
:class=
"
{'curselected':isCurSelected(item,dataitem)}">
{{
dataitem
.
srfmajortext
}}
</span>
</dropdown-item>
</dropdown-menu>
</dropdown>
</span>
</span>
</span>
<a
v-else
@
click
.
prevent=
"handleLink(item)"
>
{{
item
.
title
}}
</a>
</el-breadcrumb-item>
<a
v-else
@
click
.
prevent=
"handleLink(item)"
>
{{
item
.
title
}}
</a>
</el-breadcrumb-item>
</
template
>
<
template
v-if=
"!Object.is(this.navModel,'route')"
>
<el-breadcrumb-item
v-for=
"(item, index) in breadcrumbs"
:key=
"item.path"
>
<span
v-if=
"index === breadcrumbs.length-1"
class=
"no-redirect"
>
{{
$t
(
item
.
meta
.
caption
)
}}
</span>
<a
v-else
@
click
.
prevent=
"handleLink(item)"
>
{{
$t
(
item
.
meta
.
caption
)
}}
</a>
</el-breadcrumb-item>
</
template
>
</transition-group>
</el-breadcrumb>
</template>
...
...
@@ -54,6 +62,24 @@ export default class Breadcrumb extends Vue {
*/
@
Prop
()
public
indexViewTag
!
:
string
;
/**
* 导航模式
*
* @memberof Breadcrumb
*/
@
Prop
({
default
:
'tab'
})
public
navModel
?:
string
;
/**
* 监听路由
*
* @memberof Breadcrumb
*/
@
Watch
(
'$route'
)
private
onRouteChange
(
route
:
Route
)
{
this
.
getBreadcrumb
()
}
/**
* 导航服务事件
*
...
...
@@ -70,11 +96,13 @@ export default class Breadcrumb extends Vue {
*/
created
()
{
this
.
getBreadcrumb
();
this
.
serviceStateEvent
=
this
.
navDataService
.
serviceState
.
subscribe
(({
action
,
name
,
data
}:{
action
:
string
,
name
:
any
,
data
:
any
})
=>
{
if
(
Object
.
is
(
action
,
'datarefresh'
))
{
this
.
getBreadcrumb
();
}
});
if
(
Object
.
is
(
this
.
navModel
,
"route"
)){
this
.
serviceStateEvent
=
this
.
navDataService
.
serviceState
.
subscribe
(({
action
,
name
,
data
}:{
action
:
string
,
name
:
any
,
data
:
any
})
=>
{
if
(
Object
.
is
(
action
,
'datarefresh'
))
{
this
.
getBreadcrumb
();
}
});
}
}
/**
...
...
@@ -83,8 +111,14 @@ export default class Breadcrumb extends Vue {
* @memberof Breadcrumb
*/
private
getBreadcrumb
()
{
this
.
breadcrumbs
=
this
.
navDataService
.
getNavData
();
this
.
$forceUpdate
();
if
(
Object
.
is
(
this
.
navModel
,
"route"
)){
this
.
breadcrumbs
=
this
.
navDataService
.
getNavData
();
this
.
$forceUpdate
();
}
else
{
this
.
breadcrumbs
=
this
.
$route
.
matched
.
filter
((
item
)
=>
{
return
item
.
meta
&&
item
.
meta
.
caption
})
}
}
/**
...
...
@@ -112,16 +146,31 @@ export default class Breadcrumb extends Vue {
* @memberof Breadcrumb
*/
private
handleLink
(
item
:
any
)
{
// 首页
if
(
Object
.
is
(
item
.
id
,
this
.
indexViewTag
)){
this
.
$router
.
push
((
window
.
sessionStorage
.
getItem
(
Environment
.
AppName
))
as
string
);
if
(
Object
.
is
(
this
.
navModel
,
"route"
)){
// 首页
if
(
Object
.
is
(
item
.
id
,
this
.
indexViewTag
)){
this
.
$router
.
push
((
window
.
sessionStorage
.
getItem
(
Environment
.
AppName
))
as
string
);
}
else
{
// 非首页
this
.
$router
.
push
(
item
.
path
).
catch
(
err
=>
{
console
.
warn
(
err
);
});
}
this
.
navDataService
.
removeNavData
(
item
.
id
);
}
else
{
// 非首页
this
.
$router
.
push
(
item
.
path
).
catch
(
err
=>
{
console
.
warn
(
err
);
});
if
(
item
&&
item
.
meta
&&
item
.
meta
.
viewType
&&
Object
.
is
(
item
.
meta
.
viewType
,
"APPINDEX"
)){
let
path
:
string
|
null
=
window
.
sessionStorage
.
getItem
(
Environment
.
AppName
);
if
(
path
)
{
this
.
$router
.
push
({
path
:
path
});
}
else
{
this
.
$router
.
push
(
"/"
);
}
}
else
{
this
.
$router
.
push
(
item
).
catch
(
err
=>
{
console
.
warn
(
err
);
});
}
}
this
.
navDataService
.
removeNavData
(
item
.
id
);
}
/**
...
...
src/service/app/navdata-service.ts
浏览文件 @
f1c4e773
...
...
@@ -228,6 +228,24 @@ export default class NavDataService {
}
}
/**
* 从导航数据栈中删除指定数据上层数据(不清除页面缓存)
*
* @memberof NavDataService
*/
public
removeNavDataWithoutCache
(
id
:
string
){
if
(
this
.
navDataStack
.
length
>
0
){
let
tempIndex
:
number
=
this
.
navDataStack
.
findIndex
((
element
:
NavDataElement
)
=>
{
return
Object
.
is
(
element
.
id
,
id
);
})
let
removeNavData
=
this
.
navDataStack
.
splice
(
tempIndex
+
1
);
this
.
sessionStore
.
setItem
(
'srfnavdata'
,
JSON
.
stringify
(
this
.
navDataStack
));
return
removeNavData
;
}
else
{
return
null
;
}
}
/**
* 从导航数据栈中获取指定数据
*
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录