Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
9
91isoft_web_vue3
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
张伯涛
91isoft_web_vue3
Commits
590b624d
Commit
590b624d
authored
Feb 18, 2024
by
张毅辰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编译通过修改
parent
adf8ec91
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
15 deletions
+32
-15
filterData.js
src/assets/js/filterData.js
+6
-7
filterData.ts
src/assets/js/filterData.ts
+6
-7
searchParams.ts
src/store/modules/searchParams.ts
+15
-1
index.vue
src/views/system/dept/index.vue
+5
-0
No files found.
src/assets/js/filterData.js
View file @
590b624d
...
...
@@ -3,13 +3,12 @@ import { useSearchParamsStore } from "@/store/modules/searchParams";
const
searchParamsObj
=
useSearchParamsStore
();
// 路由离开前存储筛选条件
export
function
setDataCache
(
path
,
param
)
{
// store.dispatch('searchSave/searchParamsSet', {
// path: path,
// param: {
// ...param
// }
// }).then(r => {} )
// console.log('store.getters.searchParams', store.getters.searchParams)
searchParamsObj
.
setSearchParams
({
path
:
path
,
param
:
{
...
param
}
});
}
// 获取缓存的筛选条件 分页参数需统一,如需自定义分页参数,在列表页自行修改
export
function
getDataCache
(
routerPath
)
{
...
...
src/assets/js/filterData.ts
View file @
590b624d
...
...
@@ -3,13 +3,12 @@ import { useSearchParamsStore } from "@/store/modules/searchParams";
const
searchParamsObj
=
useSearchParamsStore
()
// 路由离开前存储筛选条件
export
function
setDataCache
(
path
:
any
,
param
:
any
)
{
// store.dispatch('searchSave/searchParamsSet', {
// path: path,
// param: {
// ...param
// }
// }).then(r => {} )
// console.log('store.getters.searchParams', store.getters.searchParams)
searchParamsObj
.
setSearchParams
({
path
:
path
,
param
:
{
...
param
}
})
}
// 获取缓存的筛选条件 分页参数需统一,如需自定义分页参数,在列表页自行修改
...
...
src/store/modules/searchParams.ts
View file @
590b624d
...
...
@@ -2,8 +2,22 @@ import { defineStore } from "pinia";
export
const
useSearchParamsStore
=
defineStore
(
"searchParams"
,
()
=>
{
const
searchParams
=
ref
<
object
>
({});
function
setSearchParams
(
config
:
any
)
{
if
(
!
config
||
typeof
config
!==
'object'
)
{
return
}
if
(
!
config
.
path
)
{
return
}
SET_SEARCH_PARAMS
(
config
)
}
function
SET_SEARCH_PARAMS
(
config
:
any
)
{
if
(
!
config
||
typeof
config
!==
'object'
)
{
return
}
if
(
!
config
.
path
)
{
return
}
if
(
config
.
param
&&
typeof
config
.
param
===
'object'
&&
Object
.
keys
(
config
.
param
).
length
>
0
)
{
searchParams
[
config
.
path
]
=
JSON
.
stringify
(
config
.
param
)
}
else
{
delete
searchParams
[
config
.
path
]
}
}
return
{
searchParams
,
setSearchParams
};
});
src/views/system/dept/index.vue
View file @
590b624d
...
...
@@ -240,6 +240,11 @@ onMounted(() => {
Object
.
assign
(
queryParams
,
JSON
.
parse
(
getDataCache
(
route
.
path
)));
getList
();
});
onBeforeRouteLeave
((
to
,
from
,
next
)
=>
{
setDataCache
(
route
.
path
,
queryParams
)
next
()
})
</
script
>
<
template
>
<div
class=
"app-container"
>
...
...
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