feat: 搜索中心一般检索

This commit is contained in:
super_liu
2021-08-05 18:07:57 +08:00
parent 050a3a30a5
commit 45fb8ca199
+115 -8
View File
@@ -9,7 +9,7 @@
<div class="search-box">
<div class="home-input">
<el-input
placeholder="请输入查询条件"
placeholder="请输入查询条件111"
clearable
v-model="keywords"
@keyup.enter.native="searchSarByInputKeyByCondition">
@@ -207,8 +207,115 @@ export default {
};
},
methods: {
searchSarByInputKeyByCondition() {
dateFormat2(str){
return dateFormat(str)
},
searchSarByInputKey (status) {
if (status === 'All') {
this.AllCheck = true
}
if (this.AllCheck) {
if (this.keywords === undefined) {
this.keywords = ''
}
const Alllist = {
selectIndex: 'fulltextserch',
selectValue: this.keywords,
page: this.pageAll,
pageSize: this.$store.getters.userInfo.configContent
}
this.$http.post('search/searchCenter/searchSarBykey', Alllist, {
_this: this,
loading: 'resultLoading'
}, res => {
if (res.ok) {
this.Allitems = res.data.list.map((item) => {
if (item.textContent) {
this.str = item.textContent
}
return {
...item,
textContent: this.str.replace(/null/g, '- -')
}
})
this.totalAll = res.data.count
this.AllCheck = true
} else {
}
}, e => {
})
} else {
this.searchSarBykey()
}
},
searchSarBykey () {
let searchCondition = this.searchCondition
let condition = {}
let searchKeys = Object.keys(this.searchOptions)
for (let key in searchCondition) {
if (searchKeys.indexOf(key) !== -1) {
if (condition.selectIndex === 'laws') {
condition.SYCLLX = condition.CLLX
condition.WSSFCY = condition.CYSD
}
condition[key] = searchCondition[key].join(',') === 'all' ? '' : searchCondition[key].join(',')
}
}
if (this.resultKeyword != null && this.resultKeyword !== '') {
condition.resultKeyword = this.resultKeyword
}
condition.page = this.page
condition.pageSize = this.$store.getters.userInfo.configContent
condition.selectValue = this.keywords
if (condition.selectIndex === 'bussstand') {
condition.selectIndex = 'stand'
condition.standType = 'FOREIGN'
} else if (condition.selectIndex === 'stand') {
condition.standType = 'INLAND'
}
if(condition.selectIndex === 'enterprise'){
condition.selectIndex='bussstand'
condition.standState = condition.BUSSSTATE
condition.ZQCBM = condition.ORGLIST
}
// 查询为国内外政策时,改变查询参数名
if (condition.selectIndex === 'laws') {
condition.SYCLLX = condition.CLLX
condition.WSSFCY = condition.CYSD
delete condition.CLLX
delete condition.CYSD
}
if(condition.selectValue === undefined){
condition.selectValue = ''
}
this.$http.post('search/searchCenter/searchSarBykey', condition, {
_this: this,
loading: 'resultLoading'
}, res => {
if (res.ok) {
this.total = res.data.count
this.resultData = res.data.list
this.selectGroupdata(res.data)
} else {
this.total = 0
this.resultData = []
this.selectGroupdata(res.data)
// this.getSearchHistoty()
}
}, e => {
this.total = 0
this.resultData = []
console.error(e)
// this.getSearchHistoty()
})
},
searchSarByInputKeyByCondition() {
console.log(11111111111111111111111111)
this.pageAll = 1
this.page = 1
this.searchSarByInputKey()
},
//查询选项
queryOptions() {
let _this = this;
@@ -342,12 +449,6 @@ export default {
cancelCollectStandard() {
},
//条件检索
searchSarByInputKey(status) {
if (status === "All") {
this.AllCheck = true;
}
}
},
components: {
PersonalCenter
@@ -367,6 +468,12 @@ export default {
if (globalInputSearch !== 'allvalue') {
this.keywords = globalInputSearch
}
if (this.$route.params.selectKey === 'All') {
// 从首页进入一般检索-资源类型查询全部
this.searchSarByInputKey('All')
} else {
this.searchSarBykey()
}
},
unmounted() {