Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pda-ui
Project
Project
Details
Activity
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
pda
pda-ui
Commits
f8046a21
Commit
f8046a21
authored
Jun 18, 2024
by
沈翠玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
切换页签保存数据
parent
1bc7bdb0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
6 deletions
+50
-6
SidebarItem.vue
src/layout/components/Sidebar/SidebarItem.vue
+19
-1
permission.js
src/store/modules/permission.js
+31
-4
index.vue
src/views/mes/pro/combination/index.vue
+0
-1
No files found.
src/layout/components/Sidebar/SidebarItem.vue
View file @
f8046a21
...
...
@@ -13,6 +13,7 @@
>
<el-menu-item
:index=
"resolvePath(onlyOneChild.path)"
@
click=
"clickitem(onlyOneChild)"
:class=
"
{ 'submenu-title-noDropdown': !isNest }"
>
<item
...
...
@@ -55,7 +56,7 @@ import Item from "./Item";
import
AppLink
from
"./Link"
;
import
FixiOSBug
from
"./FixiOSBug"
;
import
{
mapGetters
}
from
"vuex"
;
import
router
from
'@/router'
;
export
default
{
name
:
"SidebarItem"
,
components
:
{
Item
,
AppLink
},
...
...
@@ -83,6 +84,23 @@ export default {
return
{};
},
methods
:
{
clickitem
(
obj
)
{
// this.$tab.refreshPage(item)
const
{
path
,
query
,
matched
}
=
router
.
currentRoute
;
if
(
obj
===
undefined
)
{
matched
.
forEach
((
m
)
=>
{
if
(
m
.
components
&&
m
.
components
.
default
&&
m
.
components
.
default
.
name
)
{
if
(
!
[
'Layout'
,
'ParentView'
].
includes
(
m
.
components
.
default
.
name
))
{
obj
=
{
name
:
m
.
components
.
default
.
name
,
path
:
path
,
query
:
query
};
}
}
});
}
this
.
$store
.
dispatch
(
'tagsView/delCachedView'
,
obj
).
then
(()
=>
{
const
{
path
,
query
}
=
obj
this
.
$router
.
replace
({
path
:
'/'
+
path
,
query
})
})
},
hasOneShowingChild
(
children
=
[],
parent
)
{
if
(
!
children
)
{
children
=
[];
...
...
src/store/modules/permission.js
View file @
f8046a21
...
...
@@ -41,6 +41,7 @@ const permission = {
const
asyncRoutes
=
filterDynamicRoutes
(
dynamicRoutes
);
rewriteRoutes
.
push
({
path
:
'*'
,
redirect
:
'/404'
,
hidden
:
true
})
router
.
addRoutes
(
asyncRoutes
);
console
.
log
(
'rewriteRoutes'
,
rewriteRoutes
)
commit
(
'SET_ROUTES'
,
rewriteRoutes
)
commit
(
'SET_SIDEBAR_ROUTERS'
,
constantRoutes
.
concat
(
sidebarRoutes
))
commit
(
'SET_DEFAULT_ROUTES'
,
sidebarRoutes
)
...
...
@@ -67,7 +68,7 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
}
else
if
(
route
.
component
===
'InnerLink'
)
{
route
.
component
=
InnerLink
}
else
{
route
.
component
=
loadView
(
route
.
component
)
route
.
component
=
loadView
(
route
.
component
,
route
.
name
)
}
}
if
(
route
.
children
!=
null
&&
route
.
children
&&
route
.
children
.
length
)
{
...
...
@@ -120,13 +121,39 @@ export function filterDynamicRoutes(routes) {
})
return
res
}
export
function
createCustomComponent
(
name
,
component
)
{
return
{
name
,
data
()
{
return
{
component
:
null
}
},
async
created
()
{
if
(
component
instanceof
Promise
)
{
try
{
const
module
=
await
component
this
.
component
=
module
?.
default
}
catch
(
error
)
{
console
.
error
(
`can not resolve component
${
name
}
, error:`
,
error
)
}
export
const
loadView
=
(
view
)
=>
{
return
}
this
.
component
=
component
},
render
(
h
)
{
return
this
.
component
?
h
(
this
.
component
)
:
null
},
}
}
export
const
loadView
=
(
view
,
name
)
=>
{
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
return
(
resolve
)
=>
require
([
`@/views/
${
view
}
`
],
resolve
)
return
createCustomComponent
(
name
,
(
resolve
)
=>
require
([
`@/views/
${
view
}
`
],
resolve
))
// return (resolve) => {
// return require([`@/views/${view}`], resolve)
// }
}
else
{
// 使用 import 实现生产环境的路由懒加载
return
(
resolve
)
=>
require
([
`@/views/
${
view
}
`
],
resolve
)
return
createCustomComponent
(
name
,
(
resolve
)
=>
require
([
`@/views/
${
view
}
`
],
resolve
)
)
}
}
...
...
src/views/mes/pro/combination/index.vue
View file @
f8046a21
...
...
@@ -129,7 +129,6 @@
<!-- >删除-->
<!-- </el-button>-->
<!-- </template>-->
</el-table-column>
</el-table>
<pagination
...
...
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