fix: 修复实体列表刷新后页码重置为1的问题
This commit is contained in:
@@ -454,8 +454,11 @@ export default {
|
|||||||
const errorList = parser.validateMeta(this.metaList)
|
const errorList = parser.validateMeta(this.metaList)
|
||||||
if (_.isEmpty(errorList)) {
|
if (_.isEmpty(errorList)) {
|
||||||
const strObj = handleMetaListToStr(this.metaList)
|
const strObj = handleMetaListToStr(this.metaList)
|
||||||
const key = handleEntityTypeByStr(strObj.str)
|
const str = strObj.str ? strObj.str : strObj
|
||||||
this.$emit('search', { ...parser.parseStr(key), str: strObj.str2 })
|
const str2 = strObj.str2 ? strObj.str2 : strObj
|
||||||
|
// str为将metaList转成字符串的值,str2为地址栏展示的值
|
||||||
|
const key = handleEntityTypeByStr(str)
|
||||||
|
this.$emit('search', { ...parser.parseStr(key), str: str2 })
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(handleErrorTip(errorList[0]))
|
this.$message.error(handleErrorTip(errorList[0]))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,13 +202,13 @@ export default {
|
|||||||
entityIpNew: '-',
|
entityIpNew: '-',
|
||||||
entityIpActive: '-',
|
entityIpActive: '-',
|
||||||
|
|
||||||
pageObj: {
|
// pageObj: {
|
||||||
pageNo: 1,
|
// pageNo: 1,
|
||||||
// 是否重置pageNo,在执行新搜索时是true
|
// // 是否重置pageNo,在执行新搜索时是true
|
||||||
resetPageNo: true,
|
// resetPageNo: true,
|
||||||
pageSize: defaultPageSize,
|
// pageSize: defaultPageSize,
|
||||||
total: 0
|
// total: 0
|
||||||
},
|
// },
|
||||||
newFilterData: [
|
newFilterData: [
|
||||||
{
|
{
|
||||||
icon: 'cn-icon cn-icon-registration-country',
|
icon: 'cn-icon cn-icon-registration-country',
|
||||||
@@ -283,7 +283,7 @@ export default {
|
|||||||
|
|
||||||
// 实体详情列表页面 左侧筛选条件
|
// 实体详情列表页面 左侧筛选条件
|
||||||
loadingLeft: false,
|
loadingLeft: false,
|
||||||
initFlag: false, // 初始化标志,避免初始化时pageSize和pageNo会调用搜索
|
initFlag: true, // 初始化标志,避免初始化时pageSize和pageNo会调用搜索
|
||||||
timer: null, // 初始化标志的延时器,需要销毁
|
timer: null, // 初始化标志的延时器,需要销毁
|
||||||
summaryCount: {
|
summaryCount: {
|
||||||
total: 0,
|
total: 0,
|
||||||
@@ -366,10 +366,15 @@ export default {
|
|||||||
|
|
||||||
// 在非列表模式下选择tag模式,在地址栏输入内容时将mode添加到地址栏
|
// 在非列表模式下选择tag模式,在地址栏输入内容时将mode添加到地址栏
|
||||||
const mode = this.$route.query.mode || 'text'
|
const mode = this.$route.query.mode || 'text'
|
||||||
|
if (this.pageObj.resetPageNo && !this.initFlag) {
|
||||||
|
this.pageObj.pageNo = 1
|
||||||
|
} else {
|
||||||
|
this.pageObj.resetPageNo = true
|
||||||
|
}
|
||||||
|
|
||||||
this.reloadUrl({
|
this.reloadUrl({
|
||||||
listMode: this.listMode,
|
listMode: this.listMode,
|
||||||
q: encodeURI(param.str) || '',
|
q: param.str ? encodeURI(param.str) : '',
|
||||||
mode: mode,
|
mode: mode,
|
||||||
pageNo: this.pageObj.pageNo,
|
pageNo: this.pageObj.pageNo,
|
||||||
pageSize: this.pageObj.pageSize
|
pageSize: this.pageObj.pageSize
|
||||||
@@ -381,7 +386,7 @@ export default {
|
|||||||
path: '/entityExplorer',
|
path: '/entityExplorer',
|
||||||
query: {
|
query: {
|
||||||
listMode: this.listMode,
|
listMode: this.listMode,
|
||||||
q: encodeURI(param.str) || '',
|
q: param.str ? encodeURI(param.str) : '',
|
||||||
mode: mode,
|
mode: mode,
|
||||||
range: this.timeFilter.dateRangeValue,
|
range: this.timeFilter.dateRangeValue,
|
||||||
pageNo: this.pageObj.pageNo,
|
pageNo: this.pageObj.pageNo,
|
||||||
@@ -392,11 +397,6 @@ export default {
|
|||||||
// 跳转页面,则不执行搜索功能
|
// 跳转页面,则不执行搜索功能
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (this.pageObj.resetPageNo) {
|
|
||||||
this.pageObj.pageNo = 1
|
|
||||||
} else {
|
|
||||||
this.pageObj.resetPageNo = true
|
|
||||||
}
|
|
||||||
// 带参数时,只查询对应类型的entity;不带参数时,3种entity都查
|
// 带参数时,只查询对应类型的entity;不带参数时,3种entity都查
|
||||||
if (q) {
|
if (q) {
|
||||||
this.queryFilterNew({ q: this.q, ...this.pageObj, ...this.timeFilter })
|
this.queryFilterNew({ q: this.q, ...this.pageObj, ...this.timeFilter })
|
||||||
@@ -408,9 +408,9 @@ export default {
|
|||||||
this.queryCount({ ...this.pageObj, ...this.timeFilter })
|
this.queryCount({ ...this.pageObj, ...this.timeFilter })
|
||||||
|
|
||||||
// 延时一秒,避免初始化时pageSize为20,pageNo为1也会调用“搜索”的情况
|
// 延时一秒,避免初始化时pageSize为20,pageNo为1也会调用“搜索”的情况
|
||||||
if (!this.initFlag) {
|
if (this.initFlag) {
|
||||||
this.timer = setTimeout(() => {
|
this.timer = setTimeout(() => {
|
||||||
this.initFlag = true
|
this.initFlag = false
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -418,22 +418,18 @@ export default {
|
|||||||
pageSize (val) {
|
pageSize (val) {
|
||||||
this.pageObj.pageSize = val
|
this.pageObj.pageSize = val
|
||||||
if (this.initFlag) {
|
if (this.initFlag) {
|
||||||
this.search({ metaList: this.metaList, q: this.q })
|
|
||||||
} else {
|
|
||||||
if (val !== 20) {
|
if (val !== 20) {
|
||||||
this.search({ metaList: this.metaList, q: this.q })
|
this.search({ metaList: this.metaList, q: this.q })
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.search({ metaList: this.metaList, q: this.q })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pageNo (val) {
|
pageNo (val) {
|
||||||
|
if (!this.initFlag) {
|
||||||
this.pageObj.pageNo = val
|
this.pageObj.pageNo = val
|
||||||
this.pageObj.resetPageNo = false
|
this.pageObj.resetPageNo = false
|
||||||
if (this.initFlag) {
|
|
||||||
this.search({ metaList: this.metaList, q: this.q })
|
this.search({ metaList: this.metaList, q: this.q })
|
||||||
} else {
|
|
||||||
if (val !== 1) {
|
|
||||||
this.search({ metaList: this.metaList, q: this.q })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 点击上一页箭头
|
// 点击上一页箭头
|
||||||
@@ -721,8 +717,16 @@ export default {
|
|||||||
timeFilter.value.startTime = parseInt(startTimeParam)
|
timeFilter.value.startTime = parseInt(startTimeParam)
|
||||||
timeFilter.value.endTime = parseInt(endTimeParam)
|
timeFilter.value.endTime = parseInt(endTimeParam)
|
||||||
}
|
}
|
||||||
|
const pageObj = ref({
|
||||||
|
pageNo: query.pageNo ? parseInt(query.pageNo) : 1,
|
||||||
|
// 是否重置pageNo,在执行新搜索时是true
|
||||||
|
resetPageNo: true,
|
||||||
|
pageSize: query.pageSize ? parseInt(query.pageSize) : defaultPageSize,
|
||||||
|
total: 0
|
||||||
|
})
|
||||||
return {
|
return {
|
||||||
timeFilter
|
timeFilter,
|
||||||
|
pageObj
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeUnmount () {
|
beforeUnmount () {
|
||||||
|
|||||||
Reference in New Issue
Block a user