保留搜索记录

(cherry picked from commit 54d79be338e6c3de14c18e29086f31f3b3c2c1f1)
This commit is contained in:
Xia Zekun
2024-09-06 17:25:20 +08:00
committed by mzaxd
parent 181ea119a9
commit d7015d373b
2 changed files with 24 additions and 4 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<template> <template>
<!-- <div class="iframe-container">--> <!-- <div class="iframe-container">-->
<iframe :src="previewUrl" class="responsive-iframe" frameborder="0"></iframe> <iframe :src="previewUrl" class="responsive-iframe"></iframe>
<!-- </div>--> <!-- </div>-->
</template> </template>
+23 -3
View File
@@ -185,6 +185,7 @@ export default {
selectOptionLoading: false, // 其他筛选条件部分的loading selectOptionLoading: false, // 其他筛选条件部分的loading
loading: false, loading: false,
searchValue: '', // 搜索框内容 searchValue: '', // 搜索框内容
searchParam: '', // 搜索条件集合
toggleSearchStatus: false, // 检索条件收缩还是展开, false收缩状态 toggleSearchStatus: false, // 检索条件收缩还是展开, false收缩状态
// 检索方式可选择项 // 检索方式可选择项
retrievalModeOptions: [ retrievalModeOptions: [
@@ -261,10 +262,25 @@ export default {
if (this.searchValue) { if (this.searchValue) {
this.onSearch(1) this.onSearch(1)
} }
this.loadResultFromSession()
}, },
methods: { methods: {
isHasPermission, isHasPermission,
loadResultFromSession () {
// 从session获取搜索结果
this.searchParam = JSON.parse(sessionStorage.getItem('searchParam'))
if (!this.searchParam) return
this.searchValue = this.searchParam.searchContent
this.resourceTypeCurrent = this.searchParam.resourceType
this.retrievalModeCurrent = this.searchParam.searchMode
this.standardStatusSetCurrent = this.searchParam.standardStateSet
this.initFilterData()
this.dataSource = JSON.parse(sessionStorage.getItem('dataSource'))
this.ipagination = JSON.parse(sessionStorage.getItem('ipagination'))
},
// 判断是否是废止标准 // 判断是否是废止标准
judgeAbolish (item) { judgeAbolish (item) {
// console.log('judgeAbolish') // console.log('judgeAbolish')
@@ -373,7 +389,7 @@ export default {
if (arg === 1) { if (arg === 1) {
this.ipagination.current = 1 this.ipagination.current = 1
} }
const param = this.getSearchParam() this.searchParam = this.getSearchParam()
let func let func
if (this.retrievalModeCurrent === '1') { if (this.retrievalModeCurrent === '1') {
// 是全文检索 // 是全文检索
@@ -383,16 +399,20 @@ export default {
func = generalSearchTitleSearch func = generalSearchTitleSearch
} }
this.loading = true this.loading = true
func(param).then(res => { func(this.searchParam).then(res => {
if (res.success) { if (res.success) {
this.dataSource = res.result.records this.dataSource = res.result.records
console.log('this.ipagination', this.ipagination)
if (res.result.total) { if (res.result.total) {
this.ipagination.total = res.result.total this.ipagination.total = res.result.total
this.ipagination.pageCount = Math.ceil(this.ipagination.total / this.ipagination.pageSize) this.ipagination.pageCount = Math.ceil(this.ipagination.total / this.ipagination.pageSize)
} else { } else {
this.ipagination.total = 0 this.ipagination.total = 0
} }
// 保存搜索和结果
sessionStorage.setItem('searchParam', JSON.stringify(this.searchParam))
sessionStorage.setItem('dataSource', JSON.stringify(this.dataSource))
sessionStorage.setItem('ipagination', JSON.stringify(this.ipagination))
// console.log('this.ipagination', this.ipagination)
} else { } else {
this.$message.warning(res.message) this.$message.warning(res.message)
} }