feat:添加顶部搜索选择

This commit is contained in:
zhangyu
2021-10-12 16:53:59 +08:00
parent b591445d91
commit 133275d66d
8 changed files with 271 additions and 32 deletions

View File

@@ -4,7 +4,8 @@ export default {
return {
detailType: 'list',
detailViewRightObj: '',
detailViewLoading: false
detailViewLoading: false,
detailTimer: ''
}
},
created () {
@@ -31,16 +32,51 @@ export default {
this.$refs.clickSearch && this.$refs.clickSearch.needMore()
}, 100)
},
searchDetail (params) {
searchDetail (searchObj) {
this.searchLabel = {}
this.pageObj.pageNo = 1
for (const item in searchObj) {
if (typeof searchObj[item] !== 'undefined' && searchObj[item] !== null && searchObj[item] !== '') {
this.$set(this.searchLabel, item, searchObj[item])
}
}
if (this.searchDetailObj) {
for (const item in this.searchDetailObj) {
if (typeof this.searchDetailObj[item] !== 'undefined' && this.searchDetailObj[item] !== null && this.searchDetailObj[item] !== '') {
if (this.searchDetailObj[item].join(',') !== '') {
this.$set(this.searchLabel, item, this.searchDetailObj[item].join(','))
}
}
}
}
if (this.$refs.dataTable) {
this.$refs.dataTable.$refs.dataTable.bodyWrapper.scrollTop = 0
}
this.getDetail()
},
searchDetailTop () {
if (!this.detailTimer) {
this.detailTimer = setTimeout(() => {
this.searchDetail()
clearTimeout(this.detailTimer)
this.detailTimer = ''
}, 1000)
} else {
clearTimeout(this.detailTimer)
this.detailTimer = setTimeout(() => {
this.searchDetail()
clearTimeout(this.detailTimer)
this.detailTimer = ''
}, 1000)
}
},
getDetail () {
const params = {
pageNo: this.pageObj.pageNo,
pageSize: this.pageObj.pageSize
}
this.tools.loading = true
this.$get(this.url, { ...params }).then(response => {
this.$get(this.url, { ...this.searchLabel, ...params }).then(response => {
this.tools.loading = false
if (response.code === 200) {
this.tableData = response.data.list