Files
laws_weilai/jero-web/src/views/documentTools/searchCenter/index.vue
T
2022-08-18 14:54:59 +08:00

334 lines
11 KiB
Java

<template>
<a-card :bordered="false">
<div class="search-center">
<div class="search-center-wrap">
<div class="search-detail">
<div class="search-detail-wrap">
<a-input-group class="input-group" compact v-if="active === $t('DocumentLibrary')">
<a-select v-model="selectModel" @change="selectModelChange">
<a-select-option :value="item.db_field_name"
v-for="(item,index) in searchOption" :key="index">
{{item.db_field_txt}}
</a-select-option>
</a-select>
<a-input
:maxLength="100"
@keyup.enter.native="onSearch(selectValueTwo)"
v-model="selectValueTwo"
style="width: calc(100% - 128px)"
:placeholder="$t('pleaseEnter')+$t('searchContent')"
></a-input>
</a-input-group>
<a-input
v-model="selectValueTwo"
:maxLength="100"
@keyup.enter.native="wholeOnSearch(selectValueTwo)"
v-else-if="active === $t('whole') || active === $t('problemKnowledgeBase')
|| active === $t('monthlyReportRegulations')"
class="inputSearch"
:placeholder="$t('pleaseEnter')+$t('searchContent')"
></a-input>
<a-button class="textSearch"
v-if="active === $t('DocumentLibrary')"
@click="onSearch(selectValueTwo)"
>{{$t('query')}}
</a-button>
<a-button class="textSearch"
v-if="active === $t('whole') || active === $t('problemKnowledgeBase')
|| active === $t('monthlyReportRegulations')"
@keyup.enter.native="wholeOnSearch(selectValueTwo)"
@click="wholeOnSearch(selectValueTwo)"
>{{$t('query')}}
</a-button>
<a-button class="textSearch"
v-if="active === $t('whole') || active === $t('DocumentLibrary')
|| active === $t('problemKnowledgeBase') || active === $t('monthlyReportRegulations')"
@click="wholeTextSearch(selectValueTwo)"
>{{$t('searchInResults')}}
</a-button>
<a-button class="textSearch"
v-if="active === $t('whole') || active === $t('DocumentLibrary')
|| active === $t('problemKnowledgeBase') || active === $t('monthlyReportRegulations')"
@click="ResetSearch()"
>{{$t('reset')}}
</a-button>
<!-- <span v-if="active === $t('whole') || active === $t('DocumentLibrary')" class="textSearch"-->
<!-- @click="wholeTextSearch(selectValueTwo)">{{$t('searchInResults')}}</span>-->
<!-- <span v-if="active === $t('whole') || active === $t('DocumentLibrary')" class="textSearch"-->
<!-- @click="ResetSearch()">{{$t('reset')}}</span>-->
</div>
</div>
<div class="search-center-content">
<div class="search-con-header">
<div class="search-header-left">
<a-tabs :default-active-key="active" @change="callback">
<a-tab-pane :key="$t('whole')" :tab="$t('whole')"></a-tab-pane>
<a-tab-pane :key="$t('DocumentLibrary')" :tab="$t('DocumentLibrary')" force-render>
</a-tab-pane>
<a-tab-pane :key="$t('problemKnowledgeBase')" :tab="$t('problemKnowledgeBase')" force-render>
</a-tab-pane>
<a-tab-pane :key="$t('monthlyReportRegulations')" :tab="$t('monthlyReportRegulations')" force-render>
</a-tab-pane>
</a-tabs>
</div>
</div>
<whole ref="wholeRef" :url="url" v-if="active === $t('whole')"/>
<DocumentLibrary ref="DocumentLibraryRef" v-else-if="active === $t('DocumentLibrary')"/>
<problemKnowledgeBase ref="problemKnowledgeBaseRef" v-else-if="active === $t('problemKnowledgeBase')"/>
<monthlyReportRegulations ref="monthlyReportRegulationsRef"
v-else-if="active === $t('monthlyReportRegulations')"/>
</div>
</div>
</div>
</a-card>
</template>
<script>
import whole from './components/whole'
import DocumentLibrary from './components/DocumentLibrary'
import problemKnowledgeBase from './components/problemKnowledgeBase'
import monthlyReportRegulations from './components/monthlyReportRegulations'
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
export default {
name: 'searchCenter',
components: {
whole,
DocumentLibrary,
problemKnowledgeBase,
monthlyReportRegulations
},
data() {
return {
active: this.$t('whole'),
showList: false,
url: {
queryCondition: 'search/document/queryCondition'
},
selectModel: '',
selectModelName: '',
queryParam: {},
selectValueTwo: ''
}
},
mounted() {
this.getCondition()
if (this.$route.query.selectValue) {
this.selectValueTwo = this.$route.query.selectValue
this.$nextTick(() => {
if (this.$refs.wholeRef) {
this.$refs.wholeRef.searchData(this.selectValueTwo)
}
})
} else {
this.$nextTick(() => {
if (this.$refs.wholeRef) {
this.$refs.wholeRef.searchData()
}
})
}
},
methods: {
callback(key) {
this.active = key
this.selectValueTwo = ''
if (this.active == this.$t('whole')) {
this.$nextTick(() => {
if (this.$refs.wholeRef) {
this.$refs.wholeRef.searchData()
}
})
}
},
ResetSearch() {
this.selectValueTwo = ''
if (this.$refs.wholeRef) {
this.$refs.wholeRef.ResetSearch()
} else if (this.$refs.DocumentLibraryRef) {
this.$refs.DocumentLibraryRef.ResetSearch()
}else if (this.$refs.monthlyReportRegulationsRef) {
this.$refs.monthlyReportRegulationsRef.ResetSearch()
}
},
onSearch(event) {
if (event == '' || !event) {
this.queryParam = {}
if (this.$refs.DocumentLibraryRef) {
this.$refs.DocumentLibraryRef.searchData(this.queryParam, this.selectModel, this.selectModelName)
}
} else {
this.queryParam[this.selectModel] = event
if (this.$refs.DocumentLibraryRef) {
this.$refs.DocumentLibraryRef.searchData(this.queryParam, this.selectModel, this.selectModelName)
}
}
},
wholeOnSearch(event) {
if (this.$refs.wholeRef) {
this.$refs.wholeRef.searchData(event)
}else if(this.$refs.monthlyReportRegulationsRef){
this.$refs.monthlyReportRegulationsRef.searchData(event)
}
},
wholeTextSearch(event) {
if (this.$refs.wholeRef) {
this.$refs.wholeRef.searchDataTwo(event)
} else if (this.$refs.DocumentLibraryRef) {
if (event == '' || !event) {
this.queryParam = {}
this.$refs.DocumentLibraryRef.searchDataTwo(this.queryParam, this.selectModel, this.selectModelName)
} else {
this.queryParam[this.selectModel] = event
this.$refs.DocumentLibraryRef.searchDataTwo(this.queryParam, this.selectModel, this.selectModelName)
}
}else if(this.$refs.monthlyReportRegulationsRef){
this.$refs.monthlyReportRegulationsRef.searchDataTwo(event)
}
},
getCondition() {
let query = {
flag: 1,
searchFlag: 1
}
getAction(this.url.queryCondition, query).then((res) => {
if (res.success) {
this.searchOption = res.result || []
if (this.searchOption.length > 0) {
this.selectModel = this.searchOption[0].db_field_name
this.selectModelName = this.searchOption[0].db_field_txt
}
} else {
this.searchOption = []
}
})
},
selectModelChange(event) {
let content = this.searchOption.filter((res) => {
return res.db_field_name === event
})
if (content && content.length > 0) {
this.selectModelName = content[0].db_field_txt
} else {
this.selectModelName = ''
}
this.queryParam = {}
}
}
}
</script>
<style>
.search-center .ant-tabs-nav-container {
font-size: 18px !important;
font-weight: 400 !important;
color: #040B29 !important;
}
</style>
<style lang="less" scoped>
.search-center {
/*background-color: #ffffff;*/
.search-center-wrap {
margin: 10px;
.search-detail {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
//justify-content: center;
.search-detail-wrap {
display: flex;
.search-detail-title {
width: 120px;
margin-right: 10px;
line-height: 32px;
}
}
}
.search-center-content {
.search-con-header {
width: 100%;
padding: 10px 0;
display: flex;
justify-content: space-between;
.search-header-left {
width: 100%;
span {
margin-right: 10px;
padding: 4px 20px;
}
}
}
}
}
}
.inputSearch {
width: 608px;
}
.input-group {
width: 608px;
display: inline-block;
}
::v-deep .input-group .ant-select-selection--single {
height: 40px !important;
}
</style>
<style>
.inputSearch {
height: 40px;
line-height: 40px;
}
.input-group .ant-select-selection {
width: 128px;
height: 40px;
line-height: 40px;
padding: 0 0 0 6px;
}
.input-group .ant-select-selection__rendered {
height: 40px;
line-height: 40px;
}
.input-group .ant-input {
height: 40px;
line-height: 40px;
}
.input-group .ant-select-arrow {
right: 15px;
}
.input-group .ant-select {
background: #F6F7FA;
}
.textSearch {
line-height: 40px;
display: inline-block;
margin-left: 8px;
/*color: #21c9cc;*/
cursor: pointer;
height: 40px;
}
.textSearch .ant-btn {
height: 40px;
}
.search-header-left .ant-tabs-nav-wrap {
display: flex;
justify-content: center;
}
</style>
<style>
</style>