[update] 一般检索完成部分

This commit is contained in:
lideqin
2023-09-05 18:15:52 +08:00
parent ff11f74725
commit 589dcbcf62
4 changed files with 242 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

+9
View File
@@ -0,0 +1,9 @@
// 首页的所有翻译
module.exports = {
// 一般检索
generalSearch: {
queryCondition: 'Query Condition',
retrievalMode: 'Retrieval Mode',
resourceType: 'Resource Type'
}
}
+9
View File
@@ -0,0 +1,9 @@
// 首页的所有翻译
module.exports = {
// 一般检索
generalSearch: {
queryCondition: '查询条件',
retrievalMode: '检索方式',
resourceType: '资源类型'
}
}
@@ -0,0 +1,224 @@
<template>
<a-card :bordered="false">
<!-- 搜索框部分 -->
<div class="top-search-div">
<div class="top-search-div-content">
<a-input-search class="input-search" :placeholder="$t('pleaseEnter')+$t('dashboard.generalSearch.queryCondition')" enter-button @search="onSearch" />
<a class="search-link">高级搜索</a>
<a class="search-link">首页</a>
</div>
</div>
<!-- 筛选区域 -->
<div class="filter-area-div">
<!-- 检索方式 -->
<a-row :gutter="24" class="filter-row">
<a-col :md="6" class="label-col"><span class="search_label">{{ $t('dashboard.generalSearch.retrievalMode') }}</span></a-col>
<a-col :md="18" class="option-col">
<div v-for="item in retrievalModeOptions" :key="item.key" class="option-div" :class="retrievalModeCurrent === item.key ? 'option-curr' : ''" @click="retrievalModeChange(item.key)">
{{ item.label }}
</div>
</a-col>
</a-row>
<!-- 资源类型 -->
<a-row :gutter="24" class="filter-row">
<a-col :md="6" class="label-col"><span class="search_label">{{ $t('dashboard.generalSearch.resourceType') }}</span></a-col>
<a-col :md="18" class="option-col">
<div v-for="item in resourceTypeOptions" :key="item.key" class="option-div" :class="resourceTypeCurrent === item.key ? 'option-curr' : ''" @click="resourceTypeChange(item.key)">
{{ item.label }}
</div>
</a-col>
</a-row>
<!-- 其他筛选条件 -->
<template v-if="toggleSearchStatus">
<template v-for="(value, key) in selectOptions">
<a-row :key="key" :gutter="24" class="filter-row">
<a-col :md="6" class="label-col"><span class="search_label">{{ value.label }}</span></a-col>
<a-col :md="18" class="option-col">
<div v-for="item in value.options" :key="item.key" class="option-div" :class="value.current === item.key ? 'option-curr' : ''" @click="selectOptionsChange(key, item.key)">
{{ item.label }}
</div>
</a-col>
</a-row>
</template>
</template>
<div class="toggle-div" @click="handleToggleChange">
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
{{ toggleSearchStatus ? $t('putAway') : $t('open') }}
</div>
</div>
</a-card>
</template>
<script>
export default {
name: 'GeneralSearch',
data () {
return {
toggleSearchStatus: false, // 检索条件收缩还是展开, false收缩状态
retrievalModeOptions: [
{ key: 1, label: '全文检索' },
{ key: 2, label: '标题检索' }
], // 检索方式可选择项
retrievalModeCurrent: 1, // 检索方式当前选中项
resourceTypeOptions: [
{ key: 1, label: '全部' },
{ key: 2, label: '国内标准法规' },
{ key: 3, label: '海外标准法规' },
{ key: 4, label: '企业标准' },
{ key: 5, label: '动态消息' }
], // 资源类型可选择项
resourceTypeCurrent: 1, // 资源类型当前选中项
selectOptions: { // 其他筛选条件
standardCategory: { // 标准类别
label: '标准类别',
current: 1,
options: [
{ key: 1, label: 'GB', number: 3 },
{ key: 2, label: 'GB/T', number: 2 },
{ key: 3, label: 'QC/T', number: 3 },
{ key: 4, label: 'GA', number: 1 }
]
},
dynamicType: { // 动力类型
label: '动力类型',
current: 1,
options: [
{ key: 1, label: '汽油', number: 3 },
{ key: 2, label: '柴油', number: 2 },
{ key: 3, label: '纯电动', number: 3 },
{ key: 4, label: '混合动力', number: 1 },
{ key: 5, label: '燃油电池', number: 1 },
{ key: 6, label: '替代燃料', number: 1 }
]
},
applicableVehicleType: { // 适用车辆类型
label: '适用车辆类型',
current: 1,
options: [
{ key: 1, label: 'N1', number: 3 },
{ key: 2, label: 'N2', number: 2 },
{ key: 3, label: 'N3', number: 3 },
{ key: 4, label: 'M1', number: 1 },
{ key: 5, label: 'M2', number: 1 },
{ key: 6, label: 'M3', number: 1 }
]
},
standardType: { // 标准类型
label: '标准类型',
current: 1,
options: [
{ key: 1, label: '标准性', number: 3 },
{ key: 2, label: '强制性', number: 2 }
]
},
status: { // 状态
label: '状态',
current: 1,
options: [
{ key: 1, label: '即将实施', number: 3 },
{ key: 2, label: '现行有效', number: 2 },
{ key: 3, label: '废止', number: 3 }
]
}
}
}
},
methods: {
// 获取要显示数量的筛选条件的数据
initFilterData () {
},
// 查询
onSearch () {},
// 检索方式改变
retrievalModeChange (key) {
this.retrievalModeCurrent = key
},
// 资源类型改变
resourceTypeChange (key) {
this.resourceTypeCurrent = key
},
// 其他检索条件改变
selectOptionsChange (changeKey, value) {
this.selectOptions[changeKey].current = value
},
// 收齐展开点击
handleToggleChange () {
this.toggleSearchStatus = !this.toggleSearchStatus
}
}
}
</script>
<style scoped lang="less">
/deep/ .ant-card-body {
padding: 0;
}
// 头部搜索区域
.top-search-div {
width: 100%;
height: 124px;
background-image: url("../../../assets/image/searchPageBack.png");
background-size: contain;
display: flex;
justify-content: center;
align-items: center;
.input-search {
width: 468px;
height: 44px;
/deep/ .ant-input {
height: 42px;
line-height: 42px;
}
/deep/ .ant-input-search-button {
height: 42px;
}
}
.search-link {
height: 44px;
line-height: 44px;
margin-left: 32px;
border-bottom: 1px solid #D52C26;
}
}
// 筛选区域
.filter-area-div {
padding: 10px 20px;
.filter-row {
height: 44px;
line-height: 44px;
}
.label-col {
text-align: left;
color: #86909c;
}
.option-col {
height: 100%;
color: #1D2129;
display: flex;
align-items: center;
.option-div {
height: 32px;
line-height: 32px;
padding: 0 12px;
cursor: pointer;
margin: 0 4px;
}
}
}
.option-curr {
background: rgba(213, 44, 38, 0.08);
color: #D52C26;
border-radius: 4px 4px 4px 4px;
}
// 收缩展开容器
.toggle-div {
text-align: center;
cursor: pointer;
/deep/ .anticon {
height: 8px;
}
}
</style>