修改搜索中心

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
@@ -1,53 +1,89 @@
<template>
<div class="search-con-text">
<div class="search-text-wrap">
<div class="text-left">
<div class="text-left-wrap">
<div v-for="item in searchOption" :key="item.id">
<div class="text-left-select">
<span class="text-sel">{{item.value}}</span>
<a-select class="text-select" :default-value="item.option[0].value" style="width: 120px"
@change="handleChange">
<a-select-option v-for="opt in item.option" :value="opt.value">
{{opt.value}}
</a-select-option>
</a-select>
<div class="search-con-text">
<div class="search-text-wrap">
<div class="text-left">
<div class="text-left-wrap" v-for="(item,index) in searchOption" :key="index">
<div class="text-left-select" v-if="item.field_show_type == '0'">
<span class="text-sel">{{item.db_field_txt}}</span>
<a-tree-select
class="text-select"
v-model="queryParam[item.db_field_name]"
:maxTagCount="1"
:tree-data="item.tree"
tree-checkable
: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 class="table-page-search-submitButtons submitButtons">
<a-button class="box-button" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}
</a-button>
</div>
</div>
</div>
<div class="text-left-select">
<span class="text-sel">发布日期</span>
<a-date-picker class="text-select" @change="onChange"/>
</div>
<div class="text-left-select">
<span class="text-sel">标准实施日期</span>
<a-date-picker class="text-select" @change="onChange"/>
</div>
</div>
</div>
<div class="text-right">
<div class="search-text-list">
<div class="search-text-title">
<span>检索范围:</span>
<span>纯电动</span>
<div class="search-header-right">
<a-icon type="appstore" class="header-list" :title="$t('list')" :class="{'header-list-active':isTrue }"
@click="selectListModel('list')"></a-icon>
<a-icon type="unordered-list" class="header-list" :title="$t('paragraph')"
:class="{'header-list-active':!isTrue }"
@click="selectListModel('unord')"></a-icon>
</div>
</div>
<a-table
v-if="isTrue"
ref="table"
size="middle"
:scroll="{x: true}"
rowKey="id"
:data-source="tableData"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:columns="columns"
>
<div class="text-right">
<div class="search-text-list">
<div class="search-text-title">
<span>检索范围:</span>
<span>纯电动</span>
<div class="search-header-right">
<a-icon type="appstore" class="header-list" :title="$t('list')"
:class="{'header-list-active':isTrue }"
@click="selectListModel('list')"></a-icon>
<a-icon type="unordered-list" class="header-list" :title="$t('paragraph')"
:class="{'header-list-active':!isTrue }"
@click="selectListModel('unord')"></a-icon>
</div>
</div>
<a-table
v-if="isTrue"
ref="table"
size="middle"
:loading="loading"
:scroll="{x: true}"
rowKey="id"
:data-source="tableData"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:columns="columns"
>
<span slot="operation" slot-scope="record">
<a @click="Collection(record)" class="text-operation">
{{!record.collectFlag || record.collectFlag == 0 ? $t('Collection') :$t('CancelCollection')}}
@@ -57,57 +93,58 @@
</a>
<a @click="handleCompare(record)" class="text-operation"> {{$t('Push')}}</a>
</span>
<!-- 字符串超长截取省略号显示-->
<!-- <span slot="templateContent" slot-scope="text">-->
<!-- <j-ellipsis :value="text" :length="25"/>-->
<!-- </span>-->
</a-table>
<div v-if="!isTrue" class="box-content">
<a-checkbox-group v-model="checkboxText">
<li v-for="item in conList" :key="item.id">
<div style="margin-bottom: 10px;position: relative">
<a-checkbox :value="item.id" class="checkbox-left"></a-checkbox>
<div class="text-text-right"
@click="checkedClick(item)"
:class="{ 'null-input':item.checked }">
<div class="text-header">
<span>{{item.type}}</span>
<span>{{item.number}}</span>
<span>{{item.title}}</span>
<!-- 字符串超长截取省略号显示-->
<!-- <span slot="templateContent" slot-scope="text">-->
<!-- <j-ellipsis :value="text" :length="25"/>-->
<!-- </span>-->
</a-table>
<div v-if="!isTrue" class="box-content">
<a-checkbox-group v-model="checkboxText">
<li v-for="item in conList" :key="item.id">
<div style="margin-bottom: 10px;position: relative">
<a-checkbox :value="item.id" class="checkbox-left"></a-checkbox>
<div class="text-text-right"
@click="checkedClick(item)"
:class="{ 'null-input':item.checked }">
<div class="text-header">
<span>{{item.type}}</span>
<span>{{item.number}}</span>
<span>{{item.title}}</span>
</div>
<div class="text-content">
{{item.content}}
</div>
</div>
</div>
</li>
</a-checkbox-group>
</div>
<div class="text-content">
{{item.content}}
<div class="page">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSize"
:total="total"
@change="pageOnChange"
@showSizeChange="SizeChange"
/>
</div>
</div>
</div>
</li>
</a-checkbox-group>
</div>
<div class="page">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSize"
:total="total"
@change="pageOnChange"
@showSizeChange="SizeChange"
/>
</div>
</div>
</div>
</div>
<libraryPush
:url="url"
ref="libraryPushRef"
/>
</div>
<libraryPush
:url="url"
ref="libraryPushRef"
/>
</div>
</template>
<script>
import eventBUs from '../../../../common/event'
import { getAction, postAction } from '@/api/manage'
import libraryPush from '@/components/libraryPush/index'
import moment from 'moment'
export default {
name: 'DocumentLibrary',
@@ -116,117 +153,14 @@
},
data() {
return {
searchOption: [
{
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: '英国'
}
]
}
],
searchOption: [],
queryParam: {},
tableData: [
{}
],
url: {
queryCondition: 'search/document/queryCondition',
getInfoList: 'search/document/getInfoList',
pullMessage: 'document/bussDocumentLibraryEO/pullMessage'//推送
},
columns: [
@@ -325,7 +259,8 @@
],
total: 0,
pageSize: 10,
pageNo: 1
pageNo: 1,
loading: false
}
},
watch: {
@@ -345,12 +280,13 @@
this.conList = [...this.conList]
}
},
mounted() {
this.getCondition()
this.getInfoList()
},
methods: {
handleChange() {
},
onChange(date, dateString) {
// console.log(date, dateString);
},
selectListModel(val) {
this.isTrue = val == 'list' ? true : false
@@ -369,10 +305,12 @@
},
pageOnChange(page, pageSize) {
this.pageNo = page
this.getInfoList()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.getInfoList()
},
//收藏按钮
Collection(val) {
@@ -425,187 +363,246 @@
this.$refs.libraryPushRef.visible = true
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>
<style>
.table .ant-table-column-title {
font-weight: bold;
}
.table .ant-table-column-title {
font-weight: bold;
}
.ant-table td {
white-space: nowrap;
}
.ant-table td {
white-space: nowrap;
}
.checkbox-left .ant-checkbox-inner {
width: 18px !important;
height: 18px !important;
line-height: 18px !important;
}
.checkbox-left .ant-checkbox-inner {
width: 18px !important;
height: 18px !important;
line-height: 18px !important;
}
</style>
<style lang="less" scoped>
.search-con-text {
.search-con-text {
.search-text-wrap {
margin-top: -27px;
height: 100%;
display: flex;
justify-content: flex-start;
.text-left {
width: 358px;
padding: 24px 24px 24px 0;
box-sizing: border-box;
.text-left-wrap {
.text-left-select {
.search-text-wrap {
margin-top: -27px;
height: 100%;
display: flex;
justify-content: space-between;
margin-bottom: 24px;
line-height: 32px;
justify-content: flex-start;
.text-sel {
font-size: 14px;
font-weight: 400;
color: #000F16;
text-align: right;
margin-right: 14px;
width: 83px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.text-left {
width: 358px;
padding: 24px 24px 24px 0;
box-sizing: border-box;
.text-left-wrap {
.text-left-select {
display: flex;
justify-content: space-between;
margin-bottom: 24px;
line-height: 32px;
.text-sel {
font-size: 14px;
font-weight: 400;
color: #000F16;
text-align: right;
margin-right: 14px;
width: 83px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.text-select {
flex: 1;
}
}
}
}
.text-select {
flex: 1;
.text-right {
width: 100%;
position: relative;
padding: 26px 0 22px 24px;
box-sizing: border-box;
border-left: 2px solid #E6E7EC;
.search-text-title {
padding: 0 0 24px 0;
span {
font-size: 14px;
font-weight: 400;
color: #040B29;
}
.search-header-right {
float: right;
margin-top: -7px;
a-icon {
border: 1px solid rgba(0, 0, 0, 0.65);
cursor: pointer;
padding: 2px 5px;
border-right: none;
}
a-icon:last-child {
border-right: 1px solid rgba(0, 0, 0, 0.65);
}
.header-list {
font-size: 20px;
border: 1px solid gray;
border-radius: 3px;
padding: 3px;
}
.header-list:hover {
color: #00B3BE;
border: 1px solid #00B3BE;
}
.header-list-active {
border: 1px solid #00B3BE;
color: #00B3BE;
}
}
}
.search-text-list {
ul {
padding: 0 0 0 18px;
margin: 0;
li {
list-style: none;
.text-content {
font-size: 14px;
font-weight: 400;
color: #040B29;
opacity: 0.8;
}
}
}
}
}
}
}
}
}
.text-right {
width: 100%;
position: relative;
padding: 26px 0 22px 24px;
.checkbox-left {
float: left;
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
}
.text-text-right {
padding: 19px 28px;
box-sizing: border-box;
border-left: 2px solid #E6E7EC;
margin-left: 38px;
}
.search-text-title {
padding: 0 0 24px 0;
.null-input {
background-color: #F2F4F8;
}
span {
font-size: 14px;
font-weight: 400;
.text-header {
margin-bottom: 11px;
span {
margin-right: 52px;
font-size: 16px;
font-weight: bold;
color: #040B29;
}
.search-header-right {
float: right;
margin-top: -7px;
a-icon {
border: 1px solid rgba(0, 0, 0, 0.65);
cursor: pointer;
padding: 2px 5px;
border-right: none;
}
a-icon:last-child {
border-right: 1px solid rgba(0, 0, 0, 0.65);
}
.header-list {
font-size: 20px;
border: 1px solid gray;
border-radius: 3px;
padding: 3px;
}
.header-list:hover {
color: #00B3BE;
border: 1px solid #00B3BE;
}
.header-list-active {
border: 1px solid #00B3BE;
color: #00B3BE;
}
}
}
.search-text-list {
ul {
padding: 0 0 0 18px;
margin: 0;
li {
list-style: none;
.text-content {
font-size: 14px;
font-weight: 400;
color: #040B29;
opacity: 0.8;
}
}
}
}
}
}
}
.checkbox-left {
float: left;
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
}
.text-text-right {
padding: 19px 28px;
box-sizing: border-box;
margin-left: 38px;
}
.null-input {
background-color: #F2F4F8;
}
.text-header {
margin-bottom: 11px;
span {
margin-right: 52px;
font-size: 16px;
font-weight: bold;
color: #040B29;
.text-content {
font-size: 14px;
font-weight: 400;
color: #040B29;
opacity: 0.7;
}
}
.text-content {
font-size: 14px;
font-weight: 400;
color: #040B29;
opacity: 0.7;
}
.box-content {
padding: 0 0 0 8px;
box-sizing: border-box;
}
.box-content {
padding: 0 0 0 8px;
box-sizing: border-box;
}
.page {
text-align: right;
margin-top: 20px;
}
.page {
text-align: right;
margin-top: 20px;
}
.text-operation {
margin-right: 8px;
}
.text-operation {
margin-right: 8px;
}
.submitButtons{
text-align: center;
}
</style>
@@ -5,12 +5,11 @@
<div class="search-detail">
<div class="search-detail-wrap">
<a-input-group class="input-group" compact v-if="active === $t('DocumentLibrary')">
<a-select default-value="Option1">
<a-select-option value="Option1">
标题
</a-select-option>
<a-select-option value="Option2">
Option2
<a-select v-model="selectModel">
<a-select-option :value="item.db_field_name"
@change="selectChange"
v-for="(item,index) in searchOption" :key="index">
{{item.db_field_txt}}
</a-select-option>
</a-select>
<a-input-search
@@ -42,8 +41,8 @@
</a-tabs>
</div>
</div>
<whole v-if="active === $t('whole')"/>
<DocumentLibrary v-else-if="active === $t('DocumentLibrary')"/>
<whole :url="url" v-if="active === $t('whole')"/>
<DocumentLibrary ref="DocumentLibraryRef" v-else-if="active === $t('DocumentLibrary')"/>
</div>
</div>
</div>
@@ -53,6 +52,7 @@
<script>
import whole from './components/whole'
import DocumentLibrary from './components/DocumentLibrary'
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
export default {
name: 'searchCenter',
@@ -63,16 +63,45 @@
data() {
return {
active: this.$t('whole'),
showList: false
showList: false,
url: {
queryCondition: 'search/document/queryCondition'
},
selectModel: '',
queryParam: {}
}
},
mounted() {
this.getCondition()
},
methods: {
callback(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;
line-height: 40px;
}
.input-group .ant-select-selection{
.input-group .ant-select-selection {
width: 88px;
height: 40px;
line-height: 40px;
padding: 0 0 0 6px;
}
.input-group .ant-select-selection__rendered{
.input-group .ant-select-selection__rendered {
height: 40px;
line-height: 40px;
}
.input-group .ant-input{
.input-group .ant-input {
height: 40px;
line-height: 40px;
}
.input-group .ant-select-arrow{
.input-group .ant-select-arrow {
right: 15px;
}
.input-group .ant-select{
.input-group .ant-select {
background: #F6F7FA;
}
</style>