修改搜索中心

This commit is contained in:
qq787203167
2022-03-15 15:27:46 +08:00
parent 1a2190f12d
commit a4744b0f39
2 changed files with 401 additions and 370 deletions
@@ -2,27 +2,61 @@
<div class="search-con-text"> <div class="search-con-text">
<div class="search-text-wrap"> <div class="search-text-wrap">
<div class="text-left"> <div class="text-left">
<div class="text-left-wrap"> <div class="text-left-wrap" v-for="(item,index) in searchOption" :key="index">
<div v-for="item in searchOption" :key="item.id"> <div class="text-left-select" v-if="item.field_show_type == '0'">
<div class="text-left-select"> <span class="text-sel">{{item.db_field_txt}}</span>
<span class="text-sel">{{item.value}}</span> <a-tree-select
<a-select class="text-select" :default-value="item.option[0].value" style="width: 120px" class="text-select"
@change="handleChange"> v-model="queryParam[item.db_field_name]"
<a-select-option v-for="opt in item.option" :value="opt.value"> :maxTagCount="1"
{{opt.value}} :tree-data="item.tree"
</a-select-option> tree-checkable
</a-select> :placeholder="$t('PleaseSelect')+item.db_field_txt"
/>
</div>
<div class="text-left-select" v-if="item.field_show_type == '1' || item.field_show_type == '8' ||
item.field_show_type == '9' || item.field_show_type == '10' || item.field_show_type == '11'">
<span class="text-sel">{{item.db_field_txt}}</span>
<a-input class="text-select"
v-model="queryParam[item.db_field_name]"
:placeholder="$t('PleaseEnter')+item.db_field_txt"/>
</div>
<div class="text-left-select" v-if="item.field_show_type == '2'">
<span class="text-sel">{{item.db_field_txt}}</span>
<a-input-number class="text-select" :placeholder="$t('PleaseEnter')+item.db_field_txt"
v-model="queryParam[item.db_field_name]" :min="1" :max="99999999"/>
</div>
<div class="text-left-select" v-if="item.field_show_type == '3'">
<span class="text-sel">{{item.db_field_txt}}</span>
<j-dict-select-tag class="text-select" v-model="queryParam[item.db_field_name]"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
:type="'select'"
:triggerChange="false" :dictCode="item.dict_field"/>
</div>
<div class="text-left-select" v-if="item.field_show_type == '4'">
<span class="text-sel">{{item.db_field_txt}}</span>
<j-multi-select-tag class="text-select" v-model="queryParam[item.db_field_name]"
:placeholder="$t('PleaseSelect')+item.db_field_txt" :type="'select'"
:triggerChange="false" :dictCode="item.dict_field"/>
</div>
<div class="text-left-select" v-if="item.field_show_type == '5'">
<span class="text-sel">{{item.db_field_txt}}</span>
<a-date-picker class="text-select"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
@change="dateChange(item.db_field_name)"
v-model="queryParam[item.db_field_name]"/>
</div>
<div class="text-left-select" v-if="item.field_show_type == '6'">
<span class="text-sel">{{item.db_field_txt}}</span>
<a-range-picker class="text-select" v-model="queryParam[item.db_field_name]"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
@change="onChange(item.db_field_name)"></a-range-picker>
</div> </div>
</div> </div>
<div class="table-page-search-submitButtons submitButtons">
<div class="text-left-select"> <a-button class="box-button" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
<span class="text-sel">发布日期</span> <a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}
<a-date-picker class="text-select" @change="onChange"/> </a-button>
</div>
<div class="text-left-select">
<span class="text-sel">标准实施日期</span>
<a-date-picker class="text-select" @change="onChange"/>
</div>
</div> </div>
</div> </div>
<div class="text-right"> <div class="text-right">
@@ -31,7 +65,8 @@
<span>检索范围:</span> <span>检索范围:</span>
<span>纯电动</span> <span>纯电动</span>
<div class="search-header-right"> <div class="search-header-right">
<a-icon type="appstore" class="header-list" :title="$t('list')" :class="{'header-list-active':isTrue }" <a-icon type="appstore" class="header-list" :title="$t('list')"
:class="{'header-list-active':isTrue }"
@click="selectListModel('list')"></a-icon> @click="selectListModel('list')"></a-icon>
<a-icon type="unordered-list" class="header-list" :title="$t('paragraph')" <a-icon type="unordered-list" class="header-list" :title="$t('paragraph')"
:class="{'header-list-active':!isTrue }" :class="{'header-list-active':!isTrue }"
@@ -42,6 +77,7 @@
v-if="isTrue" v-if="isTrue"
ref="table" ref="table"
size="middle" size="middle"
:loading="loading"
:scroll="{x: true}" :scroll="{x: true}"
rowKey="id" rowKey="id"
:data-source="tableData" :data-source="tableData"
@@ -108,6 +144,7 @@
import eventBUs from '../../../../common/event' import eventBUs from '../../../../common/event'
import { getAction, postAction } from '@/api/manage' import { getAction, postAction } from '@/api/manage'
import libraryPush from '@/components/libraryPush/index' import libraryPush from '@/components/libraryPush/index'
import moment from 'moment'
export default { export default {
name: 'DocumentLibrary', name: 'DocumentLibrary',
@@ -116,117 +153,14 @@
}, },
data() { data() {
return { return {
searchOption: [ searchOption: [],
{ queryParam: {},
id: 1,
label: 'categary',
value: '适用区域',
option: [
{
label: 'china',
value: '中国'
},
{
label: 'english',
value: '英国'
}
]
},
{
id: 2,
label: 'type',
value: '类别',
option: [
{
label: 'china',
value: '中国'
},
{
label: 'english',
value: '英国'
}
]
},
{
id: 3,
label: 'stand',
value: '标准体系',
option: [
{
label: 'china',
value: '中国'
},
{
label: 'english',
value: '英国'
}
]
},
{
id: 4,
label: 'state',
value: '状态',
option: [
{
label: 'china',
value: '中国'
},
{
label: 'english',
value: '英国'
}
]
},
{
id: 5,
label: 'trial',
value: '适用范围',
option: [
{
label: 'china',
value: '中国'
},
{
label: 'english',
value: '英国'
}
]
},
{
id: 6,
label: 'funArea',
value: '功能领域',
option: [
{
label: 'china',
value: '中国'
},
{
label: 'english',
value: '英国'
}
]
},
{
id: 7,
label: 'techArea',
value: '技术领域',
option: [
{
label: 'china',
value: '中国'
},
{
label: 'english',
value: '英国'
}
]
}
],
tableData: [ tableData: [
{} {}
], ],
url: { url: {
queryCondition: 'search/document/queryCondition',
getInfoList: 'search/document/getInfoList',
pullMessage: 'document/bussDocumentLibraryEO/pullMessage'//推送 pullMessage: 'document/bussDocumentLibraryEO/pullMessage'//推送
}, },
columns: [ columns: [
@@ -325,7 +259,8 @@
], ],
total: 0, total: 0,
pageSize: 10, pageSize: 10,
pageNo: 1 pageNo: 1,
loading: false
} }
}, },
watch: { watch: {
@@ -345,12 +280,13 @@
this.conList = [...this.conList] this.conList = [...this.conList]
} }
}, },
mounted() {
this.getCondition()
this.getInfoList()
},
methods: { methods: {
handleChange() { handleChange() {
},
onChange(date, dateString) {
// console.log(date, dateString);
}, },
selectListModel(val) { selectListModel(val) {
this.isTrue = val == 'list' ? true : false this.isTrue = val == 'list' ? true : false
@@ -369,10 +305,12 @@
}, },
pageOnChange(page, pageSize) { pageOnChange(page, pageSize) {
this.pageNo = page this.pageNo = page
this.getInfoList()
}, },
SizeChange(page, pageSize) { SizeChange(page, pageSize) {
this.pageNo = 1 this.pageNo = 1
this.pageSize = pageSize this.pageSize = pageSize
this.getInfoList()
}, },
//收藏按钮 //收藏按钮
Collection(val) { Collection(val) {
@@ -425,7 +363,63 @@
this.$refs.libraryPushRef.visible = true this.$refs.libraryPushRef.visible = true
this.$refs.libraryPushRef.tableKey = item.id.split(',') this.$refs.libraryPushRef.tableKey = item.id.split(',')
}) })
},
dateChange(item) {
this.queryParam[item] = moment(this.queryParam[item]).format('YYYY-MM-DD')
},
onChange(item) {
let dateOne = moment(this.queryParam[item][0]).format('YYYY-MM-DD')
let dateTwo = moment(this.queryParam[item][1]).format('YYYY-MM-DD')
this.queryParam[item] = [dateOne, dateTwo]
},
getCondition() {
let query = {
flag: 1,
searchFlag: 0
} }
getAction(this.url.queryCondition, query).then((res) => {
if (res.success) {
this.searchOption = res.result
} else {
this.searchOption = []
}
})
},
searchQuery() {
this.pageNo = 1
this.getInfoList()
},
searchData(data) {
this.queryParam = { ...data, ...this.queryParam }
},
getInfoList() {
let queryParam = JSON.parse(JSON.stringify(this.queryParam))
Object.keys(queryParam).forEach(val => {
if (queryParam[val] instanceof Array) {
queryParam[val] = queryParam[val].join(',')
}
})
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
...queryParam
}
this.loading = true
getAction(this.url.getInfoList, query).then((res) => {
if (res.success) {
this.dataSource = res.result.records
this.total = res.result.total
this.loading = false
} else {
this.loading = false
}
})
},
searchReset(){
this.pageNo = 1
this.queryParam = {}
this.getInfoList()
},
} }
} }
</script> </script>
@@ -608,4 +602,7 @@
.text-operation { .text-operation {
margin-right: 8px; margin-right: 8px;
} }
.submitButtons{
text-align: center;
}
</style> </style>
@@ -5,12 +5,11 @@
<div class="search-detail"> <div class="search-detail">
<div class="search-detail-wrap"> <div class="search-detail-wrap">
<a-input-group class="input-group" compact v-if="active === $t('DocumentLibrary')"> <a-input-group class="input-group" compact v-if="active === $t('DocumentLibrary')">
<a-select default-value="Option1"> <a-select v-model="selectModel">
<a-select-option value="Option1"> <a-select-option :value="item.db_field_name"
标题 @change="selectChange"
</a-select-option> v-for="(item,index) in searchOption" :key="index">
<a-select-option value="Option2"> {{item.db_field_txt}}
Option2
</a-select-option> </a-select-option>
</a-select> </a-select>
<a-input-search <a-input-search
@@ -42,8 +41,8 @@
</a-tabs> </a-tabs>
</div> </div>
</div> </div>
<whole v-if="active === $t('whole')"/> <whole :url="url" v-if="active === $t('whole')"/>
<DocumentLibrary v-else-if="active === $t('DocumentLibrary')"/> <DocumentLibrary ref="DocumentLibraryRef" v-else-if="active === $t('DocumentLibrary')"/>
</div> </div>
</div> </div>
</div> </div>
@@ -53,6 +52,7 @@
<script> <script>
import whole from './components/whole' import whole from './components/whole'
import DocumentLibrary from './components/DocumentLibrary' import DocumentLibrary from './components/DocumentLibrary'
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
export default { export default {
name: 'searchCenter', name: 'searchCenter',
@@ -63,16 +63,45 @@
data() { data() {
return { return {
active: this.$t('whole'), active: this.$t('whole'),
showList: false showList: false,
url: {
queryCondition: 'search/document/queryCondition'
},
selectModel: '',
queryParam: {}
} }
}, },
mounted() {
this.getCondition()
},
methods: { methods: {
callback(key) { callback(key) {
this.active = key this.active = key
}, },
onSearch() { onSearch(event) {
this.queryParam[this.selectModel] = event
if (this.$refs.DocumentLibraryRef){
this.$refs.DocumentLibraryRef.searchData(this.queryParam)
}
},
selectChange(event) {
console.log(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
}
} else {
this.searchOption = []
}
})
} }
} }
} }
@@ -139,24 +168,29 @@
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
} }
.input-group .ant-select-selection{
.input-group .ant-select-selection {
width: 88px; width: 88px;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
padding: 0 0 0 6px; padding: 0 0 0 6px;
} }
.input-group .ant-select-selection__rendered{
.input-group .ant-select-selection__rendered {
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
} }
.input-group .ant-input{
.input-group .ant-input {
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
} }
.input-group .ant-select-arrow{
.input-group .ant-select-arrow {
right: 15px; right: 15px;
} }
.input-group .ant-select{
.input-group .ant-select {
background: #F6F7FA; background: #F6F7FA;
} }
</style> </style>