保留搜索记录

(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>
<!-- <div class="iframe-container">-->
<iframe :src="previewUrl" class="responsive-iframe" frameborder="0"></iframe>
<iframe :src="previewUrl" class="responsive-iframe"></iframe>
<!-- </div>-->
</template>
+23 -3
View File
@@ -185,6 +185,7 @@ export default {
selectOptionLoading: false, // 其他筛选条件部分的loading
loading: false,
searchValue: '', // 搜索框内容
searchParam: '', // 搜索条件集合
toggleSearchStatus: false, // 检索条件收缩还是展开, false收缩状态
// 检索方式可选择项
retrievalModeOptions: [
@@ -261,10 +262,25 @@ export default {
if (this.searchValue) {
this.onSearch(1)
}
this.loadResultFromSession()
},
methods: {
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) {
// console.log('judgeAbolish')
@@ -373,7 +389,7 @@ export default {
if (arg === 1) {
this.ipagination.current = 1
}
const param = this.getSearchParam()
this.searchParam = this.getSearchParam()
let func
if (this.retrievalModeCurrent === '1') {
// 是全文检索
@@ -383,16 +399,20 @@ export default {
func = generalSearchTitleSearch
}
this.loading = true
func(param).then(res => {
func(this.searchParam).then(res => {
if (res.success) {
this.dataSource = res.result.records
console.log('this.ipagination', this.ipagination)
if (res.result.total) {
this.ipagination.total = res.result.total
this.ipagination.pageCount = Math.ceil(this.ipagination.total / this.ipagination.pageSize)
} else {
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 {
this.$message.warning(res.message)
}