175 lines
4.6 KiB
Vue
175 lines
4.6 KiB
Vue
<template>
|
|
<!-- 搜索区域 -->
|
|
<div class="search-wrapper">
|
|
<a-select class="resource-type-select" v-model="resourceType" size="large">
|
|
<a-select-option value="all">{{ $t('dashboard.generalSearch.all')}}</a-select-option>
|
|
<a-select-option v-for="item in resourceTypeOptions" :key="item.value" :value="item.value" :title="isChinese() ? item.title : item.enText">
|
|
{{ isChinese() ? item.title : item.enText }}
|
|
</a-select-option>
|
|
</a-select>
|
|
<a-input class="search-input" size="large" v-model="searchValue" :placeholder="$t('pleaseEnter')" @pressEnter="searchInputEnter">
|
|
<a-icon slot="prefix" type="search" style="color: #0064FA;" />
|
|
</a-input>
|
|
<div class="btn-box">
|
|
<a-button type="primary" size="large" icon="search" @click="toSearchWindow('title')">{{ $t('dashboard.retrieval.titleSearch') }}</a-button>
|
|
<a-button type="primary" size="large" icon="search" @click="toSearchWindow('fullText')">{{ $t('dashboard.retrieval.fullSearch') }}</a-button>
|
|
<a-button type="primary" size="large" class="btn-ghost" ghost @click="toAdvancedSearch()"><img :src="require('@/assets/image/icon/super-search.png')" alt='' class="btn-icon">{{ $t('dashboard.retrieval.advancedSearch') }}</a-button>
|
|
<a-button type="primary" size="large" class="btn-ghost" ghost @click="toAdvancedSearch(4)"><img :src="require('@/assets/image/icon/super-search.png')" alt='' class="btn-icon">{{ $t('dashboard.retrieval.termSearch') }}</a-button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { ajaxGetDictItems } from '@api/api'
|
|
|
|
export default {
|
|
name: 'RetrievalCard',
|
|
data () {
|
|
return {
|
|
resourceTypeOptions: [], // 资源类型下拉框数据
|
|
resourceType: 'all', // 资源类型
|
|
searchValue: '' // 检索内容
|
|
}
|
|
},
|
|
mounted () {
|
|
this.initResourceTypeOptions()
|
|
},
|
|
methods: {
|
|
// 获取资源类型下拉框数据
|
|
initResourceTypeOptions () {
|
|
ajaxGetDictItems('resource_type').then(res => {
|
|
if (res.success) {
|
|
this.resourceTypeOptions = res.result
|
|
}
|
|
})
|
|
},
|
|
// 点击跳转到一般检索页
|
|
toSearchWindow (type) {
|
|
const { href } = this.$router.resolve({
|
|
path: '/generalSearch',
|
|
query: {
|
|
type: type,
|
|
resourceType: this.resourceType,
|
|
searchValue: this.searchValue
|
|
}
|
|
})
|
|
window.open(href, '_blank')
|
|
},
|
|
// 点击跳转到高级检索页
|
|
toAdvancedSearch (standardType) {
|
|
const { href } = this.$router.resolve({
|
|
path: '/advancedSearch',
|
|
query: {
|
|
standardType
|
|
}
|
|
})
|
|
window.open(href, '_blank')
|
|
},
|
|
// 回车跳标题检索
|
|
searchInputEnter () {
|
|
const { href } = this.$router.resolve({
|
|
path: '/generalSearch',
|
|
query: {
|
|
type: 'title',
|
|
resourceType: this.resourceType,
|
|
searchValue: this.searchValue
|
|
}
|
|
})
|
|
window.open(href, '_blank')
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.search-wrapper {
|
|
margin: 0 auto;
|
|
width: 80%;
|
|
display: grid;
|
|
grid-template-columns: 120px 1fr auto;
|
|
grid-gap: 10px;
|
|
|
|
& > .resource-type-select {
|
|
height: 100%;
|
|
color: @primary-color;
|
|
|
|
/deep/.ant-select-arrow svg {
|
|
fill: @primary-color;
|
|
}
|
|
/deep/.ant-select-selection--single {
|
|
height: 100%;
|
|
border-color: @primary-color;
|
|
}
|
|
/deep/.ant-select-arrow {
|
|
right: 20px;
|
|
}
|
|
/deep/.ant-select-selection__rendered {
|
|
line-height: 56px;
|
|
margin-left: 20px;
|
|
margin-right: 34px;
|
|
}
|
|
}
|
|
|
|
& > .search-input {
|
|
height: 100%;
|
|
font-size: 16px;
|
|
//margin-left: 10px;
|
|
/deep/.ant-input-prefix {
|
|
left: 24px;
|
|
}
|
|
|
|
/deep/.ant-input {
|
|
padding-left: 40px;
|
|
height: 100%;
|
|
border-color: @primary-color;
|
|
}
|
|
}
|
|
|
|
.btn-box .ant-btn {
|
|
min-width: 138px;
|
|
height: 100%;
|
|
|
|
&:not(:first-child) {
|
|
margin-left: 10px;
|
|
}
|
|
}
|
|
}
|
|
|
|
// 1366屏幕
|
|
@media screen and (max-width: 1366px) {
|
|
@fontSize: 14px;
|
|
.search-wrapper {
|
|
& > .resource-type-select {
|
|
font-size: @fontSize;
|
|
|
|
/deep/ .ant-select-selection__rendered {
|
|
line-height: 48px;
|
|
}
|
|
}
|
|
& > .search-input {
|
|
/deep/ .ant-input {
|
|
font-size: @fontSize;
|
|
}
|
|
/deep/.ant-input-prefix {
|
|
left: 12px;
|
|
}
|
|
/deep/.ant-input {
|
|
padding-left: 30px;
|
|
height: 100%;
|
|
border-color: @primary-color;
|
|
}
|
|
}
|
|
.btn-box .ant-btn {
|
|
min-width: 88px;
|
|
padding: 0 12px;
|
|
font-size: @fontSize;
|
|
}
|
|
}
|
|
|
|
}
|
|
.btn-icon {
|
|
margin-right: 8px;
|
|
vertical-align: sub;
|
|
}
|
|
</style>
|